lilact 0.27.3 → 0.28.0

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 (30) hide show
  1. package/dist/lilact.development.js +23 -17
  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/static/lilact.development.js +23 -17
  18. package/docs/static/lilact.development.js.map +2 -2
  19. package/docs/static/lilact.development.min.js +26 -26
  20. package/docs/static/lilact.development.min.js.map +3 -3
  21. package/docs/static/lilact.production.min.js +26 -26
  22. package/docs/variables/components.cloneElement.html +1 -1
  23. package/examples/lilact.development.js +23 -17
  24. package/examples/lilact.development.js.map +2 -2
  25. package/examples/lilact.development.min.js +26 -26
  26. package/examples/lilact.development.min.js.map +3 -3
  27. package/examples/lilact.production.min.js +26 -26
  28. package/package.json +1 -1
  29. package/src/components.jsx +20 -15
  30. package/src/run.jsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lilact",
3
- "version": "0.27.3",
3
+ "version": "0.28.0",
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/",
@@ -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
+ const s = String(patch.value);
424
+
425
+ if(s!==this.element.value) {
426
+ this.element.value=s;
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/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