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