ziko 0.0.7 → 0.0.9
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/README.md +0 -75
- package/dist/ziko.cjs +2024 -1401
- package/dist/ziko.js +2024 -1401
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +1982 -1401
- package/package.json +1 -1
- package/wrapper/react/README.md +0 -26
- package/wrapper/react/index.jsx +0 -22
- package/wrapper/svelte/ZikoUI.svelte +0 -15
- package/wrapper/vue/ZikoUI.vue +0 -23
package/dist/ziko.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*
|
|
3
3
|
Project: ziko.js
|
|
4
4
|
Author: Zakaria Elalaoui
|
|
5
|
-
Date :
|
|
5
|
+
Date : Thu Jun 13 2024 19:22:25 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
|
|
@@ -3240,7 +3240,7 @@ class ZikoEventPointer extends ZikoEvent{
|
|
|
3240
3240
|
// if(up)this.handleUp()
|
|
3241
3241
|
// }
|
|
3242
3242
|
}
|
|
3243
|
-
var
|
|
3243
|
+
var usePointerEvent=target=>new ZikoEventPointer(target);
|
|
3244
3244
|
|
|
3245
3245
|
class ZikoEventMouse extends ZikoEvent{
|
|
3246
3246
|
constructor(target){
|
|
@@ -3469,7 +3469,7 @@ function mouseover_controller(e){
|
|
|
3469
3469
|
null
|
|
3470
3470
|
);
|
|
3471
3471
|
}
|
|
3472
|
-
const
|
|
3472
|
+
const useMouseEvent=target=>new ZikoEventMouse(target);
|
|
3473
3473
|
|
|
3474
3474
|
function wheel_controller(e){
|
|
3475
3475
|
EVENT_CONTROLLER.call(this,e,"wheel",null,null);
|
|
@@ -3512,7 +3512,7 @@ class ZikoEventWheel extends ZikoEvent{
|
|
|
3512
3512
|
return this;
|
|
3513
3513
|
}
|
|
3514
3514
|
}
|
|
3515
|
-
const
|
|
3515
|
+
const useWheelEventnent=Target=>new ZikoEventWheel(Target);
|
|
3516
3516
|
|
|
3517
3517
|
function keydown_controller(e){
|
|
3518
3518
|
EVENT_CONTROLLER.call(
|
|
@@ -3609,7 +3609,7 @@ class ZikoEventKey extends ZikoEvent{
|
|
|
3609
3609
|
|
|
3610
3610
|
}
|
|
3611
3611
|
|
|
3612
|
-
var
|
|
3612
|
+
var useKeyEvenent=Target=>new ZikoEventKey(Target);
|
|
3613
3613
|
|
|
3614
3614
|
function dragstart_controller(e){
|
|
3615
3615
|
EVENT_CONTROLLER(this,e,"start",null);
|
|
@@ -3744,8 +3744,8 @@ class ZikoEventDrop extends ZikoEvent{
|
|
|
3744
3744
|
return this;
|
|
3745
3745
|
}
|
|
3746
3746
|
}
|
|
3747
|
-
const
|
|
3748
|
-
const
|
|
3747
|
+
const useDragEvent=Target=>new ZikoEventDrag(Target);
|
|
3748
|
+
const useDropEvent=Target=>new ZikoEventDrop(Target);
|
|
3749
3749
|
|
|
3750
3750
|
function click_controller(e){
|
|
3751
3751
|
EVENT_CONTROLLER.call(this,e,"click",null,null);
|
|
@@ -3800,7 +3800,7 @@ class ZikoEventClick extends ZikoEvent{
|
|
|
3800
3800
|
return this;
|
|
3801
3801
|
}
|
|
3802
3802
|
}
|
|
3803
|
-
const
|
|
3803
|
+
const useClickEventnt=Target=>new ZikoEventClick(Target);
|
|
3804
3804
|
|
|
3805
3805
|
function copy_controller(e){
|
|
3806
3806
|
EVENT_CONTROLLER.call(this,e,"copy",null,null);
|
|
@@ -3883,7 +3883,7 @@ class ZikoEventClipboard extends ZikoEvent{
|
|
|
3883
3883
|
return this;
|
|
3884
3884
|
}
|
|
3885
3885
|
}
|
|
3886
|
-
const
|
|
3886
|
+
const useClipboardEvent=Target=>new ZikoEventClipboard(Target);
|
|
3887
3887
|
|
|
3888
3888
|
function focus_controller(e){
|
|
3889
3889
|
EVENT_CONTROLLER.call(this,e,"focus",null,null);
|
|
@@ -3938,7 +3938,7 @@ class ZikoEventFocus extends ZikoEvent{
|
|
|
3938
3938
|
return this;
|
|
3939
3939
|
}
|
|
3940
3940
|
}
|
|
3941
|
-
const
|
|
3941
|
+
const useFocusEvent=Target=>new ZikoEventFocus(Target);
|
|
3942
3942
|
|
|
3943
3943
|
function input_controller(e){
|
|
3944
3944
|
EVENT_CONTROLLER.call(this,e,"input",null,null);
|
|
@@ -3996,7 +3996,7 @@ class ZikoEventInput extends ZikoEvent{
|
|
|
3996
3996
|
return this;
|
|
3997
3997
|
}
|
|
3998
3998
|
}
|
|
3999
|
-
const
|
|
3999
|
+
const useInputEvent=Target=>new ZikoEventInput(Target);
|
|
4000
4000
|
|
|
4001
4001
|
function hashchange_controller(e){
|
|
4002
4002
|
EVENT_CONTROLLER.call(this,e,"hashchange",null,null);
|
|
@@ -4039,7 +4039,7 @@ class ZikoEventHash extends ZikoEvent{
|
|
|
4039
4039
|
return this;
|
|
4040
4040
|
}
|
|
4041
4041
|
}
|
|
4042
|
-
const
|
|
4042
|
+
const useHashEvent=Target=>new ZikoEventHash(Target);
|
|
4043
4043
|
|
|
4044
4044
|
const custom_event_controller=event_name=>function(e){
|
|
4045
4045
|
EVENT_CONTROLLER.call(this,e,event_name,null,null);
|
|
@@ -4091,21 +4091,21 @@ class ZikoCustomEvent extends ZikoEvent{
|
|
|
4091
4091
|
return this;
|
|
4092
4092
|
}
|
|
4093
4093
|
}
|
|
4094
|
-
const
|
|
4094
|
+
const useCustomEvent=Target=>new ZikoCustomEvent(Target);
|
|
4095
4095
|
|
|
4096
4096
|
const Events={
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4097
|
+
usePointerEvent,
|
|
4098
|
+
useMouseEvent,
|
|
4099
|
+
useWheelEvent: useWheelEventnent,
|
|
4100
|
+
useKeyEvent: useKeyEvenent,
|
|
4101
|
+
useDragEvent,
|
|
4102
|
+
useDropEvent,
|
|
4103
|
+
useClickEvent: useClickEventnt,
|
|
4104
|
+
useClipboardEvent,
|
|
4105
|
+
useFocusEvent,
|
|
4106
|
+
useInputEvent,
|
|
4107
|
+
useHashEvent,
|
|
4108
|
+
useCustomEvent,
|
|
4109
4109
|
ExtractAll: function () {
|
|
4110
4110
|
const keys = Object.keys(this);
|
|
4111
4111
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -4166,7 +4166,104 @@ class ZikoIntersectionObserver{
|
|
|
4166
4166
|
}
|
|
4167
4167
|
}
|
|
4168
4168
|
|
|
4169
|
-
const
|
|
4169
|
+
const watchIntersection=(UI,callback,config)=>new ZikoIntersectionObserver(UI,callback,config);
|
|
4170
|
+
|
|
4171
|
+
class ZikoMutationObserver {
|
|
4172
|
+
constructor(UIElement, options) {
|
|
4173
|
+
this.UIElement = UIElement;
|
|
4174
|
+
this.options = options || { attributes: true, childList: true, subtree: true };
|
|
4175
|
+
this.observer = null;
|
|
4176
|
+
this.streamingEnabled = true;
|
|
4177
|
+
this.mutationHistory = {
|
|
4178
|
+
attributes: [],
|
|
4179
|
+
childList: [],
|
|
4180
|
+
subtree: [],
|
|
4181
|
+
};
|
|
4182
|
+
|
|
4183
|
+
this.observeCallback = (mutationsList, observer) => {
|
|
4184
|
+
if (this.streamingEnabled) {
|
|
4185
|
+
for (const mutation of mutationsList) {
|
|
4186
|
+
switch(mutation.type){
|
|
4187
|
+
case 'attributes':this.mutationHistory.attributes.push(mutation.target.getAttribute(mutation.attributeName));break;
|
|
4188
|
+
case 'childList':this.mutationHistory.childList.push(mutation);break;
|
|
4189
|
+
case 'subtree':this.mutationHistory.subtree.push(mutation);break;
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
if (this.callback) {
|
|
4194
|
+
this.callback(mutationsList, observer);
|
|
4195
|
+
}
|
|
4196
|
+
};
|
|
4197
|
+
}
|
|
4198
|
+
|
|
4199
|
+
observe(callback) {
|
|
4200
|
+
if(!this.observer) {
|
|
4201
|
+
this.observer = new MutationObserver(this.observeCallback);
|
|
4202
|
+
this.observer.observe(this.UIElement.element, this.options);
|
|
4203
|
+
this.callback = callback;
|
|
4204
|
+
this.streamingEnabled = true;
|
|
4205
|
+
}
|
|
4206
|
+
}
|
|
4207
|
+
|
|
4208
|
+
pause(options) {
|
|
4209
|
+
if (this.observer) {
|
|
4210
|
+
this.observer.disconnect();
|
|
4211
|
+
if (options) {
|
|
4212
|
+
this.observer.observe(this.UIElement, options);
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4216
|
+
|
|
4217
|
+
reset(options) {
|
|
4218
|
+
if (this.observer) {
|
|
4219
|
+
this.observer.disconnect();
|
|
4220
|
+
this.observer.observe(this.UIElement, options || this.options);
|
|
4221
|
+
}
|
|
4222
|
+
}
|
|
4223
|
+
|
|
4224
|
+
clear() {
|
|
4225
|
+
if (this.observer) {
|
|
4226
|
+
this.observer.disconnect();
|
|
4227
|
+
this.observer = null;
|
|
4228
|
+
this.mutationHistory = {
|
|
4229
|
+
attributes: [],
|
|
4230
|
+
childList: [],
|
|
4231
|
+
subtree: [],
|
|
4232
|
+
};
|
|
4233
|
+
}
|
|
4234
|
+
this.streamingEnabled = false;
|
|
4235
|
+
return this;
|
|
4236
|
+
}
|
|
4237
|
+
|
|
4238
|
+
getMutationHistory() {
|
|
4239
|
+
return this.mutationHistory;
|
|
4240
|
+
}
|
|
4241
|
+
|
|
4242
|
+
enableStreaming() {
|
|
4243
|
+
this.streamingEnabled = true;
|
|
4244
|
+
return this;
|
|
4245
|
+
}
|
|
4246
|
+
|
|
4247
|
+
disableStreaming() {
|
|
4248
|
+
this.streamingEnabled = false;
|
|
4249
|
+
return this;
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
const watch=(UIElement,options={},callback=null)=>{
|
|
4254
|
+
const Observer= new ZikoMutationObserver(UIElement,options);
|
|
4255
|
+
if(callback)Observer.observe(callback);
|
|
4256
|
+
return Observer
|
|
4257
|
+
};
|
|
4258
|
+
const watchAttr = (UIElement, callback = null) => {
|
|
4259
|
+
const options = { attributes: true, childList: false, subtree: false };
|
|
4260
|
+
return watch(UIElement, options, ([e])=>callback(e));
|
|
4261
|
+
};
|
|
4262
|
+
|
|
4263
|
+
const watchChildren = (UIElement, callback = null) => {
|
|
4264
|
+
const options = { attributes: false, childList: true, subtree: false };
|
|
4265
|
+
return watch(UIElement, options, ([e])=>callback(e));
|
|
4266
|
+
};
|
|
4170
4267
|
|
|
4171
4268
|
class ZikoResizeObserver{
|
|
4172
4269
|
constructor(UIElement,callback){
|
|
@@ -4213,601 +4310,1103 @@ class ZikoResizeObserver{
|
|
|
4213
4310
|
}
|
|
4214
4311
|
}
|
|
4215
4312
|
|
|
4216
|
-
const
|
|
4313
|
+
const watchSize=(UI,callback)=>new ZikoResizeObserver(UI,callback);
|
|
4217
4314
|
|
|
4218
|
-
class
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4315
|
+
class ZikoTimeLoop {
|
|
4316
|
+
constructor(callback, {fps,step,t=[0,null],start=true}={}) {
|
|
4317
|
+
this.callback = callback;
|
|
4318
|
+
this.cache = {
|
|
4319
|
+
isRunning: false,
|
|
4320
|
+
AnimationId : null,
|
|
4321
|
+
startTime : null,
|
|
4322
|
+
step,
|
|
4323
|
+
fps,
|
|
4324
|
+
t,
|
|
4325
|
+
started:start
|
|
4326
|
+
};
|
|
4327
|
+
this.adjust();
|
|
4328
|
+
this.i=0;
|
|
4329
|
+
}
|
|
4330
|
+
adjust(){
|
|
4331
|
+
if(this.cache.step && this.cache.fps){
|
|
4332
|
+
console.warn(`Fps will be adjusted from ${this.cache.fps} to ${1000/this.cache.step} to ensure a smoother animation`);
|
|
4333
|
+
this.cache.fps=1000/this.cache.step;
|
|
4234
4334
|
}
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4335
|
+
if(this.cache.started){
|
|
4336
|
+
const t=this.cache.t;
|
|
4337
|
+
t[0]?this.startAfter(t[0]):this.start();
|
|
4338
|
+
if(t[1]&&t[1]!==Infinity)this.stopAfter(t[1]);
|
|
4239
4339
|
}
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4340
|
+
return this;
|
|
4341
|
+
}
|
|
4342
|
+
get TIME_STEP() {
|
|
4343
|
+
return this.cache.step?this.cache.step:1000 / this.cache.fps;
|
|
4344
|
+
}
|
|
4345
|
+
start() {
|
|
4346
|
+
if (!this.cache.isRunning) {
|
|
4347
|
+
this.i=0;
|
|
4348
|
+
this.cache.isRunning = true;
|
|
4349
|
+
this.cache.startTime = Date.now();
|
|
4350
|
+
this.animate();
|
|
4248
4351
|
}
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4352
|
+
return this;
|
|
4353
|
+
}
|
|
4354
|
+
pause() {
|
|
4355
|
+
if (this.cache.isRunning) {
|
|
4356
|
+
clearTimeout(this.cache.AnimationId);
|
|
4357
|
+
this.cache.isRunning = false;
|
|
4255
4358
|
}
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4359
|
+
return this;
|
|
4360
|
+
}
|
|
4361
|
+
stop(){
|
|
4362
|
+
this.pause();
|
|
4363
|
+
this.i=0;
|
|
4364
|
+
return this;
|
|
4365
|
+
}
|
|
4366
|
+
resume(){
|
|
4367
|
+
this.cache.isRunning=true;
|
|
4368
|
+
this.animate();
|
|
4369
|
+
return this;
|
|
4370
|
+
}
|
|
4371
|
+
startAfter(t=1000){
|
|
4372
|
+
setTimeout(this.start.bind(this),t);
|
|
4373
|
+
return this;
|
|
4374
|
+
}
|
|
4375
|
+
stopAfter(t=1000){
|
|
4376
|
+
setTimeout(this.stop.bind(this),t);
|
|
4377
|
+
return this;
|
|
4378
|
+
}
|
|
4379
|
+
animate = () => {
|
|
4380
|
+
if (this.cache.isRunning) {
|
|
4381
|
+
const now = Date.now();
|
|
4382
|
+
const delta = now - this.cache.startTime;
|
|
4383
|
+
if (delta > this.TIME_STEP) {
|
|
4384
|
+
this.callback(this);
|
|
4385
|
+
this.i++;
|
|
4386
|
+
this.cache.startTime = now - (delta % this.TIME_STEP);
|
|
4260
4387
|
}
|
|
4261
|
-
|
|
4262
|
-
}
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
if(style instanceof Object)this.#useStyleObject(style);
|
|
4267
|
-
return this;
|
|
4268
|
-
}
|
|
4269
|
-
}
|
|
4270
|
-
const useStyle=id=>style=>new ZikoUseStyle(style,id);
|
|
4388
|
+
this.cache.AnimationId = setTimeout(this.animate, 0);
|
|
4389
|
+
} }
|
|
4390
|
+
}
|
|
4391
|
+
|
|
4392
|
+
const loop = (callback, options) => new ZikoTimeLoop(callback, options);
|
|
4271
4393
|
|
|
4272
|
-
const
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
currentLine: "#F8BBD0",
|
|
4276
|
-
selection: "#FFCDD2",
|
|
4277
|
-
foreground: "#673AB7",
|
|
4278
|
-
comment: "#9575CD",
|
|
4279
|
-
cyan: "#00BCD4",
|
|
4280
|
-
green: "#4CAF50",
|
|
4281
|
-
orange: "#FF9800",
|
|
4282
|
-
pink: "#E91E63",
|
|
4283
|
-
purple: "#9C27B0",
|
|
4284
|
-
red: "#F44336",
|
|
4285
|
-
yellow: "#FFEB3B"
|
|
4394
|
+
const Ease={
|
|
4395
|
+
Linear:function(t){
|
|
4396
|
+
return t;
|
|
4286
4397
|
},
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
currentLine: "#E8F0F5",
|
|
4290
|
-
selection: "#D4E9F7",
|
|
4291
|
-
foreground: "#485766",
|
|
4292
|
-
comment: "#8492A6",
|
|
4293
|
-
cyan: "#00ACC1",
|
|
4294
|
-
green: "#8BC34A",
|
|
4295
|
-
orange: "#FFA726",
|
|
4296
|
-
pink: "#FF4081",
|
|
4297
|
-
purple: "#7E57C2",
|
|
4298
|
-
red: "#EF5350",
|
|
4299
|
-
yellow: "#FFD740"
|
|
4398
|
+
InSin(t){
|
|
4399
|
+
return 1 - Math.cos((t * Math.PI) / 2);
|
|
4300
4400
|
},
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
currentLine: "#E8E8E8",
|
|
4304
|
-
selection: "#DADADA",
|
|
4305
|
-
foreground: "#555555",
|
|
4306
|
-
comment: "#999999",
|
|
4307
|
-
cyan: "#5FB3B3",
|
|
4308
|
-
green: "#68C386",
|
|
4309
|
-
orange: "#FFB67A",
|
|
4310
|
-
pink: "#FF94B0",
|
|
4311
|
-
purple: "#B78BC3",
|
|
4312
|
-
red: "#FF6666",
|
|
4313
|
-
yellow: "#FFD666"
|
|
4401
|
+
OutSin(t){
|
|
4402
|
+
return Math.sin((t * Math.PI) / 2);
|
|
4314
4403
|
},
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
currentLine: "#E1BEE7",
|
|
4318
|
-
selection: "#CE93D8",
|
|
4319
|
-
foreground: "#311B92",
|
|
4320
|
-
comment: "#673AB7",
|
|
4321
|
-
cyan: "#00BCD4",
|
|
4322
|
-
green: "#8BC34A",
|
|
4323
|
-
orange: "#FF9800",
|
|
4324
|
-
pink: "#E91E63",
|
|
4325
|
-
purple: "#9C27B0",
|
|
4326
|
-
red: "#F44336",
|
|
4327
|
-
yellow: "#FFEB3B"
|
|
4404
|
+
InOutSin(t){
|
|
4405
|
+
return -(Math.cos(Math.PI * t) - 1) / 2;
|
|
4328
4406
|
},
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
currentLine: "#E1BEE7",
|
|
4332
|
-
selection: "#CE93D8",
|
|
4333
|
-
foreground: "#311B92",
|
|
4334
|
-
comment: "#673AB7",
|
|
4335
|
-
cyan: "#00BCD4",
|
|
4336
|
-
green: "#8BC34A",
|
|
4337
|
-
orange: "#FF9800",
|
|
4338
|
-
pink: "#E91E63",
|
|
4339
|
-
purple: "#9C27B0",
|
|
4340
|
-
red: "#F44336",
|
|
4341
|
-
yellow: "#FFEB3B"
|
|
4407
|
+
InQuad(t){
|
|
4408
|
+
return t**2;
|
|
4342
4409
|
},
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
currentLine: "#E1BEE7",
|
|
4346
|
-
selection: "#CE93D8",
|
|
4347
|
-
foreground: "#311B92",
|
|
4348
|
-
comment: "#673AB7",
|
|
4349
|
-
cyan: "#00BCD4",
|
|
4350
|
-
green: "#8BC34A",
|
|
4351
|
-
orange: "#FF9800",
|
|
4352
|
-
pink: "#E91E63",
|
|
4353
|
-
purple: "#9C27B0",
|
|
4354
|
-
red: "#F44336",
|
|
4355
|
-
yellow: "#FFEB3B"
|
|
4410
|
+
OutQuad(t){
|
|
4411
|
+
return 1 - Math.pow((1 - t),2)
|
|
4356
4412
|
},
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
currentLine: "#EAEAEA",
|
|
4360
|
-
selection: "#D8D8D8",
|
|
4361
|
-
foreground: "#333333",
|
|
4362
|
-
comment: "#808080",
|
|
4363
|
-
cyan: "#00A6A6",
|
|
4364
|
-
green: "#4CAF50",
|
|
4365
|
-
orange: "#FFA726",
|
|
4366
|
-
pink: "#FF4081",
|
|
4367
|
-
purple: "#9C27B0",
|
|
4368
|
-
red: "#FF5252",
|
|
4369
|
-
yellow: "#FFD740"
|
|
4413
|
+
InOutQuad(t){
|
|
4414
|
+
return t < 0.5 ? 2 * Math.pow(t,2) : 1 - Math.pow(-2 * t + 2, 2) / 2;
|
|
4370
4415
|
},
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
currentLine: "#DDE8ED",
|
|
4374
|
-
selection: "#BFD3C1",
|
|
4375
|
-
foreground: "#37474F",
|
|
4376
|
-
comment: "#607D8B",
|
|
4377
|
-
cyan: "#00BCD4",
|
|
4378
|
-
green: "#8BC34A",
|
|
4379
|
-
orange: "#FF9800",
|
|
4380
|
-
pink: "#E91E63",
|
|
4381
|
-
purple: "#673AB7",
|
|
4382
|
-
red: "#F44336",
|
|
4383
|
-
yellow: "#FFEB3B"
|
|
4416
|
+
InCubic(t){
|
|
4417
|
+
return t**3;
|
|
4384
4418
|
},
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
currentLine: "#E8E8E8",
|
|
4388
|
-
selection: "#DADADA",
|
|
4389
|
-
foreground: "#555555",
|
|
4390
|
-
comment: "#999999",
|
|
4391
|
-
cyan: "#5FB3B3",
|
|
4392
|
-
green: "#68C386",
|
|
4393
|
-
orange: "#FFB67A",
|
|
4394
|
-
pink: "#FF94B0",
|
|
4395
|
-
purple: "#B78BC3",
|
|
4396
|
-
red: "#FF6666",
|
|
4397
|
-
yellow: "#FFD666"
|
|
4419
|
+
OutCubic(t){
|
|
4420
|
+
return 1 - Math.pow((1 - t),3)
|
|
4398
4421
|
},
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
currentLine: "#F8BBD0",
|
|
4402
|
-
selection: "#FFCDD2",
|
|
4403
|
-
foreground: "#673AB7",
|
|
4404
|
-
comment: "#9575CD",
|
|
4405
|
-
cyan: "#00BCD4",
|
|
4406
|
-
green: "#4CAF50",
|
|
4407
|
-
orange: "#FF9800",
|
|
4408
|
-
pink: "#E91E63",
|
|
4409
|
-
purple: "#9C27B0",
|
|
4410
|
-
red: "#F44336",
|
|
4411
|
-
yellow: "#FFEB3B"
|
|
4422
|
+
InOutCubic(t){
|
|
4423
|
+
return t < 0.5 ? 4 * Math.pow(t,3) : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
4412
4424
|
},
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
currentLine: "#EDEDED",
|
|
4416
|
-
selection: "#D8D8D8",
|
|
4417
|
-
foreground: "#454545",
|
|
4418
|
-
comment: "#888888",
|
|
4419
|
-
cyan: "#5FA5A5",
|
|
4420
|
-
green: "#5BC47E",
|
|
4421
|
-
orange: "#FFBC8D",
|
|
4422
|
-
pink: "#FFA7BF",
|
|
4423
|
-
purple: "#B88AAE",
|
|
4424
|
-
red: "#FF7575",
|
|
4425
|
-
yellow: "#FFD98F"
|
|
4425
|
+
InQuart(t){
|
|
4426
|
+
return t**4;
|
|
4426
4427
|
},
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
currentLine: "#FAF1EB",
|
|
4430
|
-
selection: "#FFEBEE",
|
|
4431
|
-
foreground: "#6D4C41",
|
|
4432
|
-
comment: "#A1887F",
|
|
4433
|
-
cyan: "#00BCD4",
|
|
4434
|
-
green: "#689F38",
|
|
4435
|
-
orange: "#FFA000",
|
|
4436
|
-
pink: "#EC407A",
|
|
4437
|
-
purple: "#8E24AA",
|
|
4438
|
-
red: "#E53935",
|
|
4439
|
-
yellow: "#FFC107"
|
|
4428
|
+
OutQuart(t){
|
|
4429
|
+
return 1 - Math.pow((1 - t),4);
|
|
4440
4430
|
},
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
currentLine: "#E8EDF2",
|
|
4444
|
-
selection: "#D1D9E6",
|
|
4445
|
-
foreground: "#2C3E50",
|
|
4446
|
-
comment: "#95A5A6",
|
|
4447
|
-
cyan: "#3498DB",
|
|
4448
|
-
green: "#2ECC71",
|
|
4449
|
-
orange: "#F39C12",
|
|
4450
|
-
pink: "#E74C3C",
|
|
4451
|
-
purple: "#9B59B6",
|
|
4452
|
-
red: "#C0392B",
|
|
4453
|
-
yellow: "#F1C40F"
|
|
4431
|
+
InOutQuart(t){
|
|
4432
|
+
return t < 0.5 ? 8 * Math.pow(t,4) : 1 - Math.pow(-2 * t + 2, 4) / 2;
|
|
4454
4433
|
},
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
currentLine: "#F8BBD0",
|
|
4458
|
-
selection: "#FFCDD2",
|
|
4459
|
-
foreground: "#4E342E",
|
|
4460
|
-
comment: "#795548",
|
|
4461
|
-
cyan: "#009688",
|
|
4462
|
-
green: "#43A047",
|
|
4463
|
-
orange: "#FF5722",
|
|
4464
|
-
pink: "#E91E63",
|
|
4465
|
-
purple: "#9C27B0",
|
|
4466
|
-
red: "#F44336",
|
|
4467
|
-
yellow: "#FFEB3B"
|
|
4434
|
+
InQuint(t){
|
|
4435
|
+
return t**5;
|
|
4468
4436
|
},
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
currentLine: "#FFF3E0",
|
|
4472
|
-
selection: "#FFE0B2",
|
|
4473
|
-
foreground: "#4E342E",
|
|
4474
|
-
comment: "#795548",
|
|
4475
|
-
cyan: "#00BCD4",
|
|
4476
|
-
green: "#8BC34A",
|
|
4477
|
-
orange: "#FF9800",
|
|
4478
|
-
pink: "#E91E63",
|
|
4479
|
-
purple: "#673AB7",
|
|
4480
|
-
red: "#F44336",
|
|
4481
|
-
yellow: "#FFEB3B"
|
|
4437
|
+
OutQuint(t){
|
|
4438
|
+
return 1 - Math.pow((1 - t),5);
|
|
4482
4439
|
},
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
currentLine: "#EDEDED",
|
|
4486
|
-
selection: "#D8D8D8",
|
|
4487
|
-
foreground: "#454545",
|
|
4488
|
-
comment: "#888888",
|
|
4489
|
-
cyan: "#5FA5A5",
|
|
4490
|
-
green: "#5BC47E",
|
|
4491
|
-
orange: "#FFBC8D",
|
|
4492
|
-
pink: "#FFA7BF",
|
|
4493
|
-
purple: "#B88AAE",
|
|
4494
|
-
red: "#FF7575",
|
|
4495
|
-
yellow: "#FFD98F"
|
|
4440
|
+
InOutQuint(t){
|
|
4441
|
+
return t < 0.5 ? 16 * Math.pow(t,5) : 1 - Math.pow(-2 * t + 2, 5) / 2;
|
|
4496
4442
|
},
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
currentLine: "#E4E4E4",
|
|
4500
|
-
selection: "#D4D4D4",
|
|
4501
|
-
foreground: "#2C3E50",
|
|
4502
|
-
comment: "#7F8C8D",
|
|
4503
|
-
cyan: "#3498DB",
|
|
4504
|
-
green: "#2ECC71",
|
|
4505
|
-
orange: "#F39C12",
|
|
4506
|
-
pink: "#E74C3C",
|
|
4507
|
-
purple: "#9B59B6",
|
|
4508
|
-
red: "#C0392B",
|
|
4509
|
-
yellow: "#F1C40F"
|
|
4443
|
+
InExpo(t){
|
|
4444
|
+
return t === 0 ? 0 : Math.pow(2, 10 * t - 10);
|
|
4510
4445
|
},
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
currentLine: "#E8F0F5",
|
|
4514
|
-
selection: "#D4E9F7",
|
|
4515
|
-
foreground: "#485766",
|
|
4516
|
-
comment: "#8492A6",
|
|
4517
|
-
cyan: "#00ACC1",
|
|
4518
|
-
green: "#8BC34A",
|
|
4519
|
-
orange: "#FFA726",
|
|
4520
|
-
pink: "#FF4081",
|
|
4521
|
-
purple: "#7E57C2",
|
|
4522
|
-
red: "#EF5350",
|
|
4523
|
-
yellow: "#FFD740"
|
|
4524
|
-
}
|
|
4525
|
-
};
|
|
4526
|
-
|
|
4527
|
-
const DarkThemes = {
|
|
4528
|
-
antiqueRose: {
|
|
4529
|
-
background: "#1C1014",
|
|
4530
|
-
currentLine: "#2B1B21",
|
|
4531
|
-
selection: "#443034",
|
|
4532
|
-
foreground: "#D8B5B5",
|
|
4533
|
-
comment: "#7F5E5E",
|
|
4534
|
-
cyan: "#6FA2A2",
|
|
4535
|
-
green: "#66A66F",
|
|
4536
|
-
orange: "#FFB97A",
|
|
4537
|
-
pink: "#FFA8BD",
|
|
4538
|
-
purple: "#B78DA5",
|
|
4539
|
-
red: "#FF6C6C",
|
|
4540
|
-
yellow: "#FFD579"
|
|
4446
|
+
OutExpo(t){
|
|
4447
|
+
return t === 1 ? 1 : 1 - Math.pow(2, -10 * t);
|
|
4541
4448
|
},
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
currentLine: "#2B1E35",
|
|
4545
|
-
selection: "#432D4E",
|
|
4546
|
-
foreground: "#C2AABF",
|
|
4547
|
-
comment: "#7F6E8E",
|
|
4548
|
-
cyan: "#7EA5D3",
|
|
4549
|
-
green: "#77C992",
|
|
4550
|
-
orange: "#FFC476",
|
|
4551
|
-
pink: "#FFA8B3",
|
|
4552
|
-
purple: "#AE9AC3",
|
|
4553
|
-
red: "#FF6C6C",
|
|
4554
|
-
yellow: "#FFD576"
|
|
4449
|
+
InOutExpo(t){
|
|
4450
|
+
return t === 0? 0: t === 1? 1: t < 0.5 ? Math.pow(2, 20 * t - 10) / 2: (2 - Math.pow(2, -20 * t + 10)) / 2;
|
|
4555
4451
|
},
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
currentLine: "#3A2A1E",
|
|
4559
|
-
selection: "#573C2C",
|
|
4560
|
-
foreground: "#D4C3A2",
|
|
4561
|
-
comment: "#7F6F52",
|
|
4562
|
-
cyan: "#82B4BF",
|
|
4563
|
-
green: "#7FB074",
|
|
4564
|
-
orange: "#FFAB6E",
|
|
4565
|
-
pink: "#FF8196",
|
|
4566
|
-
purple: "#B394A9",
|
|
4567
|
-
red: "#FF6565",
|
|
4568
|
-
yellow: "#FFD270"
|
|
4452
|
+
InCirc(t){
|
|
4453
|
+
return 1 - Math.sqrt(1 - Math.pow(t, 2));
|
|
4569
4454
|
},
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
currentLine: "#161A28",
|
|
4573
|
-
selection: "#222B3E",
|
|
4574
|
-
foreground: "#D2D8E0",
|
|
4575
|
-
comment: "#697098",
|
|
4576
|
-
cyan: "#78D1E1",
|
|
4577
|
-
green: "#98C379",
|
|
4578
|
-
orange: "#EBCB8B",
|
|
4579
|
-
pink: "#D16D9E",
|
|
4580
|
-
purple: "#C678DD",
|
|
4581
|
-
red: "#E88388",
|
|
4582
|
-
yellow: "#EBCB8B"
|
|
4455
|
+
OutCirc(t){
|
|
4456
|
+
return Math.sqrt(1 - Math.pow(t - 1, 2));
|
|
4583
4457
|
},
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
currentLine: "#002C3E",
|
|
4587
|
-
selection: "#004E6B",
|
|
4588
|
-
foreground: "#C3D7E2",
|
|
4589
|
-
comment: "#5F7C92",
|
|
4590
|
-
cyan: "#75B7D1",
|
|
4591
|
-
green: "#70C8A7",
|
|
4592
|
-
orange: "#FFB476",
|
|
4593
|
-
pink: "#FF92B0",
|
|
4594
|
-
purple: "#B88BC3",
|
|
4595
|
-
red: "#FF6666",
|
|
4596
|
-
yellow: "#FFD666"
|
|
4458
|
+
InOutCic(t){
|
|
4459
|
+
return t < 0.5? (1 - Math.sqrt(1 - Math.pow(2 * t, 2))) / 2: (Math.sqrt(1 - Math.pow(-2 * t + 2, 2)) + 1) / 2;
|
|
4597
4460
|
},
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
currentLine: "#1F4662",
|
|
4601
|
-
selection: "#193549",
|
|
4602
|
-
foreground: "#B9BED0",
|
|
4603
|
-
comment: "#627D98",
|
|
4604
|
-
cyan: "#4DB5BD",
|
|
4605
|
-
green: "#86B300",
|
|
4606
|
-
orange: "#FFB86C",
|
|
4607
|
-
pink: "#FF7F7B",
|
|
4608
|
-
purple: "#9B64FB",
|
|
4609
|
-
red: "#FF6672",
|
|
4610
|
-
yellow: "#FFCC99"
|
|
4611
|
-
},
|
|
4612
|
-
cobaltMaterialTheme: {
|
|
4613
|
-
background: "#263238",
|
|
4614
|
-
currentLine: "#37474F",
|
|
4615
|
-
selection: "#80CBC4",
|
|
4616
|
-
foreground: "#CFD8DC",
|
|
4617
|
-
comment: "#78909C",
|
|
4618
|
-
cyan: "#80CBC4",
|
|
4619
|
-
green: "#A5D6A7",
|
|
4620
|
-
orange: "#FFD54F",
|
|
4621
|
-
pink: "#FF80AB",
|
|
4622
|
-
purple: "#CE93D8",
|
|
4623
|
-
red: "#EF5350",
|
|
4624
|
-
yellow: "#FFEE58"
|
|
4625
|
-
},
|
|
4626
|
-
cosmicBlue: {
|
|
4627
|
-
background: "#1B2836",
|
|
4628
|
-
currentLine: "#223348",
|
|
4629
|
-
selection: "#39516D",
|
|
4630
|
-
foreground: "#C0D4E5",
|
|
4631
|
-
comment: "#728CAB",
|
|
4632
|
-
cyan: "#75A6FF",
|
|
4633
|
-
green: "#5ED99F",
|
|
4634
|
-
orange: "#FFAD6F",
|
|
4635
|
-
pink: "#FF90B6",
|
|
4636
|
-
purple: "#A889C5",
|
|
4637
|
-
red: "#FF6E6E",
|
|
4638
|
-
yellow: "#FCD256"
|
|
4639
|
-
},
|
|
4640
|
-
cosmicSunset: {
|
|
4641
|
-
background: "#1B1921",
|
|
4642
|
-
currentLine: "#272530",
|
|
4643
|
-
selection: "#3C3948",
|
|
4644
|
-
foreground: "#B8B4CB",
|
|
4645
|
-
comment: "#7A738B",
|
|
4646
|
-
cyan: "#77B4D8",
|
|
4647
|
-
green: "#6CC09E",
|
|
4648
|
-
orange: "#FFA677",
|
|
4649
|
-
pink: "#FF95B2",
|
|
4650
|
-
purple: "#B48FC1",
|
|
4651
|
-
red: "#FF6565",
|
|
4652
|
-
yellow: "#FFD566"
|
|
4653
|
-
},
|
|
4654
|
-
cyberForest: {
|
|
4655
|
-
background: "#0D151D",
|
|
4656
|
-
currentLine: "#18262F",
|
|
4657
|
-
selection: "#2B3B47",
|
|
4658
|
-
foreground: "#CDD7E0",
|
|
4659
|
-
comment: "#667B8B",
|
|
4660
|
-
cyan: "#7EC4CF",
|
|
4661
|
-
green: "#68CC96",
|
|
4662
|
-
orange: "#FFAC6C",
|
|
4663
|
-
pink: "#FF89B4",
|
|
4664
|
-
purple: "#A889C5",
|
|
4665
|
-
red: "#FF6565",
|
|
4666
|
-
yellow: "#FFCB6B"
|
|
4461
|
+
Arc(t){
|
|
4462
|
+
return 1 - Math.sin(Math.acos(t));
|
|
4667
4463
|
},
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
foreground: "#DADADA",
|
|
4673
|
-
comment: "#626262",
|
|
4674
|
-
cyan: "#71B7FF",
|
|
4675
|
-
green: "#50D890",
|
|
4676
|
-
orange: "#FFB86C",
|
|
4677
|
-
pink: "#FF79C6",
|
|
4678
|
-
purple: "#BB86FC",
|
|
4679
|
-
red: "#FF5454",
|
|
4680
|
-
yellow: "#FDD663"
|
|
4464
|
+
Back(t){
|
|
4465
|
+
// To Be Changed
|
|
4466
|
+
let x=1;
|
|
4467
|
+
return Math.pow(t, 2) * ((x + 1) * t - x);
|
|
4681
4468
|
},
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
currentLine: "#1B1B1B",
|
|
4685
|
-
selection: "#262626",
|
|
4686
|
-
foreground: "#DADADA",
|
|
4687
|
-
comment: "#6C6C6C",
|
|
4688
|
-
cyan: "#69AEDB",
|
|
4689
|
-
green: "#4ECCA3",
|
|
4690
|
-
orange: "#FFB86C",
|
|
4691
|
-
pink: "#FF79C6",
|
|
4692
|
-
purple: "#D08EFF",
|
|
4693
|
-
red: "#FF5454",
|
|
4694
|
-
yellow: "#FDD663"
|
|
4469
|
+
Elastic(t){
|
|
4470
|
+
return -2*Math.pow(2, 10 * (t - 1)) * Math.cos(20 * Math.PI * t / 3 * t);
|
|
4695
4471
|
},
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
foreground: "#C0C5CE",
|
|
4701
|
-
comment: "#5C6368",
|
|
4702
|
-
cyan: "#6FB3E0",
|
|
4703
|
-
green: "#88C076",
|
|
4704
|
-
orange: "#FFB454",
|
|
4705
|
-
pink: "#FF7F90",
|
|
4706
|
-
purple: "#B48EAD",
|
|
4707
|
-
red: "#FF6666",
|
|
4708
|
-
yellow: "#FFCC66"
|
|
4472
|
+
InBack(t){
|
|
4473
|
+
const c1 = 1.70158;
|
|
4474
|
+
const c3 = c1 + 1;
|
|
4475
|
+
return c3 *Math.pow(t,3)- c1 * (t**2);
|
|
4709
4476
|
},
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
foreground: "#D9DEE5",
|
|
4715
|
-
comment: "#65737E",
|
|
4716
|
-
cyan: "#88C0D0",
|
|
4717
|
-
green: "#98C379",
|
|
4718
|
-
orange: "#FFB86C",
|
|
4719
|
-
pink: "#FF7F8B",
|
|
4720
|
-
purple: "#C594C5",
|
|
4721
|
-
red: "#FF6561",
|
|
4722
|
-
yellow: "#FAD07B"
|
|
4477
|
+
OutBack(t){
|
|
4478
|
+
const c1 = 1.70158;
|
|
4479
|
+
const c3 = c1 + 1;
|
|
4480
|
+
return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
|
|
4723
4481
|
},
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
cyan: "#59ABE3",
|
|
4731
|
-
green: "#26A65B",
|
|
4732
|
-
orange: "#F9690E",
|
|
4733
|
-
pink: "#EB3B5A",
|
|
4734
|
-
purple: "#D2527F",
|
|
4735
|
-
red: "#E74C3C",
|
|
4736
|
-
yellow: "#F5AB35"
|
|
4482
|
+
InOutBack(t){
|
|
4483
|
+
const c1 = 1.70158;
|
|
4484
|
+
const c2 = c1 * 1.525;
|
|
4485
|
+
return t < 0.5
|
|
4486
|
+
? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
|
|
4487
|
+
: (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
|
|
4737
4488
|
},
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
cyan: "#6CB5FF",
|
|
4745
|
-
green: "#65C287",
|
|
4746
|
-
orange: "#FFA974",
|
|
4747
|
-
pink: "#FF87B4",
|
|
4748
|
-
purple: "#AE9BFF",
|
|
4749
|
-
red: "#FF6666",
|
|
4750
|
-
yellow: "#FFD67B"
|
|
4489
|
+
InElastic(t){
|
|
4490
|
+
const c4 = (2 * Math.PI) / 3;return t === 0
|
|
4491
|
+
? 0
|
|
4492
|
+
: t === 1
|
|
4493
|
+
? 1
|
|
4494
|
+
: -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);
|
|
4751
4495
|
},
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
green: "#66C295",
|
|
4760
|
-
orange: "#FFA476",
|
|
4761
|
-
pink: "#FF94B0",
|
|
4762
|
-
purple: "#B08FC0",
|
|
4763
|
-
red: "#FF6565",
|
|
4764
|
-
yellow: "#FFD466"
|
|
4496
|
+
OutElastic(t){
|
|
4497
|
+
const c4 = (2 * Math.PI) / 3;
|
|
4498
|
+
return t === 0
|
|
4499
|
+
? 0
|
|
4500
|
+
: t === 1
|
|
4501
|
+
? 1
|
|
4502
|
+
: Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
|
|
4765
4503
|
},
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
pink: "#FF75B5",
|
|
4776
|
-
purple: "#9A76FF",
|
|
4777
|
-
red: "#FF5555",
|
|
4778
|
-
yellow: "#FFC857"
|
|
4504
|
+
InOutElastic(t){
|
|
4505
|
+
const c5 = (2 * Math.PI) / 4.5;
|
|
4506
|
+
return t === 0
|
|
4507
|
+
? 0
|
|
4508
|
+
: t === 1
|
|
4509
|
+
? 1
|
|
4510
|
+
: t < 0.5
|
|
4511
|
+
? -(Math.pow(2, 20 * t - 10) * Math.sin((20 * t - 11.125) * c5)) / 2
|
|
4512
|
+
: (Math.pow(2, -20 * t + 10) * Math.sin((20 * t - 11.125) * c5)) / 2 + 1;
|
|
4779
4513
|
},
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
currentLine: "#44475a",
|
|
4783
|
-
selection: "#44475a",
|
|
4784
|
-
foreground: "#f8f8f2",
|
|
4785
|
-
comment: "#6272a4",
|
|
4786
|
-
cyan: "#8be9fd",
|
|
4787
|
-
green: "#50fa7b",
|
|
4788
|
-
orange: "#ffb86c",
|
|
4789
|
-
pink: "#ff79c6",
|
|
4790
|
-
purple: "#bd93f9",
|
|
4791
|
-
red: "#ff5555",
|
|
4792
|
-
yellow: "#f1fa8c"
|
|
4514
|
+
InBounce(t){
|
|
4515
|
+
return 1 - Ease.OutBounce(1-t);
|
|
4793
4516
|
},
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4517
|
+
OutBounce(t){
|
|
4518
|
+
const n1 = 7.5625;
|
|
4519
|
+
const d1 = 2.75;
|
|
4520
|
+
if (t < 1 / d1) {
|
|
4521
|
+
return n1 * t * t;
|
|
4522
|
+
} else if (t < 2 / d1) {
|
|
4523
|
+
return n1 * (t -= 1.5 / d1) * t + 0.75;
|
|
4524
|
+
} else if (t < 2.5 / d1) {
|
|
4525
|
+
return n1 * (t -= 2.25 / d1) * t + 0.9375;
|
|
4526
|
+
} else {
|
|
4527
|
+
return n1 * (t -= 2.625 / d1) * t + 0.984375;
|
|
4528
|
+
}
|
|
4529
|
+
|
|
4807
4530
|
},
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4531
|
+
InOutBounce(t){
|
|
4532
|
+
return t < 0.5
|
|
4533
|
+
? (1 - Ease.OutBounce(1 - 2 * t)) / 2
|
|
4534
|
+
: (1 + Ease.OutBounce(2 * t - 1)) / 2;
|
|
4535
|
+
}
|
|
4536
|
+
};
|
|
4537
|
+
|
|
4538
|
+
const useDebounce=(fn,delay=1000)=>{
|
|
4539
|
+
let id;
|
|
4540
|
+
return (...args)=>id?clearTimeout(id):setTimeout(()=>fn(...args),delay)
|
|
4541
|
+
};
|
|
4542
|
+
const useThrottle=(fn,delay)=>{
|
|
4543
|
+
let lastTime=0;
|
|
4544
|
+
return (...args)=>{
|
|
4545
|
+
const now=new Date().getTime();
|
|
4546
|
+
if(now-lastTime<delay)return;
|
|
4547
|
+
lastTime=now;
|
|
4548
|
+
fn(...args);
|
|
4549
|
+
}
|
|
4550
|
+
};
|
|
4551
|
+
|
|
4552
|
+
const time_memory_Taken = (callback) => {
|
|
4553
|
+
const t0 = Date.now();
|
|
4554
|
+
const m0 = performance.memory.usedJSHeapSize;
|
|
4555
|
+
const result = callback();
|
|
4556
|
+
const t1 = Date.now();
|
|
4557
|
+
const m1 = performance.memory.usedJSHeapSize;
|
|
4558
|
+
const elapsedTime = t1 - t0;
|
|
4559
|
+
const usedMemory = m1 - m0;
|
|
4560
|
+
return {
|
|
4561
|
+
elapsedTime,
|
|
4562
|
+
usedMemory,
|
|
4563
|
+
result
|
|
4564
|
+
};
|
|
4565
|
+
};
|
|
4566
|
+
|
|
4567
|
+
const waitForUIElm=(UIElement)=>{
|
|
4568
|
+
return new Promise(resolve => {
|
|
4569
|
+
if (UIElement.element) {
|
|
4570
|
+
return resolve(UIElement.element);
|
|
4571
|
+
}
|
|
4572
|
+
|
|
4573
|
+
const observer = new MutationObserver(() => {
|
|
4574
|
+
if (UIElement.element) {
|
|
4575
|
+
resolve(UIElement.element);
|
|
4576
|
+
observer.disconnect();
|
|
4577
|
+
}
|
|
4578
|
+
});
|
|
4579
|
+
|
|
4580
|
+
observer.observe(document.body, {
|
|
4581
|
+
childList: true,
|
|
4582
|
+
subtree: true
|
|
4583
|
+
});
|
|
4584
|
+
});
|
|
4585
|
+
};
|
|
4586
|
+
const waitForUIElmSync=(UIElement,timeout=2000)=>{
|
|
4587
|
+
const t0=Date.now();
|
|
4588
|
+
while(Date.now()-t0<timeout){
|
|
4589
|
+
if(UIElement.element)return UIElement.element
|
|
4590
|
+
}
|
|
4591
|
+
};
|
|
4592
|
+
|
|
4593
|
+
const wait=(delayInMS)=>{
|
|
4594
|
+
return new Promise((resolve) => setTimeout(resolve, delayInMS));
|
|
4595
|
+
};
|
|
4596
|
+
const timeTaken = callback => {
|
|
4597
|
+
console.time('timeTaken');
|
|
4598
|
+
const r = callback();
|
|
4599
|
+
console.timeEnd('timeTaken');
|
|
4600
|
+
return r;
|
|
4601
|
+
};
|
|
4602
|
+
|
|
4603
|
+
class ZikoTimeAnimation{
|
|
4604
|
+
constructor(callback,{ease=Ease.Linear,step=50,t=[0,null],start=true,duration=3000}={}){
|
|
4605
|
+
this.cache={
|
|
4606
|
+
isRunning:false,
|
|
4607
|
+
AnimationId:null,
|
|
4608
|
+
startTime:null,
|
|
4609
|
+
ease,
|
|
4610
|
+
step,
|
|
4611
|
+
intervall:t,
|
|
4612
|
+
started:start,
|
|
4613
|
+
duration
|
|
4614
|
+
};
|
|
4615
|
+
this.t=0;
|
|
4616
|
+
this.tx=0;
|
|
4617
|
+
this.ty=0;
|
|
4618
|
+
this.i=0;
|
|
4619
|
+
this.callback=callback;
|
|
4620
|
+
}
|
|
4621
|
+
#animation_handler(){
|
|
4622
|
+
this.t+=this.cache.step;
|
|
4623
|
+
this.i++;
|
|
4624
|
+
this.tx=map(this.t,0,this.cache.duration,0,1);
|
|
4625
|
+
this.ty=this.cache.ease(this.tx);
|
|
4626
|
+
this.callback(this);
|
|
4627
|
+
if(this.t>=this.cache.duration){
|
|
4628
|
+
clearInterval(this.cache.AnimationId);
|
|
4629
|
+
this.cache.isRunning=false;
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4632
|
+
reset(restart=true){
|
|
4633
|
+
this.t=0;
|
|
4634
|
+
this.tx=0;
|
|
4635
|
+
this.ty=0;
|
|
4636
|
+
this.i=0;
|
|
4637
|
+
if(restart)this.start();
|
|
4638
|
+
return this;
|
|
4639
|
+
}
|
|
4640
|
+
#animate(reset=true){
|
|
4641
|
+
if(!this.cache.isRunning){
|
|
4642
|
+
if(reset)this.reset(false);
|
|
4643
|
+
this.cache.isRunning=true;
|
|
4644
|
+
this.cache.startTime = Date.now();
|
|
4645
|
+
this.cache.AnimationId=setInterval(this.#animation_handler.bind(this),this.cache.step);
|
|
4646
|
+
}
|
|
4647
|
+
return this;
|
|
4648
|
+
}
|
|
4649
|
+
start(){
|
|
4650
|
+
this.#animate(true);
|
|
4651
|
+
return this;
|
|
4652
|
+
}
|
|
4653
|
+
pause(){
|
|
4654
|
+
if (this.cache.isRunning) {
|
|
4655
|
+
clearTimeout(this.cache.AnimationId);
|
|
4656
|
+
this.cache.isRunning = false;
|
|
4657
|
+
}
|
|
4658
|
+
return this;
|
|
4659
|
+
}
|
|
4660
|
+
resume(){
|
|
4661
|
+
this.#animate(false);
|
|
4662
|
+
return this;
|
|
4663
|
+
}
|
|
4664
|
+
stop(){
|
|
4665
|
+
this.pause();
|
|
4666
|
+
this.reset(false);
|
|
4667
|
+
return this;
|
|
4668
|
+
}
|
|
4669
|
+
// clear(){
|
|
4670
|
+
// }
|
|
4671
|
+
// stream(){
|
|
4672
|
+
// }
|
|
4673
|
+
}
|
|
4674
|
+
|
|
4675
|
+
const animation=(callback,config)=>new ZikoTimeAnimation(callback,config);
|
|
4676
|
+
|
|
4677
|
+
const Time={
|
|
4678
|
+
wait,
|
|
4679
|
+
timeTaken,
|
|
4680
|
+
useThrottle,
|
|
4681
|
+
useDebounce,
|
|
4682
|
+
Ease,
|
|
4683
|
+
time_memory_Taken,
|
|
4684
|
+
loop,
|
|
4685
|
+
animation,
|
|
4686
|
+
waitForUIElm,
|
|
4687
|
+
waitForUIElmSync,
|
|
4688
|
+
ExtractAll: function () {
|
|
4689
|
+
const keys = Object.keys(this);
|
|
4690
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4691
|
+
const key = keys[i];
|
|
4692
|
+
if (key !== 'ExtractAll' && key !== 'RemoveAll') {
|
|
4693
|
+
globalThis[key] = this[key];
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
return this;
|
|
4697
|
+
},
|
|
4698
|
+
RemoveAll: function () {
|
|
4699
|
+
const keys = Object.keys(this);
|
|
4700
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4701
|
+
const key = keys[i];
|
|
4702
|
+
if (key !== 'RemoveAll') {
|
|
4703
|
+
delete globalThis[key];
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
return this;
|
|
4707
|
+
}
|
|
4708
|
+
};
|
|
4709
|
+
|
|
4710
|
+
class ZikoScreenObserver {
|
|
4711
|
+
constructor(callback=e=>console.log({x:e.x,y:e.y})) {
|
|
4712
|
+
this.previousX = globalThis?.screenX;
|
|
4713
|
+
this.previousY = globalThis?.screenY;
|
|
4714
|
+
this.view=[-1,-1,1,1];
|
|
4715
|
+
this.start(callback);
|
|
4716
|
+
}
|
|
4717
|
+
get xMin(){
|
|
4718
|
+
return this.view[0];
|
|
4719
|
+
}
|
|
4720
|
+
get yMin(){
|
|
4721
|
+
return this.view[1];
|
|
4722
|
+
}
|
|
4723
|
+
get xMax(){
|
|
4724
|
+
return this.view[2];
|
|
4725
|
+
}
|
|
4726
|
+
get yMax(){
|
|
4727
|
+
return this.view[3];
|
|
4728
|
+
}
|
|
4729
|
+
get x(){
|
|
4730
|
+
return globalThis?.screenX;
|
|
4731
|
+
}
|
|
4732
|
+
get y(){
|
|
4733
|
+
return globalThis?.screenY;
|
|
4734
|
+
}
|
|
4735
|
+
get scx(){
|
|
4736
|
+
return screen.availWidth/2;
|
|
4737
|
+
}
|
|
4738
|
+
get scy(){
|
|
4739
|
+
return screen.availHeight/2;
|
|
4740
|
+
}
|
|
4741
|
+
get wcx(){
|
|
4742
|
+
return screenX+globalThis?.innerWidth/2;
|
|
4743
|
+
}
|
|
4744
|
+
get wcx_v(){
|
|
4745
|
+
return map(this.wcx,0,screen.availWidth,this.view[0],this.view[2]);
|
|
4746
|
+
}
|
|
4747
|
+
get wcy(){
|
|
4748
|
+
return screenY+globalThis?.innerHeight/2;
|
|
4749
|
+
}
|
|
4750
|
+
get wcy_v(){
|
|
4751
|
+
return -map(this.wcy,0,screen.availHeight,this.view[1],this.view[3]);
|
|
4752
|
+
}
|
|
4753
|
+
get dx(){
|
|
4754
|
+
return map(this.x,0,screen.availWidth,this.xMin,this.xMax);
|
|
4755
|
+
}
|
|
4756
|
+
get dy(){
|
|
4757
|
+
return map(this.y,0,screen.availHeight,this.yMin,this.yMax);
|
|
4758
|
+
}
|
|
4759
|
+
start(callback){
|
|
4760
|
+
this.loop = loop(()=>{
|
|
4761
|
+
let currentX = globalThis?.screenX;
|
|
4762
|
+
let currentY = globalThis?.screenY;
|
|
4763
|
+
if (this.previousX !== currentX || this.previousY !== currentY) {
|
|
4764
|
+
callback(this);
|
|
4765
|
+
this.previousX = currentX;
|
|
4766
|
+
this.previousY = currentY;
|
|
4767
|
+
}
|
|
4768
|
+
},
|
|
4769
|
+
{fps:10,t:[0,Infinity],start:true});
|
|
4770
|
+
return this;
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
const watchScreen=(callback)=>new ZikoScreenObserver(callback);
|
|
4774
|
+
globalThis.watchScreen=watchScreen;
|
|
4775
|
+
|
|
4776
|
+
/*
|
|
4777
|
+
a=ul("x","y","dx","dy","wcx","wxy")
|
|
4778
|
+
watchScreen(e=>{
|
|
4779
|
+
a[0].setValue("x : "+e.x)
|
|
4780
|
+
a[1].setValue("y : "+e.y)
|
|
4781
|
+
a[2].setValue("dx : "+e.dx)
|
|
4782
|
+
a[3].setValue("dy : "+e.dy)
|
|
4783
|
+
a[4].setValue("wCx : "+e.wcx)
|
|
4784
|
+
a[5].setValue("wCy : "+e.wcy)
|
|
4785
|
+
})
|
|
4786
|
+
*/
|
|
4787
|
+
|
|
4788
|
+
const Observer={
|
|
4789
|
+
watch,
|
|
4790
|
+
watchAttr,
|
|
4791
|
+
watchChildren,
|
|
4792
|
+
watchIntersection,
|
|
4793
|
+
watchSize,
|
|
4794
|
+
watchScreen,
|
|
4795
|
+
ExtractAll: function () {
|
|
4796
|
+
const keys = Object.keys(this);
|
|
4797
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4798
|
+
const key = keys[i];
|
|
4799
|
+
if (key !== 'ExtractAll' && key !== 'RemoveAll') {
|
|
4800
|
+
globalThis[key] = this[key];
|
|
4801
|
+
}
|
|
4802
|
+
}
|
|
4803
|
+
return this;
|
|
4804
|
+
},
|
|
4805
|
+
RemoveAll: function () {
|
|
4806
|
+
const keys = Object.keys(this);
|
|
4807
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4808
|
+
const key = keys[i];
|
|
4809
|
+
if (key !== 'RemoveAll') {
|
|
4810
|
+
delete globalThis[key];
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
return this;
|
|
4814
|
+
}
|
|
4815
|
+
};
|
|
4816
|
+
|
|
4817
|
+
class ZikoUseStyle{
|
|
4818
|
+
constructor(style,id=0){
|
|
4819
|
+
this.id="Ziko-Style-"+id;
|
|
4820
|
+
this.use(style);
|
|
4821
|
+
this.keys=new Set();
|
|
4822
|
+
this.styles={
|
|
4823
|
+
default:{
|
|
4824
|
+
fontSize:"1em"
|
|
4825
|
+
}
|
|
4826
|
+
};
|
|
4827
|
+
}
|
|
4828
|
+
get current(){
|
|
4829
|
+
return [...this.keys].reduce((key, value) => {
|
|
4830
|
+
key[value] = `var(--${value}-${this.id})`;
|
|
4831
|
+
return key;
|
|
4832
|
+
}, {});
|
|
4833
|
+
}
|
|
4834
|
+
add(name,style={}){
|
|
4835
|
+
if(name instanceof Object)Object.assign(this.styles,name);
|
|
4836
|
+
else Object.assign(this.styles,{[name]:style});
|
|
4837
|
+
return this;
|
|
4838
|
+
}
|
|
4839
|
+
#useStyleIndex(index){
|
|
4840
|
+
const keys=Object.keys(this.styles);
|
|
4841
|
+
for(let a in this.styles[keys[index]]){
|
|
4842
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[keys[index]][a]);
|
|
4843
|
+
this.keys.add(a);
|
|
4844
|
+
}
|
|
4845
|
+
|
|
4846
|
+
return this;
|
|
4847
|
+
}
|
|
4848
|
+
#useStyleName(name){
|
|
4849
|
+
for(let a in this.styles[name]){
|
|
4850
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, this.styles[name][a]);
|
|
4851
|
+
this.keys.add(a);
|
|
4852
|
+
}
|
|
4853
|
+
return this;
|
|
4854
|
+
}
|
|
4855
|
+
#useStyleObject(Style){
|
|
4856
|
+
for(let a in Style){
|
|
4857
|
+
document.documentElement.style.setProperty(`--${a}-${this.id}`, Style[a]);
|
|
4858
|
+
this.keys.add(a);
|
|
4859
|
+
}
|
|
4860
|
+
return this;
|
|
4861
|
+
}
|
|
4862
|
+
use(style){
|
|
4863
|
+
if(typeof style === "number")this.#useStyleIndex(style);
|
|
4864
|
+
if(typeof style === "string")this.#useStyleName(style);
|
|
4865
|
+
if(style instanceof Object)this.#useStyleObject(style);
|
|
4866
|
+
return this;
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
const useStyle=id=>style=>new ZikoUseStyle(style,id);
|
|
4870
|
+
|
|
4871
|
+
const LightThemes={
|
|
4872
|
+
cozyCottonCandy: {
|
|
4873
|
+
background: "#FCE4EC",
|
|
4874
|
+
currentLine: "#F8BBD0",
|
|
4875
|
+
selection: "#FFCDD2",
|
|
4876
|
+
foreground: "#673AB7",
|
|
4877
|
+
comment: "#9575CD",
|
|
4878
|
+
cyan: "#00BCD4",
|
|
4879
|
+
green: "#4CAF50",
|
|
4880
|
+
orange: "#FF9800",
|
|
4881
|
+
pink: "#E91E63",
|
|
4882
|
+
purple: "#9C27B0",
|
|
4883
|
+
red: "#F44336",
|
|
4884
|
+
yellow: "#FFEB3B"
|
|
4885
|
+
},
|
|
4886
|
+
crystalClear: {
|
|
4887
|
+
background: "#F6F8FA",
|
|
4888
|
+
currentLine: "#E8F0F5",
|
|
4889
|
+
selection: "#D4E9F7",
|
|
4890
|
+
foreground: "#485766",
|
|
4891
|
+
comment: "#8492A6",
|
|
4892
|
+
cyan: "#00ACC1",
|
|
4893
|
+
green: "#8BC34A",
|
|
4894
|
+
orange: "#FFA726",
|
|
4895
|
+
pink: "#FF4081",
|
|
4896
|
+
purple: "#7E57C2",
|
|
4897
|
+
red: "#EF5350",
|
|
4898
|
+
yellow: "#FFD740"
|
|
4899
|
+
},
|
|
4900
|
+
lightdreamyDusk: {
|
|
4901
|
+
background: "#F5F5F5",
|
|
4902
|
+
currentLine: "#E8E8E8",
|
|
4903
|
+
selection: "#DADADA",
|
|
4904
|
+
foreground: "#555555",
|
|
4905
|
+
comment: "#999999",
|
|
4906
|
+
cyan: "#5FB3B3",
|
|
4907
|
+
green: "#68C386",
|
|
4908
|
+
orange: "#FFB67A",
|
|
4909
|
+
pink: "#FF94B0",
|
|
4910
|
+
purple: "#B78BC3",
|
|
4911
|
+
red: "#FF6666",
|
|
4912
|
+
yellow: "#FFD666"
|
|
4913
|
+
},
|
|
4914
|
+
luminousLavender: {
|
|
4915
|
+
background: "#F3E5F5",
|
|
4916
|
+
currentLine: "#E1BEE7",
|
|
4917
|
+
selection: "#CE93D8",
|
|
4918
|
+
foreground: "#311B92",
|
|
4919
|
+
comment: "#673AB7",
|
|
4920
|
+
cyan: "#00BCD4",
|
|
4921
|
+
green: "#8BC34A",
|
|
4922
|
+
orange: "#FF9800",
|
|
4923
|
+
pink: "#E91E63",
|
|
4924
|
+
purple: "#9C27B0",
|
|
4925
|
+
red: "#F44336",
|
|
4926
|
+
yellow: "#FFEB3B"
|
|
4927
|
+
},
|
|
4928
|
+
meadowMornings: {
|
|
4929
|
+
background: "#F3E5F5",
|
|
4930
|
+
currentLine: "#E1BEE7",
|
|
4931
|
+
selection: "#CE93D8",
|
|
4932
|
+
foreground: "#311B92",
|
|
4933
|
+
comment: "#673AB7",
|
|
4934
|
+
cyan: "#00BCD4",
|
|
4935
|
+
green: "#8BC34A",
|
|
4936
|
+
orange: "#FF9800",
|
|
4937
|
+
pink: "#E91E63",
|
|
4938
|
+
purple: "#9C27B0",
|
|
4939
|
+
red: "#F44336",
|
|
4940
|
+
yellow: "#FFEB3B"
|
|
4941
|
+
},
|
|
4942
|
+
moonlitMauve: {
|
|
4943
|
+
background: "#F3E5F5",
|
|
4944
|
+
currentLine: "#E1BEE7",
|
|
4945
|
+
selection: "#CE93D8",
|
|
4946
|
+
foreground: "#311B92",
|
|
4947
|
+
comment: "#673AB7",
|
|
4948
|
+
cyan: "#00BCD4",
|
|
4949
|
+
green: "#8BC34A",
|
|
4950
|
+
orange: "#FF9800",
|
|
4951
|
+
pink: "#E91E63",
|
|
4952
|
+
purple: "#9C27B0",
|
|
4953
|
+
red: "#F44336",
|
|
4954
|
+
yellow: "#FFEB3B"
|
|
4955
|
+
},
|
|
4956
|
+
morningMist: {
|
|
4957
|
+
background: "#F6F6F6",
|
|
4958
|
+
currentLine: "#EAEAEA",
|
|
4959
|
+
selection: "#D8D8D8",
|
|
4960
|
+
foreground: "#333333",
|
|
4961
|
+
comment: "#808080",
|
|
4962
|
+
cyan: "#00A6A6",
|
|
4963
|
+
green: "#4CAF50",
|
|
4964
|
+
orange: "#FFA726",
|
|
4965
|
+
pink: "#FF4081",
|
|
4966
|
+
purple: "#9C27B0",
|
|
4967
|
+
red: "#FF5252",
|
|
4968
|
+
yellow: "#FFD740"
|
|
4969
|
+
},
|
|
4970
|
+
oceanBreeze: {
|
|
4971
|
+
background: "#ECF1F4",
|
|
4972
|
+
currentLine: "#DDE8ED",
|
|
4973
|
+
selection: "#BFD3C1",
|
|
4974
|
+
foreground: "#37474F",
|
|
4975
|
+
comment: "#607D8B",
|
|
4976
|
+
cyan: "#00BCD4",
|
|
4977
|
+
green: "#8BC34A",
|
|
4978
|
+
orange: "#FF9800",
|
|
4979
|
+
pink: "#E91E63",
|
|
4980
|
+
purple: "#673AB7",
|
|
4981
|
+
red: "#F44336",
|
|
4982
|
+
yellow: "#FFEB3B"
|
|
4983
|
+
},
|
|
4984
|
+
pastelParadise: {
|
|
4985
|
+
background: "#F5F5F5",
|
|
4986
|
+
currentLine: "#E8E8E8",
|
|
4987
|
+
selection: "#DADADA",
|
|
4988
|
+
foreground: "#555555",
|
|
4989
|
+
comment: "#999999",
|
|
4990
|
+
cyan: "#5FB3B3",
|
|
4991
|
+
green: "#68C386",
|
|
4992
|
+
orange: "#FFB67A",
|
|
4993
|
+
pink: "#FF94B0",
|
|
4994
|
+
purple: "#B78BC3",
|
|
4995
|
+
red: "#FF6666",
|
|
4996
|
+
yellow: "#FFD666"
|
|
4997
|
+
},
|
|
4998
|
+
pastelPetals: {
|
|
4999
|
+
background: "#FCE4EC",
|
|
5000
|
+
currentLine: "#F8BBD0",
|
|
5001
|
+
selection: "#FFCDD2",
|
|
5002
|
+
foreground: "#673AB7",
|
|
5003
|
+
comment: "#9575CD",
|
|
5004
|
+
cyan: "#00BCD4",
|
|
5005
|
+
green: "#4CAF50",
|
|
5006
|
+
orange: "#FF9800",
|
|
5007
|
+
pink: "#E91E63",
|
|
5008
|
+
purple: "#9C27B0",
|
|
5009
|
+
red: "#F44336",
|
|
5010
|
+
yellow: "#FFEB3B"
|
|
5011
|
+
},
|
|
5012
|
+
sereneSnowfall: {
|
|
5013
|
+
background: "#F9F9F9",
|
|
5014
|
+
currentLine: "#EDEDED",
|
|
5015
|
+
selection: "#D8D8D8",
|
|
5016
|
+
foreground: "#454545",
|
|
5017
|
+
comment: "#888888",
|
|
5018
|
+
cyan: "#5FA5A5",
|
|
5019
|
+
green: "#5BC47E",
|
|
5020
|
+
orange: "#FFBC8D",
|
|
5021
|
+
pink: "#FFA7BF",
|
|
5022
|
+
purple: "#B88AAE",
|
|
5023
|
+
red: "#FF7575",
|
|
5024
|
+
yellow: "#FFD98F"
|
|
5025
|
+
},
|
|
5026
|
+
softSherbet: {
|
|
5027
|
+
background: "#FDF8F3",
|
|
5028
|
+
currentLine: "#FAF1EB",
|
|
5029
|
+
selection: "#FFEBEE",
|
|
5030
|
+
foreground: "#6D4C41",
|
|
5031
|
+
comment: "#A1887F",
|
|
5032
|
+
cyan: "#00BCD4",
|
|
5033
|
+
green: "#689F38",
|
|
5034
|
+
orange: "#FFA000",
|
|
5035
|
+
pink: "#EC407A",
|
|
5036
|
+
purple: "#8E24AA",
|
|
5037
|
+
red: "#E53935",
|
|
5038
|
+
yellow: "#FFC107"
|
|
5039
|
+
},
|
|
5040
|
+
subtleSerenity: {
|
|
5041
|
+
background: "#F3F5F7",
|
|
5042
|
+
currentLine: "#E8EDF2",
|
|
5043
|
+
selection: "#D1D9E6",
|
|
5044
|
+
foreground: "#2C3E50",
|
|
5045
|
+
comment: "#95A5A6",
|
|
5046
|
+
cyan: "#3498DB",
|
|
5047
|
+
green: "#2ECC71",
|
|
5048
|
+
orange: "#F39C12",
|
|
5049
|
+
pink: "#E74C3C",
|
|
5050
|
+
purple: "#9B59B6",
|
|
5051
|
+
red: "#C0392B",
|
|
5052
|
+
yellow: "#F1C40F"
|
|
5053
|
+
},
|
|
5054
|
+
summerSunset: {
|
|
5055
|
+
background: "#FCE4EC",
|
|
5056
|
+
currentLine: "#F8BBD0",
|
|
5057
|
+
selection: "#FFCDD2",
|
|
5058
|
+
foreground: "#4E342E",
|
|
5059
|
+
comment: "#795548",
|
|
5060
|
+
cyan: "#009688",
|
|
5061
|
+
green: "#43A047",
|
|
5062
|
+
orange: "#FF5722",
|
|
5063
|
+
pink: "#E91E63",
|
|
5064
|
+
purple: "#9C27B0",
|
|
5065
|
+
red: "#F44336",
|
|
5066
|
+
yellow: "#FFEB3B"
|
|
5067
|
+
},
|
|
5068
|
+
sunnyDay: {
|
|
5069
|
+
background: "#FFF8E1",
|
|
5070
|
+
currentLine: "#FFF3E0",
|
|
5071
|
+
selection: "#FFE0B2",
|
|
5072
|
+
foreground: "#4E342E",
|
|
5073
|
+
comment: "#795548",
|
|
5074
|
+
cyan: "#00BCD4",
|
|
5075
|
+
green: "#8BC34A",
|
|
5076
|
+
orange: "#FF9800",
|
|
5077
|
+
pink: "#E91E63",
|
|
5078
|
+
purple: "#673AB7",
|
|
5079
|
+
red: "#F44336",
|
|
5080
|
+
yellow: "#FFEB3B"
|
|
5081
|
+
},
|
|
5082
|
+
tranquilTwilight: {
|
|
5083
|
+
background: "#F9F9F9",
|
|
5084
|
+
currentLine: "#EDEDED",
|
|
5085
|
+
selection: "#D8D8D8",
|
|
5086
|
+
foreground: "#454545",
|
|
5087
|
+
comment: "#888888",
|
|
5088
|
+
cyan: "#5FA5A5",
|
|
5089
|
+
green: "#5BC47E",
|
|
5090
|
+
orange: "#FFBC8D",
|
|
5091
|
+
pink: "#FFA7BF",
|
|
5092
|
+
purple: "#B88AAE",
|
|
5093
|
+
red: "#FF7575",
|
|
5094
|
+
yellow: "#FFD98F"
|
|
5095
|
+
},
|
|
5096
|
+
tranquilWaves: {
|
|
5097
|
+
background: "#F9F9F9",
|
|
5098
|
+
currentLine: "#E4E4E4",
|
|
5099
|
+
selection: "#D4D4D4",
|
|
5100
|
+
foreground: "#2C3E50",
|
|
5101
|
+
comment: "#7F8C8D",
|
|
5102
|
+
cyan: "#3498DB",
|
|
5103
|
+
green: "#2ECC71",
|
|
5104
|
+
orange: "#F39C12",
|
|
5105
|
+
pink: "#E74C3C",
|
|
5106
|
+
purple: "#9B59B6",
|
|
5107
|
+
red: "#C0392B",
|
|
5108
|
+
yellow: "#F1C40F"
|
|
5109
|
+
},
|
|
5110
|
+
whisperingWillow: {
|
|
5111
|
+
background: "#F6F8FA",
|
|
5112
|
+
currentLine: "#E8F0F5",
|
|
5113
|
+
selection: "#D4E9F7",
|
|
5114
|
+
foreground: "#485766",
|
|
5115
|
+
comment: "#8492A6",
|
|
5116
|
+
cyan: "#00ACC1",
|
|
5117
|
+
green: "#8BC34A",
|
|
5118
|
+
orange: "#FFA726",
|
|
5119
|
+
pink: "#FF4081",
|
|
5120
|
+
purple: "#7E57C2",
|
|
5121
|
+
red: "#EF5350",
|
|
5122
|
+
yellow: "#FFD740"
|
|
5123
|
+
}
|
|
5124
|
+
};
|
|
5125
|
+
|
|
5126
|
+
const DarkThemes = {
|
|
5127
|
+
antiqueRose: {
|
|
5128
|
+
background: "#1C1014",
|
|
5129
|
+
currentLine: "#2B1B21",
|
|
5130
|
+
selection: "#443034",
|
|
5131
|
+
foreground: "#D8B5B5",
|
|
5132
|
+
comment: "#7F5E5E",
|
|
5133
|
+
cyan: "#6FA2A2",
|
|
5134
|
+
green: "#66A66F",
|
|
5135
|
+
orange: "#FFB97A",
|
|
5136
|
+
pink: "#FFA8BD",
|
|
5137
|
+
purple: "#B78DA5",
|
|
5138
|
+
red: "#FF6C6C",
|
|
5139
|
+
yellow: "#FFD579"
|
|
5140
|
+
},
|
|
5141
|
+
auroraBorealis: {
|
|
5142
|
+
background: "#1D1426",
|
|
5143
|
+
currentLine: "#2B1E35",
|
|
5144
|
+
selection: "#432D4E",
|
|
5145
|
+
foreground: "#C2AABF",
|
|
5146
|
+
comment: "#7F6E8E",
|
|
5147
|
+
cyan: "#7EA5D3",
|
|
5148
|
+
green: "#77C992",
|
|
5149
|
+
orange: "#FFC476",
|
|
5150
|
+
pink: "#FFA8B3",
|
|
5151
|
+
purple: "#AE9AC3",
|
|
5152
|
+
red: "#FF6C6C",
|
|
5153
|
+
yellow: "#FFD576"
|
|
5154
|
+
},
|
|
5155
|
+
autumnHarvest: {
|
|
5156
|
+
background: "#291C10",
|
|
5157
|
+
currentLine: "#3A2A1E",
|
|
5158
|
+
selection: "#573C2C",
|
|
5159
|
+
foreground: "#D4C3A2",
|
|
5160
|
+
comment: "#7F6F52",
|
|
5161
|
+
cyan: "#82B4BF",
|
|
5162
|
+
green: "#7FB074",
|
|
5163
|
+
orange: "#FFAB6E",
|
|
5164
|
+
pink: "#FF8196",
|
|
5165
|
+
purple: "#B394A9",
|
|
5166
|
+
red: "#FF6565",
|
|
5167
|
+
yellow: "#FFD270"
|
|
5168
|
+
},
|
|
5169
|
+
aylin: {
|
|
5170
|
+
background: "#13161E",
|
|
5171
|
+
currentLine: "#161A28",
|
|
5172
|
+
selection: "#222B3E",
|
|
5173
|
+
foreground: "#D2D8E0",
|
|
5174
|
+
comment: "#697098",
|
|
5175
|
+
cyan: "#78D1E1",
|
|
5176
|
+
green: "#98C379",
|
|
5177
|
+
orange: "#EBCB8B",
|
|
5178
|
+
pink: "#D16D9E",
|
|
5179
|
+
purple: "#C678DD",
|
|
5180
|
+
red: "#E88388",
|
|
5181
|
+
yellow: "#EBCB8B"
|
|
5182
|
+
},
|
|
5183
|
+
azureBlue: {
|
|
5184
|
+
background: "#001B29",
|
|
5185
|
+
currentLine: "#002C3E",
|
|
5186
|
+
selection: "#004E6B",
|
|
5187
|
+
foreground: "#C3D7E2",
|
|
5188
|
+
comment: "#5F7C92",
|
|
5189
|
+
cyan: "#75B7D1",
|
|
5190
|
+
green: "#70C8A7",
|
|
5191
|
+
orange: "#FFB476",
|
|
5192
|
+
pink: "#FF92B0",
|
|
5193
|
+
purple: "#B88BC3",
|
|
5194
|
+
red: "#FF6666",
|
|
5195
|
+
yellow: "#FFD666"
|
|
5196
|
+
},
|
|
5197
|
+
cobalt2: {
|
|
5198
|
+
background: "#193549",
|
|
5199
|
+
currentLine: "#1F4662",
|
|
5200
|
+
selection: "#193549",
|
|
5201
|
+
foreground: "#B9BED0",
|
|
5202
|
+
comment: "#627D98",
|
|
5203
|
+
cyan: "#4DB5BD",
|
|
5204
|
+
green: "#86B300",
|
|
5205
|
+
orange: "#FFB86C",
|
|
5206
|
+
pink: "#FF7F7B",
|
|
5207
|
+
purple: "#9B64FB",
|
|
5208
|
+
red: "#FF6672",
|
|
5209
|
+
yellow: "#FFCC99"
|
|
5210
|
+
},
|
|
5211
|
+
cobaltMaterialTheme: {
|
|
5212
|
+
background: "#263238",
|
|
5213
|
+
currentLine: "#37474F",
|
|
5214
|
+
selection: "#80CBC4",
|
|
5215
|
+
foreground: "#CFD8DC",
|
|
5216
|
+
comment: "#78909C",
|
|
5217
|
+
cyan: "#80CBC4",
|
|
5218
|
+
green: "#A5D6A7",
|
|
5219
|
+
orange: "#FFD54F",
|
|
5220
|
+
pink: "#FF80AB",
|
|
5221
|
+
purple: "#CE93D8",
|
|
5222
|
+
red: "#EF5350",
|
|
5223
|
+
yellow: "#FFEE58"
|
|
5224
|
+
},
|
|
5225
|
+
cosmicBlue: {
|
|
5226
|
+
background: "#1B2836",
|
|
5227
|
+
currentLine: "#223348",
|
|
5228
|
+
selection: "#39516D",
|
|
5229
|
+
foreground: "#C0D4E5",
|
|
5230
|
+
comment: "#728CAB",
|
|
5231
|
+
cyan: "#75A6FF",
|
|
5232
|
+
green: "#5ED99F",
|
|
5233
|
+
orange: "#FFAD6F",
|
|
5234
|
+
pink: "#FF90B6",
|
|
5235
|
+
purple: "#A889C5",
|
|
5236
|
+
red: "#FF6E6E",
|
|
5237
|
+
yellow: "#FCD256"
|
|
5238
|
+
},
|
|
5239
|
+
cosmicSunset: {
|
|
5240
|
+
background: "#1B1921",
|
|
5241
|
+
currentLine: "#272530",
|
|
5242
|
+
selection: "#3C3948",
|
|
5243
|
+
foreground: "#B8B4CB",
|
|
5244
|
+
comment: "#7A738B",
|
|
5245
|
+
cyan: "#77B4D8",
|
|
5246
|
+
green: "#6CC09E",
|
|
5247
|
+
orange: "#FFA677",
|
|
5248
|
+
pink: "#FF95B2",
|
|
5249
|
+
purple: "#B48FC1",
|
|
5250
|
+
red: "#FF6565",
|
|
5251
|
+
yellow: "#FFD566"
|
|
5252
|
+
},
|
|
5253
|
+
cyberForest: {
|
|
5254
|
+
background: "#0D151D",
|
|
5255
|
+
currentLine: "#18262F",
|
|
5256
|
+
selection: "#2B3B47",
|
|
5257
|
+
foreground: "#CDD7E0",
|
|
5258
|
+
comment: "#667B8B",
|
|
5259
|
+
cyan: "#7EC4CF",
|
|
5260
|
+
green: "#68CC96",
|
|
5261
|
+
orange: "#FFAC6C",
|
|
5262
|
+
pink: "#FF89B4",
|
|
5263
|
+
purple: "#A889C5",
|
|
5264
|
+
red: "#FF6565",
|
|
5265
|
+
yellow: "#FFCB6B"
|
|
5266
|
+
},
|
|
5267
|
+
cyberPunkCity: {
|
|
5268
|
+
background: "#000000",
|
|
5269
|
+
currentLine: "#121212",
|
|
5270
|
+
selection: "#1F1F1F",
|
|
5271
|
+
foreground: "#DADADA",
|
|
5272
|
+
comment: "#626262",
|
|
5273
|
+
cyan: "#71B7FF",
|
|
5274
|
+
green: "#50D890",
|
|
5275
|
+
orange: "#FFB86C",
|
|
5276
|
+
pink: "#FF79C6",
|
|
5277
|
+
purple: "#BB86FC",
|
|
5278
|
+
red: "#FF5454",
|
|
5279
|
+
yellow: "#FDD663"
|
|
5280
|
+
},
|
|
5281
|
+
cyberpunkNeon: {
|
|
5282
|
+
background: "#121212",
|
|
5283
|
+
currentLine: "#1B1B1B",
|
|
5284
|
+
selection: "#262626",
|
|
5285
|
+
foreground: "#DADADA",
|
|
5286
|
+
comment: "#6C6C6C",
|
|
5287
|
+
cyan: "#69AEDB",
|
|
5288
|
+
green: "#4ECCA3",
|
|
5289
|
+
orange: "#FFB86C",
|
|
5290
|
+
pink: "#FF79C6",
|
|
5291
|
+
purple: "#D08EFF",
|
|
5292
|
+
red: "#FF5454",
|
|
5293
|
+
yellow: "#FDD663"
|
|
5294
|
+
},
|
|
5295
|
+
darkDesert: {
|
|
5296
|
+
background: "#1E2022",
|
|
5297
|
+
currentLine: "#282A2E",
|
|
5298
|
+
selection: "#393D42",
|
|
5299
|
+
foreground: "#C0C5CE",
|
|
5300
|
+
comment: "#5C6368",
|
|
5301
|
+
cyan: "#6FB3E0",
|
|
5302
|
+
green: "#88C076",
|
|
5303
|
+
orange: "#FFB454",
|
|
5304
|
+
pink: "#FF7F90",
|
|
5305
|
+
purple: "#B48EAD",
|
|
5306
|
+
red: "#FF6666",
|
|
5307
|
+
yellow: "#FFCC66"
|
|
5308
|
+
},
|
|
5309
|
+
darkMint: {
|
|
5310
|
+
background: "#11161A",
|
|
5311
|
+
currentLine: "#1B2128",
|
|
5312
|
+
selection: "#3D4853",
|
|
5313
|
+
foreground: "#D9DEE5",
|
|
5314
|
+
comment: "#65737E",
|
|
5315
|
+
cyan: "#88C0D0",
|
|
5316
|
+
green: "#98C379",
|
|
5317
|
+
orange: "#FFB86C",
|
|
5318
|
+
pink: "#FF7F8B",
|
|
5319
|
+
purple: "#C594C5",
|
|
5320
|
+
red: "#FF6561",
|
|
5321
|
+
yellow: "#FAD07B"
|
|
5322
|
+
},
|
|
5323
|
+
deepOcean: {
|
|
5324
|
+
background: "#121C2C",
|
|
5325
|
+
currentLine: "#182236",
|
|
5326
|
+
selection: "#2B3E50",
|
|
5327
|
+
foreground: "#BDC3C7",
|
|
5328
|
+
comment: "#6C7A89",
|
|
5329
|
+
cyan: "#59ABE3",
|
|
5330
|
+
green: "#26A65B",
|
|
5331
|
+
orange: "#F9690E",
|
|
5332
|
+
pink: "#EB3B5A",
|
|
5333
|
+
purple: "#D2527F",
|
|
5334
|
+
red: "#E74C3C",
|
|
5335
|
+
yellow: "#F5AB35"
|
|
5336
|
+
},
|
|
5337
|
+
deepOceanBlue: {
|
|
5338
|
+
background: "#1B2F40",
|
|
5339
|
+
currentLine: "#263B53",
|
|
5340
|
+
selection: "#3A536E",
|
|
5341
|
+
foreground: "#BFC9D4",
|
|
5342
|
+
comment: "#657C8E",
|
|
5343
|
+
cyan: "#6CB5FF",
|
|
5344
|
+
green: "#65C287",
|
|
5345
|
+
orange: "#FFA974",
|
|
5346
|
+
pink: "#FF87B4",
|
|
5347
|
+
purple: "#AE9BFF",
|
|
5348
|
+
red: "#FF6666",
|
|
5349
|
+
yellow: "#FFD67B"
|
|
5350
|
+
},
|
|
5351
|
+
deepOceanSunset: {
|
|
5352
|
+
background: "#151D2A",
|
|
5353
|
+
currentLine: "#1D2735",
|
|
5354
|
+
selection: "#31405B",
|
|
5355
|
+
foreground: "#D5D9E0",
|
|
5356
|
+
comment: "#6C7B8B",
|
|
5357
|
+
cyan: "#6FAAD4",
|
|
5358
|
+
green: "#66C295",
|
|
5359
|
+
orange: "#FFA476",
|
|
5360
|
+
pink: "#FF94B0",
|
|
5361
|
+
purple: "#B08FC0",
|
|
5362
|
+
red: "#FF6565",
|
|
5363
|
+
yellow: "#FFD466"
|
|
5364
|
+
},
|
|
5365
|
+
deepSpace: {
|
|
5366
|
+
background: "#0F1419",
|
|
5367
|
+
currentLine: "#1A232D",
|
|
5368
|
+
selection: "#3A4758",
|
|
5369
|
+
foreground: "#CDD9E5",
|
|
5370
|
+
comment: "#657C96",
|
|
5371
|
+
cyan: "#6CB6FF",
|
|
5372
|
+
green: "#4CAF50",
|
|
5373
|
+
orange: "#FFB454",
|
|
5374
|
+
pink: "#FF75B5",
|
|
5375
|
+
purple: "#9A76FF",
|
|
5376
|
+
red: "#FF5555",
|
|
5377
|
+
yellow: "#FFC857"
|
|
5378
|
+
},
|
|
5379
|
+
dracula: {
|
|
5380
|
+
background: "#282a36",
|
|
5381
|
+
currentLine: "#44475a",
|
|
5382
|
+
selection: "#44475a",
|
|
5383
|
+
foreground: "#f8f8f2",
|
|
5384
|
+
comment: "#6272a4",
|
|
5385
|
+
cyan: "#8be9fd",
|
|
5386
|
+
green: "#50fa7b",
|
|
5387
|
+
orange: "#ffb86c",
|
|
5388
|
+
pink: "#ff79c6",
|
|
5389
|
+
purple: "#bd93f9",
|
|
5390
|
+
red: "#ff5555",
|
|
5391
|
+
yellow: "#f1fa8c"
|
|
5392
|
+
},
|
|
5393
|
+
dreamyDusk: {
|
|
5394
|
+
background: "#22243D",
|
|
5395
|
+
currentLine: "#313558",
|
|
5396
|
+
selection: "#4C4F6D",
|
|
5397
|
+
foreground: "#A5A7C5",
|
|
5398
|
+
comment: "#6F728E",
|
|
5399
|
+
cyan: "#81A2BE",
|
|
5400
|
+
green: "#7FB074",
|
|
5401
|
+
orange: "#FFB476",
|
|
5402
|
+
pink: "#FF91A4",
|
|
5403
|
+
purple: "#AE8DC2",
|
|
5404
|
+
red: "#FF7272",
|
|
5405
|
+
yellow: "#FFD67A"
|
|
5406
|
+
},
|
|
5407
|
+
electricLagoon: {
|
|
5408
|
+
background: "#15232B",
|
|
5409
|
+
currentLine: "#20323E",
|
|
4811
5410
|
selection: "#344E5F",
|
|
4812
5411
|
foreground: "#A6C0B9",
|
|
4813
5412
|
comment: "#6C8F81",
|
|
@@ -5586,606 +6185,252 @@ class ZikoUseFavIcon{
|
|
|
5586
6185
|
return this;
|
|
5587
6186
|
}
|
|
5588
6187
|
get current(){
|
|
5589
|
-
return document.__FavIcon__.href;
|
|
5590
|
-
}
|
|
5591
|
-
onChange(callback){
|
|
5592
|
-
if(this.cache.Emitter)this.cache.Emitter.on("ziko:favicon-changed",callback);
|
|
5593
|
-
return this;
|
|
5594
|
-
}
|
|
5595
|
-
useEventEmitter(){
|
|
5596
|
-
this.cache.Emitter=useEventEmitter();
|
|
5597
|
-
return this;
|
|
5598
|
-
}
|
|
5599
|
-
|
|
5600
|
-
}
|
|
5601
|
-
const useFavIcon=(FavIcon,useEventEmitter)=>new ZikoUseFavIcon(FavIcon,useEventEmitter);
|
|
5602
|
-
|
|
5603
|
-
class ZikoUseChannel{
|
|
5604
|
-
constructor(name=""){
|
|
5605
|
-
this.channel=new BroadcastChannel(name);
|
|
5606
|
-
this.EVENTS_DATAS_PAIRS=new Map();
|
|
5607
|
-
this.EVENTS_HANDLERS_PAIRS=new Map();
|
|
5608
|
-
this.LAST_RECEIVED_EVENT="";
|
|
5609
|
-
this.UUID="ziko-channel"+Random.string(10);
|
|
5610
|
-
this.SUBSCRIBERS=new Set([this.UUID]);
|
|
5611
|
-
}
|
|
5612
|
-
get broadcast(){
|
|
5613
|
-
// update receiver
|
|
5614
|
-
return this;
|
|
5615
|
-
}
|
|
5616
|
-
emit(event, data){
|
|
5617
|
-
this.EVENTS_DATAS_PAIRS.set(event,data);
|
|
5618
|
-
this.#maintainEmit(event);
|
|
5619
|
-
return this;
|
|
5620
|
-
}
|
|
5621
|
-
on(event,handler=console.log){
|
|
5622
|
-
this.EVENTS_HANDLERS_PAIRS.set(event,handler);
|
|
5623
|
-
this.#maintainOn();
|
|
5624
|
-
return this;
|
|
5625
|
-
}
|
|
5626
|
-
#maintainOn(){
|
|
5627
|
-
this.channel.onmessage = (e) => {
|
|
5628
|
-
this.LAST_RECEIVED_EVENT=e.data.last_sended_event;
|
|
5629
|
-
const USER_ID=e.data.userId;
|
|
5630
|
-
this.SUBSCRIBERS.add(USER_ID);
|
|
5631
|
-
const Data=e.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT);
|
|
5632
|
-
const Handler=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);
|
|
5633
|
-
if(Data && Handler)Handler(Data);
|
|
5634
|
-
};
|
|
5635
|
-
return this;
|
|
5636
|
-
}
|
|
5637
|
-
#maintainEmit(event){
|
|
5638
|
-
this.channel.postMessage({
|
|
5639
|
-
EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,
|
|
5640
|
-
last_sended_event:event,
|
|
5641
|
-
userId:this.UUID
|
|
5642
|
-
});
|
|
5643
|
-
return this;
|
|
5644
|
-
}
|
|
5645
|
-
close(){
|
|
5646
|
-
this.channel.close();
|
|
5647
|
-
return this;
|
|
5648
|
-
}
|
|
5649
|
-
}
|
|
5650
|
-
const useChannel=name=>new ZikoUseChannel(name);
|
|
5651
|
-
|
|
5652
|
-
class ZikoUseThreed {
|
|
5653
|
-
#workerContent;
|
|
5654
|
-
constructor() {
|
|
5655
|
-
this.#workerContent = (
|
|
5656
|
-
function (msg) {
|
|
5657
|
-
try {
|
|
5658
|
-
const func = new Function("return " + msg.data.fun)();
|
|
5659
|
-
let result = func();
|
|
5660
|
-
postMessage({ result });
|
|
5661
|
-
} catch (error) {
|
|
5662
|
-
postMessage({ error: error.message });
|
|
5663
|
-
} finally {
|
|
5664
|
-
if (msg.data.close) self.close();
|
|
5665
|
-
}
|
|
5666
|
-
}
|
|
5667
|
-
).toString();
|
|
5668
|
-
this.blob = new Blob(["this.onmessage = " + this.#workerContent], { type: "text/javascript" });
|
|
5669
|
-
this.worker = new Worker(window.URL.createObjectURL(this.blob));
|
|
5670
|
-
}
|
|
5671
|
-
call(func, callback, close = true) {
|
|
5672
|
-
this.worker.postMessage({
|
|
5673
|
-
fun: func.toString(),
|
|
5674
|
-
close
|
|
5675
|
-
});
|
|
5676
|
-
this.worker.onmessage = function (e) {
|
|
5677
|
-
if (e.data.error) {
|
|
5678
|
-
console.error(e.data.error);
|
|
5679
|
-
} else {
|
|
5680
|
-
callback(e.data.result);
|
|
5681
|
-
}
|
|
5682
|
-
};
|
|
5683
|
-
return this;
|
|
5684
|
-
}
|
|
5685
|
-
}
|
|
5686
|
-
|
|
5687
|
-
const useThread = (func, callback , close) => {
|
|
5688
|
-
const T = new ZikoUseThreed();
|
|
5689
|
-
if (func) {
|
|
5690
|
-
T.call(func, callback , close);
|
|
5691
|
-
}
|
|
5692
|
-
return T;
|
|
5693
|
-
};
|
|
5694
|
-
|
|
5695
|
-
class ZikoUseBluetooth{
|
|
5696
|
-
constructor(options={acceptAllDevices:true}){
|
|
5697
|
-
this.options=options;
|
|
5698
|
-
this.__Emitter__=useEventEmitter();
|
|
5699
|
-
if(this.isSupported)this.#init();
|
|
5700
|
-
}
|
|
5701
|
-
async #init(){
|
|
5702
|
-
this.promise=navigator.bluetooth.requestDevice(this.options).then(device=>this.device=device);
|
|
5703
|
-
}
|
|
5704
|
-
get isSupported(){
|
|
5705
|
-
return !!navigator.bluetooth;
|
|
5706
|
-
}
|
|
5707
|
-
get current(){
|
|
5708
|
-
// Synchrouns Code
|
|
5709
|
-
return this.device;
|
|
5710
|
-
}
|
|
5711
|
-
connect(){
|
|
5712
|
-
this.server=this.device.gatt.connect();
|
|
5713
|
-
this.__Emitter__.emit("ziko:bluetooth-connected");
|
|
5714
|
-
return this;
|
|
5715
|
-
}
|
|
5716
|
-
disconnect(){
|
|
5717
|
-
this.device.gatt.disconnect();
|
|
5718
|
-
this.__Emitter__.emit("ziko:bluetooth-disconnected");
|
|
5719
|
-
return this;
|
|
5720
|
-
}
|
|
5721
|
-
onConnect(callback){
|
|
5722
|
-
this.__Emitter__.on("ziko:bluetooth-connected",callback);
|
|
5723
|
-
return this;
|
|
5724
|
-
}
|
|
5725
|
-
onDisconnect(callback){
|
|
5726
|
-
this.__Emitter__.on("ziko:bluetooth-disconnected",callback);
|
|
5727
|
-
return this;
|
|
5728
|
-
}
|
|
5729
|
-
dispose(){
|
|
5730
|
-
|
|
5731
|
-
}
|
|
5732
|
-
async battery(callback){
|
|
5733
|
-
const batteryService = await this.server.getPrimaryService("battery_service");
|
|
5734
|
-
const batteryLevelCharacteristic = await batteryService.getCharacteristic("battery_level");
|
|
5735
|
-
const batteryLevel = await batteryLevelCharacteristic.readValue();
|
|
5736
|
-
const batteryPercent = await batteryLevel.getUint8(0);
|
|
5737
|
-
callback(batteryPercent);
|
|
5738
|
-
}
|
|
5739
|
-
}
|
|
5740
|
-
const useBluetooth=(options)=>new ZikoUseBluetooth(options);
|
|
5741
|
-
|
|
5742
|
-
class ZikoUseBattery{
|
|
5743
|
-
constructor(){
|
|
5744
|
-
if(this.isSupported)this.#init();
|
|
5745
|
-
}
|
|
5746
|
-
async #init(){
|
|
5747
|
-
this.__Battery__=await navigator.getBattery();
|
|
5748
|
-
}
|
|
5749
|
-
get isSupported(){
|
|
5750
|
-
return !!navigator.getBattery;
|
|
5751
|
-
}
|
|
5752
|
-
get current(){
|
|
5753
|
-
// Synchrouns Code
|
|
5754
|
-
const {
|
|
5755
|
-
level,
|
|
5756
|
-
charging,
|
|
5757
|
-
chargingTime,
|
|
5758
|
-
dischargingTime
|
|
5759
|
-
}=this.__Battery__;
|
|
5760
|
-
return {
|
|
5761
|
-
level,
|
|
5762
|
-
charging,
|
|
5763
|
-
chargingTime,
|
|
5764
|
-
dischargingTime
|
|
5765
|
-
}
|
|
5766
|
-
}
|
|
5767
|
-
onChargingChange(callback){
|
|
5768
|
-
this.__Battery__.addEventListener("chargingchange",callback);
|
|
5769
|
-
return this;
|
|
5770
|
-
}
|
|
5771
|
-
onLevelChange(callback){
|
|
5772
|
-
this.__Battery__.addEventListener("levelchange",callback);
|
|
5773
|
-
return this;
|
|
5774
|
-
}
|
|
5775
|
-
}
|
|
5776
|
-
const useBattery=()=>new ZikoUseBattery();
|
|
5777
|
-
|
|
5778
|
-
class ZikoUseGeolocation{
|
|
5779
|
-
constructor(){
|
|
5780
|
-
if(this.isSupported)this.#init();
|
|
5781
|
-
}
|
|
5782
|
-
async #init(){
|
|
5783
|
-
navigator.geolocation.getCurrentPosition(e=>this.__Geolocation__=e);
|
|
5784
|
-
}
|
|
5785
|
-
get isSupported(){
|
|
5786
|
-
return !!navigator.geolocation;
|
|
5787
|
-
}
|
|
5788
|
-
get current(){
|
|
5789
|
-
// Synchrouns Code
|
|
5790
|
-
return this.__Geolocation__;
|
|
6188
|
+
return document.__FavIcon__.href;
|
|
5791
6189
|
}
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
class ZikoTimeLoop {
|
|
5796
|
-
constructor(callback, {fps,step,t=[0,null],start=true}={}) {
|
|
5797
|
-
this.callback = callback;
|
|
5798
|
-
this.cache = {
|
|
5799
|
-
isRunning: false,
|
|
5800
|
-
AnimationId : null,
|
|
5801
|
-
startTime : null,
|
|
5802
|
-
step,
|
|
5803
|
-
fps,
|
|
5804
|
-
t,
|
|
5805
|
-
started:start
|
|
5806
|
-
};
|
|
5807
|
-
this.adjust();
|
|
5808
|
-
this.i=0;
|
|
5809
|
-
}
|
|
5810
|
-
adjust(){
|
|
5811
|
-
if(this.cache.step && this.cache.fps){
|
|
5812
|
-
console.warn(`Fps will be adjusted from ${this.cache.fps} to ${1000/this.cache.step} to ensure a smoother animation`);
|
|
5813
|
-
this.cache.fps=1000/this.cache.step;
|
|
6190
|
+
onChange(callback){
|
|
6191
|
+
if(this.cache.Emitter)this.cache.Emitter.on("ziko:favicon-changed",callback);
|
|
6192
|
+
return this;
|
|
5814
6193
|
}
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
if(t[1])this.stopAfter(t[1]);
|
|
6194
|
+
useEventEmitter(){
|
|
6195
|
+
this.cache.Emitter=useEventEmitter();
|
|
6196
|
+
return this;
|
|
5819
6197
|
}
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
6198
|
+
|
|
6199
|
+
}
|
|
6200
|
+
const useFavIcon=(FavIcon,useEventEmitter)=>new ZikoUseFavIcon(FavIcon,useEventEmitter);
|
|
6201
|
+
|
|
6202
|
+
/*
|
|
6203
|
+
[
|
|
6204
|
+
{
|
|
6205
|
+
query: '(min-width: 600px)',
|
|
6206
|
+
callback: () => console.log(1)
|
|
6207
|
+
},
|
|
6208
|
+
{
|
|
6209
|
+
query: '(max-width: 300px)',
|
|
6210
|
+
callback: () => console.log(2)
|
|
6211
|
+
}
|
|
6212
|
+
]
|
|
6213
|
+
*/
|
|
6214
|
+
class ZikoUseMediaQuery {
|
|
6215
|
+
constructor(mediaQueryRules=[],fallback=()=>{}) {
|
|
6216
|
+
this.mediaQueryRules = mediaQueryRules;
|
|
6217
|
+
this.fallback = fallback;
|
|
6218
|
+
this.lastCalledCallback = null;
|
|
6219
|
+
this.init();
|
|
5831
6220
|
}
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
6221
|
+
|
|
6222
|
+
init() {
|
|
6223
|
+
this.mediaQueryRules.forEach(({ query, callback }) => {
|
|
6224
|
+
const mediaQueryList = globalThis.matchMedia(query);
|
|
6225
|
+
const checkMatches = () => {
|
|
6226
|
+
const anyMatch = this.mediaQueryRules.some(({ query }) => globalThis.matchMedia(query).matches);
|
|
6227
|
+
if (mediaQueryList.matches) {
|
|
6228
|
+
callback();
|
|
6229
|
+
this.lastCalledCallback = callback;
|
|
6230
|
+
} else if (!anyMatch && this.lastCalledCallback !== this.fallback) {
|
|
6231
|
+
this.fallback();
|
|
6232
|
+
this.lastCalledCallback = this.fallback;
|
|
6233
|
+
}
|
|
6234
|
+
};
|
|
6235
|
+
checkMatches();
|
|
6236
|
+
mediaQueryList.addListener(checkMatches);
|
|
6237
|
+
});
|
|
5838
6238
|
}
|
|
5839
|
-
return this;
|
|
5840
|
-
}
|
|
5841
|
-
stop(){
|
|
5842
|
-
this.pause();
|
|
5843
|
-
this.i=0;
|
|
5844
|
-
return this;
|
|
5845
|
-
}
|
|
5846
|
-
resume(){
|
|
5847
|
-
this.cache.isRunning=true;
|
|
5848
|
-
this.animate();
|
|
5849
|
-
return this;
|
|
5850
|
-
}
|
|
5851
|
-
startAfter(t=1000){
|
|
5852
|
-
setTimeout(this.start.bind(this),t);
|
|
5853
|
-
return this;
|
|
5854
|
-
}
|
|
5855
|
-
stopAfter(t=1000){
|
|
5856
|
-
setTimeout(this.stop.bind(this),t);
|
|
5857
|
-
return this;
|
|
5858
|
-
}
|
|
5859
|
-
animate = () => {
|
|
5860
|
-
if (this.cache.isRunning) {
|
|
5861
|
-
const now = Date.now();
|
|
5862
|
-
const delta = now - this.cache.startTime;
|
|
5863
|
-
if (delta > this.TIME_STEP) {
|
|
5864
|
-
this.callback(this);
|
|
5865
|
-
this.i++;
|
|
5866
|
-
this.cache.startTime = now - (delta % this.TIME_STEP);
|
|
5867
|
-
}
|
|
5868
|
-
this.cache.AnimationId = setTimeout(this.animate, 0);
|
|
5869
|
-
} }
|
|
5870
6239
|
}
|
|
5871
6240
|
|
|
5872
|
-
const
|
|
6241
|
+
const useMediaQuery = (mediaQueryRules,fallback) => new ZikoUseMediaQuery(mediaQueryRules,fallback);
|
|
5873
6242
|
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
return
|
|
5886
|
-
}
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
InCubic(t){
|
|
5897
|
-
return t**3;
|
|
5898
|
-
},
|
|
5899
|
-
OutCubic(t){
|
|
5900
|
-
return 1 - Math.pow((1 - t),3)
|
|
5901
|
-
},
|
|
5902
|
-
InOutCubic(t){
|
|
5903
|
-
return t < 0.5 ? 4 * Math.pow(t,3) : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
5904
|
-
},
|
|
5905
|
-
InQuart(t){
|
|
5906
|
-
return t**4;
|
|
5907
|
-
},
|
|
5908
|
-
OutQuart(t){
|
|
5909
|
-
return 1 - Math.pow((1 - t),4);
|
|
5910
|
-
},
|
|
5911
|
-
InOutQuart(t){
|
|
5912
|
-
return t < 0.5 ? 8 * Math.pow(t,4) : 1 - Math.pow(-2 * t + 2, 4) / 2;
|
|
5913
|
-
},
|
|
5914
|
-
InQuint(t){
|
|
5915
|
-
return t**5;
|
|
5916
|
-
},
|
|
5917
|
-
OutQuint(t){
|
|
5918
|
-
return 1 - Math.pow((1 - t),5);
|
|
5919
|
-
},
|
|
5920
|
-
InOutQuint(t){
|
|
5921
|
-
return t < 0.5 ? 16 * Math.pow(t,5) : 1 - Math.pow(-2 * t + 2, 5) / 2;
|
|
5922
|
-
},
|
|
5923
|
-
InExpo(t){
|
|
5924
|
-
return t === 0 ? 0 : Math.pow(2, 10 * t - 10);
|
|
5925
|
-
},
|
|
5926
|
-
OutExpo(t){
|
|
5927
|
-
return t === 1 ? 1 : 1 - Math.pow(2, -10 * t);
|
|
5928
|
-
},
|
|
5929
|
-
InOutExpo(t){
|
|
5930
|
-
return t === 0? 0: t === 1? 1: t < 0.5 ? Math.pow(2, 20 * t - 10) / 2: (2 - Math.pow(2, -20 * t + 10)) / 2;
|
|
5931
|
-
},
|
|
5932
|
-
InCirc(t){
|
|
5933
|
-
return 1 - Math.sqrt(1 - Math.pow(t, 2));
|
|
5934
|
-
},
|
|
5935
|
-
OutCirc(t){
|
|
5936
|
-
return Math.sqrt(1 - Math.pow(t - 1, 2));
|
|
5937
|
-
},
|
|
5938
|
-
InOutCic(t){
|
|
5939
|
-
return t < 0.5? (1 - Math.sqrt(1 - Math.pow(2 * t, 2))) / 2: (Math.sqrt(1 - Math.pow(-2 * t + 2, 2)) + 1) / 2;
|
|
5940
|
-
},
|
|
5941
|
-
Arc(t){
|
|
5942
|
-
return 1 - Math.sin(Math.acos(t));
|
|
5943
|
-
},
|
|
5944
|
-
Back(t){
|
|
5945
|
-
// To Be Changed
|
|
5946
|
-
let x=1;
|
|
5947
|
-
return Math.pow(t, 2) * ((x + 1) * t - x);
|
|
5948
|
-
},
|
|
5949
|
-
Elastic(t){
|
|
5950
|
-
return -2*Math.pow(2, 10 * (t - 1)) * Math.cos(20 * Math.PI * t / 3 * t);
|
|
5951
|
-
},
|
|
5952
|
-
InBack(t){
|
|
5953
|
-
const c1 = 1.70158;
|
|
5954
|
-
const c3 = c1 + 1;
|
|
5955
|
-
return c3 *Math.pow(t,3)- c1 * (t**2);
|
|
5956
|
-
},
|
|
5957
|
-
OutBack(t){
|
|
5958
|
-
const c1 = 1.70158;
|
|
5959
|
-
const c3 = c1 + 1;
|
|
5960
|
-
return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);
|
|
5961
|
-
},
|
|
5962
|
-
InOutBack(t){
|
|
5963
|
-
const c1 = 1.70158;
|
|
5964
|
-
const c2 = c1 * 1.525;
|
|
5965
|
-
return t < 0.5
|
|
5966
|
-
? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
|
|
5967
|
-
: (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
|
|
5968
|
-
},
|
|
5969
|
-
InElastic(t){
|
|
5970
|
-
const c4 = (2 * Math.PI) / 3;return t === 0
|
|
5971
|
-
? 0
|
|
5972
|
-
: t === 1
|
|
5973
|
-
? 1
|
|
5974
|
-
: -Math.pow(2, 10 * t - 10) * Math.sin((t * 10 - 10.75) * c4);
|
|
5975
|
-
},
|
|
5976
|
-
OutElastic(t){
|
|
5977
|
-
const c4 = (2 * Math.PI) / 3;
|
|
5978
|
-
return t === 0
|
|
5979
|
-
? 0
|
|
5980
|
-
: t === 1
|
|
5981
|
-
? 1
|
|
5982
|
-
: Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * c4) + 1;
|
|
5983
|
-
},
|
|
5984
|
-
InOutElastic(t){
|
|
5985
|
-
const c5 = (2 * Math.PI) / 4.5;
|
|
5986
|
-
return t === 0
|
|
5987
|
-
? 0
|
|
5988
|
-
: t === 1
|
|
5989
|
-
? 1
|
|
5990
|
-
: t < 0.5
|
|
5991
|
-
? -(Math.pow(2, 20 * t - 10) * Math.sin((20 * t - 11.125) * c5)) / 2
|
|
5992
|
-
: (Math.pow(2, -20 * t + 10) * Math.sin((20 * t - 11.125) * c5)) / 2 + 1;
|
|
5993
|
-
},
|
|
5994
|
-
InBounce(t){
|
|
5995
|
-
return 1 - Ease.OutBounce(1-t);
|
|
5996
|
-
},
|
|
5997
|
-
OutBounce(t){
|
|
5998
|
-
const n1 = 7.5625;
|
|
5999
|
-
const d1 = 2.75;
|
|
6000
|
-
if (t < 1 / d1) {
|
|
6001
|
-
return n1 * t * t;
|
|
6002
|
-
} else if (t < 2 / d1) {
|
|
6003
|
-
return n1 * (t -= 1.5 / d1) * t + 0.75;
|
|
6004
|
-
} else if (t < 2.5 / d1) {
|
|
6005
|
-
return n1 * (t -= 2.25 / d1) * t + 0.9375;
|
|
6006
|
-
} else {
|
|
6007
|
-
return n1 * (t -= 2.625 / d1) * t + 0.984375;
|
|
6008
|
-
}
|
|
6009
|
-
|
|
6010
|
-
},
|
|
6011
|
-
InOutBounce(t){
|
|
6012
|
-
return t < 0.5
|
|
6013
|
-
? (1 - Ease.OutBounce(1 - 2 * t)) / 2
|
|
6014
|
-
: (1 + Ease.OutBounce(2 * t - 1)) / 2;
|
|
6243
|
+
class ZikoUseChannel{
|
|
6244
|
+
constructor(name=""){
|
|
6245
|
+
this.channel=new BroadcastChannel(name);
|
|
6246
|
+
this.EVENTS_DATAS_PAIRS=new Map();
|
|
6247
|
+
this.EVENTS_HANDLERS_PAIRS=new Map();
|
|
6248
|
+
this.LAST_RECEIVED_EVENT="";
|
|
6249
|
+
this.UUID="ziko-channel"+Random.string(10);
|
|
6250
|
+
this.SUBSCRIBERS=new Set([this.UUID]);
|
|
6251
|
+
}
|
|
6252
|
+
get broadcast(){
|
|
6253
|
+
// update receiver
|
|
6254
|
+
return this;
|
|
6255
|
+
}
|
|
6256
|
+
emit(event, data){
|
|
6257
|
+
this.EVENTS_DATAS_PAIRS.set(event,data);
|
|
6258
|
+
this.#maintainEmit(event);
|
|
6259
|
+
return this;
|
|
6260
|
+
}
|
|
6261
|
+
on(event,handler=console.log){
|
|
6262
|
+
this.EVENTS_HANDLERS_PAIRS.set(event,handler);
|
|
6263
|
+
this.#maintainOn();
|
|
6264
|
+
return this;
|
|
6015
6265
|
}
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
const
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
if(now-lastTime<delay)return;
|
|
6027
|
-
lastTime=now;
|
|
6028
|
-
fn(...args);
|
|
6266
|
+
#maintainOn(){
|
|
6267
|
+
this.channel.onmessage = (e) => {
|
|
6268
|
+
this.LAST_RECEIVED_EVENT=e.data.last_sended_event;
|
|
6269
|
+
const USER_ID=e.data.userId;
|
|
6270
|
+
this.SUBSCRIBERS.add(USER_ID);
|
|
6271
|
+
const Data=e.data.EVENTS_DATAS_PAIRS.get(this.LAST_RECEIVED_EVENT);
|
|
6272
|
+
const Handler=this.EVENTS_HANDLERS_PAIRS.get(this.LAST_RECEIVED_EVENT);
|
|
6273
|
+
if(Data && Handler)Handler(Data);
|
|
6274
|
+
};
|
|
6275
|
+
return this;
|
|
6029
6276
|
}
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
};
|
|
6045
|
-
};
|
|
6277
|
+
#maintainEmit(event){
|
|
6278
|
+
this.channel.postMessage({
|
|
6279
|
+
EVENTS_DATAS_PAIRS:this.EVENTS_DATAS_PAIRS,
|
|
6280
|
+
last_sended_event:event,
|
|
6281
|
+
userId:this.UUID
|
|
6282
|
+
});
|
|
6283
|
+
return this;
|
|
6284
|
+
}
|
|
6285
|
+
close(){
|
|
6286
|
+
this.channel.close();
|
|
6287
|
+
return this;
|
|
6288
|
+
}
|
|
6289
|
+
}
|
|
6290
|
+
const useChannel=name=>new ZikoUseChannel(name);
|
|
6046
6291
|
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6292
|
+
class ZikoUseThreed {
|
|
6293
|
+
#workerContent;
|
|
6294
|
+
constructor() {
|
|
6295
|
+
this.#workerContent = (
|
|
6296
|
+
function (msg) {
|
|
6297
|
+
try {
|
|
6298
|
+
const func = new Function("return " + msg.data.fun)();
|
|
6299
|
+
let result = func();
|
|
6300
|
+
postMessage({ result });
|
|
6301
|
+
} catch (error) {
|
|
6302
|
+
postMessage({ error: error.message });
|
|
6303
|
+
} finally {
|
|
6304
|
+
if (msg.data.close) self.close();
|
|
6305
|
+
}
|
|
6057
6306
|
}
|
|
6307
|
+
).toString();
|
|
6308
|
+
this.blob = new Blob(["this.onmessage = " + this.#workerContent], { type: "text/javascript" });
|
|
6309
|
+
this.worker = new Worker(window.URL.createObjectURL(this.blob));
|
|
6310
|
+
}
|
|
6311
|
+
call(func, callback, close = true) {
|
|
6312
|
+
this.worker.postMessage({
|
|
6313
|
+
fun: func.toString(),
|
|
6314
|
+
close
|
|
6058
6315
|
});
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
const t0=Date.now();
|
|
6068
|
-
while(Date.now()-t0<timeout){
|
|
6069
|
-
if(UIElement.element)return UIElement.element
|
|
6316
|
+
this.worker.onmessage = function (e) {
|
|
6317
|
+
if (e.data.error) {
|
|
6318
|
+
console.error(e.data.error);
|
|
6319
|
+
} else {
|
|
6320
|
+
callback(e.data.result);
|
|
6321
|
+
}
|
|
6322
|
+
};
|
|
6323
|
+
return this;
|
|
6070
6324
|
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
const
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
console.timeEnd('timeTaken');
|
|
6080
|
-
return r;
|
|
6325
|
+
}
|
|
6326
|
+
|
|
6327
|
+
const useThread = (func, callback , close) => {
|
|
6328
|
+
const T = new ZikoUseThreed();
|
|
6329
|
+
if (func) {
|
|
6330
|
+
T.call(func, callback , close);
|
|
6331
|
+
}
|
|
6332
|
+
return T;
|
|
6081
6333
|
};
|
|
6082
6334
|
|
|
6083
|
-
class
|
|
6084
|
-
constructor(
|
|
6085
|
-
this.
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
intervall:t,
|
|
6092
|
-
started:start,
|
|
6093
|
-
duration
|
|
6094
|
-
};
|
|
6095
|
-
this.t=0;
|
|
6096
|
-
this.tx=0;
|
|
6097
|
-
this.ty=0;
|
|
6098
|
-
this.i=0;
|
|
6099
|
-
this.callback=callback;
|
|
6335
|
+
class ZikoUseBluetooth{
|
|
6336
|
+
constructor(options={acceptAllDevices:true}){
|
|
6337
|
+
this.options=options;
|
|
6338
|
+
this.__Emitter__=useEventEmitter();
|
|
6339
|
+
if(this.isSupported)this.#init();
|
|
6340
|
+
}
|
|
6341
|
+
async #init(){
|
|
6342
|
+
this.promise=navigator.bluetooth.requestDevice(this.options).then(device=>this.device=device);
|
|
6100
6343
|
}
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
this.i++;
|
|
6104
|
-
this.tx=map(this.t,0,this.cache.duration,0,1);
|
|
6105
|
-
this.ty=this.cache.ease(this.tx);
|
|
6106
|
-
this.callback(this);
|
|
6107
|
-
if(this.t>=this.cache.duration){
|
|
6108
|
-
clearInterval(this.cache.AnimationId);
|
|
6109
|
-
this.cache.isRunning=false;
|
|
6110
|
-
}
|
|
6344
|
+
get isSupported(){
|
|
6345
|
+
return !!navigator.bluetooth;
|
|
6111
6346
|
}
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
this.
|
|
6115
|
-
this.ty=0;
|
|
6116
|
-
this.i=0;
|
|
6117
|
-
if(restart)this.start();
|
|
6118
|
-
return this;
|
|
6347
|
+
get current(){
|
|
6348
|
+
// Synchrouns Code
|
|
6349
|
+
return this.device;
|
|
6119
6350
|
}
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
this.cache.isRunning=true;
|
|
6124
|
-
this.cache.startTime = Date.now();
|
|
6125
|
-
this.cache.AnimationId=setInterval(this.#animation_handler.bind(this),this.cache.step);
|
|
6126
|
-
}
|
|
6351
|
+
connect(){
|
|
6352
|
+
this.server=this.device.gatt.connect();
|
|
6353
|
+
this.__Emitter__.emit("ziko:bluetooth-connected");
|
|
6127
6354
|
return this;
|
|
6128
6355
|
}
|
|
6129
|
-
|
|
6130
|
-
this
|
|
6356
|
+
disconnect(){
|
|
6357
|
+
this.device.gatt.disconnect();
|
|
6358
|
+
this.__Emitter__.emit("ziko:bluetooth-disconnected");
|
|
6131
6359
|
return this;
|
|
6132
6360
|
}
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
clearTimeout(this.cache.AnimationId);
|
|
6136
|
-
this.cache.isRunning = false;
|
|
6137
|
-
}
|
|
6361
|
+
onConnect(callback){
|
|
6362
|
+
this.__Emitter__.on("ziko:bluetooth-connected",callback);
|
|
6138
6363
|
return this;
|
|
6139
6364
|
}
|
|
6140
|
-
|
|
6141
|
-
this
|
|
6365
|
+
onDisconnect(callback){
|
|
6366
|
+
this.__Emitter__.on("ziko:bluetooth-disconnected",callback);
|
|
6142
6367
|
return this;
|
|
6143
6368
|
}
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6369
|
+
dispose(){
|
|
6370
|
+
|
|
6371
|
+
}
|
|
6372
|
+
async battery(callback){
|
|
6373
|
+
const batteryService = await this.server.getPrimaryService("battery_service");
|
|
6374
|
+
const batteryLevelCharacteristic = await batteryService.getCharacteristic("battery_level");
|
|
6375
|
+
const batteryLevel = await batteryLevelCharacteristic.readValue();
|
|
6376
|
+
const batteryPercent = await batteryLevel.getUint8(0);
|
|
6377
|
+
callback(batteryPercent);
|
|
6148
6378
|
}
|
|
6149
|
-
// clear(){
|
|
6150
|
-
// }
|
|
6151
|
-
// stream(){
|
|
6152
|
-
// }
|
|
6153
6379
|
}
|
|
6154
|
-
|
|
6155
|
-
const animation=(callback,config)=>new ZikoTimeAnimation(callback,config);
|
|
6380
|
+
const useBluetooth=(options)=>new ZikoUseBluetooth(options);
|
|
6156
6381
|
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
const
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6382
|
+
class ZikoUseBattery{
|
|
6383
|
+
constructor(){
|
|
6384
|
+
if(this.isSupported)this.#init();
|
|
6385
|
+
}
|
|
6386
|
+
async #init(){
|
|
6387
|
+
this.__Battery__=await navigator.getBattery();
|
|
6388
|
+
}
|
|
6389
|
+
get isSupported(){
|
|
6390
|
+
return !!navigator.getBattery;
|
|
6391
|
+
}
|
|
6392
|
+
get current(){
|
|
6393
|
+
// Synchrouns Code
|
|
6394
|
+
const {
|
|
6395
|
+
level,
|
|
6396
|
+
charging,
|
|
6397
|
+
chargingTime,
|
|
6398
|
+
dischargingTime
|
|
6399
|
+
}=this.__Battery__;
|
|
6400
|
+
return {
|
|
6401
|
+
level,
|
|
6402
|
+
charging,
|
|
6403
|
+
chargingTime,
|
|
6404
|
+
dischargingTime
|
|
6175
6405
|
}
|
|
6406
|
+
}
|
|
6407
|
+
onChargingChange(callback){
|
|
6408
|
+
this.__Battery__.addEventListener("chargingchange",callback);
|
|
6176
6409
|
return this;
|
|
6177
|
-
}
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
for (let i = 0; i < keys.length; i++) {
|
|
6181
|
-
const key = keys[i];
|
|
6182
|
-
if (key !== 'RemoveAll') {
|
|
6183
|
-
delete globalThis[key];
|
|
6184
|
-
}
|
|
6185
|
-
}
|
|
6410
|
+
}
|
|
6411
|
+
onLevelChange(callback){
|
|
6412
|
+
this.__Battery__.addEventListener("levelchange",callback);
|
|
6186
6413
|
return this;
|
|
6187
6414
|
}
|
|
6188
|
-
}
|
|
6415
|
+
}
|
|
6416
|
+
const useBattery=()=>new ZikoUseBattery();
|
|
6417
|
+
|
|
6418
|
+
class ZikoUseGeolocation{
|
|
6419
|
+
constructor(){
|
|
6420
|
+
if(this.isSupported)this.#init();
|
|
6421
|
+
}
|
|
6422
|
+
async #init(){
|
|
6423
|
+
navigator.geolocation.getCurrentPosition(e=>this.__Geolocation__=e);
|
|
6424
|
+
}
|
|
6425
|
+
get isSupported(){
|
|
6426
|
+
return !!navigator.geolocation;
|
|
6427
|
+
}
|
|
6428
|
+
get current(){
|
|
6429
|
+
// Synchrouns Code
|
|
6430
|
+
return this.__Geolocation__;
|
|
6431
|
+
}
|
|
6432
|
+
}
|
|
6433
|
+
const useGeolocation=()=>new ZikoUseGeolocation();
|
|
6189
6434
|
|
|
6190
6435
|
// To do : remove old items
|
|
6191
6436
|
class ZikoUseStorage{
|
|
@@ -6272,6 +6517,7 @@ const useSuccesifKeys=(self,keys=[],callback=()=>{})=>{
|
|
|
6272
6517
|
const Use={
|
|
6273
6518
|
useStyle,
|
|
6274
6519
|
useTheme,
|
|
6520
|
+
useMediaQuery,
|
|
6275
6521
|
useBattery,
|
|
6276
6522
|
useGeolocation,
|
|
6277
6523
|
useEventEmitter,
|
|
@@ -6307,6 +6553,22 @@ const Use={
|
|
|
6307
6553
|
}
|
|
6308
6554
|
};
|
|
6309
6555
|
|
|
6556
|
+
const Reactivity={
|
|
6557
|
+
Events,
|
|
6558
|
+
Observer,
|
|
6559
|
+
Use,
|
|
6560
|
+
ExtractAll: function () {
|
|
6561
|
+
this.Events.ExtractAll();
|
|
6562
|
+
this.Observer.ExtractAll();
|
|
6563
|
+
this.Use.ExtractAll();
|
|
6564
|
+
},
|
|
6565
|
+
RemoveAll: function () {
|
|
6566
|
+
this.Events.RemoveAll();
|
|
6567
|
+
this.Observer.RemoveAll();
|
|
6568
|
+
this.Use.RemoveAll();
|
|
6569
|
+
}
|
|
6570
|
+
};
|
|
6571
|
+
|
|
6310
6572
|
class ZikoUIElement {
|
|
6311
6573
|
constructor(element,name="") {
|
|
6312
6574
|
this.target = globalThis.__Ziko__.__Config__.default.target||globalThis.document.body;
|
|
@@ -6529,15 +6791,18 @@ class ZikoUIElement {
|
|
|
6529
6791
|
const [names,values]=[Object.keys(name),Object.values(name)];
|
|
6530
6792
|
for(let i=0;i<names.length;i++){
|
|
6531
6793
|
if(values[i] instanceof Array)value[i] = values[i].join(" ");
|
|
6532
|
-
this
|
|
6533
|
-
|
|
6794
|
+
if(this?.attr[name[i]]!==value[i]){
|
|
6795
|
+
this.element.setAttribute(names[i], values[i]);
|
|
6796
|
+
Object.assign(this.cache.attributes, Object.fromEntries([[names[i], values[i]]]));
|
|
6797
|
+
}
|
|
6534
6798
|
}
|
|
6535
6799
|
}
|
|
6536
6800
|
else {
|
|
6537
6801
|
if(value instanceof Array)value = value.join(" ");
|
|
6538
|
-
this
|
|
6539
|
-
|
|
6540
|
-
|
|
6802
|
+
if(this?.attr[name]!==value){
|
|
6803
|
+
this.element.setAttribute(name, value);
|
|
6804
|
+
Object.assign(this.cache.attributes, Object.fromEntries([[name, value]]));
|
|
6805
|
+
}
|
|
6541
6806
|
}
|
|
6542
6807
|
return this;
|
|
6543
6808
|
}
|
|
@@ -6568,7 +6833,7 @@ class ZikoUIElement {
|
|
|
6568
6833
|
return this;*/
|
|
6569
6834
|
}
|
|
6570
6835
|
setId(id) {
|
|
6571
|
-
this.
|
|
6836
|
+
this.setAttr("id", id);
|
|
6572
6837
|
return this;
|
|
6573
6838
|
}
|
|
6574
6839
|
get id() {
|
|
@@ -6618,173 +6883,175 @@ class ZikoUIElement {
|
|
|
6618
6883
|
return this;
|
|
6619
6884
|
}
|
|
6620
6885
|
onPtrMove(...callbacks){
|
|
6621
|
-
if(!this.events.ptr)this.events.ptr =
|
|
6886
|
+
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
6622
6887
|
this.events.ptr.onMove(...callbacks);
|
|
6623
6888
|
return this;
|
|
6624
6889
|
}
|
|
6625
6890
|
onPtrDown(...callbacks){
|
|
6626
|
-
if(!this.events.ptr)this.events.ptr =
|
|
6891
|
+
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
6627
6892
|
this.events.ptr.onDown(...callbacks);
|
|
6628
6893
|
return this;
|
|
6629
6894
|
}
|
|
6630
6895
|
onPtrUp(...callbacks){
|
|
6631
|
-
if(!this.events.ptr)this.events.ptr =
|
|
6896
|
+
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
6632
6897
|
this.events.ptr.onUp(...callbacks);
|
|
6633
6898
|
return this;
|
|
6634
6899
|
}
|
|
6635
6900
|
onPtrEnter(...callbacks){
|
|
6636
|
-
if(!this.events.ptr)this.events.ptr =
|
|
6901
|
+
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
6637
6902
|
this.events.ptr.onEnter(...callbacks);
|
|
6638
6903
|
return this;
|
|
6639
6904
|
}
|
|
6640
6905
|
onPtrLeave(...callbacks){
|
|
6641
|
-
if(!this.events.ptr)this.events.ptr =
|
|
6906
|
+
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
6642
6907
|
this.events.ptr.onLeave(...callbacks);
|
|
6643
6908
|
return this;
|
|
6644
6909
|
}
|
|
6645
6910
|
onPtrOut(...callbacks){
|
|
6646
|
-
if(!this.events.ptr)this.events.ptr =
|
|
6911
|
+
if(!this.events.ptr)this.events.ptr = usePointerEvent(this);
|
|
6647
6912
|
this.events.ptr.onOut(...callbacks);
|
|
6648
6913
|
return this;
|
|
6649
6914
|
}
|
|
6650
6915
|
onMouseMove(...callbacks){
|
|
6651
|
-
if(!this.events.mouse)this.events.mouse =
|
|
6916
|
+
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
6652
6917
|
this.events.mouse.onMove(...callbacks);
|
|
6653
6918
|
return this;
|
|
6654
6919
|
}
|
|
6655
6920
|
onMouseDown(...callbacks){
|
|
6656
|
-
if(!this.events.mouse)this.events.mouse =
|
|
6921
|
+
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
6657
6922
|
this.events.mouse.onDown(...callbacks);
|
|
6658
6923
|
return this;
|
|
6659
6924
|
}
|
|
6660
6925
|
onMouseUp(...callbacks){
|
|
6661
|
-
if(!this.events.mouse)this.events.mouse =
|
|
6926
|
+
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
6662
6927
|
this.events.mouse.onUp(...callbacks);
|
|
6663
6928
|
return this;
|
|
6664
6929
|
}
|
|
6665
6930
|
onMouseEnter(...callbacks){
|
|
6666
|
-
if(!this.events.mouse)this.events.mouse =
|
|
6931
|
+
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
6667
6932
|
this.events.mouse.onEnter(...callbacks);
|
|
6668
6933
|
return this;
|
|
6669
6934
|
}
|
|
6670
6935
|
onMouseLeave(...callbacks){
|
|
6671
|
-
if(!this.events.mouse)this.events.mouse =
|
|
6936
|
+
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
6672
6937
|
this.events.mouse.onLeave(...callbacks);
|
|
6673
6938
|
return this;
|
|
6674
6939
|
}
|
|
6675
6940
|
onMouseOut(...callbacks){
|
|
6676
|
-
if(!this.events.mouse)this.events.mouse =
|
|
6941
|
+
if(!this.events.mouse)this.events.mouse = useMouseEvent(this);
|
|
6677
6942
|
this.events.mouse.onOut(...callbacks);
|
|
6678
6943
|
return this;
|
|
6679
6944
|
}
|
|
6680
6945
|
onWheel(...callbacks){
|
|
6681
|
-
if(!this.events.wheel)this.events.wheel =
|
|
6946
|
+
if(!this.events.wheel)this.events.wheel = useWheelEventnent(this);
|
|
6682
6947
|
this.events.wheel.onWheel(...callbacks);
|
|
6683
6948
|
return this;
|
|
6684
6949
|
}
|
|
6685
6950
|
onKeyDown(...callbacks){
|
|
6686
|
-
if(!this.events.key)this.events.key =
|
|
6951
|
+
if(!this.events.key)this.events.key = useKeyEvenent(this);
|
|
6687
6952
|
this.events.key.onDown(...callbacks);
|
|
6688
6953
|
return this;
|
|
6689
6954
|
}
|
|
6690
6955
|
onKeyPress(...callbacks){
|
|
6691
|
-
if(!this.events.key)this.events.key =
|
|
6956
|
+
if(!this.events.key)this.events.key = useKeyEvenent(this);
|
|
6692
6957
|
this.events.key.onPress(...callbacks);
|
|
6693
6958
|
return this;
|
|
6694
6959
|
}
|
|
6695
6960
|
onKeyUp(...callbacks){
|
|
6696
|
-
if(!this.events.key)this.events.key =
|
|
6961
|
+
if(!this.events.key)this.events.key = useKeyEvenent(this);
|
|
6697
6962
|
this.events.key.onUp(...callbacks);
|
|
6698
6963
|
return this;
|
|
6699
6964
|
}
|
|
6700
6965
|
onKeysDown({keys=[],callback}={}){
|
|
6701
|
-
if(!this.events.key)this.events.key =
|
|
6966
|
+
if(!this.events.key)this.events.key = useKeyEvenent(this);
|
|
6702
6967
|
this.events.key.handleSuccessifKeys({keys,callback});
|
|
6703
6968
|
return this;
|
|
6704
6969
|
}
|
|
6705
6970
|
onDragStart(...callbacks){
|
|
6706
|
-
if(!this.events.drag)this.events.drag =
|
|
6971
|
+
if(!this.events.drag)this.events.drag = useDragEvent(this);
|
|
6707
6972
|
this.events.drag.onStart(...callbacks);
|
|
6708
6973
|
return this;
|
|
6709
6974
|
}
|
|
6710
6975
|
onDrag(...callbacks){
|
|
6711
|
-
if(!this.events.drag)this.events.drag =
|
|
6976
|
+
if(!this.events.drag)this.events.drag = useDragEvent(this);
|
|
6712
6977
|
this.events.drag.onDrag(...callbacks);
|
|
6713
6978
|
return this;
|
|
6714
6979
|
}
|
|
6715
6980
|
onDragEnd(...callbacks){
|
|
6716
|
-
if(!this.events.drag)this.events.drag =
|
|
6981
|
+
if(!this.events.drag)this.events.drag = useDragEvent(this);
|
|
6717
6982
|
this.events.drag.onEnd(...callbacks);
|
|
6718
6983
|
return this;
|
|
6719
6984
|
}
|
|
6720
6985
|
onDrop(...callbacks){
|
|
6721
|
-
if(!this.events.drop)this.events.drop =
|
|
6986
|
+
if(!this.events.drop)this.events.drop = useDropEvent(this);
|
|
6722
6987
|
this.events.drop.onDrop(...callbacks);
|
|
6723
6988
|
return this;
|
|
6724
6989
|
}
|
|
6725
6990
|
onClick(...callbacks){
|
|
6726
|
-
if(!this.events.click)this.events.click =
|
|
6991
|
+
if(!this.events.click)this.events.click = useClickEventnt(this);
|
|
6727
6992
|
this.events.click.onClick(...callbacks);
|
|
6728
6993
|
return this;
|
|
6729
6994
|
}
|
|
6730
6995
|
onDbClick(...callbacks){
|
|
6731
|
-
if(!this.events.click)this.events.click =
|
|
6996
|
+
if(!this.events.click)this.events.click = useClickEventnt(this);
|
|
6732
6997
|
this.events.click.onDbClick(...callbacks);
|
|
6733
6998
|
return this;
|
|
6734
6999
|
}
|
|
6735
7000
|
onCopy(...callbacks){
|
|
6736
|
-
if(!this.events.clipboard)this.events.clipboard =
|
|
7001
|
+
if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
6737
7002
|
this.events.clipboard.onCopy(...callbacks);
|
|
6738
7003
|
return this;
|
|
6739
7004
|
}
|
|
6740
7005
|
onCut(...callbacks){
|
|
6741
|
-
if(!this.events.clipboard)this.events.clipboard =
|
|
7006
|
+
if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
6742
7007
|
this.events.clipboard.onCut(...callbacks);
|
|
6743
7008
|
return this;
|
|
6744
7009
|
}
|
|
6745
7010
|
onPaste(...callbacks){
|
|
6746
|
-
if(!this.events.clipboard)this.events.clipboard =
|
|
7011
|
+
if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
6747
7012
|
this.events.clipboard.onPaste(...callbacks);
|
|
6748
7013
|
return this;
|
|
6749
7014
|
}
|
|
6750
7015
|
onSelect(...callbacks){
|
|
6751
|
-
if(!this.events.clipboard)this.events.clipboard =
|
|
7016
|
+
if(!this.events.clipboard)this.events.clipboard = useClipboardEvent(this);
|
|
6752
7017
|
this.events.clipboard.onSelect(...callbacks);
|
|
6753
7018
|
return this;
|
|
6754
7019
|
}
|
|
6755
7020
|
onFocus(...callbacks){
|
|
6756
|
-
if(!this.events.focus)this.events.focus =
|
|
7021
|
+
if(!this.events.focus)this.events.focus = useFocusEvent(this);
|
|
6757
7022
|
this.events.focus.onFocus(...callbacks);
|
|
6758
7023
|
return this;
|
|
6759
7024
|
}
|
|
6760
7025
|
onBlur(...callbacks){
|
|
6761
|
-
if(!this.events.focus)this.events.focus =
|
|
7026
|
+
if(!this.events.focus)this.events.focus = useFocusEvent(this);
|
|
6762
7027
|
this.events.focus.onFocus(...callbacks);
|
|
6763
7028
|
return this;
|
|
6764
7029
|
}
|
|
6765
7030
|
on(event_name,...callbacks){
|
|
6766
|
-
if(!this.events.custom)this.events.custom =
|
|
7031
|
+
if(!this.events.custom)this.events.custom = useCustomEvent(this);
|
|
6767
7032
|
this.events.custom.on(event_name,...callbacks);
|
|
6768
7033
|
return this;
|
|
6769
7034
|
}
|
|
6770
7035
|
emit(event_name,detail={}){
|
|
6771
|
-
if(!this.events.custom)this.events.custom =
|
|
7036
|
+
if(!this.events.custom)this.events.custom = useCustomEvent(this);
|
|
6772
7037
|
this.events.custom.emit(event_name,detail);
|
|
6773
7038
|
return this;
|
|
6774
7039
|
}
|
|
6775
|
-
watchAttr(){
|
|
6776
|
-
|
|
7040
|
+
watchAttr(callback){
|
|
7041
|
+
if(!this.observer.attr)this.observer.attr = watchAttr(this,callback);
|
|
7042
|
+
return this;
|
|
6777
7043
|
}
|
|
6778
|
-
watchChildren(){
|
|
6779
|
-
|
|
7044
|
+
watchChildren(callback){
|
|
7045
|
+
if(!this.observer.children)this.observer.children = watchChildren(this,callback);
|
|
7046
|
+
return this;
|
|
6780
7047
|
}
|
|
6781
7048
|
watchSize(callback){
|
|
6782
|
-
if(!this.observer.resize)this.observer.resize =
|
|
7049
|
+
if(!this.observer.resize)this.observer.resize = watchSize(this,callback);
|
|
6783
7050
|
this.observer.resize.start();
|
|
6784
7051
|
return this;
|
|
6785
7052
|
}
|
|
6786
7053
|
watchIntersection(callback,config){
|
|
6787
|
-
if(!this.observer.intersection)this.observer.intersection =
|
|
7054
|
+
if(!this.observer.intersection)this.observer.intersection = watchIntersection(this,callback,config);
|
|
6788
7055
|
this.observer.intersection.start();
|
|
6789
7056
|
return this;
|
|
6790
7057
|
}
|
|
@@ -7190,20 +7457,20 @@ class ZikoUITextArea extends ZikoUIElement {
|
|
|
7190
7457
|
//import { debounce,throttle} from "../../Data/decorators.js";
|
|
7191
7458
|
|
|
7192
7459
|
class ZikoUIInput extends ZikoUIElement {
|
|
7193
|
-
constructor(value = "",datalist) {
|
|
7194
|
-
super();
|
|
7460
|
+
constructor(name , value = "",datalist) {
|
|
7461
|
+
super("input",name);
|
|
7195
7462
|
this.element = document.createElement("input");
|
|
7196
7463
|
Object.assign(this.events,{input:null});
|
|
7197
7464
|
this.setValue(value);
|
|
7198
7465
|
if(datalist)this.linkDatalist(datalist);
|
|
7199
7466
|
}
|
|
7200
7467
|
onInput(...callbacks){
|
|
7201
|
-
if(!this.events.input)this.events.input =
|
|
7468
|
+
if(!this.events.input)this.events.input = useInputEvent(this);
|
|
7202
7469
|
this.events.input.onInput(...callbacks);
|
|
7203
7470
|
return this;
|
|
7204
7471
|
}
|
|
7205
7472
|
onChange(...callbacks){
|
|
7206
|
-
if(!this.events.input)this.events.input =
|
|
7473
|
+
if(!this.events.input)this.events.input = useInputEvent(this);
|
|
7207
7474
|
this.events.input.onChange(...callbacks);
|
|
7208
7475
|
return this;
|
|
7209
7476
|
}
|
|
@@ -7266,7 +7533,7 @@ class ZikoUIInput extends ZikoUIElement {
|
|
|
7266
7533
|
}
|
|
7267
7534
|
class ZikoUIInputSearch extends ZikoUIInput {
|
|
7268
7535
|
constructor() {
|
|
7269
|
-
super();
|
|
7536
|
+
super("inputSearch");
|
|
7270
7537
|
this._setType("search");
|
|
7271
7538
|
this.Length = 0;
|
|
7272
7539
|
}
|
|
@@ -7303,7 +7570,7 @@ class ZikoUIInputSearch extends ZikoUIInput {
|
|
|
7303
7570
|
}
|
|
7304
7571
|
class ZikoUIInputNumber extends ZikoUIInput {
|
|
7305
7572
|
constructor(min, max ,step = 1) {
|
|
7306
|
-
super();
|
|
7573
|
+
super("inpuNumber");
|
|
7307
7574
|
this._setType("number");
|
|
7308
7575
|
this.setMin(min).setMax(max).setStep(step);
|
|
7309
7576
|
}
|
|
@@ -7325,14 +7592,14 @@ class ZikoUIInputNumber extends ZikoUIInput {
|
|
|
7325
7592
|
}
|
|
7326
7593
|
class ZikoUIInputSlider extends ZikoUIInputNumber {
|
|
7327
7594
|
constructor(val = 0, min = 0, max = 10, step = 1) {
|
|
7328
|
-
super();
|
|
7595
|
+
super("inputSlider");
|
|
7329
7596
|
this._setType("range");
|
|
7330
7597
|
this.setMin(min).setMax(max).setValue(val).setStep(step);
|
|
7331
7598
|
}
|
|
7332
7599
|
}
|
|
7333
7600
|
class ZikoUIInputColor extends ZikoUIInput {
|
|
7334
7601
|
constructor() {
|
|
7335
|
-
super();
|
|
7602
|
+
super("inputColor");
|
|
7336
7603
|
this._setType("color");
|
|
7337
7604
|
this.background(this.value);
|
|
7338
7605
|
this.onInput(() => this.background(this.value));
|
|
@@ -7340,37 +7607,37 @@ class ZikoUIInputColor extends ZikoUIInput {
|
|
|
7340
7607
|
}
|
|
7341
7608
|
class ZikoUIInputPassword extends ZikoUIInput {
|
|
7342
7609
|
constructor() {
|
|
7343
|
-
super();
|
|
7610
|
+
super("inputPassword");
|
|
7344
7611
|
this._setType("password");
|
|
7345
7612
|
}
|
|
7346
7613
|
}
|
|
7347
7614
|
class ZikoUIInputEmail extends ZikoUIInput {
|
|
7348
7615
|
constructor() {
|
|
7349
|
-
super();
|
|
7616
|
+
super("inputEmail");
|
|
7350
7617
|
this._setType("email");
|
|
7351
7618
|
}
|
|
7352
7619
|
}
|
|
7353
7620
|
class ZikoUIInputTime extends ZikoUIInput {
|
|
7354
7621
|
constructor() {
|
|
7355
|
-
super();
|
|
7622
|
+
super("inputTime");
|
|
7356
7623
|
this._setType("time");
|
|
7357
7624
|
}
|
|
7358
7625
|
}
|
|
7359
7626
|
class ZikoUIInputDate extends ZikoUIInput {
|
|
7360
7627
|
constructor() {
|
|
7361
|
-
super();
|
|
7628
|
+
super("inputDate");
|
|
7362
7629
|
this._setType("date");
|
|
7363
7630
|
}
|
|
7364
7631
|
}
|
|
7365
7632
|
class ZikoUIInputDateTime extends ZikoUIInput {
|
|
7366
7633
|
constructor() {
|
|
7367
|
-
super();
|
|
7634
|
+
super("inputDateTime");
|
|
7368
7635
|
this._setType("datetime-local");
|
|
7369
7636
|
}
|
|
7370
7637
|
}
|
|
7371
7638
|
class ZikoUIInputCheckbox extends ZikoUIInput {
|
|
7372
7639
|
constructor() {
|
|
7373
|
-
super();
|
|
7640
|
+
super("inputCheckbox");
|
|
7374
7641
|
this._setType("checkbox");
|
|
7375
7642
|
this.cursor("pointer");
|
|
7376
7643
|
}
|
|
@@ -7388,7 +7655,7 @@ class ZikoUIInputCheckbox extends ZikoUIInput {
|
|
|
7388
7655
|
}
|
|
7389
7656
|
class ZikoUIInputRadio extends ZikoUIInput {
|
|
7390
7657
|
constructor() {
|
|
7391
|
-
super();
|
|
7658
|
+
super("inputRadio");
|
|
7392
7659
|
this._setType("radio");
|
|
7393
7660
|
this.cursor("pointer");
|
|
7394
7661
|
}
|
|
@@ -7408,7 +7675,7 @@ class ZikoUIInputRadio extends ZikoUIInput {
|
|
|
7408
7675
|
|
|
7409
7676
|
class ZikoUIInputImage extends ZikoUIElement {
|
|
7410
7677
|
constructor(text = "File") {
|
|
7411
|
-
super();
|
|
7678
|
+
super("inputImage");
|
|
7412
7679
|
this._aux_element = btn(text).setTarget(this.Target);
|
|
7413
7680
|
this.element = document.createElement("input");
|
|
7414
7681
|
this.element.setAttribute("type", "file");
|
|
@@ -8927,69 +9194,361 @@ const preload=(url)=>{
|
|
|
8927
9194
|
} else {
|
|
8928
9195
|
throw new Error(`Failed to fetch data from ${url}. Status: ${xhr.status}`);
|
|
8929
9196
|
}
|
|
8930
|
-
};
|
|
8931
|
-
|
|
8932
|
-
async function fetchdom(url='https://github.com/zakarialaoui10'){
|
|
8933
|
-
const data=await fetch(url);
|
|
8934
|
-
const html=await data.text();
|
|
8935
|
-
const dom= new DOMParser().parseFromString(html,'text/xml');
|
|
8936
|
-
return dom.documentElement
|
|
8937
|
-
}
|
|
8938
|
-
function fetchdomSync(url='https://github.com/zakarialaoui10'){
|
|
8939
|
-
const data=preload(url);
|
|
8940
|
-
const dom= new DOMParser().parseFromString(data,'text/xml');
|
|
8941
|
-
return dom.documentElement;
|
|
8942
|
-
}
|
|
8943
|
-
|
|
8944
|
-
globalThis.fetchdom=fetchdom;
|
|
8945
|
-
globalThis.fetchdomSync=fetchdomSync;
|
|
8946
|
-
|
|
8947
|
-
const
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
return this;
|
|
9197
|
+
};
|
|
9198
|
+
|
|
9199
|
+
async function fetchdom(url='https://github.com/zakarialaoui10'){
|
|
9200
|
+
const data=await fetch(url);
|
|
9201
|
+
const html=await data.text();
|
|
9202
|
+
const dom= new DOMParser().parseFromString(html,'text/xml');
|
|
9203
|
+
return dom.documentElement
|
|
9204
|
+
}
|
|
9205
|
+
function fetchdomSync(url='https://github.com/zakarialaoui10'){
|
|
9206
|
+
const data=preload(url);
|
|
9207
|
+
const dom= new DOMParser().parseFromString(data,'text/xml');
|
|
9208
|
+
return dom.documentElement;
|
|
9209
|
+
}
|
|
9210
|
+
|
|
9211
|
+
globalThis.fetchdom=fetchdom;
|
|
9212
|
+
globalThis.fetchdomSync=fetchdomSync;
|
|
9213
|
+
|
|
9214
|
+
const Patterns={
|
|
9215
|
+
isDigit: /^\d+$/,
|
|
9216
|
+
isEmail: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
|
|
9217
|
+
isURL: /^(https?:\/\/)?([\w\-]+\.)+[\w\-]+(\/[\w\-./?%&=]*)?$/,
|
|
9218
|
+
isHexColor: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
|
|
9219
|
+
isIPv4: /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
|
|
9220
|
+
isMACAddress: /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/,
|
|
9221
|
+
isDate: /^\d{4}-\d{2}-\d{2}$/,
|
|
9222
|
+
};
|
|
9223
|
+
|
|
9224
|
+
class Str{
|
|
9225
|
+
constructor(string){
|
|
9226
|
+
this.string=string;
|
|
9227
|
+
}
|
|
9228
|
+
isDigit() {
|
|
9229
|
+
return Patterns.isDigit.test(this.string);
|
|
9230
|
+
}
|
|
9231
|
+
static isDigit(string){
|
|
9232
|
+
return new Str(string).isDigit();
|
|
9233
|
+
}
|
|
9234
|
+
isNumber() {
|
|
9235
|
+
return !isNaN(this.string);
|
|
9236
|
+
}
|
|
9237
|
+
static isNumber(string){
|
|
9238
|
+
return new Str(string).isNumber();
|
|
9239
|
+
}
|
|
9240
|
+
isUrl(){
|
|
9241
|
+
return Patterns.isURL.test(this.string);
|
|
9242
|
+
}
|
|
9243
|
+
static isUrl(string){
|
|
9244
|
+
return new Str(string).isUrl();
|
|
9245
|
+
}
|
|
9246
|
+
isHexColor(){
|
|
9247
|
+
return Patterns.isHexColor.test(this.string);
|
|
9248
|
+
}
|
|
9249
|
+
static isHexColor(string){
|
|
9250
|
+
return new Str(string).isHexColor();
|
|
9251
|
+
}
|
|
9252
|
+
isIPv4(){
|
|
9253
|
+
return Patterns.isIPv4.test(this.string);
|
|
9254
|
+
}
|
|
9255
|
+
static isIPv4(string){
|
|
9256
|
+
return new Str(string).isIPv4();
|
|
9257
|
+
}
|
|
9258
|
+
isDate(){
|
|
9259
|
+
return Patterns.isDate.test(this.string);
|
|
9260
|
+
}
|
|
9261
|
+
static isDate(string){
|
|
9262
|
+
return new Str(string).isDate();
|
|
9263
|
+
}
|
|
9264
|
+
isMACAddress(){
|
|
9265
|
+
return Patterns.isMACAddress.test(this.string);
|
|
9266
|
+
}
|
|
9267
|
+
static isMACAddress(string){
|
|
9268
|
+
return new Str(string).isMACAddress();
|
|
9269
|
+
}
|
|
9270
|
+
isPascalCase(){
|
|
9271
|
+
if (this.string.length === 0) return false;
|
|
9272
|
+
const PascalCasePattern = /^[A-Z][a-zA-Z0-9]*$/;
|
|
9273
|
+
return PascalCasePattern.test(this.string);
|
|
9274
|
+
}
|
|
9275
|
+
static isPascalCase(string){
|
|
9276
|
+
return new Str(string).isPascalCase();
|
|
9277
|
+
}
|
|
9278
|
+
isCamelCase() {
|
|
9279
|
+
if (this.string.length === 0) return false;
|
|
9280
|
+
const camelCasePattern = /^[a-z][a-zA-Z0-9]*$/;
|
|
9281
|
+
return camelCasePattern.test(this.string);
|
|
9282
|
+
}
|
|
9283
|
+
static isCamelCase(string){
|
|
9284
|
+
return new Str(string).isCamelCase();
|
|
9285
|
+
}
|
|
9286
|
+
isHyphenCase(){
|
|
9287
|
+
return this.string.split('-').length > 1;
|
|
9288
|
+
}
|
|
9289
|
+
static isHyphenCase(string){
|
|
9290
|
+
return new Str(string).isHyphenCase();
|
|
9291
|
+
}
|
|
9292
|
+
isSnakeCase(){
|
|
9293
|
+
return this.string.split('_').length > 1;
|
|
9294
|
+
}
|
|
9295
|
+
static isSnakeCase(string){
|
|
9296
|
+
return new Str(string).isSnakeCase();
|
|
9297
|
+
}
|
|
9298
|
+
isPalindrome(){
|
|
9299
|
+
const str=this.string.toLocaleLowerCase();
|
|
9300
|
+
let l=str.length,i;
|
|
9301
|
+
for(i=0;i<l/2;i++)if(str[i]!=str[l-i-1])return false;
|
|
9302
|
+
return true;
|
|
9303
|
+
}
|
|
9304
|
+
static isPalindrome(string){
|
|
9305
|
+
return new Str(string).isPalindrome();
|
|
9306
|
+
}
|
|
9307
|
+
static isAnagrams(word,words){
|
|
9308
|
+
word=word.split("").sort();
|
|
9309
|
+
words=words.split("").sort();
|
|
9310
|
+
return JSON.stringify(word)===JSON.stringify(words);
|
|
9311
|
+
}
|
|
9312
|
+
isIsogram(){
|
|
9313
|
+
return [...new Set(this.string.toLowerCase())].length===this.string.length;
|
|
9314
|
+
}
|
|
9315
|
+
static isIsogram(string){
|
|
9316
|
+
return new Str(string).isIsogram();
|
|
9317
|
+
}
|
|
9318
|
+
static camel2hyphencase(text) {
|
|
9319
|
+
return text.replace(/[A-Z]/g, match => '-' + match.toLowerCase());
|
|
9320
|
+
}
|
|
9321
|
+
static camel2snakecase(text) {
|
|
9322
|
+
return text.replace(/[A-Z]/g, match => '_' + match.toLowerCase());
|
|
9323
|
+
}
|
|
9324
|
+
static camel2pascalcase(text) {
|
|
9325
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
9326
|
+
}
|
|
9327
|
+
static camel2constantcase(text) {
|
|
9328
|
+
return text.replace(/[A-Z]/g, match => '_' + match).toUpperCase();
|
|
9329
|
+
}
|
|
9330
|
+
static pascal2snakecase(text) {
|
|
9331
|
+
return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match.toLowerCase() : match.toLowerCase());
|
|
9332
|
+
}
|
|
9333
|
+
static pascal2hyphencase(text) {
|
|
9334
|
+
return text.replace(/([A-Z])/g, (match, offset) => offset ? '-' + match.toLowerCase() : match.toLowerCase());
|
|
9335
|
+
}
|
|
9336
|
+
static pascal2camelcase(text) {
|
|
9337
|
+
return text.charAt(0).toLowerCase() + text.slice(1);
|
|
9338
|
+
}
|
|
9339
|
+
static pascal2constantcase(text) {
|
|
9340
|
+
return text.replace(/([A-Z])/g, (match, offset) => offset ? '_' + match : match).toUpperCase();
|
|
9341
|
+
}
|
|
9342
|
+
static snake2camelcase(text) {
|
|
9343
|
+
return text.replace(/(_\w)/g, match => match[1].toUpperCase());
|
|
9344
|
+
}
|
|
9345
|
+
static snake2hyphencase(text) {
|
|
9346
|
+
return text.replace(/_/g, "-");
|
|
9347
|
+
}
|
|
9348
|
+
static snake2pascalcase(text) {
|
|
9349
|
+
return text.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
9350
|
+
}
|
|
9351
|
+
static snake2constantcase(text) {
|
|
9352
|
+
return text.toUpperCase();
|
|
9353
|
+
}
|
|
9354
|
+
static hyphen2camelcase(text) {
|
|
9355
|
+
return text.replace(/-([a-z])/g, match => match[1].toUpperCase());
|
|
9356
|
+
}
|
|
9357
|
+
static hyphen2snakecase(text) {
|
|
9358
|
+
return text.replace(/-/g, '_');
|
|
9359
|
+
}
|
|
9360
|
+
static hyphen2pascalcase(text) {
|
|
9361
|
+
return text.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
9362
|
+
}
|
|
9363
|
+
static hyphen2constantcase(text) {
|
|
9364
|
+
return text.replace(/-/g, '_').toUpperCase();
|
|
9365
|
+
}
|
|
9366
|
+
static constant2camelcase(text) {
|
|
9367
|
+
return text.toLowerCase().replace(/_([a-z])/g, match => match[1].toUpperCase());
|
|
9368
|
+
}
|
|
9369
|
+
static constant2snakecase(text) {
|
|
9370
|
+
return text.toLowerCase();
|
|
9371
|
+
}
|
|
9372
|
+
static constant2pascalcase(text) {
|
|
9373
|
+
return text.toLowerCase().split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
9374
|
+
}
|
|
9375
|
+
static constant2hyphencase(text) {
|
|
9376
|
+
return text.toLowerCase().replace(/_/g, '-');
|
|
9377
|
+
}
|
|
9378
|
+
}
|
|
9379
|
+
const removeExtraSpace=str=>str.replace(/\s+/g,' ');
|
|
9380
|
+
const count=(str,value)=>str.split("").filter(x => x==value).length;
|
|
9381
|
+
const countWords=(str,value)=>str.split(" ").filter(x => x==value).length;
|
|
9382
|
+
const str=string=>new Str(string);
|
|
9383
|
+
|
|
9384
|
+
const Data={
|
|
9385
|
+
str,
|
|
9386
|
+
Str,
|
|
9387
|
+
parseXML,
|
|
9388
|
+
preload,
|
|
9389
|
+
markdown2html,
|
|
9390
|
+
adoc2html,
|
|
9391
|
+
csv2arr,
|
|
9392
|
+
csv2matrix,
|
|
9393
|
+
csv2object,
|
|
9394
|
+
csv2json,
|
|
9395
|
+
csv2sql,
|
|
9396
|
+
json2arr,
|
|
9397
|
+
json2csv,
|
|
9398
|
+
json2csvFile,
|
|
9399
|
+
json2yml,
|
|
9400
|
+
json2ymlFile,
|
|
9401
|
+
json2xml,
|
|
9402
|
+
json2xmlFile,
|
|
9403
|
+
svg2str,
|
|
9404
|
+
svg2ascii,
|
|
9405
|
+
svg2imgUrl,
|
|
9406
|
+
svg2img,
|
|
9407
|
+
ExtractAll: function () {
|
|
9408
|
+
const keys = Object.keys(this);
|
|
9409
|
+
for (let i = 0; i < keys.length; i++) {
|
|
9410
|
+
const key = keys[i];
|
|
9411
|
+
if (key !== 'ExtractAll' && key !== 'RemoveAll') {
|
|
9412
|
+
globalThis[key] = this[key];
|
|
9413
|
+
}
|
|
9414
|
+
}
|
|
9415
|
+
return this;
|
|
9416
|
+
},
|
|
9417
|
+
RemoveAll: function () {
|
|
9418
|
+
const keys = Object.keys(this);
|
|
9419
|
+
for (let i = 0; i < keys.length; i++) {
|
|
9420
|
+
const key = keys[i];
|
|
9421
|
+
if (key !== 'RemoveAll') {
|
|
9422
|
+
delete globalThis[key];
|
|
9423
|
+
}
|
|
9424
|
+
}
|
|
9425
|
+
return this;
|
|
9426
|
+
}
|
|
9427
|
+
};
|
|
9428
|
+
|
|
9429
|
+
// import svgRect from "./Elements/rect.js";
|
|
9430
|
+
// import svgCircle from "./Elements/circle.js";
|
|
9431
|
+
// import svgEllipse from "./Elements/ellipse.js";
|
|
9432
|
+
// import svgLine from "./Elements/line.js";
|
|
9433
|
+
// //import svgPath from "./Elements/path.js";
|
|
9434
|
+
// import svgPolygon from "./Elements/polygon.js";
|
|
9435
|
+
// import svgImage from "./Elements/image.js";
|
|
9436
|
+
// import svgText from "./Elements/text.js";
|
|
9437
|
+
// import svgGroupe from "./Elements/groupe.js";
|
|
9438
|
+
// import svgLink from "./Elements/link.js";
|
|
9439
|
+
// //import svgObject from "./Elements/foreignObject.js";
|
|
9440
|
+
// //import svgGrid from "./Elements/grid.js";
|
|
9441
|
+
|
|
9442
|
+
class ZikoUISvg extends ZikoUIElement {
|
|
9443
|
+
constructor(w=360,h=300) {
|
|
9444
|
+
super("svg","svg");
|
|
9445
|
+
//this.cache={};
|
|
9446
|
+
this.setAttr("width",w);
|
|
9447
|
+
this.setAttr("height",h);
|
|
9448
|
+
this.style({border:"1px black solid"});
|
|
9449
|
+
//this.view(-w/2,-h/2,w/2,h/2)
|
|
9450
|
+
this.view(-10,-10,10,10);
|
|
9451
|
+
}
|
|
9452
|
+
view(x1,y1,x2,y2){
|
|
9453
|
+
let width=Math.abs(x2-x1);
|
|
9454
|
+
let height=Math.abs(y2-y1);
|
|
9455
|
+
this.setAttr("viewBox",[x1,y1,width,height].join(" "));
|
|
9456
|
+
this.st.scaleY(-1);
|
|
9457
|
+
return this;
|
|
9458
|
+
}
|
|
9459
|
+
add(...svgElement){
|
|
9460
|
+
for(let i=0;i<svgElement.length;i++){
|
|
9461
|
+
this.element.appendChild(svgElement[i].element);
|
|
9462
|
+
this.items.push(svgElement[i]);
|
|
9463
|
+
}
|
|
9464
|
+
this.maintain();
|
|
9465
|
+
return this;
|
|
9466
|
+
}
|
|
9467
|
+
remove(...svgElement){
|
|
9468
|
+
for(let i=0;i<svgElement.length;i++){
|
|
9469
|
+
this.element.removeChild(svgElement[i].element);
|
|
9470
|
+
this.items=this.items.filter(n=>!svgElement);
|
|
9471
|
+
}
|
|
9472
|
+
this.maintain();
|
|
9473
|
+
return this;
|
|
9474
|
+
}
|
|
9475
|
+
// text(text,x,y){
|
|
9476
|
+
// let item=svgText(text,x,y);
|
|
9477
|
+
// this.element.appendChild(item.element);
|
|
9478
|
+
// item.x(x-item.element.getComputedTextLength()/2);
|
|
9479
|
+
// return item;
|
|
9480
|
+
// }
|
|
9481
|
+
// rect(x,y,w,h){
|
|
9482
|
+
// let item=svgRect(x,y,w,h);
|
|
9483
|
+
// this.add(item);
|
|
9484
|
+
// return item;
|
|
9485
|
+
// }
|
|
9486
|
+
// line(x1,y1,x2,y2){
|
|
9487
|
+
// let item=svgLine(x1,y1,x2,y2);
|
|
9488
|
+
// this.element.appendChild(item.element);
|
|
9489
|
+
// return item;
|
|
9490
|
+
// }
|
|
9491
|
+
// circle(cx,cy,r){
|
|
9492
|
+
// let item=svgCircle(cx,cy,r);
|
|
9493
|
+
// this.element.appendChild(item.element);
|
|
9494
|
+
// return item;
|
|
9495
|
+
// }
|
|
9496
|
+
// ellipse(cx,cy,rx,ry){
|
|
9497
|
+
// let item=svgEllipse(cx,cy,rx,ry);
|
|
9498
|
+
// this.element.appendChild(item.element);
|
|
9499
|
+
// return item;
|
|
9500
|
+
// }
|
|
9501
|
+
// polygon(X,Y){
|
|
9502
|
+
// let item=svgPolygon(X,Y);
|
|
9503
|
+
// this.element.appendChild(item.element);
|
|
9504
|
+
// item.addPoints(X,Y)
|
|
9505
|
+
// return item;
|
|
9506
|
+
// }
|
|
9507
|
+
// image(src,w,h,x,y){
|
|
9508
|
+
// let item=svgImage(src,w,h,x,y);
|
|
9509
|
+
// this.element.appendChild(item.element);
|
|
9510
|
+
// return item;
|
|
9511
|
+
// }
|
|
9512
|
+
mask(){
|
|
9513
|
+
|
|
9514
|
+
}
|
|
9515
|
+
toString(){
|
|
9516
|
+
return (new XMLSerializer()).serializeToString(this.element);
|
|
9517
|
+
}
|
|
9518
|
+
btoa(){
|
|
9519
|
+
return btoa(this.toString())
|
|
9520
|
+
}
|
|
9521
|
+
toImg(){
|
|
9522
|
+
return 'data:image/svg+xml;base64,'+this.btoa()
|
|
8987
9523
|
}
|
|
8988
|
-
|
|
9524
|
+
toImg2(){
|
|
9525
|
+
return "data:image/svg+xml;charset=utf8,"+this.toString().replaceAll("<","%3C").replaceAll(">","%3E").replaceAll("#","%23").replaceAll('"',"'");
|
|
9526
|
+
}
|
|
9527
|
+
}
|
|
9528
|
+
|
|
9529
|
+
const Svg =(w,h)=>new ZikoUISvg(w,h);
|
|
8989
9530
|
|
|
8990
9531
|
class ZikoSvgElement {
|
|
8991
|
-
constructor() {
|
|
8992
|
-
this.cache = {
|
|
9532
|
+
constructor(type) {
|
|
9533
|
+
this.cache = {
|
|
9534
|
+
type
|
|
9535
|
+
};
|
|
9536
|
+
}
|
|
9537
|
+
pos(x,y){
|
|
9538
|
+
return this.posX(x).posY(y);
|
|
9539
|
+
}
|
|
9540
|
+
posX(x){
|
|
9541
|
+
if(["circle","ellipse"].includes(this.cache.type))this.element.cx.baseVal.value=x;
|
|
9542
|
+
else this.element.x.baseVal.value=x;
|
|
9543
|
+
return this;
|
|
9544
|
+
}
|
|
9545
|
+
posY(y){
|
|
9546
|
+
if(["circle","ellipse"].includes(this.cache.type))this.element.cy.baseVal.value=y;
|
|
9547
|
+
else this.element.y.baseVal.value=y;
|
|
9548
|
+
return this;
|
|
9549
|
+
}
|
|
9550
|
+
translate(x,y){
|
|
9551
|
+
return this;
|
|
8993
9552
|
}
|
|
8994
9553
|
color({ stroke, fill }) {
|
|
8995
9554
|
this.element.setAttribute("stroke", stroke);
|
|
@@ -9058,32 +9617,24 @@ class ZikoSvgRectangle extends ZikoSvgElement{
|
|
|
9058
9617
|
|
|
9059
9618
|
class ZikoSvgCircle extends ZikoSvgElement{
|
|
9060
9619
|
constructor(cx,cy,r){
|
|
9061
|
-
super();
|
|
9620
|
+
super("circle");
|
|
9062
9621
|
this.element=document.createElementNS(
|
|
9063
9622
|
"http://www.w3.org/2000/svg",
|
|
9064
9623
|
"circle",
|
|
9065
9624
|
);
|
|
9066
|
-
this.
|
|
9067
|
-
}
|
|
9068
|
-
cx(cx){
|
|
9069
|
-
this.element.cx.baseVal.value=cx;
|
|
9070
|
-
return this;
|
|
9071
|
-
}
|
|
9072
|
-
cy(cy){
|
|
9073
|
-
this.element.cy.baseVal.value=cy;
|
|
9074
|
-
return this;
|
|
9625
|
+
this.pos(cx,cy).setR(r);
|
|
9075
9626
|
}
|
|
9076
|
-
|
|
9627
|
+
setR(r){
|
|
9077
9628
|
this.element.r.baseVal.value=r;
|
|
9078
9629
|
return this;
|
|
9079
9630
|
}
|
|
9080
|
-
get
|
|
9631
|
+
get r(){
|
|
9081
9632
|
return this.element.r.baseVal.value;
|
|
9082
9633
|
}
|
|
9083
|
-
get
|
|
9634
|
+
get cx(){
|
|
9084
9635
|
return this.element.cx.baseVal.value;
|
|
9085
9636
|
}
|
|
9086
|
-
get
|
|
9637
|
+
get cy(){
|
|
9087
9638
|
return this.element.cy.baseVal.value;
|
|
9088
9639
|
}
|
|
9089
9640
|
}
|
|
@@ -9091,26 +9642,18 @@ const svgCircle=(x,y,r)=>new ZikoSvgCircle(x,y,r);
|
|
|
9091
9642
|
|
|
9092
9643
|
class ZikoSvgEllipse extends ZikoSvgElement{
|
|
9093
9644
|
constructor(cx,cy,rx,ry){
|
|
9094
|
-
super();
|
|
9645
|
+
super("ellipse");
|
|
9095
9646
|
this.element=document.createElementNS(
|
|
9096
9647
|
"http://www.w3.org/2000/svg",
|
|
9097
9648
|
"ellipse",
|
|
9098
9649
|
);
|
|
9099
|
-
this.
|
|
9100
|
-
}
|
|
9101
|
-
cx(cx){
|
|
9102
|
-
this.element.cx.baseVal.value=cx;
|
|
9103
|
-
return this;
|
|
9650
|
+
this.pos(cx,cy).setRx(rx).setRy(ry);
|
|
9104
9651
|
}
|
|
9105
|
-
|
|
9106
|
-
this.element.cy.baseVal.value=cy;
|
|
9107
|
-
return this;
|
|
9108
|
-
}
|
|
9109
|
-
rx(rx){
|
|
9652
|
+
setRx(rx){
|
|
9110
9653
|
this.element.rx.baseVal.value=rx;
|
|
9111
9654
|
return this;
|
|
9112
9655
|
}
|
|
9113
|
-
|
|
9656
|
+
setRy(ry){
|
|
9114
9657
|
this.element.ry.baseVal.value=ry;
|
|
9115
9658
|
return this;
|
|
9116
9659
|
}
|
|
@@ -9145,6 +9688,67 @@ class ZikoSvgLine extends ZikoSvgElement{
|
|
|
9145
9688
|
}
|
|
9146
9689
|
const svgLine=(x1,y1,x2,y2)=>new ZikoSvgLine(x1,y1,x2,y2);
|
|
9147
9690
|
|
|
9691
|
+
class ZikoSvgPolyLine extends ZikoSvgElement{}
|
|
9692
|
+
const svgPolyLine=(X,Y)=>new ZikoSvgPolyLine(X,Y);
|
|
9693
|
+
|
|
9694
|
+
class ZikoSvgPath extends ZikoSvgElement{
|
|
9695
|
+
constructor(){
|
|
9696
|
+
super();
|
|
9697
|
+
this.element=document.createElementNS(
|
|
9698
|
+
"http://www.w3.org/2000/svg",
|
|
9699
|
+
"path",
|
|
9700
|
+
);
|
|
9701
|
+
this.path="";
|
|
9702
|
+
|
|
9703
|
+
}
|
|
9704
|
+
setPath(){
|
|
9705
|
+
this.element.setAttribute("d",this.path);
|
|
9706
|
+
return this;
|
|
9707
|
+
}
|
|
9708
|
+
clear(){
|
|
9709
|
+
this.path="";
|
|
9710
|
+
this.setPath();
|
|
9711
|
+
return this;
|
|
9712
|
+
}
|
|
9713
|
+
moveTo(x,y){
|
|
9714
|
+
this.path+=`M${x} ${y} `;
|
|
9715
|
+
this.setPath();
|
|
9716
|
+
return this;
|
|
9717
|
+
}
|
|
9718
|
+
lineTo(x,y){
|
|
9719
|
+
this.path+=`L${x} ${y} `;
|
|
9720
|
+
this.setPath();
|
|
9721
|
+
return this;
|
|
9722
|
+
}
|
|
9723
|
+
hr(x){
|
|
9724
|
+
this.path+=`H${x} `;
|
|
9725
|
+
this.setPath();
|
|
9726
|
+
return this;
|
|
9727
|
+
}
|
|
9728
|
+
vr(y){
|
|
9729
|
+
this.path+=`V${y} `;
|
|
9730
|
+
this.setPath();
|
|
9731
|
+
return this;
|
|
9732
|
+
}
|
|
9733
|
+
bezier(x1,y1,x2,y2,x,y){
|
|
9734
|
+
this.path+=`C ${x1} ${y1},${x2} ${y2},${x} ${y} `;
|
|
9735
|
+
this.setPath();
|
|
9736
|
+
return this;
|
|
9737
|
+
}
|
|
9738
|
+
quadratic(x1,y1,x,y){
|
|
9739
|
+
this.path+=`Q ${x1} ${y1} ${x} ${y} `;
|
|
9740
|
+
this.setPath();
|
|
9741
|
+
return this;
|
|
9742
|
+
}
|
|
9743
|
+
close(){
|
|
9744
|
+
this.path+="Z";
|
|
9745
|
+
this.setPath();
|
|
9746
|
+
return this;
|
|
9747
|
+
}
|
|
9748
|
+
}
|
|
9749
|
+
|
|
9750
|
+
const svgPath=()=>new ZikoSvgPath();
|
|
9751
|
+
|
|
9148
9752
|
class ZikoSvgPolygon extends ZikoSvgElement{
|
|
9149
9753
|
constructor(X=[],Y=[]){
|
|
9150
9754
|
super();
|
|
@@ -9155,6 +9759,7 @@ class ZikoSvgPolygon extends ZikoSvgElement{
|
|
|
9155
9759
|
"polygon",
|
|
9156
9760
|
);
|
|
9157
9761
|
this.element.setAttribute("points","");
|
|
9762
|
+
this.addPoints(X,Y);
|
|
9158
9763
|
}
|
|
9159
9764
|
addPoint(x,y){
|
|
9160
9765
|
let p=this.element.parentElement.createSVGPoint();
|
|
@@ -9175,6 +9780,31 @@ class ZikoSvgPolygon extends ZikoSvgElement{
|
|
|
9175
9780
|
}
|
|
9176
9781
|
const svgPolygon=(X,Y)=>new ZikoSvgPolygon(X,Y);
|
|
9177
9782
|
|
|
9783
|
+
class ZikoSvgText extends ZikoSvgElement{
|
|
9784
|
+
constructor(text,x,y){
|
|
9785
|
+
super();
|
|
9786
|
+
this.element=document.createElementNS(
|
|
9787
|
+
"http://www.w3.org/2000/svg",
|
|
9788
|
+
"text",
|
|
9789
|
+
);
|
|
9790
|
+
this.setText(text);
|
|
9791
|
+
this.x(x).y(y);
|
|
9792
|
+
}
|
|
9793
|
+
x(x){
|
|
9794
|
+
this.element.setAttribute("x",x);
|
|
9795
|
+
return this;
|
|
9796
|
+
}
|
|
9797
|
+
y(y){
|
|
9798
|
+
this.element.setAttribute("y",y);
|
|
9799
|
+
return this;
|
|
9800
|
+
}
|
|
9801
|
+
setText(text=""){
|
|
9802
|
+
this.element.textContent=text;
|
|
9803
|
+
return this;
|
|
9804
|
+
}
|
|
9805
|
+
}
|
|
9806
|
+
const svgText=(text,x,y)=>new ZikoSvgText(text,x,y);
|
|
9807
|
+
|
|
9178
9808
|
class ZikoSvgImage extends ZikoSvgElement{
|
|
9179
9809
|
constructor(src="",w="100%",h="100%",x=0,y=0){
|
|
9180
9810
|
super();
|
|
@@ -9207,30 +9837,36 @@ class ZikoSvgImage extends ZikoSvgElement{
|
|
|
9207
9837
|
}
|
|
9208
9838
|
const svgImage=(src,w,h,x,y)=>new ZikoSvgImage(src,w,h,x,y);
|
|
9209
9839
|
|
|
9210
|
-
class
|
|
9211
|
-
constructor(
|
|
9212
|
-
super();
|
|
9840
|
+
class ZikoSvgForeignObject extends ZikoSvgElement{
|
|
9841
|
+
constructor(x=0,y=0,w="100%",h="100%",...ZikoUIElement){
|
|
9842
|
+
super("foreignObject");
|
|
9843
|
+
this.items=[];
|
|
9213
9844
|
this.element=document.createElementNS(
|
|
9214
9845
|
"http://www.w3.org/2000/svg",
|
|
9215
|
-
"
|
|
9846
|
+
"foreignObject",
|
|
9216
9847
|
);
|
|
9217
|
-
this.
|
|
9218
|
-
this.
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9848
|
+
this.container=Flex().setTarget(this.element).vertical(0,0).size("auto","auto");
|
|
9849
|
+
this.container.st.scaleY(-1);
|
|
9850
|
+
this.posX(x).posY(y).width(w).height(h);
|
|
9851
|
+
}
|
|
9852
|
+
width(w){
|
|
9853
|
+
this.element.setAttribute("width",w);
|
|
9854
|
+
return this;
|
|
9223
9855
|
}
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9856
|
+
height(h){
|
|
9857
|
+
this.element.setAttribute("height",h);
|
|
9858
|
+
return this;
|
|
9227
9859
|
}
|
|
9228
|
-
|
|
9229
|
-
this.
|
|
9860
|
+
add(...ZikoUIElement){
|
|
9861
|
+
this.container.append(...ZikoUIElement);
|
|
9230
9862
|
return this;
|
|
9231
|
-
|
|
9863
|
+
}
|
|
9864
|
+
remove(...ZikoUIElement){
|
|
9865
|
+
this.container.append(...ZikoUIElement);
|
|
9866
|
+
return this;
|
|
9867
|
+
}
|
|
9232
9868
|
}
|
|
9233
|
-
const
|
|
9869
|
+
const svgObject=(x,y,r)=>new ZikoSvgForeignObject(x,y,r);
|
|
9234
9870
|
|
|
9235
9871
|
class ZikoSvgGroupe extends ZikoSvgElement{
|
|
9236
9872
|
constructor(...svgElement){
|
|
@@ -9253,108 +9889,49 @@ class ZikoSvgGroupe extends ZikoSvgElement{
|
|
|
9253
9889
|
remove(...svgElement){
|
|
9254
9890
|
for(let i=0;i<svgElement.length;i++){
|
|
9255
9891
|
this.element.removeChild(svgElement[i].element);
|
|
9256
|
-
this.items=this.items.filter(n
|
|
9892
|
+
this.items=this.items.filter(n=>n!=svgElement);
|
|
9257
9893
|
}
|
|
9258
9894
|
return this;
|
|
9259
9895
|
}
|
|
9260
9896
|
}
|
|
9261
9897
|
const svgGroupe=(...svgElement)=>new ZikoSvgGroupe(...svgElement);
|
|
9262
9898
|
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
this.
|
|
9272
|
-
this.
|
|
9273
|
-
this.style({border:"1px black solid"});
|
|
9274
|
-
//this.view(-w/2,-h/2,w/2,h/2)
|
|
9275
|
-
//this.view(-10,-10,10,10);
|
|
9276
|
-
//this.render();
|
|
9277
|
-
}
|
|
9278
|
-
view(x1,y1,x2,y2){
|
|
9279
|
-
let width=Math.abs(x2-x1);
|
|
9280
|
-
let height=Math.abs(y2-y1);
|
|
9281
|
-
//this.element.style.transform="scale("+Math.sign(x2-x1)+","+(-Math.sign(y2-y1))+")";
|
|
9282
|
-
this.setAttr("viewBox",[x1,y1,width,height].join(" "));
|
|
9283
|
-
//console.log({width:width,height:height})
|
|
9284
|
-
return this;
|
|
9285
|
-
|
|
9899
|
+
class ZikoSvgLink extends ZikoSvgElement{
|
|
9900
|
+
constructor(href,...svgElement){
|
|
9901
|
+
super();
|
|
9902
|
+
this.items=[];
|
|
9903
|
+
this.element=document.createElementNS(
|
|
9904
|
+
"http://www.w3.org/2000/svg",
|
|
9905
|
+
"a",
|
|
9906
|
+
);
|
|
9907
|
+
this.element.setAttribute("href",href);
|
|
9908
|
+
this.add(...svgElement);
|
|
9286
9909
|
}
|
|
9287
9910
|
add(...svgElement){
|
|
9288
9911
|
for(let i=0;i<svgElement.length;i++){
|
|
9289
9912
|
this.element.appendChild(svgElement[i].element);
|
|
9290
9913
|
this.items.push(svgElement[i]);
|
|
9291
9914
|
}
|
|
9292
|
-
|
|
9293
|
-
return
|
|
9915
|
+
if(svgElement.length===1)return svgElement[0]
|
|
9916
|
+
return svgElement;
|
|
9294
9917
|
}
|
|
9295
9918
|
remove(...svgElement){
|
|
9296
9919
|
for(let i=0;i<svgElement.length;i++){
|
|
9297
9920
|
this.element.removeChild(svgElement[i].element);
|
|
9298
|
-
this.items=this.items.filter(n
|
|
9921
|
+
this.items=this.items.filter(n=>n!=svgElement);
|
|
9299
9922
|
}
|
|
9300
|
-
this.maintain();
|
|
9301
9923
|
return this;
|
|
9302
9924
|
}
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
// }
|
|
9314
|
-
// line(x1,y1,x2,y2){
|
|
9315
|
-
// let item=svgLine(x1,y1,x2,y2);
|
|
9316
|
-
// this.element.appendChild(item.element);
|
|
9317
|
-
// return item;
|
|
9318
|
-
// }
|
|
9319
|
-
// circle(cx,cy,r){
|
|
9320
|
-
// let item=svgCircle(cx,cy,r);
|
|
9321
|
-
// this.element.appendChild(item.element);
|
|
9322
|
-
// return item;
|
|
9323
|
-
// }
|
|
9324
|
-
// ellipse(cx,cy,rx,ry){
|
|
9325
|
-
// let item=svgEllipse(cx,cy,rx,ry);
|
|
9326
|
-
// this.element.appendChild(item.element);
|
|
9327
|
-
// return item;
|
|
9328
|
-
// }
|
|
9329
|
-
// polygon(X,Y){
|
|
9330
|
-
// let item=svgPolygon(X,Y);
|
|
9331
|
-
// this.element.appendChild(item.element);
|
|
9332
|
-
// item.addPoints(X,Y)
|
|
9333
|
-
// return item;
|
|
9334
|
-
// }
|
|
9335
|
-
// image(src,w,h,x,y){
|
|
9336
|
-
// let item=svgImage(src,w,h,x,y);
|
|
9337
|
-
// this.element.appendChild(item.element);
|
|
9338
|
-
// return item;
|
|
9339
|
-
// }
|
|
9340
|
-
mask(){
|
|
9341
|
-
|
|
9342
|
-
}
|
|
9343
|
-
toString(){
|
|
9344
|
-
return (new XMLSerializer()).serializeToString(this.element);
|
|
9345
|
-
}
|
|
9346
|
-
btoa(){
|
|
9347
|
-
return btoa(this.toString())
|
|
9348
|
-
}
|
|
9349
|
-
toImg(){
|
|
9350
|
-
return 'data:image/svg+xml;base64,'+this.btoa()
|
|
9351
|
-
}
|
|
9352
|
-
toImg2(){
|
|
9353
|
-
return "data:image/svg+xml;charset=utf8,"+this.toString().replaceAll("<","%3C").replaceAll(">","%3E").replaceAll("#","%23").replaceAll('"',"'");
|
|
9354
|
-
}
|
|
9355
|
-
}
|
|
9356
|
-
|
|
9357
|
-
const Svg =(w,h)=>new ZikoUISvg(w,h);
|
|
9925
|
+
}
|
|
9926
|
+
const svgLink=(href,...svgElement)=>new ZikoSvgLink(href,...svgElement);
|
|
9927
|
+
|
|
9928
|
+
const svgGrid=(w,h,r=10,c=10)=>{
|
|
9929
|
+
let path=svgPath().fill("none").stroke("coral").strokeWidth(0.6);
|
|
9930
|
+
console.log({x:w/r,y:h/c});
|
|
9931
|
+
for(let i=0;i<w;i++) path.moveTo(0,i*w/r).hr(w);
|
|
9932
|
+
for(let j=0;j<h;j++) path.moveTo(j*h/c,0).vr(h);
|
|
9933
|
+
return path
|
|
9934
|
+
};
|
|
9358
9935
|
|
|
9359
9936
|
class ZikoUICanvas extends ZikoUIElement{
|
|
9360
9937
|
constructor(w,h){
|
|
@@ -9822,6 +10399,10 @@ const Graphics={
|
|
|
9822
10399
|
svgRect,
|
|
9823
10400
|
svgText,
|
|
9824
10401
|
svgGroupe,
|
|
10402
|
+
svgLink,
|
|
10403
|
+
svgGrid,
|
|
10404
|
+
svgObject,
|
|
10405
|
+
svgPath,
|
|
9825
10406
|
Canvas,
|
|
9826
10407
|
canvasArc,
|
|
9827
10408
|
canvasCircle,
|
|
@@ -9917,7 +10498,10 @@ const __UI__={};
|
|
|
9917
10498
|
const __Config__={
|
|
9918
10499
|
default:{
|
|
9919
10500
|
target:null,
|
|
9920
|
-
render:true
|
|
10501
|
+
render:true,
|
|
10502
|
+
math:{
|
|
10503
|
+
mode:"deg"
|
|
10504
|
+
}
|
|
9921
10505
|
},
|
|
9922
10506
|
setDefault:function(pairs){
|
|
9923
10507
|
const keys=Object.keys(pairs);
|
|
@@ -10039,7 +10623,7 @@ class ZikoUIApp extends ZikoUIFlex{
|
|
|
10039
10623
|
|
|
10040
10624
|
}
|
|
10041
10625
|
onHashChange(...callbacks){
|
|
10042
|
-
if(!this.events.hash)this.events.hash =
|
|
10626
|
+
if(!this.events.hash)this.events.hash = useHashEvent(this);
|
|
10043
10627
|
this.events.hash.onChange(...callbacks);
|
|
10044
10628
|
return this;
|
|
10045
10629
|
}
|
|
@@ -10052,8 +10636,7 @@ const Ziko={
|
|
|
10052
10636
|
UI: UI$1,
|
|
10053
10637
|
Time,
|
|
10054
10638
|
Graphics,
|
|
10055
|
-
|
|
10056
|
-
Use,
|
|
10639
|
+
Reactivity,
|
|
10057
10640
|
Data,
|
|
10058
10641
|
SPA,
|
|
10059
10642
|
};
|
|
@@ -10076,8 +10659,7 @@ function ExtractAll(){
|
|
|
10076
10659
|
UI$1.ExtractAll();
|
|
10077
10660
|
Math$1.ExtractAll();
|
|
10078
10661
|
Time.ExtractAll();
|
|
10079
|
-
|
|
10080
|
-
Use.ExtractAll();
|
|
10662
|
+
Reactivity.ExtractAll();
|
|
10081
10663
|
Graphics.ExtractAll();
|
|
10082
10664
|
Data.ExtractAll();
|
|
10083
10665
|
return this;
|
|
@@ -10086,8 +10668,7 @@ function RemoveAll(){
|
|
|
10086
10668
|
UI$1.RemoveAll();
|
|
10087
10669
|
Math$1.RemoveAll();
|
|
10088
10670
|
Time.RemoveAll();
|
|
10089
|
-
|
|
10090
|
-
Use.RemoveAll();
|
|
10671
|
+
Reactivity.RemoveAll();
|
|
10091
10672
|
Graphics.RemoveAll();
|
|
10092
10673
|
Data.RemoveAll();
|
|
10093
10674
|
}
|
|
@@ -10108,7 +10689,6 @@ exports.Data = Data;
|
|
|
10108
10689
|
exports.E = E;
|
|
10109
10690
|
exports.EPSILON = EPSILON;
|
|
10110
10691
|
exports.Ease = Ease;
|
|
10111
|
-
exports.Events = Events;
|
|
10112
10692
|
exports.ExtractAll = ExtractAll;
|
|
10113
10693
|
exports.Fixed = Fixed;
|
|
10114
10694
|
exports.Flex = Flex;
|
|
@@ -10126,10 +10706,12 @@ exports.Nav = Nav;
|
|
|
10126
10706
|
exports.PI = PI;
|
|
10127
10707
|
exports.Permutation = Permutation;
|
|
10128
10708
|
exports.Random = Random;
|
|
10709
|
+
exports.Reactivity = Reactivity;
|
|
10129
10710
|
exports.RemoveAll = RemoveAll;
|
|
10130
10711
|
exports.SPA = SPA;
|
|
10131
10712
|
exports.Section = Section$1;
|
|
10132
10713
|
exports.Signal = Signal;
|
|
10714
|
+
exports.Str = Str;
|
|
10133
10715
|
exports.Svg = Svg;
|
|
10134
10716
|
exports.Table = Table;
|
|
10135
10717
|
exports.Tabs = Tabs;
|
|
@@ -10193,6 +10775,8 @@ exports.cos = cos;
|
|
|
10193
10775
|
exports.cosh = cosh;
|
|
10194
10776
|
exports.cot = cot;
|
|
10195
10777
|
exports.coth = coth;
|
|
10778
|
+
exports.count = count;
|
|
10779
|
+
exports.countWords = countWords;
|
|
10196
10780
|
exports.csc = csc;
|
|
10197
10781
|
exports.csv2arr = csv2arr;
|
|
10198
10782
|
exports.csv2json = csv2json;
|
|
@@ -10271,6 +10855,7 @@ exports.prod = prod;
|
|
|
10271
10855
|
exports.qrDecomposition = qrDecomposition;
|
|
10272
10856
|
exports.rad2deg = rad2deg;
|
|
10273
10857
|
exports.radio = radio;
|
|
10858
|
+
exports.removeExtraSpace = removeExtraSpace;
|
|
10274
10859
|
exports.round = round;
|
|
10275
10860
|
exports.search = search;
|
|
10276
10861
|
exports.sec = sec;
|
|
@@ -10283,6 +10868,7 @@ exports.sinh = sinh;
|
|
|
10283
10868
|
exports.slider = slider;
|
|
10284
10869
|
exports.sqrt = sqrt;
|
|
10285
10870
|
exports.sqrtn = sqrtn;
|
|
10871
|
+
exports.str = str;
|
|
10286
10872
|
exports.sub = sub;
|
|
10287
10873
|
exports.subSet = subSet;
|
|
10288
10874
|
exports.sum = sum;
|
|
@@ -10292,9 +10878,14 @@ exports.svg2imgUrl = svg2imgUrl;
|
|
|
10292
10878
|
exports.svg2str = svg2str;
|
|
10293
10879
|
exports.svgCircle = svgCircle;
|
|
10294
10880
|
exports.svgEllipse = svgEllipse;
|
|
10881
|
+
exports.svgGrid = svgGrid;
|
|
10295
10882
|
exports.svgGroupe = svgGroupe;
|
|
10296
10883
|
exports.svgImage = svgImage;
|
|
10297
10884
|
exports.svgLine = svgLine;
|
|
10885
|
+
exports.svgLink = svgLink;
|
|
10886
|
+
exports.svgObject = svgObject;
|
|
10887
|
+
exports.svgPath = svgPath;
|
|
10888
|
+
exports.svgPolyLine = svgPolyLine;
|
|
10298
10889
|
exports.svgPolygon = svgPolygon;
|
|
10299
10890
|
exports.svgRect = svgRect;
|
|
10300
10891
|
exports.svgText = svgText;
|
|
@@ -10305,10 +10896,42 @@ exports.textarea = textarea;
|
|
|
10305
10896
|
exports.timeTaken = timeTaken;
|
|
10306
10897
|
exports.time_memory_Taken = time_memory_Taken;
|
|
10307
10898
|
exports.ul = ul;
|
|
10899
|
+
exports.useBattery = useBattery;
|
|
10900
|
+
exports.useBluetooth = useBluetooth;
|
|
10901
|
+
exports.useChannel = useChannel;
|
|
10902
|
+
exports.useClickEvent = useClickEventnt;
|
|
10903
|
+
exports.useClipboardEvent = useClipboardEvent;
|
|
10904
|
+
exports.useCustomEvent = useCustomEvent;
|
|
10308
10905
|
exports.useDebounce = useDebounce;
|
|
10906
|
+
exports.useDragEvent = useDragEvent;
|
|
10907
|
+
exports.useDropEvent = useDropEvent;
|
|
10908
|
+
exports.useEventEmitter = useEventEmitter;
|
|
10909
|
+
exports.useFavIcon = useFavIcon;
|
|
10910
|
+
exports.useFocusEvent = useFocusEvent;
|
|
10911
|
+
exports.useGeolocation = useGeolocation;
|
|
10912
|
+
exports.useHashEvent = useHashEvent;
|
|
10913
|
+
exports.useInputEvent = useInputEvent;
|
|
10914
|
+
exports.useKeyEvent = useKeyEvenent;
|
|
10915
|
+
exports.useLocaleStorage = useLocaleStorage;
|
|
10916
|
+
exports.useMediaQuery = useMediaQuery;
|
|
10917
|
+
exports.useMouseEvent = useMouseEvent;
|
|
10918
|
+
exports.usePointerEvent = usePointerEvent;
|
|
10919
|
+
exports.useSessionStorage = useSessionStorage;
|
|
10920
|
+
exports.useStyle = useStyle;
|
|
10921
|
+
exports.useSuccesifKeys = useSuccesifKeys;
|
|
10922
|
+
exports.useTheme = useTheme;
|
|
10923
|
+
exports.useThread = useThread;
|
|
10309
10924
|
exports.useThrottle = useThrottle;
|
|
10925
|
+
exports.useTitle = useTitle;
|
|
10926
|
+
exports.useWheelEvent = useWheelEventnent;
|
|
10310
10927
|
exports.video = video;
|
|
10311
10928
|
exports.wait = wait;
|
|
10312
10929
|
exports.waitForUIElm = waitForUIElm;
|
|
10313
10930
|
exports.waitForUIElmSync = waitForUIElmSync;
|
|
10931
|
+
exports.watch = watch;
|
|
10932
|
+
exports.watchAttr = watchAttr;
|
|
10933
|
+
exports.watchChildren = watchChildren;
|
|
10934
|
+
exports.watchIntersection = watchIntersection;
|
|
10935
|
+
exports.watchScreen = watchScreen;
|
|
10936
|
+
exports.watchSize = watchSize;
|
|
10314
10937
|
exports.zeros = zeros;
|