dash-startup-loading-plugin 1.0.3__tar.gz → 1.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {dash_startup_loading_plugin-1.0.3/src/dash_startup_loading_plugin.egg-info → dash_startup_loading_plugin-1.0.4}/PKG-INFO +27 -3
  2. {dash_startup_loading_plugin-1.0.3/src/dash_startup_loading_plugin → dash_startup_loading_plugin-1.0.4}/README.md +26 -2
  3. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/README.zh-CN.md +23 -2
  4. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/pyproject.toml +1 -1
  5. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4/src/dash_startup_loading_plugin}/README.md +26 -2
  6. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/README.zh-CN.md +23 -2
  7. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/__init__.py +1 -1
  8. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/resources/theme.js +1 -1
  9. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4/src/dash_startup_loading_plugin.egg-info}/PKG-INFO +27 -3
  10. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/tests/test_documentation.py +3 -0
  11. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/tests/test_plugin.py +16 -0
  12. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/LICENSE +0 -0
  13. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/MANIFEST.in +0 -0
  14. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/setup.cfg +0 -0
  15. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/examples/__init__.py +0 -0
  16. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/examples/__main__.py +0 -0
  17. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/examples/antd.py +0 -0
  18. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/examples/basic.py +0 -0
  19. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/examples/cli.py +0 -0
  20. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/examples/fac.py +0 -0
  21. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/examples/mantine.py +0 -0
  22. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/examples/shared.py +0 -0
  23. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/plugin.py +0 -0
  24. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/resources/loading.css +0 -0
  25. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin/resources/loading.js +0 -0
  26. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin.egg-info/SOURCES.txt +0 -0
  27. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin.egg-info/dependency_links.txt +0 -0
  28. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin.egg-info/entry_points.txt +0 -0
  29. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin.egg-info/requires.txt +0 -0
  30. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/src/dash_startup_loading_plugin.egg-info/top_level.txt +0 -0
  31. {dash_startup_loading_plugin-1.0.3 → dash_startup_loading_plugin-1.0.4}/tests/test_examples.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dash-startup-loading-plugin
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: A configurable full-screen startup loading overlay for Dash apps, packaged as a Dash Hooks plugin.
5
5
  Author-email: Ethan Zhang <ethan.zhang2016@gmail.com>
6
6
  License-Expression: MIT
@@ -34,7 +34,7 @@ document.
34
34
  ## Installation
35
35
 
36
36
  ```bash
37
- pip install "dash-startup-loading-plugin>=1.0.3"
37
+ pip install "dash-startup-loading-plugin>=1.0.4"
38
38
  ```
39
39
 
40
40
  Dash discovers the plugin through its `dash_hooks` entry point. Installing the
@@ -89,6 +89,30 @@ app.layout = html.Main(
89
89
  )
90
90
  ```
91
91
 
92
+ ### Theme behavior
93
+
94
+ With the default `theme_mode="auto"`, the startup overlay follows an explicit
95
+ application theme from, in order, the root HTML element (including Tailwind's
96
+ `dark`/`light` classes and common theme data attributes), a persisted Dash
97
+ theme component, or conventional theme keys in local storage. If the
98
+ application has not declared a theme preference, the overlay uses the light
99
+ theme; it does not infer a preference from the operating system.
100
+
101
+ Set the mode explicitly when the application does not expose its preference,
102
+ or when the loading screen should always use one theme:
103
+
104
+ ```python
105
+ configure(theme_mode="light") # or "dark"
106
+ ```
107
+
108
+ An application preference explicitly set to `"system"` or `"auto"` still
109
+ uses `prefers-color-scheme`. Use `dash_theme_component_id` to prefer one Dash
110
+ component when multiple persisted theme values exist:
111
+
112
+ ```python
113
+ configure(theme_mode="auto", dash_theme_component_id="theme-provider")
114
+ ```
115
+
92
116
  ## Component-library integrations
93
117
 
94
118
  Component libraries are not dependencies of this package. Install only the
@@ -221,7 +245,7 @@ configure(pending_selector=None)
221
245
  | `dark_background` | `"#0f0f0f"` | Dark background. |
222
246
  | `color` | `"#1677ff"` | Light spinner color. |
223
247
  | `dark_color` | `"#4096ff"` | Dark spinner color. |
224
- | `theme_mode` | `"auto"` | `"auto"`, `"light"`, or `"dark"`. |
248
+ | `theme_mode` | `"auto"` | `"auto"` detects application theme signals and otherwise uses light; `"light"` and `"dark"` force a mode. |
225
249
  | `dash_theme_component_id` | `None` | Preferred persisted Dash theme component. |
226
250
  | `spinner_size_px` | `28` | Spinner width and height. |
227
251
  | `spinner_stroke_px` | `3` | Spinner stroke width. |
@@ -20,7 +20,7 @@ document.
20
20
  ## Installation
21
21
 
22
22
  ```bash
