@navikt/aksel 7.21.1 → 7.22.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/dist/codemod/run-codeshift.js +17 -7
- package/dist/codemod/transforms/darkside/box-to-boxnew/box-to-boxnew.js +68 -8
- package/dist/codemod/utils/check.js +17 -7
- package/dist/darkside/config/darkside.tokens.js +12 -12
- package/dist/darkside/config/legacy.tokens.js +38 -18
- package/dist/darkside/config/token.utils.js +2 -2
- package/dist/darkside/run-tooling.js +20 -9
- package/dist/darkside/tasks/status.js +9 -6
- package/dist/darkside/transforms/darkside-tokens-js.js +0 -1
- package/package.json +5 -5
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.default = transformer;
|
|
27
37
|
const legacy_tokens_1 = require("../../../../darkside/config/legacy.tokens");
|
|
@@ -78,6 +88,27 @@ function transformer(file, api) {
|
|
|
78
88
|
}
|
|
79
89
|
});
|
|
80
90
|
}
|
|
91
|
+
(0, ast_1.findProps)({ j, path: astElement, name: "borderRadius" }).forEach((attr) => {
|
|
92
|
+
const attrValue = attr.value.value;
|
|
93
|
+
if (attrValue.type === "StringLiteral") {
|
|
94
|
+
/* borderRadius="xlarge" */
|
|
95
|
+
attrValue.value = convertBorderRadiusToRadius(attrValue.value);
|
|
96
|
+
}
|
|
97
|
+
else if (attrValue.type === "JSXExpressionContainer") {
|
|
98
|
+
/* borderRadius={{xs: "xlarge", sm: "large"}} */
|
|
99
|
+
const expression = attrValue.expression;
|
|
100
|
+
if (expression.type === "ObjectExpression") {
|
|
101
|
+
/* xs, md, sm */
|
|
102
|
+
expression.properties.forEach((property) => {
|
|
103
|
+
if (property.type === "ObjectProperty") {
|
|
104
|
+
if (property.value.type === "StringLiteral") {
|
|
105
|
+
property.value.value = convertBorderRadiusToRadius(property.value.value);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
81
112
|
if (!encounteredUnmigratableProp) {
|
|
82
113
|
// TODO: ?? Box -> BoxNew type fail? (but works)
|
|
83
114
|
astElement.node.openingElement.name.name = "BoxNew";
|
|
@@ -105,7 +136,7 @@ function transformer(file, api) {
|
|
|
105
136
|
toImport: "@navikt/ds-react/Box",
|
|
106
137
|
fromName: "Box",
|
|
107
138
|
toName: "BoxNew",
|
|
108
|
-
ignoreAlias:
|
|
139
|
+
ignoreAlias: true,
|
|
109
140
|
});
|
|
110
141
|
}
|
|
111
142
|
const output = `${blockComment ? blockComment + "\n\n" : ""}${root.toSource(toSourceOptions)}`;
|
|
@@ -157,3 +188,32 @@ const analyzePartialMigration = (j, source) => {
|
|
|
157
188
|
}
|
|
158
189
|
return "mixed";
|
|
159
190
|
};
|
|
191
|
+
const legacyBorderRadiusNameTokenLookup = {
|
|
192
|
+
full: "full",
|
|
193
|
+
xlarge: "12",
|
|
194
|
+
large: "8",
|
|
195
|
+
medium: "4",
|
|
196
|
+
small: "2",
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Takes an old valid border-radius token and returns the new converted radius token
|
|
200
|
+
* oldValue: "xlarge", "full"
|
|
201
|
+
* @returns "12", "full"
|
|
202
|
+
*/
|
|
203
|
+
function convertBorderRadiusToRadius(oldValue) {
|
|
204
|
+
const radiusTokens = oldValue.split(" ");
|
|
205
|
+
const newRadius = [];
|
|
206
|
+
for (const radiusToken of radiusTokens) {
|
|
207
|
+
if (radiusToken === "full") {
|
|
208
|
+
newRadius.push(radiusToken);
|
|
209
|
+
}
|
|
210
|
+
else if (!(radiusToken in legacyBorderRadiusNameTokenLookup)) {
|
|
211
|
+
console.warn(`Possibly invalid radius token found: ${radiusToken}\n`);
|
|
212
|
+
newRadius.push(radiusToken);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
newRadius.push(`${legacyBorderRadiusNameTokenLookup[radiusToken]}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return newRadius.join(" ");
|
|
219
|
+
}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -211,47 +211,47 @@ const colors = [
|
|
|
211
211
|
"border-neutral-subtle",
|
|
212
212
|
"border-neutral",
|
|
213
213
|
"text-meta-lime-contrast",
|
|
214
|
-
"text-meta-lime-
|
|
214
|
+
"text-meta-lime-decoration",
|
|
215
215
|
"text-meta-lime-subtle",
|
|
216
216
|
"text-meta-lime",
|
|
217
217
|
"text-meta-purple-contrast",
|
|
218
|
-
"text-meta-purple-
|
|
218
|
+
"text-meta-purple-decoration",
|
|
219
219
|
"text-meta-purple-subtle",
|
|
220
220
|
"text-meta-purple",
|
|
221
221
|
"text-brand-blue-contrast",
|
|
222
|
-
"text-brand-blue-
|
|
222
|
+
"text-brand-blue-decoration",
|
|
223
223
|
"text-brand-blue-subtle",
|
|
224
224
|
"text-brand-blue",
|
|
225
225
|
"text-brand-beige-contrast",
|
|
226
|
-
"text-brand-beige-
|
|
226
|
+
"text-brand-beige-decoration",
|
|
227
227
|
"text-brand-beige-subtle",
|
|
228
228
|
"text-brand-beige",
|
|
229
229
|
"text-brand-magenta-contrast",
|
|
230
|
-
"text-brand-magenta-
|
|
230
|
+
"text-brand-magenta-decoration",
|
|
231
231
|
"text-brand-magenta-subtle",
|
|
232
232
|
"text-brand-magenta",
|
|
233
233
|
"text-info-contrast",
|
|
234
|
-
"text-info-
|
|
234
|
+
"text-info-decoration",
|
|
235
235
|
"text-info-subtle",
|
|
236
236
|
"text-info",
|
|
237
237
|
"text-danger-contrast",
|
|
238
|
-
"text-danger-
|
|
238
|
+
"text-danger-decoration",
|
|
239
239
|
"text-danger-subtle",
|
|
240
240
|
"text-danger",
|
|
241
241
|
"text-warning-contrast",
|
|
242
|
-
"text-warning-
|
|
242
|
+
"text-warning-decoration",
|
|
243
243
|
"text-warning-subtle",
|
|
244
244
|
"text-warning",
|
|
245
245
|
"text-success-contrast",
|
|
246
|
-
"text-success-
|
|
246
|
+
"text-success-decoration",
|
|
247
247
|
"text-success-subtle",
|
|
248
248
|
"text-success",
|
|
249
249
|
"text-accent-contrast",
|
|
250
|
-
"text-accent-
|
|
250
|
+
"text-accent-decoration",
|
|
251
251
|
"text-accent-subtle",
|
|
252
252
|
"text-accent",
|
|
253
253
|
"text-neutral-contrast",
|
|
254
|
-
"text-neutral-
|
|
254
|
+
"text-neutral-decoration",
|
|
255
255
|
"text-neutral-subtle",
|
|
256
256
|
"text-neutral",
|
|
257
257
|
"bg-meta-lime-strong-pressed",
|
|
@@ -383,7 +383,7 @@ const colors = [
|
|
|
383
383
|
const newTokensWithoutRegex = Object.assign(Object.assign({}, colors.reduce((acc, token) => {
|
|
384
384
|
acc[token] = (0, token_utils_1.generateBgTwTags)(token, true);
|
|
385
385
|
return acc;
|
|
386
|
-
}, {})), { "opacity-disabled": "opacity-ax-disabled", "shadow-dialog": "shadow-ax-dialog", "font-weight-regular": "font-ax-regular", "font-weight-bold": "font-ax-bold", "font-size-small": "text-ax-small", "font-size-medium": "text-ax-medium", "font-size-large": "text-ax-large", "font-size-xlarge": "text-ax-xlarge", "font-size-heading-xsmall": "text-ax-heading-xsmall", "font-size-heading-small": "text-ax-heading-small", "font-size-heading-medium": "text-ax-heading-medium", "font-size-heading-large": "text-ax-heading-large", "font-size-heading-xlarge": "text-ax-heading-xlarge", "font-size-heading-2xlarge": "text-ax-heading-2xlarge", "font-line-height-medium": "leading-ax-medium", "font-line-height-large": "leading-ax-large", "font-line-height-xlarge": "leading-ax-xlarge", "font-line-height-heading-xsmall": "leading-ax-heading-xsmall", "font-line-height-heading-small": "leading-ax-heading-small", "font-line-height-heading-medium": "leading-ax-heading-medium", "font-line-height-heading-large": "leading-ax-heading-large", "font-line-height-heading-xlarge": "leading-ax-heading-xlarge", "font-line-height-heading-2xlarge": "leading-ax-heading-2xlarge", "font-family": "font-font-family", "breakpoint-2xl-down": null, "breakpoint-2xl": "ax-2xl", "breakpoint-xl-down": null, "breakpoint-xl": "ax-xl", "breakpoint-lg-down": null, "breakpoint-lg": "ax-lg", "breakpoint-md-down": null, "breakpoint-md": "ax-md", "breakpoint-sm-down": null, "breakpoint-sm": "ax-sm", "breakpoint-xs": null, "
|
|
386
|
+
}, {})), { "opacity-disabled": "opacity-ax-disabled", "shadow-dialog": "shadow-ax-dialog", "font-weight-regular": "font-ax-regular", "font-weight-bold": "font-ax-bold", "font-size-small": "text-ax-small", "font-size-medium": "text-ax-medium", "font-size-large": "text-ax-large", "font-size-xlarge": "text-ax-xlarge", "font-size-heading-xsmall": "text-ax-heading-xsmall", "font-size-heading-small": "text-ax-heading-small", "font-size-heading-medium": "text-ax-heading-medium", "font-size-heading-large": "text-ax-heading-large", "font-size-heading-xlarge": "text-ax-heading-xlarge", "font-size-heading-2xlarge": "text-ax-heading-2xlarge", "font-line-height-medium": "leading-ax-medium", "font-line-height-large": "leading-ax-large", "font-line-height-xlarge": "leading-ax-xlarge", "font-line-height-heading-xsmall": "leading-ax-heading-xsmall", "font-line-height-heading-small": "leading-ax-heading-small", "font-line-height-heading-medium": "leading-ax-heading-medium", "font-line-height-heading-large": "leading-ax-heading-large", "font-line-height-heading-xlarge": "leading-ax-heading-xlarge", "font-line-height-heading-2xlarge": "leading-ax-heading-2xlarge", "font-family": "font-font-family", "breakpoint-2xl-down": null, "breakpoint-2xl": "ax-2xl", "breakpoint-xl-down": null, "breakpoint-xl": "ax-xl", "breakpoint-lg-down": null, "breakpoint-lg": "ax-lg", "breakpoint-md-down": null, "breakpoint-md": "ax-md", "breakpoint-sm-down": null, "breakpoint-sm": "ax-sm", "breakpoint-xs": null, "radius-full": (0, token_utils_1.generateRoundedTwTags)("full"), "radius-12": (0, token_utils_1.generateRoundedTwTags)("12"), "radius-8": (0, token_utils_1.generateRoundedTwTags)("8"), "radius-4": (0, token_utils_1.generateRoundedTwTags)("4"), "radius-2": (0, token_utils_1.generateRoundedTwTags)("2"), "space-128": null, "space-96": null, "space-80": null, "space-72": null, "space-64": null, "space-56": null, "space-48": null, "space-44": null, "space-40": null, "space-36": null, "space-32": null, "space-28": null, "space-24": null, "space-20": null, "space-16": null, "space-12": null, "space-8": null, "space-6": null, "space-4": null, "space-2": null, "space-1": null, "space-0": null });
|
|
387
387
|
const darksideTokenConfig = Object.entries(newTokensWithoutRegex).reduce((acc, [name, tw]) => {
|
|
388
388
|
acc[name] = {
|
|
389
389
|
tw,
|
|
@@ -992,42 +992,42 @@ const colors = {
|
|
|
992
992
|
"icon-alt-3": {
|
|
993
993
|
ref: "deepblue-500",
|
|
994
994
|
raw: "rgba(0, 91, 130, 1)",
|
|
995
|
-
replacement: "text-brand-blue-
|
|
995
|
+
replacement: "text-brand-blue-decoration",
|
|
996
996
|
},
|
|
997
997
|
"icon-alt-2": {
|
|
998
998
|
ref: "limegreen-700",
|
|
999
999
|
raw: "rgba(127, 137, 0, 1)",
|
|
1000
|
-
replacement: "text-meta-lime-
|
|
1000
|
+
replacement: "text-meta-lime-decoration",
|
|
1001
1001
|
},
|
|
1002
1002
|
"icon-alt-1": {
|
|
1003
1003
|
ref: "purple-500",
|
|
1004
1004
|
raw: "rgba(99, 70, 137, 1)",
|
|
1005
|
-
replacement: "text-meta-purple-
|
|
1005
|
+
replacement: "text-meta-purple-decoration",
|
|
1006
1006
|
},
|
|
1007
1007
|
"icon-info": {
|
|
1008
1008
|
ref: "lightblue-800",
|
|
1009
1009
|
raw: "rgba(35, 107, 125, 1)",
|
|
1010
|
-
replacement: "text-info-
|
|
1010
|
+
replacement: "text-info-decoration",
|
|
1011
1011
|
},
|
|
1012
1012
|
"icon-warning": {
|
|
1013
1013
|
ref: "orange-600",
|
|
1014
1014
|
raw: "rgba(199, 115, 0, 1)",
|
|
1015
|
-
replacement: "text-warning-
|
|
1015
|
+
replacement: "text-warning-decoration",
|
|
1016
1016
|
},
|
|
1017
1017
|
"icon-danger": {
|
|
1018
1018
|
ref: "red-500",
|
|
1019
1019
|
raw: "rgba(195, 0, 0, 1)",
|
|
1020
|
-
replacement: "text-danger-
|
|
1020
|
+
replacement: "text-danger-decoration",
|
|
1021
1021
|
},
|
|
1022
1022
|
"icon-success": {
|
|
1023
1023
|
ref: "green-500",
|
|
1024
1024
|
raw: "rgba(6, 137, 58, 1)",
|
|
1025
|
-
replacement: "text-success-
|
|
1025
|
+
replacement: "text-success-decoration",
|
|
1026
1026
|
},
|
|
1027
1027
|
"icon-action": {
|
|
1028
1028
|
ref: "blue-500",
|
|
1029
1029
|
raw: "rgba(0, 103, 197, 1)",
|
|
1030
|
-
replacement: "text-accent-
|
|
1030
|
+
replacement: "text-accent-decoration",
|
|
1031
1031
|
},
|
|
1032
1032
|
"icon-action-on-action-subtle": {
|
|
1033
1033
|
ref: "blue-600",
|
|
@@ -1314,33 +1314,53 @@ const tokensWithoutRegex = Object.assign(Object.assign({}, colorWithTailwindConv
|
|
|
1314
1314
|
}, "border-radius-full": {
|
|
1315
1315
|
ref: "",
|
|
1316
1316
|
raw: "9999px",
|
|
1317
|
-
replacement: "
|
|
1317
|
+
replacement: "radius-full",
|
|
1318
1318
|
twOld: (0, token_utils_1.generateRoundedTwTags)("full"),
|
|
1319
|
-
twNew: (0, token_utils_1.generateRoundedTwTags)("full"
|
|
1319
|
+
twNew: (0, token_utils_1.generateRoundedTwTags)("full"),
|
|
1320
1320
|
}, "border-radius-xlarge": {
|
|
1321
1321
|
ref: "",
|
|
1322
1322
|
raw: "12px",
|
|
1323
|
-
replacement: "
|
|
1323
|
+
replacement: "radius-12",
|
|
1324
1324
|
twOld: (0, token_utils_1.generateRoundedTwTags)("xlarge"),
|
|
1325
|
-
twNew: (0, token_utils_1.generateRoundedTwTags)("
|
|
1325
|
+
twNew: (0, token_utils_1.generateRoundedTwTags)("xl"),
|
|
1326
1326
|
}, "border-radius-large": {
|
|
1327
1327
|
ref: "",
|
|
1328
1328
|
raw: "8px",
|
|
1329
|
-
replacement: "
|
|
1329
|
+
replacement: "radius-8",
|
|
1330
1330
|
twOld: (0, token_utils_1.generateRoundedTwTags)("large"),
|
|
1331
|
-
twNew: (0, token_utils_1.generateRoundedTwTags)("
|
|
1331
|
+
twNew: (0, token_utils_1.generateRoundedTwTags)("lg"),
|
|
1332
1332
|
}, "border-radius-medium": {
|
|
1333
1333
|
ref: "",
|
|
1334
1334
|
raw: "4px",
|
|
1335
|
-
replacement: "
|
|
1335
|
+
replacement: "radius-4",
|
|
1336
1336
|
twOld: (0, token_utils_1.generateRoundedTwTags)("medium"),
|
|
1337
|
-
twNew: (0, token_utils_1.generateRoundedTwTags)("
|
|
1337
|
+
twNew: (0, token_utils_1.generateRoundedTwTags)("sm"),
|
|
1338
1338
|
}, "border-radius-small": {
|
|
1339
1339
|
ref: "",
|
|
1340
1340
|
raw: "2px",
|
|
1341
|
-
replacement: "
|
|
1341
|
+
replacement: "radius-2",
|
|
1342
1342
|
twOld: (0, token_utils_1.generateRoundedTwTags)("small"),
|
|
1343
|
-
twNew: (0, token_utils_1.generateRoundedTwTags)("
|
|
1343
|
+
twNew: (0, token_utils_1.generateRoundedTwTags)("xs"),
|
|
1344
|
+
}, "radius-full": {
|
|
1345
|
+
ref: "",
|
|
1346
|
+
raw: "9999px",
|
|
1347
|
+
replacement: "radius-full",
|
|
1348
|
+
}, "radius-12": {
|
|
1349
|
+
ref: "",
|
|
1350
|
+
raw: "12px",
|
|
1351
|
+
replacement: "radius-12",
|
|
1352
|
+
}, "radius-8": {
|
|
1353
|
+
ref: "",
|
|
1354
|
+
raw: "8px",
|
|
1355
|
+
replacement: "radius-8",
|
|
1356
|
+
}, "radius-4": {
|
|
1357
|
+
ref: "",
|
|
1358
|
+
raw: "4px",
|
|
1359
|
+
replacement: "radius-4",
|
|
1360
|
+
}, "radius-2": {
|
|
1361
|
+
ref: "",
|
|
1362
|
+
raw: "2px",
|
|
1363
|
+
replacement: "radius-2",
|
|
1344
1364
|
}, "z-index-tooltip": {
|
|
1345
1365
|
ref: "",
|
|
1346
1366
|
raw: "3000",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateRoundedTwTags = generateRoundedTwTags;
|
|
4
4
|
exports.generateBgTwTags = generateBgTwTags;
|
|
5
|
-
function generateRoundedTwTags(name
|
|
5
|
+
function generateRoundedTwTags(name) {
|
|
6
6
|
const options = [
|
|
7
7
|
"s",
|
|
8
8
|
"e",
|
|
@@ -20,7 +20,7 @@ function generateRoundedTwTags(name, addNewPrefix = false) {
|
|
|
20
20
|
"bl",
|
|
21
21
|
];
|
|
22
22
|
return `rounded-${name},${options
|
|
23
|
-
.map((option) => `rounded-${option}-${
|
|
23
|
+
.map((option) => `rounded-${option}-${name}`)
|
|
24
24
|
.join(",")}`;
|
|
25
25
|
}
|
|
26
26
|
function generateBgTwTags(name, addNewPrefix = false) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -87,8 +97,8 @@ function runTooling(options, program) {
|
|
|
87
97
|
// Show initial status
|
|
88
98
|
(0, status_1.getStatus)(filepaths);
|
|
89
99
|
// Task execution loop
|
|
90
|
-
let task;
|
|
91
|
-
while (
|
|
100
|
+
let task = yield getNextTask();
|
|
101
|
+
while (task !== "exit") {
|
|
92
102
|
console.info("\n\n");
|
|
93
103
|
try {
|
|
94
104
|
yield executeTask(task, filepaths, options, program);
|
|
@@ -96,6 +106,7 @@ function runTooling(options, program) {
|
|
|
96
106
|
catch (error) {
|
|
97
107
|
program.error(chalk_1.default.red("Error:", error.message));
|
|
98
108
|
}
|
|
109
|
+
task = yield getNextTask();
|
|
99
110
|
}
|
|
100
111
|
process.exit(0);
|
|
101
112
|
});
|
|
@@ -38,8 +38,8 @@ function getStatus(files, action = "print") {
|
|
|
38
38
|
if (!regex) {
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
|
-
let match;
|
|
42
|
-
while (
|
|
41
|
+
let match = regex.exec(fileSrc);
|
|
42
|
+
while (match) {
|
|
43
43
|
const { row, column } = getWordPositionInFile(fileSrc, match.index);
|
|
44
44
|
StatusStore.add({
|
|
45
45
|
isLegacy: true,
|
|
@@ -53,12 +53,13 @@ function getStatus(files, action = "print") {
|
|
|
53
53
|
fileName,
|
|
54
54
|
name: match[0],
|
|
55
55
|
});
|
|
56
|
+
match = regex.exec(fileSrc);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
const legacyRegex = new RegExp(`(${legacy_component_tokens_1.legacyComponentTokenList.map((t) => `${t}:`).join("|")})`, "gm");
|
|
60
|
-
let legacyMatch;
|
|
61
|
-
while (
|
|
61
|
+
let legacyMatch = legacyRegex.exec(fileSrc);
|
|
62
|
+
while (legacyMatch !== null) {
|
|
62
63
|
const { row, column } = getWordPositionInFile(fileSrc, legacyMatch.index);
|
|
63
64
|
StatusStore.add({
|
|
64
65
|
isLegacy: true,
|
|
@@ -69,6 +70,7 @@ function getStatus(files, action = "print") {
|
|
|
69
70
|
fileName,
|
|
70
71
|
name: legacyMatch[0],
|
|
71
72
|
});
|
|
73
|
+
legacyMatch = legacyRegex.exec(fileSrc);
|
|
72
74
|
}
|
|
73
75
|
for (const [newTokenName, config] of Object.entries(darkside_tokens_1.darksideTokenConfig)) {
|
|
74
76
|
if (!(0, token_regex_1.getTokenRegex)(newTokenName, "css").test(fileSrc)) {
|
|
@@ -78,8 +80,8 @@ function getStatus(files, action = "print") {
|
|
|
78
80
|
if (!regex) {
|
|
79
81
|
continue;
|
|
80
82
|
}
|
|
81
|
-
let match;
|
|
82
|
-
while (
|
|
83
|
+
let match = regex.exec(fileSrc);
|
|
84
|
+
while (match) {
|
|
83
85
|
const { row, column } = getWordPositionInFile(fileSrc, match.index);
|
|
84
86
|
StatusStore.add({
|
|
85
87
|
isLegacy: false,
|
|
@@ -89,6 +91,7 @@ function getStatus(files, action = "print") {
|
|
|
89
91
|
fileName,
|
|
90
92
|
name: match[0],
|
|
91
93
|
});
|
|
94
|
+
match = regex.exec(fileSrc);
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/aksel",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.22.0",
|
|
4
4
|
"description": "Aksel command line interface. Handles css-imports, codemods and more",
|
|
5
5
|
"author": "Aksel | Nav designsystem team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://aksel.nav.no/grunnleggende/kode/kommandolinje",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@navikt/ds-css": "^7.
|
|
33
|
-
"@navikt/ds-tokens": "^7.
|
|
34
|
-
"axios": "1.
|
|
32
|
+
"@navikt/ds-css": "^7.22.0",
|
|
33
|
+
"@navikt/ds-tokens": "^7.22.0",
|
|
34
|
+
"axios": "1.9.0",
|
|
35
35
|
"chalk": "4.1.0",
|
|
36
36
|
"cli-progress": "^3.12.0",
|
|
37
37
|
"clipboardy": "^2.3.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/cli-progress": "3.11.6",
|
|
50
50
|
"rimraf": "6.0.1",
|
|
51
|
-
"typescript": "5.
|
|
51
|
+
"typescript": "5.8.3",
|
|
52
52
|
"vitest": "^2.1.9"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": false,
|