@webref/css 6.22.0 → 7.0.0-alpha

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.
Files changed (121) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +37 -22
  3. package/css.json +17754 -0
  4. package/index.js +2 -9
  5. package/package.json +1 -1
  6. package/CSS.json +0 -559
  7. package/SVG.json +0 -387
  8. package/compat.json +0 -784
  9. package/compositing.json +0 -178
  10. package/css-align.json +0 -559
  11. package/css-anchor-position.json +0 -1042
  12. package/css-animations-2.json +0 -377
  13. package/css-animations.json +0 -337
  14. package/css-backgrounds-4.json +0 -402
  15. package/css-backgrounds.json +0 -732
  16. package/css-borders.json +0 -1636
  17. package/css-box.json +0 -484
  18. package/css-break.json +0 -444
  19. package/css-cascade-6.json +0 -31
  20. package/css-cascade.json +0 -91
  21. package/css-color-5.json +0 -527
  22. package/css-color-6.json +0 -60
  23. package/css-color-adjust.json +0 -151
  24. package/css-color-hdr.json +0 -183
  25. package/css-color.json +0 -1759
  26. package/css-conditional-4.json +0 -23
  27. package/css-conditional-5.json +0 -505
  28. package/css-conditional.json +0 -50
  29. package/css-contain.json +0 -123
  30. package/css-content.json +0 -466
  31. package/css-counter-styles.json +0 -613
  32. package/css-display.json +0 -444
  33. package/css-easing.json +0 -149
  34. package/css-env.json +0 -109
  35. package/css-exclusions.json +0 -108
  36. package/css-extensions.json +0 -36
  37. package/css-flexbox.json +0 -259
  38. package/css-fonts-5.json +0 -385
  39. package/css-fonts.json +0 -1754
  40. package/css-forms.json +0 -263
  41. package/css-gaps.json +0 -544
  42. package/css-gcpm-4.json +0 -55
  43. package/css-gcpm.json +0 -138
  44. package/css-grid-3.json +0 -335
  45. package/css-grid.json +0 -824
  46. package/css-images-4.json +0 -367
  47. package/css-images-5.json +0 -43
  48. package/css-images.json +0 -373
  49. package/css-inline.json +0 -903
  50. package/css-layout-api.json +0 -21
  51. package/css-line-grid.json +0 -142
  52. package/css-link-params.json +0 -34
  53. package/css-lists.json +0 -337
  54. package/css-logical.json +0 -396
  55. package/css-masking.json +0 -717
  56. package/css-mixins.json +0 -52
  57. package/css-multicol.json +0 -252
  58. package/css-namespaces.json +0 -25
  59. package/css-nav.json +0 -121
  60. package/css-nesting.json +0 -16
  61. package/css-overflow-4.json +0 -428
  62. package/css-overflow-5.json +0 -223
  63. package/css-overflow.json +0 -379
  64. package/css-overscroll.json +0 -215
  65. package/css-page-floats.json +0 -296
  66. package/css-page.json +0 -382
  67. package/css-paint-api.json +0 -17
  68. package/css-position-4.json +0 -48
  69. package/css-position.json +0 -495
  70. package/css-properties-values-api.json +0 -39
  71. package/css-pseudo.json +0 -85
  72. package/css-regions.json +0 -59
  73. package/css-rhythm.json +0 -181
  74. package/css-round-display.json +0 -85
  75. package/css-ruby.json +0 -221
  76. package/css-scoping.json +0 -36
  77. package/css-scroll-anchoring.json +0 -43
  78. package/css-scroll-snap-2.json +0 -69
  79. package/css-scroll-snap.json +0 -643
  80. package/css-scrollbars.json +0 -82
  81. package/css-shadow-parts.json +0 -17
  82. package/css-shapes-2.json +0 -273
  83. package/css-shapes.json +0 -200
  84. package/css-size-adjust.json +0 -50
  85. package/css-sizing-4.json +0 -601
  86. package/css-sizing.json +0 -427
  87. package/css-speech.json +0 -985
  88. package/css-syntax.json +0 -263
  89. package/css-tables.json +0 -91
  90. package/css-text-4.json +0 -1516
  91. package/css-text-decor-4.json +0 -741
  92. package/css-text-decor.json +0 -337
  93. package/css-text.json +0 -670
  94. package/css-transforms-2.json +0 -329
  95. package/css-transforms.json +0 -213
  96. package/css-transitions-2.json +0 -47
  97. package/css-transitions.json +0 -119
  98. package/css-ui.json +0 -818
  99. package/css-values-5.json +0 -651
  100. package/css-values.json +0 -790
  101. package/css-variables.json +0 -29
  102. package/css-view-transitions-2.json +0 -151
  103. package/css-view-transitions.json +0 -76
  104. package/css-viewport.json +0 -43
  105. package/css-will-change.json +0 -64
  106. package/css-writing-modes.json +0 -256
  107. package/fill-stroke.json +0 -755
  108. package/filter-effects-2.json +0 -28
  109. package/filter-effects.json +0 -220
  110. package/html.json +0 -29
  111. package/mathml-core.json +0 -69
  112. package/mediaqueries-5.json +0 -915
  113. package/mediaqueries.json +0 -549
  114. package/motion.json +0 -303
  115. package/scroll-animations.json +0 -519
  116. package/selectors-5.json +0 -21
  117. package/selectors.json +0 -546
  118. package/svg-strokes.json +0 -59
  119. package/upgrade-insecure-requests.json +0 -28
  120. package/webvtt.json +0 -31
  121. package/webxr-dom-overlays.json +0 -16
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ Webref adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
7
7
  applied to data. A new major version is released whenever a breaking change is