23
- pip install "dash-startup-loading-plugin>=1.0.3"
23
+ pip install "dash-startup-loading-plugin>=1.0.4"
24
24
  ```
25
25
 
26
26
  Dash discovers the plugin through its `dash_hooks` entry point. Installing the
@@ -75,6 +75,30 @@ app.layout = html.Main(
75
75
  )
76
76
  ```
77
77
 
78
+ ### Theme behavior
79
+
80
+ With the default `theme_mode="auto"`, the startup overlay follows an explicit
81
+ application theme from, in order, the root HTML element (including Tailwind's
82
+ `dark`/`light` classes and common theme data attributes), a persisted Dash
83
+ theme component, or conventional theme keys in local storage. If the
84
+ application has not declared a theme preference, the overlay uses the light
85
+ theme; it does not infer a preference from the operating system.
86
+
87
+ Set the mode explicitly when the application does not expose its preference,
88
+ or when the loading screen should always use one theme:
89
+
90
+ ```python
91
+ configure(theme_mode="light") # or "dark"
92
+ ```
93
+
94
+ An application preference explicitly set to `"system"` or `"auto"` still
95
+ uses `prefers-color-scheme`. Use `dash_theme_component_id` to prefer one Dash
96
+ component when multiple persisted theme values exist:
97
+
98
+ ```python
99
+ configure(theme_mode="auto", dash_theme_component_id="theme-provider")
100
+ ```
101
+
78
102
  ## Component-library integrations
79
103
 
80
104
  Component libraries are not dependencies of this package. Install only the
@@ -207,7 +231,7 @@ configure(pending_selector=None)
207
231
  | `dark_background` | `"#0f0f0f"` | Dark background. |
208
232
  | `color` | `"#1677ff"` | Light spinner color. |
209
233
  | `dark_color` | `"#4096ff"` | Dark spinner color. |
210
- | `theme_mode` | `"auto"` | `"auto"`, `"light"`, or `"dark"`. |
234
+ | `theme_mode` | `"auto"` | `"auto"` detects application theme signals and otherwise uses light; `"light"` and `"dark"` force a mode. |
211
235
  | `dash_theme_component_id` | `None` | Preferred persisted Dash theme component. |
212
236
  | `spinner_size_px` | `28` | Spinner width and height. |
213
237
  | `spinner_stroke_px` | `3` | Spinner stroke width. |
@@ -18,7 +18,7 @@
18
18
  ## 安装
19
19
 
20
20
  ```bash
21
- pip install "dash-startup-loading-plugin>=1.0.3"
21
+ pip install "dash-startup-loading-plugin>=1.0.4"
22
22
  ```
23
23
 
24
24
  Dash 会通过 `dash_hooks` entry point 自动发现插件。安装后,默认 loading
@@ -72,6 +72,27 @@ app.layout = html.Main(
72
72
  )
