lilact 0.27.3 → 0.28.1

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 (65) hide show
  1. package/bin/bundle.cjs +2 -2
  2. package/dist/lilact.development.js +312 -280
  3. package/dist/lilact.development.js.map +3 -3
  4. package/dist/lilact.development.min.js +39 -37
  5. package/dist/lilact.development.min.js.map +3 -3
  6. package/dist/lilact.production.min.js +39 -37
  7. package/docs/classes/accessories.ErrorBoundary.html +11 -11
  8. package/docs/classes/accessories.Suspense.html +10 -10
  9. package/docs/classes/components.Component.html +11 -11
  10. package/docs/classes/components.HTMLComponent.html +11 -11
  11. package/docs/classes/components.RootComponent.html +11 -11
  12. package/docs/functions/accessories.DragHandle.html +1 -1
  13. package/docs/functions/accessories.Spinner.html +1 -1
  14. package/docs/functions/components.cloneComponent.html +1 -1
  15. package/docs/functions/components.createComponent.html +1 -1
  16. package/docs/functions/components.createPortal.html +1 -1
  17. package/docs/functions/components.createRoot.html +1 -1
  18. package/docs/functions/components.memo.html +1 -1
  19. package/docs/functions/components.render.html +1 -1
  20. package/docs/functions/errors.scanBlockLabels.html +1 -1
  21. package/docs/functions/timers.animationFramePromise.html +3 -3
  22. package/docs/functions/timers.clearInterval.html +5 -3
  23. package/docs/functions/timers.clearTimeout.html +5 -3
  24. package/docs/functions/timers.grabTimers.html +4 -3
  25. package/docs/functions/timers.pauseTimers.html +5 -2
  26. package/docs/functions/timers.releaseTimers.html +4 -2
  27. package/docs/functions/timers.resetTimers.html +4 -2
  28. package/docs/functions/timers.resumeTimers.html +4 -2
  29. package/docs/functions/timers.setInterval.html +8 -6
  30. package/docs/functions/timers.setTimeout.html +8 -6
  31. package/docs/functions/timers.timeoutPromise.html +8 -149
  32. package/docs/static/demos/error-nested-1.jsx +11 -0
  33. package/docs/static/demos/error-nested-2.jsx +12 -0
  34. package/docs/static/demos/error-nested-3.jsx +12 -0
  35. package/docs/static/demos/error-nested-4.jsx +12 -0
  36. package/docs/static/demos/error-nested-5.jsx +12 -0
  37. package/docs/static/index.html +44 -38
  38. package/docs/static/lilact.development.js +312 -280
  39. package/docs/static/lilact.development.js.map +3 -3
  40. package/docs/static/lilact.development.min.js +39 -37
  41. package/docs/static/lilact.development.min.js.map +3 -3
  42. package/docs/static/lilact.production.min.js +39 -37
  43. package/docs/variables/accessories.SplitPane.html +1 -1
  44. package/docs/variables/components.cloneElement.html +1 -1
  45. package/docs/variables/errors.blocks_info.html +1 -1
  46. package/docs/variables/errors.error.html +1 -1
  47. package/examples/demos/error-nested-1.jsx +11 -0
  48. package/examples/demos/error-nested-2.jsx +12 -0
  49. package/examples/demos/error-nested-3.jsx +12 -0
  50. package/examples/demos/error-nested-4.jsx +12 -0
  51. package/examples/demos/error-nested-5.jsx +12 -0
  52. package/examples/index.html +44 -38
  53. package/examples/lilact.development.js +312 -280
  54. package/examples/lilact.development.js.map +3 -3
  55. package/examples/lilact.development.min.js +39 -37
  56. package/examples/lilact.development.min.js.map +3 -3
  57. package/examples/lilact.production.min.js +39 -37
  58. package/package.json +1 -1
  59. package/scripts/build.mjs +1 -1
  60. package/src/accessories.jsx +1 -4
  61. package/src/components.jsx +20 -15
  62. package/src/errors.jsx +5 -3
  63. package/src/lilact.jsx +4 -4
  64. package/src/run.jsx +1 -1
  65. package/src/timers.jsx +377 -207
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lilact",
3
- "version": "0.27.3",
3
+ "version": "0.28.1",
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/",
package/scripts/build.mjs CHANGED
@@ -104,7 +104,7 @@ await esbuild.build({
104
104
  platform: "browser",
105
105
 
106
106
  outfile: `dist/${outFile}`,
107
- target: "es2018",
107
+ target: "es2020",
108
108
  sourcemap: mode === "development",
109
109
 
110
110
  minify,
@@ -32,10 +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"
36
35
  import {Component} from "./components.jsx"
37
- import {emotion} from "./lilact.jsx"
38
- const {css,cx} = emotion;
39
36
 
40
37
  /**
41
38
  * A CSS-only loading spinner component.
@@ -375,7 +372,7 @@ export function DragHandle({
375
372
  role="button"
376
373
  tabIndex={0}
377
374
  style={{ ...style, touchAction: "none" }}
378
- className={cx(className, isDragging?"dragging":"")}
375
+ className={`${className} ${isDragging?"dragging":""}`}
379
376
  onPointerDown={onPointerDown}
380
377
  onPointerMove={onPointerMove}
381
378
  onPointerUp={onPointerUp}
@@ -283,12 +283,10 @@ if(DEBUG) {
283
283
  }
284
284
  }
285
285
 
286
-
287
286
  if( this?.portal ) {
288
287
  this.element = this.portal;
289
288
  }
290
289
 
291
-
292
290
  if(this.outlet?.constructor?.name!=='Array') {
293
291
  this.outlet = [this.outlet];
294
292
  }
@@ -422,8 +420,18 @@ if(DEBUG) {
422
420
  }
423
421
  }
424
422
  else if(this.entity==="select") {
425
- if(patch?.value!==this.element.value) {
426
- Lilact._setTimeout(()=>this.element.value=String(patch.value), 0);
423
+ if(typeof(patch.value)==='string') {
424
+ if(patch.value!==this.element.value) {
425
+ this.element.value=patch.value;
426
+ }
427
+ }
428
+ }
429
+ else if(this.entity==="option") {
430
+ if(this.container?.props?.value?.constructor?.name==='Array') {
431
+ patch.selected = this.container.props.value.indexOf(patch.value)!==-1;
432
+ }
433
+ else if(typeof(this.container?.props?.value)==='string') {
434
+ patch.selected = this.container.props.value===patch.value;
427
435
  }
428
436
  }
429
437
 
@@ -489,8 +497,11 @@ if(DEBUG) {
489
497
  }
490
498
  }
491
499
  else if(boolean_html_attributes_set.has(a)) { // not lower cased(al), as it is set as a js property
492
- this.element[a] = toBool(patch[a]);
493
- if(!this.element[a]) this.element.removeAttribute(a);
500
+ const v = toBool(patch[a]);
501
+
502
+ if(v!==this.element[a]) {
503
+ this.element[a] = v;
504
+ }
494
505
  }
495
506
  else if(a==='autoFocus') { // not lower cased(al), as it is set as a js property
496
507
  this.element['autofocus'] = toBool(patch[a]);
@@ -498,10 +509,8 @@ if(DEBUG) {
498
509
  else if(a==='htmlFor') { // not lower cased(al), as it is set as a js property
499
510
  this.element.setAttribute('for', patch[a]);
500
511
  }
501
- else {
502
- if(al!=='value' || ['input', 'textarea', 'select'].indexOf(this.entity)===-1) {
503
- this.element.setAttribute(al, patch[a]);
504
- }
512
+ else if(al!=='value' || ['input', 'textarea', 'select'].indexOf(this.entity)===-1) {
513
+ this.element.setAttribute(al, patch[a]);
505
514
  }
506
515
  }
507
516
  }
@@ -514,10 +523,6 @@ if(DEBUG) {
514
523
  this.element.onsubmit = undefined;
515
524
  }
516
525
 
517
- if(DEBUG) {
518
- //this.element.setAttribute('key', this.props.key);
519
- }
520
-
521
526
  this.updateElementClass(patch);
522
527
  }
523
528
 
@@ -1411,7 +1416,7 @@ export const length_css_attributes_set = new Set([
1411
1416
 
1412
1417
  /** @ignore */
1413
1418
  export const boolean_html_attributes_set = new
1414
- Set(["disabled", "readOnly", "required", "checked", "multiple",
1419
+ Set(["disabled", "readOnly", "required", "checked", "multiple", "selected",
1415
1420
  "hidden","open","loop","muted","controls","playsInline","allowFullScreen"]);
1416
1421
 
1417
1422
 
package/src/errors.jsx CHANGED
@@ -301,8 +301,9 @@ export function globalErrorHandler(eventOrError) {
301
301
  );
302
302
 
303
303
  const className = css(`
304
- background: linear-gradient(135deg, #fff2f2d4, #ffffffd4);
305
- backdrop-filter: blur(10px);
304
+ background: #fff;
305
+ text-shadow: 0 0 3px #fff;
306
+ -backdrop-filter: blur(20px);
306
307
  border: 1px solid rgba(255,255,255,.25);
307
308
  border-radius: 5px;
308
309
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
@@ -315,10 +316,11 @@ export function globalErrorHandler(eventOrError) {
315
316
  }
316
317
 
317
318
  code {
318
- border: 1px solid #0003;
319
+ background: #0001;
319
320
  overflow: auto;
320
321
  padding: 10px;
321
322
  display: block;
323
+ border-radius: 3px;
322
324
  }
323
325
  `);
324
326
 
package/src/lilact.jsx CHANGED
@@ -126,10 +126,10 @@ 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),
129
+ _setTimeout: globalThis.setTimeout.bind(globalThis),
130
+ _setInterval: globalThis.setInterval.bind(globalThis),
131
+ _clearTimeout: globalThis.clearTimeout.bind(globalThis),
132
+ _clearInterval: globalThis.clearInterval.bind(globalThis),
133
133
 
134
134
  }
135
135
 
package/src/run.jsx CHANGED
@@ -341,7 +341,7 @@ export function require(path) {
341
341
  * A completed module can be returned synchronously unless the caller
342
342
  * explicitly requests lazy loading.
343
343
  */
344
- if (module.loaded && !options.forceUpdate && !loadAsync) {
344
+ if (module.loaded && !options.forceUpdate) {
345
345
  return module.exports;
346
346
  }
347
347