@loveluthien/carta-frontend 6.0.0-dev

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 (148) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
  2. package/.github/pull_request_template.md +23 -0
  3. package/.github/workflows/continuous_integration.yml +139 -0
  4. package/.github/workflows/deploy.yml +30 -0
  5. package/.husky/pre-commit +16 -0
  6. package/.husky/pre-push +42 -0
  7. package/.prettierignore +1 -0
  8. package/.prettierrc.json +18 -0
  9. package/CHANGELOG.md +363 -0
  10. package/COPYING.md +636 -0
  11. package/README.md +112 -0
  12. package/babel.config.json +10 -0
  13. package/build/ast_wrapper.wasm +0 -0
  14. package/build/carta_computation.wasm +0 -0
  15. package/build/carta_icon_128px.png +0 -0
  16. package/build/carta_logo.png +0 -0
  17. package/build/gsl_wrapper.wasm +0 -0
  18. package/build/index.html +147 -0
  19. package/build/manifest.json +15 -0
  20. package/build/robots.txt +3 -0
  21. package/build/static/css/546.aa44a897.css +1 -0
  22. package/build/static/css/async/359.4d8f6ff7.css +1 -0
  23. package/build/static/css/async/403.ea9edfac.css +1 -0
  24. package/build/static/css/async/462.8bde08e0.css +1 -0
  25. package/build/static/css/index.c1f77b92.css +1 -0
  26. package/build/static/font/blueprint-icons-16.5fb1af27.woff2 +0 -0
  27. package/build/static/font/blueprint-icons-16.79f603d1.woff +0 -0
  28. package/build/static/font/blueprint-icons-16.83d51978.eot +0 -0
  29. package/build/static/font/blueprint-icons-16.af0c342f.ttf +0 -0
  30. package/build/static/font/blueprint-icons-20.83fddc09.ttf +0 -0
  31. package/build/static/font/blueprint-icons-20.9a51bc58.woff +0 -0
  32. package/build/static/font/blueprint-icons-20.d61315fe.eot +0 -0
  33. package/build/static/font/blueprint-icons-20.ebf16e9a.woff2 +0 -0
  34. package/build/static/image/allmaps.03f2ba92.png +0 -0
  35. package/build/static/image/gamma.6fca425b.png +0 -0
  36. package/build/static/image/linear.c7941b64.png +0 -0
  37. package/build/static/image/log.7fce6aee.png +0 -0
  38. package/build/static/image/power.5dac9727.png +0 -0
  39. package/build/static/image/sqrt.0ec2b3f1.png +0 -0
  40. package/build/static/image/squared.798b23aa.png +0 -0
  41. package/build/static/js/546.b5841ade.js +489 -0
  42. package/build/static/js/546.b5841ade.js.LICENSE.txt +925 -0
  43. package/build/static/js/async/359.97257512.js +1 -0
  44. package/build/static/js/async/403.b00f768c.js +1 -0
  45. package/build/static/js/async/462.92c07a07.js +1 -0
  46. package/build/static/js/async/905.70044ee8.js +1 -0
  47. package/build/static/js/async/907.dc17f1d2.js +1 -0
  48. package/build/static/js/async/blueprint-icons-16px-paths.e17db832.js +1 -0
  49. package/build/static/js/async/blueprint-icons-20px-paths.6ad43f5f.js +1 -0
  50. package/build/static/js/async/blueprint-icons-all-paths-loader.61cc0f7b.js +1 -0
  51. package/build/static/js/async/blueprint-icons-all-paths.0c699441.js +1 -0
  52. package/build/static/js/async/blueprint-icons-split-paths-by-size-loader.5cff79f5.js +1 -0
  53. package/build/static/js/index.8fc34b4d.js +1344 -0
  54. package/build/static/js/index.9a30d560.worker.js +1 -0
  55. package/build/static/js/zfp_wrapper.wasm +0 -0
  56. package/build/static/svg/blueprint-icons-16.130888ef.svg +2097 -0
  57. package/build/static/svg/blueprint-icons-20.c8456d56.svg +2097 -0
  58. package/build/zfp_wrapper.wasm +0 -0
  59. package/declarations.d.ts +18 -0
  60. package/docs_website/.prettierignore +1 -0
  61. package/docs_website/api/api.md +13 -0
  62. package/docs_website/babel.config.js +3 -0
  63. package/docs_website/docs/assets/enable-code-snippets.png +0 -0
  64. package/docs_website/docs/code-snippet-tutorial/_category_.json +8 -0
  65. package/docs_website/docs/code-snippet-tutorial/basics.md +97 -0
  66. package/docs_website/docs/code-snippet-tutorial/image-blending.mdx +57 -0
  67. package/docs_website/docs/code-snippet-tutorial/image-fitting.mdx +44 -0
  68. package/docs_website/docs/code-snippet-tutorial/image-properties.mdx +84 -0
  69. package/docs_website/docs/code-snippet-tutorial/moment-images.mdx +31 -0
  70. package/docs_website/docs/code-snippet-tutorial/pv-images.mdx +28 -0
  71. package/docs_website/docs/code-snippet-tutorial/quick-start.mdx +82 -0
  72. package/docs_website/docs/code-snippet-tutorial/regions.mdx +49 -0
  73. package/docs_website/docs/contributing/_category_.json +7 -0
  74. package/docs_website/docs/contributing/developer-tips.md +61 -0
  75. package/docs_website/docs/contributing/documentation-guidelines.md +87 -0
  76. package/docs_website/docs/contributing/github-workflow.md +146 -0
  77. package/docs_website/docs/contributing/release-guidelines.md +73 -0
  78. package/docs_website/docs/contributing/unit-test-guidelines.md +79 -0
  79. package/docs_website/docs/documents.mdx +15 -0
  80. package/docs_website/docusaurus.config.js +167 -0
  81. package/docs_website/package-lock.json +16769 -0
  82. package/docs_website/package.json +121 -0
  83. package/docs_website/patches/@docusaurus+core+3.9.2.patch +20 -0
  84. package/docs_website/sidebars.js +33 -0
  85. package/docs_website/static/.nojekyll +0 -0
  86. package/docs_website/static/img/carta_icon_128px.png +0 -0
  87. package/docs_website/versioned_docs/version-4.1.0/api-packages.json +1 -0
  88. package/docs_website/versioned_docs/version-4.1.0/api-typedoc.json +214112 -0
  89. package/docs_website/versioned_docs/version-4.1.0/assets/enable-code-snippets.png +0 -0
  90. package/docs_website/versioned_docs/version-4.1.0/code-snippet-tutorial/_category_.json +8 -0
  91. package/docs_website/versioned_docs/version-4.1.0/code-snippet-tutorial/basics.md +97 -0
  92. package/docs_website/versioned_docs/version-4.1.0/code-snippet-tutorial/image-fitting.mdx +42 -0
  93. package/docs_website/versioned_docs/version-4.1.0/code-snippet-tutorial/image-properties.mdx +86 -0
  94. package/docs_website/versioned_docs/version-4.1.0/code-snippet-tutorial/moment-images.mdx +31 -0
  95. package/docs_website/versioned_docs/version-4.1.0/code-snippet-tutorial/pv-images.mdx +28 -0
  96. package/docs_website/versioned_docs/version-4.1.0/code-snippet-tutorial/quick-start.mdx +82 -0
  97. package/docs_website/versioned_docs/version-4.1.0/code-snippet-tutorial/regions.mdx +49 -0
  98. package/docs_website/versioned_docs/version-4.1.0/contributing/_category_.json +7 -0
  99. package/docs_website/versioned_docs/version-4.1.0/contributing/developer-tips.md +36 -0
  100. package/docs_website/versioned_docs/version-4.1.0/contributing/documentation-guidelines.md +87 -0
  101. package/docs_website/versioned_docs/version-4.1.0/contributing/github-workflow.md +141 -0
  102. package/docs_website/versioned_docs/version-4.1.0/contributing/release-guidelines.md +73 -0
  103. package/docs_website/versioned_docs/version-4.1.0/contributing/unit-test-guidelines.md +79 -0
  104. package/docs_website/versioned_docs/version-4.1.0/documents.mdx +15 -0
  105. package/docs_website/versioned_docs/version-5.0.0/api-packages.json +1 -0
  106. package/docs_website/versioned_docs/version-5.0.0/api-typedoc.json +315266 -0
  107. package/docs_website/versioned_docs/version-5.0.0/assets/enable-code-snippets.png +0 -0
  108. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/_category_.json +8 -0
  109. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/basics.md +97 -0
  110. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/image-blending.mdx +57 -0
  111. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/image-fitting.mdx +44 -0
  112. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/image-properties.mdx +86 -0
  113. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/moment-images.mdx +31 -0
  114. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/pv-images.mdx +28 -0
  115. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/quick-start.mdx +82 -0
  116. package/docs_website/versioned_docs/version-5.0.0/code-snippet-tutorial/regions.mdx +49 -0
  117. package/docs_website/versioned_docs/version-5.0.0/contributing/_category_.json +7 -0
  118. package/docs_website/versioned_docs/version-5.0.0/contributing/developer-tips.md +36 -0
  119. package/docs_website/versioned_docs/version-5.0.0/contributing/documentation-guidelines.md +87 -0
  120. package/docs_website/versioned_docs/version-5.0.0/contributing/github-workflow.md +141 -0
  121. package/docs_website/versioned_docs/version-5.0.0/contributing/release-guidelines.md +73 -0
  122. package/docs_website/versioned_docs/version-5.0.0/contributing/unit-test-guidelines.md +79 -0
  123. package/docs_website/versioned_docs/version-5.0.0/documents.mdx +15 -0
  124. package/docs_website/versioned_sidebars/version-4.1.0-sidebars.json +8 -0
  125. package/docs_website/versioned_sidebars/version-5.0.0-sidebars.json +8 -0
  126. package/docs_website/versions.json +4 -0
  127. package/eslint.config.mjs +86 -0
  128. package/jest.config.js +101 -0
  129. package/package.json +186 -0
  130. package/patches/golden-layout+1.5.9.patch +24 -0
  131. package/patches/react-split-pane+0.1.92.patch +20 -0
  132. package/rsbuild.config.ts +75 -0
  133. package/schemas/.github/workflows/AddToCartaVisProject.yml +23 -0
  134. package/schemas/.prettierrc.json +18 -0
  135. package/schemas/CMakeLists.txt +15 -0
  136. package/schemas/README.md +1 -0
  137. package/schemas/_config.yml +7 -0
  138. package/schemas/controller_config_schema_1.json +343 -0
  139. package/schemas/controller_config_schema_2.json +685 -0
  140. package/schemas/layout_schema_2.json +440 -0
  141. package/schemas/preference_backend_schema_1.json +81 -0
  142. package/schemas/preference_backend_schema_2.json +118 -0
  143. package/schemas/preference_schema_1.json +410 -0
  144. package/schemas/preferences_schema_2.json +421 -0
  145. package/schemas/schemacompiler.c +200 -0
  146. package/schemas/snippet_schema_1.json +45 -0
  147. package/schemas/workspace_schema_1.json +573 -0
  148. package/scripts/make_colormaps.py +161 -0