73
73
  ```
74
74
 
75
+ ### 主题行为
76
+
77
+ 默认的 `theme_mode="auto"` 会按顺序读取应用显式提供的主题:HTML 根节点
78
+ (包括 Tailwind 的 `dark`/`light` 类及常见主题 data 属性)、Dash 组件的
79
+ 持久化主题值,以及 local storage 中的常见主题键。如果应用没有声明主题
80
+ 偏好,loading 遮罩会使用亮色主题,不会根据操作系统配色自动推断。
81
+
82
+ 当应用没有暴露主题偏好,或 loading 页面需要固定主题时,可手动配置:
83
+
84
+ ```python
85
+ configure(theme_mode="light") # 或 "dark"
86
+ ```
87
+
88
+ 如果应用主题偏好明确设置为 `"system"` 或 `"auto"`,插件仍会读取
89
+ `prefers-color-scheme`。当页面中存在多个持久化主题值时,可用
90
+ `dash_theme_component_id` 指定优先读取的 Dash 组件:
91
+
92
+ ```python
93
+ configure(theme_mode="auto", dash_theme_component_id="theme-provider")
94
+ ```
95
+
75
96
  ## 组件库集成
76
97
 
77
98
  各组件库不是本插件的依赖。应用只需单独安装实际使用的组件库。
@@ -198,7 +219,7 @@ configure(pending_selector=None)
198
219
  | `dark_background` | `"#0f0f0f"` | 暗色背景。 |
199
220
  | `color` | `"#1677ff"` | 亮色 spinner 颜色。 |
200
221
  | `dark_color` | `"#4096ff"` | 暗色 spinner 颜色。 |
201
- | `theme_mode` | `"auto"` | 可选 `"auto"`、`"light"` 或 `"dark"`。 |
222
+ | `theme_mode` | `"auto"` | `"auto"` 自动检测应用主题,未检测到时使用亮色;`"light"` 和 `"dark"` 用于强制指定主题。 |
202
223
  | `dash_theme_component_id` | `None` | 优先读取主题状态的 Dash 持久化组件 ID。 |
203
224
  | `spinner_size_px` | `28` | Spinner 宽度和高度。 |
204
225
  | `spinner_stroke_px` | `3` | Spinner 描边宽度。 |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dash-startup-loading-plugin"
7
- version = "1.0.3"
7
+ version = "1.0.4"
8
8
  description = "A configurable full-screen startup loading overlay for Dash apps, packaged as a Dash Hooks plugin."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -20,7 +20,7 @@ document.
20
20
  ## Installation
21
21
 
22
22
  ```bash
23
- pip install "dash-startup-loading-plugin>=1.0.3"
23
+ pip install "dash-startup-loading-plugin>=1.0.4"
24
24
  ```
25
25
 
26
26
  Dash discovers the plugin through its `dash_hooks` entry point. Installing the
@@ -75,6 +75,30 @@ app.layout = html.Main(
75
75
  )
76
76
  ```
77
77
 
78
+ ### Theme behavior
79
+
80
+ With the default `theme_mode="auto"`, the startup overlay follows an explicit
81
+ application theme from, in order, the root HTML element (including Tailwind's
82
+ `dark`/`light` classes and common theme data attributes), a persisted Dash
83
+ theme component, or conventional theme keys in local storage. If the
84
+ application has not declared a theme preference, the overlay uses the light
85
+ theme; it does not infer a preference from the operating system.
86
+
87
+ Set the mode explicitly when the application does not expose its preference,
88
+ or when the loading screen should always use one theme:
89
+
90
+ ```python
91
+ configure(theme_mode="light") # or "dark"
92
+ ```
93
+
94
+ An application preference explicitly set to `"system"` or `"auto"` still
95
+ uses `prefers-color-scheme`. Use `dash_theme_component_id` to prefer one Dash
96
+ component when multiple persisted theme values exist:
97
+
98
+ ```python
99
+ configure(theme_mode="auto", dash_theme_component_id="theme-provider")
100
+ ```
101
+
78
102
  ## Component-library integrations
79
103
 
80
104
  Component libraries are not dependencies of this package. Install only the
@@ -207,7 +231,7 @@ configure(pending_selector=None)
207
231
  | `dark_background` | `"#0f0f0f"` | Dark background. |
208
232
  | `color` | `"#1677ff"` | Light spinner color. |
209
233
  | `dark_color` | `"#4096ff"` | Dark spinner color. |
210
- | `theme_mode` | `"auto"` | `"auto"`, `"light"`, or `"dark"`. |
234
+ | `theme_mode` | `"auto"` | `"auto"` detects application theme signals and otherwise uses light; `"light"` and `"dark"` force a mode. |
211
235
  | `dash_theme_component_id` | `None` | Preferred persisted Dash theme component. |
