figpack 0.2.33__py3-none-any.whl → 0.2.35__py3-none-any.whl

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.

Potentially problematic release.


This version of figpack might be problematic. Click here for more details.

@@ -9,7 +9,7 @@
9
9
  // Allow script injection from trusted domains (see src/main.tsx)
10
10
  window.script_injection_allowed_domains = ['https://manage.figpack.org', 'https://figpack.org'];
11
11
  </script>
12
- <script type="module" crossorigin src="./assets/index-CbC7KfMC.js"></script>
12
+ <script type="module" crossorigin src="./assets/index-DXkrNeMu.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="./assets/index-V5m_wCvw.css">
14
14
  </head>
15
15
  <body>
@@ -0,0 +1,64 @@
1
+ """
2
+ CaptionedView for figpack - displays a view with a caption below it
3
+ """
4
+
5
+ from typing import Optional
6
+ import numpy as np
7
+
8
+ from ..core.figpack_view import FigpackView
9
+ from ..core.zarr import Group
10
+
11
+
12
+ class CaptionedView(FigpackView):
13
+ """
14
+ A view that displays a child view with a text caption below it.
15
+ The caption height dynamically adjusts based on text length and container width.
16
+ """
17
+
18
+ def __init__(
19
+ self,
20
+ *,
21
+ view: FigpackView,
22
+ caption: str,
23
+ font_size: Optional[int] = None,
24
+ ):
25
+ """
26
+ Initialize a CaptionedView
27
+
28
+ Args:
29
+ view: The child view to display above the caption
30
+ caption: The text caption to display below the view
31
+ font_size: Optional font size for the caption text (default: 14)
32
+ """
33
+ self.view = view
34
+ self.caption = caption
35
+ self.font_size = font_size if font_size is not None else 14
36
+
37
+ def write_to_zarr_group(self, group: Group) -> None:
38
+ """
39
+ Write the CaptionedView data to a Zarr group
40
+
41
+ Args:
42
+ group: Zarr group to write data into
43
+ """
44
+ # Set the view type
45
+ group.attrs["view_type"] = "CaptionedView"
46
+
47
+ # Set caption properties
48
+ group.attrs["font_size"] = self.font_size
49
+
50
+ # Convert caption string to numpy array of bytes
51
+ caption_bytes = self.caption.encode("utf-8")
52
+ caption_array = np.frombuffer(caption_bytes, dtype=np.uint8)
53
+
54
+ # Store the caption as a zarr array
55
+ group.create_dataset("caption_data", data=caption_array)
56
+
57
+ # Store caption size in attrs
58
+ group.attrs["caption_size"] = len(caption_bytes)
59
+
60
+ # Create a subgroup for the child view
61
+ child_group = group.create_group("child_view")
62
+
63
+ # Recursively write the child view to the subgroup
64
+ self.view.write_to_zarr_group(child_group)
figpack/views/__init__.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from .Box import Box
2
+ from .CaptionedView import CaptionedView
2
3
  from .DataFrame import DataFrame
3
4
  from .Gallery import Gallery
4
5
  from .GalleryItem import GalleryItem
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: figpack
3
- Version: 0.2.33
3
+ Version: 0.2.35
4
4
  Summary: A Python package for creating shareable, interactive visualizations in the browser
5
5
  Author-email: Jeremy Magland <jmagland@flatironinstitute.org>
6
6
  License: Apache-2.0
@@ -1,4 +1,4 @@
1
- figpack/__init__.py,sha256=oO07qDsMNaszQdaMRE1HH1hZeqplVlnB0XMFInzdh0Y,358
1
+ figpack/__init__.py,sha256=7Q_sLtYRKyTVLtkTc5VZ21KUBsu3u5OBIihRytwY73s,358
2
2
  figpack/cli.py,sha256=s1mGQuFSntxiIvU6OWwHVlM9Cj-l1zMQ3OzFFe1-5ZE,11089
3
3
  figpack/extensions.py,sha256=mILB4_F1RHkca4I7t88zh74IX8VCmfT7XFZZT4XYdNw,13009
4
4
  figpack/core/__init__.py,sha256=7zU6O1piTk07aeCfbU81QqTgSHIO2n5MZ4LFNmsrtfs,192
@@ -14,11 +14,12 @@ figpack/core/extension_view.py,sha256=FSBXdhFEWicLi0jhkuRdS-a8CNsULrEqqIKtYfV3tm
14
14
  figpack/core/figpack_extension.py,sha256=KSJKlnLYueFnGa8QFMpbIF3CDMwnIZJOqsI0smz6cUc,2252
15
15
  figpack/core/figpack_view.py,sha256=SMc5mZztmzbFriWu4N5YVqRdl3TvhkDVPGjZlk1uWBE,7089
16
16
  figpack/core/zarr.py,sha256=LTWOIX6vuH25STYTQS9_apfnfYXmATAEQkil3z9eYKE,1634
