ziko 0.65.0 → 0.67.0

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 (113) hide show
  1. package/dist/ziko.cjs +61 -107
  2. package/dist/ziko.js +61 -107
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +61 -107
  5. package/package.json +2 -2
  6. package/src/events/custom-events-registry/click-away.js +0 -1
  7. package/src/exp-events/controller/index.js +41 -0
  8. package/src/exp-events/custom-events-registry/click-away.js +39 -0
  9. package/src/exp-events/custom-events-registry/index.js +3 -0
  10. package/src/exp-events/custom-events-registry/swipe.js +76 -0
  11. package/src/exp-events/custom-events-registry/view.js +74 -0
  12. package/src/exp-events/details-setter/index.js +4 -0
  13. package/src/exp-events/details-setter/key.js +14 -0
  14. package/src/exp-events/details-setter/mouse.js +35 -0
  15. package/src/exp-events/details-setter/pointer.js +35 -0
  16. package/src/exp-events/details-setter/touch.js +37 -0
  17. package/src/exp-events/index.js +1 -0
  18. package/src/hooks/index.d.ts +11 -0
  19. package/src/hooks/use-derived.d.ts +14 -0
  20. package/src/hooks/use-event-emitter.d.ts +46 -0
  21. package/src/hooks/use-favicon.d.ts +41 -0
  22. package/src/hooks/use-ipc.d.ts +12 -0
  23. package/src/hooks/use-media-query.d.ts +24 -0
  24. package/src/hooks/use-reactive.d.ts +14 -0
  25. package/src/hooks/use-root.d.ts +15 -0
  26. package/src/hooks/use-state.d.ts +25 -0
  27. package/src/hooks/use-storage.d.ts +47 -0
  28. package/src/hooks/use-thread.d.ts +33 -0
  29. package/src/hooks/use-title.d.ts +37 -0
  30. package/src/index.d.ts +5 -0
  31. package/src/math/complex/index.d.ts +54 -0
  32. package/src/math/functions/index.d.ts +140 -0
  33. package/src/math/functions/logic/index.d.ts +11 -0
  34. package/src/math/functions/mapfun/index.d.ts +87 -0
  35. package/src/math/functions/utils/index.d.ts +1 -0
  36. package/src/math/functions/utils/mapfun.d.ts +43 -0
  37. package/src/math/index.d.ts +5 -0
  38. package/src/time/clocks/clock.d.ts +28 -0
  39. package/src/time/clocks/index.d.ts +3 -0
  40. package/src/time/clocks/scheduler.d.ts +42 -0
  41. package/src/time/clocks/tick.d.ts +26 -0
  42. package/src/time/decorators/index.d.ts +9 -0
  43. package/src/time/delay/index.d.ts +12 -0
  44. package/src/time/ease/index.d.ts +103 -0
  45. package/src/time/index.d.ts +4 -0
  46. package/src/time/loop/index.d.ts +50 -0
  47. package/src/ui/constructors/UIElement.js +19 -93
  48. package/src/ui/constructors/UIElementCore.d.ts +59 -0
  49. package/src/ui/constructors/UIElementCore.js +0 -9
  50. package/src/ui/constructors/UINode.d.ts +11 -0
  51. package/src/ui/constructors/UINode.js +1 -1
  52. package/src/ui/{__methods__ → constructors/mixins}/dom.js +1 -1
  53. package/src/ui/{__methods__ → constructors/mixins}/events.js +3 -3
  54. package/src/ui/{__methods__ → constructors/mixins}/style.js +1 -1
  55. package/src/ui/{__methods__ → constructors/mixins}/utils/index.js +4 -4
  56. package/src/ui/web-component/index.d.ts +14 -0
  57. package/src/ui/web-component/index.js +2 -2
  58. package/README.dep.md +0 -137
  59. package/src/--reactivity-deprecated/events/Input.js +0 -62
  60. package/src/--reactivity-deprecated/events/ZikoEvent.js +0 -92
  61. package/src/--reactivity-deprecated/events/__note__ +0 -1
  62. package/src/--reactivity-deprecated/events/custom-event.js +0 -57
  63. package/src/--reactivity-deprecated/events/hash.js +0 -47
  64. package/src/--reactivity-deprecated/events/index.js +0 -12
  65. package/src/--reactivity-deprecated/events/media.js +0 -1
  66. package/src/--reactivity-deprecated/events/mouse.js +0 -233
  67. package/src/--reactivity-deprecated/events/swipe.js +0 -149
  68. package/src/--reactivity-deprecated/events/touch.js +0 -0
  69. package/src/--reactivity-deprecated/hooks/Contexte/index.js +0 -1
  70. package/src/--reactivity-deprecated/hooks/Contexte/useSuccesifKeys.js +0 -14
  71. package/src/--reactivity-deprecated/hooks/UI/index.js +0 -6
  72. package/src/--reactivity-deprecated/hooks/UI/useCssLink.js +0 -0
  73. package/src/--reactivity-deprecated/hooks/UI/useLinearGradient.js +0 -0
  74. package/src/--reactivity-deprecated/hooks/UI/useMediaQuery.js +0 -43
  75. package/src/--reactivity-deprecated/hooks/UI/useRadialGradient.js +0 -0
  76. package/src/--reactivity-deprecated/hooks/UI/useRoot.js +0 -39
  77. package/src/--reactivity-deprecated/hooks/UI/useStyle.js +0 -79
  78. package/src/--reactivity-deprecated/hooks/UI/useTheme.js +0 -62
  79. package/src/--reactivity-deprecated/hooks/head/_useCssText.js +0 -21
  80. package/src/--reactivity-deprecated/hooks/head/index.js +0 -5
  81. package/src/--reactivity-deprecated/hooks/head/useFavIcon.js +0 -38
  82. package/src/--reactivity-deprecated/hooks/head/useHead.js +0 -28
  83. package/src/--reactivity-deprecated/hooks/head/useMeta.js +0 -52
  84. package/src/--reactivity-deprecated/hooks/head/useTitle.js +0 -30
  85. package/src/--reactivity-deprecated/hooks/index.js +0 -8
  86. package/src/--reactivity-deprecated/hooks/todo.md +0 -26
  87. package/src/--reactivity-deprecated/idea +0 -1
  88. package/src/--reactivity-deprecated/index.js +0 -3
  89. package/src/--reactivity-deprecated/observer/attributes.js +0 -28
  90. package/src/--reactivity-deprecated/observer/children.js +0 -37
  91. package/src/--reactivity-deprecated/observer/index.js +0 -6
  92. package/src/--reactivity-deprecated/observer/intersection.js +0 -44
  93. package/src/--reactivity-deprecated/observer/mutation.js +0 -113
  94. package/src/--reactivity-deprecated/observer/resize.js +0 -47
  95. package/src/--reactivity-deprecated/observer/screen.js +0 -45
  96. package/src/--reactivity-deprecated/observer/screen.js.txt +0 -84
  97. package/src/--reactivity-deprecated/observer/screen.txt +0 -13
  98. package/src/--use-deprecated/index.js +0 -11
  99. package/src/--use-deprecated/use-channel.js.txt +0 -61
  100. package/src/--use-deprecated/use-event-emmiter.js.txt +0 -64
  101. package/src/--use-deprecated/use-favicon.js +0 -0
  102. package/src/--use-deprecated/use-link.js +0 -0
  103. package/src/--use-deprecated/use-meta.js +0 -0
  104. package/src/--use-deprecated/use-root.js +0 -77
  105. package/src/--use-deprecated/use-storage.js.txt +0 -73
  106. package/src/--use-deprecated/use-thread.js +0 -44
  107. package/src/--use-deprecated/use-title.js +0 -0
  108. package/src/ui/constructors/_m.js.txt +0 -96
  109. package/src/ui/constructors/style/index.js +0 -506
  110. /package/src/ui/{__methods__ → constructors/mixins}/attrs.js +0 -0
  111. /package/src/ui/{__methods__ → constructors/mixins}/index.js +0 -0
  112. /package/src/ui/{__methods__ → constructors/mixins}/indexing.js +0 -0
  113. /package/src/ui/{__methods__ → constructors/mixins}/lifecycle.js +0 -0
