lilact 0.31.7 → 0.31.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.
Files changed (47) hide show
  1. package/dist/lilact.development.js +18 -10
  2. package/dist/lilact.development.js.map +2 -2
  3. package/dist/lilact.development.min.js +26 -26
  4. package/dist/lilact.development.min.js.map +3 -3
  5. package/dist/lilact.production.min.js +26 -26
  6. package/docs/classes/accessories.ErrorBoundary.html +8 -8
  7. package/docs/classes/accessories.Suspense.html +7 -7
  8. package/docs/classes/components.Component.html +11 -11
  9. package/docs/classes/components.HTMLComponent.html +11 -11
  10. package/docs/classes/components.RootComponent.html +11 -11
  11. package/docs/functions/components.cloneComponent.html +1 -1
  12. package/docs/functions/components.createComponent.html +1 -1
  13. package/docs/functions/components.createPortal.html +1 -1
  14. package/docs/functions/components.createRoot.html +1 -1
  15. package/docs/functions/components.memo.html +1 -1
  16. package/docs/functions/components.render.html +1 -1
  17. package/docs/functions/hooks.startTransition.html +1 -1
  18. package/docs/functions/hooks.useActionState.html +1 -1
  19. package/docs/functions/hooks.useDebugValue.html +1 -1
  20. package/docs/functions/hooks.useDeferredValue.html +1 -1
  21. package/docs/functions/hooks.useImperativeHandle.html +1 -1
  22. package/docs/functions/hooks.useReducer.html +1 -1
  23. package/docs/functions/misc.deepEqual.html +1 -1
  24. package/docs/functions/misc.isAsync.html +1 -1
  25. package/docs/functions/misc.isClass.html +1 -1
  26. package/docs/functions/misc.isEmpty.html +1 -1
  27. package/docs/functions/misc.isError.html +1 -1
  28. package/docs/functions/misc.isThenable.html +1 -1
  29. package/docs/functions/misc.shallowEqual.html +1 -1
  30. package/docs/functions/misc.toBool.html +1 -1
  31. package/docs/static/lilact.development.js +18 -10
  32. package/docs/static/lilact.development.js.map +2 -2
  33. package/docs/static/lilact.development.min.js +26 -26
  34. package/docs/static/lilact.development.min.js.map +3 -3
  35. package/docs/static/lilact.production.min.js +26 -26
  36. package/docs/variables/components.cloneElement.html +1 -1
  37. package/examples/lilact.development.js +18 -10
  38. package/examples/lilact.development.js.map +2 -2
  39. package/examples/lilact.development.min.js +26 -26
  40. package/examples/lilact.development.min.js.map +3 -3
  41. package/examples/lilact.production.min.js +26 -26
  42. package/package.json +1 -1
  43. package/src/components.jsx +9 -5
  44. package/src/hooks.jsx +6 -7
  45. package/src/lilact.jsx +2 -2
  46. package/src/misc.jsx +4 -2
  47. package/src/symbols.jsx +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lilact",
3
- "version": "0.31.7",
3
+ "version": "0.31.9",
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/",
@@ -30,7 +30,7 @@
30
30
 
31
31
  import Lilact from './lilact.jsx';
32
32
 
33
- import { CORE, COMPONENT, TEXT, IS_ZOMBIE, IDX, CHILD_CLASS_ADDENDUM, MEMOIZED, LOCATION } from "./symbols.jsx"
33
+ import { CORE, COMPONENT, TEXT, IS_ZOMBIE, IDX, CHILD_CLASS_ADDENDUM, MEMOIZED, LOCATION, CLONED_STYLE } from "./symbols.jsx"
34
34
  import { shallowEqual, toBool, isClass, isThenable } from "./misc.jsx";
35
35
 
36
36
  import { PropTypes } from './proptypes.jsx';
@@ -298,7 +298,7 @@ class ComponentCache
298
298
  ex.cleanup();
299
299
  }
300
300
  else if(ex.element && !ex.portal) {
301
- ex.element.parentElement.removeChild(ex.element);
301
+ ex.element.parentElement?.removeChild?.(ex.element);
302
302
  }
303
303
  });
304
304
  });
@@ -401,6 +401,10 @@ class ComponentCore
401
401
  };
402
402
  }
403
403
 
404
+ if(next_props?.style && typeof next_props.style === 'object' && !next_props.style[CLONED_STYLE]) {
405
+ next_props.style = { ...next_props.style, [CLONED_STYLE]: true };
406
+ }
407
+
404
408
  if(this?.parent?.component?.context || this?.parent?.component?.getChildContext ) {
405
409
  this.context = { ...this.parent.component.context, ...this.parent.component.getChildContext?.() };
406
410
 
@@ -553,7 +557,7 @@ class ComponentCore
553
557
  this.props.ref(null);
554
558
  }
555
559
  else {
556
- this.props.current = null;
560
+ this.props.ref.current = null;
557
561
  }
558
562
  }
559
563
 
@@ -679,7 +683,7 @@ class ComponentCore
679
683
  }