17
- figpack/figpack-figure-dist/index.html,sha256=CrX3OQEZC4sV0BtcjeQwiGH8afeih7zL_IAQ3n4gVNQ,688
18
- figpack/figpack-figure-dist/assets/index-CbC7KfMC.js,sha256=fv3Fs53oukQIX2IlBsWqAm5tYUZe-3W-p83isvlalHo,1112037
17
+ figpack/figpack-figure-dist/index.html,sha256=D_jEKFrFKWBi-hFvMhSzQm9HmSvNUBZA2zJLIZXc7KA,688
18
+ figpack/figpack-figure-dist/assets/index-DXkrNeMu.js,sha256=1bIKjBQ2IndmHFu_MYi6JLqO9JQi6cgIeogu7_zrPBg,1114402
19
19
  figpack/figpack-figure-dist/assets/index-V5m_wCvw.css,sha256=WRtQLW6SNlTlLtepSOt89t1z41SD7XzYUyRldqowjMM,7286
20
20
  figpack/figpack-figure-dist/assets/neurosift-logo-CLsuwLMO.png,sha256=g5m-TwrGh5f6-9rXtWV-znH4B0nHgc__0GWclRDLUHs,9307
21
21
  figpack/views/Box.py,sha256=oN_OJH2pK_hH26k0eFCFjlfuJssVqKvw20GxYK1HX7g,2419
22
+ figpack/views/CaptionedView.py,sha256=Lgv4ZMs0LqHuzLIjEGVZhq2zzv-Ufa9pqUCyky8DuCY,1908
22
23
  figpack/views/DataFrame.py,sha256=VGspmfWtnZ4Gvea5zd-ODpiJPQEp8gVv-ScDhVVCeyA,3400
23
24
  figpack/views/Gallery.py,sha256=15ukt9CmgkbT8q_okEYYDESW1E7vOJkVPombSlrEWKw,3324
24
25
  figpack/views/GalleryItem.py,sha256=b_upJno5P3ANSulbG-h3t6Xj56tPGJ7iVxqyiZu3zaQ,1244
@@ -35,14 +36,14 @@ figpack/views/Splitter.py,sha256=BR2L-8aqicTubS1rSzsQ3XnhoJcX5GcfEnVWtEWEs0w,201
35
36
  figpack/views/TabLayout.py,sha256=AqdHPLcP2-caWjxbkC8r8m60z8n_eyZrIBGOOPSVNCs,1908
36
37
  figpack/views/TabLayoutItem.py,sha256=xmHA0JsW_6naJze4_mQuP_Fy0Nm17p2N7w_AsmVRp8k,880
37
38
  figpack/views/TimeseriesGraph.py,sha256=y3tl0-95dGw01GdVwNlEzO5xg9WPLNGvvfgF3VxsusY,21700
38
- figpack/views/__init__.py,sha256=L4Ikj6s5VXZtKEATVFkY_szB14w6-nqh_vdP_FvD4kc,668
39
+ figpack/views/__init__.py,sha256=eZVhNCRRUIYtXou__k2tfNjPKyrc576whfZsVFagofY,709
39
40
  figpack/views/PlotlyExtension/PlotlyExtension.py,sha256=LOFSqbm46UZ7HsHTDxUPnNB33ydYQvEkRVK-TSKkzK4,2149
40
41
  figpack/views/PlotlyExtension/__init__.py,sha256=80Wy1mDMWyagjuR99ECxJePIYpRQ6TSyHkB0uZoBZ_0,70
41
42
  figpack/views/PlotlyExtension/_plotly_extension.py,sha256=yZjG1NMGlQedeeLdV6TQWpi_NTm5Wfk5eWbXEdZbbFE,1455
42
43
  figpack/views/PlotlyExtension/plotly_view.js,sha256=9BjgOPkqGl87SSonnb48nFeQV3UTIi1trpSPxd9qlKo,3055
43
- figpack-0.2.33.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
44
- figpack-0.2.33.dist-info/METADATA,sha256=apZv4-R2FK1mDzqerIZlpR2wQXIMoIITcLf0Z6mHKNU,4618
45
- figpack-0.2.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
- figpack-0.2.33.dist-info/entry_points.txt,sha256=l6d3siH2LxXa8qJGbjAqpIZtI5AkMSyDeoRDCzdrUto,45
47
- figpack-0.2.33.dist-info/top_level.txt,sha256=lMKGaC5xWmAYBx9Ac1iMokm42KFnJFjmkP2ldyvOo-c,8
48
- figpack-0.2.33.dist-info/RECORD,,
44
+ figpack-0.2.35.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
+ figpack-0.2.35.dist-info/METADATA,sha256=KWYwiIEERtODLFj9Q_lFFvjEQMvUplHQehQ2dQKs4FM,4618
46
+ figpack-0.2.35.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
+ figpack-0.2.35.dist-info/entry_points.txt,sha256=l6d3siH2LxXa8qJGbjAqpIZtI5AkMSyDeoRDCzdrUto,45
48
+ figpack-0.2.35.dist-info/top_level.txt,sha256=lMKGaC5xWmAYBx9Ac1iMokm42KFnJFjmkP2ldyvOo-c,8
49
+ figpack-0.2.35.dist-info/RECORD,,