@solidjs/web 2.0.0-experimental.1 → 2.0.0-experimental.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2016-2023 Ryan Carniato
3
+ Copyright (c) 2016-2025 Ryan Carniato
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/dev.cjs CHANGED
@@ -363,14 +363,17 @@ function toggleClassKey(node, key, value) {
363
363
  function classListToObject(classList) {
364
364
  if (Array.isArray(classList)) {
365
365
  const result = {};
366
- for (let i = 0, len = classList.length; i < len; i++) {
367
- const key = classList[i];
368
- if (typeof key === "object" && key != null) Object.assign(result, key);else if (key || key === 0) result[key] = true;
369
- }
366
+ flattenClassList(classList, result);
370
367
  return result;
371
368
  }
372
369
  return classList;
373
370
  }
371
+ function flattenClassList(list, result) {
372
+ for (let i = 0, len = list.length; i < len; i++) {
373
+ const item = list[i];
374
+ if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
375
+ }
376
+ }
374
377
  function assignProp(node, prop, value, prev, isSVG, skipRef) {
375
378
  let propAlias, forceProp;
376
379
  if (prop === "style") return style(node, value, prev), value;
@@ -398,7 +401,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
398
401
  } else if (prop.slice(0, 5) === "bool:") {
399
402
  setBoolAttribute(node, prop.slice(5), value);
400
403
  } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && (propAlias = getPropAlias(prop, node.tagName)) || Properties.has(prop)) {
401
- if (forceProp) prop = prop.slice(5);else node[propAlias || prop] = value;
404
+ if (forceProp) prop = prop.slice(5);
405
+ if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[propAlias || prop] = value;
402
406
  } else {
403
407
  const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
404
408
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
@@ -493,7 +497,7 @@ function normalize(value, current, multi, doNotUnwrap) {
493
497
  doNotUnwrap
494
498
  });
495
499
  if (doNotUnwrap && typeof value === "function") return value;
496
- if (multi && value != null && !Array.isArray(value)) value = [value];
500
+ if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
497
501
  if (Array.isArray(value)) {
498
502
  for (let i = 0, len = value.length; i < len; i++) {
499
503
  const item = value[i],
@@ -609,9 +613,8 @@ function createElementProxy(el, marker) {
609
613
  }
610
614
  });
611
615
  }
612
- function Dynamic(props) {
613
- const others = solidJs.omit(props, "component");
614
- const cached = solidJs.createMemo(() => props.component);
616
+ function createDynamic(component, props) {
617
+ const cached = solidJs.createMemo(component);
615
618
  return solidJs.createMemo(() => {
616
619
  const component = cached();
617
620
  switch (typeof component) {
@@ -619,15 +622,19 @@ function Dynamic(props) {
619
622
  Object.assign(component, {
620
623
  [solidJs.$DEVCOMP]: true
621
624
  });
622
- return solidJs.untrack(() => component(others));
625
+ return solidJs.untrack(() => component(props));
623
626
  case "string":
624
627
  const isSvg = SVGElements.has(component);
625
628
  const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
626
- spread(el, others, isSvg);
629
+ spread(el, props, isSvg);
627
630
  return el;
628
631
  }
629
632
  });
630
633
  }
634
+ function Dynamic(props) {
635
+ const others = solidJs.omit(props, "component");
636
+ return createDynamic(() => props.component, others);
637
+ }
631
638
 
632
639
  Object.defineProperty(exports, "ErrorBoundary", {
633
640
  enumerable: true,
@@ -694,6 +701,7 @@ exports.addEventListener = addEventListener;
694
701
  exports.assign = assign;
695
702
  exports.className = className;
696
703
  exports.clearDelegatedEvents = clearDelegatedEvents;
704
+ exports.createDynamic = createDynamic;
697
705
  exports.delegateEvents = delegateEvents;
698
706
  exports.dynamicProperty = dynamicProperty;
699
707
  exports.escape = escape;