8
8
  made to the data structure.
9
9
 
10
+ ## v7.0.0 - 2025-06
11
+
12
+ CSS extracts are now consolidated into a single file.
13
+
14
+ ### Breaking changes
15
+
16
+ - A single consolidated `css.json` file replaces CSS extracts per spec.
17
+
18
+ ### How to upgrade
19
+
20
+ In version 6, `listAll()` resolved with an object where the keys were spec shortnames, and the values mostly matched the structure of the consolidated object that the function now returns. On top of the consolidation itself, main differences are:
21
+ - Functions and types were merged in a `values` category in version 6, they now appear in separate `functions` and `types` categories.
22
+ - Functions and types that were scoped to another CSS feature appeared nested under that CSS feature in version 6. They now appear directly under `functions` and `types` with a `for` key that contains the name of the scoping feature.
23
+ - The shortname of the spec (or specs) that defines a feature is no longer readily available (but note the `href` key targets the defining spec). If you need the specs' shortnames, please [raise an issue](https://github.com/w3c/webref/issues) to describe your use case.
24
+ - The consolidation removes duplicates, merging extended definitions into a single feature. The definition from the latest spec level is used when a feature is defined in more than one level. If you need the definition from earlier levels, please [raise an issue](https://github.com/w3c/webref/issues) to describe your needs!
25
+ - Some of the possible values that a CSS feature could take appeared nested under that feature definition in a `values` key in version 6. Such values are no longer reported in the new version: they were confusing in any case because they did not cover the whole range of values that a feature could take, and could contain values that were not atomic keyword values. Values could be re-introduced when CSS specs are more systematic about them. In the meantime, you will need to parse the feature's syntax (the `value` key) to extract keyword values.
26
+
10
27
 
11
28
  ## v6.0.0 - 2022-11-28
12
29
 
package/README.md CHANGED
@@ -1,46 +1,61 @@
1
1
  # CSS definitions of the web platform
2
2
 
3
- This package contains CSS property definitions scraped from the latest versions of web platform specifications in [webref](https://github.com/w3c/webref), with fixes applied to ensure ([almost](#guarantees)) all CSS value definitions can be parsed with [CSSTree](https://github.com/csstree/csstree).
3
+ This package contains a consolidated list of CSS features defined across specs, scraped from the latest versions of web platform specifications in [webref](https://github.com/w3c/webref). Fixes are applied to ensure that [guarantees](#guarantees) hold, including the ability to parse syntaxes associated with CSS features with [CSSTree](https://github.com/csstree/csstree).
4
+
5
+ **Important:** If you're migrating from version 6, see the [changelog](CHANGELOG.md) for "How to upgrade" considerations.
4
6
 
5
7
  # API
6
8
 
7
- The async `listAll()` method resolves with an object where the keys are spec shortnames, and the values are the data for that spec. Example:
9
+ The async `listAll()` method resolves with an object that contains lists of features grouped by feature type: `atrules`, `functions`, `properties`, `selectors` and `types`. Example:
8
10
 
9
11
  ```js
10
12
  const css = require('@webref/css');
11
13
 
12
- const parsedFiles = await css.listAll();
13
- for (const [shortname, data] of Object.entries(parsedFiles)) {
14
- // do something with the json object
14
+ const { atrules, functions, properties, selectors, types } = await css.listAll();
15
+
16
+ for (const feature of functions) {
17
+ // do something with the object that describes the CSS function
15
18
  }
16
19
  ```
17
20
 
18
- CSS fragments that appear in the objects, in other words the contents of the `properties[].value`, `properties[].newValues`, `atrules[].value`, `atrules[].descriptors[].value`, `selectors[].value` and `values[].value` properties can be parsed with the [CSSTree Value Definition Syntax parser](https://github.com/csstree/csstree/blob/master/docs/definition-syntax.md#value-definition-syntax). Example:
21
+ Each CSS feature is described by:
22
+ - a `name` key that contains the name of the feature
23
+ - an `href` key that contains the URL (with a fragment) of the CSS spec that defines the feature
24
+
25
+ Many CSS features also have a `value` key that describes the syntax of the feature, as defined in the spec. This syntax can be parsed with the [CSSTree Value Definition Syntax parser](https://github.com/csstree/csstree/blob/master/docs/definition-syntax.md#value-definition-syntax). Example:
19
26
 
20
27
  ```js
21
28
  const css = require('@webref/css');
22
29
  const { definitionSyntax } = require('css-tree');
23
30
 
24
- const parsedFiles = await css.listAll();
25
- for (const [shortname, data] of Object.entries(parsedFiles)) {
26
- for (const property of data.properties) {
27
- if (property.value) {
28
- try {
29
- const ast = definitionSyntax.parse(property.value);
30
- // do something with the ast
31
- }
32
- catch {
33
- // one of the few value definitions that cannot yet be parsed by CSSTree
34
- }
35
- }
31
+ const { properties } = await css.listAll();
32
+ for (const property of properties) {
33
+ if (!property.value) {
34
+ continue;
36
35
  }
36
+ const ast = definitionSyntax.parse(property.value);
37
+ // do something with the abstract syntax tree
37
38
  }
38
39
  ```
39
40
 
41
+ Additional keys may be set depending on the type of the CSS feature. For example:
42
+
43
+ - At-rules have a `descriptors` key that contains the list of descriptors defined for the given at-rule.
44
+ - Functions and types that are scoped to a property or other feature have a `for` key that contains the name of the scoping property or other feature.
45
+ - Properties have a `styleDeclaration` key that contains the list of IDL attribute names that the property generates. A number of other keys may be set to describe the property's initial value, animation type and other parameters.
46
+
47
+ Additional notes:
48
+ - Type names are enclosed in `<>`. For example: `<frequency-percentage>`.
49
+ - When a feature is defined across different levels in the same spec series, the definition from the latest level is used.
50
+ - When a property is extended with new values in different specs, `href` links to the base definition and `value` is the union (using `|`) of the syntaxes of the base and extended definitions.
51
+ - When new descriptors are defined for an at-rule in different specs, `descriptors` contains the merged list of known descriptors.
52
+ - When specs define the syntax of an at-rule in terms of `<declaration-list>` or `<declaration-rule-list>`, the `value` key contains an "expanded" syntax that leverages the syntax of the at-rule's descriptors.
53
+
40
54
  # Guarantees
41
55
 
42
56
  The following guarantees are provided by this package:
43
- - All values in CSS files can be parsed by the version of [CSSTree](https://github.com/csstree/csstree) used in `peerDependencies` in `package.json`.
44
- - No duplicate definitions of entries in CSS files provided that CSS extracts of [delta specs](https://github.com/w3c/browser-specs/#seriescomposition) are not taken into account (such extracts end with `-n.json`, where `n` is a level number). The term "entries" includes CSS properties, at-rules, selectors, types and functions. Please note that specs may still extend entries defined elsewhere (to define new values for CSS properties, or new selectors for at-rules).
45
- - CSS extracts contain a base definition of all CSS properties that get extended by other CSS property definitions (those for which `newValues` is set).
46
- - All entries in CSS files that do not extend a base definition link back to their actual definition in the spec. In other words, all entries under `properties[]`, `properties[].values[]`, `selectors[]`, `atrules[]` and `values[]` have an `href` key that contains an absolute URL with fragment, except properties that that have a `newValues` key, at-rules that neither have a `prose` nor a `value` key, and definitions of a [delta spec](https://github.com/w3c/browser-specs/#seriescomposition) that completely override a definition in a previous level.
57
+ - All syntax values (the `value` keys) can be parsed by the version of [CSSTree](https://github.com/csstree/csstree) set in `peerDependencies` in `package.json`.
58
+ - Feature names (the `name` keys) are unique per type provided that the `for` key is also taken into account for functions and types.
59
+ - All features have an `href` key that targets the CSS spec that defines the feature. When the feature is extended across CSS specs, this URL targets the base definition.
60
+
61
+ *Note:* there is no guarantee that functions, properties and types referenced by other constructs actually exist. The grammar is known to be incomplete.