lilact 0.27.1 → 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.
Files changed (79) hide show
  1. package/dist/lilact.development.js +413 -308
  2. package/dist/lilact.development.js.map +4 -4
  3. package/dist/lilact.development.min.js +59 -59
  4. package/dist/lilact.development.min.js.map +4 -4
  5. package/dist/lilact.production.min.js +58 -58
  6. package/docs/classes/accessories.ErrorBoundary.html +3 -3
  7. package/docs/classes/accessories.Suspense.html +2 -2
  8. package/docs/classes/components.Component.html +3 -3
  9. package/docs/classes/components.HTMLComponent.html +4 -4
  10. package/docs/classes/components.RootComponent.html +5 -5
  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.useEffect.html +1 -1
  22. package/docs/functions/hooks.useId.html +1 -1
  23. package/docs/functions/hooks.useImperativeHandle.html +1 -1
  24. package/docs/functions/hooks.useInsertionEffect.html +1 -1
  25. package/docs/functions/hooks.useLayoutEffect.html +1 -1
  26. package/docs/functions/hooks.useLocalStorage.html +1 -1
  27. package/docs/functions/hooks.useMemo.html +1 -1
  28. package/docs/functions/hooks.useReducer.html +1 -1
  29. package/docs/functions/hooks.useRef.html +1 -1
  30. package/docs/functions/hooks.useTransition.html +1 -1
  31. package/docs/functions/misc.Fragment.html +2 -2
  32. package/docs/functions/misc.Portal.html +2 -2
  33. package/docs/functions/misc.deepEqual.html +1 -1
  34. package/docs/functions/misc.findDOMNode.html +1 -1
  35. package/docs/functions/misc.forwardRef.html +1 -1
  36. package/docs/functions/misc.getComponentByPointer.html +1 -1
  37. package/docs/functions/misc.isAsync.html +1 -1
  38. package/docs/functions/misc.isClass.html +1 -1
  39. package/docs/functions/misc.isEmpty.html +1 -1
  40. package/docs/functions/misc.isError.html +1 -1
  41. package/docs/functions/misc.isThenable.html +1 -1
  42. package/docs/functions/misc.shallowEqual.html +1 -1
  43. package/docs/functions/misc.toBool.html +1 -1
  44. package/docs/functions/run.lazy.html +1 -1
  45. package/docs/functions/run.require.html +1 -1
  46. package/docs/functions/run.run.html +1 -1
  47. package/docs/functions/run.runScripts.html +1 -1
  48. package/docs/functions/timers.animationFramePromise.html +1 -1
  49. package/docs/functions/timers.clearInterval.html +1 -1
  50. package/docs/functions/timers.grabTimers.html +1 -1
  51. package/docs/functions/timers.releaseTimers.html +1 -1
  52. package/docs/functions/timers.timeoutPromise.html +14 -14
  53. package/docs/static/index.html +1 -1
  54. package/docs/static/lilact.development.js +413 -308
  55. package/docs/static/lilact.development.js.map +4 -4
  56. package/docs/static/lilact.development.min.js +59 -59
  57. package/docs/static/lilact.development.min.js.map +4 -4
  58. package/docs/static/lilact.production.min.js +58 -58
  59. package/docs/variables/components.cloneElement.html +1 -1
  60. package/docs/variables/misc.Children.html +10 -10
  61. package/docs/variables/misc.isValidElement.html +1 -1
  62. package/docs/variables/run.required_scripts.html +1 -1
  63. package/examples/index.html +1 -1
  64. package/examples/lilact.development.js +413 -308
  65. package/examples/lilact.development.js.map +4 -4
  66. package/examples/lilact.development.min.js +59 -59
  67. package/examples/lilact.development.min.js.map +4 -4
  68. package/examples/lilact.production.min.js +58 -58
  69. package/package.json +1 -1
  70. package/src/accessories.jsx +1 -1
  71. package/src/components.jsx +27 -16
  72. package/src/errors.jsx +310 -310
  73. package/src/expscan.js +2 -2
  74. package/src/hooks.jsx +52 -56
  75. package/src/lilact.jsx +7 -1
  76. package/src/misc.jsx +46 -18
  77. package/src/run.jsx +405 -290
  78. package/src/timers.jsx +2 -0
  79. package/src/transition.jsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lilact",
