@fremtind/jokul 5.0.0-next.5 → 5.0.0-next.7
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/README.md +5 -10
- package/codemods/__tests__/import-paths.test.mjs +189 -0
- package/codemods/import-paths.mjs +137 -3
- package/package.json +2 -1
- package/src/fonts/Fremtind-Material-Symbols.woff2 +0 -0
- package/src/fonts/InterVariable-Italic.woff2 +0 -0
- package/src/fonts/InterVariable.woff2 +0 -0
- package/styles/base.css +22 -70
- package/styles/base.min.css +1 -1
- package/styles/components/beta/nav-link/navlink.css +1 -1
- package/styles/components/beta/nav-link/navlink.min.css +1 -1
- package/styles/components/checkbox/checkbox.css +1 -1
- package/styles/components/checkbox/checkbox.min.css +1 -1
- package/styles/components/checkbox-panel/checkbox-panel.css +1 -1
- package/styles/components/checkbox-panel/checkbox-panel.min.css +1 -1
- package/styles/components/countdown/countdown.css +2 -2
- package/styles/components/countdown/countdown.min.css +1 -1
- package/styles/components/feedback/feedback.css +2 -2
- package/styles/components/feedback/feedback.min.css +1 -1
- package/styles/components/file-input/file-input.css +10 -10
- package/styles/components/file-input/file-input.min.css +1 -1
- package/styles/components/icon/_base-styles.scss +1 -1
- package/styles/components/icon/icon.css +1 -1
- package/styles/components/icon/icon.min.css +1 -1
- package/styles/components/input-group/input-group.css +2 -2
- package/styles/components/input-group/input-group.min.css +1 -1
- package/styles/components/link/link.css +1 -1
- package/styles/components/link/link.min.css +1 -1
- package/styles/components/link-list/link-list.css +1 -1
- package/styles/components/link-list/link-list.min.css +1 -1
- package/styles/components/loader/loader.css +6 -6
- package/styles/components/loader/loader.min.css +1 -1
- package/styles/components/loader/skeleton-loader.css +3 -3
- package/styles/components/loader/skeleton-loader.min.css +1 -1
- package/styles/components/message/message.css +2 -2
- package/styles/components/message/message.min.css +1 -1
- package/styles/components/progress-bar/progress-bar.css +1 -1
- package/styles/components/progress-bar/progress-bar.min.css +1 -1
- package/styles/components/radio-button/radio-button.css +1 -1
- package/styles/components/radio-button/radio-button.min.css +1 -1
- package/styles/components/search/search.css +2 -2
- package/styles/components/search/search.min.css +1 -1
- package/styles/components/search/search.scss +1 -1
- package/styles/components/segmented-control/segmented-control.css +4 -4
- package/styles/components/segmented-control/segmented-control.min.css +1 -1
- package/styles/components/system-message/system-message.css +2 -2
- package/styles/components/system-message/system-message.min.css +1 -1
- package/styles/components/toast/toast.css +4 -4
- package/styles/components/toast/toast.min.css +1 -1
- package/styles/components.css +32 -32
- package/styles/components.min.css +1 -1
- package/styles/jkl/_typography.scss +4 -4
- package/styles/theme/_fonts.scss +20 -58
- package/styles/theme/_index.scss +1 -1
- package/styles/theme/brands/{jokul → fremtind}/_color-scheme.scss +1 -1
- package/styles/theme/brands/fremtind/_fonts.scss +30 -0
- package/styles/theme/brands/jokul/_fonts.scss +0 -46
- /package/styles/theme/brands/{jokul → fremtind}/_index.scss +0 -0
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ jokul codemod src app --dry-run
|
|
|
33
33
|
jokul codemod src app
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
Codemoden oppdaterer sikre stier automatisk og varsler når den finner tvetydige stilimports for beta-komponenter som må vurderes manuelt.
|
|
36
|
+
Codemoden oppdaterer sikre stier automatisk og varsler når den finner tvetydige stilimports for beta-komponenter som må vurderes manuelt. Den fjerner `@fremtind/jokul/styles/fonts/webfonts.css`-imports siden `@font-face`-definisjonene nå ligger i `styles/base.css`, bytter ut det gamle font-family-navnet `Fremtind Material Symbols` med `Jokul Icons`, og flagger fjernede Sass-fargevariabler, gamle `light-mode-variables`/`dark-mode-variables`-mixins og utdaterte `text-style`-navn (`"body"`, `"small"`).
|
|
37
37
|
|
|
38
38
|
## React-komponenter
|
|
39
39
|
|
|
@@ -137,21 +137,16 @@ Dette gjør du med
|
|
|
137
137
|
|
|
138
138
|
Om du ikke bruker Sass kan du bruke CSS-versjonen. Denne versjonen ser **kun** etter fontfilene på URLen `/fonts`, så det beste er å sørge for å kopiere fonter på en måte som gjør at de blir tilgjengelig på den URLen.
|
|
139
139
|
|
|
140
|
-
Om du er nødt til å legge fontfilene et annet sted må
|
|
141
|
-
kopieres inn i prosjektet. Deretter må du endre URLen i hver `@font-face`-definisjon manuelt så det stemmer med hvor fontfilene ligger. **Husk at man må gjenta prosessen hver gang man oppdaterer pakken!**
|
|
140
|
+
Om du er nødt til å legge fontfilene et annet sted må `@font-face`-definisjonene fra `node_modules/@fremtind/jokul/styles/base.css` kopieres inn i prosjektet. Deretter må du endre URLen i hver `@font-face`-definisjon manuelt så det stemmer med hvor fontfilene ligger. **Husk at man må gjenta prosessen hver gang man oppdaterer pakken!**
|
|
142
141
|
|
|
143
142
|
```css
|
|
144
143
|
@font-face {
|
|
145
144
|
font-family: "Jokul";
|
|
146
145
|
font-display: fallback;
|
|
147
|
-
font-weight:
|
|
146
|
+
font-weight: 400;
|
|
148
147
|
font-style: normal;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/* Endre de to neste linjene så de stemmer */
|
|
152
|
-
url("/relative/path/to/font/files/InterVariable.woff2")
|
|
153
|
-
format("woff2"),
|
|
154
|
-
url("/relative/path/to/font/files/InterVariable.woff2") format("woff");
|
|
148
|
+
/* Endre URLen så den stemmer */
|
|
149
|
+
src: url("/relative/path/to/font/files/InterVariable.woff2") format("woff2");
|
|
155
150
|
}
|
|
156
151
|
```
|
|
157
152
|
|
|
@@ -82,3 +82,192 @@ import "@fremtind/jokul/styles/components/nav-link";
|
|
|
82
82
|
assert.equal(result.changed, false);
|
|
83
83
|
assert.equal(result.warnings.length, 1);
|
|
84
84
|
});
|
|
85
|
+
|
|
86
|
+
test("removes redundant webfonts.css imports when base or components css is also imported", () => {
|
|
87
|
+
const source = `import "@fremtind/jokul/styles/styles.css";
|
|
88
|
+
import "@fremtind/jokul/styles/core/core.css";
|
|
89
|
+
import "@fremtind/jokul/styles/fonts/webfonts.css";
|
|
90
|
+
`;
|
|
91
|
+
|
|
92
|
+
const result = transformImportPaths(source, "/tmp/main.tsx");
|
|
93
|
+
|
|
94
|
+
assert.equal(
|
|
95
|
+
result.text.includes("@fremtind/jokul/styles/fonts/webfonts.css"),
|
|
96
|
+
false,
|
|
97
|
+
);
|
|
98
|
+
assert.equal(
|
|
99
|
+
result.text.includes('import "@fremtind/jokul/styles/components.css";'),
|
|
100
|
+
true,
|
|
101
|
+
);
|
|
102
|
+
assert.equal(
|
|
103
|
+
result.text.includes('import "@fremtind/jokul/styles/base.css";'),
|
|
104
|
+
true,
|
|
105
|
+
);
|
|
106
|
+
assert.deepEqual(result.warnings, []);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("removes minified webfonts.css imports as well", () => {
|
|
110
|
+
const source = `import "@fremtind/jokul/styles/core/core.min.css";
|
|
111
|
+
import "@fremtind/jokul/styles/fonts/webfonts.min.css";
|
|
112
|
+
`;
|
|
113
|
+
|
|
114
|
+
const result = transformImportPaths(source, "/tmp/main.ts");
|
|
115
|
+
|
|
116
|
+
assert.equal(
|
|
117
|
+
result.text.includes("webfonts"),
|
|
118
|
+
false,
|
|
119
|
+
);
|
|
120
|
+
assert.equal(
|
|
121
|
+
result.text.includes('import "@fremtind/jokul/styles/base.min.css";'),
|
|
122
|
+
true,
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test("warns when webfonts.css is removed without a base or components import", () => {
|
|
127
|
+
const source = `import "@fremtind/jokul/styles/fonts/webfonts.css";
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
const result = transformImportPaths(source, "/tmp/main.tsx");
|
|
131
|
+
|
|
132
|
+
assert.equal(result.text.includes("webfonts"), false);
|
|
133
|
+
assert.equal(result.warnings.length, 1);
|
|
134
|
+
assert.match(result.warnings[0], /styles\/base\.css/);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("removes css @import of webfonts.css", () => {
|
|
138
|
+
const source = `@import "@fremtind/jokul/styles/components.css";
|
|
139
|
+
@import "@fremtind/jokul/styles/fonts/webfonts.css";
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
const result = transformImportPaths(source, "/tmp/global.css");
|
|
143
|
+
|
|
144
|
+
assert.equal(result.text.includes("webfonts"), false);
|
|
145
|
+
assert.equal(
|
|
146
|
+
result.text.includes('@import "@fremtind/jokul/styles/components.css";'),
|
|
147
|
+
true,
|
|
148
|
+
);
|
|
149
|
+
assert.deepEqual(result.warnings, []);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test("warns about removed sass color variables", () => {
|
|
153
|
+
const source = `@use "@fremtind/jokul/styles/jkl";
|
|
154
|
+
|
|
155
|
+
.banner {
|
|
156
|
+
background: jkl.$color-granitt;
|
|
157
|
+
color: jkl.$color-snohvit;
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
|
|
161
|
+
const result = transformImportPaths(source, "/tmp/banner.scss");
|
|
162
|
+
|
|
163
|
+
assert.equal(
|
|
164
|
+
result.warnings.some((warning) =>
|
|
165
|
+
/jkl\.\$color-\*/.test(warning),
|
|
166
|
+
),
|
|
167
|
+
true,
|
|
168
|
+
);
|
|
169
|
+
// Bare én advarsel per mønster, selv om det er flere forekomster
|
|
170
|
+
assert.equal(
|
|
171
|
+
result.warnings.filter((warning) =>
|
|
172
|
+
/jkl\.\$color-\*/.test(warning),
|
|
173
|
+
).length,
|
|
174
|
+
1,
|
|
175
|
+
);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test("warns about removed light/dark mode mixins", () => {
|
|
179
|
+
const source = `@use "@fremtind/jokul/styles/jkl";
|
|
180
|
+
|
|
181
|
+
@include jkl.light-mode-variables {
|
|
182
|
+
--min-farge: jkl.$color-granitt;
|
|
183
|
+
}
|
|
184
|
+
@include jkl.dark-mode-variables {
|
|
185
|
+
--min-farge: jkl.$color-snohvit;
|
|
186
|
+
}
|
|
187
|
+
`;
|
|
188
|
+
|
|
189
|
+
const result = transformImportPaths(source, "/tmp/theme.scss");
|
|
190
|
+
|
|
191
|
+
assert.equal(
|
|
192
|
+
result.warnings.some((warning) =>
|
|
193
|
+
/light-mode-variables/.test(warning),
|
|
194
|
+
),
|
|
195
|
+
true,
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("warns about deprecated text-style names", () => {
|
|
200
|
+
const source = `@use "@fremtind/jokul/styles/jkl";
|
|
201
|
+
|
|
202
|
+
.lead {
|
|
203
|
+
@include jkl.text-style("body");
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.fineprint {
|
|
207
|
+
@include jkl.text-style("small");
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
210
|
+
|
|
211
|
+
const result = transformImportPaths(source, "/tmp/typography.scss");
|
|
212
|
+
|
|
213
|
+
assert.equal(
|
|
214
|
+
result.warnings.some((warning) =>
|
|
215
|
+
/paragraph-large\/medium\/small/.test(warning),
|
|
216
|
+
),
|
|
217
|
+
true,
|
|
218
|
+
);
|
|
219
|
+
assert.equal(
|
|
220
|
+
result.warnings.some((warning) => /<Text>-komponenten/.test(warning)),
|
|
221
|
+
true,
|
|
222
|
+
);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test("renames Fremtind Material Symbols font-family", () => {
|
|
226
|
+
const source = `.icon {
|
|
227
|
+
font-family: "Fremtind Material Symbols", "Fremtind Material Symbols Fallback", sans-serif;
|
|
228
|
+
}
|
|
229
|
+
`;
|
|
230
|
+
|
|
231
|
+
const result = transformImportPaths(source, "/tmp/icons.scss");
|
|
232
|
+
|
|
233
|
+
assert.equal(
|
|
234
|
+
result.text.includes("Fremtind Material Symbols"),
|
|
235
|
+
false,
|
|
236
|
+
);
|
|
237
|
+
assert.equal(
|
|
238
|
+
result.text.includes(
|
|
239
|
+
'"Jokul Icons", "Jokul Icons Fallback", sans-serif',
|
|
240
|
+
),
|
|
241
|
+
true,
|
|
242
|
+
);
|
|
243
|
+
assert.equal(result.replacements, 2);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
test("renames Fremtind Material Symbols inside CSS files too", () => {
|
|
247
|
+
const source = `.icon {
|
|
248
|
+
font-family: 'Fremtind Material Symbols';
|
|
249
|
+
}
|
|
250
|
+
`;
|
|
251
|
+
|
|
252
|
+
const result = transformImportPaths(source, "/tmp/icons.css");
|
|
253
|
+
|
|
254
|
+
assert.equal(
|
|
255
|
+
result.text.includes("Fremtind Material Symbols"),
|
|
256
|
+
false,
|
|
257
|
+
);
|
|
258
|
+
assert.equal(result.text.includes("'Jokul Icons'"), true);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
test("does not warn about valid 5.0 patterns", () => {
|
|
262
|
+
const source = `@use "@fremtind/jokul/styles/jkl";
|
|
263
|
+
|
|
264
|
+
.title {
|
|
265
|
+
@include jkl.text-style("heading-1");
|
|
266
|
+
color: var(--jkl-color-text-default);
|
|
267
|
+
}
|
|
268
|
+
`;
|
|
269
|
+
|
|
270
|
+
const result = transformImportPaths(source, "/tmp/title.scss");
|
|
271
|
+
|
|
272
|
+
assert.deepEqual(result.warnings, []);
|
|
273
|
+
});
|
|
@@ -226,6 +226,120 @@ function applyBetaStyleReplacements(text) {
|
|
|
226
226
|
return { text: next, replacements, warnings };
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Font-family-navnet "Fremtind Material Symbols" (og tilhørende fallback) ble
|
|
231
|
+
* omdøpt til "Jokul Icons" i Jøkul 5. Konsumenter som har skrevet font-family
|
|
232
|
+
* direkte i sin egen CSS/SCSS får ellers en stille brutt referanse.
|
|
233
|
+
*
|
|
234
|
+
* Fallback-navnet erstattes først (lengst først), slik at det ikke blir
|
|
235
|
+
* delvis overskrevet av kortere mønster.
|
|
236
|
+
*/
|
|
237
|
+
const FONT_FAMILY_REPLACEMENTS = [
|
|
238
|
+
["Fremtind Material Symbols Fallback", "Jokul Icons Fallback"],
|
|
239
|
+
["Fremtind Material Symbols", "Jokul Icons"],
|
|
240
|
+
];
|
|
241
|
+
|
|
242
|
+
function applyFontFamilyReplacements(text) {
|
|
243
|
+
let next = text;
|
|
244
|
+
let count = 0;
|
|
245
|
+
|
|
246
|
+
for (const [from, to] of FONT_FAMILY_REPLACEMENTS) {
|
|
247
|
+
const pattern = new RegExp(escapeRegExp(from), "g");
|
|
248
|
+
next = next.replace(pattern, () => {
|
|
249
|
+
count += 1;
|
|
250
|
+
return to;
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return { text: next, count };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const WEBFONTS_CSS_SPECIFIER =
|
|
258
|
+
"@fremtind/jokul/styles/fonts/webfonts(?:\\.min)?\\.css";
|
|
259
|
+
|
|
260
|
+
const BASE_OR_COMPONENT_CSS_PATTERN = new RegExp(
|
|
261
|
+
"@fremtind/jokul/styles/(?:base|components)(?:\\.min)?\\.css",
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
const WEBFONTS_CSS_REMOVAL_PATTERNS = [
|
|
265
|
+
// import "@fremtind/jokul/styles/fonts/webfonts.css"; (ESM)
|
|
266
|
+
new RegExp(
|
|
267
|
+
`^[ \\t]*import\\s+["']${WEBFONTS_CSS_SPECIFIER}["']\\s*;?[ \\t]*\\r?\\n?`,
|
|
268
|
+
"gm",
|
|
269
|
+
),
|
|
270
|
+
// require("@fremtind/jokul/styles/fonts/webfonts.css"); (CJS)
|
|
271
|
+
new RegExp(
|
|
272
|
+
`^[ \\t]*require\\(\\s*["']${WEBFONTS_CSS_SPECIFIER}["']\\s*\\)\\s*;?[ \\t]*\\r?\\n?`,
|
|
273
|
+
"gm",
|
|
274
|
+
),
|
|
275
|
+
// @import "@fremtind/jokul/styles/fonts/webfonts.css"; (CSS / SCSS)
|
|
276
|
+
new RegExp(
|
|
277
|
+
`^[ \\t]*@import\\s+["']${WEBFONTS_CSS_SPECIFIER}["']\\s*;?[ \\t]*\\r?\\n?`,
|
|
278
|
+
"gm",
|
|
279
|
+
),
|
|
280
|
+
];
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* I Jøkul 5 er `@font-face`-definisjonene flyttet inn i `styles/base.css`, og den
|
|
284
|
+
* frittstående `styles/fonts/webfonts.css` finnes ikke lenger i pakken. For
|
|
285
|
+
* .css-konsumenter betyr det at gamle `webfonts.css`-imports må fjernes – ellers
|
|
286
|
+
* blir bygget brutt fordi filen er borte. SCSS-konsumenter håndteres av
|
|
287
|
+
* `DIRECT_REPLACEMENTS` siden de kan ha behov for å overstyre `$webfonts-dir`.
|
|
288
|
+
*/
|
|
289
|
+
function removeRedundantWebfontsCssImport(text) {
|
|
290
|
+
let next = text;
|
|
291
|
+
let count = 0;
|
|
292
|
+
|
|
293
|
+
for (const pattern of WEBFONTS_CSS_REMOVAL_PATTERNS) {
|
|
294
|
+
next = next.replace(pattern, () => {
|
|
295
|
+
count += 1;
|
|
296
|
+
return "";
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return { text: next, count };
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Patterns som ikke kan auto-erstattes, men som krever manuell migrering ved
|
|
305
|
+
* oppgradering fra Jøkul 4 til 5. Hvert mønster gir én advarsel per fil det
|
|
306
|
+
* matcher i (uavhengig av antall forekomster), med peker til hva man skal
|
|
307
|
+
* gjøre i stedet.
|
|
308
|
+
*/
|
|
309
|
+
const MANUAL_MIGRATION_WARNINGS = [
|
|
310
|
+
{
|
|
311
|
+
// jkl.$color-granitt, jkl.$color-varde, osv. Alle Sass-fargevariabler
|
|
312
|
+
// ble fjernet i Jøkul 5 til fordel for semantiske CSS-variabler.
|
|
313
|
+
pattern: /\bjkl\.\$color-[a-z][a-z0-9-]*/i,
|
|
314
|
+
message:
|
|
315
|
+
"Fjernede Sass-fargevariabler (jkl.$color-*). I Jøkul 5 er alle gamle fargenavn (granitt, varde, snohvit osv.) fjernet — bruk semantiske CSS-variabler, f.eks. var(--jkl-color-text-default). Se https://jokul-portal.intern.app.prodaws.fremtind.no/fundamenter/farger.",
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
// @include jkl.light-mode-variables { ... } / dark-mode-variables { ... }
|
|
319
|
+
pattern: /@include\s+jkl\.(?:light|dark)-mode-variables\b/,
|
|
320
|
+
message:
|
|
321
|
+
"Fjernede mixins for custom light/dark-farger (jkl.light-mode-variables / jkl.dark-mode-variables). I Jøkul 5 må du bruke semantiske CSS-variabler i stedet for å definere egne dark/light-varianter.",
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
// @include jkl.text-style("body") / text-style("small")
|
|
325
|
+
pattern: /\btext-style\(\s*["'](?:body|small)["']\s*\)/,
|
|
326
|
+
message:
|
|
327
|
+
'Fjernede tekststiler ("body", "small") i text-style-mixin. Foretrekk å bruke <Text>-komponenten der det er mulig (`import { Text } from "@fremtind/jokul/components/typography"`). Hvis du må sette stiler direkte, bytt til "paragraph-large/medium/small" eller "text-large/medium/small/micro" — se https://jokul-portal.intern.app.prodaws.fremtind.no/fundamenter/typografi.',
|
|
328
|
+
},
|
|
329
|
+
];
|
|
330
|
+
|
|
331
|
+
function collectManualMigrationWarnings(text) {
|
|
332
|
+
const warnings = [];
|
|
333
|
+
|
|
334
|
+
for (const { pattern, message } of MANUAL_MIGRATION_WARNINGS) {
|
|
335
|
+
if (pattern.test(text)) {
|
|
336
|
+
warnings.push(`Manuell vurdering: ${message}`);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return warnings;
|
|
341
|
+
}
|
|
342
|
+
|
|
229
343
|
function reorderConfiguredFontImport(text) {
|
|
230
344
|
const fontImportPattern =
|
|
231
345
|
/^@use\s+["']@fremtind\/jokul\/styles\/theme\/fonts["'][\s\S]*?;\s*/m;
|
|
@@ -257,7 +371,9 @@ function reorderConfiguredFontImport(text) {
|
|
|
257
371
|
}
|
|
258
372
|
|
|
259
373
|
export function transformImportPaths(text, filePath = "") {
|
|
260
|
-
const
|
|
374
|
+
const webfontsRemoval = removeRedundantWebfontsCssImport(text);
|
|
375
|
+
const fontFamily = applyFontFamilyReplacements(webfontsRemoval.text);
|
|
376
|
+
const direct = applyDirectReplacements(fontFamily.text);
|
|
261
377
|
const beta = applyBetaStyleReplacements(direct.text);
|
|
262
378
|
let next = beta.text;
|
|
263
379
|
let reordered = false;
|
|
@@ -268,11 +384,29 @@ export function transformImportPaths(text, filePath = "") {
|
|
|
268
384
|
reordered = reorderedResult.reordered;
|
|
269
385
|
}
|
|
270
386
|
|
|
387
|
+
const warnings = [
|
|
388
|
+
...beta.warnings,
|
|
389
|
+
...collectManualMigrationWarnings(text),
|
|
390
|
+
];
|
|
391
|
+
|
|
392
|
+
if (
|
|
393
|
+
webfontsRemoval.count > 0 &&
|
|
394
|
+
!BASE_OR_COMPONENT_CSS_PATTERN.test(next)
|
|
395
|
+
) {
|
|
396
|
+
warnings.push(
|
|
397
|
+
"Manuell vurdering: fjernet import av `styles/fonts/webfonts.css`. `@font-face`-definisjonene ligger nå i `@fremtind/jokul/styles/base.css`, så den må importeres for at fontene skal lastes.",
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
271
401
|
return {
|
|
272
402
|
text: next,
|
|
273
403
|
changed: next !== text,
|
|
274
|
-
replacements:
|
|
275
|
-
|
|
404
|
+
replacements:
|
|
405
|
+
direct.replacements +
|
|
406
|
+
beta.replacements +
|
|
407
|
+
webfontsRemoval.count +
|
|
408
|
+
fontFamily.count,
|
|
409
|
+
warnings,
|
|
276
410
|
reordered,
|
|
277
411
|
};
|
|
278
412
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fremtind/jokul",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"exports": {
|
|
28
28
|
"./package.json": "./package.json",
|
|
29
|
+
"./styles/jkl": "./styles/jkl/_index.scss",
|
|
29
30
|
"./styles/*": "./styles/*",
|
|
30
31
|
"./tailwind": {
|
|
31
32
|
"import": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/styles/base.css
CHANGED
|
@@ -267,16 +267,6 @@
|
|
|
267
267
|
font-style: normal;
|
|
268
268
|
src: url("/fonts/InterVariable.woff2") format("woff2");
|
|
269
269
|
}
|
|
270
|
-
@font-face {
|
|
271
|
-
font-family: "Adjusted Arial Fallback";
|
|
272
|
-
font-weight: 400;
|
|
273
|
-
font-style: normal;
|
|
274
|
-
src: local(arial);
|
|
275
|
-
size-adjust: 104%;
|
|
276
|
-
ascent-override: 82%;
|
|
277
|
-
descent-override: normal;
|
|
278
|
-
line-gap-override: 32%;
|
|
279
|
-
}
|
|
280
270
|
@font-face {
|
|
281
271
|
font-family: Jokul;
|
|
282
272
|
font-display: fallback;
|
|
@@ -285,56 +275,45 @@
|
|
|
285
275
|
src: url("/fonts/InterVariable.woff2") format("woff2");
|
|
286
276
|
}
|
|
287
277
|
@font-face {
|
|
288
|
-
font-family: "
|
|
289
|
-
font-
|
|
278
|
+
font-family: "Jokul Display";
|
|
279
|
+
font-display: fallback;
|
|
280
|
+
font-weight: 400;
|
|
290
281
|
font-style: normal;
|
|
291
|
-
src:
|
|
292
|
-
size-adjust: 108%;
|
|
293
|
-
ascent-override: 83%;
|
|
294
|
-
descent-override: normal;
|
|
295
|
-
line-gap-override: 28%;
|
|
282
|
+
src: url("/fonts/InterVariable.woff2") format("woff2");
|
|
296
283
|
}
|
|
297
284
|
@font-face {
|
|
298
|
-
font-family: Jokul;
|
|
285
|
+
font-family: "Jokul Mono";
|
|
299
286
|
font-display: fallback;
|
|
300
287
|
font-weight: 400;
|
|
301
|
-
font-style:
|
|
288
|
+
font-style: normal;
|
|
302
289
|
src: url("/fonts/InterVariable.woff2") format("woff2");
|
|
303
290
|
}
|
|
291
|
+
@font-face {
|
|
292
|
+
font-family: "Jokul Icons";
|
|
293
|
+
font-weight: 300 400;
|
|
294
|
+
font-style: normal;
|
|
295
|
+
src: url("/fonts/Fremtind-Material-Symbols.woff2") format("woff2");
|
|
296
|
+
}
|
|
304
297
|
@font-face {
|
|
305
298
|
font-family: "Adjusted Arial Fallback";
|
|
306
299
|
font-weight: 400;
|
|
307
|
-
font-style:
|
|
300
|
+
font-style: normal;
|
|
308
301
|
src: local(arial);
|
|
309
|
-
size-adjust:
|
|
310
|
-
ascent-override:
|
|
302
|
+
size-adjust: 104%;
|
|
303
|
+
ascent-override: 82%;
|
|
311
304
|
descent-override: normal;
|
|
312
|
-
line-gap-override:
|
|
313
|
-
}
|
|
314
|
-
@font-face {
|
|
315
|
-
font-family: Jokul;
|
|
316
|
-
font-display: fallback;
|
|
317
|
-
font-weight: 700;
|
|
318
|
-
font-style: italic;
|
|
319
|
-
src: url("/fonts/InterVariable.woff2") format("woff2");
|
|
305
|
+
line-gap-override: 32%;
|
|
320
306
|
}
|
|
321
307
|
@font-face {
|
|
322
308
|
font-family: "Adjusted Arial Fallback";
|
|
323
309
|
font-weight: 700;
|
|
324
|
-
font-style:
|
|
310
|
+
font-style: normal;
|
|
325
311
|
src: local(arial);
|
|
326
312
|
size-adjust: 108%;
|
|
327
313
|
ascent-override: 83%;
|
|
328
314
|
descent-override: normal;
|
|
329
315
|
line-gap-override: 28%;
|
|
330
316
|
}
|
|
331
|
-
@font-face {
|
|
332
|
-
font-family: "Jokul Display";
|
|
333
|
-
font-display: fallback;
|
|
334
|
-
font-weight: 400;
|
|
335
|
-
font-style: normal;
|
|
336
|
-
src: url("/fonts/InterVariable.woff2") format("woff2");
|
|
337
|
-
}
|
|
338
317
|
@font-face {
|
|
339
318
|
font-family: "Adjusted Arial Display Fallback";
|
|
340
319
|
font-weight: 400;
|
|
@@ -345,13 +324,6 @@
|
|
|
345
324
|
descent-override: normal;
|
|
346
325
|
line-gap-override: 40%;
|
|
347
326
|
}
|
|
348
|
-
@font-face {
|
|
349
|
-
font-family: "Jokul Mono";
|
|
350
|
-
font-display: fallback;
|
|
351
|
-
font-weight: 400;
|
|
352
|
-
font-style: normal;
|
|
353
|
-
src: url("/fonts/InterVariable.woff2") format("woff2");
|
|
354
|
-
}
|
|
355
327
|
@font-face {
|
|
356
328
|
font-family: "Adjusted Courier New Fallback";
|
|
357
329
|
font-weight: 400;
|
|
@@ -363,13 +335,7 @@
|
|
|
363
335
|
line-gap-override: 27%;
|
|
364
336
|
}
|
|
365
337
|
@font-face {
|
|
366
|
-
font-family: "Jokul
|
|
367
|
-
font-weight: 300 400;
|
|
368
|
-
font-style: normal;
|
|
369
|
-
src: url("/fonts/Fremtind-Material-Symbols.woff2") format("woff2");
|
|
370
|
-
}
|
|
371
|
-
@font-face {
|
|
372
|
-
font-family: "Jokul Material Symbols Fallback";
|
|
338
|
+
font-family: "Jokul Icons Fallback";
|
|
373
339
|
src: local(courier new);
|
|
374
340
|
font-weight: 300 400;
|
|
375
341
|
font-style: normal;
|
|
@@ -1204,7 +1170,7 @@
|
|
|
1204
1170
|
* Do not edit directly, this file was auto-generated.
|
|
1205
1171
|
*/
|
|
1206
1172
|
@layer jokul.theme {
|
|
1207
|
-
[data-brand=
|
|
1173
|
+
[data-brand=fremtind] {
|
|
1208
1174
|
/* stylelint-disable declaration-block-no-duplicate-custom-properties -- fallback and light-dark() declarations are intentionally paired. */
|
|
1209
1175
|
--jkl-color-neutral-background-page: #F4F2EF;
|
|
1210
1176
|
--jkl-color-neutral-background-page: light-dark(#F4F2EF, #1B1917);
|
|
@@ -1321,35 +1287,21 @@
|
|
|
1321
1287
|
* Do not edit directly, this file was auto-generated.
|
|
1322
1288
|
*/
|
|
1323
1289
|
@layer jokul.theme {
|
|
1324
|
-
@font-face {
|
|
1325
|
-
font-family: "Inter";
|
|
1326
|
-
font-display: fallback;
|
|
1327
|
-
font-weight: 300;
|
|
1328
|
-
font-style: normal;
|
|
1329
|
-
src: url("/fonts/brands/jokul/InterVariable.woff2") format("woff2");
|
|
1330
|
-
}
|
|
1331
1290
|
@font-face {
|
|
1332
1291
|
font-family: "Inter";
|
|
1333
1292
|
font-display: fallback;
|
|
1334
1293
|
font-weight: 400;
|
|
1335
1294
|
font-style: normal;
|
|
1336
|
-
src: url("/fonts/brands/
|
|
1337
|
-
}
|
|
1338
|
-
@font-face {
|
|
1339
|
-
font-family: "Inter";
|
|
1340
|
-
font-display: fallback;
|
|
1341
|
-
font-weight: 600;
|
|
1342
|
-
font-style: normal;
|
|
1343
|
-
src: url("/fonts/brands/jokul/InterVariable.woff2") format("woff2");
|
|
1295
|
+
src: url("/fonts/brands/fremtind/InterVariable.woff2") format("woff2");
|
|
1344
1296
|
}
|
|
1345
1297
|
@font-face {
|
|
1346
1298
|
font-family: "Inter";
|
|
1347
1299
|
font-display: fallback;
|
|
1348
1300
|
font-weight: 700;
|
|
1349
1301
|
font-style: normal;
|
|
1350
|
-
src: url("/fonts/brands/
|
|
1302
|
+
src: url("/fonts/brands/fremtind/InterVariable.woff2") format("woff2");
|
|
1351
1303
|
}
|
|
1352
|
-
[data-brand=
|
|
1304
|
+
[data-brand=fremtind] {
|
|
1353
1305
|
--jkl-font-family-regular: Inter, "Adjusted Arial Fallback", arial, sans-serif;
|
|
1354
1306
|
--jkl-font-family-display: Inter, "Adjusted Arial Display Fallback", arial, sans-serif;
|
|
1355
1307
|
--jkl-font-family-mono: monospace, -apple-system, blinkmacsystemfont;
|