snice 3.10.0 → 3.10.2

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * snice v3.9.0
2
+ * snice v3.10.1
3
3
  * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
4
4
  * (c) 2024
5
5
  * Released under the MIT License.
@@ -1493,10 +1493,12 @@ var Snice = (function (exports) {
1493
1493
  * ConditionalIfPart handles <if> conditional rendering
1494
1494
  * Removes/inserts DOM nodes based on condition
1495
1495
  */
1496
+ // Sentinel value to distinguish "not yet set" from undefined
1497
+ const NOT_SET = Symbol('not-set');
1496
1498
  class ConditionalIfPart extends Part {
1497
1499
  constructor(ifElement) {
1498
1500
  super();
1499
- this.value = undefined;
1501
+ this.value = NOT_SET;
1500
1502
  this.fragment = null;
1501
1503
  this.ifElement = ifElement;
1502
1504
  this.ifElement.style.display = 'contents';
@@ -1538,7 +1540,7 @@ var Snice = (function (exports) {
1538
1540
  class ConditionalCasePart extends Part {
1539
1541
  constructor(caseElement) {
1540
1542
  super();
1541
- this.value = undefined;
1543
+ this.value = NOT_SET;
1542
1544
  this.childrenMap = new Map();
1543
1545
  this.fragments = new Map();
1544
1546
  this.defaultChild = null;
@@ -2579,6 +2581,10 @@ var Snice = (function (exports) {
2579
2581
  // Use explicit type or detect from initial value
2580
2582
  const typeToUse = propertyOptions.type || detectType(initialValue);
2581
2583
  switch (typeToUse) {
2584
+ case Boolean:
2585
+ // For boolean attributes, return "true" when true
2586
+ // (false is already handled above - returns null to remove attribute)
2587
+ return 'true';
2582
2588
  case Date:
2583
2589
  return value instanceof Date ? value.toISOString() : String(value);
2584
2590
  case BigInt:
@@ -3001,6 +3007,10 @@ var Snice = (function (exports) {
3001
3007
  this[EXPLICITLY_SET_PROPERTIES] = new Set();
3002
3008
  }
3003
3009
  this[EXPLICITLY_SET_PROPERTIES].add(propName);
3010
+ // For boolean attributes, normalize to "true" if they're empty
3011
+ if (propOptions.type === Boolean && attrValue === '') {
3012
+ this.setAttribute(attributeName, 'true');
3013
+ }
3004
3014
  this[propName] = parseAttributeValue(attrValue, propOptions);
3005
3015
  }
3006
3016
  }