3
- "version": "0.27.1",
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
 
@@ -639,9 +639,9 @@ const renderErrorHandler = (c, e) =>
639
639
  }
640
640
 
641
641
  let stack_log = Array.prototype
642
- .map.call(stack, x => (`in ${typeof(x.component.displayName)==='function'?
643
- x.component.displayName():x.component.displayName}` ) )
644
- .join('\n');
642
+ .map.call(stack, x => (`in ${typeof(x.component.displayName)==='function'?
643
+ x.component.displayName():x.component.displayName}` ) )
644
+ .join('\n');
645
645
 
646
646
  e.componentStack = stack;
647
647
  e.componentStackLog = stack_log;
@@ -774,8 +774,8 @@ function doUpdates()
774
774
  - Layout effects (run immediately after insertion effects, still before paint).
775
775
  - Passive effects (useEffect)
776
776
 
777
- schedule them for after paint using requestAnimationFrame, typically:
778
- run the “after paint” work in the next frame or in a callback scheduled such that it runs after the browser has performed the paint.
777
+ schedule them for after paint using requestAnimationFrame, typically:
778
+ run the “after paint” work in the next frame or in a callback scheduled such that it runs after the browser has performed the paint.
779
779
 
780
780
 
781
781
  Current task: render → DOM updates → insertion effects → layout effects
@@ -971,15 +971,26 @@ export class Component
971
971
  * It can also be set for function components.
972
972
  * @type {string}
973
973
  */
974
- displayName()
975
- {
976
- if(this[CORE].entity?.displayName) return this[CORE].entity?.displayName;
977
- if(typeof(this[CORE].entity)==='string') return this[CORE].entity;
978
- if( isClass(this[CORE].entity) ) this[CORE].entity.constructor.name;
979
- if( typeof(this[CORE].entity)==='function' ) return this[CORE].entity.name;
974
+ displayName() {
975
+ const entity = this[CORE].entity;
976
+
977
+ if (entity?.displayName) {
978
+ return typeof entity.displayName === "function"
979
+ ? entity.displayName()
980
+ : entity.displayName;
981
+ }
982
+
983
+ if (typeof entity === "string") {
984
+ return entity;
985
+ }
986
+
987
+ if (typeof entity === "function") {
988
+ return entity.name || "Component";
989
+ }
990
+
980
991
  return "Component";
981
992
  }
982
-
993
+
983
994
  constructor(props)
984
995
  {
985
996
  this[CORE] = new ComponentCore(this, props);
@@ -992,11 +1003,11 @@ export class Component
992
1003
  */
993
1004
  forceUpdate(callback)
994
1005
  {
995
- Lilact.clearTimeout(Lilact.update_timeout);
1006
+ Lilact._clearTimeout(Lilact.update_timeout);
996
1007
 
997
1008
  Lilact.update_set.add(this[CORE].container || this[CORE]);
998
1009
  if(callback) Lilact.update_cbs.add(callback.bind(this));
999
- Lilact.update_timeout = Lilact.setTimeout( doUpdates, Lilact.update_interval_margin );
1010
+ Lilact.update_timeout = Lilact._setTimeout( doUpdates, Lilact.update_interval_margin );
1000
1011
  }
1001
1012
 
1002
1013
  /**
@@ -1385,7 +1396,7 @@ export const events_set = new Set([
1385
1396
  /** @ignore */
1386
1397
  export const capture_events_set = {};
1387
1398
  for (const x of events_set) {
1388
- capture_events_set[x+"capture"] = x;
1399
+ capture_events_set[x+"capture"] = x;
1389
1400
  }
1390
1401
 
1391
1402
  /** @ignore */