212
236
  | `spinner_size_px` | `28` | Spinner width and height. |
213
237
  | `spinner_stroke_px` | `3` | Spinner stroke width. |
@@ -18,7 +18,7 @@
18
18
  ## 安装
19
19
 
20
20
  ```bash
21
- pip install "dash-startup-loading-plugin>=1.0.3"
21
+ pip install "dash-startup-loading-plugin>=1.0.4"
22
22
  ```
23
23
 
24
24
  Dash 会通过 `dash_hooks` entry point 自动发现插件。安装后,默认 loading
@@ -72,6 +72,27 @@ app.layout = html.Main(
72
72
  )
73
73
  ```
74
74
 
75
+ ### 主题行为
76
+
77
+ 默认的 `theme_mode="auto"` 会按顺序读取应用显式提供的主题:HTML 根节点
78
+ (包括 Tailwind 的 `dark`/`light` 类及常见主题 data 属性)、Dash 组件的
79
+ 持久化主题值,以及 local storage 中的常见主题键。如果应用没有声明主题
80
+ 偏好,loading 遮罩会使用亮色主题,不会根据操作系统配色自动推断。
81
+
82
+ 当应用没有暴露主题偏好,或 loading 页面需要固定主题时,可手动配置:
83
+
84
+ ```python
85
+ configure(theme_mode="light") # 或 "dark"
86
+ ```
87
+
88
+ 如果应用主题偏好明确设置为 `"system"` 或 `"auto"`,插件仍会读取
89
+ `prefers-color-scheme`。当页面中存在多个持久化主题值时,可用
90
+ `dash_theme_component_id` 指定优先读取的 Dash 组件:
91
+
92
+ ```python
93
+ configure(theme_mode="auto", dash_theme_component_id="theme-provider")
94
+ ```
95
+
75
96
  ## 组件库集成
76
97
 
77
98
  各组件库不是本插件的依赖。应用只需单独安装实际使用的组件库。
@@ -198,7 +219,7 @@ configure(pending_selector=None)
198
219
  | `dark_background` | `"#0f0f0f"` | 暗色背景。 |
199
220
  | `color` | `"#1677ff"` | 亮色 spinner 颜色。 |
200
221
  | `dark_color` | `"#4096ff"` | 暗色 spinner 颜色。 |
201
- | `theme_mode` | `"auto"` | 可选 `"auto"`、`"light"` 或 `"dark"`。 |
222
+ | `theme_mode` | `"auto"` | `"auto"` 自动检测应用主题,未检测到时使用亮色;`"light"` 和 `"dark"` 用于强制指定主题。 |
202
223
  | `dash_theme_component_id` | `None` | 优先读取主题状态的 Dash 持久化组件 ID。 |
203
224
  | `spinner_size_px` | `28` | Spinner 宽度和高度。 |
204
225
  | `spinner_stroke_px` | `3` | Spinner 描边宽度。 |
@@ -5,7 +5,7 @@ from importlib.metadata import PackageNotFoundError, version
5
5
  try:
6
6
  __version__ = version("dash-startup-loading-plugin")
7
7
  except PackageNotFoundError: # pragma: no cover - source tree fallback
8
- __version__ = "1.0.3"
8
+ __version__ = "1.0.4"
9
9
 
10
10
  from .plugin import (
11
11
  StartupLoadingConfig,
@@ -92,7 +92,7 @@
92
92
  theme = dashPersistenceTheme();
93
93
  }
94
94
  if (!theme) {
95
- theme = rootTheme() || dashPersistenceTheme() || conventionalStoredTheme() || "system";
95
+ theme = rootTheme() || dashPersistenceTheme() || conventionalStoredTheme() || "light";
96
96
  }
97
97
  if (theme === "system") {
98
98
  theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dash-startup-loading-plugin
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: A configurable full-screen startup loading overlay for Dash apps, packaged as a Dash Hooks plugin.
5
5
  Author-email: Ethan Zhang <ethan.zhang2016@gmail.com>
6
6
  License-Expression: MIT
@@ -34,7 +34,7 @@ document.
34
34
  ## Installation
35
35
 
36
36
  ```bash
