@adobe/design-data-spec 0.1.0 → 0.2.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/LICENSE +201 -0
- package/conformance/invalid/SPEC-016/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-016/tokens.tokens.json +8 -0
- package/conformance/invalid/SPEC-017/expected-errors.json +10 -0
- package/conformance/invalid/SPEC-017/tokens.tokens.json +7 -0
- package/conformance/valid/composite-drop-shadow.json +14 -0
- package/conformance/valid/composite-typography-scale.json +6 -0
- package/conformance/valid/composite-typography.json +12 -0
- package/conformance/valid/string-name-escape-hatch.json +7 -0
- package/fields/scaleIndex.json +15 -0
- package/package.json +2 -3
- package/rules/rules.yaml +36 -0
- package/schemas/field.schema.json +2 -2
- package/schemas/token.schema.json +26 -2
- package/schemas/value-types/drop-shadow.schema.json +20 -0
- package/schemas/value-types/typography-scale.schema.json +13 -0
- package/schemas/value-types/typography.schema.json +16 -0
- package/spec/token-format.md +70 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": { "property": "drop-shadow-default" },
|
|
3
|
+
"$valueType": "value-types/drop-shadow.schema.json",
|
|
4
|
+
"value": [
|
|
5
|
+
{
|
|
6
|
+
"x": "0px",
|
|
7
|
+
"y": "1px",
|
|
8
|
+
"blur": "4px",
|
|
9
|
+
"spread": "0px",
|
|
10
|
+
"color": "rgba(0, 0, 0, 0.16)"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"uuid": "aaaaaaaa-0010-4000-8000-000000000002"
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": { "property": "component-m-regular" },
|
|
3
|
+
"$valueType": "value-types/typography.schema.json",
|
|
4
|
+
"value": {
|
|
5
|
+
"fontFamily": "{sans-serif-font-family}",
|
|
6
|
+
"fontSize": "{font-size-100}",
|
|
7
|
+
"fontWeight": "{regular-font-weight}",
|
|
8
|
+
"letterSpacing": "{letter-spacing}",
|
|
9
|
+
"lineHeight": "{line-height-font-size-100}"
|
|
10
|
+
},
|
|
11
|
+
"uuid": "aaaaaaaa-0010-4000-8000-000000000001"
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/field.schema.json",
|
|
3
|
+
"specVersion": "1.0.0-draft",
|
|
4
|
+
"name": "scaleIndex",
|
|
5
|
+
"description": "Numeric scale index appended at the end of the serialized name (e.g., 100, 200, 900). Used by foundational scale tokens for spacing, color palette, font sizes, border widths, corner radii, and drop-shadow values.",
|
|
6
|
+
"kind": "numeric",
|
|
7
|
+
"registry": null,
|
|
8
|
+
"validation": "none",
|
|
9
|
+
"serialization": {
|
|
10
|
+
"position": 16
|
|
11
|
+
},
|
|
12
|
+
"scope": null,
|
|
13
|
+
"required": false,
|
|
14
|
+
"valueType": "integer"
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/design-data-spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Design Data Specification — prose, JSON Schemas, rule catalog, and conformance fixtures for Spectrum design data",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"node": ">=20.12.0",
|
|
19
19
|
"pnpm": ">=10.17.1"
|
|
20
20
|
},
|
|
21
|
-
"packageManager": "pnpm@10.17.1",
|
|
22
21
|
"exports": {
|
|
23
22
|
"./package.json": "./package.json",
|
|
24
23
|
"./schemas/token.schema.json": "./schemas/token.schema.json",
|
|
@@ -37,4 +36,4 @@
|
|
|
37
36
|
"README.md"
|
|
38
37
|
],
|
|
39
38
|
"scripts": {}
|
|
40
|
-
}
|
|
39
|
+
}
|
package/rules/rules.yaml
CHANGED
|
@@ -118,3 +118,39 @@ rules:
|
|
|
118
118
|
message: "Token {token} has plannedRemoval but is not marked deprecated"
|
|
119
119
|
spec_ref: spec/token-format.md#lifecycle-and-metadata
|
|
120
120
|
introduced_in: "1.0.0-draft"
|
|
121
|
+
|
|
122
|
+
- id: SPEC-014
|
|
123
|
+
name: composite-inline-alias-exists
|
|
124
|
+
severity: error
|
|
125
|
+
category: reference-integrity
|
|
126
|
+
assert: Inline alias references ({token-name}) within composite values MUST resolve to an existing token in the dataset.
|
|
127
|
+
message: "Inline alias target not found within composite value: {path}"
|
|
128
|
+
spec_ref: spec/token-format.md#inline-alias-references
|
|
129
|
+
introduced_in: "1.0.0-draft"
|
|
130
|
+
|
|
131
|
+
- id: SPEC-015
|
|
132
|
+
name: composite-inline-alias-type-compatible
|
|
133
|
+
severity: error
|
|
134
|
+
category: type-safety
|
|
135
|
+
assert: Resolved inline alias target within a composite value MUST have a value type compatible with the sub-value's expected type.
|
|
136
|
+
message: "Inline alias {path} within composite resolves to incompatible type"
|
|
137
|
+
spec_ref: spec/token-format.md#inline-alias-references
|
|
138
|
+
introduced_in: "1.0.0-draft"
|
|
139
|
+
|
|
140
|
+
- id: SPEC-016
|
|
141
|
+
name: value-type-match
|
|
142
|
+
severity: error
|
|
143
|
+
category: type-safety
|
|
144
|
+
assert: When $valueType is present on a token with a literal value, the value MUST validate against the referenced value-type schema.
|
|
145
|
+
message: "Token {token} value does not validate against declared $valueType schema {schema}"
|
|
146
|
+
spec_ref: spec/token-format.md#value-type-declaration-valuetype
|
|
147
|
+
introduced_in: "1.0.0-draft"
|
|
148
|
+
|
|
149
|
+
- id: SPEC-017
|
|
150
|
+
name: string-name-tech-debt
|
|
151
|
+
severity: warning
|
|
152
|
+
category: tech-debt
|
|
153
|
+
assert: Token names SHOULD be structured name objects. A plain string name is permitted as a temporary escape hatch but MUST be treated as tech debt and tracked for remediation.
|
|
154
|
+
message: 'Token "{name}" uses a string name instead of a name object — treat as tech debt and plan remediation'
|
|
155
|
+
spec_ref: spec/token-format.md#string-name-escape-hatch
|
|
156
|
+
introduced_in: "1.0.0-draft"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"kind": {
|
|
25
25
|
"type": "string",
|
|
26
|
-
"enum": ["semantic", "dimension"],
|
|
27
|
-
"description": "Whether this field participates in cascade resolution. 'dimension' fields drive cascade specificity; '
|
|
26
|
+
"enum": ["semantic", "dimension", "numeric"],
|
|
27
|
+
"description": "Whether this field participates in serialization ordering or cascade resolution. 'semantic' fields describe identity and appear in the standard serialization order; 'dimension' fields drive cascade specificity; 'numeric' fields hold integer indices appended at the end of the serialized name."
|
|
28
28
|
},
|
|
29
29
|
"registry": {
|
|
30
30
|
"oneOf": [
|
|
@@ -99,7 +99,19 @@
|
|
|
99
99
|
"const": "1.0.0-draft"
|
|
100
100
|
},
|
|
101
101
|
"name": {
|
|
102
|
-
"
|
|
102
|
+
"oneOf": [
|
|
103
|
+
{ "$ref": "#/$defs/nameObject" },
|
|
104
|
+
{
|
|
105
|
+
"type": "string",
|
|
106
|
+
"minLength": 1,
|
|
107
|
+
"description": "String escape hatch for tokens that cannot be expressed as a name object. Valid but triggers SPEC-017 (tech-debt warning). See token-format.md#string-name-escape-hatch."
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"$valueType": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"format": "uri-reference",
|
|
114
|
+
"description": "URI reference to a value-type schema under schemas/value-types/. When present, value MUST validate against the referenced schema (rule SPEC-016)."
|
|
103
115
|
},
|
|
104
116
|
"value": {
|
|
105
117
|
"description": "Literal value; type narrowed by value-type schemas where applicable.",
|
|
@@ -174,7 +186,19 @@
|
|
|
174
186
|
"const": "1.0.0-draft"
|
|
175
187
|
},
|
|
176
188
|
"name": {
|
|
177
|
-
"
|
|
189
|
+
"oneOf": [
|
|
190
|
+
{ "$ref": "#/$defs/nameObject" },
|
|
191
|
+
{
|
|
192
|
+
"type": "string",
|
|
193
|
+
"minLength": 1,
|
|
194
|
+
"description": "String escape hatch for tokens that cannot be expressed as a name object. Valid but triggers SPEC-017 (tech-debt warning). See token-format.md#string-name-escape-hatch."
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
"$valueType": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"format": "uri-reference",
|
|
201
|
+
"description": "URI reference to a value-type schema under schemas/value-types/. When present, the alias resolution chain MUST terminate at a token whose value validates against this schema."
|
|
178
202
|
},
|
|
179
203
|
"$ref": {
|
|
180
204
|
"type": "string",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/value-types/drop-shadow.schema.json",
|
|
4
|
+
"title": "Drop shadow composite value",
|
|
5
|
+
"description": "Array of shadow layers. Each layer defines offset, blur, spread, and color.",
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"x": { "type": "string" },
|
|
11
|
+
"y": { "type": "string" },
|
|
12
|
+
"blur": { "type": "string" },
|
|
13
|
+
"spread": { "type": "string" },
|
|
14
|
+
"color": { "type": "string" }
|
|
15
|
+
},
|
|
16
|
+
"required": ["x", "y", "blur", "spread", "color"],
|
|
17
|
+
"additionalProperties": false
|
|
18
|
+
},
|
|
19
|
+
"minItems": 1
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/value-types/typography-scale.schema.json",
|
|
4
|
+
"title": "Typography scale composite value",
|
|
5
|
+
"description": "Pairs a font size with its corresponding line height at a single typographic tier.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"fontSize": { "type": "string" },
|
|
9
|
+
"lineHeight": { "type": "string" }
|
|
10
|
+
},
|
|
11
|
+
"required": ["fontSize", "lineHeight"],
|
|
12
|
+
"additionalProperties": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://opensource.adobe.com/spectrum-design-data/schemas/v0/value-types/typography.schema.json",
|
|
4
|
+
"title": "Typography composite value",
|
|
5
|
+
"description": "Object bundling font properties for a typographic style. Sub-values may be literal strings or inline alias references ({token-name}).",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"fontFamily": { "type": "string" },
|
|
9
|
+
"fontSize": { "type": "string" },
|
|
10
|
+
"fontWeight": { "type": "string" },
|
|
11
|
+
"letterSpacing": { "type": "string" },
|
|
12
|
+
"lineHeight": { "type": "string" }
|
|
13
|
+
},
|
|
14
|
+
"required": ["fontFamily", "fontSize", "fontWeight", "lineHeight"],
|
|
15
|
+
"additionalProperties": false
|
|
16
|
+
}
|
package/spec/token-format.md
CHANGED
|
@@ -12,13 +12,33 @@ A **token** is a JSON object that satisfies the Layer 1 schema [`token.schema.js
|
|
|
12
12
|
|
|
13
13
|
A token **MUST** contain:
|
|
14
14
|
|
|
15
|
-
1. **`name`** — a JSON object (the **name object**) as defined below.
|
|
15
|
+
1. **`name`** — a JSON object (the **name object**) as defined below, or a non-empty plain string (escape hatch — see [String-name escape hatch](#string-name-escape-hatch)).
|
|
16
16
|
2. Exactly one of:
|
|
17
17
|
* **`value`** — a literal token value (type depends on value-type schema), or
|
|
18
18
|
* **`$ref`** — a string reference to another token (alias).
|
|
19
19
|
|
|
20
20
|
A token **MUST NOT** include both `value` and `$ref`.
|
|
21
21
|
|
|
22
|
+
### String-name escape hatch
|
|
23
|
+
|
|
24
|
+
A token's `name` field **MAY** be a non-empty plain string instead of a name object when the token's identity cannot be expressed using the structured taxonomy fields.
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"name": "focus-ring-color-key-focus",
|
|
29
|
+
"value": "#0265dc",
|
|
30
|
+
"uuid": "aaaaaaaa-0012-4000-8000-000000000001"
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**NORMATIVE:** String-named tokens are schema-valid. Validators **MUST** accept them without a structural error.
|
|
35
|
+
|
|
36
|
+
**NORMATIVE:** String-named tokens **MUST** trigger rule SPEC-017 (severity: `warning`, category: `tech-debt`). The warning surfaces the token as tracked debt requiring future remediation.
|
|
37
|
+
|
|
38
|
+
**NORMATIVE:** String-named tokens **MUST NOT** participate in name-object cascade dimension matching, specificity calculation, or registry vocabulary checks (SPEC-009 does not apply).
|
|
39
|
+
|
|
40
|
+
**RECOMMENDED:** Authors **SHOULD** treat string names as a temporary escape hatch and track a remediation plan. Each string-named token **SHOULD** eventually be given a structured name object, at which point SPEC-017 no longer fires.
|
|
41
|
+
|
|
22
42
|
### Name object
|
|
23
43
|
|
|
24
44
|
The **name object** identifies the token in a structured way. Implementations use it for cascade matching, specificity, and tooling.
|
|
@@ -149,6 +169,55 @@ Example:
|
|
|
149
169
|
|
|
150
170
|
Individual types (color, dimension, opacity, etc.) **MUST** be defined as JSON Schemas under `schemas/value-types/` and **MUST** use `$id` under the same `v0` base path as [Overview — JSON Schema `$id`](index.md).
|
|
151
171
|
|
|
172
|
+
### Value-type declaration (`$valueType`)
|
|
173
|
+
|
|
174
|
+
A token **MAY** include a `$valueType` field: a URI reference pointing to a value-type schema under `schemas/value-types/`.
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"name": { "property": "typography-scale", "scale": "desktop" },
|
|
179
|
+
"$valueType": "value-types/typography-scale.schema.json",
|
|
180
|
+
"value": { "fontSize": "14px", "lineHeight": "18px" },
|
|
181
|
+
"uuid": "377145e8-079b-43fd-b522-8f16b1b8f883"
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**NORMATIVE:** When `$valueType` is present on a token with a literal `value`, the value **MUST** validate against the referenced schema (rule SPEC-016).
|
|
186
|
+
|
|
187
|
+
**NORMATIVE:** When `$valueType` is present on an alias token (`$ref`), the alias resolution chain **MUST** terminate at a token whose value validates against the same value-type schema (rule SPEC-002, extended).
|
|
188
|
+
|
|
189
|
+
**RECOMMENDED:** All tokens with composite values (see below) **SHOULD** include `$valueType` to enable tooling discovery and validation. Tokens without `$valueType` remain valid under the permissive `anyOf` union in `token.schema.json`.
|
|
190
|
+
|
|
191
|
+
### Composite value types
|
|
192
|
+
|
|
193
|
+
A **composite value type** is a value-type schema whose root type is `object` or `array`. Composite values bundle multiple sub-values into a single token.
|
|
194
|
+
|
|
195
|
+
**NORMATIVE:** Composite value types **MUST** be defined as JSON Schemas under `schemas/value-types/` following the same conventions as primitive value types.
|
|
196
|
+
|
|
197
|
+
**NORMATIVE:** A composite token participates in cascade resolution as an **atomic unit**. Sub-values within a composite **MUST NOT** independently match, override, or participate in specificity calculation.
|
|
198
|
+
|
|
199
|
+
### Inline alias references
|
|
200
|
+
|
|
201
|
+
Within a composite value, a string sub-value **MAY** be an **inline alias**: a reference to another token that is resolved to produce the final sub-value.
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"name": { "property": "component-m-regular" },
|
|
206
|
+
"$valueType": "value-types/typography.schema.json",
|
|
207
|
+
"value": {
|
|
208
|
+
"fontFamily": "{sans-serif-font-family}",
|
|
209
|
+
"fontSize": "{font-size-100}",
|
|
210
|
+
"fontWeight": "{regular-font-weight}",
|
|
211
|
+
"letterSpacing": "{letter-spacing}",
|
|
212
|
+
"lineHeight": "{line-height-font-size-100}"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**NORMATIVE:** In legacy format, inline aliases use the syntax `{token-name}` (curly-brace-wrapped token property name). In cascade format, the inline alias syntax is `{token-name}` for backward compatibility; UUID-based inline aliases are reserved for a future spec version.
|
|
218
|
+
|
|
219
|
+
**NORMATIVE:** Inline aliases within composite values are subject to alias resolution rules. Validators **MUST** resolve inline aliases and report errors for missing targets (SPEC-014), type mismatches (SPEC-015), and circular references (SPEC-003, extended).
|
|
220
|
+
|
|
152
221
|
## Relationship to legacy Spectrum tokens
|
|
153
222
|
|
|
154
223
|
The current `@adobe/spectrum-tokens` JSON uses **sets** (`color-set`, `scale-set`, …). This specification describes the **target** per-token model. Mapping from legacy to this format is out of scope for this document; see [#743](https://github.com/adobe/spectrum-design-data/issues/743).
|