dashlab 0.3.4__tar.gz → 0.3.5__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 (24) hide show
  1. {dashlab-0.3.4 → dashlab-0.3.5}/PKG-INFO +1 -1
  2. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/_version.py +1 -1
  3. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/utils.py +8 -1
  4. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab.egg-info/PKG-INFO +1 -1
  5. {dashlab-0.3.4 → dashlab-0.3.5}/LICENSE +0 -0
  6. {dashlab-0.3.4 → dashlab-0.3.5}/README.md +0 -0
  7. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/__init__.py +0 -0
  8. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/_internal.py +0 -0
  9. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/base.py +0 -0
  10. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/core.py +0 -0
  11. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/patches.py +0 -0
  12. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/static/animator.css +0 -0
  13. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/static/animator.js +0 -0
  14. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/static/fscreen.css +0 -0
  15. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/static/fscreen.js +0 -0
  16. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/static/listw.css +0 -0
  17. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/static/listw.js +0 -0
  18. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab/widgets.py +0 -0
  19. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab.egg-info/SOURCES.txt +0 -0
  20. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab.egg-info/dependency_links.txt +0 -0
  21. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab.egg-info/requires.txt +0 -0
  22. {dashlab-0.3.4 → dashlab-0.3.5}/dashlab.egg-info/top_level.txt +0 -0
  23. {dashlab-0.3.4 → dashlab-0.3.5}/pyproject.toml +0 -0
  24. {dashlab-0.3.4 → dashlab-0.3.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dashlab
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: A Python package for dashboard and data visualization tools.
5
5
  Author-email: Abdul Saboor <asaboor.my@outlook.com>
6
6
  License-Expression: MIT
@@ -1,4 +1,4 @@
1
1
  # This is automatically updated at build time, do not edit manually.
2
2
  # Double qoites are checked here
3
3
 
4
- __version__ = "0.3.4"
4
+ __version__ = "0.3.5"
@@ -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,7 @@ 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. This can be used to inject complex CSS like `@import`, `@font-face`, `@layer` etc.
106
107
 
107
108
  Read about specificity of CSS selectors [here](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity).
108
109
  """
@@ -113,6 +114,12 @@ def _build_css(selector, props):
113
114
 
114
115
  for key, value in props.items():
115
116
  key = _validate_key(key) # Just validate key
117
+ if not key.strip() and isinstance(value, str): # Empty key with string value is direct CSS
118
+ value = '\n'.join(line.strip() for line in value.splitlines()) # Clean extra spaces
119
+ content += ("@scope (" + " ".join(selector) + ") {\n")
120
+ content += (textwrap.indent(value, '\t')+ "\n}\n")
121
+ continue
122
+
116
123
  if isinstance(value, dict):
117
124
  children.append( (key, value) )
118
125
  elif isinstance(value, (list, tuple)): # Fallbacks
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dashlab
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: A Python package for dashboard and data visualization tools.
5
5
  Author-email: Abdul Saboor <asaboor.my@outlook.com>
6
6
  License-Expression: MIT
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