@@ -0,0 +1,161 @@
1
+ # /// script
2
+ # requires-python = ">=3.11"
3
+ # dependencies = [
4
+ # "matplotlib>=3.9",
5
+ # "numpy>=1.25",
6
+ # ]
7
+ # ///
8
+ """Generate a stacked colormap PNG from CARTA's colormap definitions.
9
+
10
+ This script reads COLOR_MAPS_ALL and COLOR_MAPS_MONO from color.ts,
11
+ filters out monochrome colormaps, and generates a single PNG image with each
12
+ colormap rendered as a horizontal stripe. The output is used by the CARTA
13
+ frontend for both colormap previews (in the dropdown selector) and as a lookup
14
+ texture for WebGL rendering of image tiles, contours, and overlays.
15
+
16
+ Usage (uv):
17
+ uv run make_colormaps.py # Output to src/static/allmaps.png
18
+ uv run make_colormaps.py --out FILE # Output to custom path
19
+ Usage (python):
20
+ python make_colormaps.py # Output to src/static/allmaps.png
21
+ python make_colormaps.py --out FILE # Output to custom path
22
+
23
+ For Python users, it is best to install dependencies matching the script header
24
+ (python>=3.11, matplotlib>=3.9, numpy>=1.25) before running directly.
25
+ """
26
+
27
+ import argparse
28
+ import re
29
+ from collections.abc import Sequence
30
+ from os import PathLike
31
+ from pathlib import Path
32
+
33
+ import matplotlib as mpl
34
+ import matplotlib.pyplot as plt
35
+ import numpy as np
36
+
37
+ MPL_CMAP_MAPPING = {
38
+ cmap.lower(): mpl.colormaps.get_cmap(cmap) for cmap in mpl.colormaps
39
+ }
40
+
41
+
42
+ def extract_color_maps(file: str | PathLike) -> tuple[list[str], list[str]]:
43
+ """Extract COLOR_MAPS_ALL and COLOR_MAPS_MONO from color.ts."""
44
+ results = {
45
+ "COLOR_MAPS_ALL": [],
46
+ "COLOR_MAPS_MONO": [],
47
+ }
48
+ current = None
49
+ with open(file, "r") as f:
50
+ for line in f:
51
+ for name in results:
52
+ if f"{name} = " in line:
53
+ current = name
54
+ break
55
+ else:
56
+ if current:
57
+ if ";" in line:
58
+ current = None
59
+ elif match := re.search(r'"(.*?)"', line):
60
+ results[current].append(match.group(1))
61
+ return results["COLOR_MAPS_ALL"], results["COLOR_MAPS_MONO"]
62
+
63
+
64
+ def validate_colormap_order(
65
+ color_maps_all: list[str], color_maps_mono: list[str]
66
+ ) -> None:
67
+ """Validate COLOR_MAPS_MONO entries exist and are the trailing block of COLOR_MAPS_ALL."""
68
+ if not color_maps_all:
69
+ raise ValueError("COLOR_MAPS_ALL not found in color.ts")
70
+ if not color_maps_mono:
71
+ raise ValueError("COLOR_MAPS_MONO not found in color.ts")
72
+
73
+ missing = [name for name in color_maps_mono if name not in color_maps_all]
74
+ if missing:
75
+ raise ValueError(
76
+ f"COLOR_MAPS_MONO entries missing from COLOR_MAPS_ALL: {missing}"
77
+ )
78
+
79
+ indices = [color_maps_all.index(name) for name in color_maps_mono]
80
+ expected_start = len(color_maps_all) - len(color_maps_mono)
81
+ expected_indices = list(range(expected_start, len(color_maps_all)))
82
+ if indices != expected_indices:
83
+ raise ValueError(
84
+ "COLOR_MAPS_MONO entries must appear at the end of COLOR_MAPS_ALL in the same order"
85
+ )
86
+
87
+
88
+ def get_colormaps(names: list[str]) -> Sequence[mpl.colors.Colormap]:
89
+ """Get matplotlib Colormap objects from a list of colormap names."""
90
+ colormaps = []
91
+ not_found = []
92
+ for name in names:
93
+ if name.lower() in MPL_CMAP_MAPPING:
94
+ colormaps.append(MPL_CMAP_MAPPING[name.lower()])
95
+ else:
96
+ not_found.append(name)
97
+ if not_found:
98
+ raise ValueError(f"Colormaps not found in matplotlib: {not_found}")
99
+ return colormaps
100
+
101
+
102
+ def build_image(
103
+ colormaps: Sequence[mpl.colors.Colormap],
104
+ width: int = 1024,
105
+ stripe_height: int = 5,
106
+ ) -> np.ndarray:
107
+ """Build a stacked colormap image from a sequence of colormaps."""
108
+ x = np.linspace(0, 1, width, dtype=np.float32)[None, :]
109
+ grad = np.tile(x, (stripe_height, 1))
110
+ rows = np.vstack([cmap(grad, bytes=True) for cmap in colormaps])
111
+ return rows
112
+
113
+
114
+ def main():
115
+ """Generate and save a colormap image from CARTA's colormap definitions."""
116
+ parser = argparse.ArgumentParser(description="Generate a colormap image.")
117
+ parser.add_argument("--out", type=str)
118
+ args = parser.parse_args()
119
+
120
+ # Set output path
121
+ if args.out is None:
122
+ output = (
123
+ Path(__file__).parent.parent / "src" / "static" / "allmaps.png"
124
+ )
125
+ else:
126
+ output = Path(args.out)
127
+
128
+ # Create parent directory if it does not exist
129
+ output.parent.mkdir(parents=True, exist_ok=True)
130
+
131
+ # Extract COLOR_MAPS_ALL and COLOR_MAPS_MONO
132
+ file = (
133
+ Path(__file__).parent.parent
134
+ / "src"
135
+ / "utilities"
136
+ / "color"
137
+ / "color.ts"
138
+ )
139
+ color_maps_all, color_maps_mono = extract_color_maps(file)
140
+
141
+ # Ensure COLOR_MAPS_MONO is the last entries of COLOR_MAPS_ALL
142
+ validate_colormap_order(color_maps_all, color_maps_mono)
143
+
144
+ # Filter out monochrome colormaps
145
+ colormap_names = [
146
+ name for name in color_maps_all if name not in color_maps_mono
147
+ ]
148
+
149
+ # Get colormaps
150
+ colormaps = get_colormaps(colormap_names)
151
+
152
+ # Build image
153
+ image = build_image(colormaps)
154
+
155
+ # Save image
156
+ plt.imsave(output, image, dpi=72)
157
+ print(f"Saved {len(colormaps)} colormaps to {output}")
158
+
159
+
160
+ if __name__ == "__main__":
161
+ main()