reflex-components-code 0.9.3__tar.gz → 0.9.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.
@@ -0,0 +1,12 @@
1
+ ## v0.9.4 (2026-08-28)
2
+
3
+ ### Bug Fixes
4
+
5
+ - Track state vars referenced in `rx.code_block`'s `custom_style` dict so styles bound to state re-render on updates, and make `wrap_long_lines=True` apply `whiteSpace: pre-wrap` to the code tag even when `code_tag_props` is also provided. ([#6520](https://github.com/reflex-dev/reflex/issues/6520))
6
+
7
+
8
+ ## v0.9.3 (2026-08-04)
9
+
10
+ ### Miscellaneous
11
+
12
+ - Bumped `shiki` and `@shikijs/transformers` 3.3.0 → 4.3.1. ([#6678](https://github.com/reflex-dev/reflex/issues/6678))
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: reflex-components-code
3
- Version: 0.9.3
3
+ Version: 0.9.4
4
4
  Summary: Reflex code display components.
5
5
  Author-email: Khaleel Al-Adhami <khaleel@reflex.dev>
6
6
  Maintainer-email: Khaleel Al-Adhami <khaleel@reflex.dev>
@@ -22,8 +22,8 @@ pattern-prefix = "reflex-components-code-"
22
22
  fallback-version = "0.0.0dev0"
23
23
 
24
24
  [tool.hatch.build]
25
- targets.sdist.artifacts = ["*.pyi"]
26
- targets.wheel.artifacts = ["*.pyi"]
25
+ # Include uncommitted pyi stubs generated for this package.
26
+ artifacts = ["/src/**/*.pyi"]
27
27
 
28
28
  [tool.hatch.build.hooks.reflex-pyi]
29
29
  dependencies = [
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import dataclasses
6
+ from collections.abc import Iterator
6
7
  from typing import ClassVar, Literal
7
8
 
8
9
  from reflex_base.components.component import Component, ComponentNamespace, field
@@ -409,7 +410,6 @@ class CodeBlock(Component, MarkdownComponentMap):
409
410
  custom_style: dict[str, str | Var | Color] = field(
410
411
  doc="A custom style for the code block.",
411
412
  default_factory=dict,
412
- is_javascript_property=False,
413
413
  )
414
414
 
415
415
  code_tag_props: Var[dict[str, str | dict[str, str]]] = field(
@@ -459,6 +459,25 @@ class CodeBlock(Component, MarkdownComponentMap):
459
459
  dark=Theme.one_dark,
460
460
  )
461
461
 
462
+ if props.get("wrap_long_lines") is True:
463
+ code_tag_props = props.get("code_tag_props")
464
+ if code_tag_props is None:
465
+ props["code_tag_props"] = {"style": {"whiteSpace": "pre-wrap"}}
466
+ elif isinstance(code_tag_props, dict):
467
+ code_tag_props = code_tag_props.copy()
468
+ code_tag_style = code_tag_props.get("style")
469
+ if code_tag_style is None:
470
+ code_tag_props["style"] = {"whiteSpace": "pre-wrap"}
471
+ elif (
472
+ isinstance(code_tag_style, dict)
473
+ and "whiteSpace" not in code_tag_style
474
+ ):
475
+ code_tag_props["style"] = {
476
+ "whiteSpace": "pre-wrap",
477
+ **code_tag_style,
478
+ }
479
+ props["code_tag_props"] = code_tag_props
480
+
462
481
  if can_copy:
463
482
  code = children[0]
464
483
  copy_button = (
@@ -499,6 +518,30 @@ class CodeBlock(Component, MarkdownComponentMap):
499
518
  """Add style to the component."""
500
519
  self.custom_style.update(self.style)
501
520
 
521
+ def _get_vars(
522
+ self, include_children: bool = False, ignore_ids: set[int] | None = None
523
+ ) -> Iterator[Var]:
524
+ """Walk all Vars used in this component.
525
+
526
+ Args:
527
+ include_children: Whether to include Vars from children.
528
+ ignore_ids: The ids to ignore.
529
+
530
+ Yields:
531
+ Each var referenced by the component, including any embedded in
532
+ the custom_style dict, which is not a Var-typed prop.
533
+ """
534
+ yield from super()._get_vars(
535
+ include_children=include_children, ignore_ids=ignore_ids
536
+ )
537
+ custom_style = self.custom_style
538
+ if isinstance(custom_style, Style) and custom_style._var_data:
539
+ yield Var(
540
+ _js_expr="custom_style",
541
+ _var_type=str,
542
+ _var_data=custom_style._var_data,
543
+ )
544
+
502
545
  def _render(self):
503
546
  out = super()._render()
504
547
 
@@ -1,5 +0,0 @@
1
- ## v0.9.3 (2026-08-04)
2
-
3
- ### Miscellaneous
4
-
5
- - Bumped `shiki` and `@shikijs/transformers` 3.3.0 → 4.3.1. ([#6678](https://github.com/reflex-dev/reflex/issues/6678))