ziko 0.41.1 → 0.42.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.
- package/dist/ziko.cjs +351 -265
- package/dist/ziko.js +351 -265
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +346 -260
- package/package.json +2 -2
- package/src/__ziko__/__state__.js +12 -0
- package/src/__ziko__/index.js +3 -1
- package/src/hooks/use-derived.js +7 -45
- package/src/hooks/use-reactive.js +11 -1
- package/src/hooks/use-state.js +42 -35
- package/src/time/clocks/tick.js +19 -5
- package/src/ui/web-component/index.js +9 -1
package/dist/ziko.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Sun Aug 24 2025 12:13:24 GMT+0100 (UTC+01:00)
|
|
6
6
|
Git-Repo : https://github.com/zakarialaoui10/ziko.js
|
|
7
7
|
Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
|
|
8
8
|
Released under MIT License
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
const { PI: PI$2, E } = Math;
|
|
18
18
|
const EPSILON=Number.EPSILON;
|
|
19
19
|
|
|
20
|
-
const {PI: PI$1, cos: cos$
|
|
20
|
+
const {PI: PI$1, cos: cos$3, sin: sin$3, tan: tan$1, acos: acos$2, asin: asin$1, atan: atan$1, cosh: cosh$2, sinh: sinh$2, tanh: tanh$1, acosh: acosh$1, asinh: asinh$1, atanh: atanh$1, log: log$1} = Math;
|
|
21
21
|
let Fixed={
|
|
22
|
-
cos: cos$
|
|
23
|
-
sin: sin$
|
|
22
|
+
cos: cos$3,
|
|
23
|
+
sin: sin$3,
|
|
24
24
|
tan: tan$1,
|
|
25
|
-
sinc: x => sin$
|
|
26
|
-
sec: x => 1/cos$
|
|
27
|
-
csc: x => 1/sin$
|
|
25
|
+
sinc: x => sin$3(PI$1*x)/(PI$1*x),
|
|
26
|
+
sec: x => 1/cos$3(x),
|
|
27
|
+
csc: x => 1/sin$3(x),
|
|
28
28
|
cot: x => 1/tan$1(x),
|
|
29
29
|
acos: acos$2,
|
|
30
30
|
asin: asin$1,
|
|
31
31
|
atan: atan$1,
|
|
32
32
|
acot: x => PI$1/2-atan$1(x),
|
|
33
|
-
cosh: cosh$
|
|
34
|
-
sinh: sinh$
|
|
33
|
+
cosh: cosh$2,
|
|
34
|
+
sinh: sinh$2,
|
|
35
35
|
tanh: tanh$1,
|
|
36
|
-
coth: n => (1/2*log((1+n)/(1-n))),
|
|
36
|
+
coth: n => (1/2*log$1((1+n)/(1-n))),
|
|
37
37
|
acosh: acosh$1,
|
|
38
38
|
asinh: asinh$1,
|
|
39
39
|
atanh: atanh$1,
|
|
@@ -67,20 +67,20 @@
|
|
|
67
67
|
const [a,b,z,phi]=[x.a,x.b,x.z,x.phi];
|
|
68
68
|
switch(fun){
|
|
69
69
|
case Math.log: return complex(ln(z),phi); // Done
|
|
70
|
-
case Math.exp: return complex(e(a)*cos$
|
|
70
|
+
case Math.exp: return complex(e(a)*cos$2(b),e(a)*sin$2(b)); // Done
|
|
71
71
|
case Math.abs: return z; // Done
|
|
72
|
-
case Math.sqrt: return complex(sqrt$
|
|
73
|
-
case Fixed.cos: return complex(cos$
|
|
74
|
-
case Fixed.sin: return complex(sin$
|
|
72
|
+
case Math.sqrt: return complex(sqrt$2(z)*cos$2(phi/2),sqrt$2(z)*sin$2(phi/2)); // Done
|
|
73
|
+
case Fixed.cos: return complex(cos$2(a)*cosh$1(b),-(sin$2(a)*sinh$1(b)));
|
|
74
|
+
case Fixed.sin: return complex(sin$2(a)*cosh$1(b),cos$2(a)*sinh$1(b));
|
|
75
75
|
case Fixed.tan:{
|
|
76
|
-
const DEN = cos$
|
|
77
|
-
return complex(sin$
|
|
76
|
+
const DEN = cos$2(2*a)+cosh$1(2*b);
|
|
77
|
+
return complex(sin$2(2*a)/DEN,sinh$1(2*b)/DEN);
|
|
78
78
|
}
|
|
79
|
-
case Fixed.cosh:return complex(cosh(a)*cos$
|
|
80
|
-
case Fixed.sinh:return complex(sinh(a)*cos$
|
|
79
|
+
case Fixed.cosh:return complex(cosh$1(a)*cos$2(b),sinh$1(a)*sin$2(b));
|
|
80
|
+
case Fixed.sinh:return complex(sinh$1(a)*cos$2(b),cosh$1(a)*sin$2(b));
|
|
81
81
|
case Fixed.tanh:{
|
|
82
|
-
const DEN=cosh(2*a)+cos$
|
|
83
|
-
return complex(sinh(2*a)/DEN,sin$
|
|
82
|
+
const DEN=cosh$1(2*a)+cos$2(2*b);
|
|
83
|
+
return complex(sinh$1(2*a)/DEN,sin$2(2*b)/DEN)
|
|
84
84
|
}
|
|
85
85
|
default : return fun(x)
|
|
86
86
|
}
|
|
@@ -951,6 +951,21 @@
|
|
|
951
951
|
}
|
|
952
952
|
};
|
|
953
953
|
|
|
954
|
+
async function fetchdom(url='https://github.com/zakarialaoui10'){
|
|
955
|
+
const data=await fetch(url);
|
|
956
|
+
const html=await data.text();
|
|
957
|
+
const dom= new DOMParser().parseFromString(html,'text/xml');
|
|
958
|
+
return dom.documentElement
|
|
959
|
+
}
|
|
960
|
+
function fetchdomSync(url='https://github.com/zakarialaoui10'){
|
|
961
|
+
const data=preload(url);
|
|
962
|
+
const dom= new DOMParser().parseFromString(data,'text/xml');
|
|
963
|
+
return dom.documentElement;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
globalThis.fetchdom=fetchdom;
|
|
967
|
+
globalThis.fetchdomSync=fetchdomSync;
|
|
968
|
+
|
|
954
969
|
const csv2arr = (csv, delimiter = ",")=>csv.trim().trimEnd().split("\n").map(n=>n.split(delimiter));
|
|
955
970
|
const csv2matrix = (csv, delimiter = ",")=>new Matrix(csv2arr(csv,delimiter));
|
|
956
971
|
const csv2object = (csv, delimiter = ",") => {
|
|
@@ -1106,59 +1121,180 @@
|
|
|
1106
1121
|
else register_to_instance(target, ...mixins);
|
|
1107
1122
|
};
|
|
1108
1123
|
|
|
1124
|
+
function parseQueryParams$1(queryString) {
|
|
1125
|
+
const params = {};
|
|
1126
|
+
queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
|
|
1127
|
+
const [key, value] = match.split('=');
|
|
1128
|
+
params[key] = value;
|
|
1129
|
+
});
|
|
1130
|
+
return params;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
function defineParamsGetter$1(target ){
|
|
1134
|
+
Object.defineProperties(target, {
|
|
1135
|
+
'QueryParams': {
|
|
1136
|
+
get: function() {
|
|
1137
|
+
return parseQueryParams$1(globalThis.location.search.substring(1));
|
|
1138
|
+
},
|
|
1139
|
+
configurable: false,
|
|
1140
|
+
enumerable: true
|
|
1141
|
+
},
|
|
1142
|
+
'HashParams': {
|
|
1143
|
+
get: function() {
|
|
1144
|
+
const hash = globalThis.location.hash.substring(1);
|
|
1145
|
+
return hash.split("#");
|
|
1146
|
+
},
|
|
1147
|
+
configurable: false,
|
|
1148
|
+
enumerable: true
|
|
1149
|
+
}
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
const __UI__={
|
|
1154
|
+
__all__(){
|
|
1155
|
+
return Object.values(this)
|
|
1156
|
+
.filter(Array.isArray)
|
|
1157
|
+
.flat();
|
|
1158
|
+
},
|
|
1159
|
+
querySelectorAll(){
|
|
1160
|
+
return this.__all__().filter(n=>n)
|
|
1161
|
+
},
|
|
1162
|
+
getElementByIndex(index){
|
|
1163
|
+
return this.__all__().find(n=>n.ui_index===index);
|
|
1164
|
+
},
|
|
1165
|
+
getElementById(id){
|
|
1166
|
+
return null;
|
|
1167
|
+
},
|
|
1168
|
+
getElementsByClass(){
|
|
1169
|
+
|
|
1170
|
+
},
|
|
1171
|
+
getElementsByTagName(){
|
|
1172
|
+
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
const __Config__ = {
|
|
1177
|
+
default:{
|
|
1178
|
+
target:null,
|
|
1179
|
+
render:true,
|
|
1180
|
+
math:{
|
|
1181
|
+
mode:"deg"
|
|
1182
|
+
}
|
|
1183
|
+
},
|
|
1184
|
+
setDefault:function(pairs){
|
|
1185
|
+
const keys=Object.keys(pairs);
|
|
1186
|
+
const values=Object.values(pairs);
|
|
1187
|
+
for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
|
|
1188
|
+
},
|
|
1189
|
+
init:()=>{
|
|
1190
|
+
// document.documentElement.setAttribute("data-engine","zikojs")
|
|
1191
|
+
},
|
|
1192
|
+
renderingMode :"spa",
|
|
1193
|
+
isSSC : false,
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
const __HYDRATION__ = {
|
|
1197
|
+
map : new Map(),
|
|
1198
|
+
index : 0,
|
|
1199
|
+
increment : function(){
|
|
1200
|
+
return this.index ++
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
|
|
1204
|
+
const __CACHE__ = {
|
|
1205
|
+
ui_index : 0,
|
|
1206
|
+
get_ui_index:function(){
|
|
1207
|
+
return this.ui_index ++
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
|
|
1211
|
+
const __State__ = {
|
|
1212
|
+
store : new Map(),
|
|
1213
|
+
index : undefined?.data?.__Ziko__?.__State__?.index ?? 0,
|
|
1214
|
+
register: function(state){
|
|
1215
|
+
console.log({
|
|
1216
|
+
hmr : undefined?.data.__Ziko__.__State__.index,
|
|
1217
|
+
index : this.index
|
|
1218
|
+
});
|
|
1219
|
+
this.store.set(this.index++, state);
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
function __init__global__(){
|
|
1225
|
+
if ( !globalThis?.__Ziko__ ){
|
|
1226
|
+
globalThis.__Ziko__ = {
|
|
1227
|
+
__UI__,
|
|
1228
|
+
__HYDRATION__,
|
|
1229
|
+
__State__,
|
|
1230
|
+
// __HYDRATION_MAP__,
|
|
1231
|
+
__Config__,
|
|
1232
|
+
__CACHE__,
|
|
1233
|
+
};
|
|
1234
|
+
defineParamsGetter$1(__Ziko__);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
if(!globalThis.__Ziko__) __init__global__();
|
|
1239
|
+
|
|
1240
|
+
// HMR persistence
|
|
1241
|
+
if (undefined) {
|
|
1242
|
+
undefined.data.__Ziko__ = undefined.data.__Ziko__ || globalThis.__Ziko__;
|
|
1243
|
+
globalThis.__Ziko__ = undefined.data.__Ziko__;
|
|
1244
|
+
// import.meta.hot.accept(n=>console.log(n));
|
|
1245
|
+
// console.log(import.meta.hot.data.__Ziko__.__State__.store)
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1109
1250
|
function useState(initialValue) {
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1251
|
+
|
|
1252
|
+
// console.log(import.meta.hot.data.__Ziko__.__State__.store.get(0))
|
|
1253
|
+
|
|
1254
|
+
const {store, index} = __Ziko__.__State__;
|
|
1255
|
+
__Ziko__.__State__.register({
|
|
1256
|
+
value : initialValue,
|
|
1257
|
+
subscribers : new Set(),
|
|
1258
|
+
paused : false
|
|
1259
|
+
});
|
|
1260
|
+
|
|
1261
|
+
const current = store.get(index);
|
|
1113
1262
|
|
|
1114
1263
|
function getValue() {
|
|
1115
1264
|
return {
|
|
1116
|
-
value,
|
|
1265
|
+
value: current.value,
|
|
1117
1266
|
isStateGetter: () => true,
|
|
1118
|
-
_subscribe: (
|
|
1119
|
-
fn,
|
|
1120
|
-
// UIElement
|
|
1121
|
-
) => {
|
|
1122
|
-
subscribers.add(fn);
|
|
1123
|
-
|
|
1124
|
-
// const observer = new MutationObserver(() => {
|
|
1125
|
-
// if (!document.body.contains(UIElement.element)) {
|
|
1126
|
-
// subscribers.delete(fn);
|
|
1127
|
-
// observer.disconnect();
|
|
1128
|
-
// }
|
|
1129
|
-
// });
|
|
1130
|
-
|
|
1131
|
-
// observer.observe(document.body, { childList: true, subtree: true });
|
|
1132
|
-
},
|
|
1267
|
+
_subscribe: (fn) => current.subscribers.add(fn),
|
|
1133
1268
|
};
|
|
1134
1269
|
}
|
|
1135
1270
|
|
|
1136
1271
|
function setValue(newValue) {
|
|
1137
|
-
if (paused) return;
|
|
1138
|
-
if (typeof newValue === "function") newValue = newValue(value);
|
|
1139
|
-
if (newValue !== value) {
|
|
1140
|
-
value = newValue;
|
|
1141
|
-
subscribers.forEach(fn => fn(value));
|
|
1272
|
+
if (current.paused) return;
|
|
1273
|
+
if (typeof newValue === "function") newValue = newValue(current.value);
|
|
1274
|
+
if (newValue !== current.value) {
|
|
1275
|
+
current.value = newValue;
|
|
1276
|
+
current.subscribers.forEach(fn => fn(current.value));
|
|
1142
1277
|
}
|
|
1143
1278
|
}
|
|
1144
1279
|
|
|
1145
1280
|
const controller = {
|
|
1146
|
-
pause: () => { paused = true; },
|
|
1147
|
-
resume: () => { paused = false; },
|
|
1148
|
-
clear: () => { subscribers.clear(); },
|
|
1149
|
-
force: (newValue) => {
|
|
1150
|
-
if (typeof newValue === "function") newValue = newValue(value);
|
|
1151
|
-
value = newValue;
|
|
1152
|
-
subscribers.forEach(fn => fn(value));
|
|
1281
|
+
pause: () => { current.paused = true; },
|
|
1282
|
+
resume: () => { current.paused = false; },
|
|
1283
|
+
clear: () => { current.subscribers.clear(); },
|
|
1284
|
+
force: (newValue) => {
|
|
1285
|
+
if (typeof newValue === "function") newValue = newValue(current.value);
|
|
1286
|
+
current.value = newValue;
|
|
1287
|
+
current.subscribers.forEach(fn => fn(current.value));
|
|
1153
1288
|
},
|
|
1154
|
-
getSubscribers: () => new Set(subscribers),
|
|
1289
|
+
getSubscribers: () => new Set(current.subscribers),
|
|
1155
1290
|
};
|
|
1156
1291
|
|
|
1157
1292
|
return [getValue, setValue, controller];
|
|
1158
1293
|
}
|
|
1159
1294
|
|
|
1295
|
+
|
|
1160
1296
|
const isStateGetter = (arg) => {
|
|
1161
|
-
return typeof
|
|
1297
|
+
return typeof arg === 'function' && arg?.()?.isStateGetter?.();
|
|
1162
1298
|
};
|
|
1163
1299
|
|
|
1164
1300
|
const camel2hyphencase = (text = '') => text.replace(/[A-Z]/g, match => '-' + match.toLowerCase());
|
|
@@ -2737,107 +2873,6 @@
|
|
|
2737
2873
|
|
|
2738
2874
|
const useMediaQuery = (mediaQueryRules,fallback) => new ZikoUseMediaQuery(mediaQueryRules,fallback);
|
|
2739
2875
|
|
|
2740
|
-
function parseQueryParams$1(queryString) {
|
|
2741
|
-
const params = {};
|
|
2742
|
-
queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
|
|
2743
|
-
const [key, value] = match.split('=');
|
|
2744
|
-
params[key] = value;
|
|
2745
|
-
});
|
|
2746
|
-
return params;
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
function defineParamsGetter$1(target ){
|
|
2750
|
-
Object.defineProperties(target, {
|
|
2751
|
-
'QueryParams': {
|
|
2752
|
-
get: function() {
|
|
2753
|
-
return parseQueryParams$1(globalThis.location.search.substring(1));
|
|
2754
|
-
},
|
|
2755
|
-
configurable: false,
|
|
2756
|
-
enumerable: true
|
|
2757
|
-
},
|
|
2758
|
-
'HashParams': {
|
|
2759
|
-
get: function() {
|
|
2760
|
-
const hash = globalThis.location.hash.substring(1);
|
|
2761
|
-
return hash.split("#");
|
|
2762
|
-
},
|
|
2763
|
-
configurable: false,
|
|
2764
|
-
enumerable: true
|
|
2765
|
-
}
|
|
2766
|
-
});
|
|
2767
|
-
}
|
|
2768
|
-
|
|
2769
|
-
const __UI__={
|
|
2770
|
-
__all__(){
|
|
2771
|
-
return Object.values(this)
|
|
2772
|
-
.filter(Array.isArray)
|
|
2773
|
-
.flat();
|
|
2774
|
-
},
|
|
2775
|
-
querySelectorAll(){
|
|
2776
|
-
return this.__all__().filter(n=>n)
|
|
2777
|
-
},
|
|
2778
|
-
getElementByIndex(index){
|
|
2779
|
-
return this.__all__().find(n=>n.ui_index===index);
|
|
2780
|
-
},
|
|
2781
|
-
getElementById(id){
|
|
2782
|
-
return null;
|
|
2783
|
-
},
|
|
2784
|
-
getElementsByClass(){
|
|
2785
|
-
|
|
2786
|
-
},
|
|
2787
|
-
getElementsByTagName(){
|
|
2788
|
-
|
|
2789
|
-
}
|
|
2790
|
-
};
|
|
2791
|
-
|
|
2792
|
-
const __Config__ = {
|
|
2793
|
-
default:{
|
|
2794
|
-
target:null,
|
|
2795
|
-
render:true,
|
|
2796
|
-
math:{
|
|
2797
|
-
mode:"deg"
|
|
2798
|
-
}
|
|
2799
|
-
},
|
|
2800
|
-
setDefault:function(pairs){
|
|
2801
|
-
const keys=Object.keys(pairs);
|
|
2802
|
-
const values=Object.values(pairs);
|
|
2803
|
-
for(let i=0; i<keys.length; i++) this.default[keys[i]]=values[i];
|
|
2804
|
-
},
|
|
2805
|
-
init:()=>{
|
|
2806
|
-
// document.documentElement.setAttribute("data-engine","zikojs")
|
|
2807
|
-
},
|
|
2808
|
-
renderingMode :"spa",
|
|
2809
|
-
isSSC : false,
|
|
2810
|
-
};
|
|
2811
|
-
|
|
2812
|
-
const __HYDRATION__ = {
|
|
2813
|
-
map : new Map(),
|
|
2814
|
-
index : 0,
|
|
2815
|
-
increment : function(){
|
|
2816
|
-
return this.index ++
|
|
2817
|
-
}
|
|
2818
|
-
};
|
|
2819
|
-
const __HYDRATION_MAP__ = new Map();
|
|
2820
|
-
|
|
2821
|
-
const __CACHE__ = {
|
|
2822
|
-
ui_index : 0,
|
|
2823
|
-
get_ui_index:function(){
|
|
2824
|
-
return this.ui_index ++
|
|
2825
|
-
}
|
|
2826
|
-
};
|
|
2827
|
-
|
|
2828
|
-
function __init__global__(){
|
|
2829
|
-
if ( !globalThis?.__Ziko__ ){
|
|
2830
|
-
globalThis.__Ziko__ = {
|
|
2831
|
-
__UI__,
|
|
2832
|
-
__HYDRATION__,
|
|
2833
|
-
__HYDRATION_MAP__,
|
|
2834
|
-
__Config__,
|
|
2835
|
-
__CACHE__,
|
|
2836
|
-
};
|
|
2837
|
-
defineParamsGetter$1(__Ziko__);
|
|
2838
|
-
}
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
2876
|
__init__global__();
|
|
2842
2877
|
class UIElement extends UINode{
|
|
2843
2878
|
constructor({element, name ='', type="html", useDefaultStyle=false}={}){
|
|
@@ -3660,38 +3695,45 @@
|
|
|
3660
3695
|
|
|
3661
3696
|
const Svg =(w,h)=>new ZikoUISvg(w,h);
|
|
3662
3697
|
|
|
3663
|
-
function
|
|
3698
|
+
function define_wc(name, UIElement, props = {}, { mode = 'open'} = {}) {
|
|
3699
|
+
if (globalThis.customElements?.get(name)) {
|
|
3700
|
+
console.warn(`Custom element "${name}" is already defined`);
|
|
3701
|
+
return; // skip redefinition
|
|
3702
|
+
}
|
|
3703
|
+
if(name.search('-') === -1){
|
|
3704
|
+
console.warn(`"${name}" is not a valid custom element name`);
|
|
3705
|
+
return;
|
|
3706
|
+
}
|
|
3664
3707
|
globalThis.customElements?.define(
|
|
3665
3708
|
name,
|
|
3666
|
-
class extends HTMLElement{
|
|
3667
|
-
static observedAttributes
|
|
3668
|
-
|
|
3709
|
+
class extends HTMLElement {
|
|
3710
|
+
static get observedAttributes() {
|
|
3711
|
+
return ['style', ...Object.keys(props)];
|
|
3712
|
+
}
|
|
3713
|
+
|
|
3714
|
+
constructor() {
|
|
3669
3715
|
super();
|
|
3670
3716
|
this.attachShadow({ mode });
|
|
3671
3717
|
this.props = {};
|
|
3672
3718
|
this.mask = {
|
|
3673
3719
|
...props,
|
|
3674
|
-
//
|
|
3675
|
-
// style : { type : Object}
|
|
3676
|
-
// }
|
|
3720
|
+
// style: { type: Object }
|
|
3677
3721
|
};
|
|
3678
3722
|
}
|
|
3679
|
-
|
|
3723
|
+
|
|
3724
|
+
connectedCallback() {
|
|
3680
3725
|
this.render();
|
|
3681
|
-
// console.log(this.props)
|
|
3682
3726
|
}
|
|
3683
|
-
|
|
3727
|
+
|
|
3728
|
+
render() {
|
|
3684
3729
|
this.shadowRoot.innerHTML = '';
|
|
3685
|
-
|
|
3686
|
-
UIElement({attrs:(key, value) => console.log({key, value})}).render(this.shadowRoot);
|
|
3687
|
-
UIElement(a => console.log(a)).render(this.shadowRoot);
|
|
3688
|
-
// this.UIElement = (()=>{
|
|
3689
|
-
// UIElement(this.props).render(this.shadowRoot);
|
|
3690
|
-
// })()
|
|
3691
|
-
// this.UIElement.setTarget(this.shadowRoot);
|
|
3730
|
+
this.UIElement = UIElement(this.props).render(this.shadowRoot);
|
|
3692
3731
|
}
|
|
3732
|
+
|
|
3693
3733
|
attributeChangedCallback(name, _, newValue) {
|
|
3694
|
-
Object.assign(this.props, {
|
|
3734
|
+
Object.assign(this.props, {
|
|
3735
|
+
[name]: this.mask[name].type(newValue)
|
|
3736
|
+
});
|
|
3695
3737
|
this.render();
|
|
3696
3738
|
}
|
|
3697
3739
|
}
|
|
@@ -4523,7 +4565,7 @@
|
|
|
4523
4565
|
}
|
|
4524
4566
|
else if(("a" in b && "z" in a)){
|
|
4525
4567
|
this.a=a.a;
|
|
4526
|
-
this.b=sqrt$
|
|
4568
|
+
this.b=sqrt$2((a.z**2)-(a.a**2));
|
|
4527
4569
|
}
|
|
4528
4570
|
else if(("a" in b && "phi" in a)){
|
|
4529
4571
|
this.a=a.a;
|
|
@@ -4531,15 +4573,15 @@
|
|
|
4531
4573
|
}
|
|
4532
4574
|
else if(("b" in b && "z" in a)){
|
|
4533
4575
|
this.b=a.b;
|
|
4534
|
-
this.a=sqrt$
|
|
4576
|
+
this.a=sqrt$2((a.z**2)-(a.b**2));
|
|
4535
4577
|
}
|
|
4536
4578
|
else if(("b" in b && "phi" in a)){
|
|
4537
4579
|
this.b=b;
|
|
4538
4580
|
this.a=a.b/tan(a.phi);
|
|
4539
4581
|
}
|
|
4540
4582
|
else if(("z" in b && "phi" in a)){
|
|
4541
|
-
this.a=a.z*cos$
|
|
4542
|
-
this.a=a.z*sin$
|
|
4583
|
+
this.a=a.z*cos$2(a.phi);
|
|
4584
|
+
this.a=a.z*sin$2(a.phi);
|
|
4543
4585
|
}
|
|
4544
4586
|
}
|
|
4545
4587
|
else if(typeof(a)==="number"&&typeof(b)==="number"){
|
|
@@ -4607,8 +4649,8 @@
|
|
|
4607
4649
|
}
|
|
4608
4650
|
let Z=+prod(this.z,...z.map(n=>n.z)).toFixed(15);
|
|
4609
4651
|
let phi=+sum(this.phi,...z.map(n=>n.phi)).toFixed(15);
|
|
4610
|
-
this.a=+(Z*cos$
|
|
4611
|
-
this.b=+(Z*sin$
|
|
4652
|
+
this.a=+(Z*cos$2(phi).toFixed(15)).toFixed(14);
|
|
4653
|
+
this.b=+(Z*sin$2(phi).toFixed(15)).toFixed(14);
|
|
4612
4654
|
return this;
|
|
4613
4655
|
}
|
|
4614
4656
|
div(...z) {
|
|
@@ -4617,23 +4659,23 @@
|
|
|
4617
4659
|
}
|
|
4618
4660
|
let Z=+(this.z/prod(...z.map(n=>n.z))).toFixed(15);
|
|
4619
4661
|
let phi=+(this.phi-sum(...z.map(n=>n.phi))).toFixed(15);
|
|
4620
|
-
this.a=+(Z*cos$
|
|
4621
|
-
this.b=+(Z*sin$
|
|
4662
|
+
this.a=+(Z*cos$2(phi).toFixed(15)).toFixed(15);
|
|
4663
|
+
this.b=+(Z*sin$2(phi).toFixed(15)).toFixed(15);
|
|
4622
4664
|
return this;
|
|
4623
4665
|
}
|
|
4624
4666
|
pow(n) {
|
|
4625
4667
|
if (floor(n) === n && n > 0) {
|
|
4626
4668
|
let z=+(this.z**n).toFixed(15);
|
|
4627
4669
|
let phi=+(this.phi*n).toFixed(15);
|
|
4628
|
-
this.a=+(z*cos$
|
|
4629
|
-
this.b=+(z*sin$
|
|
4670
|
+
this.a=+(z*cos$2(phi).toFixed(15)).toFixed(15);
|
|
4671
|
+
this.b=+(z*sin$2(phi).toFixed(15)).toFixed(15);
|
|
4630
4672
|
}
|
|
4631
4673
|
return this;
|
|
4632
4674
|
}
|
|
4633
4675
|
static fromExpo(z, phi) {
|
|
4634
4676
|
return new Complex(
|
|
4635
|
-
+(z * cos$
|
|
4636
|
-
+(z * sin$
|
|
4677
|
+
+(z * cos$2(phi)).toFixed(13),
|
|
4678
|
+
+(z * sin$2(phi)).toFixed(13)
|
|
4637
4679
|
);
|
|
4638
4680
|
}
|
|
4639
4681
|
get expo() {
|
|
@@ -4655,10 +4697,10 @@
|
|
|
4655
4697
|
return z.clone.pow(n);
|
|
4656
4698
|
}
|
|
4657
4699
|
static xpowZ(x){
|
|
4658
|
-
return complex((x**this.a)*cos$
|
|
4700
|
+
return complex((x**this.a)*cos$2(this.b*ln(x)),(x**this.a)*sin$2(this.b*ln(x)));
|
|
4659
4701
|
}
|
|
4660
4702
|
sqrtn(n=2){
|
|
4661
|
-
return complex(sqrtn(this.z,n)*cos$
|
|
4703
|
+
return complex(sqrtn(this.z,n)*cos$2(this.phi/n),sqrtn(this.z,n)*sin$2(this.phi/n));
|
|
4662
4704
|
}
|
|
4663
4705
|
get sqrt(){
|
|
4664
4706
|
return this.sqrtn(2);
|
|
@@ -4667,14 +4709,14 @@
|
|
|
4667
4709
|
return complex(this.z,this.phi);
|
|
4668
4710
|
}
|
|
4669
4711
|
get cos(){
|
|
4670
|
-
return complex(cos$
|
|
4712
|
+
return complex(cos$2(this.a)*cosh$1(this.b),sin$2(this.a)*sinh$1(this.b))
|
|
4671
4713
|
}
|
|
4672
4714
|
get sin(){
|
|
4673
|
-
return complex(sin$
|
|
4715
|
+
return complex(sin$2(this.a)*cosh$1(this.b),cos$2(this.a)*sinh$1(this.b))
|
|
4674
4716
|
}
|
|
4675
4717
|
get tan(){
|
|
4676
|
-
const de=cos$
|
|
4677
|
-
return complex(sin$
|
|
4718
|
+
const de=cos$2(this.a*2)+cosh$1(this.b*2);
|
|
4719
|
+
return complex(sin$2(2*this.a)/de,sinh$1(2*this.b)/de);
|
|
4678
4720
|
}
|
|
4679
4721
|
printInConsole() {
|
|
4680
4722
|
let string = this.a + " + " + this.b + " * i";
|
|
@@ -4705,7 +4747,7 @@
|
|
|
4705
4747
|
// } from "../calculus/index.js";
|
|
4706
4748
|
|
|
4707
4749
|
const abs=(...x)=>mapfun$1(Math.abs,...x);
|
|
4708
|
-
const sqrt$
|
|
4750
|
+
const sqrt$2=(...x)=>mapfun$1(Math.sqrt,...x);
|
|
4709
4751
|
const pow$1=(x,n)=>{
|
|
4710
4752
|
if(typeof x === "number"){
|
|
4711
4753
|
if(typeof n === "number")return Math.pow(x,n);
|
|
@@ -4753,8 +4795,8 @@
|
|
|
4753
4795
|
};
|
|
4754
4796
|
const e=(...x) => mapfun$1(Math.exp,...x);
|
|
4755
4797
|
const ln=(...x) => mapfun$1(Math.log,...x);
|
|
4756
|
-
const cos$
|
|
4757
|
-
const sin$
|
|
4798
|
+
const cos$2=(...x) => mapfun$1(Fixed.cos,...x);
|
|
4799
|
+
const sin$2=(...x) => mapfun$1(Fixed.sin,...x);
|
|
4758
4800
|
const tan=(...x) => mapfun$1(Fixed.tan,...x);
|
|
4759
4801
|
const sec=(...x) => mapfun$1(Fixed.sec,...x);
|
|
4760
4802
|
const sinc=(...x) => mapfun$1(Fixed.sinc,...x);
|
|
@@ -4764,8 +4806,8 @@
|
|
|
4764
4806
|
const asin=(...x) => mapfun$1(Fixed.asin,...x);
|
|
4765
4807
|
const atan=(...x) => mapfun$1(Fixed.atan,...x);
|
|
4766
4808
|
const acot=(...x) => mapfun$1(Fixed.acot,...x);
|
|
4767
|
-
const cosh=(...x) => mapfun$1(Fixed.cosh,...x);
|
|
4768
|
-
const sinh=(...x) => mapfun$1(Fixed.sinh,...x);
|
|
4809
|
+
const cosh$1=(...x) => mapfun$1(Fixed.cosh,...x);
|
|
4810
|
+
const sinh$1=(...x) => mapfun$1(Fixed.sinh,...x);
|
|
4769
4811
|
const tanh=(...x) => mapfun$1(Fixed.tanh,...x);
|
|
4770
4812
|
const coth=(...x) => mapfun$1(Fixed.coth,...x);
|
|
4771
4813
|
const acosh=(...x) => mapfun$1(Fixed.acosh,...x);
|
|
@@ -4814,12 +4856,12 @@
|
|
|
4814
4856
|
)
|
|
4815
4857
|
};
|
|
4816
4858
|
|
|
4817
|
-
const {PI, sqrt, cos, sin, acos, pow} = Math;
|
|
4859
|
+
const {PI, sqrt: sqrt$1, cos: cos$1, sin: sin$1, acos, pow} = Math;
|
|
4818
4860
|
|
|
4819
4861
|
const Linear = t => t;
|
|
4820
|
-
const InSin = t => 1 - cos((t * PI) / 2);
|
|
4821
|
-
const OutSin = t => sin((t * PI) / 2);
|
|
4822
|
-
const InOutSin = t => -(cos(PI * t) - 1) / 2;
|
|
4862
|
+
const InSin = t => 1 - cos$1((t * PI) / 2);
|
|
4863
|
+
const OutSin = t => sin$1((t * PI) / 2);
|
|
4864
|
+
const InOutSin = t => -(cos$1(PI * t) - 1) / 2;
|
|
4823
4865
|
|
|
4824
4866
|
const InQuad = t => t**2;
|
|
4825
4867
|
const OutQuad = t => 1 - (1-t)**2;
|
|
@@ -4841,13 +4883,13 @@
|
|
|
4841
4883
|
const OutExpo = t => t === 1 ? 1 : 1 - 2**(-10 * t);
|
|
4842
4884
|
const InOutExpo = t => t === 0? 0: t === 1? 1: t < 0.5 ? 2**(20 * t - 10) / 2: (2 - 2**(-20 * t + 10)) / 2;
|
|
4843
4885
|
|
|
4844
|
-
const InCirc = t => 1 - sqrt(1 - t**2);
|
|
4845
|
-
const OutCirc = t => sqrt(1 - (t-1)**2);
|
|
4846
|
-
const InOutCirc = t => t < 0.5? (1 - sqrt(1 - (2*t)**2)) / 2: (sqrt(1 - (-2*t+2)**2) + 1) / 2;
|
|
4886
|
+
const InCirc = t => 1 - sqrt$1(1 - t**2);
|
|
4887
|
+
const OutCirc = t => sqrt$1(1 - (t-1)**2);
|
|
4888
|
+
const InOutCirc = t => t < 0.5? (1 - sqrt$1(1 - (2*t)**2)) / 2: (sqrt$1(1 - (-2*t+2)**2) + 1) / 2;
|
|
4847
4889
|
|
|
4848
|
-
const Arc = t => 1 - sin(acos(t));
|
|
4890
|
+
const Arc = t => 1 - sin$1(acos(t));
|
|
4849
4891
|
const Back = (t, x = 1) => (t**2) * ((x+1)*t - x);
|
|
4850
|
-
const Elastic = t => -2*pow(2, 10 * (t - 1)) * cos(20 * PI * t / 3 * t);
|
|
4892
|
+
const Elastic = t => -2*pow(2, 10 * (t - 1)) * cos$1(20 * PI * t / 3 * t);
|
|
4851
4893
|
|
|
4852
4894
|
const InBack = (t, c1 = 1.70158, c3 = c1 + 1) => c3 * pow(t,3)- c1 * (t**2);
|
|
4853
4895
|
const OutBack = (t, c1 = 1.70158, c3 = c1 + 1) => 1 + c3 * pow(t - 1, 3) + c1 * pow(t - 1, 2);
|
|
@@ -4858,7 +4900,7 @@
|
|
|
4858
4900
|
? 0
|
|
4859
4901
|
: t === 1
|
|
4860
4902
|
? 1
|
|
4861
|
-
: -pow(2, 10 * t - 10) * sin((t * 10 - 10.75) * c4);
|
|
4903
|
+
: -pow(2, 10 * t - 10) * sin$1((t * 10 - 10.75) * c4);
|
|
4862
4904
|
};
|
|
4863
4905
|
|
|
4864
4906
|
const OutElastic = (t, c4 = 2*PI/3) => {
|
|
@@ -4866,7 +4908,7 @@
|
|
|
4866
4908
|
? 0
|
|
4867
4909
|
: t === 1
|
|
4868
4910
|
? 1
|
|
4869
|
-
: pow(2, -10 * t) * sin((t * 10 - 0.75) * c4) + 1;
|
|
4911
|
+
: pow(2, -10 * t) * sin$1((t * 10 - 0.75) * c4) + 1;
|
|
4870
4912
|
};
|
|
4871
4913
|
const InOutElastic = (t, c5 = 2 * PI / 4.5) => {
|
|
4872
4914
|
return t === 0
|
|
@@ -4874,8 +4916,8 @@
|
|
|
4874
4916
|
: t === 1
|
|
4875
4917
|
? 1
|
|
4876
4918
|
: t < 0.5
|
|
4877
|
-
? -(pow(2, 20 * t - 10) * sin((20 * t - 11.125) * c5)) / 2
|
|
4878
|
-
: (pow(2, -20 * t + 10) * sin((20 * t - 11.125) * c5)) / 2 + 1;
|
|
4919
|
+
? -(pow(2, 20 * t - 10) * sin$1((20 * t - 11.125) * c5)) / 2
|
|
4920
|
+
: (pow(2, -20 * t + 10) * sin$1((20 * t - 11.125) * c5)) / 2 + 1;
|
|
4879
4921
|
};
|
|
4880
4922
|
|
|
4881
4923
|
const InBounce = (t, n1 = 7.5625, d1 = 2.75) => 1 - OutBounce(1-t, n1, d1);
|
|
@@ -4983,17 +5025,28 @@
|
|
|
4983
5025
|
new TimeAnimation(callback, {ease, t0, t1, start, duration});
|
|
4984
5026
|
|
|
4985
5027
|
class Tick {
|
|
4986
|
-
constructor(ms,
|
|
5028
|
+
constructor(fn, ms, count = Infinity, start) {
|
|
4987
5029
|
this.ms = ms;
|
|
4988
5030
|
this.fn = fn;
|
|
5031
|
+
this.count = count;
|
|
5032
|
+
this.frame = 1;
|
|
4989
5033
|
this.id = null;
|
|
4990
5034
|
this.running = false;
|
|
5035
|
+
if(start) this.start();
|
|
4991
5036
|
}
|
|
4992
5037
|
|
|
4993
5038
|
start() {
|
|
4994
5039
|
if (!this.running) {
|
|
4995
5040
|
this.running = true;
|
|
4996
|
-
this.
|
|
5041
|
+
this.frame = 1;
|
|
5042
|
+
this.id = setInterval(() => {
|
|
5043
|
+
if (this.frame > this.count) {
|
|
5044
|
+
this.stop();
|
|
5045
|
+
return;
|
|
5046
|
+
}
|
|
5047
|
+
this.fn.call(null, this);
|
|
5048
|
+
this.frame++;
|
|
5049
|
+
}, this.ms);
|
|
4997
5050
|
}
|
|
4998
5051
|
return this;
|
|
4999
5052
|
}
|
|
@@ -5011,7 +5064,9 @@
|
|
|
5011
5064
|
return this.running;
|
|
5012
5065
|
}
|
|
5013
5066
|
}
|
|
5014
|
-
|
|
5067
|
+
|
|
5068
|
+
// Helper factory
|
|
5069
|
+
const tick = (fn, ms, count = Infinity, start = true) => new Tick(fn, ms, count, start);
|
|
5015
5070
|
|
|
5016
5071
|
class Clock extends Tick {
|
|
5017
5072
|
constructor(tickMs = 1000 / 60) {
|
|
@@ -5143,7 +5198,8 @@
|
|
|
5143
5198
|
const step_fps = (step_or_fps) => 1000 / step_or_fps;
|
|
5144
5199
|
|
|
5145
5200
|
const debounce=(fn,delay=1000)=>{
|
|
5146
|
-
|
|
5201
|
+
let id;
|
|
5202
|
+
return (...args) => id ? clearTimeout(id) : setTimeout(()=>fn(...args),delay);
|
|
5147
5203
|
};
|
|
5148
5204
|
const throttle=(fn,delay)=>{
|
|
5149
5205
|
let lastTime=0;
|
|
@@ -5548,66 +5604,37 @@
|
|
|
5548
5604
|
function useDerived(deriveFn, sources) {
|
|
5549
5605
|
let value = deriveFn(...sources.map(s => s().value));
|
|
5550
5606
|
const subscribers = new Set();
|
|
5551
|
-
let paused = false;
|
|
5552
|
-
|
|
5553
|
-
function getValue() {
|
|
5554
|
-
return {
|
|
5555
|
-
value,
|
|
5556
|
-
isStateGetter: () => true,
|
|
5557
|
-
_subscribe: (fn, UIElement) => {
|
|
5558
|
-
subscribers.add(fn);
|
|
5559
|
-
|
|
5560
|
-
const observer = new MutationObserver(() => {
|
|
5561
|
-
if (!document.body.contains(UIElement.element)) {
|
|
5562
|
-
subscribers.delete(fn);
|
|
5563
|
-
observer.disconnect();
|
|
5564
|
-
}
|
|
5565
|
-
});
|
|
5566
|
-
|
|
5567
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
5568
|
-
},
|
|
5569
|
-
};
|
|
5570
|
-
}
|
|
5571
|
-
|
|
5572
|
-
function setValue(newValue) {
|
|
5573
|
-
if (paused) return;
|
|
5574
|
-
if (typeof newValue === "function") newValue = newValue(value);
|
|
5575
|
-
if (newValue !== value) {
|
|
5576
|
-
value = newValue;
|
|
5577
|
-
subscribers.forEach(fn => fn(value));
|
|
5578
|
-
}
|
|
5579
|
-
}
|
|
5580
|
-
|
|
5581
|
-
const controller = {
|
|
5582
|
-
pause: () => { paused = true; },
|
|
5583
|
-
resume: () => { paused = false; },
|
|
5584
|
-
clear: () => { subscribers.clear(); },
|
|
5585
|
-
force: (newValue) => {
|
|
5586
|
-
if (typeof newValue === "function") newValue = newValue(value);
|
|
5587
|
-
value = newValue;
|
|
5588
|
-
subscribers.forEach(fn => fn(value));
|
|
5589
|
-
},
|
|
5590
|
-
getSubscribers: () => new Set(subscribers),
|
|
5591
|
-
};
|
|
5592
5607
|
|
|
5593
|
-
// Subscribe to source states
|
|
5594
5608
|
sources.forEach(source => {
|
|
5595
5609
|
const srcValue = source(); // getValue()
|
|
5596
5610
|
srcValue._subscribe(() => {
|
|
5597
|
-
|
|
5611
|
+
{
|
|
5598
5612
|
const newVal = deriveFn(...sources.map(s => s().value));
|
|
5599
5613
|
if (newVal !== value) {
|
|
5600
5614
|
value = newVal;
|
|
5601
5615
|
subscribers.forEach(fn => fn(value));
|
|
5602
5616
|
}
|
|
5603
5617
|
}
|
|
5604
|
-
}
|
|
5618
|
+
});
|
|
5605
5619
|
});
|
|
5606
|
-
|
|
5607
|
-
|
|
5620
|
+
return () => ({
|
|
5621
|
+
value,
|
|
5622
|
+
isStateGetter : () => true,
|
|
5623
|
+
_subscribe: (fn) => subscribers.add(fn)
|
|
5624
|
+
})
|
|
5608
5625
|
}
|
|
5609
5626
|
|
|
5610
|
-
const useReactive = (nested_value) => mapfun$1(
|
|
5627
|
+
const useReactive = (nested_value) => mapfun$1(
|
|
5628
|
+
n => {
|
|
5629
|
+
const state = useState(n);
|
|
5630
|
+
// console.log(state)
|
|
5631
|
+
return {
|
|
5632
|
+
get : state[0],
|
|
5633
|
+
set : state[1],
|
|
5634
|
+
}
|
|
5635
|
+
},
|
|
5636
|
+
nested_value
|
|
5637
|
+
);
|
|
5611
5638
|
|
|
5612
5639
|
class ZikoUseChannel{
|
|
5613
5640
|
constructor(name = ""){
|
|
@@ -5843,6 +5870,65 @@
|
|
|
5843
5870
|
const useLocaleStorage=(key,initialValue)=>new ZikoUseStorage(localStorage,key,initialValue);
|
|
5844
5871
|
const useSessionStorage=(key,initialValue)=>new ZikoUseStorage(sessionStorage,key,initialValue);
|
|
5845
5872
|
|
|
5873
|
+
let {sqrt, cos, sin, exp, log, cosh, sinh} = Math;
|
|
5874
|
+
// Math.abs = new Proxy(Math.abs, {
|
|
5875
|
+
// apply(target, thisArg, args) {
|
|
5876
|
+
// const x = args[0]
|
|
5877
|
+
// if(typeof x === 'number') return target.apply(thisArg, args);
|
|
5878
|
+
// if(x?.isComplex?.()){
|
|
5879
|
+
// const {a, b, z, phi} = x
|
|
5880
|
+
// const complex = (a, b) => new x.constructor(a, b)
|
|
5881
|
+
// switch(target.name){
|
|
5882
|
+
// case 'abs' : return a.z;
|
|
5883
|
+
// case 'sqrt' : return complex(sqrt(z)*cos(phi/2),sqrt(z)*sin(phi/2));
|
|
5884
|
+
// }
|
|
5885
|
+
// }
|
|
5886
|
+
|
|
5887
|
+
// }
|
|
5888
|
+
// });
|
|
5889
|
+
|
|
5890
|
+
|
|
5891
|
+
for (const key of Object.getOwnPropertyNames(Math)) {
|
|
5892
|
+
const fn = Math[key];
|
|
5893
|
+
if (typeof fn === "function") {
|
|
5894
|
+
Math[key] = new Proxy(fn, {
|
|
5895
|
+
apply(target, thisArg, args) {
|
|
5896
|
+
// console.log(target)
|
|
5897
|
+
const x = args[0];
|
|
5898
|
+
if(typeof x === 'number' || args.length === 0) return target.apply(thisArg, args);
|
|
5899
|
+
if(x?.isComplex?.()){
|
|
5900
|
+
const {a, b, z, phi} = x;
|
|
5901
|
+
const complex = (a, b) => new x.constructor(a, b);
|
|
5902
|
+
switch(target.name){
|
|
5903
|
+
case 'abs' : return x.z;
|
|
5904
|
+
case 'sqrt' : return complex(sqrt(z)*cos(phi/2),sqrt(z)*sin(phi/2));
|
|
5905
|
+
case 'log' : return complex(log(z), phi);
|
|
5906
|
+
case 'exp' : return complex(exp(a)*cos(b),exp(a)*sin(b));
|
|
5907
|
+
case 'cos' : return complex(cos(a)*cosh(b),-(sin(a)*sinh(b)));
|
|
5908
|
+
case 'sin' : return complex(sin(a)*cosh(b),cos(a)*sinh(b));
|
|
5909
|
+
case 'tan' : {
|
|
5910
|
+
const DEN = cos(2*a)+cosh(2*b);
|
|
5911
|
+
return complex(sin(2*a) /DEN, sinh(2*b)/DEN);
|
|
5912
|
+
}
|
|
5913
|
+
case 'cosh' : return complex(cosh(a)*cos(b),sinh(a)*sin(b));
|
|
5914
|
+
case 'sinh' : return complex(sinh(a)*cos(b),cosh(a)*sin(b));
|
|
5915
|
+
case 'tanh' : {
|
|
5916
|
+
const DEN=cosh(2*a)+cos(2*b);
|
|
5917
|
+
return complex(sinh(2*a)/DEN,sin(2*b)/DEN)
|
|
5918
|
+
}
|
|
5919
|
+
default : return target.apply(thisArg, args)
|
|
5920
|
+
}
|
|
5921
|
+
}
|
|
5922
|
+
// if( x.isMatrix?.()){
|
|
5923
|
+
// const {rows, cols, arr} = x
|
|
5924
|
+
// // return new x.constructor(rows, cols, arr.flat(1).map(n=>));
|
|
5925
|
+
// }
|
|
5926
|
+
throw new TypeError(`Math.${key} expects only numbers`);
|
|
5927
|
+
}
|
|
5928
|
+
});
|
|
5929
|
+
}
|
|
5930
|
+
}
|
|
5931
|
+
|
|
5846
5932
|
if(globalThis?.document){
|
|
5847
5933
|
document?.addEventListener("DOMContentLoaded", __Ziko__.__Config__.init());
|
|
5848
5934
|
}
|
|
@@ -5971,8 +6057,8 @@
|
|
|
5971
6057
|
exports.clock = clock;
|
|
5972
6058
|
exports.combinaison = combinaison;
|
|
5973
6059
|
exports.complex = complex;
|
|
5974
|
-
exports.cos = cos$
|
|
5975
|
-
exports.cosh = cosh;
|
|
6060
|
+
exports.cos = cos$2;
|
|
6061
|
+
exports.cosh = cosh$1;
|
|
5976
6062
|
exports.cot = cot;
|
|
5977
6063
|
exports.coth = coth;
|
|
5978
6064
|
exports.csc = csc;
|
|
@@ -5983,7 +6069,7 @@
|
|
|
5983
6069
|
exports.csv2sql = csv2sql;
|
|
5984
6070
|
exports.debounce = debounce;
|
|
5985
6071
|
exports.defineParamsGetter = defineParamsGetter;
|
|
5986
|
-
exports.
|
|
6072
|
+
exports.define_wc = define_wc;
|
|
5987
6073
|
exports.deg2rad = deg2rad;
|
|
5988
6074
|
exports.div = div;
|
|
5989
6075
|
exports.e = e;
|
|
@@ -6033,11 +6119,11 @@
|
|
|
6033
6119
|
exports.sec = sec;
|
|
6034
6120
|
exports.sig = sig;
|
|
6035
6121
|
exports.sign = sign;
|
|
6036
|
-
exports.sin = sin$
|
|
6122
|
+
exports.sin = sin$2;
|
|
6037
6123
|
exports.sinc = sinc;
|
|
6038
|
-
exports.sinh = sinh;
|
|
6124
|
+
exports.sinh = sinh$1;
|
|
6039
6125
|
exports.sleep = sleep;
|
|
6040
|
-
exports.sqrt = sqrt$
|
|
6126
|
+
exports.sqrt = sqrt$2;
|
|
6041
6127
|
exports.sqrtn = sqrtn;
|
|
6042
6128
|
exports.step_fps = step_fps;
|
|
6043
6129
|
exports.sub = sub;
|