funcnodes-react-flow 0.3.12__py3-none-any.whl → 0.3.13__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.
@@ -1,22 +1,10 @@
1
- from typing import Dict, TypedDict, List
1
+ from typing import TypedDict, List
2
2
 
3
3
  try:
4
4
  from .run import run_server # noqa: F401
5
5
  except ImportError:
6
6
  pass
7
-
8
-
9
- class ReactPlugin(TypedDict):
10
- """
11
- A typed dictionary for a React plugin.
12
-
13
- Attributes:
14
- js (list[str]): A list of JavaScript files.
15
- """
16
-
17
- js: list[str]
18
- css: list[str]
19
- module: str
7
+ from .plugin_setup import ReactPlugin, setup, FUNCNODES_REACT_PLUGIN
20
8
 
21
9
 
22
10
  class ExpandedReactPlugin(TypedDict):
@@ -32,20 +20,6 @@ class ExpandedReactPlugin(TypedDict):
32
20
  css: List[bytes]
33
21
 
34
22
 
35
- FUNCNODES_REACT_PLUGIN: Dict[str, ReactPlugin] = {}
36
-
37
-
38
- def add_react_plugin(name: str, plugin: ReactPlugin):
39
- """
40
- Add a React plugin to the FUNCNODES_REACT_PLUGIN dictionary.
41
-
42
- Args:
43
- name (str): The name of the plugin.
44
- plugin (ReactPlugin): The plugin to add.
45
- """
46
- FUNCNODES_REACT_PLUGIN[str(name)] = plugin
47
-
48
-
49
23
  def get_react_plugin_content(key: str) -> ExpandedReactPlugin:
50
24
  """
51
25
  Get the content of a React plugin.
@@ -58,6 +32,9 @@ def get_react_plugin_content(key: str) -> ExpandedReactPlugin:
58
32
  """
59
33
  key = str(key)
60
34
 
35
+ if key not in FUNCNODES_REACT_PLUGIN:
36
+ raise ValueError(f"React plugin {key} not found")
37
+
61
38
  with open(FUNCNODES_REACT_PLUGIN[key]["module"], "rb") as f:
62
39
  module = f.read()
63
40
  resp: ExpandedReactPlugin = {"js": [], "module": module, "css": []}
@@ -71,3 +48,15 @@ def get_react_plugin_content(key: str) -> ExpandedReactPlugin:
71
48
  with open(css, "rb") as f:
72
49
  resp["css"].append(f.read())
73
50
  return resp
51
+
52
+
53
+ setup()
54
+
55
+
56
+ __all__ = [
57
+ "run_server",
58
+ "ReactPlugin",
59
+ "FUNCNODES_REACT_PLUGIN",
60
+ "get_react_plugin_content",
61
+ "ReactPlugin",
62
+ ]
@@ -0,0 +1,43 @@
1
+ from typing import Dict
2
+ from funcnodes_core import plugins
3
+
4
+
5
+ class ReactPlugin(plugins.BasePlugin):
6
+ """
7
+ A typed dictionary for a React plugin.
8
+
9
+ Attributes:
10
+ js (list[str]): A list of JavaScript files.
11
+ """
12
+
13
+ js: list[str]
14
+ css: list[str]
15
+
16
+
17
+ FUNCNODES_REACT_PLUGIN: Dict[str, ReactPlugin] = {}
18
+
19
+
20
+ def add_react_plugin(name: str, plugin: ReactPlugin):
21
+ """
22
+ Add a React plugin to the FUNCNODES_REACT_PLUGIN dictionary.
23
+
24
+ Args:
25
+ name (str): The name of the plugin.
26
+ plugin (ReactPlugin): The plugin to add.
27
+ """
28
+ FUNCNODES_REACT_PLUGIN[str(name)] = plugin
29
+
30
+
31
+ def plugin_function(installed_module: plugins.InstalledModule):
32
+ entry_points = installed_module.entry_points
33
+ mod = installed_module.module
34
+
35
+ if "react_plugin" in entry_points:
36
+ add_react_plugin(mod, entry_points["react_plugin"])
37
+ elif hasattr(mod, "REACT_PLUGIN"):
38
+ add_react_plugin(mod, mod.REACT_PLUGIN)
39
+ entry_points["react_plugin"] = mod.REACT_PLUGIN
40
+
41
+
42
+ def setup():
43
+ plugins.register_setup_plugin(plugin_function)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: funcnodes-react-flow
3
- Version: 0.3.12
3
+ Version: 0.3.13
4
4
  Summary: funcnodes frontend for react flow
