dashlab 0.3.4__tar.gz → 0.3.6__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.
- {dashlab-0.3.4 → dashlab-0.3.6}/PKG-INFO +1 -1
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/_version.py +1 -1
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/utils.py +10 -1
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab.egg-info/PKG-INFO +1 -1
- {dashlab-0.3.4 → dashlab-0.3.6}/LICENSE +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/README.md +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/__init__.py +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/_internal.py +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/base.py +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/core.py +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/patches.py +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/static/animator.css +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/static/animator.js +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/static/fscreen.css +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/static/fscreen.js +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/static/listw.css +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/static/listw.js +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab/widgets.py +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab.egg-info/SOURCES.txt +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab.egg-info/dependency_links.txt +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab.egg-info/requires.txt +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/dashlab.egg-info/top_level.txt +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/pyproject.toml +0 -0
- {dashlab-0.3.4 → dashlab-0.3.6}/setup.cfg +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import inspect, re, sys
|
|
1
|
+
import inspect, re, sys, textwrap
|
|
2
2
|
import ipywidgets as ipw
|
|
3
3
|
|
|
4
4
|
from contextlib import contextmanager
|
|
@@ -103,6 +103,8 @@ def _build_css(selector, props):
|
|
|
103
103
|
- All nested selectors are joined with space, so code`'.A': {'.B': ... }` becomes code['css']`.A .B {...}` in CSS.
|
|
104
104
|
- A '^' in start of a selector joins to parent selector without space, so code`'.A': {'^:hover': ...}` becomes code['css']`.A:hover {...}` in CSS. You can also use code`'.A:hover'` directly but it will restrict other nested keys to hover only.
|
|
105
105
|
- A list/tuple of values for a key in dict generates CSS fallback, so code`'.A': {'font-size': ('20px','2em')}` becomes code['css']`.A {font-size: 20px; font-size: 2em;}` in CSS.
|
|
106
|
+
- An empty key with a string value injects direct CSS wrapped in code['css']`@scope`, so code`'.A': {'': 'raw css here'}` becomes code['css']`@scope (.A) { raw css here }` in CSS.
|
|
107
|
+
This can be used to inject complex CSS like `@import`, `@font-face`, `@layer` etc. `:root` is replaced with `:scope` to make variables local to the selector.
|
|
106
108
|
|
|
107
109
|
Read about specificity of CSS selectors [here](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity).
|
|
108
110
|
"""
|
|
@@ -113,6 +115,13 @@ def _build_css(selector, props):
|
|
|
113
115
|
|
|
114
116
|
for key, value in props.items():
|
|
115
117
|
key = _validate_key(key) # Just validate key
|
|
118
|
+
if not key.strip() and isinstance(value, str): # Empty key with string value is direct CSS
|
|
119
|
+
value = '\n'.join(line.strip() for line in value.splitlines()) # Clean extra spaces
|
|
120
|
+
value = value.replace(':root',':scope') # Take external root to scope
|
|
121
|
+
content += ("@scope (" + " ".join(selector) + ") {\n")
|
|
122
|
+
content += (textwrap.indent(value, '\t')+ "\n}\n")
|
|
123
|
+
continue
|
|
124
|
+
|
|
116
125
|
if isinstance(value, dict):
|
|
117
126
|
children.append( (key, value) )
|
|
118
127
|
elif isinstance(value, (list, tuple)): # Fallbacks
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|