Skip to content

Commit 2297948

Browse files
committed
css-syntax-patches-for-csstree
1 parent cd5337b commit 2297948

8 files changed

Lines changed: 213 additions & 4 deletions

File tree

packages/css-syntax-patches-for-csstree/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Unreleased (patch)
44

55
- Update `@webref/css` to [`v8.5.7`](https://github.com/w3c/webref/releases/tag/%40webref%2Fcss%408.5.7)
6+
- Patch `@position-try` and `@page`
67

78
### 1.1.4
89

packages/css-syntax-patches-for-csstree/dist/index.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,19 @@
4646
},
4747
"page": {
4848
"descriptors": {
49+
"margin": "<'margin'>",
50+
"margin-bottom": "<'margin-bottom'>",
51+
"margin-left": "<'margin-left'>",
52+
"margin-right": "<'margin-right'>",
53+
"margin-top": "<'margin-top'>",
4954
"page-margin-safety": "none | clamp | add"
5055
}
56+
},
57+
"position-try": {
58+
"descriptors": {
59+
"position-anchor": "<'position-anchor'>",
60+
"position-area": "<'position-area'>"
61+
}
5162
}
5263
},
5364
"properties": {

packages/css-syntax-patches-for-csstree/patches/webref-over-csstree-atrules.json

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,61 @@
319319
},
320320
"page": {
321321
"descriptors": {
322+
"margin": {
323+
"type": "added",
324+
"comment": "",
325+
"syntax-b": "",
326+
"syntax-a": "<'margin'>",
327+
"syntax-m": "<'margin'>",
328+
"tests": {
329+
"passing": [],
330+
"failing": []
331+
}
332+
},
333+
"margin-bottom": {
334+
"type": "added",
335+
"comment": "",
336+
"syntax-b": "",
337+
"syntax-a": "<'margin-bottom'>",
338+
"syntax-m": "<'margin-bottom'>",
339+
"tests": {
340+
"passing": [],
341+
"failing": []
342+
}
343+
},
344+
"margin-left": {
345+
"type": "added",
346+
"comment": "",
347+
"syntax-b": "",
348+
"syntax-a": "<'margin-left'>",
349+
"syntax-m": "<'margin-left'>",
350+
"tests": {
351+
"passing": [],
352+
"failing": []
353+
}
354+
},
355+
"margin-right": {
356+
"type": "added",
357+
"comment": "",
358+
"syntax-b": "",
359+
"syntax-a": "<'margin-right'>",
360+
"syntax-m": "<'margin-right'>",
361+
"tests": {
362+
"passing": [],
363+
"failing": []
364+
}
365+
},
366+
"margin-top": {
367+
"type": "added",
368+
"comment": "",
369+
"syntax-b": "",
370+
"syntax-a": "<'margin-top'>",
371+
"syntax-m": "<'margin-top'>",
372+
"tests": {
373+
"passing": [],
374+
"failing": []
375+
}
376+
},
322377
"page-margin-safety": {
323378
"type": "added",
324379
"comment": "",
@@ -331,5 +386,31 @@
331386
}
332387
}
333388
}
389+
},
390+
"position-try": {
391+
"descriptors": {
392+
"position-anchor": {
393+
"type": "added",
394+
"comment": "",
395+
"syntax-b": "",
396+
"syntax-a": "<'position-anchor'>",
397+
"syntax-m": "<'position-anchor'>",
398+
"tests": {
399+
"passing": [],
400+
"failing": []
401+
}
402+
},
403+
"position-area": {
404+
"type": "added",
405+
"comment": "",
406+
"syntax-b": "",
407+
"syntax-a": "<'position-area'>",
408+
"syntax-m": "<'position-area'>",
409+
"tests": {
410+
"passing": [],
411+
"failing": []
412+
}
413+
}
414+
}
334415
}
335416
}

packages/css-syntax-patches-for-csstree/raw-data/webref-atrules.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,21 @@
152152
"bleed": {
153153
"syntax": "auto | <length>"
154154
},
155+
"margin": {
156+
"syntax": "<'margin'>"
157+
},
158+
"margin-bottom": {
159+
"syntax": "<'margin-bottom'>"
160+
},
161+
"margin-left": {
162+
"syntax": "<'margin-left'>"
163+
},
164+
"margin-right": {
165+
"syntax": "<'margin-right'>"
166+
},
167+
"margin-top": {
168+
"syntax": "<'margin-top'>"
169+
},
155170
"marks": {
156171
"syntax": "none | [ crop || cross ]"
157172
},
@@ -267,6 +282,12 @@
267282
"min-width": {
268283
"syntax": "<'min-width'>"
269284
},
285+
"position-anchor": {
286+
"syntax": "<'position-anchor'>"
287+
},
288+
"position-area": {
289+
"syntax": "<'position-area'>"
290+
},
270291
"right": {
271292
"syntax": "<'right'>"
272293
},

