@webority/tokens 0.0.0-stage → 0.90.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 +5 -0
- package/dist/_virtual/_rolldown/runtime.js +1 -0
- package/dist/brand.d.ts +33 -0
- package/dist/brand.js +2 -0
- package/dist/build.js +5 -0
- package/dist/canvas/renames.json +159 -0
- package/dist/canvas/webority-phone.json +763 -0
- package/dist/canvas/webority-web-390.json +423 -0
- package/dist/canvas/webority-web.json +423 -0
- package/dist/canvas-renames.js +1 -0
- package/dist/check.js +2 -0
- package/dist/cli.d.ts +91 -0
- package/dist/cli.js +2 -0
- package/dist/deviations.js +1 -0
- package/dist/emit/canvas.js +1 -0
- package/dist/emit/email.js +2 -0
- package/dist/emit/meanings.js +1 -0
- package/dist/emit/phone.js +3 -0
- package/dist/emit/web.js +23 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/meanings.json +879 -0
- package/dist/model/colour.js +1 -0
- package/dist/model/derive.js +1 -0
- package/dist/model/index.js +1 -0
- package/dist/model/length.js +1 -0
- package/dist/model/load.js +1 -0
- package/dist/model/references.js +1 -0
- package/dist/model/resolve.js +2 -0
- package/dist/names.d.ts +13 -0
- package/dist/names.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +2 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +4 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +4 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +1 -0
- package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +1 -0
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +1 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/index.js +1 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/schemes.js +1 -0
- package/dist/node_modules/.pnpm/fast-uri@3.1.9/node_modules/fast-uri/lib/utils.js +1 -0
- package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +1 -0
- package/dist/outputs.d.ts +139 -0
- package/dist/source/component.tokens.json +1672 -0
- package/dist/source/meaning.tokens.json +1025 -0
- package/dist/source/mode.dark.tokens.json +594 -0
- package/dist/source/palette.tokens.json +1406 -0
- package/dist/source/platform.phone.tokens.json +395 -0
- package/dist/source/scale.tokens.json +869 -0
- package/dist/source/width.390.tokens.json +96 -0
- package/dist/upgrade/css.js +2 -0
- package/dist/upgrade/index.js +5 -0
- package/dist/upgrade/razorAttributes.js +3 -0
- package/dist/upgrade/themeReads.js +2 -0
- package/dist/webority.js +2 -0
- package/dist/webority.resolver.json +18 -0
- package/package.json +46 -3
- package/renames/0.87.1.json +14 -0
- package/renames/0.89.0.json +1423 -0
- package/renames/renames.d.ts +42 -0
- package/schema/design-map.schema.json +143 -0
- package/schema/webority-tokens.schema.json +211 -0
- package/README.md +0 -3
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "webority-theme-tokens/2",
|
|
3
|
+
"source": {
|
|
4
|
+
"package": "@webority/tokens",
|
|
5
|
+
"version": "0.90.0",
|
|
6
|
+
"brand": null,
|
|
7
|
+
"platform": "web",
|
|
8
|
+
"width": 1440
|
|
9
|
+
},
|
|
10
|
+
"modes": [
|
|
11
|
+
"light",
|
|
12
|
+
"dark"
|
|
13
|
+
],
|
|
14
|
+
"colors": {
|
|
15
|
+
"light": {
|
|
16
|
+
"bg": "#f4f6f8",
|
|
17
|
+
"bg-subtle": "#f9fbfc",
|
|
18
|
+
"bg-muted": "#f5f6fa",
|
|
19
|
+
"surface": "#ffffff",
|
|
20
|
+
"surface-inverse": "#071437",
|
|
21
|
+
"surface-inverse-raised": "#132041",
|
|
22
|
+
"surface-inverse-elevated": "#1d2949",
|
|
23
|
+
"text": "#071437",
|
|
24
|
+
"text-body": "#252f4a",
|
|
25
|
+
"text-muted": "#4b5675",
|
|
26
|
+
"text-subtle": "#687088",
|
|
27
|
+
"text-inverse": "#ffffff",
|
|
28
|
+
"link": "#4f46e5",
|
|
29
|
+
"border": "#ebedf3",
|
|
30
|
+
"border-subtle": "#f4f6f8",
|
|
31
|
+
"border-strong": "#c4cada",
|
|
32
|
+
"field-bg": "#f9fbfc",
|
|
33
|
+
"field-border": "#dfe2ea",
|
|
34
|
+
"field-border-hover": "#c4cada",
|
|
35
|
+
"field-border-focus": "#a5b4fc",
|
|
36
|
+
"focus-ring": "#4f46e5",
|
|
37
|
+
"scrim": "#07143773",
|
|
38
|
+
"scrim-strong": "#0714379e",
|
|
39
|
+
"on-scrim": "#ffffff",
|
|
40
|
+
"progress-track": "#e1e5ee",
|
|
41
|
+
"progress-label": "#ffffff",
|
|
42
|
+
"thumb": "#ffffff",
|
|
43
|
+
"scrollbar": "#919eab73",
|
|
44
|
+
"scrollbar-hover": "#919eaba6",
|
|
45
|
+
"scrollbar-active": "#919eabd9",
|
|
46
|
+
"primary": "#4f46e5",
|
|
47
|
+
"primary-hover": "#4338ca",
|
|
48
|
+
"primary-soft": "#e0e7ff",
|
|
49
|
+
"primary-text": "#4f46e5",
|
|
50
|
+
"on-primary": "#ffffff",
|
|
51
|
+
"primary-wash": "#4f46e514",
|
|
52
|
+
"primary-wash-strong": "#4f46e533",
|
|
53
|
+
"neutral": "#07143714",
|
|
54
|
+
"neutral-hover": "#0714371f",
|
|
55
|
+
"neutral-pressed": "#07143729",
|
|
56
|
+
"neutral-soft": "#68708829",
|
|
57
|
+
"neutral-text": "#4b5675",
|
|
58
|
+
"on-neutral": "#071437",
|
|
59
|
+
"success": "#04b440",
|
|
60
|
+
"success-pressed": "#04b440",
|
|
61
|
+
"success-soft": "#e8faee",
|
|
62
|
+
"success-border": "#baeecc",
|
|
63
|
+
"success-text": "#0e7531",
|
|
64
|
+
"success-text-on-soft": "#0e7531",
|
|
65
|
+
"success-strong": "#0e7531",
|
|
66
|
+
"on-success": "#ffffff",
|
|
67
|
+
"on-success-strong": "#ffffff",
|
|
68
|
+
"warning": "#dfa000",
|
|
69
|
+
"warning-pressed": "#dfa000",
|
|
70
|
+
"warning-soft": "#fff8e6",
|
|
71
|
+
"warning-border": "#fde8b3",
|
|
72
|
+
"warning-text": "#876100",
|
|
73
|
+
"warning-text-on-soft": "#876100",
|
|
74
|
+
"warning-strong": "#9a6b00",
|
|
75
|
+
"warning-strong-hover": "#855c00",
|
|
76
|
+
"on-warning": "#ffffff",
|
|
77
|
+
"on-warning-strong": "#ffffff",
|
|
78
|
+
"danger": "#e82646",
|
|
79
|
+
"danger-pressed": "#e82646",
|
|
80
|
+
"danger-soft": "#ffeaef",
|
|
81
|
+
"danger-border": "#fdbfce",
|
|
82
|
+
"danger-text": "#cf1735",
|
|
83
|
+
"danger-text-on-soft": "#cf1735",
|
|
84
|
+
"danger-strong": "#c81340",
|
|
85
|
+
"danger-strong-hover": "#ab1036",
|
|
86
|
+
"on-danger": "#ffffff",
|
|
87
|
+
"on-danger-strong": "#ffffff",
|
|
88
|
+
"info": "#056ee9",
|
|
89
|
+
"info-pressed": "#056ee9",
|
|
90
|
+
"info-soft": "#e9f3ff",
|
|
91
|
+
"info-border": "#bbdbff",
|
|
92
|
+
"info-text": "#1460ba",
|
|
93
|
+
"info-text-on-soft": "#1460ba",
|
|
94
|
+
"info-strong": "#056ee9",
|
|
95
|
+
"on-info": "#ffffff",
|
|
96
|
+
"on-info-strong": "#ffffff",
|
|
97
|
+
"chart-1": "#4f46e5",
|
|
98
|
+
"chart-2": "#eb6834",
|
|
99
|
+
"chart-3": "#1baf7a",
|
|
100
|
+
"chart-4": "#eda100",
|
|
101
|
+
"chart-5": "#e87ba4",
|
|
102
|
+
"chart-6": "#008300",
|
|
103
|
+
"chart-7": "#2a78d6",
|
|
104
|
+
"chart-8": "#e34948",
|
|
105
|
+
"chart-seq-0": "#f5f6fa",
|
|
106
|
+
"chart-seq-1": "#e0e7ff",
|
|
107
|
+
"chart-seq-2": "#c7d2fe",
|
|
108
|
+
"chart-seq-3": "#a5b4fc",
|
|
109
|
+
"chart-seq-4": "#818cf8",
|
|
110
|
+
"chart-seq-5": "#6366f1",
|
|
111
|
+
"chart-seq-6": "#4338ca",
|
|
112
|
+
"chart-diverging-low": "#e34948",
|
|
113
|
+
"chart-diverging-mid": "#c4cada",
|
|
114
|
+
"chart-diverging-high": "#2a78d6",
|
|
115
|
+
"chart-neutral": "#99a1b7",
|
|
116
|
+
"chart-grid": "#ebedf3",
|
|
117
|
+
"chart-axis": "#c4cada",
|
|
118
|
+
"chart-label": "#687088"
|
|
119
|
+
},
|
|
120
|
+
"dark": {
|
|
121
|
+
"bg": "#0f1117",
|
|
122
|
+
"bg-subtle": "#0d0f15",
|
|
123
|
+
"bg-muted": "#232733",
|
|
124
|
+
"surface": "#181b23",
|
|
125
|
+
"surface-inverse": "#e6e8ee",
|
|
126
|
+
"surface-inverse-raised": "#dbdde5",
|
|
127
|
+
"surface-inverse-elevated": "#d2d5de",
|
|
128
|
+
"text": "#e6e8ee",
|
|
129
|
+
"text-body": "#e6e8ee",
|
|
130
|
+
"text-muted": "#b4b9c6",
|
|
131
|
+
"text-subtle": "#8a90a0",
|
|
132
|
+
"text-inverse": "#071437",
|
|
133
|
+
"link": "#9590ef",
|
|
134
|
+
"border": "#2a2f3a",
|
|
135
|
+
"border-subtle": "#2a2f3a80",
|
|
136
|
+
"border-strong": "#3a414f",
|
|
137
|
+
"field-bg": "#232733",
|
|
138
|
+
"field-border": "#2a2f3a",
|
|
139
|
+
"field-border-hover": "#3a414f",
|
|
140
|
+
"field-border-focus": "#9590ef",
|
|
141
|
+
"focus-ring": "#9590ef",
|
|
142
|
+
"scrim": "#00000073",
|
|
143
|
+
"scrim-strong": "#0000009e",
|
|
144
|
+
"on-scrim": "#ffffff",
|
|
145
|
+
"progress-track": "#323845",
|
|
146
|
+
"progress-label": "#0f0f0f",
|
|
147
|
+
"thumb": "#3a3e49",
|
|
148
|
+
"scrollbar": "#ffffff2e",
|
|
149
|
+
"scrollbar-hover": "#ffffff47",
|
|
150
|
+
"scrollbar-active": "#ffffff66",
|
|
151
|
+
"primary": "#9590ef",
|
|
152
|
+
"primary-hover": "#a29df1",
|
|
153
|
+
"primary-soft": "#4f46e533",
|
|
154
|
+
"primary-text": "#9590ef",
|
|
155
|
+
"on-primary": "#0f0f0f",
|
|
156
|
+
"primary-wash": "#9590ef14",
|
|
157
|
+
"primary-wash-strong": "#9590ef33",
|
|
158
|
+
"neutral": "#e6e8ee14",
|
|
159
|
+
"neutral-hover": "#e6e8ee1f",
|
|
160
|
+
"neutral-pressed": "#e6e8ee29",
|
|
161
|
+
"neutral-soft": "#8a90a029",
|
|
162
|
+
"neutral-text": "#b4b9c6",
|
|
163
|
+
"on-neutral": "#e6e8ee",
|
|
164
|
+
"success": "#30c780",
|
|
165
|
+
"success-pressed": "#4fcf93",
|
|
166
|
+
"success-soft": "#04b4402e",
|
|
167
|
+
"success-border": "#30c78066",
|
|
168
|
+
"success-text": "#43c770",
|
|
169
|
+
"success-text-on-soft": "#5cce83",
|
|
170
|
+
"success-strong": "#43c770",
|
|
171
|
+
"on-success": "#0f0f1a",
|
|
172
|
+
"on-success-strong": "#0f0f0f",
|
|
173
|
+
"warning": "#fbbf24",
|
|
174
|
+
"warning-pressed": "#fcc945",
|
|
175
|
+
"warning-soft": "#dfa0002e",
|
|
176
|
+
"warning-border": "#fbbf2466",
|
|
177
|
+
"warning-text": "#e7b840",
|
|
178
|
+
"warning-text-on-soft": "#eac159",
|
|
179
|
+
"warning-strong": "#e7b840",
|
|
180
|
+
"warning-strong-hover": "#ebc35d",
|
|
181
|
+
"on-warning": "#0f0f1a",
|
|
182
|
+
"on-warning-strong": "#0f0f0f",
|
|
183
|
+
"danger": "#f87171",
|
|
184
|
+
"danger-pressed": "#f98686",
|
|
185
|
+
"danger-soft": "#e826462e",
|
|
186
|
+
"danger-border": "#f8717166",
|
|
187
|
+
"danger-text": "#ee5c74",
|
|
188
|
+
"danger-text-on-soft": "#f07287",
|
|
189
|
+
"danger-strong": "#ee5c74",
|
|
190
|
+
"danger-strong-hover": "#f17489",
|
|
191
|
+
"on-danger": "#0f0f1a",
|
|
192
|
+
"on-danger-strong": "#0f0f0f",
|
|
193
|
+
"info": "#60a5fa",
|
|
194
|
+
"info-pressed": "#78b3fb",
|
|
195
|
+
"info-soft": "#056ee92e",
|
|
196
|
+
"info-border": "#60a5fa66",
|
|
197
|
+
"info-text": "#4492ef",
|
|
198
|
+
"info-text-on-soft": "#5da1f1",
|
|
199
|
+
"info-strong": "#4492ef",
|
|
200
|
+
"on-info": "#0f0f1a",
|
|
201
|
+
"on-info-strong": "#0f0f0f",
|
|
202
|
+
"chart-1": "#9590ef",
|
|
203
|
+
"chart-2": "#d95926",
|
|
204
|
+
"chart-3": "#199e70",
|
|
205
|
+
"chart-4": "#c98500",
|
|
206
|
+
"chart-5": "#d55181",
|
|
207
|
+
"chart-6": "#008300",
|
|
208
|
+
"chart-7": "#3987e5",
|
|
209
|
+
"chart-8": "#e66767",
|
|
210
|
+
"chart-seq-0": "#20242f",
|
|
211
|
+
"chart-seq-1": "#262c45",
|
|
212
|
+
"chart-seq-2": "#2f3a70",
|
|
213
|
+
"chart-seq-3": "#3b4ba0",
|
|
214
|
+
"chart-seq-4": "#5168d2",
|
|
215
|
+
"chart-seq-5": "#7a90ef",
|
|
216
|
+
"chart-seq-6": "#b3c1f7",
|
|
217
|
+
"chart-diverging-low": "#e66767",
|
|
218
|
+
"chart-diverging-mid": "#3a414f",
|
|
219
|
+
"chart-diverging-high": "#3987e5",
|
|
220
|
+
"chart-neutral": "#5d6475",
|
|
221
|
+
"chart-grid": "#2a2f3a",
|
|
222
|
+
"chart-axis": "#3a414f",
|
|
223
|
+
"chart-label": "#8a90a0"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"space": {
|
|
227
|
+
"none": 0,
|
|
228
|
+
"xxs": 2,
|
|
229
|
+
"xs": 4,
|
|
230
|
+
"sm": 8,
|
|
231
|
+
"md": 12,
|
|
232
|
+
"lg": 16,
|
|
233
|
+
"xl": 24,
|
|
234
|
+
"2xl": 32,
|
|
235
|
+
"3xl": 48,
|
|
236
|
+
"4xl": 64
|
|
237
|
+
},
|
|
238
|
+
"radius": {
|
|
239
|
+
"none": 0,
|
|
240
|
+
"sm": 8,
|
|
241
|
+
"md": 10,
|
|
242
|
+
"lg": 14,
|
|
243
|
+
"xl": 16,
|
|
244
|
+
"pill": 9999
|
|
245
|
+
},
|
|
246
|
+
"text": {
|
|
247
|
+
"xs": {
|
|
248
|
+
"size": 13,
|
|
249
|
+
"lineHeight": 1.5
|
|
250
|
+
},
|
|
251
|
+
"sm": {
|
|
252
|
+
"size": 14,
|
|
253
|
+
"lineHeight": 1.5
|
|
254
|
+
},
|
|
255
|
+
"base": {
|
|
256
|
+
"size": 16.8,
|
|
257
|
+
"lineHeight": 1.5
|
|
258
|
+
},
|
|
259
|
+
"lg": {
|
|
260
|
+
"size": 20,
|
|
261
|
+
"lineHeight": 1.4
|
|
262
|
+
},
|
|
263
|
+
"xl": {
|
|
264
|
+
"size": 24,
|
|
265
|
+
"lineHeight": 1.3
|
|
266
|
+
},
|
|
267
|
+
"2xl": {
|
|
268
|
+
"size": 32,
|
|
269
|
+
"lineHeight": 1.25
|
|
270
|
+
},
|
|
271
|
+
"3xl": {
|
|
272
|
+
"size": 44,
|
|
273
|
+
"lineHeight": 1.2
|
|
274
|
+
},
|
|
275
|
+
"4xl": {
|
|
276
|
+
"size": 56,
|
|
277
|
+
"lineHeight": 1.1
|
|
278
|
+
},
|
|
279
|
+
"5xl": {
|
|
280
|
+
"size": 72,
|
|
281
|
+
"lineHeight": 1.05
|
|
282
|
+
},
|
|
283
|
+
"6xl": {
|
|
284
|
+
"size": 96,
|
|
285
|
+
"lineHeight": 1
|
|
286
|
+
},
|
|
287
|
+
"7xl": {
|
|
288
|
+
"size": 119.95,
|
|
289
|
+
"lineHeight": 1
|
|
290
|
+
},
|
|
291
|
+
"8xl": {
|
|
292
|
+
"size": 144,
|
|
293
|
+
"lineHeight": 1
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"typography": {
|
|
297
|
+
"fontWeight": {
|
|
298
|
+
"normal": 400,
|
|
299
|
+
"medium": 500,
|
|
300
|
+
"semibold": 600,
|
|
301
|
+
"bold": 700
|
|
302
|
+
},
|
|
303
|
+
"leading": {
|
|
304
|
+
"tight": 1.2
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"fonts": {
|
|
308
|
+
"ui": {
|
|
309
|
+
"family": "Webority Sans",
|
|
310
|
+
"fallback": "Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif"
|
|
311
|
+
},
|
|
312
|
+
"display": {
|
|
313
|
+
"family": "Webority Serif",
|
|
314
|
+
"fallback": "Cambria, Georgia, Times New Roman, Noto Serif, serif"
|
|
315
|
+
},
|
|
316
|
+
"mono": {
|
|
317
|
+
"family": "JetBrains Mono",
|
|
318
|
+
"fallback": "SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"shadow": {
|
|
322
|
+
"card": null,
|
|
323
|
+
"popover": {
|
|
324
|
+
"x": 0,
|
|
325
|
+
"y": 8,
|
|
326
|
+
"blur": 28,
|
|
327
|
+
"spread": -6,
|
|
328
|
+
"color": "rgba(7, 20, 55, 0.14)",
|
|
329
|
+
"elevation": 8
|
|
330
|
+
},
|
|
331
|
+
"modal": {
|
|
332
|
+
"x": 0,
|
|
333
|
+
"y": 24,
|
|
334
|
+
"blur": 60,
|
|
335
|
+
"spread": -16,
|
|
336
|
+
"color": "rgba(7, 20, 55, 0.28)",
|
|
337
|
+
"elevation": 12
|
|
338
|
+
},
|
|
339
|
+
"drawer": {
|
|
340
|
+
"x": 0,
|
|
341
|
+
"y": 24,
|
|
342
|
+
"blur": 60,
|
|
343
|
+
"spread": -16,
|
|
344
|
+
"color": "rgba(7, 20, 55, 0.28)",
|
|
345
|
+
"elevation": 12
|
|
346
|
+
},
|
|
347
|
+
"overlay": {
|
|
348
|
+
"x": 0,
|
|
349
|
+
"y": 24,
|
|
350
|
+
"blur": 60,
|
|
351
|
+
"spread": -16,
|
|
352
|
+
"color": "rgba(7, 20, 55, 0.28)"
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"components": {
|
|
356
|
+
"field": {
|
|
357
|
+
"base": {},
|
|
358
|
+
"sizes": {
|
|
359
|
+
"sm": {
|
|
360
|
+
"radius": "8px"
|
|
361
|
+
},
|
|
362
|
+
"md": {
|
|
363
|
+
"radius": "8px"
|
|
364
|
+
},
|
|
365
|
+
"lg": {
|
|
366
|
+
"radius": "8px"
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
"focus-ring": {
|
|
371
|
+
"base": {
|
|
372
|
+
"width": "2px",
|
|
373
|
+
"offset": "2px",
|
|
374
|
+
"shadow": "0 0 0 2px #e0e7ff"
|
|
375
|
+
},
|
|
376
|
+
"sizes": {}
|
|
377
|
+
},
|
|
378
|
+
"press": {
|
|
379
|
+
"base": {
|
|
380
|
+
"scale": "0.96",
|
|
381
|
+
"duration": "80ms",
|
|
382
|
+
"opacity": "0.5"
|
|
383
|
+
},
|
|
384
|
+
"sizes": {}
|
|
385
|
+
},
|
|
386
|
+
"thumb": {
|
|
387
|
+
"base": {
|
|
388
|
+
"shadow": "0 2px 6px rgba(0, 0, 0, 0.1)",
|
|
389
|
+
"shadow-hover": "0 2px 12px rgba(0, 0, 0, 0.2)"
|
|
390
|
+
},
|
|
391
|
+
"sizes": {}
|
|
392
|
+
},
|
|
393
|
+
"card": {
|
|
394
|
+
"base": {
|
|
395
|
+
"shadow-lifted": "none",
|
|
396
|
+
"shadow-lifted-hover": "none"
|
|
397
|
+
},
|
|
398
|
+
"sizes": {}
|
|
399
|
+
},
|
|
400
|
+
"table": {
|
|
401
|
+
"base": {},
|
|
402
|
+
"sizes": {
|
|
403
|
+
"md": {
|
|
404
|
+
"padding-x": "20px"
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"container": {
|
|
409
|
+
"base": {},
|
|
410
|
+
"sizes": {
|
|
411
|
+
"md": {
|
|
412
|
+
"padding-x": "88px"
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
"disabled": {
|
|
417
|
+
"base": {
|
|
418
|
+
"opacity": "0.5"
|
|
419
|
+
},
|
|
420
|
+
"sizes": {}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`webority-theme-tokens/1`,t=`webority-theme-tokens/2`,n={"accent-dark":`primary-hover`,"bg-elevated":`bg-subtle`,"bg-light":`surface`,"bg-muted":`bg-muted`,"bg-page":`bg`,"border-light":`border`,"border-soft":`border-subtle`,"border-strong":`border-strong`,"chart-1":`chart-1`,"chart-2":`chart-2`,"chart-3":`chart-3`,"chart-4":`chart-4`,"chart-5":`chart-5`,"chart-6":`chart-6`,"chart-7":`chart-7`,"chart-8":`chart-8`,"chart-diverging-high":`chart-diverging-high`,"chart-diverging-low":`chart-diverging-low`,"chart-diverging-mid":`chart-diverging-mid`,"chart-neutral":`chart-neutral`,"chart-seq-0":`chart-seq-0`,"chart-seq-1":`chart-seq-1`,"chart-seq-2":`chart-seq-2`,"chart-seq-3":`chart-seq-3`,"chart-seq-4":`chart-seq-4`,"chart-seq-5":`chart-seq-5`,"chart-seq-6":`chart-seq-6`,danger:`danger`,"danger-10":`danger-soft`,"danger-20":null,"danger-30":`danger-border`,"danger-5":null,"danger-50":null,"danger-active":`danger-pressed`,"danger-strong":`danger-strong`,"danger-strong-hover":`danger-strong-hover`,"danger-text":`danger-text`,"fg-2":`text-body`,"fg-3":`text-muted`,"fg-4":`text-subtle`,"fg-5":`border-strong`,"field-bg":`field-bg`,"field-border":`field-border`,"field-border-hover":`field-border-hover`,info:`info`,"info-10":`info-soft`,"info-20":null,"info-30":`info-border`,"info-5":null,"info-50":null,"info-active":`info-pressed`,"info-text":`info-text`,ink:null,"neutral-bg-dark":`bg-muted`,"neutral-bg-light":`bg-subtle`,"neutral-border-dark":`border`,"neutral-border-light":`border-subtle`,primary:`primary`,"primary-10":`primary-soft`,"primary-15":null,"primary-20":null,"primary-30":null,"primary-5":null,"primary-50":null,"primary-hover":`primary-hover`,"primary-ink":`primary-text`,"primary-pressed":`primary-hover`,"primary-text":`on-primary`,"progress-track":`progress-track`,scrollbar:`scrollbar`,"scrollbar-active":`scrollbar-active`,"scrollbar-hover":`scrollbar-hover`,"shadow-overlay":null,"shadow-overlay-lg":null,success:`success`,"success-10":`success-soft`,"success-20":null,"success-30":`success-border`,"success-5":null,"success-50":null,"success-active":`success-pressed`,"success-strong":`success-strong`,"success-text":`success-text`,"surface-mute":`bg-subtle`,"surface-soft":null,"surface-violet":null,"surface-violet-soft":null,"text-1":`text-body`,"text-2":`text-muted`,"text-3":`text-subtle`,"text-4":`text-subtle`,"text-5":`border-strong`,"text-heading":`text`,warning:`warning`,"warning-10":`warning-soft`,"warning-20":null,"warning-30":`warning-border`,"warning-5":null,"warning-50":null,"warning-active":`warning-pressed`,"warning-strong":`warning-strong`,"warning-strong-hover":`warning-strong-hover`,"warning-text":`warning-text`},r={display:`display`,mono:`mono`,sans:`ui`},i={"2xl":`2xl`,"3xl":`3xl`,48:`4xl`,"4xl":`4xl`,"5xl":`5xl`,64:`5xl`,"6xl":`6xl`,"7xl":`7xl`,"8xl":`8xl`,base:`base`,lg:`lg`,sm:`sm`,smb:`sm`,xl:`xl`,xs:`xs`},a={"2xl":`2xl`,"3xl":`3xl`,"4xl":`4xl`,lg:`lg`,md:`md`,none:`none`,sm:`sm`,xl:`xl`,xs:`xs`,xxs:`xxs`},o={lg:`lg`,md:`md`,pill:`pill`,sm:`sm`,xl:`xl`},s={card:`card`,"card-lifted":null,"card-lifted-hover":null,overlay:`popover`,"overlay-lg":`modal`,thumb:null,"thumb-hover":null},c={from:e,to:t,color:n,font:r,text:i,space:a,radius:o,shadow:s};export{n as color,c as default,r as font,e as from,o as radius,s as shadow,a as space,i as text,t as to};
|
package/dist/check.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__toESM as e}from"./_virtual/_rolldown/runtime.js";import{BRAND_OUTPUT_FILES as t}from"./brand.js";import{require__2020 as n}from"./node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js";import{loadModel as r}from"./model/index.js";import{brand as i}from"./build.js";import{readFileSync as a,readdirSync as o}from"node:fs";import{join as s,resolve as c}from"node:path";import{spawnSync as l}from"node:child_process";var u=e(n(),1),d=`.webority/design.json`,f=c(import.meta.dirname,`../schema/design-map.schema.json`),p=new Set([`vite.config.js`,`vite.config.mjs`,`vite.config.cjs`,`vite.config.ts`,`vite.config.mts`,`vite.config.cts`]);async function m(e={},t={}){let{brand:n=i,repoChecks:a=w,loadModel:o=r}=t,s=e.root??process.cwd(),c=[],l=h(s,c);return l!==null&&(g(l,c),c.length===0&&v(l,s,c)),c.length===0&&(await b(l,s,o,c),await S(l,s,n,c)),await C(s,a,c),{findings:c}}function h(e,t){let n;try{n=a(s(e,d),`utf8`)}catch{return t.push({check:`design-map`,file:d,message:`Cannot read the file. Run webority check from the repo root and create the file.`}),null}try{return JSON.parse(n)}catch(e){return t.push({check:`design-map`,file:d,message:`${e.message}. Fix the file.`}),null}}function g(e,t){let n=new u.Ajv2020({allErrors:!0}).compile(JSON.parse(a(f,`utf8`)));if(!n(e))for(let r of n.errors)t.push({check:`design-map`,file:d,message:_(r,e)})}function _(e,t){let n=e.instancePath.split(`/`).filter(Boolean),r=n.length>0?n.join(`.`):`design.json`;if(e.keyword===`additionalProperties`)return r+=`.${e.params.additionalProperty}`,`${r}: is not a design map key, retired or misspelled. Remove it.`;if(e.keyword===`required`)return r+=`.${e.params.missingProperty}`,`${r}: is required. Add it.`;let i=n.reduce((e,t)=>e?.[t],t);return typeof i==`string`&&(i.startsWith(`--`)||i.includes(`var(`))?`${r}: a CSS variable is not a role. Use the meaning name, or <group>.<name> for a scale role.`:`${r}: ${e.message}. Fix the file.`}function v(e,t,n){let r=e.tokens.brands,i=e.tokens.heads??[],a=e=>n.push({check:`design-map`,file:d,message:e}),o=new Map;for(let e of r)o.set(e.name,(o.get(e.name)??0)+1);for(let[e,t]of o)t>1&&a(`tokens.brands: ${e} is listed more than once. Give each brand its own name.`);let c=new Set(r.map(e=>e.name));i.forEach((e,t)=>{c.has(e.brand)||a(`tokens.heads[${t}]: brand ${e.brand} is not in tokens.brands. Use a listed brand name.`)});let l=new Set(i.map(e=>e.brand));for(let e of r)e.source!==`library`&&!l.has(e.name)&&a(`tokens.brands: ${e.name} has no head. List a head for it or remove the brand.`);if(r.length>1)for(let e of r)e.source===`library`&&a(`tokens.brands: a library source cannot be combined with other brands. Keep one brand.`);i.forEach((e,n)=>{let r=y(s(t,e.path));r!==null&&(e.kind===`spa`&&r.some(e=>e.endsWith(`.csproj`))&&a(`tokens.heads[${n}]: ${e.path} holds a .csproj, so its kind is razor. Set kind razor.`),e.kind===`razor`&&r.some(e=>p.has(e))&&a(`tokens.heads[${n}]: ${e.path} holds a Vite project, so its kind is spa. Set kind spa.`))})}function y(e){try{return o(e)}catch{return null}}async function b(e,n,r,i){let a=e=>i.push({check:`design-map`,file:d,message:e});for(let r of e.tokens.brands){let i=r.source===`library`?`${r.export}/canvas`:r.export,o=x(s(n,i));if(o!==null)for(let[n,s]of Object.entries(e.color?.roles??{}))o.has(s)||a(`color.roles.${n}: ${s} is not a colour of brand ${r.name}. Use a name from ${i}/${t.web}.`)}let o=[];for(let[t,n]of Object.entries(e.scale??{})){for(let[e,r]of Object.entries(n.roles??{}))o.push([`scale.${t}.roles.${e}`,r]);for(let[e,r]of Object.entries(n.durations??{}))o.push([`scale.${t}.durations.${e}`,r])}for(let[t,n]of Object.entries(e.iconography?.sizes??{}))o.push([`iconography.sizes.${t}`,n]);if(o.length===0)return;let c;try{c=await r()}catch(e){i.push({check:`design-map`,file:null,message:`${e.message}. Fix the token source.`});return}let l=new Set;for(let e of c.tokens.values())l.add(`${e.group}.${e.name}`);for(let[e,t]of o)l.has(t)||a(`${e}: ${t} is not a token. Use a <group>.<name> the library defines.`)}function x(e){let n=new Set,r=!1;for(let i of[t.web,t.phoneTheme]){let t;try{t=JSON.parse(a(s(e,i),`utf8`))}catch{continue}r=!0;for(let e of Object.keys(t?.colors?.light??{}))n.add(e)}return r?n:null}async function S(e,t,n,r){let i=e.tokens.brands,a=i.length===1&&i[0].source===`library`,o;try{o=a?await n({root:t,library:!0,out:i[0].export,check:!0}):await n({root:t,check:!0})}catch(e){for(let t of String(e?.message??e).split(`
|
|
2
|
+
`))t.trim()!==``&&r.push({check:`generated`,file:null,message:t});return}let s=a?`stale. Run webority brand --library --out ${i[0].export}`:`stale. Run webority brand`;for(let e of o.stale)r.push({check:`generated`,file:e,message:s})}async function C(e,t,n){let r;try{r=await t(e)}catch{n.push({check:`repo-checks`,file:null,message:`repo-checks did not run. Add @webority/repo-checks at the lockstep version.`});return}for(let e of r.new)n.push({check:`repo-checks`,file:e.pkg===`.`?null:e.pkg,message:`${e.id}: ${e.message}`})}function w(e){let t=l(`corepack pnpm exec webority-repo-checks --json`,{cwd:e,encoding:`utf8`,shell:!0,maxBuffer:64*1024*1024}),n;try{n=JSON.parse(t.stdout??``)}catch{throw Error(`repo-checks printed no JSON`)}if(!Array.isArray(n?.new))throw Error(`repo-checks printed no new array`);return n}export{m as check};
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** 0 ok, 1 refused or stale, 2 usage error. */
|
|
2
|
+
export type ExitCode = 0 | 1 | 2;
|
|
3
|
+
|
|
4
|
+
export type CliCommand = "brand" | "upgrade" | "check";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* webority brand [--brand <file>] [--library] [--out <dir>] [--web <scss>] [--phone <ts>] [--check]
|
|
8
|
+
*
|
|
9
|
+
* Product mode (no --library) reads .webority/design.json and builds every entry of tokens.brands: it writes the
|
|
10
|
+
* seven BRAND_OUTPUT_FILES into the brand's export folder, then copies brand.css into <head>/wwwroot/generated/,
|
|
11
|
+
* brand.phone.js into <head>/generated/ and email.json into <head>/generated/ for each head of that brand, by its
|
|
12
|
+
* kind. --brand and --out replace the source and export of the repo's one brand, and are refused when it has more.
|
|
13
|
+
* Library mode (--library) writes canvas/*.json, meanings.json and canvas/renames.json into --out; --web and --phone
|
|
14
|
+
* name the generated SCSS and TS files. --check compares instead of writing.
|
|
15
|
+
*/
|
|
16
|
+
export interface BrandOptions {
|
|
17
|
+
brand?: string;
|
|
18
|
+
library?: boolean;
|
|
19
|
+
out?: string;
|
|
20
|
+
web?: string;
|
|
21
|
+
phone?: string;
|
|
22
|
+
check?: boolean;
|
|
23
|
+
/** Defaults to process.cwd(). */
|
|
24
|
+
root?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface BrandResult {
|
|
28
|
+
written: string[];
|
|
29
|
+
/** Files whose contents differ from what brand would write; only filled with check. */
|
|
30
|
+
stale: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* webority upgrade <version> [--dry-run] [--path <p>]...
|
|
35
|
+
*
|
|
36
|
+
* With no --path, moves every pin in the lockstep list to <version>, installs, applies every rename table from the
|
|
37
|
+
* installed version up to <version> in order, then runs brand. With --path (repeatable), applies the tables to those
|
|
38
|
+
* paths only, with no pin move, install or brand run; webority-ui uses it on itself.
|
|
39
|
+
*/
|
|
40
|
+
export interface UpgradeOptions {
|
|
41
|
+
version: string;
|
|
42
|
+
dryRun?: boolean;
|
|
43
|
+
paths?: string[];
|
|
44
|
+
/** Defaults to process.cwd(). */
|
|
45
|
+
root?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** One rewrite upgrade made, or would make on a dry run. */
|
|
49
|
+
export interface UpgradeHit {
|
|
50
|
+
file: string;
|
|
51
|
+
line: number;
|
|
52
|
+
from: string;
|
|
53
|
+
to: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** A use upgrade cannot rewrite on its own; a person picks the new name. */
|
|
57
|
+
export interface UpgradeChoice {
|
|
58
|
+
file: string;
|
|
59
|
+
line: number;
|
|
60
|
+
name: string;
|
|
61
|
+
hint: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface UpgradeResult {
|
|
65
|
+
hits: UpgradeHit[];
|
|
66
|
+
choose: UpgradeChoice[];
|
|
67
|
+
changedFiles: string[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** webority check: fresh generated files, a valid design map, and repo-checks with no count above its record. */
|
|
71
|
+
export interface CheckOptions {
|
|
72
|
+
/** Defaults to process.cwd(). */
|
|
73
|
+
root?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface CheckFinding {
|
|
77
|
+
check: "generated" | "design-map" | "repo-checks";
|
|
78
|
+
file: string | null;
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface CheckResult {
|
|
83
|
+
findings: CheckFinding[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export declare function brand(options: BrandOptions): Promise<BrandResult>;
|
|
87
|
+
export declare function upgrade(options: UpgradeOptions): Promise<UpgradeResult>;
|
|
88
|
+
export declare function check(options?: CheckOptions): Promise<CheckResult>;
|
|
89
|
+
|
|
90
|
+
/** The command line: parses argv (without node and the script), runs one command and maps its result to an exit code. */
|
|
91
|
+
export declare function run(argv: string[]): Promise<ExitCode>;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{brand as e}from"./build.js";import{check as t}from"./check.js";import{upgrade as n}from"./upgrade/index.js";var r=[`Usage: webority <command>`,` brand [--brand <file>] [--library] [--out <dir>] [--web <scss>] [--phone <ts>] [--check]`,` upgrade <version> [--dry-run] [--path <p>]...`,` check`].join(`
|
|
2
|
+
`),i=[`brand`,`upgrade`,`check`],a=[`generated`,`design-map`,`repo-checks`],o={"--brand":`brand`,"--out":`out`,"--web":`web`,"--phone":`phone`},s=class extends Error{};function c(e){return console.error(e),console.error(r),2}function l(e){if(!(e instanceof Error))throw e;return console.error(e.message),1}function u(e,t,n){let r=[],i={},a=new Set;for(let o=0;o<e.length;o+=1){let c=e[o];if(t.includes(c)){let t=e[o+1];if(t===void 0||t.startsWith(`--`))throw new s(`${c} needs a value.`);i[c]=[...i[c]??[],t],o+=1}else if(n.includes(c))a.add(c);else if(c.startsWith(`--`))throw new s(`Unknown flag ${c}.`);else r.push(c)}return{positionals:r,values:i,flags:a}}function d(e,t){if(e===`brand`){let{positionals:e,values:n,flags:r}=u(t,Object.keys(o),[`--library`,`--check`]);if(e.length>0)throw new s(`brand takes no argument, got ${e[0]}.`);let i={};for(let[e,t]of Object.entries(o))n[e]!==void 0&&(i[t]=n[e].at(-1));return r.has(`--library`)&&(i.library=!0),r.has(`--check`)&&(i.check=!0),{kind:`brand`,options:i}}if(e===`upgrade`){let{positionals:e,values:n,flags:r}=u(t,[`--path`],[`--dry-run`]);if(e.length===0)throw new s(`upgrade needs a <version>.`);if(e.length>1)throw new s(`Unexpected argument ${e[1]}.`);let i={version:e[0]};return r.has(`--dry-run`)&&(i.dryRun=!0),n[`--path`]!==void 0&&(i.paths=n[`--path`]),{kind:`upgrade`,options:i}}if(t.length>0)throw new s(`check takes no arguments, got ${t[0]}.`);return{kind:`check`}}async function f(o,u={brand:e,upgrade:n,check:t}){if(o.includes(`--help`)||o.includes(`-h`))return console.log(r),0;if(o.length===0)return console.error(r),2;let[f,...p]=o;if(!i.includes(f))return c(`Unknown command ${f}. Commands: brand, upgrade, check.`);let m;try{m=d(f,p)}catch(e){if(e instanceof s)return c(e.message);throw e}if(m.kind===`brand`){let e;try{e=await u.brand(m.options)}catch(e){return l(e)}for(let t of e.written)console.log(`wrote ${t}`);if(!m.options.check)return 0;for(let t of e.stale)console.log(`stale ${t}`);return+(e.stale.length>0)}if(m.kind===`upgrade`){let e;try{e=await u.upgrade(m.options)}catch(e){return l(e)}for(let t of e.hits)console.log(`${t.file}:${t.line} ${t.from} -> ${t.to}`);for(let t of e.choose)console.log(`choose ${t.file}:${t.line} ${t.name}: ${t.hint}`);return+(e.choose.length>0)}let h;try{h=await u.check()}catch(e){return l(e)}for(let e of a)h.findings.some(t=>t.check===e)||console.log(`ok ${e}`);for(let e of h.findings){let t=e.file?`${e.file}: `:``;console.log(`FAIL ${e.check}: ${t}${e.message}`)}return+(h.findings.length>0)}export{e as brand,t as check,f as run,n as upgrade};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={"operations/fleet-parity-deviation-register#website":{reason:`The public sites (webority.com, Government, Demo) keep their own fluid size scale by a recorded deviation.`},"decisions/D-016-tray-app-keeps-its-own-design-tokens":{reason:`The governor tray keeps its own token values with no portal stylesheet, written through the generator.`},"operations/fleet-parity-deviation-register#studio":{reason:`Webority Studio keeps its own colours, sizes, radii and fonts, written through the generator.`}};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return{web:t(e,`web`,1440),web390:t(e,`web`,390),phone:t(e,`phone`,null)}}function t(e,t,a){let o=n(e,`light`,t,a),s=n(e,`dark`,t,a),c={format:`webority-theme-tokens/2`,source:{package:e.source.package,version:e.source.version,brand:e.source.brand,platform:t,width:a},modes:[`light`,`dark`],colors:{light:{},dark:{}},space:{},radius:{},text:{},typography:{fontWeight:{},leading:{}},fonts:{},shadow:{},components:{}};for(let t of e.tokens.values())t.group===`color`?i(c,e,t,o,s):e.existsIn(t.path,o)&&r(c,e,t,o);return c}function n(e,t,n,r){let i=e.contexts.find(e=>e.mode===t&&e.platform===n&&e.width===r);if(!i){let e=r===null?``:` ${r}`;throw Error(`emitCanvas: the model has no ${t} ${n}${e} context`)}return i}function r(e,t,n,r){let{path:i,name:o}=n;switch(n.group){case`space`:e.space[o]=s(t,i,r);break;case`radius`:e.radius[o]=s(t,i,r);break;case`text`:e.text[o]={size:s(t,i,r),lineHeight:c(t,i,r)};break;case`weight`:e.typography.fontWeight[o]=l(t,i,r);break;case`leading`:e.typography.leading[o]=l(t,i,r);break;case`font`:e.fonts[o]=u(t,i,r);break;case`shadow`:e.shadow[o]=d(t,i,r);break;case`component`:a(e,t,i,r);break}}function i(e,t,n,r,i){let a=t.existsIn(n.path,r);if(a!==t.existsIn(n.path,i))throw Error(`emitCanvas: ${n.path} is present in one mode only`);a&&(e.colors.light[n.name]=o(t,n.path,r),e.colors.dark[n.name]=o(t,n.path,i))}function a(e,t,n,r){let i=n.split(`.`);if(i.length!==3&&i.length!==4)throw Error(`emitCanvas: ${n} must be component.<name>.<prop> or component.<name>.<size>.<prop>`);let a=i[1],o=i[i.length-1];e.components[a]??={base:{},sizes:{}};let s=i.length===3?e.components[a].base:e.components[a].sizes[i[2]]??={};s[o]=p(t,n,r)}function o(e,t,n){let r=e.resolvedIn(t,n);if(typeof r!=`string`)throw Error(`emitCanvas: ${t} is not a colour string`);return r}function s(e,t,n){let r=e.resolvedIn(t,n);if(typeof r==`number`)return r;if(typeof r==`object`&&r&&r.unit===`px`&&typeof r.value==`number`)return r.value;throw Error(`emitCanvas: ${t} is not a px length`)}function c(e,t,n){let r=e.valueIn(t,n),i=typeof r==`object`&&r?r.lineHeight:void 0;if(!Number.isFinite(i))throw Error(`emitCanvas: ${t} has no lineHeight`);return i}function l(e,t,n){let r=e.resolvedIn(t,n);if(typeof r!=`number`)throw Error(`emitCanvas: ${t} is not a number`);return r}function u(e,t,n){let r=e.resolvedIn(t,n);if(!Array.isArray(r)||r.length===0)throw Error(`emitCanvas: ${t} is not a font family list`);return{family:r[0],fallback:r.slice(1).join(`, `)}}function d(e,t,n){let r=e.resolvedIn(t,n);if(r===`none`)return null;if(typeof r!=`object`||!r||typeof r.color!=`string`)throw Error(`emitCanvas: ${t} is not a shadow`);let[i,a,o,s]=[`offsetX`,`offsetY`,`blur`,`spread`].map(e=>f(t,r[e])),c={x:i,y:a,blur:o,spread:s,color:r.color},l=e.tokens.get(t)?.extensions?.elevation;return Number.isFinite(l)&&(c.elevation=l),c}function f(e,t){let n=typeof t==`number`?t:t?.value;if(typeof n!=`number`)throw Error(`emitCanvas: ${e} has a shadow length that is not a number`);return n}function p(e,t,n){let r=e.resolvedIn(t,n);if(typeof r==`string`||typeof r==`number`)return String(r);if(typeof r==`object`&&r&&typeof r.unit==`string`)return`${r.value}${r.unit}`;throw Error(`emitCanvas: ${t} is not a component value`)}export{e as emitCanvas};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=[`light`,`dark`],t=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`]),n=[[`body`,`ui`],[`display`,`display`],[`mono`,`mono`]],r=Object.freeze({page:`bg`,canvas:`bg`,card:`surface`,panel:`bg-subtle`,"panel-alt":`bg-muted`,surface:`surface`,line:`border`,"line-strong":`border-strong`,"accent-tint-line":`primary-wash-strong`,heading:`text`,strong:`text`,text:`text-body`,secondary:`text-muted`,muted:`text-subtle`,accent:`primary`,"on-accent":`on-primary`,link:`link`,success:`success-text`,warning:`warning-text`,danger:`danger-text`,"accent-tint":`primary-wash`,"success-tint":`success-soft`,"warning-tint":`warning-soft`,"danger-tint":`danger-soft`,"figure-panel":`primary-wash`}),i=Object.freeze({eyebrow:`xs`,h1:`2xl`,lede:`lg`,body:`base`,"body-large":`lg`,title:`2xl`,item:`base`,label:`sm`,note:`sm`,"note-small":`xs`,figure:`3xl`,"figure-hero":`4xl`,"figure-sub":`sm`,range:`sm`,sign:`base`,foot:`xs`,num:`base`,"code-otp":`2xl`,"code-id":`base`,button:`base`}),a=Object.freeze({section:`2xl`,"section-phone":`xl`,tight:`md`,item:`sm`,"heading-after":`xl`,"eyebrow-after":`xxs`,"title-after":`md`,"callout-lead-after":`xs`,"paragraph-gap":`sm`,"sign-gap":`2xl`,"sign-gap-phone":`lg`,"signature-gap":`md`,"step-gap":`lg`,"step-gutter":`3xl`,"step-gutter-phone":`2xl`,"step-number-space":`md`,"step-number-space-phone":`sm`,"column-top":`lg`,"column-gap":`lg`,"row-padding":`sm`,"panel-padding":`lg`,"panel-padding-wide":`lg`,"details-padding":`lg`,"details-padding-wide":`lg`,"hero-padding":`xl lg`,"hero-padding-wide":`2xl lg`,"columns-padding":`none lg lg lg`,"columns-padding-wide":`xs lg lg lg`}),o=new Set([`panel-padding`,`panel-padding-wide`,`details-padding`,`details-padding-wide`,`hero-padding`,`hero-padding-wide`,`columns-padding`,`columns-padding-wide`]),s=Object.freeze({"panel-radius":`md`,"tint-radius":`md`,"code-radius":`md`,"details-radius":`md`}),c=Object.freeze({radius:`md`,padding:`md sm`});function l(e){return Math.floor(e+.5)}function u(e){if(typeof e!=`string`)return null;let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(e);if(t===null)return null;let n=t[1];n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=e=>Number.parseInt(n.slice(e,e+2),16);return{r:r(0),g:r(2),b:r(4),a:n.length===8?r(6)/255:1}}function d(e,t,n){return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`.toUpperCase()}function f(e,t){if(e.a===1)return d(e.r,e.g,e.b);if(t===null)return null;let n=(t,n)=>l(t*e.a+n*(1-e.a));return d(n(e.r,t.r),n(e.g,t.g),n(e.b,t.b))}function p(t,n){let i={},a={light:{},dark:{}};for(let o of e){let e=t.colors?.[o]?.surface;e===void 0&&n(`email role card needs meaning surface in ${o}`);let s=u(e);s!==null&&s.a<1&&n(`email card colour (meaning surface, ${o}) must be opaque`),i[o]=s;for(let[e,s]of Object.entries(r)){let r=t.colors?.[o]?.[s];if(r===void 0){n(`email role ${e} needs meaning ${s} in ${o}`);continue}let c=u(r);if(c===null){n(`email role ${e} (meaning ${s}, ${o}): cannot read colour ${r}`);continue}a[o][e]=f(c,i[o])}}return Object.fromEntries(Object.keys(r).map(e=>[e,{light:a.light[e],dark:a.dark[e]}]))}function m(e,t,n){let r={};for(let[a,o]of Object.entries(i)){let i=e.text?.[o],s=t.text?.[o];i===void 0&&n(`email type role ${a} needs text step ${o}`),s===void 0&&n(`email type role ${a} needs text step ${o} in the 390 theme`),!(i===void 0||s===void 0)&&(r[a]={size:l(i.size),lineHeight:l(i.size*i.lineHeight),phoneSize:l(s.size),phoneLineHeight:l(s.size*s.lineHeight)})}return r}function h(e,t,n,r){let i=[],a=!0;for(let o of t.split(/\s+/))typeof e.space?.[o]==`number`?i.push(e.space[o]):(r(n(o)),a=!1);return a?i.map(e=>`${e}px`).join(` `):null}function g(e,t,n,r){return/\s/.test(n)?(r(`email space role ${t} is a gap and takes one space step, not ${n}`),null):typeof e.space?.[n]==`number`?e.space[n]:(r(`email space role ${t} needs space step ${n}`),null)}function _(e,t){let n={};for(let[r,i]of Object.entries(a)){let a=o.has(r)?h(e,i,e=>`email space role ${r} needs space step ${e}`,t):g(e,r,i,t);a!==null&&(n[r]=a)}return n}function v(e,t){let n={};for(let[r,i]of Object.entries(s)){let a=e.radius?.[i];typeof a==`number`?n[r]=a:t(`email shape role ${r} needs radius step ${i}`)}return n}function y(e,t){let n=e.radius?.[c.radius];return typeof n!=`number`&&t(`email button needs radius step ${c.radius}`),{radius:n,padding:h(e,c.padding,e=>`email button needs space step ${e}`,t)}}function b(e){let t=e.trim();return t.length>=2&&t[0]===t.at(-1)&&(t[0]===`"`||t[0]===`'`)?t.slice(1,-1).trim():t}function x(e){return t.has(e.toLowerCase())||e.startsWith(`-`)?e:e.includes(` `)?`'${e}'`:e}function S(e,t,n){let r=[t.family,...t.fallback.split(`,`)].map(b).filter(e=>e.length>0),i=r.find(e=>/["';<>]/.test(e));return i===void 0?r.map(x).join(`, `):(n(`email font ${e} holds an unsafe character: ${i}`),null)}function C(e,t){let r={};for(let[i,a]of n){let n=e.fonts?.[a];if(typeof n?.family!=`string`||typeof n?.fallback!=`string`){t(`email fonts need font ${a}`);continue}r[i]=S(a,n,t)}return r}function w(e,t){if(e?.format!==`webority-theme-tokens/2`||e.source?.platform!==`web`)throw Error(`emitEmail: web must be the web theme tokens at width 1440`);if(e.source.width!==1440)throw Error(`emitEmail: web must be the 1440 theme`);if(t?.format!==`webority-theme-tokens/2`||t.source?.platform!==`web`||t.source?.width!==390)throw Error(`emitEmail: web390 must be the web theme tokens at width 390`);let n=[],r=e=>n.push(`emitEmail: ${e}`),i=p(e,r),a=m(e,t,r),o=_(e,r),s=v(e,r),c=y(e,r),l=C(e,r);if(n.length>0)throw Error(n.join(`
|
|
2
|
+
`));return{format:`webority-email-theme/1`,source:{package:e.source.package,version:e.source.version,brand:e.source.brand},colors:i,fonts:l,type:a,space:o,shape:s,button:c}}export{c as EMAIL_BUTTON,r as EMAIL_COLOR_ROLES,s as EMAIL_SHAPE,a as EMAIL_SPACE,i as EMAIL_TYPE_ROLES,w as emitEmail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let t={};for(let n of e.tokens.values())if(n.group===`color`){if(typeof n.description!=`string`||n.description.length===0)throw Error(`webority-tokens: color.${n.name}: no description`);t[n.name]={description:n.description,platforms:[...n.platforms??[`web`,`phone`]]}}return{format:`webority-meanings/1`,source:{package:e.source.package,version:e.source.version},color:t}}export{e as emitMeanings};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var e=/^[A-Za-z_$][A-Za-z0-9_$]*$/,t=/^#([0-9a-fA-F]{6})([0-9a-fA-F]{2})?$/,n=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/,r=[`xs`,`sm`,`md`,`lg`,`xl`],i=`must be component.<name>.<prop> or component.<name>.<size>.<prop>`,a=[`light`,`dark`],o={color:`colors`,space:`space`,radius:`radius`,text:`text`,weight:`weight`,leading:`leading`,"letter-spacing":`letter-spacing`,font:`font`,shadow:`shadow`,size:`size`,component:`components`},s=[{key:`colors`,constName:`COLOR_NAMES`,typeName:`ColorName`},{key:`space`,constName:`SPACE_NAMES`,typeName:`SpaceName`},{key:`radius`,constName:`RADIUS_NAMES`,typeName:`RadiusName`},{key:`text`,constName:`TEXT_NAMES`,typeName:`TextName`},{key:`weight`,constName:`WEIGHT_NAMES`,typeName:`WeightName`},{key:`leading`,constName:`LEADING_NAMES`,typeName:`LeadingName`},{key:`letter-spacing`,constName:`LETTER_SPACING_NAMES`,typeName:`LetterSpacingName`},{key:`font`,constName:`FONT_NAMES`,typeName:`FontName`},{key:`shadow`,constName:`SHADOW_NAMES`,typeName:`ShadowName`},{key:`motion.duration`,constName:`DURATION_NAMES`,typeName:`DurationName`},{key:`motion.ease`,constName:`EASE_NAMES`,typeName:`EaseName`},{key:`size`,constName:`SIZE_NAMES`,typeName:`SizeName`}],c={space:`SpaceName`,text:`TextName`,radius:`RadiusName`,px:`number`,number:`number`,ms:`number`},l=[`export type FontWeightValue = "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900";`,`/** Face name per weight; an empty object means the platform system font. */`,`export type FontFaces = Partial<Record<WeightName, string>>;`,`export interface PhoneShadow {`,` shadowColor: string;`,` shadowOffset: { width: number; height: number };`,` shadowOpacity: number;`,` shadowRadius: number;`,` elevation: number;`,`}`,`export type ComponentKind = "space" | "text" | "radius" | "px" | "number" | "ms";`,`type Sized<S extends string, T> = Record<S, T>;`,`type L3 = "sm" | "md" | "lg";`],u=[`export interface TokenSet {`,` mode: "light" | "dark";`,` colors: Record<ColorName, string>;`,` space: Record<SpaceName, number>;`,` radius: Record<RadiusName, number>;`,` text: Record<TextName, { size: number; lineHeight: number }>;`,` weight: Record<WeightName, FontWeightValue>;`,` leading: Record<LeadingName, number>;`,` "letter-spacing": Record<LetterSpacingName, number>;`,` font: Record<FontName, FontFaces>;`,` shadow: Record<ShadowName, PhoneShadow>;`,` motion: { duration: Record<DurationName, number>; ease: Record<EaseName, readonly [number, number, number, number]> };`,` size: Record<SizeName, number>;`,` components: ComponentTokens;`,`}`];function d(e,t){let n=e.contexts.find(e=>e.platform===`phone`&&e.mode===t);if(!n)throw Error(`phoneSets: the model has no ${t} phone context`);let r=[];for(let t of e.tokens.values()){if(!e.existsIn(t.path,n))continue;let i=e.resolvedIn(t.path,n);r.push({path:t.path.split(`.`),type:t.type,value:t.group===`text`?m(t.path,e,n,i):i,reference:e.referenceIn(t.path,n)??null,platforms:t.platforms,extensions:Object.keys(t.extensions).length>0?t.extensions:null})}return r}function f(e){let t=y(e.light),n=y(e.dark);D(t,n);let r=["// Generated by `webority brand --library` from packages/tokens/src/source. Do not edit: run `corepack pnpm --filter @webority/mobile-ui tokens`."];for(let e of s)r.push(...j(e,t.lists.get(e.key)));return r.push(...l),r.push(...I(t.components)),r.push(...L(t.components)),r.push(...u),r.push(...B(`lightTokens`,`light`,t)),r.push(...B(`darkTokens`,`dark`,n)),{name:`tokens.generated.ts`,contents:`${r.join(`
|
|
2
|
+
`)}\n`}}function p(e,t,n){let r={colors:{light:{},dark:{}},radius:{},font:{}};for(let n of a){let i=y(e[n]).values,a=y(t[n]).values;for(let e of new Set([...i.keys(),...a.keys()])){let t=i.get(e),o=a.get(e);if(!t||!o)throw Error(k(e));if(JSON.stringify(t.value)===JSON.stringify(o.value))continue;let s=e.lastIndexOf(`.`),c=e.slice(0,s),l=e.slice(s+1);if(c===`radius`&&(l===`none`||l===`pill`))throw Error(`A brand cannot change radius none or pill`);if(c===`colors`)r.colors[n][l]=o.value;else if(c===`radius`)O(r.radius,l,o.value,e);else if(c===`font`)O(r.font,l,o.value,e);else throw Error(k(e))}}let i=Object.fromEntries(a.filter(e=>Object.keys(r.colors[e]).length>0).map(e=>[e,r.colors[e]])),o={};Object.keys(i).length>0&&(o.colors=i),Object.keys(r.radius).length>0&&(o.radius=r.radius),Object.keys(r.font).length>0&&(o.font=r.font);let s=[`// Generated by \`webority brand\` for ${n.brand} from ${n.package} ${n.version}. Do not edit.`,``,`/** @type {import("@webority/mobile-ui").BrandOverrides} */`];return Object.keys(o).length===0?s.push(`export const brand = {};`):s.push(`export const brand = {`,...Object.entries(o).flatMap(([e,t])=>H(e,t,` `)),`};`),{name:`brand.phone.js`,contents:`${s.join(`
|
|
3
|
+
`)}\n`}}function m(e,t,n,r){let i=t.valueIn(e,n)?.lineHeight;if(!Number.isFinite(i))throw Error(`phoneSets: ${e} has no lineHeight`);return{size:v(r,e),lineHeight:i}}function h(e){return e.extensions?.internal===!0?!1:e.platforms===null||e.platforms.includes(`phone`)}function g(e,t){return Error(`Token group ${e} has no phone mapping; mark it web or add one to emit/phone.js (first: ${t})`)}function _(e){let[t,n]=e.path;if(t===`motion`){if(n===`duration`||n===`ease`)return`motion.${n}`;throw g(t,e.path.join(`.`))}if(!Object.hasOwn(o,t))throw g(t,e.path.join(`.`));return o[t]}function v(e,t){let n=typeof e==`object`&&e?e.value:e;if(!Number.isFinite(n))throw Error(`Token ${t} has no numeric value`);return n}function y(e){let t=new Map(s.map(e=>[e.key,[]])),n=new Map,r=new Map;for(let i of e){if(!h(i))continue;let e=i.path.join(`.`),a=_(i);if(i.value===void 0||i.value===null)throw Error(`Token ${e} has no phone value`);if(a===`components`){T(i,e,n,r);continue}let o=i.path.slice(a.startsWith(`motion.`)?2:1).join(`-`);n.set(`${a}.${o}`,{path:e,value:b(a,o,i,e)}),t.get(a).push(o)}return{lists:t,values:n,components:r}}function b(e,t,n,r){let{value:i}=n;switch(e){case`colors`:return i;case`space`:case`radius`:case`letter-spacing`:case`size`:case`leading`:case`motion.duration`:return v(i,r);case`text`:{let e=v(i.size,r);if(!Number.isFinite(i.lineHeight))throw Error(`Token ${r} has no phone value`);return{size:e,lineHeight:Math.round(e*i.lineHeight)}}case`weight`:return String(v(i,r));case`font`:return x(n,t);case`shadow`:return S(n,t,r);case`motion.ease`:return w(i,r)}}function x(e,t){if(Array.isArray(e.value)&&e.value.length===1&&e.value[0]===`System`)return{};if(!e.extensions?.faces)throw Error(`Font ${t} is not the system font and has no faces`);return e.extensions.faces}function S(e,t,n){let{color:r,offsetX:i,offsetY:a,blur:o}=e.value,{hex:s,opacity:c}=C(r,n),l=e.extensions?.elevation;if(!Number.isFinite(l))throw Error(`Shadow ${t} has no elevation`);return{shadowColor:s,shadowOffset:{width:v(i,n),height:v(a,n)},shadowOpacity:c,shadowRadius:v(o,n),elevation:l}}function C(e,r){let i=t.exec(e);if(i){let e=i[2]===void 0?1:Math.round(parseInt(i[2],16)/255*1e3)/1e3;return{hex:`#${i[1].toLowerCase()}`,opacity:e}}let a=n.exec(e);if(a)return{hex:`#${a.slice(1,4).map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}`,opacity:Number(a[4])};throw Error(`Shadow ${r} colour is not #RRGGBB, #RRGGBBAA or rgba(): ${e}`)}function w(e,t){if(!Array.isArray(e)||e.length!==4||!e.every(e=>Number.isFinite(e)))throw Error(`Token ${t} has no phone value`);return[...e]}function T(e,t,n,a){let o=e.path,s=o.length===4;if(o.length!==3&&!s||s&&!r.includes(o[2]))throw Error(`Component token ${t} ${i}`);let c=o[1],l=o[o.length-1],{kind:u,value:d}=E(e,t);a.has(c)||a.set(c,{props:new Map,sizes:new Map,free:new Map});let f=a.get(c);if(f.props.has(l)&&f.props.get(l)!==u)throw Error(`Component ${c} prop ${l} has two kinds`);if(f.props.set(l,u),s){let e=o[2];f.sizes.has(e)||f.sizes.set(e,new Map),f.sizes.get(e).set(l,d),n.set(`components.${c}.${e}.${l}`,{path:t,value:d})}else f.free.set(l,d),n.set(`components.${c}.${l}`,{path:t,value:d})}function E(e,t){let{reference:n}=e;for(let[e,t]of[[`space.`,`space`],[`text.`,`text`],[`radius.`,`radius`]])if(n?.startsWith(e))return{kind:t,value:n.slice(e.length)};if(!n){if(e.type===`dimension`)return{kind:`px`,value:v(e.value,t)};if(e.type===`number`)return{kind:`number`,value:v(e.value,t)};if(e.type===`duration`)return{kind:`ms`,value:v(e.value,t)}}throw Error(`Component token ${t} has an unsupported value`)}function D(e,t){for(let[n,{path:r}]of e.values)if(!t.values.has(n))throw Error(`Token ${r} exists in one mode only`);for(let[n,{path:r}]of t.values)if(!e.values.has(n))throw Error(`Token ${r} exists in one mode only`)}function O(e,t,n,r){if(Object.hasOwn(e,t)&&JSON.stringify(e[t])!==JSON.stringify(n))throw Error(`A brand sets ${r} differently in light and dark`);e[t]=n}function k(e){return`A brand overrides colours, radius and fonts only; ${e} differs`}function A(t){return e.test(t)?t:JSON.stringify(t)}function j(e,t){let n=`export type ${e.typeName} = (typeof ${e.constName})[number];`;return t.length<=12?[`export const ${e.constName} = [${t.map(e=>JSON.stringify(e)).join(`, `)}] as const;`,n]:[`export const ${e.constName} = [`,...t.map(e=>` ${JSON.stringify(e)},`),`] as const;`,n]}var M=140;function N(e,t){return t.map(t=>`${A(t)}: ${c[e.props.get(t)]}`)}function P(e){return e.split(/[^A-Za-z0-9]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function F(e,t){return[`export interface ${e} {`,...t.map(e=>` ${e};`),`}`]}function I(e){let t=[],n=[];for(let[i,a]of e){let e=N(a,[...a.free.keys()]),o=N(a,[...new Set([...a.sizes.values()].flatMap(e=>[...e.keys()]))]),s=r.filter(e=>a.sizes.has(e)),c=s.join()===`sm,md,lg`?`L3`:s.map(e=>JSON.stringify(e)).join(` | `),l=e=>`{ ${e.join(`; `)} }`,u=(t,n)=>o.length===0?n:`Sized<${c}, ${t}>${e.length>0?` & ${n}`:``}`,d=` ${A(i)}: ${u(l(o),l(e))};`;if(d.length<=M){n.push(d);continue}let f=P(i);o.length>0&&t.push(...F(`${f}SizeTokens`,o)),e.length>0&&t.push(...F(`${f}Tokens`,e)),n.push(` ${A(i)}: ${u(`${f}SizeTokens`,`${f}Tokens`)};`)}let i=[...t,`export interface ComponentTokens {`,...n];return i.push(`}`,`export type ComponentName = keyof ComponentTokens;`,`type SizeKeysOf<C extends ComponentName> = Extract<keyof ComponentTokens[C], "xs" | "sm" | "md" | "lg" | "xl">;`,`export type ComponentSizeTokens<C extends ComponentName> = ComponentTokens[C][SizeKeysOf<C>];`),i}function L(e){let t=[`export const COMPONENT_KINDS = {`];for(let[n,r]of e){let e=[...r.props].map(([e,t])=>`${A(e)}: ${JSON.stringify(t)}`),i=` ${A(n)}: { ${e.join(`, `)} },`;i.length<=M?t.push(i):t.push(` ${A(n)}: {`,...e.map(e=>` ${e},`),` },`)}return t.push(`} as const satisfies { readonly [C in ComponentName]: Readonly<Record<string, ComponentKind>> };`),t}function R(e){let t={};for(let[n,i]of e){let e={};for(let t of r)i.sizes.has(t)&&(e[t]=Object.fromEntries(i.sizes.get(t)));for(let[t,n]of i.free)e[t]=n;t[n]=e}return t}function z(e,t){let{lists:n}=t,r=(e,n)=>Object.fromEntries(n.map(n=>[n,t.values.get(`${e}.${n}`).value]));return{mode:e,colors:r(`colors`,n.get(`colors`)),space:r(`space`,n.get(`space`)),radius:r(`radius`,n.get(`radius`)),text:r(`text`,n.get(`text`)),weight:r(`weight`,n.get(`weight`)),leading:r(`leading`,n.get(`leading`)),"letter-spacing":r(`letter-spacing`,n.get(`letter-spacing`)),font:r(`font`,n.get(`font`)),shadow:r(`shadow`,n.get(`shadow`)),motion:{duration:r(`motion.duration`,n.get(`motion.duration`)),ease:r(`motion.ease`,n.get(`motion.ease`))},size:r(`size`,n.get(`size`)),components:R(t.components)}}function B(e,t,n){let r=z(t,n);return[`export const ${e}: TokenSet = {`,...Object.entries(r).flatMap(([e,t])=>H(e,t,` `)),`};`]}function V(e){return Array.isArray(e)?`[${e.map(e=>V(e)).join(`, `)}]`:JSON.stringify(e)}function H(e,t,n){let r=`${n}${A(e)}`;if(typeof t==`object`&&t&&!Array.isArray(t)){let e=Object.entries(t);return e.length===0?[`${r}: {},`]:[`${r}: {`,...e.flatMap(([e,t])=>H(e,t,`${n} `)),`${n}},`]}return[`${r}: ${V(t)},`]}export{p as emitPhoneBrand,f as emitPhoneTheme,d as phoneSets};
|
package/dist/emit/web.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{BREAKPOINT_PX as e,breakpointRules as t,fluidLength as n}from"../model/length.js";import{cssVarOfPath as r}from"../names.js";var i={mode:`light`,platform:`web`,width:1440},a={mode:`dark`,platform:`web`,width:1440},o={mode:`light`,platform:`web`,width:390},s=/\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}/g,c=/^\{([a-z0-9-]+(?:\.[a-z0-9-]+)+)\}$/,l=/^#[0-9a-f]{6}$/i,u=[[`--bs-body-color`,`text`],[`--bs-emphasis-color`,`text`],[`--bs-secondary-color`,`text-muted`],[`--bs-tertiary-color`,`text-subtle`],[`--bs-body-bg`,`bg`],[`--bs-border-color`,`border`],[`--bs-secondary-bg`,`surface`],[`--bs-tertiary-bg`,`bg-muted`]],d=[[`--bs-body-bg-rgb`,`bg`],[`--bs-body-color-rgb`,`text`],[`--bs-emphasis-color-rgb`,`text`],[`--bs-secondary-color-rgb`,`text-muted`],[`--bs-tertiary-color-rgb`,`text-subtle`],[`--bs-secondary-bg-rgb`,`surface`],[`--bs-tertiary-bg-rgb`,`bg-muted`],[`--bs-border-color-rgb`,`border`]],f=[[`$body-color`,`color.text-body`],[`$body-secondary-color`,`color.text-muted`],[`$body-tertiary-color`,`color.text-subtle`],[`$body-secondary-bg`,`color.bg-subtle`],[`$body-tertiary-bg`,`color.bg-muted`],[`$border-color`,`color.border`],[`$border-color-translucent`,`color.border`],[`$border-radius`,`radius.md`],[`$border-radius-sm`,`radius.sm`],[`$border-radius-lg`,`radius.lg`],[`$border-radius-pill`,`radius.pill`],[`$wui-shadow-overlay`,`shadow.popover`],[`$wui-shadow-overlay-lg`,`shadow.modal`],[`$link-color`,`color.link`]],p=`:root[data-theme="dark"],
|
|
2
|
+
:root[data-bs-theme="dark"]`,m=`[data-theme="dark"]:not(:root),
|
|
3
|
+
[data-bs-theme="dark"]:not(:root)`,h=`:root[data-theme="auto"]`,g=`[data-theme="dark"]:not(:root) [data-theme="light"],
|
|
4
|
+
[data-theme="dark"]:not(:root) [data-bs-theme="light"],
|
|
5
|
+
[data-bs-theme="dark"]:not(:root) [data-theme="light"],
|
|
6
|
+
[data-bs-theme="dark"]:not(:root) [data-bs-theme="light"]`,_=`// var() resolves where a name is declared, so the html copies keep the light values for a light box.`,v=`/* var() resolves where a name is declared, so the html copies keep the light values for a light box. */`,y=`// Zero specificity, so a component's own class on a themed section or inside it keeps its colour.`,b=`/* Zero specificity, so a component's own class on a themed section or inside it keeps its colour. */`;function x(e){return String(Number(e.toFixed(4)))}function S(e,t){if(typeof t==`string`)return t.replace(s,(e,t)=>`var(${r(t)})`);if(typeof t==`number`)return x(t);if(Array.isArray(t)){if(e.type===`cubicBezier`&&t.length===4&&t.every(e=>typeof e==`number`))return`cubic-bezier(${t.map(e=>x(e)).join(`, `)})`;if(e.type===`fontFamily`&&t.every(e=>typeof e==`string`))return t.map(e=>/\s/.test(e)?`"${e}"`:e).join(`, `)}else if(t&&typeof t==`object`){if(`unit`in t&&typeof t.value==`number`)return`${x(t.value)}${t.unit}`;if(`color`in t)return[t.offsetX,t.offsetY,t.blur,t.spread,t.color].map(t=>S(e,t)).join(` `)}throw Error(`emitWeb: ${e.path}: cannot write a ${e.type} value as CSS.`)}function C(e,t,n){let r=e.tokens.get(t);return r.extensions?.derive?e.resolvedIn(t,n):S(r,e.valueIn(t,n))}function w(e,t){if(t&&typeof t==`object`&&t.unit===`px`&&typeof t.value==`number`)return t.value;throw Error(`emitWeb: ${e}: a text size must be a px dimension.`)}function T(e,a){let s=e.tokens.get(a),c=r(a);if(s.group===`text`){if(t(s).length>0)throw Error(`emitWeb: ${a}: a text size cannot carry breakpoints.`);let r=w(a,e.valueIn(a,o)),l=w(a,e.valueIn(a,i)),u=s.extensions?.fluidUntil;if(r!==l&&u===void 0)throw Error(`emitWeb: ${a}: the 390 and 1440 sizes differ but no fluidUntil is recorded.`);return{path:a,name:c,root:n(r,l,u??1440),tiers:[]}}let l=t(s);return l.length>0?{path:a,name:c,root:C(e,a,o),tiers:l.map(e=>({tier:e.tier,text:S(s,e.value)}))}:{path:a,name:c,root:C(e,a,i),tiers:[]}}function E(e){let t=[];for(let n of e.tokens.keys())e.existsIn(n,i)&&t.push(T(e,n));return t}function D(e,n){let o=[];for(let[s,c]of e.tokens){if(!e.existsIn(s,a)||!e.existsIn(s,i)||t(c).length>0)continue;let l=C(e,s,a);if(c.group===`text`){if(l!==C(e,s,i))throw Error(`emitWeb: ${s}: a text size cannot change with the mode.`);continue}n(s,l)&&o.push({path:s,name:r(s),text:l})}return o}function O(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function k(e,t){let n=[];for(let[r,i]of d){let o=`color.${i}`,s=e.resolvedIn(o,a);if(!l.test(s))throw Error(`emitWeb: ${o}: a Bootstrap rgb triplet needs an opaque colour.`);t(o,s)&&n.push({name:r,text:O(s)})}return n}function A(e,t){let n=D(e,t?(e,n)=>!t.tokens.has(e)||!t.existsIn(e,a)||n!==C(t,e,a):(t,n)=>n!==C(e,t,i)),o=k(e,t?(e,n)=>n!==t.resolvedIn(e,a):()=>!0);if(t)return[...n,...o];let s=u.map(([e,t])=>({name:e,text:`var(${r(`color.${t}`)})`}));return[...n,...s,...o]}function j(e,t){return`${e} {\n${t.join(`
|
|
7
|
+
`).split(`
|
|
8
|
+
`).map(e=>e===``?e:` ${e}`).join(`
|
|
9
|
+
`)}\n}`}function M(e){return e.split(`,
|
|
10
|
+
`).map(e=>`:where(${e})`).join(`,
|
|
11
|
+
`)}function N(e){let t=[];for(let n=0;n<e.length;n+=6)t.push(e.slice(n,n+6).join(`, `));return[`$wui-dark-layer-names: (\n${t.map((e,n)=>` ${e}${n<t.length-1?`,`:``}`).join(`
|
|
12
|
+
`)}\n);`,_,j(`html`,[`@each $name in $wui-dark-layer-names {`,` --wui-light-#{$name}: var(--#{$name});`,`}`]),j(g,[`@each $name in $wui-dark-layer-names {`,` --#{$name}: var(--wui-light-#{$name});`,`}`]),j(M(g),[`color-scheme: light;`,`color: var(--color-text);`])].join(`
|
|
13
|
+
|
|
14
|
+
`)}function P(e){return[v,j(`html`,e.map(e=>`--wui-light-${e}: var(--${e});`)),j(g,e.map(e=>`--${e}: var(--wui-light-${e});`)),j(M(g),[`color-scheme: light;`,`color: var(--color-text);`])].join(`
|
|
15
|
+
|
|
16
|
+
`)}function F(e,t,n=!1){let{package:r,version:i,brand:a}=e.source,o=t?`Generated by ${r} ${i} for the ${a} brand. Do not edit; run webority brand.`:`Generated by ${r} ${i} from its token source. Do not edit; run webority brand --library.`;return n?`/* ${o} */`:`// ${o}`}function I(t,n){let r=E(t),i=new Map((n?E(n):[]).map(e=>[e.path,e])),a=[],o=r.filter(e=>i.get(e.path)?.root!==e.root).map(e=>`${e.name}: ${e.root};`);o.length>0&&a.push(j(`:root`,o));for(let[t,n]of Object.entries(e)){let e=[];for(let n of r)for(let r of n.tiers)r.tier===t&&i.get(n.path)?.tiers.find(e=>e.tier===t)?.text!==r.text&&e.push(`${n.name}: ${r.text};`);e.length>0&&a.push(j(`@media (min-width: ${n}px)`,[j(`:root`,e)]))}let s=A(t,n);if(s.length>0){let e=s.map(e=>`${e.name}: ${e.text};`),t=n?b:y;a.push(j(p,[...e,`color-scheme: dark;`]),j(m,e),`${t}\n${j(M(m),[`color-scheme: dark;`,`color: var(--color-text);`])}`);let r=s.map(e=>e.name.slice(2));if(n){let e=new Set(A(n,null).map(e=>e.name.slice(2))),t=r.filter(t=>!e.has(t));t.length>0&&a.push(P(t))}else a.push(N(r));a.push(j(`@media (prefers-color-scheme: dark)`,[j(h,[...e,`color-scheme: dark;`])]))}return[F(t,n!==null,n!==null),...a].join(`
|
|
17
|
+
|
|
18
|
+
`)+`
|
|
19
|
+
`}function L(e,t){let n=e.tokens.get(t);if(n.type===`color`)return e.resolvedIn(t,i);let r=e.valueIn(t,i),a=typeof r==`string`?c.exec(r):null;if(a)return L(e,a[1]);let o=S(n,r);if(o.includes(`var(`))throw Error(`emitWeb: ${t}: a Bootstrap variable needs a literal.`);return o}function R(e){let t=f.map(([t,n])=>`${t}: ${L(e,n)} !default;`);return[F(e,!1),...t].join(`
|
|
20
|
+
`)+`
|
|
21
|
+
`}function z(e,t){let n=f.filter(([,n])=>L(e,n)!==L(t,n)).map(([t,n])=>`${t}: ${L(e,n)};`);return[F(e,!0),...n].join(`
|
|
22
|
+
`)+`
|
|
23
|
+
`}function B(e,t){return t===void 0?{tokens:I(e,null),bootstrap:R(e)}:{css:I(e,t.library),variables:z(e,t.library)}}export{B as emitWeb};
|