linkedin / linkedin/css-blocks
Design consideration: Should all values for a global attribute be global?
- Dominant language
- TypeScript
- Stars
- 6.3k
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
The current code for global attributes lets individual values be marked global, but has no syntax for marking an entire attribute with all its values as global.
It's a little tricky because global attributes are often a forward declaration.
I think we should consider the following:
1. For states, the entire attribute should be marked as global with the syntax `@global [state|foo];` and doing so should not create any attribute values (including the universal value).
2. For states, disallow marking individual values as global.
3. If block B inherits from block A, marking an attribute as global, makes all inherited values global, but only when accessed through block B, those values from block A, would remain local.
4. If block B inherits a global attribute from block A, all values it adds to the global attribute should be global.
In other words:
```ts
class Attribute {
private _isGlobal: boolean;
get isGlobal(): boolean {
return this._isGlobal || this.base.isGlobal;
}
set isGlobal(v: true) {
this._isGlobal = v;
}
}
class AttrValue {
get isGlobal(): boolean {
return this.attribute.isGlobal;
}
}
Contributor guide
Research direction
The issue does not name implementation files, tests, or an entry point. First clarify the proposed global-attribute syntax and inheritance semantics with the maintainers, then identify the parser and attribute-model tests that would define completion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100