@digdir/designsystemet 1.0.8 → 1.1.1
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/dist/bin/config.d.ts +3 -3
- package/dist/bin/config.d.ts.map +1 -1
- package/dist/bin/config.js +45 -45
- package/dist/bin/designsystemet.js +827 -748
- package/dist/config.schema.json +4 -4
- package/dist/src/colors/index.d.ts +2 -2
- package/dist/src/colors/index.d.ts.map +1 -1
- package/dist/src/colors/index.js +143 -143
- package/dist/src/colors/theme.d.ts +1 -2
- package/dist/src/colors/theme.d.ts.map +1 -1
- package/dist/src/config.d.ts +6 -21
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +43 -40
- package/dist/src/index.js +418 -430
- package/dist/src/scripts/createJsonSchema.js +23 -24
- package/dist/src/scripts/update-template.d.ts.map +1 -1
- package/dist/src/tokens/build.d.ts +1 -1
- package/dist/src/tokens/build.d.ts.map +1 -1
- package/dist/src/tokens/build.js +359 -280
- package/dist/src/tokens/create/generators/$designsystemet.js +16 -15
- package/dist/src/tokens/create/generators/color.js +21 -21
- package/dist/src/tokens/create/write.js +17 -16
- package/dist/src/tokens/create.d.ts +1 -0
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +22 -21
- package/dist/src/tokens/format.d.ts.map +1 -1
- package/dist/src/tokens/format.js +931 -944
- package/dist/src/tokens/index.d.ts +2 -2
- package/dist/src/tokens/index.d.ts.map +1 -1
- package/dist/src/tokens/index.js +295 -307
- package/dist/src/tokens/process/configs/color.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/color.js +5 -5
- package/dist/src/tokens/process/configs/semantic.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/semantic.js +5 -5
- package/dist/src/tokens/process/configs/storefront.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/storefront.js +1 -1
- package/dist/src/tokens/process/configs/typography.d.ts.map +1 -1
- package/dist/src/tokens/process/configs/typography.js +5 -5
- package/dist/src/tokens/process/configs.d.ts.map +1 -1
- package/dist/src/tokens/process/configs.js +5 -5
- package/dist/src/tokens/process/formats/css/color.js +2 -2
- package/dist/src/tokens/process/formats/css/semantic.js +2 -2
- package/dist/src/tokens/process/formats/css/typography.js +1 -1
- package/dist/src/tokens/process/formats/css.js +5 -5
- package/dist/src/tokens/process/formats/js-tokens.js +1 -1
- package/dist/src/tokens/process/output/declarations.d.ts +4 -0
- package/dist/src/tokens/process/output/declarations.d.ts.map +1 -0
- package/dist/src/tokens/process/output/declarations.js +860 -0
- package/dist/src/tokens/process/output/tailwind.d.ts +3 -0
- package/dist/src/tokens/process/output/tailwind.d.ts.map +1 -0
- package/dist/src/tokens/process/output/tailwind.js +59 -0
- package/dist/src/tokens/process/{theme.d.ts → output/theme.d.ts} +2 -2
- package/dist/src/tokens/process/output/theme.d.ts.map +1 -0
- package/dist/src/tokens/process/{theme.js → output/theme.js} +20 -19
- package/dist/src/tokens/process/platform.d.ts +8 -4
- package/dist/src/tokens/process/platform.d.ts.map +1 -1
- package/dist/src/tokens/process/platform.js +27 -56
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts +1 -0
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts.map +1 -1
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +12 -5
- package/dist/src/tokens/types.d.ts +1 -1
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/dist/src/tokens/utils.d.ts.map +1 -1
- package/package.json +16 -15
- package/dist/src/tokens/process/theme.d.ts.map +0 -1
|
@@ -6,26 +6,8 @@ import { z as z2 } from "zod/v4";
|
|
|
6
6
|
// src/config.ts
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
import * as R7 from "ramda";
|
|
9
|
-
import { fromError } from "zod-validation-error";
|
|
10
9
|
import { z } from "zod/v4";
|
|
11
|
-
|
|
12
|
-
// src/colors/utils.ts
|
|
13
|
-
import chroma from "chroma-js";
|
|
14
|
-
import Colorjs from "colorjs.io";
|
|
15
|
-
import { Hsluv } from "hsluv";
|
|
16
|
-
var convertToHex = (color) => {
|
|
17
|
-
if (!color) {
|
|
18
|
-
return "#000000";
|
|
19
|
-
}
|
|
20
|
-
if (/^#[0-9A-Fa-f]{6}$/.test(color)) {
|
|
21
|
-
return color;
|
|
22
|
-
}
|
|
23
|
-
return chroma(color).hex();
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// src/colors/theme.ts
|
|
27
|
-
import chroma2 from "chroma-js";
|
|
28
|
-
import * as R2 from "ramda";
|
|
10
|
+
import { fromError } from "zod-validation-error/v4";
|
|
29
11
|
|
|
30
12
|
// src/colors/colorMetadata.ts
|
|
31
13
|
import * as R from "ramda";
|
|
@@ -273,6 +255,24 @@ var colorMetadata = {
|
|
|
273
255
|
};
|
|
274
256
|
var colorMetadataByNumber = R.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
275
257
|
|
|
258
|
+
// src/colors/theme.ts
|
|
259
|
+
import chroma2 from "chroma-js";
|
|
260
|
+
import * as R2 from "ramda";
|
|
261
|
+
|
|
262
|
+
// src/colors/utils.ts
|
|
263
|
+
import chroma from "chroma-js";
|
|
264
|
+
import Colorjs from "colorjs.io";
|
|
265
|
+
import { Hsluv } from "hsluv";
|
|
266
|
+
var convertToHex = (color) => {
|
|
267
|
+
if (!color) {
|
|
268
|
+
return "#000000";
|
|
269
|
+
}
|
|
270
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(color)) {
|
|
271
|
+
return color;
|
|
272
|
+
}
|
|
273
|
+
return chroma(color).hex();
|
|
274
|
+
};
|
|
275
|
+
|
|
276
276
|
// src/colors/theme.ts
|
|
277
277
|
var RESERVED_COLORS = [
|
|
278
278
|
"neutral",
|
|
@@ -334,22 +334,21 @@ var themeSchema = z.object({
|
|
|
334
334
|
}).describe("Defines the typography for a given theme").optional(),
|
|
335
335
|
borderRadius: z.number().meta({ description: "Defines the border-radius for this theme" }).optional()
|
|
336
336
|
}).meta({ description: "An object defining a theme. The property name holding the object becomes the theme name." });
|
|
337
|
-
var
|
|
337
|
+
var commonConfig = z.object({
|
|
338
338
|
clean: z.boolean().meta({ description: "Delete the output directory before building or creating tokens" }).optional()
|
|
339
339
|
});
|
|
340
|
-
var
|
|
340
|
+
var _configFileCreateSchema = z.object({
|
|
341
341
|
outDir: z.string().meta({ description: "Path to the output directory for the created design tokens" }),
|
|
342
|
-
clean: z.boolean().meta({ description: "Delete the output directory before building or creating tokens" }).optional(),
|
|
343
342
|
themes: z.record(z.string(), themeSchema).meta({
|
|
344
343
|
description: "An object with one or more themes. Each property defines a theme, and the property name is used as the theme name."
|
|
345
344
|
})
|
|
346
345
|
}).required();
|
|
347
|
-
var
|
|
346
|
+
var configFileCreateSchema = _configFileCreateSchema.extend(commonConfig.shape);
|
|
348
347
|
|
|
349
348
|
// src/scripts/createJsonSchema.ts
|
|
350
349
|
var schema = z2.object({
|
|
351
350
|
$schema: z2.string().optional()
|
|
352
|
-
}).extend(
|
|
351
|
+
}).extend(configFileCreateSchema.shape);
|
|
353
352
|
writeFile(
|
|
354
353
|
resolve(import.meta.dirname, "../../dist/config.schema.json"),
|
|
355
354
|
JSON.stringify(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-template.d.ts","sourceRoot":"","sources":["../../../src/scripts/update-template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-template.d.ts","sourceRoot":"","sources":["../../../src/scripts/update-template.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,eAAe,qBA+E3B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type BuildOptions } from './process/platform.js';
|
|
2
|
-
export declare const buildTokens: (options: Omit<BuildOptions, "type" | "$themes">) => Promise<import("./process/platform.js").ProcessReturn>;
|
|
2
|
+
export declare const buildTokens: (options: Omit<BuildOptions, "type" | "processed$themes">) => Promise<import("./process/platform.js").ProcessReturn>;
|
|
3
3
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/tokens/build.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/tokens/build.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,uBAAuB,CAAC;AAkB3E,eAAO,MAAM,WAAW,GAAU,SAAS,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,CAAC,2DAqDzF,CAAC"}
|