@@ -1,44 +0,0 @@
1
- class UseThreed {
2
- #workerContent;
3
- constructor() {
4
- this.#workerContent = (
5
- function (msg) {
6
- try {
7
- const func = new Function("return " + msg.data.fun)();
8
- let result = func();
9
- postMessage({ result });
10
- } catch (error) {
11
- postMessage({ error: error.message });
12
- } finally {
13
- if (msg.data.close) self.close();
14
- }
15
- }
16
- ).toString();
17
- this.blob = new Blob(["this.onmessage = " + this.#workerContent], { type: "text/javascript" });
18
- this.worker = new Worker(window.URL.createObjectURL(this.blob));
19
- }
20
- call(func, callback, close = true) {
21
- this.worker.postMessage({
22
- fun: func.toString(),
23
- close
24
- });
25
- this.worker.onmessage = function (e) {
26
- if (e.data.error) {
27
- console.error(e.data.error);
28
- } else {
29
- callback(e.data.result);
30
- }
31
- };
32
- return this;
33
- }
34
- }
35
-
36
- const useThread = (func, callback , close) => {
37
- const T = new UseThreed();
38
- if (func) {
39
- T.call(func, callback , close);
40
- }
41
- return T;
42
- }
43
-
44
- export { useThread };
File without changes
@@ -1,96 +0,0 @@
1
- class Ziko{
2
- get #SwitchedStyleRTL_LTR(){
3
- const CalculedStyle = globalThis.getComputedStyle(this.element);
4
- const SwitchedStyle = {}
5
- if(CalculedStyle.marginRight!=="0px")Object.assign(SwitchedStyle, {marginLeft: CalculedStyle.marginRight});
6
- if(CalculedStyle.marginLeft!=="0px")Object.assign(SwitchedStyle, {marginRight: CalculedStyle.marginLeft});
7
- if(CalculedStyle.paddingRight!=="0px")Object.assign(SwitchedStyle, {paddingLeft: CalculedStyle.paddingRight});
8
- if(CalculedStyle.paddingLeft!=="0px")Object.assign(SwitchedStyle, {paddingRight: CalculedStyle.paddingLeft});
9
- if(CalculedStyle.left!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.left});
10
- if(CalculedStyle.right!=="0px")Object.assign(SwitchedStyle, {left: CalculedStyle.right});
11
- if(CalculedStyle.textAlign === "right")Object.assign(SwitchedStyle, {textAlign: "left"});
12
- if(CalculedStyle.textAlign === "left")Object.assign(SwitchedStyle, {textAlign: "right"});
13
- if(CalculedStyle.float === "right")Object.assign(SwitchedStyle, {float: "left"});
14
- if(CalculedStyle.float === "left")Object.assign(SwitchedStyle, {float: "right"});
15
- if(CalculedStyle.borderRadiusLeft!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusRight});
16
- if(CalculedStyle.borderRadiusRight!=="0px")Object.assign(SwitchedStyle, {right: CalculedStyle.borderRadiusLeft});
17
- if(["flex","inline-flex"].includes(CalculedStyle.display)){
18
- if(CalculedStyle.justifyContent === "flex-end")Object.assign(SwitchedStyle, {justifyContent: "flex-start"});
19
- if(CalculedStyle.justifyContent === "flex-start")Object.assign(SwitchedStyle, {justifyContent: "flex-end"});
20
- }
21
- return SwitchedStyle;
22
- }
23
- useRtl(switchAll = false){
24
- switchAll ? this.style({
25
- ...this.#SwitchedStyleRTL_LTR,
26
- direction : "rtl"
27
- }) : this.style({direction : "rtl"});
28
- return this;
29
- }
30
- useLtr(switchAll = false){
31
- switchAll ? this.style({
32
- ...this.#SwitchedStyleRTL_LTR,
33
- direction : "ltr"
34
- }) : this.style({direction : "ltr"});
35
- return this;
36
-
37
-
38
- }
39
-
40
- filter(condition_callback, if_callback = () => {}, else_callback = () => {}) {
41
- const FilterItems = this.items.filter(condition_callback);
42
- FilterItems.forEach(if_callback);
43
- this.items
44
- .filter((item) => !FilterItems.includes(item))
45
- .forEach(else_callback);
46
- return this;
47
- }
48
- filterByTextContent(text, exactMatch = false) {
49
- this.items.forEach((n) => n.mount());
50
- this.filter(
51
- (n) => !(exactMatch ? n.text === text : n.text.includes(text)),
52
- (e) => e.unmount(),
53
- );
54
- // this.items.filter(n=>{
55
- // const content=n.element.textContent;
56
- // return !(exactMatch?content===text:content.includes(text))
57
- // }).map(n=>n.unmount());
58
- // return this;
59
- }
60
- filterByClass(value) {
61
- this.items.map((n) => n.mount());
62
- this.items
63
- .filter((n) => !n.classes.includes(value))
64
- .map((n) => n.unmount());
65
- return this;
66
- }
67
- sortByTextContent(value, displays) {
68
- let item = this.children;
69
- item
70
- .filter((n) => !n.textContent.toLowerCase().includes(value.toLowerCase()))
71
- .map((n) => {
72
- n.style.display = "none";
73
- });
74
- item
75
- .filter((n) => n.textContent.toLowerCase().includes(value.toLowerCase()))
76
- .map((n, i) => (n.style.display = displays[i]));
77
- //return item.filter(n=>n.style.display!="none")
78
- item.filter((n) => n.style.display != "none");
79
- return this;
80
- }
81
-
82
- // setFullScreen(set = true, e) {
83
- // if(!this.element.requestFullscreen){
84
- // console.error("Fullscreen API is not supported in this browser.");
85
- // return this;
86
- // }
87
- // if (set) this.element.requestFullscreen(e);
88
- // else globalThis.document.exitFullscreen();
89
- // return this;
90
- // }
91
- // toggleFullScreen(e) {
92
- // if (!globalThis.document.fullscreenElement) this.element.requestFullscreen(e);
93
- // else globalThis.document.exitFullscreen();
94
- // return this;
95
- // }
96
- }
@@ -1,506 +0,0 @@
1
- import { addSuffixeToNumber } from "../../__utils__/index.js";
2
- import { Matrix,cos,sin} from "../../../math/index.js";
3
- import { Str } from "../../../data/index.js";
4
- import { camel2hyphencase } from '../../../data/string/converters.js'
5
- class ZikoUIElementStyle{
6
- constructor(defaultStyle={}){
7
- this.target=null;
8
- this.styles=new Map(
9
- [["default",defaultStyle]]
10
- );
11
- this.cache={
12
- isHidden:false,
13
- isFaddedOut:false,
14
- transformation:{
15
- Flip:[0,0,0],
16
- matrix:new Matrix([
17
- [1,0,0,0],
18
- [0,1,0,0],
19
- [0,0,1,0],
20
- [0,0,0,1]
21
- ])
22
- }
23
- }
24
- }
25
- style(styles){
26
- for(const [key, value] of Object.entries(styles)){
27
- if(Str.isCamelCase(key)){
28
- delete styles[key];
29
- Object.assign(styles,{[camel2hyphencase(key)]:value})
30
- }
31
- }
32
- if(this?.target?.element?.style)Object.assign(this?.target?.element?.style, styles);
33
- return this;
34
- }
35
- linkTo(target){
36
- this.target=target;
37
- return this;
38
- }
39
- use(name="default"){
40
- this.style(this.styles.get(name));
41
- return this;
42
- }
43
- update(name,styles){
44
- const old=this.styles.get(name);
45
- old?this.styles.set(name,Object.assign(old,styles)):this.styles.set(name,styles);
46
- return this;
47
- }
48
- add(name,styles){
49
- this.styles.set(name,styles);
50
- return this;
51
- }
52
- replace(name,styles){
53
- this.styles.set(name,styles);
54
- return this;
55
- }
56
- delete(...names){
57
- names.forEach(n=>this.styles.delete(n));
58
- return this;
59
- }
60
- updateDefaultStyle(){
61
- const defaultStyle=Object.fromEntries(
62
- Object.entries(this.target.element.style).filter(n=>isNaN(+n[0]))
63
- )
64
- this.update("default",defaultStyle);
65
- return this;
66
- }
67
- hover(styles){
68
- //this.updateDefaultStyle()
69
- if(styles)this.add("hover",styles)
70
- this.target?.element?.addEventListener("pointerenter",()=>this.use("hover"));
71
- this.target?.element?.addEventListener("pointerleave",()=>this.use("default"))
72
- return this;
73
- }
74
- // Checkers
75
- isInline(){
76
- return getComputedStyle(this.target.element).display.includes("inline");
77
- }
78
- isBlock(){
79
- return !(this.isInline());
80
- }
81
- // Size
82
- size(width,height){
83
- this.style({
84
- width,
85
- height
86
- })
87
- return this;
88
- }
89
- width(w){
90
- if(w instanceof Object){
91
- if(w instanceof Array)w={min:w[0],max:w[1]}
92
- if("min" in w || "max" in w){
93
- let min= w.min ?? w.max;
94
- let max= w.max ?? w.min;
95
- min=addSuffixeToNumber(min,"px");
96
- max=addSuffixeToNumber(max,"px");
97
- this.style({ minWidth: min, maxWidth: max }, { target, maskVector });
98
- }
99
- }
100
- else {
101
- w=addSuffixeToNumber(w,"px");
102
- this.style({width:w});
103
- }
104
- return this
105
- }
106
- height(h){
107
- if(h instanceof Object){
108
- if(h instanceof Array)h={min:h[0],max:h[1]}
109
- if("min" in h || "max" in h){
110
- let min= h.min ?? h.max;
111
- let max= h.max ?? h.min;
112
- min=addSuffixeToNumber(min,"px");
113
- max=addSuffixeToNumber(max,"px");
114
- this.style({ minHeight: min, maxHeight: max }, { target, maskVector });
115
- }
116
- }
117
- else {
118
- h=addSuffixeToNumber(h,"px");
119
- this.style({height:h});
120
- }
121
- return this
122
- }
123
- enableResize(h=false,v=false){
124
- let resize="none";
125
- if(h)v?resize="both":resize="horizontal";
126
- else v?resize="vertical":resize="none";
127
- this.style({
128
- resize,
129
- overflow:"hidden"
130
- });
131
- if(this.isInline()){
132
- console.group("Ziko Issue : Temporarily Incompatible Method");
133
- console.warn(".enableResize has no effect on inline elements!");
134
- console.info("%cConsider using other display types such as block, inline-block, flex, or grid for proper resizing behavior.","color:gold;background-color:#3333cc;padding:5px");
135
- console.groupEnd();
136
- }
137
- return this;
138
- }
139
- // Apparence
140
- hide({after, target, maskVector } = {}){
141
- if(typeof after==="number"){
142
- const wrapper=()=>this.hide({target,maskVector})
143
- setTimeout(wrapper, after);
144
- clearTimeout(wrapper);
145
- }
146
- else {
147
- this.cache.isHidden=true;
148
- this.style({display:"none"},{target,maskVector});
149
- }
150
- return this;
151
- }
152
- show({after, target, maskVector } = {}){
153
- if(typeof after==="number"){
154
- const wrapper=()=>this.show({target,maskVector})
155
- setTimeout(wrapper, after);
156
- clearTimeout(wrapper);
157
- }
158
- else {
159
- this.cache.isHidden=false;
160
- this.style({display:""},{target,maskVector});
161
- }
162
- return this;
163
- }
164
- color(color){
165
- this.style({color});
166
- return this;
167
- }
168
- background(background){
169
- this.style({background});
170
- return this;
171
- }
172
- backgroundColor(backgroundColor){
173
- this.style({backgroundColor});
174
- return this;
175
- }
176
- opacity(opacity, { target, maskVector } = {}) {
177
- this.style({ opacity }, { target, maskVector });
178
- return this;
179
- }
180
- // Placement
181
- position(position){
182
- this.style({position});
183
- return this
184
- }
185
- display(disp, { target, maskVector } = {}) {
186
- this.style({ display: disp }, { target, maskVector });
187
- return this;
188
- }
189
- zIndex(z){
190
- this.style({zIndex:z});
191
- return this;
192
- }
193
- float(float, { target, maskVector } = {}) {
194
- this.style({ float: float }, { target, maskVector });
195
- return this;
196
- }
197
- // Box Model
198
- border(border = "1px solid red", { target, maskVector } = {}){
199
- this.style({border}, { target, maskVector });
200
- return this;
201
- }
202
- borderTop(borderTop = "1px solid red", { target, maskVector } = {}){
203
- this.style({borderTop}, { target, maskVector });
204
- return this;
205
- }
206
- borderRight(borderRight = "1px solid red", { target, maskVector } = {}){
207
- this.style({borderRight}, { target, maskVector });
208
- return this;
209
- }
210
- borderBottom(borderBottom = "1px solid red", { target, maskVector } = {}){
211
- this.style({borderBottom}, { target, maskVector });
212
- return this;
213
- }
214
- borderLeft(borderLeft = "1px solid red", { target, maskVector } = {}){
215
- this.style({borderLeft}, { target, maskVector });
216
- return this;
217
- }
218
- borderRadius(radius){
219
- radius=addSuffixeToNumber(radius,"px");
220
- this.style({ borderRadius: radius }, { target, maskVector });
221
- return this;
222
- }
223
- margin(margin){
224
- margin=addSuffixeToNumber(margin,"px");
225
- this.style({ margin }, { target, maskVector });
226
- return this;
227
- }
228
- marginTop(marginTop){
229
- marginTop=addSuffixeToNumber(marginTop,"px");
230
- this.style({marginTop});
231
- return this;
232
- }
233
- marginRight(marginRight){
234
- marginRight=addSuffixeToNumber(marginRight,"px");
235
- this.style({marginRight});
236
- return this;
237
- }
238
- marginBootom(marginBootom){
239
- marginBootom=addSuffixeToNumber(marginBootom,"px");
240
- this.style({marginBootom});
241
- return this;
242
- }
243
- marginLeft(marginLeft){
244
- marginLeft=addSuffixeToNumber(marginLeft,"px");
245
- this.style({marginLeft});
246
- return this;
247
- }
248
- padding(padding){
249
- padding=addSuffixeToNumber(padding,"px");
250
- this.style({padding});
251
- return this;
252
- }
253
- paddingTop(paddingTop){
254
- paddingTop=addSuffixeToNumber(paddingTop,"px");
255
- this.style({paddingTop});
256
- return this;
257
- }
258
- paddingRight(paddingRight){
259
- paddingRight=addSuffixeToNumber(paddingRight,"px");
260
- this.style({paddingRight});
261
- return this;
262
- }
263
- paddingBootom(paddingBootom){
264
- paddingBootom=addSuffixeToNumber(paddingBootom,"px");
265
- this.style({paddingBootom});
266
- return this;
267
- }
268
- paddingLeft(paddingLeft){
269
- paddingLeft=addSuffixeToNumber(paddingLeft,"px");
270
- this.style({paddingLeft});
271
- return this;
272
- }
273
- // Typographie
274
- font(font){
275
- this.style({font});
276
- return this;
277
- }
278
- fontFamily(fontFamily=""){
279
- this.style({fontFamily});
280
- return this;
281
- }
282
- fontSize(fontSize){
283
- this.style({fontSize});
284
- return this;
285
- }
286
- // Misc
287
- cursor(type="pointer"){
288
- this.style({ cursor: type });
289
- return this;
290
- }
291
- overflow(x,y){
292
- const values=["hidden","auto"];
293
- this.style({
294
- overflowX:typeof x==="number"?values[x]:x,
295
- overflowY:typeof y==="number"?values[y]:y
296
- },{target,maskVector})
297
- return this;
298
- }
299
- clip(polygon, { target, maskVector } = {}) {
300
- if (typeof polygon === "string") polygon = "polygon(" + polygon + ")";
301
- this.style({ clipPath: polygon }, { target, maskVector });
302
- return this;
303
- }
304
- // Transfromations
305
- fadeOut(transitionTimming = 1) {
306
- this.style({
307
- transition:`opacity ${transitionTimming/1000}s`,
308
- opacity: 0
309
- });
310
- this.cache.isFaddedOut=true;
311
- return this;
312
- }
313
- fadeIn(transitionTimming = 1) {
314
- this.style({
315
- transition: `opacity ${transitionTimming/1000}s`,
316
- opacity: 1
317
- });
318
- this.cache.isFaddedOut=false;
319
- return this;
320
- }
321
- toggleFade(t_in = 1000,t_out=t_in){
322
- this.cache.isFaddedOut?this.fadeIn(t_in):this.fadeOut(t_out);
323
- return this;
324
- }
325
- morphBorderRadius(newValue, transitionTimming){
326
- this.style({
327
- borderRadius: newValue,
328
- transition: `borderRadius ${transitionTimming/1000}s`,
329
- });
330
- return this;
331
- }
332
- #applyTransformMatrix(transitionTimming){
333
- const transformMatrix = this.cache.transformation.matrix.arr.join(",");
334
- this.style({
335
- transform: `matrix3d(${transformMatrix})`,
336
- "-webkit-transform": `matrix3d(${transformMatrix})`,
337
- "-moz-transform": `matrix3d(${transformMatrix})`,
338
- "-ms-transform": `matrix3d(${transformMatrix})`,
339
- "-o-transform": `matrix3d(${transformMatrix})`
340
- });
341
- if (transitionTimming != 0) this.style({ transition: `transform ${transitionTimming/1000}s ease` });
342
- }
343
- translate(dx, dy = dx ,dz = 0, transitionTimming = 0) {
344
- this.cache.transformation.matrix.set(3,0,dx);
345
- this.cache.transformation.matrix.set(3,1,dy);
346
- this.cache.transformation.matrix.set(3,2,dz);
347
- this.#applyTransformMatrix(transitionTimming);
348
- return this;
349
- }
350
- translateX(dx, transitionTimming = 0) {
351
- this.cache.transformation.matrix.set(3,0,dx)
352
- this.#applyTransformMatrix(transitionTimming);
353
- return this;
354
- }
355
- translateY(dy, transitionTimming = 0) {
356
- this.cache.transformation.matrix.set(3,1,dy)
357
- this.#applyTransformMatrix(transitionTimming);
358
- return this;
359
- }
360
- translateZ(dz, transitionTimming = 0) {
361
- const d=-1/this.cache.transformation.matrix[2][2];
362
- this.cache.transformation.matrix.set(3,2,z);
363
- this.cache.transformation.matrix.set(3,3,1-(dz/d));
364
- this.#applyTransformMatrix(transitionTimming);
365
- return this;
366
- }
367
- perspective(distance,transitionTimming=0){
368
- const z=this.cache.transformation.matrix[3][2];
369
- this.cache.transformation.matrix.set(2,2,-1/d);
370
- this.cache.transformation.matrix.set(3,3,1-(z/distance));
371
- this.#applyTransformMatrix(transitionTimming);
372
- return this;
373
- }
374
- scale(sx, sy = sx, transitionTimming = 0) {
375
- this.cache.transformation.matrix.set(0,0,sx)
376
- this.cache.transformation.matrix.set(1,1,sy)
377
- // const transformMatrix = this.cache.transformation.matrix.arr.join(",");
378
- this.#applyTransformMatrix(transitionTimming);
379
- return this;
380
- }
381
- scaleX(x = 1 , transitionTimming = 0) {
382
- this.cache.transformation.matrix.set(0,0,x)
383
- // const transformMatrix = this.cache.transformation.matrix.arr.join(",");
384
- this.#applyTransformMatrix(transitionTimming);
385
- return this;
386
- }
387
- scaleY(y = 1, transitionTimming = 0) {
388
- this.cache.transformation.matrix.set(1,1,y)
389
- const transformMatrix = this.cache.transformation.matrix.arr.join(",");
390
- this.#applyTransformMatrix(transitionTimming);
391
- return this;
392
- }
393
- skew(x, y = x, transitionTimming = 0) {
394
- this.cache.transformation.matrix.set(0,1,x)
395
- this.cache.transformation.matrix.set(1,0,y)
396
- const transformMatrix = this.cache.transformation.matrix.arr.join(",");
397
- this.#applyTransformMatrix(transitionTimming);
398
- return this;
399
- }
400
- skewX(x = 1 , transitionTimming = 0) {
401
- this.cache.transformation.matrix.set(0,1,x)
402
- const transformMatrix = this.cache.transformation.matrix.arr.join(",");
403
- this.#applyTransformMatrix(transitionTimming);
404
- return this;
405
- }
406
- skewY(y = 1, transitionTimming = 0) {
407
- this.cache.transformation.matrix.set(1,0,y);
408
- const transformMatrix = this.cache.transformation.matrix.arr.join(",");
409
- this.#applyTransformMatrix(transitionTimming);
410
- return this;
411
- }
412
- rotateX(rx, transitionTimming = 0) {
413
- this.cache.transformation.matrix.set(1,1,cos(rx));
414
- this.cache.transformation.matrix.set(1,2,-sin(rx));
415
- this.cache.transformation.matrix.set(2,1,sin(rx));
416
- this.cache.transformation.matrix.set(1,2,cos(rx));
417
- this.#applyTransformMatrix(transitionTimming);
418
- return this;
419
- }
420
- rotateY(ry, transitionTimming = 0) {
421
- this.cache.transformation.matrix.set(0,0,cos(ry));
422
- this.cache.transformation.matrix.set(0,2,sin(ry));
423
- this.cache.transformation.matrix.set(2,0,-sin(ry));
424
- this.cache.transformation.matrix.set(2,2,cos(ry));
425
- this.#applyTransformMatrix(transitionTimming);
426
- return this;
427
- }
428
- rotateZ(rz, transitionTimming = 0) {
429
- this.cache.transformation.matrix.set(0,0,cos(rz));
430
- this.cache.transformation.matrix.set(0,1,-sin(rz));
431
- this.cache.transformation.matrix.set(1,0,sin(rz));
432
- this.cache.transformation.matrix.set(1,1,cos(rz));
433
- this.#applyTransformMatrix(transitionTimming);
434
- return this;
435
- }
436
- flipeX(transitionTimming = 1) {
437
- this.cache.transformation.Flip[0] += 180;
438
- this.cache.transformation.Flip[0] %= 360;
439
- this.rotateX(this.cache.transformation.Flip[0], transitionTimming);
440
- return this;
441
- }
442
- flipeY(transitionTimming = 1) {
443
- this.cache.transformation.Flip[1] += 180 ;
444
- this.cache.transformation.Flip[1] %= 360;
445
- this.rotateY(this.cache.transformation.Flip[1], transitionTimming);
446
- return this;
447
- }
448
- flipeZ(transitionTimming = 1) {
449
- this.cache.transformation.Flip[2] += 180;
450
- this.cache.transformation.Flip[2] %= 360;
451
- this.rotateZ(this.cache.transformation.Flip[2], transitionTimming);
452
- return this;
453
- }
454
- slideHeightIn(transitionTimming = 1, h = this.h) {
455
- this.style({ transition: transitionTimming + "s", height: h });
456
- return this;
457
- }
458
- slideHeightOut(transitionTimming = 1) {
459
- this.style({ transition: transitionTimming + "s", height: 0 });
460
- this.target?.element?.n("transitionend", () =>
461
- this.style({ opacity: "none" }),
462
- );
463
- return this;
464
- }
465
- slideWidthIn(transitionTimming = 1, w = this.w) {
466
- this.style({ transition: transitionTimming + "s", width: w });
467
- return this;
468
- }
469
- slideWidthOut(transitionTimming = 1) {
470
- this.style({ transition: transitionTimming + "s", width: 0 });
471
- const wrapper=()=>{
472
- this.style({ opacity: "none" })
473
- }
474
- this.target?.element?.addEventListener("transitionend",wrapper);
475
- this.target?.element?.removeEventListener("transitionend",wrapper);
476
- return this;
477
- }
478
- slideIn({ transitionTimming = 1, w = "100%", h = "auto" } = {}) {
479
- this.style({
480
- transition: transitionTimming + "s",
481
- width: w,
482
- height: h,
483
- visibility: "visible",
484
- });
485
- return this;
486
- }
487
- slideOut({ transitionTimming = 1, width = 0, heightransitionTimming = 0 } = {}) {
488
- this.style({
489
- visibility: "hidden",
490
- transition: transitionTimming + "s",
491
- opacity: "none",
492
- width: width,
493
- height: height,
494
- });
495
- const wrapper=()=>{
496
- this.style({ opacity: "none" });
497
- }
498
- this.target?.element?.addEventListener("transitionend",wrapper);
499
- this.target?.element?.removeEventListener("transitionend",wrapper);
500
- return this;
501
- }
502
-
503
- }
504
- export{
505
- ZikoUIElementStyle
506
- }