dominus-cli 0.5.1 → 0.5.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.
@@ -434,6 +434,19 @@ local function applyProperty(instance, key, value)
434
434
  end)
435
435
  end
436
436
 
437
+ local RESERVED_KEYS = {
438
+ ClassName = true,
439
+ className = true,
440
+ Name = true,
441
+ name = true,
442
+ Children = true,
443
+ children = true,
444
+ properties = true,
445
+ Properties = true,
446
+ props = true,
447
+ Props = true,
448
+ }
449
+
437
450
  local function buildNode(spec, parent, animate)
438
451
  local className = spec.ClassName or spec.className or "Frame"
439
452
  local name = spec.Name or spec.name or className
@@ -441,20 +454,25 @@ local function buildNode(spec, parent, animate)
441
454
  local instance = Instance.new(className)
442
455
  instance.Name = name
443
456
 
444
- -- Apply all properties
457
+ -- Apply flattened top-level properties
445
458
  for key, value in spec do
446
- if
447
- key ~= "ClassName"
448
- and key ~= "className"
449
- and key ~= "Name"
450
- and key ~= "name"
451
- and key ~= "Children"
452
- and key ~= "children"
453
- then
459
+ if not RESERVED_KEYS[key] then
454
460
  applyProperty(instance, key, value)
455
461
  end
456
462
  end
457
463
 
464
+ -- Also accept a nested "properties" / "Properties" / "props" bag for convenience.
465
+ -- This lets callers group properties explicitly without the key being misread
466
+ -- as an instance property name.
467
+ local propBag = spec.properties or spec.Properties or spec.props or spec.Props
468
+ if type(propBag) == "table" then
469
+ for key, value in propBag do
470
+ if not RESERVED_KEYS[key] then
471
+ applyProperty(instance, key, value)
472
+ end
473
+ end
474
+ end
475
+
458
476
  -- Set parent after properties to avoid unnecessary layout computations
459
477
  instance.Parent = parent
460
478