680
684
  else {
681
685
  for(let p in this.props.style) {
682
- if( !patch.style.hasOwnProperty(p) ) {
686
+ if( p!==CLONED_STYLE && !patch?.style?.hasOwnProperty?.(p) ) {
683
687
  this.element.style[p] = "";
684
688
  }
685
689
  }
@@ -705,7 +709,7 @@ class ComponentCore
705
709
  else if(a==='autoFocus') { // not lower cased(al), as it is set as a js property
706
710
  this.element['autofocus'] = toBool(patch[a]);
707
711
  }
708
- else if(a==='htmlFor') { // not lower cased(al), as it is set as a js property
712
+ else if(a==='htmlFor' || a==='for') { // not lower cased(al), as it is set as a js property
709
713
  this.element.setAttribute('for', patch[a]);
710
714
  }
711
715
  else if(al!=='value' || ['input', 'textarea', 'select'].indexOf(this.entity)===-1) {
package/src/hooks.jsx CHANGED
@@ -288,8 +288,8 @@ export async function useLayoutEffect(effect, deps)
288
288
 
289
289
  if(hk?.cleanup) {
290
290
  await hk.cleanup();
291
- hk.cleanup = undefined;
292
- }
291
+ hk.cleanup = undefined;
292
+ }
293
293
 
294
294
  hk.deps = deps;
295
295
  Lilact.layout_effects.add( async ()=>{ hk.cleanup = await effect(); });
@@ -324,7 +324,7 @@ export async function useEffect(effect, deps)
324
324
 
325
325
  if(hk?.cleanup) {
326
326
  await hk.cleanup();
327
- hk.cleanup = undefined;
327
+ hk.cleanup = undefined;
328
328
  }
329
329
 
330
330
  hk.deps = deps;
@@ -361,7 +361,7 @@ export async function useInsertionEffect(effect, deps)
361
361
 
362
362
  if(hk?.cleanup) {
363
363
  await hk.cleanup();
364
- hk.cleanup = undefined;
364
+ hk.cleanup = undefined;
365
365
  }
366
366
 
367
367
  hk.deps = deps;
@@ -405,7 +405,7 @@ export function useMemo(factory,deps)
405
405
  }
406
406
 
407
407
  /**
408
- * React-compatible hook for managing an async/queued action and deriving state from it.
408
+ * Hook for managing an async/queued action and deriving state from it.
409
409
  *
410
410
  * @param {Function} action - The async/queued action function.
411
411
  * @param {any} initialState - Initial state for the hook.
@@ -427,8 +427,7 @@ export function useActionState(action, initialState)
427
427
  async ()=> {
428
428
  const form_data = new FormData(event.target, event.submitter);
429
429
  hk.state = await action(hk.state, form_data);
430
- },
431
- []
430
+ }
432
431
  );
433
432
 
434
433
  return false;
package/src/lilact.jsx CHANGED
@@ -160,7 +160,7 @@ if(DEBUG) {
160
160
  }
161
161
 
162
162
  if(DEBUG) {
163
- console.log(`Lilact (Version: ${Lilact.VERSION}) - Debug Mode`);
164
- console.log(`Copyright(C) 2024-2026 Arash Kazemi <contact.arash.kazemi@gmail.com>`);
163
+ console.info(`Lilact (Version: ${Lilact.VERSION}) - Debug Mode`);
164
+ console.info(`Copyright(C) 2024-2026 Arash Kazemi <contact.arash.kazemi@gmail.com>`);
165
165
  }
166
166
 
package/src/misc.jsx CHANGED
@@ -322,7 +322,6 @@ export function getComponentUnderPointer()
322
322
  const overlay = document.createElement('div');
323
323
  overlay.style.cssText =
324
324
  'position:fixed;inset:0;z-index:2147483647;cursor:crosshair;background:transparent;';
325
- document.body.appendChild(overlay);
326
325
 
327
326
  function click_handler(event) {
328
327
 
@@ -342,7 +341,10 @@ export function getComponentUnderPointer()
342
341
  return false;
343
342
  }
344
343
 
345
- window.addEventListener('click', click_handler, true);
344
+ setTimeout( ()=>{
345
+ document.body.appendChild(overlay);
346
+ window.addEventListener('click', click_handler, true);
347
+ }, 50);
346
348
 
347
349
  return pr;
348
350
  }
package/src/symbols.jsx CHANGED
@@ -40,6 +40,7 @@ export const [
40
40
  CHILD_CLASS_ADDENDUM,
41
41
  MEMOIZED,
42
42
  LAZY,
43
+ CLONED_STYLE,
43
44
 
44
45
  DUE,
45
46
  REPEAT,
@@ -59,6 +60,7 @@ export const [
59
60
  Symbol.for('LILACT:CHILD_CLASS_ADDENDUM'),
60
61
  Symbol.for('LILACT:MEMOIZED'),
61
62
  Symbol.for('LILACT:LAZY'),
63
+ Symbol.for('LILACT:CLONED_STYLE'),
62
64
 
63
65
  Symbol.for('LILACT:TIMERS:DUE'),
64
66
  Symbol.for('LILACT:TIMERS:REPEAT'),