5
5
  License: AGPL-3.0
6
6
  Author: Julian Kimmig
@@ -8,7 +8,7 @@ Author-email: julian.kimmig@linkdlab.de>
8
8
  Requires-Python: >=3.11
9
9
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
10
10
  Requires-Dist: funcnodes (>=0.5.25) ; sys_platform != "emscripten"
11
- Requires-Dist: funcnodes-core (>=0.3.8)
11
+ Requires-Dist: funcnodes-core (>=0.3.41)
12
12
  Project-URL: Homepage, https://github.com/Linkdlab/funcnodes_react_flow
13
13
  Project-URL: download, https://pypi.org/project/funcnodes-react-flow/#files
14
14
  Project-URL: source, https://github.com/Linkdlab/funcnodes_react_flow
@@ -1,5 +1,6 @@
1
- funcnodes_react_flow/__init__.py,sha256=MtXQZ64v0VUH6a6p39WdkKlZDSOLQe6TKloGbkqY5nQ,1696
1
+ funcnodes_react_flow/__init__.py,sha256=7DAPV27u5aC9X98YIGIHu1bRRcMdKduHwg9tMTx0Ddc,1454
2
2
  funcnodes_react_flow/__main__.py,sha256=79nKibsa_5l066OU4fpHnims30464ZZy-N18CGwb5Mk,834
3
+ funcnodes_react_flow/plugin_setup.py,sha256=orrk4l4A69gGZsrYmLvP5WEQWc-5qzhwf0B9rlVHJ2Y,1060
3
4
  funcnodes_react_flow/run.py,sha256=Eong6BUNms3BIxkpv4ILWSRN-STT-g5DZEpEYV0rj8I,512
4
5
  funcnodes_react_flow/static/android-chrome-192x192.png,sha256=h4hbdDXDtvScWqUT58h4E7HHUgdfqqGQq_M_O9cjS0c,21618
5
6
  funcnodes_react_flow/static/android-chrome-512x512.png,sha256=DrT8R6pyDlXCY8s3xK7XoI7kA9B_tauSHDvAEOGuhhs,109112
@@ -17,8 +18,8 @@ funcnodes_react_flow/static/logo192.png,sha256=XAIrH5_B6T77mW4eEP2emYcTkprrwuokS
17
18
  funcnodes_react_flow/static/logo512.png,sha256=9SEEPsgJusj_-fxvDf11ea2YpUKXOdLhSPT3DNRw9e8,65653
18
19
  funcnodes_react_flow/static/manifest.json,sha256=ULPYw5A68_eNhxuUVXqxT045yhkurKPSz6hjyGcnmhQ,492
19
20
  funcnodes_react_flow/static/robots.txt,sha256=kNJLw79pisHhc3OVAimMzKcq3x9WT6sF9IS4xI0crdI,67
20
- funcnodes_react_flow-0.3.12.dist-info/LICENSE,sha256=21Lj2q2SYKHMY4768_a3pr3q0jY2VYamAHipoodhMDc,34273
21
- funcnodes_react_flow-0.3.12.dist-info/METADATA,sha256=nDU4WAFoiwLiD8VX-Zdg_qmdIlFkiumH-VEmoK9cIHw,776
22
- funcnodes_react_flow-0.3.12.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
23
- funcnodes_react_flow-0.3.12.dist-info/entry_points.txt,sha256=FbrfqRLScFuNXaVpoyfz7lPcSjTlRf4G06ZUZhTgJMM,75
24
- funcnodes_react_flow-0.3.12.dist-info/RECORD,,
21
+ funcnodes_react_flow-0.3.13.dist-info/LICENSE,sha256=21Lj2q2SYKHMY4768_a3pr3q0jY2VYamAHipoodhMDc,34273
22
+ funcnodes_react_flow-0.3.13.dist-info/METADATA,sha256=09sii-J9wdkKQvDc9pCU0sZnGIIl88owmaFRDt0-f04,777
23
+ funcnodes_react_flow-0.3.13.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
24
+ funcnodes_react_flow-0.3.13.dist-info/entry_points.txt,sha256=eXzH_hMr3HHg35s8Qw9fCT5NDAG2avZcxIdsCWgFWJo,148
25
+ funcnodes_react_flow-0.3.13.dist-info/RECORD,,
@@ -1,3 +1,6 @@
1
1
  [console_scripts]
2
2
  funcnodes_react_flow=funcnodes_react_flow.__main__:main
3
3
 
4
+ [funcnodes.module]
5
+ plugin_setup=funcnodes_react_flow.plugin_setup:setup
6
+