@markuplint/svelte-spec 5.4.0 → 5.5.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.5.0](https://github.com/markuplint/markuplint/compare/v5.4.0...v5.5.0) (2026-11-10)
7
+
8
+ ### Features
9
+
10
+ * **svelte-spec:** declare how Svelte renders a literal written as code ([0211b07](https://github.com/markuplint/markuplint/commit/0211b07f55e1bd80d4614f97274ab9632b5c1088))
11
+
12
+
6
13
  # [5.4.0](https://github.com/markuplint/markuplint/compare/v5.3.0...v5.4.0) (2026-10-29)
7
14
 
8
15
  **Note:** Version bump only for package @markuplint/svelte-spec
package/lib/index.js CHANGED
@@ -27,6 +27,53 @@ const spec = {
27
27
  * `@markuplint/ml-core`, not by the parser.
28
28
  */
29
29
  acceptedAttrNames: 'both',
30
+ /**
31
+ * How Svelte renders a literal in `{…}` on the server (`attr` of `svelte/internal/shared/attributes.js`
32
+ * and `DOM_BOOLEAN_ATTRIBUTES` of `svelte/utils.js`), where it differs from the default of
33
+ * `@markuplint/ml-core`. Names are in lower case.
34
+ *
35
+ * The docs of Svelte say which attributes are included:
36
+ *
37
+ * > Boolean attributes are included on the element if their value is truthy and excluded if it's falsy
38
+ *
39
+ * > All other attributes are included unless their value is nullish
40
+ *
41
+ * - The one exception is the empty string on a boolean attribute, which is present (`booleanAttrs`)
42
+ * - `translate={true}` is `translate="yes"` and `translate={false}` is `translate="no"`
43
+ *
44
+ * What it does not tell, which does not affect a rule:
45
+ *
46
+ * - A non-empty string literal on a boolean attribute (`disabled={"x"}`) is `""` here, which is how the
47
+ * client and the other frameworks render it; the server renders `disabled="x"`
48
+ * - The client sets a boolean attribute as the property, so `""` is absent there
49
+ * - A custom element is rendered as any element on the server (the compiler only keeps the case of its
50
+ * attribute names), so there is no `customElements` table; the client sets the properties that the
51
+ * element declares (`set_custom_element_data`), which are not attributes
52
+ *
53
+ * @see https://svelte.dev/docs/svelte/basic-markup#Element-attributes
54
+ * @see https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/internal/shared/attributes.js#attr
55
+ * @see https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/utils.js#DOM_BOOLEAN_ATTRIBUTES
56
+ */
57
+ literalValues: {
58
+ booleanAttrs: { '""': '' },
59
+ attrs: {
60
+ translate: { true: 'yes', false: 'no' },
61
+ // Booleans of Svelte that the spec does not know as boolean
62
+ disablepictureinpicture: { true: '', false: null, '0': null },
63
+ disableremoteplayback: { true: '', false: null, '0': null },
64
+ indeterminate: { true: '', false: null, '0': null },
65
+ webkitdirectory: { true: '', false: null, '0': null },
66
+ // Boolean attributes of the spec that Svelte does not render as boolean
67
+ alpha: { true: 'true', false: 'false', '0': '0', '""': '' },
68
+ focusgroupstart: { true: 'true', false: 'false', '0': '0', '""': '' },
69
+ headingreset: { true: 'true', false: 'false', '0': '0', '""': '' },
70
+ shadowrootclonable: { true: 'true', false: 'false', '0': '0', '""': '' },
71
+ shadowrootcustomelementregistry: { true: 'true', false: 'false', '0': '0', '""': '' },
72
+ shadowrootdelegatesfocus: { true: 'true', false: 'false', '0': '0', '""': '' },
73
+ shadowrootserializable: { true: 'true', false: 'false', '0': '0', '""': '' },
74
+ switch: { true: 'true', false: 'false', '0': '0', '""': '' },
75
+ },
76
+ },
30
77
  def: {
31
78
  '#globalAttrs': {
32
79
  '#extends': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/svelte-spec",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "Extended specification for tags and attributes in Svelte",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "clean": "tsc --build --clean tsconfig.build.json"
29
29
  },
30
30
  "dependencies": {
31
- "@markuplint/ml-spec": "5.4.0"
31
+ "@markuplint/ml-spec": "5.5.0"
32
32
  },
33
- "gitHead": "647f6fb5d5743f060678599c97e9c84b58970747"
33
+ "gitHead": "fedebcfd56eaec4642e68643b2f9e10750d810e1"
34
34
  }