Skip to content

refactor: alignment to use string literals instead of magic numbers#42

Open
dreyfus92 wants to merge 3 commits into
mainfrom
refactor-alignment
Open

refactor: alignment to use string literals instead of magic numbers#42
dreyfus92 wants to merge 3 commits into
mainfrom
refactor-alignment

Conversation

@dreyfus92
Copy link
Copy Markdown
Member

closes: #3

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/clayterm@42

commit: 1571dde

Comment thread ops.ts
o += 4;

view.setUint32(o, (l.alignX ?? 0) | ((l.alignY ?? 0) << 8), true);
let alignX = l.alignX === "right" ? 1 : l.alignX === "center" ? 2 : 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, think we might benefit from a more generalized approach to string > enum conversion? like a typed resolveInt(property, value) util?

Copy link
Copy Markdown
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this from a DX perspective! Think we'll need to discuss how far we want to take the idea of papering over clay's lower-level layout concepts for a flexbox-friendly audience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use string literals for alignX/alignY instead of magic numbers

2 participants