lilact 0.27.2 → 0.27.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lilact",
3
- "version": "0.27.2",
3
+ "version": "0.27.3",
4
4
  "description": "A Little React/JSX Runtime Implementation for Browser",
5
5
  "repository": "github:arashkazemi/lilact",
6
6
  "homepage": "https://arashkazemi.github.io/lilact/",
@@ -32,7 +32,7 @@
32
32
  import { useEffect, useLayoutEffect, useMemo, useRef, useState, useImperativeHandle, useCallback } from "./hooks.jsx";
33
33
  import { Children, forwardRef, isThenable } from "./misc.jsx";
34
34
 
35
- import {setTimeout, clearTimeout} from "./timers.jsx"
35
+ //import {setTimeout, clearTimeout} from "./timers.jsx"
36
36
  import {Component} from "./components.jsx"
37
37
  import {emotion} from "./lilact.jsx"
38
38
  const {css,cx} = emotion;
@@ -423,7 +423,7 @@ if(DEBUG) {
423
423
  }
424
424
  else if(this.entity==="select") {
425
425
  if(patch?.value!==this.element.value) {
426
- Lilact.setTimeout(()=>this.element.value=String(patch.value), 0);
426
+ Lilact._setTimeout(()=>this.element.value=String(patch.value), 0);
427
427
  }
428
428
  }
429
429
 
@@ -1003,11 +1003,11 @@ export class Component
1003
1003
  */
1004
1004
  forceUpdate(callback)
1005
1005
  {
1006
- Lilact.clearTimeout(Lilact.update_timeout);
1006
+ Lilact._clearTimeout(Lilact.update_timeout);
1007
1007
 
1008
1008
  Lilact.update_set.add(this[CORE].container || this[CORE]);
1009
1009
  if(callback) Lilact.update_cbs.add(callback.bind(this));
1010
- Lilact.update_timeout = Lilact.setTimeout( doUpdates, Lilact.update_interval_margin );
1010
+ Lilact.update_timeout = Lilact._setTimeout( doUpdates, Lilact.update_interval_margin );
1011
1011
  }
1012
1012
 
1013
1013
  /**
package/src/expscan.js CHANGED
@@ -240,10 +240,10 @@ export function processImportExports(node, jsx)
240
240
  }
241
241
 
242
242
  let cjs = '';
243
- for(const s of import_alls) {
243
+ for(const s of star_imports) {
244
244
  cjs+=`const ${s} = require(${src},{requirer:module});\n`;
245
245
  }
246
- for(const s of star_imports) {
246
+ for(const s of import_alls) {
247
247
  cjs+=`const ${s} = require(${src},{requirer:module, checkExport: ['default']}).default;\n`;
248
248
  }
249
249
  if(Object.keys(imports).length) {
package/src/hooks.jsx CHANGED
@@ -294,8 +294,8 @@ export async function useLayoutEffect(effect, deps=undefined)
294
294
  hk.deps = deps;
295
295
  Lilact.layout_effects.add( async ()=>{ hk.cleanup = await effect(); });
296
296
 
297
- Lilact.clearTimeout( Lilact.effect_timeout );
298
- Lilact.setTimeout( Lilact.processEffects, 0 );
297
+ Lilact._clearTimeout( Lilact.effect_timeout );
298
+ Lilact._setTimeout( Lilact.processEffects, 0 );
299
299
  }
300
300
 
301
301
  /**
@@ -330,8 +330,8 @@ export async function useEffect(effect, deps=undefined)
330
330
  hk.deps = deps;
331
331
  Lilact.passive_effects.add( async ()=>{ hk.cleanup = await effect(); });
332
332
 
333
- Lilact.clearTimeout( Lilact.effect_timeout );
334
- Lilact.setTimeout( Lilact.processEffects, 0 );
333
+ Lilact._clearTimeout( Lilact.effect_timeout );
334
+ Lilact._setTimeout( Lilact.processEffects, 0 );
335
335
  }
336
336
 
337
337
 
@@ -367,8 +367,8 @@ export async function useInsertionEffect(effect, deps=undefined)
367
367
  hk.deps = deps;
368
368
  Lilact.insertion_effects.add( async ()=>{ hk.cleanup = await effect(); });
369
369
 
370
- Lilact.clearTimeout( Lilact.effect_timeout );
371
- Lilact.setTimeout( Lilact.processEffects, 0 );
370
+ Lilact._clearTimeout( Lilact.effect_timeout );
371
+ Lilact._setTimeout( Lilact.processEffects, 0 );
372
372
  }
373
373
 
374
374
 
package/src/lilact.jsx CHANGED
@@ -126,10 +126,14 @@ export const Lilact =
126
126
  redux,
127
127
  emotion,
128
128
 
129
+ _setTimeout: window.setTimeout.bind(window),
130
+ _setInterval: window.setInterval.bind(window),
131
+ _clearTimeout: window.clearTimeout.bind(window),
132
+ _clearInterval: window.clearInterval.bind(window),
133
+
129
134
  }
130
135
 
131
136
  Lilact.default = Lilact;
132
-
133
137
  export default Lilact;
134
138
 
135
139
  Lilact.importObjectPaths = {
@@ -144,6 +148,8 @@ globalThis.Fragment = Lilact.Fragment;
144
148
  globalThis.require = Lilact.require;
145
149
 
146
150
  document.addEventListener("DOMContentLoaded", () => {
151
+ Lilact.grabTimers();
152
+
147
153
  Lilact.runScripts().catch(error => {
148
154
  Lilact.globalErrorHandler?.(error);
149
155
  });
package/src/timers.jsx CHANGED
@@ -230,6 +230,7 @@ export function setInterval(callback, interval, ...args)
230
230
  export function clearTimeout(id)
231
231
  {
232
232
  if(all_timers[id]) all_timers[id][CLEARED] = true;
233
+ else _clearTimeout(id);
233
234
  }
234
235
 
235
236
  /**
@@ -240,6 +241,7 @@ export function clearTimeout(id)
240
241
  export function clearInterval(id)
241
242
  {
242
243
  if(all_timers[id]) all_timers[id][CLEARED] = true;
244
+ else _clearInterval(id);
243
245
  }
244
246
 
245
247
  /**
@@ -29,7 +29,7 @@
29
29
  */
30
30
  import Lilact from './lilact.jsx';
31
31
 
32
- import { setTimeout, clearTimeout } from "./timers.jsx"
32
+ //import { setTimeout, clearTimeout } from "./timers.jsx"
33
33
  import { Children } from "./misc.jsx"
34
34
  import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "./hooks.jsx"
35
35