reflex-components-code 0.9.0a1__tar.gz → 0.9.1__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.
@@ -1,13 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex-components-code
3
- Version: 0.9.0a1
3
+ Version: 0.9.1
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>
7
+ License: Apache-2.0
7
8
  Requires-Python: >=3.10
8
- Requires-Dist: reflex-components-core
9
- Requires-Dist: reflex-components-lucide
10
- Requires-Dist: reflex-components-radix
9
+ Requires-Dist: reflex-base>=0.9.0
10
+ Requires-Dist: reflex-components-core>=0.9.0
11
+ Requires-Dist: reflex-components-lucide>=0.9.0
12
+ Requires-Dist: reflex-components-radix>=0.9.0
11
13
  Description-Content-Type: text/markdown
12
14
 
13
15
  # reflex-components-code
@@ -2,14 +2,16 @@
2
2
  name = "reflex-components-code"
3
3
  dynamic = ["version"]
4
4
  description = "Reflex code display components."
5
+ license.text = "Apache-2.0"
5
6
  readme = "README.md"
6
7
  authors = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
7
8
  maintainers = [{ name = "Khaleel Al-Adhami", email = "khaleel@reflex.dev" }]
8
9
  requires-python = ">=3.10"
9
10
  dependencies = [
10
- "reflex-components-core",
11
- "reflex-components-lucide",
12
- "reflex-components-radix",
11
+ "reflex-base >= 0.9.0",
12
+ "reflex-components-core >= 0.9.0",
13
+ "reflex-components-lucide >= 0.9.0",
14
+ "reflex-components-radix >= 0.9.0",
13
15
  ]
14
16
 
15
17
  [tool.hatch.version]
@@ -926,7 +926,7 @@ class CodeBlock(Component, MarkdownComponentMap):
926
926
  show_line_numbers: Var[bool] | bool | None = None,
927
927
  starting_line_number: Var[int] | int | None = None,
928
928
  wrap_long_lines: Var[bool] | bool | None = None,
929
- custom_style: dict[str, str | Var | Color] | None = None,
929
+ custom_style: dict[str, Color | Var | str] | None = None,
930
930
  code_tag_props: Var[dict[str, dict[str, str] | str]]
931
931
  | dict[str, dict[str, str] | str]
932
932
  | None = None,
@@ -941,7 +941,7 @@ class CodeBlock(Component, MarkdownComponentMap):
941
941
  id: Any | None = None,
942
942
  ref: Var | None = None,
943
943
  class_name: Any | None = None,
944
- custom_attrs: dict[str, Var | Any] | None = None,
944
+ custom_attrs: dict[str, Any | Var] | None = None,
945
945
  on_blur: EventType[()] | None = None,
946
946
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
947
947
  on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -963,13 +963,43 @@ class CodeBlock(Component, MarkdownComponentMap):