37
- pip install "dash-startup-loading-plugin>=1.0.3"
37
+ pip install "dash-startup-loading-plugin>=1.0.4"
38
38
  ```
39
39
 
40
40
  Dash discovers the plugin through its `dash_hooks` entry point. Installing the
@@ -89,6 +89,30 @@ app.layout = html.Main(
89
89
  )
90
90
  ```
91
91
 
92
+ ### Theme behavior
93
+
94
+ With the default `theme_mode="auto"`, the startup overlay follows an explicit
95
+ application theme from, in order, the root HTML element (including Tailwind's
96
+ `dark`/`light` classes and common theme data attributes), a persisted Dash
97
+ theme component, or conventional theme keys in local storage. If the
98
+ application has not declared a theme preference, the overlay uses the light
99
+ theme; it does not infer a preference from the operating system.
100
+
101
+ Set the mode explicitly when the application does not expose its preference,
102
+ or when the loading screen should always use one theme:
103
+
104
+ ```python
105
+ configure(theme_mode="light") # or "dark"
106
+ ```
107
+
108
+ An application preference explicitly set to `"system"` or `"auto"` still
109
+ uses `prefers-color-scheme`. Use `dash_theme_component_id` to prefer one Dash
110
+ component when multiple persisted theme values exist:
111
+
112
+ ```python
113
+ configure(theme_mode="auto", dash_theme_component_id="theme-provider")
114
+ ```
115
+
92
116
  ## Component-library integrations
93
117
 
94
118
  Component libraries are not dependencies of this package. Install only the
@@ -221,7 +245,7 @@ configure(pending_selector=None)
221
245
  | `dark_background` | `"#0f0f0f"` | Dark background. |
222
246
  | `color` | `"#1677ff"` | Light spinner color. |
223
247
  | `dark_color` | `"#4096ff"` | Dark spinner color. |
224
- | `theme_mode` | `"auto"` | `"auto"`, `"light"`, or `"dark"`. |
248
+ | `theme_mode` | `"auto"` | `"auto"` detects application theme signals and otherwise uses light; `"light"` and `"dark"` force a mode. |
225
249
  | `dash_theme_component_id` | `None` | Preferred persisted Dash theme component. |
226
250
  | `spinner_size_px` | `28` | Spinner width and height. |
227
251
  | `spinner_stroke_px` | `3` | Spinner stroke width. |
@@ -28,6 +28,9 @@ def test_readmes_use_current_selector_and_installation_examples():
28
28
  assert "usage-sidebar-menu" not in readme
29
29
  assert "dash-ant-design # Python 3.10+" not in readme
30
30
  assert "feffery-antd-components>=0.4.0" not in readme
31
+ assert 'theme_mode="auto"' in readme
32
+ assert 'theme_mode="light"' in readme
33
+ assert "dash_theme_component_id" in readme
31
34
 
32
35
 
33
36
  def test_readmes_link_to_each_other():
@@ -211,6 +211,22 @@ def test_theme_bootstrap_supports_dash_tailwind_and_mantine_conventions():
211
211
  assert 'name === "system" || name === "auto"' in script
212
212
 
213
213
 
214
+ def test_theme_bootstrap_defaults_to_light_without_an_app_preference():
215
+ script = (
216
+ files("dash_startup_loading_plugin")
217
+ .joinpath("resources/theme.js")
218
+ .read_text(encoding="utf-8")
219
+ )
220
+
221
+ assert (
222
+ 'rootTheme() || dashPersistenceTheme() || conventionalStoredTheme() || "light"'
223
+ in script
224
+ )
225
+ assert 'conventionalStoredTheme() || "system"' not in script
226
+ assert 'theme === "system"' in script
227
+ assert 'matchMedia("(prefers-color-scheme: dark)")' in script
228
+
229
+
214
230
  def test_theme_bootstrap_serializes_component_id_and_explicit_mode():
215
231
  configure(theme_mode="dark", dash_theme_component_id="theme-provider")
216
232