packages/css-syntax-patches-for-csstree/raw-data/webref-over-csstree-atrules.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,58 @@
159159
},
160160
"page": {
161161
"descriptors": {
162+
"margin": {
163+
"type": "added",
164+
"syntax-b": "",
165+
"syntax-a": "<'margin'>",
166+
"comment": ""
167+
},
168+
"margin-bottom": {
169+
"type": "added",
170+
"syntax-b": "",
171+
"syntax-a": "<'margin-bottom'>",
172+
"comment": ""
173+
},
174+
"margin-left": {
175+
"type": "added",
176+
"syntax-b": "",
177+
"syntax-a": "<'margin-left'>",
178+
"comment": ""
179+
},
180+
"margin-right": {
181+
"type": "added",
182+
"syntax-b": "",
183+
"syntax-a": "<'margin-right'>",
184+
"comment": ""
185+
},
186+
"margin-top": {
187+
"type": "added",
188+
"syntax-b": "",
189+
"syntax-a": "<'margin-top'>",
190+
"comment": ""
191+
},
162192
"page-margin-safety": {
163193
"type": "added",
164194
"syntax-b": "",
165195
"syntax-a": "none | clamp | add",
166196
"comment": ""
167197
}
168198
}
199+
},
200+
"position-try": {
201+
"descriptors": {
202+
"position-anchor": {
203+
"type": "added",
204+
"syntax-b": "",
205+
"syntax-a": "<'position-anchor'>",
206+
"comment": ""
207+
},
208+
"position-area": {
209+
"type": "added",
210+
"syntax-b": "",
211+
"syntax-a": "<'position-area'>",
212+
"comment": ""
213+
}
214+
}
169215
}
170216
}

packages/css-syntax-patches-for-csstree/scripts/generate-webref-sets.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,35 @@ export async function generate_webref_sets() {
7474

7575
// https://github.com/w3c/csswg-drafts/issues/13311
7676
types['voice-family-name'] = '<string> | <custom-ident>+';
77+
78+
assign_new_atrule_descriptor_definition(
79+
atrules,
80+
trim_at('position-try'),
81+
'position-anchor',
82+
'<\'position-anchor\'>',
83+
);
84+
85+
assign_new_atrule_descriptor_definition(
86+
atrules,
87+
trim_at('position-try'),
88+
'position-area',
89+
'<\'position-area\'>',
90+
);
91+
92+
[
93+
'margin',
94+
'margin-top',
95+
'margin-right',
96+
'margin-bottom',
97+
'margin-left',
98+
].forEach((prop) => {
99+
assign_new_atrule_descriptor_definition(
100+
atrules,
101+
trim_at('page'),
102+
prop,
103+
`<'${prop}'>`,
104+
);
105+
});
77106
}
78107

79108
const data = await css.listAll();

packages/css-syntax-patches-for-csstree/tests/e2e.test.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ for (const css_file of css_files) {
130130
continue;
131131
}
132132

133-
if (result.error.message.includes('Unknown at-rule descriptor')) {
134-
continue;
135-
}
136-
137133
await t.test(`(${path.basename(css_file) } - ${i}) ${decl}`, () => {
138134
throw result.error;
139135
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@position-try --custom-left {
2+
position-area: left;
3+
width: 100px;
4+
margin-right: 10px;
5+
}
6+
7+
@position-try --custom-bottom {
8+
top: anchor(bottom);
9+
justify-self: anchor-center;
10+
margin-top: 10px;
11+
position-area: none;
12+
}
13+
14+
@position-try --custom-right {
15+
left: calc(anchor(right) + 10px);
16+
align-self: anchor-center;
17+
width: 100px;
18+
position-area: none;
19+
}
20+
21+
@position-try --custom-bottom-right {
22+
position-area: bottom right;
23+
margin: 10px 0 0 10px;
24+
}

0 commit comments

Comments
 (0)