Skip to content

Commit ae46bea

Browse files
committed
Support inline style declarations
1 parent c288b8e commit ae46bea

8 files changed

Lines changed: 900 additions & 1 deletion

File tree

‎.changeset/dom-inline-styles.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clack/ui': patch
3+
---
4+
5+
Add inline style declarations with shared camelCase, dashed, and setProperty access, supported CSS value parsing, and change notifications.

‎packages/ui/package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
},
3838
"dependencies": {
3939
"@bomb.sh/tty": "catalog:",
40-
"css-select": "^7.0.0"
40+
"css-select": "^7.0.0",
41+
"@standard-schema/spec": "^1.1.0",
42+
"hueful": "^0.8.1"
4143
},
4244
"devEngines": {
4345
"packageManager": {

‎packages/ui/src/dom.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { findElement, findElements, querySelector } from './css-select.ts';
44
import { asciiUppercase, asciiLowercase } from './ascii.ts';
55
import { NamedNodeMap } from './named-node-map.ts';
66
import { HTMLCollection } from './html-collection.ts';
7+
import { StyleDeclaration } from './style.ts';
78
import {
89
validateElementName,
910
validateElementNamespace,
@@ -493,6 +494,7 @@ export interface EventListener {
493494
export class Element extends Node {
494495
declare readonly ownerDocument: Document;
495496

497+
readonly style: StyleDeclaration;
496498
readonly localName: string;
497499
readonly nodeName: string;
498500
readonly namespaceURI: string | null;
@@ -507,6 +509,7 @@ export class Element extends Node {
507509
{ namespaceURI = HTML_NS, prefix = null }: Partial<ElementNamespace> = {},
508510
) {
509511
super(owner, notify);
512+
this.style = new StyleDeclaration(this.notify);
510513
this.localName = localName;
511514
this.namespaceURI = namespaceURI;
512515
this.prefix = prefix;

‎packages/ui/src/index.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ export {
1010
HTMLTitleElement,
1111
HTMLUnknownElement,
1212
} from './dom.ts';
13+
14+
export type {
15+
ColorValue,
16+
BorderWidthValue,
17+
FlexDirectionValue,
18+
DisplayValue,
19+
LengthValue,
20+
BorderStyleValue,
21+
} from './style.ts';

0 commit comments

Comments
 (0)