@digdir/designsystemet 1.0.5 → 1.0.6
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 +7 -0
- package/dist/bin/designsystemet.js +49 -42
- package/dist/src/colors/index.js +32 -0
- package/dist/src/colors/theme.js +1 -0
- package/dist/src/colors/utils.d.ts +13 -0
- package/dist/src/colors/utils.d.ts.map +1 -1
- package/dist/src/colors/utils.js +32 -0
- package/dist/src/config.js +1 -0
- package/dist/src/index.js +80 -42
- package/dist/src/scripts/createJsonSchema.js +39 -38
- package/dist/src/tokens/build.js +48 -42
- package/dist/src/tokens/create/generators/$designsystemet.js +22 -20
- package/dist/src/tokens/create/generators/$themes.js +10 -10
- package/dist/src/tokens/create/generators/color.js +1 -0
- package/dist/src/tokens/create/write.js +32 -30
- package/dist/src/tokens/create.js +1 -0
- package/dist/src/tokens/format.js +49 -42
- package/dist/src/tokens/index.js +49 -42
- package/dist/src/tokens/process/configs/color.js +26 -22
- package/dist/src/tokens/process/configs/semantic.js +16 -12
- package/dist/src/tokens/process/configs/shared.js +16 -12
- package/dist/src/tokens/process/configs/storefront.js +16 -12
- package/dist/src/tokens/process/configs/typography.js +16 -12
- package/dist/src/tokens/process/configs.js +26 -22
- package/dist/src/tokens/process/formats/css/color.js +16 -12
- package/dist/src/tokens/process/formats/css/semantic.js +16 -12
- package/dist/src/tokens/process/formats/css.js +16 -12
- package/dist/src/tokens/process/formats/js-tokens.js +16 -12
- package/dist/src/tokens/process/platform.js +26 -22
- package/dist/src/tokens/process/theme.js +22 -20
- package/dist/src/tokens/process/transformers.js +16 -12
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +26 -22
- package/dist/src/tokens/utils.d.ts +2 -2
- package/dist/src/tokens/utils.d.ts.map +1 -1
- package/dist/src/tokens/utils.js +16 -12
- package/package.json +31 -29
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/colors/utils.ts
|
|
2
2
|
import chroma from "chroma-js";
|
|
3
|
+
import Colorjs from "colorjs.io";
|
|
3
4
|
import { Hsluv } from "hsluv";
|
|
4
5
|
var hexToCssHsl = (hex, valuesOnly = false) => {
|
|
5
6
|
const [h, s, l] = chroma(hex).hsl();
|
|
@@ -72,6 +73,9 @@ var getLuminanceFromLightness = (lightness) => {
|
|
|
72
73
|
conv.hsluvToHex();
|
|
73
74
|
return chroma(conv.hex).luminance();
|
|
74
75
|
};
|
|
76
|
+
var getLuminanceFromColor = (color) => {
|
|
77
|
+
return chroma(color).luminance();
|
|
78
|
+
};
|
|
75
79
|
var getLightnessFromHex = (hex) => {
|
|
76
80
|
const conv = new Hsluv();
|
|
77
81
|
conv.hex = hex;
|
|
@@ -106,6 +110,32 @@ var rgbToHex = (rgb) => {
|
|
|
106
110
|
return hex.length === 1 ? "0" + hex : hex;
|
|
107
111
|
}).join("")}`;
|
|
108
112
|
};
|
|
113
|
+
var convertColor = (cssColor, format) => {
|
|
114
|
+
const color = new Colorjs(cssColor);
|
|
115
|
+
switch (format) {
|
|
116
|
+
case "rgb":
|
|
117
|
+
case "rgba":
|
|
118
|
+
return color.toString({
|
|
119
|
+
format: {
|
|
120
|
+
name: format,
|
|
121
|
+
coords: ["<number>[0, 255]", "<number>[0, 255]", "<number>[0, 255]"]
|
|
122
|
+
},
|
|
123
|
+
precision: 3
|
|
124
|
+
});
|
|
125
|
+
case "hex":
|
|
126
|
+
return color.toString({ format, precision: 3 });
|
|
127
|
+
case "hct":
|
|
128
|
+
return color.to(format).toString({
|
|
129
|
+
format: {
|
|
130
|
+
name: format,
|
|
131
|
+
coords: ["<number>", "<number>", "<number>"]
|
|
132
|
+
},
|
|
133
|
+
precision: 3
|
|
134
|
+
});
|
|
135
|
+
default:
|
|
136
|
+
return color.to(format).toString({ precision: 3 });
|
|
137
|
+
}
|
|
138
|
+
};
|
|
109
139
|
|
|
110
140
|
// src/colors/theme.ts
|
|
111
141
|
import chroma2 from "chroma-js";
|
|
@@ -2203,14 +2233,14 @@ var createTokens = async (opts) => {
|
|
|
2203
2233
|
// src/tokens/format.ts
|
|
2204
2234
|
import * as R20 from "ramda";
|
|
2205
2235
|
|
|
2206
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
|
|
2236
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
|
|
2207
2237
|
var BoxShadowTypes;
|
|
2208
2238
|
(function(BoxShadowTypes2) {
|
|
2209
2239
|
BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
|
|
2210
2240
|
BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
|
|
2211
2241
|
})(BoxShadowTypes || (BoxShadowTypes = {}));
|
|
2212
2242
|
|
|
2213
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
|
|
2243
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
|
|
2214
2244
|
var ColorModifierTypes;
|
|
2215
2245
|
(function(ColorModifierTypes2) {
|
|
2216
2246
|
ColorModifierTypes2["LIGHTEN"] = "lighten";
|
|
@@ -2219,7 +2249,7 @@ var ColorModifierTypes;
|
|
|
2219
2249
|
ColorModifierTypes2["ALPHA"] = "alpha";
|
|
2220
2250
|
})(ColorModifierTypes || (ColorModifierTypes = {}));
|
|
2221
2251
|
|
|
2222
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
|
|
2252
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
|
|
2223
2253
|
var ColorSpaceTypes;
|
|
2224
2254
|
(function(ColorSpaceTypes2) {
|
|
2225
2255
|
ColorSpaceTypes2["LCH"] = "lch";
|
|
@@ -2228,7 +2258,7 @@ var ColorSpaceTypes;
|
|
|
2228
2258
|
ColorSpaceTypes2["HSL"] = "hsl";
|
|
2229
2259
|
})(ColorSpaceTypes || (ColorSpaceTypes = {}));
|
|
2230
2260
|
|
|
2231
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/Properties.js
|
|
2261
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js
|
|
2232
2262
|
var Properties;
|
|
2233
2263
|
(function(Properties2) {
|
|
2234
2264
|
Properties2["sizing"] = "sizing";
|
|
@@ -2280,7 +2310,7 @@ var Properties;
|
|
|
2280
2310
|
Properties2["description"] = "description";
|
|
2281
2311
|
})(Properties || (Properties = {}));
|
|
2282
2312
|
|
|
2283
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
|
|
2313
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
|
|
2284
2314
|
var TokenSetStatus;
|
|
2285
2315
|
(function(TokenSetStatus2) {
|
|
2286
2316
|
TokenSetStatus2["DISABLED"] = "disabled";
|
|
@@ -2288,7 +2318,7 @@ var TokenSetStatus;
|
|
|
2288
2318
|
TokenSetStatus2["ENABLED"] = "enabled";
|
|
2289
2319
|
})(TokenSetStatus || (TokenSetStatus = {}));
|
|
2290
2320
|
|
|
2291
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
|
|
2321
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
|
|
2292
2322
|
var TokenTypes;
|
|
2293
2323
|
(function(TokenTypes2) {
|
|
2294
2324
|
TokenTypes2["OTHER"] = "other";
|
|
@@ -2319,7 +2349,7 @@ var TokenTypes;
|
|
|
2319
2349
|
TokenTypes2["NUMBER"] = "number";
|
|
2320
2350
|
})(TokenTypes || (TokenTypes = {}));
|
|
2321
2351
|
|
|
2322
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/BorderValues.js
|
|
2352
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js
|
|
2323
2353
|
var BorderValues;
|
|
2324
2354
|
(function(BorderValues2) {
|
|
2325
2355
|
BorderValues2["BORDER_COLOR"] = "color";
|
|
@@ -2327,7 +2357,7 @@ var BorderValues;
|
|
|
2327
2357
|
BorderValues2["BORDER_STYLE"] = "style";
|
|
2328
2358
|
})(BorderValues || (BorderValues = {}));
|
|
2329
2359
|
|
|
2330
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
|
|
2360
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
|
|
2331
2361
|
var StrokeStyleValues;
|
|
2332
2362
|
(function(StrokeStyleValues2) {
|
|
2333
2363
|
StrokeStyleValues2["SOLID"] = "solid";
|
|
@@ -2340,7 +2370,7 @@ var StrokeStyleValues;
|
|
|
2340
2370
|
StrokeStyleValues2["INSET"] = "inset";
|
|
2341
2371
|
})(StrokeStyleValues || (StrokeStyleValues = {}));
|
|
2342
2372
|
|
|
2343
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
|
|
2373
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
|
|
2344
2374
|
var BoxShadowValues;
|
|
2345
2375
|
(function(BoxShadowValues2) {
|
|
2346
2376
|
BoxShadowValues2["TYPE"] = "type";
|
|
@@ -2352,7 +2382,7 @@ var BoxShadowValues;
|
|
|
2352
2382
|
BoxShadowValues2["BLEND_MODE"] = "blendMode";
|
|
2353
2383
|
})(BoxShadowValues || (BoxShadowValues = {}));
|
|
2354
2384
|
|
|
2355
|
-
// ../../node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
|
|
2385
|
+
// ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
|
|
2356
2386
|
var TypographyValues;
|
|
2357
2387
|
(function(TypographyValues2) {
|
|
2358
2388
|
TypographyValues2["FONT_FAMILY"] = "fontFamily";
|
|
@@ -2556,20 +2586,24 @@ var mapToLowerCase = R7.map(R7.toLower);
|
|
|
2556
2586
|
var hasAnyTruth = R7.any(R7.equals(true));
|
|
2557
2587
|
var getType = (token) => (token.$type ?? token.type) || "";
|
|
2558
2588
|
var getValue = (token) => token.$value ?? token.value;
|
|
2559
|
-
var typeEquals = R7.curry(
|
|
2560
|
-
|
|
2561
|
-
|
|
2589
|
+
var typeEquals = R7.curry(
|
|
2590
|
+
(types, token) => {
|
|
2591
|
+
if (R7.isNil(token)) {
|
|
2592
|
+
return false;
|
|
2593
|
+
}
|
|
2594
|
+
return R7.includes(R7.toLower(getType(token)), R7.map(R7.toLower, Array.isArray(types) ? types : [types]));
|
|
2562
2595
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2596
|
+
);
|
|
2597
|
+
var pathStartsWithOneOf = R7.curry(
|
|
2598
|
+
(paths, token) => {
|
|
2599
|
+
if (R7.isNil(token)) {
|
|
2600
|
+
return false;
|
|
2601
|
+
}
|
|
2602
|
+
const tokenPath = mapToLowerCase(token.path);
|
|
2603
|
+
const matchPathsStartingWith = R7.map((path) => R7.startsWith([path], tokenPath), mapToLowerCase(paths));
|
|
2604
|
+
return hasAnyTruth(matchPathsStartingWith);
|
|
2568
2605
|
}
|
|
2569
|
-
|
|
2570
|
-
const matchPathsStartingWith = R7.map((path) => R7.startsWith([path], tokenPath), mapToLowerCase(paths));
|
|
2571
|
-
return hasAnyTruth(matchPathsStartingWith);
|
|
2572
|
-
});
|
|
2606
|
+
);
|
|
2573
2607
|
function isSemanticToken(token) {
|
|
2574
2608
|
return token.filePath.includes("semantic/");
|
|
2575
2609
|
}
|
|
@@ -3465,11 +3499,11 @@ import chalk3 from "chalk";
|
|
|
3465
3499
|
// package.json
|
|
3466
3500
|
var package_default = {
|
|
3467
3501
|
name: "@digdir/designsystemet",
|
|
3468
|
-
version: "1.0.
|
|
3502
|
+
version: "1.0.6",
|
|
3469
3503
|
description: "CLI for Designsystemet",
|
|
3470
3504
|
author: "Designsystemet team",
|
|
3471
3505
|
engines: {
|
|
3472
|
-
node: ">=22.
|
|
3506
|
+
node: ">=22.15.0"
|
|
3473
3507
|
},
|
|
3474
3508
|
repository: {
|
|
3475
3509
|
type: "git",
|
|
@@ -3499,56 +3533,58 @@ var package_default = {
|
|
|
3499
3533
|
},
|
|
3500
3534
|
scripts: {
|
|
3501
3535
|
designsystemet: "tsx ./bin/designsystemet.ts",
|
|
3502
|
-
"build:tokens": "
|
|
3536
|
+
"build:tokens": "pnpm run designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
|
|
3503
3537
|
"build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
|
|
3504
|
-
build: "tsup &&
|
|
3538
|
+
build: "tsup && pnpm build:types && pnpm build:json-schema",
|
|
3505
3539
|
"build:types": "tsc --emitDeclarationOnly --declaration",
|
|
3506
3540
|
"build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
|
|
3507
3541
|
types: "tsc --noEmit",
|
|
3508
|
-
"test:tokens-create-options":
|
|
3509
|
-
"test:tokens-create-config": "
|
|
3510
|
-
"test:tokens-build": "
|
|
3511
|
-
"test:tokens-build-config": "
|
|
3512
|
-
"test:tokens-create-and-build-options": "
|
|
3513
|
-
"test:tokens-create-and-build-config": "
|
|
3514
|
-
test: "
|
|
3515
|
-
"internal:tokens-create": "
|
|
3542
|
+
"test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./test-tokens/options --theme options --clean',
|
|
3543
|
+
"test:tokens-create-config": "pnpm run designsystemet tokens create --config ./test/test-tokens.config.json",
|
|
3544
|
+
"test:tokens-build": "pnpm run designsystemet tokens build -t ./test-tokens/options -o ./test-tokens/options-build --clean",
|
|
3545
|
+
"test:tokens-build-config": "pnpm run designsystemet tokens build -t ./test-tokens/config -o ./test-tokens/config-build --clean",
|
|
3546
|
+
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
3547
|
+
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
3548
|
+
test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
|
|
3549
|
+
"internal:tokens-create": "pnpm run designsystemet tokens create --config ./internal.config.json",
|
|
3516
3550
|
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
3517
|
-
"update:design-tokens": "
|
|
3518
|
-
verify: "
|
|
3551
|
+
"update:design-tokens": "pnpm internal:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
|
|
3552
|
+
verify: "pnpm test && pnpm update:template && pnpm update:design-tokens"
|
|
3519
3553
|
},
|
|
3520
3554
|
dependencies: {
|
|
3521
3555
|
"@commander-js/extra-typings": "^13.1.0",
|
|
3522
|
-
"@tokens-studio/sd-transforms": "1.
|
|
3556
|
+
"@tokens-studio/sd-transforms": "1.3.0",
|
|
3523
3557
|
"apca-w3": "^0.1.9",
|
|
3524
3558
|
chalk: "^5.4.1",
|
|
3525
3559
|
"change-case": "^5.4.4",
|
|
3526
3560
|
"chroma-js": "^3.1.2",
|
|
3561
|
+
"colorjs.io": "^0.6.0-alpha.1",
|
|
3527
3562
|
commander: "^13.1.0",
|
|
3528
3563
|
"fast-glob": "^3.3.3",
|
|
3529
3564
|
hsluv: "^1.0.1",
|
|
3530
3565
|
"object-hash": "^3.0.0",
|
|
3531
3566
|
postcss: "^8.5.3",
|
|
3532
3567
|
ramda: "^0.30.1",
|
|
3533
|
-
"style-dictionary": "^4.
|
|
3534
|
-
zod: "^3.24.
|
|
3568
|
+
"style-dictionary": "^4.4.0",
|
|
3569
|
+
zod: "^3.24.4",
|
|
3535
3570
|
"zod-validation-error": "^3.4.0"
|
|
3536
3571
|
},
|
|
3537
3572
|
devDependencies: {
|
|
3573
|
+
"@tokens-studio/types": "0.5.2",
|
|
3538
3574
|
"@types/apca-w3": "^0.1.3",
|
|
3539
3575
|
"@types/chroma-js": "^3.1.1",
|
|
3540
3576
|
"@types/fs-extra": "^11.0.4",
|
|
3541
3577
|
"@types/glob": "^8.1.0",
|
|
3542
3578
|
"@types/jscodeshift": "^0.12.0",
|
|
3543
|
-
"@types/node": "^22.
|
|
3579
|
+
"@types/node": "^22.15.3",
|
|
3544
3580
|
"@types/object-hash": "^3.0.6",
|
|
3545
3581
|
"@types/ramda": "^0.30.2",
|
|
3546
3582
|
"fs-extra": "^11.3.0",
|
|
3547
3583
|
"ts-toolbelt": "^9.6.0",
|
|
3548
3584
|
tslib: "^2.8.1",
|
|
3549
3585
|
tsup: "^8.4.0",
|
|
3550
|
-
tsx: "^4.19.
|
|
3551
|
-
typescript: "^5.8.
|
|
3586
|
+
tsx: "^4.19.4",
|
|
3587
|
+
typescript: "^5.8.3",
|
|
3552
3588
|
"zod-to-json-schema": "^3.24.5"
|
|
3553
3589
|
}
|
|
3554
3590
|
};
|
|
@@ -3659,6 +3695,7 @@ export {
|
|
|
3659
3695
|
canTextBeUsedOnColors,
|
|
3660
3696
|
cliOptions,
|
|
3661
3697
|
colorMetadata,
|
|
3698
|
+
convertColor,
|
|
3662
3699
|
convertToHex,
|
|
3663
3700
|
createTokens,
|
|
3664
3701
|
formatThemeCSS,
|
|
@@ -3671,6 +3708,7 @@ export {
|
|
|
3671
3708
|
getContrastFromLightness,
|
|
3672
3709
|
getCssVariable,
|
|
3673
3710
|
getLightnessFromHex,
|
|
3711
|
+
getLuminanceFromColor,
|
|
3674
3712
|
getLuminanceFromLightness,
|
|
3675
3713
|
hexToCssHsl,
|
|
3676
3714
|
hexToHSL,
|
|
@@ -3,7 +3,7 @@ import { writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { z as z2 } from "zod";
|
|
5
5
|
|
|
6
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
6
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
7
7
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
8
8
|
var defaultOptions = {
|
|
9
9
|
name: void 0,
|
|
@@ -36,7 +36,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
36
36
|
...options
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
39
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
40
40
|
var getRefs = (options) => {
|
|
41
41
|
const _options = getDefaultOptions(options);
|
|
42
42
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
@@ -56,7 +56,7 @@ var getRefs = (options) => {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
59
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
60
60
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
61
61
|
if (!refs?.errorMessages)
|
|
62
62
|
return;
|
|
@@ -72,15 +72,15 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
72
72
|
addErrorMessage(res, key, errorMessage, refs);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
75
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
76
76
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod";
|
|
77
77
|
|
|
78
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
78
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
79
79
|
function parseAnyDef() {
|
|
80
80
|
return {};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
83
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
84
84
|
import { ZodFirstPartyTypeKind } from "zod";
|
|
85
85
|
function parseArrayDef(def, refs) {
|
|
86
86
|
const res = {
|
|
@@ -105,7 +105,7 @@ function parseArrayDef(def, refs) {
|
|
|
105
105
|
return res;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
108
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
109
109
|
function parseBigintDef(def, refs) {
|
|
110
110
|
const res = {
|
|
111
111
|
type: "integer",
|
|
@@ -151,24 +151,24 @@ function parseBigintDef(def, refs) {
|
|
|
151
151
|
return res;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
154
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
155
155
|
function parseBooleanDef() {
|
|
156
156
|
return {
|
|
157
157
|
type: "boolean"
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
161
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
162
162
|
function parseBrandedDef(_def, refs) {
|
|
163
163
|
return parseDef(_def.type._def, refs);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
166
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
167
167
|
var parseCatchDef = (def, refs) => {
|
|
168
168
|
return parseDef(def.innerType._def, refs);
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
171
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
172
172
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
173
173
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
174
174
|
if (Array.isArray(strategy)) {
|
|
@@ -227,7 +227,7 @@ var integerDateParser = (def, refs) => {
|
|
|
227
227
|
return res;
|
|
228
228
|
};
|
|
229
229
|
|
|
230
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
230
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
231
231
|
function parseDefaultDef(_def, refs) {
|
|
232
232
|
return {
|
|
233
233
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -235,12 +235,12 @@ function parseDefaultDef(_def, refs) {
|
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
238
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
239
239
|
function parseEffectsDef(_def, refs) {
|
|
240
240
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : {};
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
243
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
244
244
|
function parseEnumDef(def) {
|
|
245
245
|
return {
|
|
246
246
|
type: "string",
|
|
@@ -248,7 +248,7 @@ function parseEnumDef(def) {
|
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
251
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
252
252
|
var isJsonSchema7AllOfType = (type) => {
|
|
253
253
|
if ("type" in type && type.type === "string")
|
|
254
254
|
return false;
|
|
@@ -290,7 +290,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
290
290
|
} : void 0;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
293
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
294
294
|
function parseLiteralDef(def, refs) {
|
|
295
295
|
const parsedType = typeof def.value;
|
|
296
296
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
@@ -310,10 +310,10 @@ function parseLiteralDef(def, refs) {
|
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
313
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
314
314
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod";
|
|
315
315
|
|
|
316
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
316
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
317
317
|
var emojiRegex = void 0;
|
|
318
318
|
var zodPatterns = {
|
|
319
319
|
/**
|
|
@@ -638,7 +638,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
638
638
|
return pattern;
|
|
639
639
|
}
|
|
640
640
|
|
|
641
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
641
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
642
642
|
function parseRecordDef(def, refs) {
|
|
643
643
|
if (refs.target === "openAi") {
|
|
644
644
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -690,7 +690,7 @@ function parseRecordDef(def, refs) {
|
|
|
690
690
|
return schema2;
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
693
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
694
694
|
function parseMapDef(def, refs) {
|
|
695
695
|
if (refs.mapStrategy === "record") {
|
|
696
696
|
return parseRecordDef(def, refs);
|
|
@@ -715,7 +715,7 @@ function parseMapDef(def, refs) {
|
|
|
715
715
|
};
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
718
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
719
719
|
function parseNativeEnumDef(def) {
|
|
720
720
|
const object = def.values;
|
|
721
721
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
@@ -729,14 +729,14 @@ function parseNativeEnumDef(def) {
|
|
|
729
729
|
};
|
|
730
730
|
}
|
|
731
731
|
|
|
732
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
732
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
733
733
|
function parseNeverDef() {
|
|
734
734
|
return {
|
|
735
735
|
not: {}
|
|
736
736
|
};
|
|
737
737
|
}
|
|
738
738
|
|
|
739
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
739
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
740
740
|
function parseNullDef(refs) {
|
|
741
741
|
return refs.target === "openApi3" ? {
|
|
742
742
|
enum: ["null"],
|
|
@@ -746,7 +746,7 @@ function parseNullDef(refs) {
|
|
|
746
746
|
};
|
|
747
747
|
}
|
|
748
748
|
|
|
749
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
749
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
750
750
|
var primitiveMappings = {
|
|
751
751
|
ZodString: "string",
|
|
752
752
|
ZodNumber: "number",
|
|
@@ -814,7 +814,7 @@ var asAnyOf = (def, refs) => {
|
|
|
814
814
|
return anyOf.length ? { anyOf } : void 0;
|
|
815
815
|
};
|
|
816
816
|
|
|
817
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
817
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
818
818
|
function parseNullableDef(def, refs) {
|
|
819
819
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
820
820
|
if (refs.target === "openApi3") {
|
|
@@ -846,7 +846,7 @@ function parseNullableDef(def, refs) {
|
|
|
846
846
|
return base && { anyOf: [base, { type: "null" }] };
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
849
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
850
850
|
function parseNumberDef(def, refs) {
|
|
851
851
|
const res = {
|
|
852
852
|
type: "number"
|
|
@@ -895,7 +895,7 @@ function parseNumberDef(def, refs) {
|
|
|
895
895
|
return res;
|
|
896
896
|
}
|
|
897
897
|
|
|
898
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
898
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
899
899
|
import { ZodOptional } from "zod";
|
|
900
900
|
function parseObjectDef(def, refs) {
|
|
901
901
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
@@ -966,7 +966,7 @@ function safeIsOptional(schema2) {
|
|
|
966
966
|
}
|
|
967
967
|
}
|
|
968
968
|
|
|
969
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
969
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
970
970
|
var parseOptionalDef = (def, refs) => {
|
|
971
971
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
972
972
|
return parseDef(def.innerType._def, refs);
|
|
@@ -985,7 +985,7 @@ var parseOptionalDef = (def, refs) => {
|
|
|
985
985
|
} : {};
|
|
986
986
|
};
|
|
987
987
|
|
|
988
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
988
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
989
989
|
var parsePipelineDef = (def, refs) => {
|
|
990
990
|
if (refs.pipeStrategy === "input") {
|
|
991
991
|
return parseDef(def.in._def, refs);
|
|
@@ -1005,12 +1005,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
1005
1005
|
};
|
|
1006
1006
|
};
|
|
1007
1007
|
|
|
1008
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
1008
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
1009
1009
|
function parsePromiseDef(def, refs) {
|
|
1010
1010
|
return parseDef(def.type._def, refs);
|
|
1011
1011
|
}
|
|
1012
1012
|
|
|
1013
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
1013
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
1014
1014
|
function parseSetDef(def, refs) {
|
|
1015
1015
|
const items = parseDef(def.valueType._def, {
|
|
1016
1016
|
...refs,
|
|
@@ -1030,7 +1030,7 @@ function parseSetDef(def, refs) {
|
|
|
1030
1030
|
return schema2;
|
|
1031
1031
|
}
|
|
1032
1032
|
|
|
1033
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
1033
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
1034
1034
|
function parseTupleDef(def, refs) {
|
|
1035
1035
|
if (def.rest) {
|
|
1036
1036
|
return {
|
|
@@ -1058,24 +1058,24 @@ function parseTupleDef(def, refs) {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
1060
|
|
|
1061
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
1061
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
1062
1062
|
function parseUndefinedDef() {
|
|
1063
1063
|
return {
|
|
1064
1064
|
not: {}
|
|
1065
1065
|
};
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
1068
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
1069
1069
|
function parseUnknownDef() {
|
|
1070
1070
|
return {};
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
1073
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
1074
1074
|
var parseReadonlyDef = (def, refs) => {
|
|
1075
1075
|
return parseDef(def.innerType._def, refs);
|
|
1076
1076
|
};
|
|
1077
1077
|
|
|
1078
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
1078
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
1079
1079
|
var selectParser = (def, typeName, refs) => {
|
|
1080
1080
|
switch (typeName) {
|
|
1081
1081
|
case ZodFirstPartyTypeKind3.ZodString:
|
|
@@ -1151,7 +1151,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
};
|
|
1153
1153
|
|
|
1154
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
1154
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
1155
1155
|
function parseDef(def, refs, forceResolution = false) {
|
|
1156
1156
|
const seenItem = refs.seen.get(def);
|
|
1157
1157
|
if (refs.override) {
|
|
@@ -1215,7 +1215,7 @@ var addMeta = (def, refs, jsonSchema) => {
|
|
|
1215
1215
|
return jsonSchema;
|
|
1216
1216
|
};
|
|
1217
1217
|
|
|
1218
|
-
// ../../node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1218
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.24.4/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1219
1219
|
var zodToJsonSchema = (schema2, options) => {
|
|
1220
1220
|
const refs = getRefs(options);
|
|
1221
1221
|
const definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema3]) => ({
|
|
@@ -1265,6 +1265,7 @@ import { z } from "zod";
|
|
|
1265
1265
|
|
|
1266
1266
|
// src/colors/utils.ts
|
|
1267
1267
|
import chroma from "chroma-js";
|
|
1268
|
+
import Colorjs from "colorjs.io";
|
|
1268
1269
|
import { Hsluv } from "hsluv";
|
|
1269
1270
|
var convertToHex = (color) => {
|
|
1270
1271
|
if (!color) {
|