From deacbd0b6f059b2382e9ed745cd35057fb15fa9d Mon Sep 17 00:00:00 2001 From: Argo-iMac Date: Sun, 9 Mar 2025 11:38:16 +0800 Subject: [PATCH 01/12] style: memorial mode --- .../wwwroot/scss/meilisearch.scss | 66 +++---- src/BootstrapBlazor/wwwroot/scss/root.scss | 182 +++++++++--------- 2 files changed, 128 insertions(+), 120 deletions(-) diff --git a/src/BootstrapBlazor/wwwroot/scss/meilisearch.scss b/src/BootstrapBlazor/wwwroot/scss/meilisearch.scss index 6bbf3337385..c175bc3fa01 100644 --- a/src/BootstrapBlazor/wwwroot/scss/meilisearch.scss +++ b/src/BootstrapBlazor/wwwroot/scss/meilisearch.scss @@ -1,43 +1,43 @@ .bb-g-search { - --bb-global-search-input-margin-left: .5rem; - --bb-global-search-border-color: rgba(255,255,255,.5); - --bb-global-search-color: rgba(255,255,255,.5); - --bb-global-search-border-hover-color: rgba(255,255,255); - --bb-global-search-padding: 0.25rem 0.75rem; - --bb-global-search-width: 168px; - display: flex; - align-items: center; - color: var(--bb-global-search-color); - border: var(--bs-border-width) solid var(--bb-global-search-border-color); - border-radius: var(--bs-border-radius); - padding: var(--bb-global-search-padding); - width: var(--bb-global-search-width); - transition: border-color .3s linear; + --bb-global-search-input-margin-left: .5rem; + --bb-global-search-border-color: rgba(255, 255, 255, .5); + --bb-global-search-color: rgba(255, 255, 255, .5); + --bb-global-search-border-hover-color: rgba(255, 255, 255); + --bb-global-search-padding: 0.25rem 0.75rem; + --bb-global-search-width: 168px; + display: flex; + align-items: center; + color: var(--bb-global-search-color); + border: var(--bs-border-width) solid var(--bb-global-search-border-color); + border-radius: var(--bs-border-radius); + padding: var(--bb-global-search-padding); + width: var(--bb-global-search-width); + transition: border-color .3s linear; - &:hover { - border: var(--bs-border-width) solid var(--bb-global-search-border-hover-color); - } + &:hover { + border: var(--bs-border-width) solid var(--bb-global-search-border-hover-color); + } - > input { - width: 100%; - background-color: transparent; - border: none; - line-height: 1.5; - padding: 0; - margin-left: var(--bb-global-search-input-margin-left); - cursor: pointer; + > input { + width: 100%; + background-color: transparent; + border: none; + line-height: 1.5; + padding: 0; + margin-left: var(--bb-global-search-input-margin-left); + cursor: pointer; - &::placeholder { - color: var(--bb-global-search-border-color); - } + &::placeholder { + color: var(--bb-global-search-border-color); } + } - .search-dialog-icon { - cursor: pointer; - font-size: 18px; - } + .search-dialog-icon { + cursor: pointer; + font-size: 18px; + } } .search-dialog-mask { - display: none; + display: none; } diff --git a/src/BootstrapBlazor/wwwroot/scss/root.scss b/src/BootstrapBlazor/wwwroot/scss/root.scss index 9b94bab5629..bb8408351a2 100644 --- a/src/BootstrapBlazor/wwwroot/scss/root.scss +++ b/src/BootstrapBlazor/wwwroot/scss/root.scss @@ -1,13 +1,13 @@ :root { - --bb-primary-color: #{$bb-primary-color}; - --bb-primary-color-rgb: #{$bb-primary-color-rgb}; - --bb-border-focus-color: #{$bb-border-focus-color}; - --bb-border-hover-color: #{$bb-border-hover-color}; - --bb-height: #{$bb-height}; - --bb-dropdown-max-height: #{$bb-dropdown-max-height}; - --bb-shadow: #{$bb-shadow}; - --bb-hover-shadow: #{$bb-hover-shadow}; - --bb-font-size: #{$bb-font-size}; + --bb-primary-color: #{$bb-primary-color}; + --bb-primary-color-rgb: #{$bb-primary-color-rgb}; + --bb-border-focus-color: #{$bb-border-focus-color}; + --bb-border-hover-color: #{$bb-border-hover-color}; + --bb-height: #{$bb-height}; + --bb-dropdown-max-height: #{$bb-dropdown-max-height}; + --bb-shadow: #{$bb-shadow}; + --bb-hover-shadow: #{$bb-hover-shadow}; + --bb-font-size: #{$bb-font-size}; } body, @@ -15,148 +15,156 @@ body, .dropdown-menu, .form-select, .input-group-text { - font-size: var(--bb-font-size); + font-size: var(--bb-font-size); } a, [for] { - cursor: pointer; + cursor: pointer; } a, a:hover, a:focus { - text-decoration: none; + text-decoration: none; } [disabled], :disabled, .disabled, .disabled > * { - cursor: not-allowed !important; + cursor: not-allowed !important; } .disabled .range-separator, :disabled { - background-color: var(--bs-secondary-bg); - opacity: 1; + background-color: var(--bs-secondary-bg); + opacity: 1; } :focus-visible, :focus { - outline: none; + outline: none; } @mixin direction($var, $child) { - > .datetime-picker:not(:#{$child}-child) .form-control, - > .select:not(:#{$child}-child) .form-control, - > .switch:not(:#{$child}-child), - > .multi-select:not(:#{$child}-child) .dropdown-toggle, - > [data-bs-toggle]:not(:#{$child}-child) > .form-control, - > .auto-complete:not(:#{$child}-child) .form-control { - border-top-#{$var}-radius: 0; - border-bottom-#{$var}-radius: 0; - } + > .datetime-picker:not(:#{$child}-child) .form-control, + > .select:not(:#{$child}-child) .form-control, + > .switch:not(:#{$child}-child), + > .multi-select:not(:#{$child}-child) .dropdown-toggle, + > [data-bs-toggle]:not(:#{$child}-child) > .form-control, + > .auto-complete:not(:#{$child}-child) .form-control { + border-top-#{$var}-radius: 0; + border-bottom-#{$var}-radius: 0; + } } .input-group { - @include direction(right,last); - @include direction(left,first) + @include direction(right, last); + @include direction(left, first) } .btn-group { - @include direction(right,last); - @include direction(left,first) + @include direction(right, last); + @include direction(left, first) } .popover.popover-table-column-toolbox { - --bs-popover-min-width: 120px; - --bs-popover-header-font-size: 12px; - --bs-popover-header-padding-x: 0.5rem; - --bs-popover-header-padding-y: 0.5rem; - --bs-popover-body-padding-x: 0.5rem; - --bs-popover-body-padding-y: 0.5rem; + --bs-popover-min-width: 120px; + --bs-popover-header-font-size: 12px; + --bs-popover-header-padding-x: 0.5rem; + --bs-popover-header-padding-y: 0.5rem; + --bs-popover-body-padding-x: 0.5rem; + --bs-popover-body-padding-y: 0.5rem; } ::view-transition-old(*) { - mix-blend-mode: normal; - animation: none; - z-index: 1; + mix-blend-mode: normal; + animation: none; + z-index: 1; } ::view-transition-new(*) { - mix-blend-mode: normal; - animation: clip .3s ease-in-out; - z-index: 9999; + mix-blend-mode: normal; + animation: clip .3s ease-in-out; + z-index: 9999; } @keyframes clip { - from { - clip-path: circle(0% at var(--bb-theme-x) var(--bb-theme-y)); - } + from { + clip-path: circle(0% at var(--bb-theme-x) var(--bb-theme-y)); + } - to { - clip-path: circle(100% at var(--bb-theme-x) var(--bb-theme-y)); - } + to { + clip-path: circle(100% at var(--bb-theme-x) var(--bb-theme-y)); + } } [data-bs-theme='dark'] { - &::view-transition-old(*) { - animation: clip2 .3s ease-in-out; - z-index: 9999; - } + &::view-transition-old(*) { + animation: clip2 .3s ease-in-out; + z-index: 9999; + } - &::view-transition-new(*) { - animation: none; - z-index: 1; - } + &::view-transition-new(*) { + animation: none; + z-index: 1; + } } @keyframes clip2 { - from { - clip-path: circle(100% at var(--bb-theme-x) var(--bb-theme-y)); - } + from { + clip-path: circle(100% at var(--bb-theme-x) var(--bb-theme-y)); + } + + to { + clip-path: circle(0% at var(--bb-theme-x) var(--bb-theme-y)); + } +} - to { - clip-path: circle(0% at var(--bb-theme-x) var(--bb-theme-y)); - } +[data-bs-theme='memorial'] { + &:root { + --bs-body-bg: #000; + --bs-body-color: #b5b5c3; + filter: grayscale(100%); + } } body:before { - content: "extraExtraSmall"; - display: none; + content: "extraExtraSmall"; + display: none; } -@media (min-width:375px) { - body:before { - content: "extraSmall"; - } +@media (min-width: 375px) { + body:before { + content: "extraSmall"; + } } -@media (min-width:576px) { - body:before { - content: "small"; - } +@media (min-width: 576px) { + body:before { + content: "small"; + } } -@media (min-width:768px) { - body:before { - content: "medium"; - } +@media (min-width: 768px) { + body:before { + content: "medium"; + } } -@media (min-width:992px) { - body:before { - content: "large"; - } +@media (min-width: 992px) { + body:before { + content: "large"; + } } -@media (min-width:1200px) { - body:before { - content: "extraLarge"; - } +@media (min-width: 1200px) { + body:before { + content: "extraLarge"; + } } -@media (min-width:1400px) { - body:before { - content: "extraExtraLarge"; - } +@media (min-width: 1400px) { + body:before { + content: "extraExtraLarge"; + } } From 36dfc04fe9764e77949b553962c54e199da5efdb Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 11:40:37 +0800 Subject: [PATCH 02/12] =?UTF-8?q?refactor:=20=E6=92=A4=E9=94=80=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/scss/meilisearch.scss | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/BootstrapBlazor/wwwroot/scss/meilisearch.scss b/src/BootstrapBlazor/wwwroot/scss/meilisearch.scss index c175bc3fa01..f8c937f451f 100644 --- a/src/BootstrapBlazor/wwwroot/scss/meilisearch.scss +++ b/src/BootstrapBlazor/wwwroot/scss/meilisearch.scss @@ -1,43 +1,43 @@ .bb-g-search { - --bb-global-search-input-margin-left: .5rem; - --bb-global-search-border-color: rgba(255, 255, 255, .5); - --bb-global-search-color: rgba(255, 255, 255, .5); - --bb-global-search-border-hover-color: rgba(255, 255, 255); - --bb-global-search-padding: 0.25rem 0.75rem; - --bb-global-search-width: 168px; - display: flex; - align-items: center; - color: var(--bb-global-search-color); - border: var(--bs-border-width) solid var(--bb-global-search-border-color); - border-radius: var(--bs-border-radius); - padding: var(--bb-global-search-padding); - width: var(--bb-global-search-width); - transition: border-color .3s linear; + --bb-global-search-input-margin-left: .5rem; + --bb-global-search-border-color: rgba(255, 255, 255, .5); + --bb-global-search-color: rgba(255, 255, 255, .5); + --bb-global-search-border-hover-color: rgba(255, 255, 255); + --bb-global-search-padding: 0.25rem 0.75rem; + --bb-global-search-width: 168px; + display: flex; + align-items: center; + color: var(--bb-global-search-color); + border: var(--bs-border-width) solid var(--bb-global-search-border-color); + border-radius: var(--bs-border-radius); + padding: var(--bb-global-search-padding); + width: var(--bb-global-search-width); + transition: border-color .3s linear; - &:hover { - border: var(--bs-border-width) solid var(--bb-global-search-border-hover-color); - } + &:hover { + border: var(--bs-border-width) solid var(--bb-global-search-border-hover-color); + } - > input { - width: 100%; - background-color: transparent; - border: none; - line-height: 1.5; - padding: 0; - margin-left: var(--bb-global-search-input-margin-left); - cursor: pointer; + > input { + width: 100%; + background-color: transparent; + border: none; + line-height: 1.5; + padding: 0; + margin-left: var(--bb-global-search-input-margin-left); + cursor: pointer; - &::placeholder { - color: var(--bb-global-search-border-color); + &::placeholder { + color: var(--bb-global-search-border-color); + } } - } - .search-dialog-icon { - cursor: pointer; - font-size: 18px; - } + .search-dialog-icon { + cursor: pointer; + font-size: 18px; + } } .search-dialog-mask { - display: none; + display: none; } From 715e16cddb916403250dfe1ec957bf20a4d52b19 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 11:40:48 +0800 Subject: [PATCH 03/12] =?UTF-8?q?refactor:=20=E6=92=A4=E9=94=80=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/wwwroot/scss/root.scss | 172 ++++++++++----------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/src/BootstrapBlazor/wwwroot/scss/root.scss b/src/BootstrapBlazor/wwwroot/scss/root.scss index bb8408351a2..1190b0a8518 100644 --- a/src/BootstrapBlazor/wwwroot/scss/root.scss +++ b/src/BootstrapBlazor/wwwroot/scss/root.scss @@ -1,13 +1,13 @@ :root { - --bb-primary-color: #{$bb-primary-color}; - --bb-primary-color-rgb: #{$bb-primary-color-rgb}; - --bb-border-focus-color: #{$bb-border-focus-color}; - --bb-border-hover-color: #{$bb-border-hover-color}; - --bb-height: #{$bb-height}; - --bb-dropdown-max-height: #{$bb-dropdown-max-height}; - --bb-shadow: #{$bb-shadow}; - --bb-hover-shadow: #{$bb-hover-shadow}; - --bb-font-size: #{$bb-font-size}; + --bb-primary-color: #{$bb-primary-color}; + --bb-primary-color-rgb: #{$bb-primary-color-rgb}; + --bb-border-focus-color: #{$bb-border-focus-color}; + --bb-border-hover-color: #{$bb-border-hover-color}; + --bb-height: #{$bb-height}; + --bb-dropdown-max-height: #{$bb-dropdown-max-height}; + --bb-shadow: #{$bb-shadow}; + --bb-hover-shadow: #{$bb-hover-shadow}; + --bb-font-size: #{$bb-font-size}; } body, @@ -15,156 +15,156 @@ body, .dropdown-menu, .form-select, .input-group-text { - font-size: var(--bb-font-size); + font-size: var(--bb-font-size); } a, [for] { - cursor: pointer; + cursor: pointer; } a, a:hover, a:focus { - text-decoration: none; + text-decoration: none; } [disabled], :disabled, .disabled, .disabled > * { - cursor: not-allowed !important; + cursor: not-allowed !important; } .disabled .range-separator, :disabled { - background-color: var(--bs-secondary-bg); - opacity: 1; + background-color: var(--bs-secondary-bg); + opacity: 1; } :focus-visible, :focus { - outline: none; + outline: none; } @mixin direction($var, $child) { - > .datetime-picker:not(:#{$child}-child) .form-control, - > .select:not(:#{$child}-child) .form-control, - > .switch:not(:#{$child}-child), - > .multi-select:not(:#{$child}-child) .dropdown-toggle, - > [data-bs-toggle]:not(:#{$child}-child) > .form-control, - > .auto-complete:not(:#{$child}-child) .form-control { - border-top-#{$var}-radius: 0; - border-bottom-#{$var}-radius: 0; - } + > .datetime-picker:not(:#{$child}-child) .form-control, + > .select:not(:#{$child}-child) .form-control, + > .switch:not(:#{$child}-child), + > .multi-select:not(:#{$child}-child) .dropdown-toggle, + > [data-bs-toggle]:not(:#{$child}-child) > .form-control, + > .auto-complete:not(:#{$child}-child) .form-control { + border-top-#{$var}-radius: 0; + border-bottom-#{$var}-radius: 0; + } } .input-group { - @include direction(right, last); - @include direction(left, first) + @include direction(right, last); + @include direction(left, first) } .btn-group { - @include direction(right, last); - @include direction(left, first) + @include direction(right, last); + @include direction(left, first) } .popover.popover-table-column-toolbox { - --bs-popover-min-width: 120px; - --bs-popover-header-font-size: 12px; - --bs-popover-header-padding-x: 0.5rem; - --bs-popover-header-padding-y: 0.5rem; - --bs-popover-body-padding-x: 0.5rem; - --bs-popover-body-padding-y: 0.5rem; + --bs-popover-min-width: 120px; + --bs-popover-header-font-size: 12px; + --bs-popover-header-padding-x: 0.5rem; + --bs-popover-header-padding-y: 0.5rem; + --bs-popover-body-padding-x: 0.5rem; + --bs-popover-body-padding-y: 0.5rem; } ::view-transition-old(*) { - mix-blend-mode: normal; - animation: none; - z-index: 1; + mix-blend-mode: normal; + animation: none; + z-index: 1; } ::view-transition-new(*) { - mix-blend-mode: normal; - animation: clip .3s ease-in-out; - z-index: 9999; + mix-blend-mode: normal; + animation: clip .3s ease-in-out; + z-index: 9999; } @keyframes clip { - from { - clip-path: circle(0% at var(--bb-theme-x) var(--bb-theme-y)); - } + from { + clip-path: circle(0% at var(--bb-theme-x) var(--bb-theme-y)); + } - to { - clip-path: circle(100% at var(--bb-theme-x) var(--bb-theme-y)); - } + to { + clip-path: circle(100% at var(--bb-theme-x) var(--bb-theme-y)); + } } [data-bs-theme='dark'] { - &::view-transition-old(*) { - animation: clip2 .3s ease-in-out; - z-index: 9999; - } + &::view-transition-old(*) { + animation: clip2 .3s ease-in-out; + z-index: 9999; + } - &::view-transition-new(*) { - animation: none; - z-index: 1; - } + &::view-transition-new(*) { + animation: none; + z-index: 1; + } } @keyframes clip2 { - from { - clip-path: circle(100% at var(--bb-theme-x) var(--bb-theme-y)); - } + from { + clip-path: circle(100% at var(--bb-theme-x) var(--bb-theme-y)); + } - to { - clip-path: circle(0% at var(--bb-theme-x) var(--bb-theme-y)); - } + to { + clip-path: circle(0% at var(--bb-theme-x) var(--bb-theme-y)); + } } [data-bs-theme='memorial'] { - &:root { - --bs-body-bg: #000; - --bs-body-color: #b5b5c3; - filter: grayscale(100%); - } + &:root { + --bs-body-bg: #000; + --bs-body-color: #b5b5c3; + filter: grayscale(100%); + } } body:before { - content: "extraExtraSmall"; - display: none; + content: "extraExtraSmall"; + display: none; } @media (min-width: 375px) { - body:before { - content: "extraSmall"; - } + body:before { + content: "extraSmall"; + } } @media (min-width: 576px) { - body:before { - content: "small"; - } + body:before { + content: "small"; + } } @media (min-width: 768px) { - body:before { - content: "medium"; - } + body:before { + content: "medium"; + } } @media (min-width: 992px) { - body:before { - content: "large"; - } + body:before { + content: "large"; + } } @media (min-width: 1200px) { - body:before { - content: "extraLarge"; - } + body:before { + content: "extraLarge"; + } } @media (min-width: 1400px) { - body:before { - content: "extraExtraLarge"; - } + body:before { + content: "extraExtraLarge"; + } } From 117ecd86047dbfb810976fe0715b946493d08277 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 13:24:15 +0800 Subject: [PATCH 04/12] =?UTF-8?q?doc:=20=E6=9B=B4=E6=94=B9=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Options/BootstrapBlazorOptions.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs b/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs index 139868f135e..b0d30f872ed 100644 --- a/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs +++ b/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs @@ -9,126 +9,126 @@ namespace BootstrapBlazor.Components; /// -/// 组件全局配置类 +/// Global configuration class for components /// public class BootstrapBlazorOptions : IOptions { /// - /// 获得/设置 Toast 组件 Delay 默认值 默认为 0 + /// Gets or sets the default delay for the Toast component, default is 0 /// public int ToastDelay { get; set; } /// - /// 获得/设置 Message 组件 Delay 默认值 默认为 0 + /// Gets or sets the default delay for the Message component, default is 0 /// public int MessageDelay { get; set; } /// - /// 获得/设置 Swal 组件 Delay 默认值 默认为 0 + /// Gets or sets the default delay for the Swal component, default is 0 /// public int SwalDelay { get; set; } /// - /// 获得/设置 回落默认语言文化 默认为 en 英文 + /// Gets or sets the fallback default language culture, default is "en" (English) /// public string FallbackCulture { get; set; } = "en"; /// - /// 获得/设置 Toast 组件全局弹窗默认位置 默认为 null 当设置值后覆盖整站设置 + /// Gets or sets the default position for the Toast component globally, default is null. When set, it overrides the site-wide setting. /// public Placement? ToastPlacement { get; set; } /// - /// 获得/设置 组件内置本地化语言列表 默认为 null + /// Gets or sets the list of built-in localization languages for components, default is null /// public List? SupportedCultures { get; set; } /// - /// 获得/设置 是否开启全局异常捕获功能 默认为 true + /// Gets or sets whether to enable global exception capture functionality, default is true /// public bool EnableErrorLogger { get; set; } = true; /// - /// 获得/设置 是否回落到 Fallback 文化 默认为 true + /// Gets or sets whether to fall back to the fallback culture, default is true /// public bool EnableFallbackCulture { get; set; } = true; /// - /// 获得/设置 是否忽略丢失文化日志信息 默认 null 未设置 + /// Gets or sets whether to ignore missing culture log information, default is null (not set) /// - /// 使用 默认值 + /// Uses the default value of public bool? IgnoreLocalizerMissing { get; set; } /// - /// 获得/设置 是否禁用从服务中获取本地化资源 默认 false 未禁用 + /// Gets or sets whether to disable fetching localization resources from the service, default is false (not disabled) /// public bool? DisableGetLocalizerFromService { get; set; } /// - /// 获得/设置 是否禁用获取 类型本地化资源 默认 false 未禁用 + /// Gets or sets whether to disable fetching localization resources of type , default is false (not disabled) /// public bool? DisableGetLocalizerFromResourceManager { get; set; } /// - /// 获得/设置 默认文化信息 + /// Gets or sets the default culture information /// - /// 开启多文化时此参数无效 + /// This parameter is invalid when multi-culture is enabled public string? DefaultCultureInfo { get; set; } /// - /// 获得/设置 是否禁用表单内回车自动提交功能 默认 null 未设置 + /// Gets or sets whether to disable the automatic form submission feature by pressing Enter, default is null (not set) /// public bool? DisableAutoSubmitFormByEnter { get; set; } /// - /// 获得/设置 JavaScript 模块脚本版本号 默认为 null + /// Gets or sets the JavaScript module script version number, default is null /// public string? JSModuleVersion { get; set; } /// - /// 获得/设置 表格设置实例 + /// Gets or sets the table settings instance /// public TableSettings TableSettings { get; set; } = new(); /// - /// 获得/设置 配置实例 + /// Gets or sets the configuration instance /// public StepSettings StepSettings { get; set; } = new(); /// - /// 获得/设置 配置 默认不为空 + /// Gets or sets the configuration, default is not null /// public ConnectionHubOptions ConnectionHubOptions { get; set; } = new(); /// - /// 获得/设置 配置 默认不为空 + /// Gets or sets the configuration, default is not null /// public WebClientOptions WebClientOptions { get; set; } = new(); /// - /// 获得/设置 配置 默认不为空 + /// Gets or sets the configuration, default is not null /// public IpLocatorOptions IpLocatorOptions { get; set; } = new(); /// - /// 获得/设置 配置 默认不为空 + /// Gets or sets the configuration, default is not null /// public ScrollOptions ScrollOptions { get; set; } = new(); /// - /// 获得/设置 配置 默认不为空 + /// Gets or sets the configuration, default is not null /// public ContextMenuOptions ContextMenuOptions { get; set; } = new(); /// - /// 获得/设置 CacheManagerOptions 配置 默认不为空 + /// Gets or sets the CacheManagerOptions configuration, default is not null /// public CacheManagerOptions CacheManagerOptions { get; set; } = new(); BootstrapBlazorOptions IOptions.Value => this; /// - /// 获得支持多语言集合 + /// Gets the collection of supported languages /// /// public IList GetSupportedCultures() => SupportedCultures?.Select(name => new CultureInfo(name)).ToList() From a4a28414210c3b6fd882b727956c101f6be48a5c Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 13:24:29 +0800 Subject: [PATCH 05/12] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20IsMemorialMo?= =?UTF-8?q?de=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs b/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs index b0d30f872ed..5e736586aa4 100644 --- a/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs +++ b/src/BootstrapBlazor/Options/BootstrapBlazorOptions.cs @@ -125,6 +125,11 @@ public class BootstrapBlazorOptions : IOptions /// public CacheManagerOptions CacheManagerOptions { get; set; } = new(); + /// + /// Get or sets website use memorial mode. default is false + /// + public bool IsMemorialMode { get; set; } + BootstrapBlazorOptions IOptions.Value => this; /// From 6dd49e953e2ca79c35622975bd140adcdc79af24 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 13:24:51 +0800 Subject: [PATCH 06/12] =?UTF-8?q?style:=20=E5=A2=9E=E5=8A=A0=E8=BF=BD?= =?UTF-8?q?=E6=82=BC=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/wwwroot/scss/root.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/wwwroot/scss/root.scss b/src/BootstrapBlazor/wwwroot/scss/root.scss index 1190b0a8518..a71d9276647 100644 --- a/src/BootstrapBlazor/wwwroot/scss/root.scss +++ b/src/BootstrapBlazor/wwwroot/scss/root.scss @@ -120,7 +120,7 @@ a, a:hover, a:focus { } } -[data-bs-theme='memorial'] { +[data-bb-theme='memorial'] { &:root { --bs-body-bg: #000; --bs-body-color: #b5b5c3; From 0a7afef9f132d99dc4f2a0796d79a97e241e2c8c Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 14:09:53 +0800 Subject: [PATCH 07/12] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/JSModuleExtensions.cs | 92 +++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/src/BootstrapBlazor/Extensions/JSModuleExtensions.cs b/src/BootstrapBlazor/Extensions/JSModuleExtensions.cs index 03276489e54..3d55e4e3232 100644 --- a/src/BootstrapBlazor/Extensions/JSModuleExtensions.cs +++ b/src/BootstrapBlazor/Extensions/JSModuleExtensions.cs @@ -11,20 +11,20 @@ namespace BootstrapBlazor.Components; public static class JSModuleExtensions { /// - /// 导入 utility js 模块 + /// Load utility js module /// - /// - /// - /// A ]]> 模块加载器 + /// The instance + /// The version of the module + /// A ]]> module loader public static Task LoadUtility(this IJSRuntime jsRuntime, string? version = null) => LoadModuleByName(jsRuntime, "utility", version); /// - /// 通过名称导入内置脚本模块 + /// Load built-in script module by name /// - /// - /// - /// - /// A ]]> 模块加载器 + /// The instance + /// The name of the module + /// The version of the module + /// A ]]> module loader public static Task LoadModuleByName(this IJSRuntime jsRuntime, string moduleName, string? version = null) { var fileName = $"./_content/BootstrapBlazor/modules/{moduleName}.js"; @@ -32,12 +32,12 @@ public static Task LoadModuleByName(this IJSRuntime jsRuntime, string } /// - /// IJSRuntime 扩展方法 动态加载脚本 + /// IJSRuntime extension method to dynamically load scripts /// - /// - /// - /// - /// A ]]> 模块加载器 + /// The instance + /// The file name of the script + /// The version of the script + /// A ]]> module loader public static async Task LoadModule(this IJSRuntime jsRuntime, string fileName, string? version = null) { if (!string.IsNullOrEmpty(version)) @@ -64,10 +64,10 @@ public static async Task LoadModule(this IJSRuntime jsRuntime, string } /// - /// 获得指定类型的加载 Module 名称 + /// Get the module name of the specified type /// - /// - /// + /// The type + /// The module name public static string GetTypeModuleName(this Type type) { var name = type.Name; @@ -80,47 +80,47 @@ public static string GetTypeModuleName(this Type type) } /// - /// 在新标签页打开指定网址 + /// Open the specified URL in a new tab /// - /// 实例 - /// 打开网页地址 - /// 默认 _blank - /// 默认 null + /// instance + /// The URL to open + /// The target window, default is _blank + /// The features of the new window, default is null /// A that represents the asynchronous invocation operation. public static ValueTask OpenUrl(this JSModule module, string url, string? target = "_blank", string? features = null) => module.InvokeVoidAsync("openUrl", url, target, features); /// - /// 动态运行js代码 + /// Dynamically run js code /// - /// 实例 - /// + /// instance + /// The script to run /// A that represents the asynchronous invocation operation. public static async ValueTask Eval(this JSModule module, string script) => await module.InvokeVoidAsync("runEval", script); /// - /// 通过 Eval 动态运行 JavaScript 代码 + /// Dynamically run JavaScript code via Eval /// - /// 实例 - /// + /// instance + /// The script to run /// A that represents the asynchronous invocation operation. public static ValueTask Eval(this JSModule module, string script) => module.InvokeAsync("runEval", script); /// - /// 通过 Function 动态运行 JavaScript 代码 + /// Dynamically run JavaScript code via Function /// - /// 实例 - /// - /// + /// instance + /// The script to run + /// The arguments to pass to the script /// A that represents the asynchronous invocation operation. public static ValueTask Function(this JSModule module, string script, params object?[]? args) => module.InvokeVoidAsync("runFunction", script, args); /// - /// 动态运行js代码 + /// Dynamically run js code /// - /// - /// 实例 - /// - /// + /// The return type + /// instance + /// The script to run + /// The arguments to pass to the script /// A that represents the asynchronous invocation operation. public static async ValueTask Function(this JSModule module, string script, params object?[]? args) { @@ -133,14 +133,14 @@ public static string GetTypeModuleName(this Type type) } /// - /// 获取当前终端是否为移动设备 + /// Check if the current terminal is a mobile device /// - /// 实例 + /// instance /// A that represents the asynchronous invocation operation. public static ValueTask IsMobile(this JSModule module) => module.InvokeAsync("isMobile"); /// - /// 获取一个页面上不重复的元素ID + /// Get a unique element ID on a page /// /// An instance of /// A prefix of type @@ -148,24 +148,24 @@ public static string GetTypeModuleName(this Type type) public static ValueTask GenerateId(this JSModule module, string? prefix = null) => module.InvokeAsync("getUID", prefix); /// - /// 获取一个页面内指定元素 Html 字符串 + /// Get the HTML string of a specified element on a page /// /// An instance of - /// - /// + /// The ID of the element + /// The selector of the element /// Returns a formatted element ID public static ValueTask GetHtml(this JSModule module, string? id = null, string? selector = null) => module.InvokeAsync("getHtml", new { id, selector }); /// - /// 设置主题方法 + /// Set the theme method /// /// An instance of - /// theme name + /// The name of the theme /// public static ValueTask SetThemeAsync(this JSModule module, string themeName) => module.InvokeVoidAsync("setTheme", themeName, true); /// - /// 设置主题方法 + /// Get the theme method /// /// An instance of /// From a01919782410c955eddf5327a7b2e7c6640d1712 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 14:10:29 +0800 Subject: [PATCH 08/12] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20setMemorialM?= =?UTF-8?q?ode=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/JSModuleExtensions.cs | 8 ++++++++ .../wwwroot/modules/utility.js | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/BootstrapBlazor/Extensions/JSModuleExtensions.cs b/src/BootstrapBlazor/Extensions/JSModuleExtensions.cs index 3d55e4e3232..97f70b823b5 100644 --- a/src/BootstrapBlazor/Extensions/JSModuleExtensions.cs +++ b/src/BootstrapBlazor/Extensions/JSModuleExtensions.cs @@ -170,4 +170,12 @@ public static string GetTypeModuleName(this Type type) /// An instance of /// public static ValueTask GetThemeAsync(this JSModule module) => module.InvokeAsync("getTheme"); + + /// + /// Set memorial mode + /// + /// An instance of + /// Whether it is memorial mode + /// + public static ValueTask SetMemorialModeAsync(this JSModule module, bool isMemorial) => module.InvokeVoidAsync("setMemorialMode", isMemorial); } diff --git a/src/BootstrapBlazor/wwwroot/modules/utility.js b/src/BootstrapBlazor/wwwroot/modules/utility.js index 3f5472e38e7..a8cf06a0271 100644 --- a/src/BootstrapBlazor/wwwroot/modules/utility.js +++ b/src/BootstrapBlazor/wwwroot/modules/utility.js @@ -849,6 +849,26 @@ export function calcCenterPosition(el) { } } +export function setMemorialMode(memorial) { + const el = document.documentElement; + if (memorial) { + const theme = el.getAttribute('data-bs-theme'); + if (theme) { + el.setAttribute('data-bs-original-theme', theme); + } + el.setAttribute('data-bs-theme', 'dark'); + el.setAttribute('data-bb-theme', 'memorial'); + } + else { + const theme = el.getAttribute('data-bs-original-theme'); + el.removeAttribute('data-bs-theme'); + el.removeAttribute('data-bb-theme'); + if (theme) { + el.setAttribute('data-bs-theme', theme); + } + } +} + export { autoAdd, autoRemove, From dbb3a11708ea160c81d465579578b972ca03989d Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 14:10:50 +0800 Subject: [PATCH 09/12] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E8=BF=BD?= =?UTF-8?q?=E6=82=BC=E6=A8=A1=E5=BC=8F=E5=AE=9E=E6=88=98=E7=BD=91=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Layout/TutorialsNavMenu.razor.cs | 5 ++++ .../Samples/Tutorials/Memorial.razor | 9 +++++++ .../Samples/Tutorials/Memorial.razor.cs | 27 +++++++++++++++++++ src/BootstrapBlazor.Server/Locales/en-US.json | 3 ++- src/BootstrapBlazor.Server/Locales/zh-CN.json | 3 ++- 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor create mode 100644 src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor.cs diff --git a/src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.cs b/src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.cs index c92f1019ab0..3235e718788 100644 --- a/src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.cs @@ -110,6 +110,11 @@ protected override async Task OnInitializedAsync() { Text = Localizer["OnlineSheet"], Url = "tutorials/online-sheet", + }, + new() + { + Text = Localizer["MemorialMode"], + Url = "tutorials/memorial", } ]); } diff --git a/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor b/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor new file mode 100644 index 00000000000..ad7c86f1ffb --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor @@ -0,0 +1,9 @@ +@page "/tutorials/memorial" + + + +

1. 加载 Utlity 工具

+
var module = await JSRuntime.LoadUtility();
+ +

2. 设置哀悼模式

+
await module.InvokeVoidAsync("SetMemorial", true);
diff --git a/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor.cs new file mode 100644 index 00000000000..1481aca7faa --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the Apache 2.0 License +// See the LICENSE file in the project root for more information. +// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone + +using Microsoft.JSInterop; + +namespace BootstrapBlazor.Server.Components.Samples.Tutorials; + +/// +/// 追悼模式 +/// +public partial class Memorial +{ + [Inject, NotNull] + private IJSRuntime? JSRuntime { get; set; } + + private bool _isMemorial = false; + + private async Task OnToggle() + { + var module = await JSRuntime.LoadUtility(); + + _isMemorial = !_isMemorial; + await module.SetMemorialModeAsync(_isMemorial); + } +} diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index 625906ea3c9..fea96186570 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -22,7 +22,8 @@ "TranslateSummary": "Translate", "DrawingSummary": "Drawing", "AdminSummary": "Admin", - "OnlineSheet": "UniverSheet" + "OnlineSheet": "UniverSheet", + "MemorialMode": "Memorial" }, "BootstrapBlazor.Server.Components.Components.Pre": { "LoadingText": "Loading ...", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index a812af54b4a..2959a357d90 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -22,7 +22,8 @@ "TranslateSummary": "翻译工具 Translate", "DrawingSummary": "画图 Drawing", "AdminSummary": "中台 Admin", - "OnlineSheet": "在线表格 UniverSheet" + "OnlineSheet": "在线表格 UniverSheet", + "MemorialMode": "追悼模式" }, "BootstrapBlazor.Server.Components.Components.Pre": { "LoadingText": "正在加载 ...", From 6e0a567f89601931c2be587de381959654744cab Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 14:19:34 +0800 Subject: [PATCH 10/12] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/Tutorials/Memorial.razor | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor b/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor index ad7c86f1ffb..1bcbf7b2dbd 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Tutorials/Memorial.razor @@ -7,3 +7,7 @@

2. 设置哀悼模式

await module.InvokeVoidAsync("SetMemorial", true);
+ +

3. 全站默认设置追悼模式方法

+

更新 App.razor 文档内容如下

+
<html lang="en" data-bs-theme='dark' data-bb-theme="memorial">
From d698ca6a4f8388f5093f99da6a994b760b4288b9 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 14:27:10 +0800 Subject: [PATCH 11/12] =?UTF-8?q?doc:=20=E7=A7=BB=E9=99=A4=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/Components/Components/Header.razor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Components/Header.razor b/src/BootstrapBlazor.Server/Components/Components/Header.razor index baa74c34958..abf04151a31 100644 --- a/src/BootstrapBlazor.Server/Components/Components/Header.razor +++ b/src/BootstrapBlazor.Server/Components/Components/Header.razor @@ -20,12 +20,12 @@ - @if (CultureInfo.CurrentUICulture.Name == "zh-CN") + @* @if (CultureInfo.CurrentUICulture.Name == "zh-CN") { - } + } *@
From 990e3e9dbf2626ce0817a04af529d9f9e219766e Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 9 Mar 2025 14:34:41 +0800 Subject: [PATCH 12/12] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Utils/JSModuleTest.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/UnitTest/Utils/JSModuleTest.cs b/test/UnitTest/Utils/JSModuleTest.cs index c1588d93de1..936bf43e5f5 100644 --- a/test/UnitTest/Utils/JSModuleTest.cs +++ b/test/UnitTest/Utils/JSModuleTest.cs @@ -102,6 +102,14 @@ public async Task JSModule_TaskCanceledException() await module.InvokeAsync("test"); } + [Fact] + public async Task JSModule_SetMemorial() + { + var js = new MockTaskCanceledObjectReference(); + var module = new JSModule(js); + await module.SetMemorialModeAsync(true); + } + private class MockErrorJSObjectReference : MockJSObjectReference { protected override ValueTask DisposeAsyncCore(bool disposing)