sheetom 0.1.0-rc.9 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/index.cjs +260 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -13
- package/dist/index.d.ts +60 -13
- package/dist/index.js +260 -99
- package/dist/index.js.map +1 -1
- package/docs/api.md +42 -6
- package/engine-abi.json +3 -3
- package/package.json +19 -19
package/docs/api.md
CHANGED
|
@@ -42,13 +42,17 @@ readable and mutable. Assigning any `CSSRule.cssText` is a successful no-op.
|
|
|
42
42
|
|
|
43
43
|
`serialize()` is the SheetOM extension that emits reparsable CSS from current
|
|
44
44
|
state. This can differ deliberately from browser-facing `cssText` when CSS
|
|
45
|
-
Syntax end-of-input recovery preserved malformed source text.
|
|
45
|
+
Syntax end-of-input recovery preserved malformed source text. It remains
|
|
46
|
+
resilient when CSS text cannot exactly encode an imperative pending-shorthand
|
|
47
|
+
state and emits an opt-in `UNREPRESENTABLE_PENDING_SHORTHAND` diagnostic.
|
|
48
|
+
`serializeStrict()` throws `SheetOMSerializationError` for that state instead.
|
|
46
49
|
|
|
47
50
|
| Surface | Contract |
|
|
48
51
|
| --- | --- |
|
|
49
52
|
| `CSSStyleDeclaration.cssText` | Browser-compatible observable declarations, including recovery quirks. |
|
|
50
53
|
| `CSSRule.cssText` | Browser-compatible observable text for the current rule. |
|
|
51
54
|
| `CSSStyleSheet.serialize()` | Deterministic Reparsable Stylesheet Serialization with repairs confined to their declaration or rule. |
|
|
55
|
+
| `CSSStyleSheet.serializeStrict()` | Exact-only reparsable serialization; rejects states CSS text cannot faithfully represent. |
|
|
52
56
|
|
|
53
57
|
“Reparsable” guarantees syntactic reparse, no declaration/rule leakage, and
|
|
54
58
|
preservation of SheetOM’s valid semantic state. It is not URL sanitization,
|
|
@@ -94,6 +98,37 @@ throws `TypeError`. Invalid priorities, unsupported names, invalid grammars,
|
|
|
94
98
|
and embedded priority tokens are atomic no-ops. Diagnostics are optional and
|
|
95
99
|
never change those return values or mutations.
|
|
96
100
|
|
|
101
|
+
For compilers that have several mutations for one block, SheetOM adds
|
|
102
|
+
`applyMutations(operations)`. It crosses the engine boundary once while
|
|
103
|
+
executing the same ordered declaration state transitions:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
const results = rule.style.applyMutations([
|
|
107
|
+
{ kind: "set", property: "padding", value: "8px 16px" },
|
|
108
|
+
{ kind: "set", property: "width", value: "20px; color: red" },
|
|
109
|
+
{ kind: "remove", property: "padding-left" },
|
|
110
|
+
]);
|
|
111
|
+
|
|
112
|
+
// results[0] => { kind: "set", accepted: true, diagnostic: null }
|
|
113
|
+
// results[1] => { kind: "set", accepted: false, diagnostic: { ... } }
|
|
114
|
+
// results[2] => { kind: "remove", value: "16px" }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Results correspond by index. A set is `accepted: true` when `setProperty`
|
|
118
|
+
would apply it, including an accepted no-op or empty-value removal. Rejections
|
|
119
|
+
are atomic for that operation and return a diagnostic even when the sheet
|
|
120
|
+
diagnostic queue is disabled. When diagnostics are enabled, the same object is
|
|
121
|
+
also queued and can be drained once after the batch. Removes return the prior
|
|
122
|
+
observable value exactly like `removeProperty()`.
|
|
123
|
+
|
|
124
|
+
The batch itself is ordered, not globally atomic. A Resource Budget error
|
|
125
|
+
throws at the same operation as sequential calls and retains earlier commits.
|
|
126
|
+
The complete operation array is shape-checked before mutation and deliberately
|
|
127
|
+
requires string properties/priorities and string-or-null values rather than
|
|
128
|
+
performing arbitrary WebIDL coercion. Group operations by
|
|
129
|
+
`CSSStyleDeclaration`; do not concatenate them into CSS text, because that
|
|
130
|
+
would change duplicate, priority, invalid-recovery and removal semantics.
|
|
131
|
+
|
|
97
132
|
Parser support for modern or implementation-dependent grammar is described by
|
|
98
133
|
the release-versioned Value Capability Corpus. SheetOM uses checked-in
|
|
99
134
|
validators synchronously and never launches or contacts a browser at runtime.
|
|
@@ -151,11 +186,12 @@ read-only until a standards-defined mutable interface is implemented.
|
|
|
151
186
|
|
|
152
187
|
Required WebIDL arguments throw `TypeError`. Parse and hierarchy failures use
|
|
153
188
|
`DOMException` names matching browser APIs. `takeDiagnostics()` drains
|
|
154
|
-
SheetOM-only warnings when diagnostics were enabled;
|
|
155
|
-
empty array. `SheetOMDiagnostic.code` is the exported
|
|
156
|
-
`SheetOMDiagnosticCode` string union.
|
|
157
|
-
|
|
158
|
-
|
|
189
|
+
SheetOM-only mutation and serialization warnings when diagnostics were enabled;
|
|
190
|
+
otherwise it returns an empty array. `SheetOMDiagnostic.code` is the exported
|
|
191
|
+
`SheetOMDiagnosticCode` string union. Serialization recovery diagnostics expose
|
|
192
|
+
`conflictingLonghands`; mutation diagnostics retain their complete input string
|
|
193
|
+
until drained. Callers handling untrusted or unusually large inputs should
|
|
194
|
+
disable diagnostics or drain the queue promptly.
|
|
159
195
|
|
|
160
196
|
SheetOM does not implement DOM association, style-sheet collections, cascade,
|
|
161
197
|
selector matching, resolved/computed values, layout, fetching, or sanitizing.
|
package/engine-abi.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"abiVersion":
|
|
3
|
-
"sheetomVersion": "0.1.
|
|
4
|
-
"syntaxEngineSetSha256": "
|
|
2
|
+
"abiVersion": 4,
|
|
3
|
+
"sheetomVersion": "0.1.1",
|
|
4
|
+
"syntaxEngineSetSha256": "a0f10d0c1f0fe9e5bac9002e8ee548e7b5f6e2c7add1af3d953ae718d25cb37b"
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sheetom",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A browser-compatible mutable CSSOM for JavaScript runtimes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
"SECURITY.md"
|
|
49
49
|
],
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"@sheetom/native-darwin-arm64": "0.1.
|
|
52
|
-
"@sheetom/native-darwin-x64": "0.1.
|
|
53
|
-
"@sheetom/native-linux-arm-gnueabihf": "0.1.
|
|
54
|
-
"@sheetom/native-linux-arm-musleabihf": "0.1.
|
|
55
|
-
"@sheetom/native-linux-arm64-gnu": "0.1.
|
|
56
|
-
"@sheetom/native-linux-arm64-musl": "0.1.
|
|
57
|
-
"@sheetom/native-linux-ppc64-gnu": "0.1.
|
|
58
|
-
"@sheetom/native-linux-s390x-gnu": "0.1.
|
|
59
|
-
"@sheetom/native-linux-x64-gnu": "0.1.
|
|
60
|
-
"@sheetom/native-linux-x64-musl": "0.1.
|
|
61
|
-
"@sheetom/native-win32-arm64-msvc": "0.1.
|
|
62
|
-
"@sheetom/native-win32-ia32-msvc": "0.1.
|
|
63
|
-
"@sheetom/native-win32-x64-msvc": "0.1.
|
|
51
|
+
"@sheetom/native-darwin-arm64": "0.1.1",
|
|
52
|
+
"@sheetom/native-darwin-x64": "0.1.1",
|
|
53
|
+
"@sheetom/native-linux-arm-gnueabihf": "0.1.1",
|
|
54
|
+
"@sheetom/native-linux-arm-musleabihf": "0.1.1",
|
|
55
|
+
"@sheetom/native-linux-arm64-gnu": "0.1.1",
|
|
56
|
+
"@sheetom/native-linux-arm64-musl": "0.1.1",
|
|
57
|
+
"@sheetom/native-linux-ppc64-gnu": "0.1.1",
|
|
58
|
+
"@sheetom/native-linux-s390x-gnu": "0.1.1",
|
|
59
|
+
"@sheetom/native-linux-x64-gnu": "0.1.1",
|
|
60
|
+
"@sheetom/native-linux-x64-musl": "0.1.1",
|
|
61
|
+
"@sheetom/native-win32-arm64-msvc": "0.1.1",
|
|
62
|
+
"@sheetom/native-win32-ia32-msvc": "0.1.1",
|
|
63
|
+
"@sheetom/native-win32-x64-msvc": "0.1.1"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "tsdown",
|
|
@@ -134,15 +134,15 @@
|
|
|
134
134
|
"typecheck:scripts": "tsc --project tsconfig.scripts.json"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"@changesets/cli": "^
|
|
138
|
-
"@napi-rs/cli": "3.8.
|
|
137
|
+
"@changesets/cli": "^3.0.0",
|
|
138
|
+
"@napi-rs/cli": "3.8.6",
|
|
139
139
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
140
|
-
"@types/css-tree": "^2.
|
|
140
|
+
"@types/css-tree": "^3.2.0",
|
|
141
141
|
"@types/node": "^24.0.0",
|
|
142
142
|
"@vitest/browser-playwright": "^4.1.10",
|
|
143
143
|
"@webref/css": "8.7.1",
|
|
144
144
|
"ajv": "^8.20.0",
|
|
145
|
-
"binaryen": "
|
|
145
|
+
"binaryen": "132.0.0",
|
|
146
146
|
"css-tree": "3.2.1",
|
|
147
147
|
"esbuild": "0.28.2",
|
|
148
148
|
"fast-check": "^4.9.0",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"rollup": "4.62.4",
|
|
151
151
|
"tsdown": "^0.22.14",
|
|
152
152
|
"typedoc": "^0.28.20",
|
|
153
|
-
"typescript": "^
|
|
153
|
+
"typescript": "^6.0.3",
|
|
154
154
|
"vite": "8.2.1",
|
|
155
155
|
"vitest": "^4.1.10",
|
|
156
156
|
"webpack": "5.109.2"
|