feat: categorize constants and expose layout SDK via SuperIsland.constants#34
feat: categorize constants and expose layout SDK via SuperIsland.constants#34shobhit99 wants to merge 1 commit into
Conversation
…tants
- Restructure Constants.swift into three sections:
- User-Tweakable: timing/behaviour values (hudAutoDismissDelay,
hoverPeekDelay, notificationDisplayDuration,
notificationHoverFullExpandWindow, weatherRefreshInterval)
- Developer/SDK Layout Constants: island geometry (sizes, corner radii)
surfaced to extensions via SuperIsland.constants.layout
- Internal Renderer Constants: notch insets, animations, window bounds
(not exposed to extensions or users)
- Add injectConstants() in ExtensionJSRuntime to inject
SuperIsland.constants.layout into every extension's JS context
- Document SuperIsland.constants.layout in SUPER-ISLAND-EXTENSION-API.md
with a full property table and usage example
Closes #24
Co-authored-by: Shobhit Bhosure <shobhit99@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f767bd600
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| layout.setObject(Double(Constants.expandedSize.width), forKeyedSubscript: "expandedWidth" as NSString) | ||
| layout.setObject(Double(Constants.expandedSize.height), forKeyedSubscript: "expandedHeight" as NSString) | ||
| layout.setObject(Double(Constants.fullExpandedSize.width), forKeyedSubscript: "fullExpandedWidth" as NSString) | ||
| layout.setObject(Double(Constants.fullExpandedSize.height), forKeyedSubscript: "fullExpandedHeight" as NSString) |
There was a problem hiding this comment.
Publish runtime fullExpanded height for non-notch Macs
SuperIsland.constants.layout.fullExpandedHeight is always sourced from Constants.fullExpandedSize.height (180), but the host actually renders a taller full-expanded content area on non-notch presentations (AppState.contentSize(for:) adds 50 when !presentationHasNotch, see SuperIsland/App/AppState.swift around lines 871–876). Extensions that size to this SDK value will compute the wrong layout and leave a 50pt mismatch on non-notch machines.
Useful? React with 👍 / 👎.
| layout.setObject(Double(Constants.compactSize.width), forKeyedSubscript: "compactWidth" as NSString) | ||
| layout.setObject(Double(Constants.compactSize.height), forKeyedSubscript: "compactHeight" as NSString) |
There was a problem hiding this comment.
Derive compact layout constants from live notch metrics
The SDK exports compactWidth/compactHeight from Constants.compactSize, but compact geometry is runtime-dependent on notched Macs (compactIslandMetrics and contentSize(for: .compact) in SuperIsland/App/AppState.swift around lines 856–866 and 1057–1069). Because the exported values are static defaults, modules that rely on SuperIsland.constants.layout.compact* can be sized incorrectly (e.g., clipped when actual compact height is reduced).
Useful? React with 👍 / 👎.
Closes #24
Summary
Constants.swiftinto three sections: User-Tweakable, Developer/SDK Layout, and Internal RendererSuperIsland.constants.layoutto the JS SDK (11 layout properties: dimensions and corner radii for all island states)SuperIsland.constantsin SUPER-ISLAND-EXTENSION-API.md with property table + usage exampleGenerated with Claude Code