ex4nicegui 0.8.10__py3-none-any.whl → 0.9.1__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.
Files changed (62) hide show
  1. ex4nicegui/__init__.py +3 -2
  2. ex4nicegui/bi/dataSource.py +1 -2
  3. ex4nicegui/bi/elements/ui_aggrid.py +1 -2
  4. ex4nicegui/bi/protocols.py +10 -20
  5. ex4nicegui/layout/rxFlex/index.py +0 -1
  6. ex4nicegui/reactive/EChartsComponent/ECharts.js +1 -1
  7. ex4nicegui/reactive/EChartsComponent/ECharts.py +1 -5
  8. ex4nicegui/reactive/UseDraggable/UseDraggable.py +3 -3
  9. ex4nicegui/reactive/__init__.py +2 -3
  10. ex4nicegui/reactive/_vmodel.py +150 -0
  11. ex4nicegui/reactive/base.py +2 -3
  12. ex4nicegui/reactive/deferredTask.py +2 -5
  13. ex4nicegui/reactive/mermaid/{mermaid.js → ex4ng_mermaid.js} +1 -1
  14. ex4nicegui/reactive/mermaid/mermaid.py +1 -6
  15. ex4nicegui/reactive/mixins/flexLayout.py +4 -8
  16. ex4nicegui/reactive/mixins/value_element.py +1 -2
  17. ex4nicegui/reactive/officials/echarts.py +1 -1
  18. ex4nicegui/reactive/systems/object_system.py +2 -4
  19. ex4nicegui/reactive/usePagination.py +2 -4
  20. ex4nicegui/reactive/vfor.py +1 -0
  21. ex4nicegui/toolbox/core/vue_use.py +1 -1
  22. ex4nicegui/utils/apiEffect.py +1 -2
  23. ex4nicegui/utils/clientScope.py +5 -8
  24. ex4nicegui/utils/effect.py +1 -2
  25. ex4nicegui/utils/page_state.py +70 -0
  26. ex4nicegui/utils/proxy/descriptor.py +0 -1
  27. ex4nicegui/utils/refComputed.py +1 -2
  28. ex4nicegui/utils/refreshable.py +122 -0
  29. ex4nicegui/utils/signals.py +5 -88
  30. {ex4nicegui-0.8.10.dist-info → ex4nicegui-0.9.1.dist-info}/METADATA +62 -21
  31. {ex4nicegui-0.8.10.dist-info → ex4nicegui-0.9.1.dist-info}/RECORD +54 -80
  32. {ex4nicegui-0.8.10.dist-info → ex4nicegui-0.9.1.dist-info}/WHEEL +1 -1
  33. ex4nicegui/gsap/__init__.py +0 -23
  34. ex4nicegui/gsap/gsap.py +0 -145
  35. ex4nicegui/gsap/timeline.js +0 -56
  36. ex4nicegui/gsap/timeline.py +0 -78
  37. ex4nicegui/gsap/wrapGsap.js +0 -48
  38. ex4nicegui/libs/gsap/.DS_Store +0 -0
  39. ex4nicegui/libs/gsap/CSSPlugin.js +0 -1577
  40. ex4nicegui/libs/gsap/CSSRulePlugin.js +0 -134
  41. ex4nicegui/libs/gsap/CustomEase.js +0 -371
  42. ex4nicegui/libs/gsap/Draggable.js +0 -2699
  43. ex4nicegui/libs/gsap/EasePack.js +0 -212
  44. ex4nicegui/libs/gsap/EaselPlugin.js +0 -341
  45. ex4nicegui/libs/gsap/Flip.js +0 -1518
  46. ex4nicegui/libs/gsap/MotionPathPlugin.js +0 -368
  47. ex4nicegui/libs/gsap/Observer.js +0 -686
  48. ex4nicegui/libs/gsap/PixiPlugin.js +0 -461
  49. ex4nicegui/libs/gsap/ScrollToPlugin.js +0 -273
  50. ex4nicegui/libs/gsap/ScrollTrigger.js +0 -2658
  51. ex4nicegui/libs/gsap/TextPlugin.js +0 -166
  52. ex4nicegui/libs/gsap/__init__.py +0 -0
  53. ex4nicegui/libs/gsap/all.js +0 -31
  54. ex4nicegui/libs/gsap/gsap-core.js +0 -4487
  55. ex4nicegui/libs/gsap/gsap.mjs +0 -6
  56. ex4nicegui/libs/gsap/utils/__init__.py +0 -0
  57. ex4nicegui/libs/gsap/utils/matrix.js +0 -420
  58. ex4nicegui/libs/gsap/utils/paths.js +0 -1487
  59. ex4nicegui/libs/gsap/utils/strings.js +0 -107
  60. ex4nicegui/reactive/local_file_picker.py +0 -208
  61. ex4nicegui/reactive/vmodel.py +0 -237
  62. {ex4nicegui-0.8.10.dist-info → ex4nicegui-0.9.1.dist-info/licenses}/LICENSE +0 -0