963
963
  """Create a text component.
964
964
 
965
965
  Args:
966
- *children: The children of the component.
967
- can_copy: Whether a copy button should appear.
968
- copy_button: A custom copy button to override the default one.
969
- **props: The props to pass to the component.
966
+ *children: The children of the component.
967
+ theme: The theme to use ("light" or "dark").
968
+ language: The language to use.
969
+ code: The code to display.
970
+ show_line_numbers: If this is enabled line numbers will be shown next to the code block.
971
+ starting_line_number: The starting line number to use.
972
+ wrap_long_lines: Whether to wrap long lines.
973
+ custom_style: A custom style for the code block.
974
+ code_tag_props: Props passed down to the code tag.
975
+ can_copy: Whether a copy button should appear.
976
+ copy_button: A custom copy button to override the default one.
977
+ style: The style of the component.
978
+ key: A unique key for the component.
979
+ id: The id for the component.
980
+ ref: The Var to pass as the ref to the component.
981
+ class_name: The class name for the component.
982
+ custom_attrs: Attributes passed directly to the component.
983
+ on_focus: Fired when the element (or some element inside of it) receives focus. For example, it is called when the user clicks on a text input.
984
+ on_blur: Fired when focus has left the element (or left some element inside of it). For example, it is called when the user clicks outside of a focused text input.
985
+ on_click: Fired when the user clicks on an element. For example, it's called when the user clicks on a button.
986
+ on_context_menu: Fired when the user right-clicks on an element.
987
+ on_double_click: Fired when the user double-clicks on an element.
988
+ on_mouse_down: Fired when the user presses a mouse button on an element.
989
+ on_mouse_enter: Fired when the mouse pointer enters the element.
990
+ on_mouse_leave: Fired when the mouse pointer leaves the element.
991
+ on_mouse_move: Fired when the mouse pointer moves over the element.
992
+ on_mouse_out: Fired when the mouse pointer moves out of the element.
993
+ on_mouse_over: Fired when the mouse pointer moves onto the element.
994
+ on_mouse_up: Fired when the user releases a mouse button on an element.
995
+ on_scroll: Fired when the user scrolls the element.
996
+ on_scroll_end: Fired when scrolling ends on the element.
997
+ on_mount: Fired when the component is mounted to the page.
998
+ on_unmount: Fired when the component is removed from the page. Only called during navigation, not on page refresh.
999
+ **props: The props to pass to the component.
970
1000
 
971
1001
  Returns:
972
- The text component.
1002
+ The text component.
973
1003
  """
974
1004
 
975
1005
  def add_style(self): ...
@@ -1550,7 +1580,7 @@ class CodeblockNamespace(ComponentNamespace):
1550
1580
  show_line_numbers: Var[bool] | bool | None = None,
1551
1581
  starting_line_number: Var[int] | int | None = None,
1552
1582
  wrap_long_lines: Var[bool] | bool | None = None,
1553
- custom_style: dict[str, str | Var | Color] | None = None,
1583
+ custom_style: dict[str, Color | Var | str] | None = None,
1554
1584
  code_tag_props: Var[dict[str, dict[str, str] | str]]
1555
1585
  | dict[str, dict[str, str] | str]
1556
1586
  | None = None,
@@ -1565,7 +1595,7 @@ class CodeblockNamespace(ComponentNamespace):
1565
1595
  id: Any | None = None,
1566
1596
  ref: Var | None = None,
1567
1597
  class_name: Any | None = None,
1568
- custom_attrs: dict[str, Var | Any] | None = None,
1598
+ custom_attrs: dict[str, Any | Var] | None = None,
1569
1599
  on_blur: EventType[()] | None = None,
1570
1600
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
1571
1601
  on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -1587,13 +1617,43 @@ class CodeblockNamespace(ComponentNamespace):
1587
1617
  """Create a text component.
1588
1618
 
1589
1619
  Args:
1590
- *children: The children of the component.
1591
- can_copy: Whether a copy button should appear.
1592
- copy_button: A custom copy button to override the default one.
1593
- **props: The props to pass to the component.
1620
+ *children: The children of the component.
1621
+ theme: The theme to use ("light" or "dark").
1622
+ language: The language to use.
1623
+ code: The code to display.
1624
+ show_line_numbers: If this is enabled line numbers will be shown next to the code block.
1625
+ starting_line_number: The starting line number to use.
1626
+ wrap_long_lines: Whether to wrap long lines.
1627
+ custom_style: A custom style for the code block.
1628
+ code_tag_props: Props passed down to the code tag.
1629
+ can_copy: Whether a copy button should appear.
1630
+ copy_button: A custom copy button to override the default one.
1631
+ style: The style of the component.
1632
+ key: A unique key for the component.
1633
+ id: The id for the component.
1634
+ ref: The Var to pass as the ref to the component.
1635
+ class_name: The class name for the component.
1636
+ custom_attrs: Attributes passed directly to the component.
1637
+ on_focus: Fired when the element (or some element inside of it) receives focus. For example, it is called when the user clicks on a text input.
1638
+ on_blur: Fired when focus has left the element (or left some element inside of it). For example, it is called when the user clicks outside of a focused text input.
1639
+ on_click: Fired when the user clicks on an element. For example, it's called when the user clicks on a button.
1640
+ on_context_menu: Fired when the user right-clicks on an element.
1641
+ on_double_click: Fired when the user double-clicks on an element.
1642
+ on_mouse_down: Fired when the user presses a mouse button on an element.
1643
+ on_mouse_enter: Fired when the mouse pointer enters the element.
1644
+ on_mouse_leave: Fired when the mouse pointer leaves the element.
1645
+ on_mouse_move: Fired when the mouse pointer moves over the element.
1646
+ on_mouse_out: Fired when the mouse pointer moves out of the element.
1647
+ on_mouse_over: Fired when the mouse pointer moves onto the element.
1648
+ on_mouse_up: Fired when the user releases a mouse button on an element.
1649
+ on_scroll: Fired when the user scrolls the element.
1650
+ on_scroll_end: Fired when scrolling ends on the element.
1651
+ on_mount: Fired when the component is mounted to the page.
1652
+ on_unmount: Fired when the component is removed from the page. Only called during navigation, not on page refresh.
1653
+ **props: The props to pass to the component.
1594
1654
 
1595
1655
  Returns:
1596
- The text component.
1656
+ The text component.
1597
1657
  """
