|
39 | 39 | "key": "a", // Required: String for KeyEquivalent (single character like "a" or special key like "return", "space", "upArrow") |
40 | 40 | "modifiers": ["command", "shift"] // Optional: Array of strings for modifiers (e.g., ["command", "shift"]), defaults to ["command"], must contain unique elements |
41 | 41 | }, |
| 42 | + "controlSize": "regular", // Optional: "mini", "small", "regular", "large", "extraLarge"; defaults to none (system default) |
42 | 43 | "disabled": false, // Optional: Boolean to disable user interaction |
43 | 44 | "accessibilityLabel": "View", // Optional: Accessibility label for VoiceOver |
44 | 45 | "accessibilityHint": "Base view", // Optional: Accessibility hint for VoiceOver |
@@ -506,6 +507,20 @@ struct View: ActionUIViewConstruction { |
506 | 507 | } |
507 | 508 | } |
508 | 509 |
|
| 510 | + // Validate controlSize |
| 511 | + if let controlSize = properties["controlSize"] { |
| 512 | + if let sizeStr = controlSize as? String { |
| 513 | + let validSizes = ["mini", "small", "regular", "large", "extraLarge"] |
| 514 | + if !validSizes.contains(sizeStr) { |
| 515 | + logger.log("Invalid controlSize '\(sizeStr)'; expected one of \(validSizes), ignoring", .warning) |
| 516 | + validatedProperties["controlSize"] = nil |
| 517 | + } |
| 518 | + } else { |
| 519 | + logger.log("Invalid type for controlSize: expected String, got \(type(of: controlSize)), ignoring", .warning) |
| 520 | + validatedProperties["controlSize"] = nil |
| 521 | + } |
| 522 | + } |
| 523 | + |
509 | 524 | if let columnWidthAny = properties["navigationSplitViewColumnWidth"] { |
510 | 525 | var validatedValue: Any? = nil |
511 | 526 |
|
@@ -665,6 +680,23 @@ struct View: ActionUIViewConstruction { |
665 | 680 | modifiedView = modifiedView.border(color, width: width) |
666 | 681 | } |
667 | 682 |
|
| 683 | + if let controlSize = properties["controlSize"] as? String { |
| 684 | + switch controlSize { |
| 685 | + case "mini": |
| 686 | + modifiedView = modifiedView.controlSize(.mini) |
| 687 | + case "small": |
| 688 | + modifiedView = modifiedView.controlSize(.small) |
| 689 | + case "regular": |
| 690 | + modifiedView = modifiedView.controlSize(.regular) |
| 691 | + case "large": |
| 692 | + modifiedView = modifiedView.controlSize(.large) |
| 693 | + case "extraLarge": |
| 694 | + modifiedView = modifiedView.controlSize(.extraLarge) |
| 695 | + default: |
| 696 | + break |
| 697 | + } |
| 698 | + } |
| 699 | + |
668 | 700 | if let shadow = properties["shadow"] as? [String: Any] { |
669 | 701 | let color = ColorHelper.resolveColor(shadow["color"] as? String) ?? .black |
670 | 702 | let radius = shadow.cgFloat(forKey: "radius") ?? 0.0 |
|
0 commit comments