ex4nicegui/gsap/gsap.py DELETED
@@ -1,145 +0,0 @@
1
- import os
2
- from pathlib import Path
3
- from typing import Dict, Optional, Union
4
- from nicegui.element import Element
5
- from nicegui import ui
6
- from weakref import WeakKeyDictionary
7
-
8
-
9
- class Gsap(
10
- Element,
11
- component="wrapGsap.js",
12
- exposed_libraries=["../libs/gsap/gsap.mjs"],
13
- extra_libraries=["../libs/gsap/*.js", "../libs/gsap/utils/*.js"],
14
- ):
15
- def __init__(
16
- self,
17
- defaults: Optional[Dict] = None,
18
- ) -> None:
19
- super().__init__()
20
- self._props["defaults"] = defaults or {}
21
- self._props["tasks"] = []
22
- self._props["scriptTasks"] = []
23
-
24
- def set_defaults(
25
- self,
26
- defaults: Optional[Dict] = None,
27
- ):
28
- self._props["defaults"] = defaults or {}
29
- return self
30
-
31
- def from_(self, targets: str, vars: Dict):
32
- self.__try_run_task("from", targets, vars)
33
- return self
34
-
35
- def to(self, targets: str, vars: Dict):
36
- self.__try_run_task("to", targets, vars)
37
- return self
38
-
39
- def run_script(self, script: str):
40
- script = os.linesep.join([s for s in script.splitlines() if s])
41
- self.__try_run_script_task(script)
42
- return self
43
-
44
- def __try_run_script_task(self, script: str):
45
- def fn():
46
- self.run_method("runScript", script)
47
-
48
- if ui.context.client.has_socket_connection:
49
- fn()
50
- else:
51
- tasks = self._props["scriptTasks"]
52
- tasks.append(script)
53
-
54
- def __try_run_task(self, name: str, targets: str, vars: Dict):
55
- def fn():
56
- self.run_method(name, targets, vars)
57
-
58
- if ui.context.client.has_socket_connection:
59
- fn()
60
- else:
61
- tasks = self._props["tasks"]
62
- tasks.append({"method": name, "targets": targets, "vars": vars})
63
-
64
-
65
- __instance_map = WeakKeyDictionary()
66
-
67
-
68
- def _get_instance():
69
- current_client = ui.context.client
70
- ins = __instance_map.get(current_client)
71
-
72
- if not ins:
73
- ins = Gsap()
74
- __instance_map[current_client] = ins
75
-
76
- return ins
77
-
78
-
79
- def set_defaults(options: Dict):
80
- ins = _get_instance()
81
- ins.set_defaults(options)
82
- return ins
83
-
84
-
85
- def new(
86
- defaults: Optional[Dict] = None,
87
- ):
88
- return Gsap(defaults)
89
-
90
-
91
- def from_(targets: str, vars: Dict):
92
- """define where the values should START, and then it animates to the current state which is perfect for animating objects onto the screen because you can set them up the way you want them to look at the end and then animate in from elsewhere
93
-
94
- @see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#gsapfrom_
95
- @中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#gsapfrom_
96
-
97
-
98
- Args:
99
- targets (str): The object(s) whose properties you want to animate. This can be selector text like ".class", "#id", etc. (GSAP uses document.querySelectorAll() internally)
100
- vars (Dict): An object containing all the properties/values you want to animate, along with any special properties like ease, duration, delay, or onComplete (listed below)
101
-
102
- """
103
- return _get_instance().from_(targets, vars)
104
-
105
-
106
- def to(targets: str, vars: Dict):
107
- """define the destination values (and most people think in terms of animating to certain values)
108
-
109
- @see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#gsapto
110
- @中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#gsapto
111
-
112
-
113
- Args:
114
- targets (str): The object(s) whose properties you want to animate. This can be selector text like ".class", "#id", etc. (GSAP uses document.querySelectorAll() internally)
115
- vars (Dict): An object containing all the properties/values you want to animate, along with any special properties like ease, duration, delay, or onComplete (listed below)
116
- """
117
-
118
- return _get_instance().to(targets, vars)
119
-
120
-
121
- def run_script(script: Union[str, Path]):
122
- """Allows you to write animated js code directly
123
-
124
- @see - https://github.com/CrystalWindSnake/ex4nicegui/blob/main/README.en.md#gsaprun_script
125
- @中文文档 - https://gitee.com/carson_add/ex4nicegui/tree/main/#gsaprun_script
126
-
127
-
128
- Args:
129
- script (Union[str, Path]): Text of the js code. If it is of type `Path` reads the text of the file.
130
-
131
- ## Examples
132
-
133
- ```python
134
- gsap.run_script(
135
- r'''(gsap)=> {
136
- gsap.to('.target',{"duration": 0.3,y:60})
137
- }
138
- ''')
139
- ```
140
-
141
- """
142
-
143
- if isinstance(script, Path):
144
- script = script.read_text("utf8")
145
- return _get_instance().run_script(script)
@@ -1,56 +0,0 @@
1
- import { gsap } from "gsap";
2
- import { convertDynamicProperties } from "../../static/utils/dynamic_properties.js";
3
-
4
-
5
- export default {
6
- template: `<template></template>`,
7
- data() {
8
-
9
- const tl = gsap.timeline(this.defaults)
10
- this.tl = tl
11
-
12
- return {
13
- }
14
-
15
- },
16
- mounted() {
17
- document.addEventListener('DOMContentLoaded', () => {
18
- /**
19
- * @type any[]
20
- */
21
- const tasks = this.tasks
22
- tasks.forEach(t => {
23
- this[t.method](t.targets, t.vars, t.position)
24
- })
25
-
26
- this.scriptTasks.forEach(script => {
27
- const fn = new Function('return ' + script)()
28
- fn(this.tl, gsap)
29
- })
30
-
31
- })
32
- },
33
-
34
- methods: {
35
- from(targets, vars, position) {
36
- convertDynamicProperties(vars, false)
37
- this.tl.from(targets, vars, position)
38
- },
39
- to(targets, vars, position) {
40
- convertDynamicProperties(vars, false)
41
- this.tl.to(targets, vars, position)
42
- },
43
- runScript(script) {
44
- const fn = new Function('return ' + script)()
45
- fn(this.tl, gsap)
46
- },
47
- callTimeline(name, ...args) {
48
- this.tl[name](...args)
49
- }
50
- },
51
- props: {
52
- defaults: Object,
53
- tasks: Array,
54
- scriptTasks: Array,
55
- },
56
- };
@@ -1,78 +0,0 @@
1
- import os
2
- from pathlib import Path
3
- from typing import Dict, Optional, Union
4
- from nicegui.element import Element
5
- from nicegui import ui
6
-
7
-
8
- class Timeline(
9
- Element,
10
- component="timeline.js",
11
- exposed_libraries=["../libs/gsap/gsap.mjs"],
12
- extra_libraries=["../libs/gsap/*.js", "../libs/gsap/utils/*.js"],
13
- ):
14
- def __init__(
15
- self,
16
- defaults: Optional[Dict] = None,
17
- ) -> None:
18
- super().__init__()
19
- self._props["defaults"] = defaults or {}
20
- self._props["tasks"] = []
21
- self._props["scriptTasks"] = []
22
-
23
- def from_(self, targets: str, vars: Dict, position: Optional[str] = None):
24
- self.__try_run_task("from", targets, vars, position)
25
- return self
26
-
27
- def to(self, targets: str, vars: Dict, position: Optional[str] = None):
28
- self.__try_run_task("to", targets, vars, position)
29
- return self
30
-
31
- def run_script(self, script: Union[str, Path]):
32
- if isinstance(script, Path):
33
- script = script.read_text("utf8")
34
-
35
- script = os.linesep.join([s for s in script.splitlines() if s])
36
- self.__try_run_script_task(script)
37
- return self
38
-
39
- def __try_run_script_task(self, script: str):
40
- def fn():
41
- self.run_method("runScript", script)
42
-
43
- if ui.context.client.has_socket_connection:
44
- fn()
45
- else:
46
- tasks = self._props["scriptTasks"]
47
- tasks.append(script)
48
-
49
- def __try_run_task(
50
- self, name: str, targets: str, vars: Dict, position: Optional[str] = None
51
- ):
52
- def fn():
53
- self.run_method(name, targets, vars)
54
-
55
- if ui.context.client.has_socket_connection:
56
- fn()
57
- else:
58
- tasks = self._props["tasks"]
59
- tasks.append(
60
- {"method": name, "targets": targets, "vars": vars, "position": position}
61
- )
62
-
63
- def pause(self):
64
- self.run_method("callTimeline", "pause")
65
-
66
- def play(self):
67
- self.run_method("callTimeline", "play")
68
-
69
- def resume(
70
- self,
71
- ):
72
- self.run_method("callTimeline", "resume")
73
-
74
- def seek(self, position: Optional[str] = None, suppressEvents=True):
75
- self.run_method("callTimeline", "seek", position, suppressEvents)
76
-
77
- def reverse(self):
78
- self.run_method("callTimeline", "reverse")
@@ -1,48 +0,0 @@
1
- import { gsap } from "gsap";
2
- import { convertDynamicProperties } from "../../static/utils/dynamic_properties.js";
3
-
4
-
5
- export default {
6
- template: `<template></template>`,
7
- data: () => ({
8
- }),
9
- mounted() {
10
- gsap.defaults(this.defaults)
11
-
12
- document.addEventListener('DOMContentLoaded', () => {
13
- /**
14
- * @type any[]
15
- */
16
- const tasks = this.tasks
17
- tasks.forEach(t => {
18
- this[t.method](t.targets, t.vars)
19
- })
20
-
21
- this.scriptTasks.forEach(script => {
22
- const fn = new Function('return ' + script)()
23
- fn(gsap)
24
- })
25
-
26
- })
27
- },
28
-
29
- methods: {
30
- from(targets, vars) {
31
- convertDynamicProperties(vars, false)
32
- gsap.from(targets, vars)
33
- },
34
- to(targets, vars) {
35
- convertDynamicProperties(vars, false)
36
- gsap.to(targets, vars)
37
- },
38
- runScript(script) {
39
- const fn = new Function('return ' + script)()
40
- fn(gsap)
41
- }
42
- },
43
- props: {
44
- defaults: Object,
45
- tasks: Array,
46
- scriptTasks: Array,
47
- },
48
- };
Binary file