1598
1658
 
1599
1659
  code_block = CodeblockNamespace()
@@ -59,9 +59,9 @@ document.addEventListener('click', function(event) {
59
59
  setTimeout(() => {
60
60
  svgIcon.innerHTML = originalPath; // Restore original SVG content
61
61
  transition(svgIcon, 1, '1');
62
- }, 125);
63
- }, 600);
64
- }, 125);
62
+ }, 60);
63
+ }, 350);
64
+ }, 60);
65
65
  } else {
66
66
  // console.error('SVG element not found within the parent.');
67
67
  }
@@ -803,9 +803,9 @@ class ShikiHighLevelCodeBlock(ShikiCodeBlock):
803
803
  "_hover": {
804
804
  "background": color("gray", 4),
805
805
  },
806
- "transition": "background 0.250s ease-out",
806
+ "transition": "background 0.12s ease-out",
807
807
  "&>svg": {
808
- "transition": "transform 0.250s ease-out, opacity 0.250s ease-out",
808
+ "transition": "transform 0.12s ease-out, opacity 0.12s ease-out",
809
809
  },
810
810
  "_active": {
811
811
  "background": color("gray", 5),
@@ -920,7 +920,7 @@ class ShikiCodeBlock(Component, MarkdownComponentMap):
920
920
  id: Any | None = None,
921
921
  ref: Var | None = None,
922
922
  class_name: Any | None = None,
923
- custom_attrs: dict[str, Var | Any] | None = None,
923
+ custom_attrs: dict[str, Any | Var] | None = None,
924
924
  on_blur: EventType[()] | None = None,
925
925
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
926
926
  on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -942,11 +942,39 @@ class ShikiCodeBlock(Component, MarkdownComponentMap):
942
942
  """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/).
943
943
 
944
944
  Args:
945
- *children: The children of the component.
946
- **props: The props to pass to the component.
945
+ *children: The children of the component.
946
+ language: The language to use.
947
+ theme: The theme to use ("light" or "dark").
948
+ themes: The set of themes to use for different modes.
949
+ code: The code to display.
950
+ transformers: The transformers to use for the syntax highlighter.
951
+ decorations: The decorations to use for the syntax highlighter.
952
+ style: The style of the component.
953
+ key: A unique key for the component.
954
+ id: The id for the component.
955
+ ref: The Var to pass as the ref to the component.
956
+ class_name: The class name for the component.
957
+ custom_attrs: Attributes passed directly to the component.
958
+ on_focus: Fired when the element (or some element inside of it) receives focus. For example, it is called when the user clicks on a text input.
959
+ on_blur: Fired when focus has left the element (or left some element inside of it). For example, it is called when the user clicks outside of a focused text input.
960
+ on_click: Fired when the user clicks on an element. For example, it's called when the user clicks on a button.
961
+ on_context_menu: Fired when the user right-clicks on an element.
962
+ on_double_click: Fired when the user double-clicks on an element.
963
+ on_mouse_down: Fired when the user presses a mouse button on an element.
964
+ on_mouse_enter: Fired when the mouse pointer enters the element.
965
+ on_mouse_leave: Fired when the mouse pointer leaves the element.
966
+ on_mouse_move: Fired when the mouse pointer moves over the element.
967
+ on_mouse_out: Fired when the mouse pointer moves out of the element.
968
+ on_mouse_over: Fired when the mouse pointer moves onto the element.
969
+ on_mouse_up: Fired when the user releases a mouse button on an element.
970
+ on_scroll: Fired when the user scrolls the element.
971
+ on_scroll_end: Fired when scrolling ends on the element.
972
+ on_mount: Fired when the component is mounted to the page.
973
+ on_unmount: Fired when the component is removed from the page. Only called during navigation, not on page refresh.
974
+ **props: The props to pass to the component.
947
975
 
948
976
  Returns:
949
- The code block component.
977
+ The code block component.
950
978
  """
951
979
 
952
980
  def add_imports(self) -> dict[str, list[str]]: ...
@@ -1524,7 +1552,7 @@ class ShikiHighLevelCodeBlock(ShikiCodeBlock):
1524
1552
  id: Any | None = None,
1525
1553
  ref: Var | None = None,
1526
1554
  class_name: Any | None = None,
1527
- custom_attrs: dict[str, Var | Any] | None = None,
1555
+ custom_attrs: dict[str, Any | Var] | None = None,
1528
1556
  on_blur: EventType[()] | None = None,
1529
1557
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
1530
1558
  on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -1546,12 +1574,43 @@ class ShikiHighLevelCodeBlock(ShikiCodeBlock):
1546
1574
  """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/).
1547
1575
 
1548
1576
  Args:
1549
- *children: The children of the component.
1550
- copy_button: copy_button: A custom copy button to override the default one.
1551
- **props: The props to pass to the component.
1577
+ *children: The children of the component.
1578
+ use_transformers: If this is enabled, the default transformers(shikijs transformer) will be used.
1579
+ show_line_numbers: If this is enabled line numbers will be shown next to the code block.
1580
+ can_copy: Whether a copy button should appear.
1581
+ copy_button: copy_button: A custom copy button to override the default one.
1582
+ language: The language to use.
1583
+ theme: The theme to use ("light" or "dark").
1584
+ themes: The set of themes to use for different modes.
1585
+ code: The code to display.
1586
+ transformers: The transformers to use for the syntax highlighter.
1587
+ decorations: The decorations to use for the syntax highlighter.
1588
+ style: The style of the component.
1589
+ key: A unique key for the component.
1590
+ id: The id for the component.
1591
+ ref: The Var to pass as the ref to the component.
1592
+ class_name: The class name for the component.
1593
+ custom_attrs: Attributes passed directly to the component.
1594
+ on_focus: Fired when the element (or some element inside of it) receives focus. For example, it is called when the user clicks on a text input.
1595
+ on_blur: Fired when focus has left the element (or left some element inside of it). For example, it is called when the user clicks outside of a focused text input.
1596
+ on_click: Fired when the user clicks on an element. For example, it's called when the user clicks on a button.
1597
+ on_context_menu: Fired when the user right-clicks on an element.
1598
+ on_double_click: Fired when the user double-clicks on an element.
1599
+ on_mouse_down: Fired when the user presses a mouse button on an element.
1600
+ on_mouse_enter: Fired when the mouse pointer enters the element.
1601
+ on_mouse_leave: Fired when the mouse pointer leaves the element.
1602
+ on_mouse_move: Fired when the mouse pointer moves over the element.
1603
+ on_mouse_out: Fired when the mouse pointer moves out of the element.
1604
+ on_mouse_over: Fired when the mouse pointer moves onto the element.
1605
+ on_mouse_up: Fired when the user releases a mouse button on an element.
1606
+ on_scroll: Fired when the user scrolls the element.
1607
+ on_scroll_end: Fired when scrolling ends on the element.
1608
+ on_mount: Fired when the component is mounted to the page.
1609
+ on_unmount: Fired when the component is removed from the page. Only called during navigation, not on page refresh.
1610
+ **props: The props to pass to the component.
1552
1611
 
1553
1612
  Returns:
1554
- The code block component.
1613
+ The code block component.
1555
1614
  """
1556
1615
 
1557
1616
  class TransformerNamespace(ComponentNamespace):
@@ -2129,7 +2188,7 @@ class CodeblockNamespace(ComponentNamespace):
2129
2188
  id: Any | None = None,
2130
2189
  ref: Var | None = None,
2131
2190
  class_name: Any | None = None,
2132
- custom_attrs: dict[str, Var | Any] | None = None,
2191
+ custom_attrs: dict[str, Any | Var] | None = None,
2133
2192
  on_blur: EventType[()] | None = None,
2134
2193
  on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
2135
2194
  on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
@@ -2151,12 +2210,43 @@ class CodeblockNamespace(ComponentNamespace):
2151
2210
  """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/).
2152
2211
 
2153
2212
  Args:
2154
- *children: The children of the component.
2155
- copy_button: copy_button: A custom copy button to override the default one.
2156
- **props: The props to pass to the component.
2213
+ *children: The children of the component.
2214
+ use_transformers: If this is enabled, the default transformers(shikijs transformer) will be used.
2215
+ show_line_numbers: If this is enabled line numbers will be shown next to the code block.
2216
+ can_copy: Whether a copy button should appear.
2217
+ copy_button: copy_button: A custom copy button to override the default one.
2218
+ language: The language to use.
2219
+ theme: The theme to use ("light" or "dark").
2220
+ themes: The set of themes to use for different modes.
2221
+ code: The code to display.
2222
+ transformers: The transformers to use for the syntax highlighter.
2223
+ decorations: The decorations to use for the syntax highlighter.
2224
+ style: The style of the component.
2225
+ key: A unique key for the component.
2226
+ id: The id for the component.
2227
+ ref: The Var to pass as the ref to the component.
2228
+ class_name: The class name for the component.
2229
+ custom_attrs: Attributes passed directly to the component.
2230
+ on_focus: Fired when the element (or some element inside of it) receives focus. For example, it is called when the user clicks on a text input.
2231
+ on_blur: Fired when focus has left the element (or left some element inside of it). For example, it is called when the user clicks outside of a focused text input.
2232
+ on_click: Fired when the user clicks on an element. For example, it's called when the user clicks on a button.
2233
+ on_context_menu: Fired when the user right-clicks on an element.
2234
+ on_double_click: Fired when the user double-clicks on an element.
2235
+ on_mouse_down: Fired when the user presses a mouse button on an element.
2236
+ on_mouse_enter: Fired when the mouse pointer enters the element.
2237
+ on_mouse_leave: Fired when the mouse pointer leaves the element.
2238
+ on_mouse_move: Fired when the mouse pointer moves over the element.
2239
+ on_mouse_out: Fired when the mouse pointer moves out of the element.
2240
+ on_mouse_over: Fired when the mouse pointer moves onto the element.
2241
+ on_mouse_up: Fired when the user releases a mouse button on an element.
2242
+ on_scroll: Fired when the user scrolls the element.
2243
+ on_scroll_end: Fired when scrolling ends on the element.
2244
+ on_mount: Fired when the component is mounted to the page.
2245
+ on_unmount: Fired when the component is removed from the page. Only called during navigation, not on page refresh.
2246
+ **props: The props to pass to the component.
2157
2247
 
2158
2248
  Returns:
2159
- The code block component.
2249
+ The code block component.
2160
2250
  """
2161
2251
 
2162
2252
  code_block = CodeblockNamespace()