@navikt/ds-css 7.7.0 → 7.8.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/CHANGELOG.md +18 -0
- package/config/bundle.darkside.ts +270 -0
- package/config/tests/bundle.test.ts +46 -0
- package/darkside/baseline/{utilities.darkside.css → baseline.darkside.css} +9 -0
- package/darkside/baseline/tokens.darkside.css +1 -0
- package/darkside/button.darkside.css +1 -1
- package/darkside/copybutton.darkside.css +1 -1
- package/darkside/dropdown.darkside.css +1 -1
- package/darkside/form/combobox.darkside.css +1 -22
- package/darkside/form/fieldset.darkside.css +1 -1
- package/darkside/form/form.darkside.css +2 -2
- package/darkside/form/radio-checkbox.darkside.css +1 -1
- package/darkside/form/search.darkside.css +6 -2
- package/darkside/form/switch.darkside.css +1 -1
- package/darkside/guide-panel.darkside.css +78 -60
- package/darkside/index.css +9 -11
- package/darkside/link.darkside.css +2 -2
- package/darkside/table.darkside.css +52 -97
- package/darkside/tag.darkside.css +85 -147
- package/darkside/timeline.darkside.css +118 -211
- package/darkside/tooltip.darkside.css +82 -57
- package/darkside/typography.darkside.css +0 -12
- package/dist/component/form.css +2 -21
- package/dist/component/form.min.css +1 -1
- package/dist/component/link.css +1 -1
- package/dist/component/link.min.css +1 -1
- package/dist/component/table.css +1 -1
- package/dist/component/table.min.css +1 -1
- package/dist/component/tag.css +12 -6
- package/dist/component/tag.min.css +1 -1
- package/dist/components.css +17 -990
- package/dist/components.min.css +2 -4
- package/dist/darkside/component/accordion.css +174 -0
- package/dist/darkside/component/accordion.min.css +1 -0
- package/dist/darkside/component/actionmenu.css +182 -0
- package/dist/darkside/component/actionmenu.min.css +1 -0
- package/dist/darkside/component/alert.css +105 -0
- package/dist/darkside/component/alert.min.css +1 -0
- package/dist/darkside/component/button.css +271 -0
- package/dist/darkside/component/button.min.css +1 -0
- package/dist/darkside/component/chat.css +103 -0
- package/dist/darkside/component/chat.min.css +1 -0
- package/dist/darkside/component/chips.css +176 -0
- package/dist/darkside/component/chips.min.css +1 -0
- package/dist/darkside/component/copybutton.css +176 -0
- package/dist/darkside/component/copybutton.min.css +1 -0
- package/dist/darkside/component/date.css +262 -0
- package/dist/darkside/component/date.min.css +1 -0
- package/dist/darkside/component/dropdown.css +92 -0
- package/dist/darkside/component/dropdown.min.css +1 -0
- package/dist/darkside/component/expansioncard.css +167 -0
- package/dist/darkside/component/expansioncard.min.css +1 -0
- package/dist/darkside/component/form.css +1871 -0
- package/dist/darkside/component/form.min.css +1 -0
- package/dist/darkside/component/guidepanel.css +113 -0
- package/dist/darkside/component/guidepanel.min.css +1 -0
- package/dist/darkside/component/helptext.css +53 -0
- package/dist/darkside/component/helptext.min.css +1 -0
- package/dist/darkside/component/internalheader.css +100 -0
- package/dist/darkside/component/internalheader.min.css +1 -0
- package/dist/darkside/component/link.css +60 -0
- package/dist/darkside/component/link.min.css +1 -0
- package/dist/darkside/component/linkpanel.css +48 -0
- package/dist/darkside/component/linkpanel.min.css +1 -0
- package/dist/darkside/component/list.css +88 -0
- package/dist/darkside/component/list.min.css +1 -0
- package/dist/darkside/component/loader.css +119 -0
- package/dist/darkside/component/loader.min.css +1 -0
- package/dist/darkside/component/modal.css +175 -0
- package/dist/darkside/component/modal.min.css +1 -0
- package/dist/darkside/component/pagination.css +43 -0
- package/dist/darkside/component/pagination.min.css +1 -0
- package/dist/darkside/component/panel.css +12 -0
- package/dist/darkside/component/panel.min.css +1 -0
- package/dist/darkside/component/popover.css +18 -0
- package/dist/darkside/component/popover.min.css +1 -0
- package/dist/darkside/component/primitives.css +1291 -0
- package/dist/darkside/component/primitives.min.css +1 -0
- package/dist/darkside/component/progressbar.css +106 -0
- package/dist/darkside/component/progressbar.min.css +1 -0
- package/dist/darkside/component/readmore.css +95 -0
- package/dist/darkside/component/readmore.min.css +1 -0
- package/dist/darkside/component/skeleton.css +66 -0
- package/dist/darkside/component/skeleton.min.css +1 -0
- package/dist/darkside/component/stepper.css +234 -0
- package/dist/darkside/component/stepper.min.css +1 -0
- package/dist/darkside/component/table.css +225 -0
- package/dist/darkside/component/table.min.css +1 -0
- package/dist/darkside/component/tabs.css +138 -0
- package/dist/darkside/component/tabs.min.css +1 -0
- package/dist/darkside/component/tag.css +128 -0
- package/dist/darkside/component/tag.min.css +1 -0
- package/dist/darkside/component/theme.css +17 -0
- package/dist/darkside/component/theme.min.css +1 -0
- package/dist/darkside/component/timeline.css +338 -0
- package/dist/darkside/component/timeline.min.css +1 -0
- package/dist/darkside/component/togglegroup.css +105 -0
- package/dist/darkside/component/togglegroup.min.css +1 -0
- package/dist/darkside/component/tooltip.css +108 -0
- package/dist/darkside/component/tooltip.min.css +1 -0
- package/dist/darkside/component/typography.css +242 -0
- package/dist/darkside/component/typography.min.css +1 -0
- package/dist/darkside/components.css +7471 -0
- package/dist/darkside/components.min.css +1 -0
- package/dist/darkside/global/baseline.css +47 -0
- package/dist/darkside/global/baseline.min.css +1 -0
- package/dist/darkside/global/fonts.css +109 -0
- package/dist/darkside/global/fonts.min.css +1 -0
- package/dist/darkside/global/print.css +52 -0
- package/dist/darkside/global/print.min.css +1 -0
- package/dist/darkside/global/reset.css +93 -0
- package/dist/darkside/global/reset.min.css +1 -0
- package/dist/darkside/global/tokens.css +895 -0
- package/dist/darkside/global/tokens.min.css +1 -0
- package/dist/darkside/index.css +8670 -0
- package/dist/darkside/index.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/accordion.css +174 -0
- package/dist/darkside/version/7.8.1/component/accordion.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/actionmenu.css +182 -0
- package/dist/darkside/version/7.8.1/component/actionmenu.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/alert.css +105 -0
- package/dist/darkside/version/7.8.1/component/alert.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/button.css +271 -0
- package/dist/darkside/version/7.8.1/component/button.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/chat.css +103 -0
- package/dist/darkside/version/7.8.1/component/chat.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/chips.css +176 -0
- package/dist/darkside/version/7.8.1/component/chips.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/copybutton.css +176 -0
- package/dist/darkside/version/7.8.1/component/copybutton.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/date.css +262 -0
- package/dist/darkside/version/7.8.1/component/date.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/dropdown.css +92 -0
- package/dist/darkside/version/7.8.1/component/dropdown.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/expansioncard.css +167 -0
- package/dist/darkside/version/7.8.1/component/expansioncard.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/form.css +1871 -0
- package/dist/darkside/version/7.8.1/component/form.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/guidepanel.css +113 -0
- package/dist/darkside/version/7.8.1/component/guidepanel.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/helptext.css +53 -0
- package/dist/darkside/version/7.8.1/component/helptext.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/internalheader.css +100 -0
- package/dist/darkside/version/7.8.1/component/internalheader.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/link.css +60 -0
- package/dist/darkside/version/7.8.1/component/link.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/linkpanel.css +48 -0
- package/dist/darkside/version/7.8.1/component/linkpanel.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/list.css +88 -0
- package/dist/darkside/version/7.8.1/component/list.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/loader.css +119 -0
- package/dist/darkside/version/7.8.1/component/loader.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/modal.css +175 -0
- package/dist/darkside/version/7.8.1/component/modal.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/pagination.css +43 -0
- package/dist/darkside/version/7.8.1/component/pagination.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/panel.css +12 -0
- package/dist/darkside/version/7.8.1/component/panel.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/popover.css +18 -0
- package/dist/darkside/version/7.8.1/component/popover.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/primitives.css +1291 -0
- package/dist/darkside/version/7.8.1/component/primitives.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/progressbar.css +106 -0
- package/dist/darkside/version/7.8.1/component/progressbar.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/readmore.css +95 -0
- package/dist/darkside/version/7.8.1/component/readmore.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/skeleton.css +66 -0
- package/dist/darkside/version/7.8.1/component/skeleton.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/stepper.css +234 -0
- package/dist/darkside/version/7.8.1/component/stepper.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/table.css +225 -0
- package/dist/darkside/version/7.8.1/component/table.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/tabs.css +138 -0
- package/dist/darkside/version/7.8.1/component/tabs.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/tag.css +128 -0
- package/dist/darkside/version/7.8.1/component/tag.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/theme.css +17 -0
- package/dist/darkside/version/7.8.1/component/theme.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/timeline.css +338 -0
- package/dist/darkside/version/7.8.1/component/timeline.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/togglegroup.css +105 -0
- package/dist/darkside/version/7.8.1/component/togglegroup.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/tooltip.css +108 -0
- package/dist/darkside/version/7.8.1/component/tooltip.min.css +1 -0
- package/dist/darkside/version/7.8.1/component/typography.css +242 -0
- package/dist/darkside/version/7.8.1/component/typography.min.css +1 -0
- package/dist/darkside/version/7.8.1/components.css +7471 -0
- package/dist/darkside/version/7.8.1/components.min.css +1 -0
- package/dist/darkside/version/7.8.1/global/baseline.css +47 -0
- package/dist/darkside/version/7.8.1/global/baseline.min.css +1 -0
- package/dist/darkside/version/7.8.1/global/fonts.css +109 -0
- package/dist/darkside/version/7.8.1/global/fonts.min.css +1 -0
- package/dist/darkside/version/7.8.1/global/print.css +52 -0
- package/dist/darkside/version/7.8.1/global/print.min.css +1 -0
- package/dist/darkside/version/7.8.1/global/reset.css +93 -0
- package/dist/darkside/version/7.8.1/global/reset.min.css +1 -0
- package/dist/darkside/version/7.8.1/global/tokens.css +895 -0
- package/dist/darkside/version/7.8.1/global/tokens.min.css +1 -0
- package/dist/darkside/version/7.8.1/index.css +8670 -0
- package/dist/darkside/version/7.8.1/index.min.css +1 -0
- package/dist/global/tokens.css +1 -1
- package/dist/global/tokens.min.css +1 -1
- package/dist/index.css +17 -31
- package/dist/index.min.css +2 -2
- package/form/combobox.css +2 -22
- package/link.css +1 -1
- package/package.json +23 -9
- package/table.css +1 -1
- package/tag.css +12 -6
- package/tokens.json +0 -3
- package/darkside/index copy.css +0 -37
- package/dist/component/index.css +0 -10123
- package/dist/component/index.min.css +0 -9
- /package/darkside/{baseline/theme.darkside.css → theme.darkside.css} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @navikt/ds-css
|
|
2
2
|
|
|
3
|
+
## 7.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Alert: Link-components used within Alert variant='inline' now preserves default coloring ([#3461](https://github.com/navikt/aksel/pull/3461))
|
|
8
|
+
|
|
9
|
+
- Table: :fire: Removed cursor 'pointer' when 'ExpandableRow' is disabled. ([#3462](https://github.com/navikt/aksel/pull/3462))
|
|
10
|
+
|
|
11
|
+
## 7.8.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Combobox: Removed clear button, removed tokens staring with `--ac-combobox-clear`, deprecated props `clearButton`/`clearButtonLabel`. ([#3433](https://github.com/navikt/aksel/pull/3433))
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- CSS: Resolved regression where the complete stylesheet was included in scoped 'components.css' file. ([#3427](https://github.com/navikt/aksel/pull/3427))
|
|
20
|
+
|
|
3
21
|
## 7.7.0
|
|
4
22
|
|
|
5
23
|
## 7.6.0
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import browserslist from "browserslist";
|
|
2
|
+
import CleanCss from "clean-css";
|
|
3
|
+
import fastglob from "fast-glob";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import { Features, browserslistToTargets, bundleAsync } from "lightningcss";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import {
|
|
8
|
+
StyleMappings,
|
|
9
|
+
componentsCss,
|
|
10
|
+
formCss,
|
|
11
|
+
primitivesCss,
|
|
12
|
+
} from "../config/_mappings";
|
|
13
|
+
import packageJSON from "../package.json";
|
|
14
|
+
|
|
15
|
+
bundleDarkside();
|
|
16
|
+
|
|
17
|
+
async function bundleDarkside() {
|
|
18
|
+
const buildDir = path.join(__dirname, "..", "dist/darkside");
|
|
19
|
+
const darksideDir = path.join(__dirname, "..", "darkside");
|
|
20
|
+
|
|
21
|
+
/* Make sure every dir is created to make node happy */
|
|
22
|
+
[buildDir, `${buildDir}/global`, `${buildDir}/component`].forEach((dir) => {
|
|
23
|
+
if (!fs.existsSync(dir)) {
|
|
24
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Bundles the ./index.css file with LightningCSS.
|
|
30
|
+
* @param rootParser: Custom parsers that allows for editing the index.css file before bundling it. This allows removing unwanted CSS from being bundled.
|
|
31
|
+
* @returns Parsed CSS file output. Must be valid CSS.
|
|
32
|
+
*/
|
|
33
|
+
async function bundleCSS(rootParser?: (rootFile: string) => string) {
|
|
34
|
+
const { code } = await bundleAsync({
|
|
35
|
+
filename: `${darksideDir}/index.css`,
|
|
36
|
+
minify: false,
|
|
37
|
+
include:
|
|
38
|
+
Features.Nesting | Features.MediaRangeSyntax | Features.HexAlphaColors,
|
|
39
|
+
|
|
40
|
+
drafts: {
|
|
41
|
+
customMedia: false,
|
|
42
|
+
},
|
|
43
|
+
targets: browserslistToTargets(
|
|
44
|
+
browserslist(">= 0.5% in NO, safari >= 15.4, iOS >= 15.4, not dead"),
|
|
45
|
+
),
|
|
46
|
+
resolver: {
|
|
47
|
+
read(filePath) {
|
|
48
|
+
const file = fs.readFileSync(filePath, "utf8");
|
|
49
|
+
if (filePath === `${darksideDir}/index.css` && rootParser) {
|
|
50
|
+
return rootParser(file);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return file;
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
let codeString = code.toString();
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* LightningCSS adds these tokens to the bundle that we want removed:
|
|
62
|
+
* --lightningcss-light: initial;
|
|
63
|
+
* --lightningcss-dark: ;
|
|
64
|
+
*/
|
|
65
|
+
codeString = codeString
|
|
66
|
+
.split("\n")
|
|
67
|
+
.filter((line) => !line.includes("--lightningcss-"))
|
|
68
|
+
.join("\n");
|
|
69
|
+
|
|
70
|
+
return codeString;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Writes the CSS file to the build directory. Includes a minified version with the .min.css suffix.
|
|
75
|
+
* @param file: CSS file content
|
|
76
|
+
* @param filePath: Path to the file in the build directory
|
|
77
|
+
*/
|
|
78
|
+
function writeFile({ file, filePath }: { file: string; filePath: string }) {
|
|
79
|
+
fs.writeFileSync(`${buildDir}/${filePath}`, file);
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* We use CleanCss package here since we only want it to optimize filesize, not transform any CSS like LightningCSS minifier does.
|
|
83
|
+
* This is because we want to keep the CSS as close to the original as possible.
|
|
84
|
+
* Since CleanCSS is not part of the PostCSS ecosystem, we use it in replacement for cssnano.
|
|
85
|
+
*/
|
|
86
|
+
const minifiedCss = new CleanCss({}).minify(file);
|
|
87
|
+
|
|
88
|
+
if (minifiedCss.errors.length > 0) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
`Errors found when minifying for ${filePath} CSS. Stopped bundling\n${minifiedCss.errors}`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
fs.writeFileSync(
|
|
95
|
+
`${buildDir}/${filePath.replace(".css", ".min.css")}`,
|
|
96
|
+
minifiedCss.styles,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* ----------------------------- index.css build ---------------------------- */
|
|
101
|
+
await bundleCSS().then((file) => {
|
|
102
|
+
writeFile({
|
|
103
|
+
file,
|
|
104
|
+
filePath: "index.css",
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
/* --------------------------- component.css build -------------------------- */
|
|
109
|
+
function rootComponentsParser(rootString: string) {
|
|
110
|
+
let parsed = rootString
|
|
111
|
+
.split("\n")
|
|
112
|
+
.filter((line) => {
|
|
113
|
+
/* We assume that all components is added under the layer components or layout */
|
|
114
|
+
return (
|
|
115
|
+
line.endsWith("layer(aksel.components);") ||
|
|
116
|
+
line.endsWith("layer(aksel.layout);")
|
|
117
|
+
);
|
|
118
|
+
})
|
|
119
|
+
.join("\n");
|
|
120
|
+
|
|
121
|
+
/* If one imports this file standalone, we would like to make sure the layering order is included. */
|
|
122
|
+
const layerDefinition = rootString
|
|
123
|
+
.split("\n")
|
|
124
|
+
.find((line) => line.startsWith("@layer"));
|
|
125
|
+
|
|
126
|
+
if (!layerDefinition) {
|
|
127
|
+
throw new Error(
|
|
128
|
+
"No layer definition found in index.css. Stopped bundling",
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
parsed = layerDefinition + "\n" + parsed;
|
|
133
|
+
|
|
134
|
+
return parsed;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
await bundleCSS(rootComponentsParser).then((file) => {
|
|
138
|
+
writeFile({
|
|
139
|
+
file,
|
|
140
|
+
filePath: componentsCss,
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
/* ------------------------------ /global build ----------------------------- */
|
|
145
|
+
for (const style of StyleMappings.baseline) {
|
|
146
|
+
// eslint-disable-next-line no-inner-declarations
|
|
147
|
+
function parser(input: string) {
|
|
148
|
+
return input
|
|
149
|
+
.split("\n")
|
|
150
|
+
.filter((line) => line.startsWith("@import"))
|
|
151
|
+
.filter((line) =>
|
|
152
|
+
line.replace(".darkside.css", ".css").includes(style.main),
|
|
153
|
+
)
|
|
154
|
+
.join("\n");
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
await bundleCSS(parser).then((file) => {
|
|
158
|
+
writeFile({
|
|
159
|
+
file,
|
|
160
|
+
filePath: `global/${style.main}`,
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* ------------------------------ form build ----------------------------- */
|
|
166
|
+
function rootFormParser(input: string) {
|
|
167
|
+
return input
|
|
168
|
+
.split("\n")
|
|
169
|
+
.filter((line) => line.startsWith("@import"))
|
|
170
|
+
.filter((line) => line.includes("form/index.css"))
|
|
171
|
+
.join("\n");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
await bundleCSS(rootFormParser).then((file) => {
|
|
175
|
+
writeFile({
|
|
176
|
+
file,
|
|
177
|
+
filePath: `component/${formCss}`,
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
/* ------------------------------ Primitives build ----------------------------- */
|
|
182
|
+
function rootPrimitivesParser(input: string) {
|
|
183
|
+
return input
|
|
184
|
+
.split("\n")
|
|
185
|
+
.filter((line) => line.startsWith("@import"))
|
|
186
|
+
.filter((line) => line.includes("primitives/index.css"))
|
|
187
|
+
.join("\n");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
await bundleCSS(rootPrimitivesParser).then((file) => {
|
|
191
|
+
writeFile({
|
|
192
|
+
file,
|
|
193
|
+
filePath: `component/${primitivesCss}`,
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
/* ---------------------------- /component build ---------------------------- */
|
|
198
|
+
|
|
199
|
+
function componentFiles(): string[] {
|
|
200
|
+
const indexFile = fs.readFileSync(`${darksideDir}/index.css`, "utf8");
|
|
201
|
+
|
|
202
|
+
/* Since forms and primitives is under the same layers, but diffferent files we filter them out to avoid duplicates */
|
|
203
|
+
const formLine = rootFormParser(indexFile);
|
|
204
|
+
const primitivesLine = rootPrimitivesParser(indexFile);
|
|
205
|
+
|
|
206
|
+
return indexFile
|
|
207
|
+
.split("\n")
|
|
208
|
+
.filter((line) => line.startsWith("@import"))
|
|
209
|
+
.filter((line) => !formLine.includes(line))
|
|
210
|
+
.filter((line) => !primitivesLine.includes(line))
|
|
211
|
+
.filter((line) => line.endsWith("layer(aksel.components);"));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
for (const componentLine of componentFiles()) {
|
|
215
|
+
// eslint-disable-next-line no-inner-declarations
|
|
216
|
+
function parser(input: string) {
|
|
217
|
+
return input
|
|
218
|
+
.split("\n")
|
|
219
|
+
.filter((line) => line === componentLine)
|
|
220
|
+
.join("\n");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
await bundleCSS(parser).then((file) => {
|
|
224
|
+
const componentName = componentLine
|
|
225
|
+
/* Matches everything between " */
|
|
226
|
+
.match(/".*"/gm)?.[0]
|
|
227
|
+
/* Replaces every " with nothing */
|
|
228
|
+
.replace(/"/gm, "")
|
|
229
|
+
/* Removes start of import-string */
|
|
230
|
+
.replace("./", "")
|
|
231
|
+
.replace(".darkside.css", ".css");
|
|
232
|
+
|
|
233
|
+
if (!componentName) {
|
|
234
|
+
throw new Error(
|
|
235
|
+
`Could not find component name for line: ${componentLine}`,
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const sanitizedName = componentName
|
|
240
|
+
/*
|
|
241
|
+
* https://regex101.com/r/MAj58n/1
|
|
242
|
+
* Removes every - and space
|
|
243
|
+
*/
|
|
244
|
+
.replace(/[\s-]/g, "")
|
|
245
|
+
.replace(".css", "")
|
|
246
|
+
.toLowerCase();
|
|
247
|
+
|
|
248
|
+
writeFile({
|
|
249
|
+
file,
|
|
250
|
+
filePath: `component/${sanitizedName}.css`,
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const version = packageJSON.version;
|
|
256
|
+
|
|
257
|
+
const files = fastglob.sync("**/*.css", {
|
|
258
|
+
cwd: buildDir,
|
|
259
|
+
ignore: ["**/version/**"],
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
for (const file of files) {
|
|
263
|
+
const css = fs.readFileSync(`${buildDir}/${file}`, "utf-8");
|
|
264
|
+
|
|
265
|
+
const filename = `${buildDir}/version/${version}/${file}`;
|
|
266
|
+
fs.mkdirSync(path.dirname(filename), { recursive: true });
|
|
267
|
+
|
|
268
|
+
fs.writeFileSync(filename, css);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fastglob from "fast-glob";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Darkside config might have some new files added. We can skip these when checking for equality.
|
|
7
|
+
*/
|
|
8
|
+
const newFiles = ["theme"];
|
|
9
|
+
|
|
10
|
+
describe("Check that old and new (darkside) bundle matches", () => {
|
|
11
|
+
test("Darkside includes the same files as old bundle", () => {
|
|
12
|
+
const oldBundleDir = path.join(__dirname, "../../dist");
|
|
13
|
+
const darksideDir = path.join(__dirname, "../../dist/darkside");
|
|
14
|
+
|
|
15
|
+
const oldFiles = fastglob.sync("**/*.css", {
|
|
16
|
+
cwd: oldBundleDir,
|
|
17
|
+
ignore: ["**/version/**", "**/darkside/**"],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const darksideFiles = fastglob.sync("**/*.css", {
|
|
21
|
+
cwd: darksideDir,
|
|
22
|
+
ignore: ["**/version/**"],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
expect(oldFiles.length).toBeGreaterThan(0);
|
|
26
|
+
expect(darksideFiles.length).toBeGreaterThan(0);
|
|
27
|
+
|
|
28
|
+
// Compare file names
|
|
29
|
+
oldFiles.forEach((file) => {
|
|
30
|
+
expect(darksideFiles).toContain(file);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
darksideFiles.forEach((file) => {
|
|
34
|
+
if (newFiles.find((newFile) => file.includes(newFile))) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
expect(oldFiles).toContain(file);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Check that darkside has the same amount of files as old bundle
|
|
42
|
+
* (minus the new files * 2 since .min.css is also included)
|
|
43
|
+
*/
|
|
44
|
+
expect(darksideFiles.length - newFiles.length * 2).toBe(oldFiles.length);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/* ------------------------- Global typo-definitions ------------------------ */
|
|
2
|
+
body,
|
|
3
|
+
:host {
|
|
4
|
+
font-family: var(--ax-font-family, "Source Sans 3", "Source Sans Pro", Arial, sans-serif);
|
|
5
|
+
line-height: 1.333;
|
|
6
|
+
font-size: 1.125rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* ---------------------------- Inline utilities ---------------------------- */
|
|
1
10
|
[hidden] {
|
|
2
11
|
display: none !important;
|
|
3
12
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "../../../tokens/dist/darkside/tokens.css";
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.navds-combobox--disabled {
|
|
31
|
-
opacity:
|
|
31
|
+
opacity: var(--ax-opacity-disabled);
|
|
32
32
|
|
|
33
33
|
& .navds-combobox__wrapper {
|
|
34
34
|
& *:hover {
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.navds-combobox__button-clear svg,
|
|
73
72
|
.navds-combobox__button-toggle-list svg,
|
|
74
73
|
.navds-combobox__list svg {
|
|
75
74
|
width: var(--__axc-combobox-icon-size);
|
|
@@ -203,19 +202,6 @@
|
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
|
|
206
|
-
.navds-combobox__button-clear {
|
|
207
|
-
border-radius: var(--ax-border-radius-medium);
|
|
208
|
-
color: var(--ax-text-subtle);
|
|
209
|
-
display: flex;
|
|
210
|
-
justify-content: center;
|
|
211
|
-
align-items: center;
|
|
212
|
-
cursor: pointer;
|
|
213
|
-
background: none;
|
|
214
|
-
border: none;
|
|
215
|
-
font-size: 1rem;
|
|
216
|
-
padding: 0;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
205
|
.navds-combobox__input::-webkit-search-cancel-button {
|
|
220
206
|
display: none;
|
|
221
207
|
}
|
|
@@ -231,10 +217,7 @@
|
|
|
231
217
|
border: none;
|
|
232
218
|
font-size: 1rem;
|
|
233
219
|
padding: 0;
|
|
234
|
-
}
|
|
235
220
|
|
|
236
|
-
.navds-combobox__button-clear,
|
|
237
|
-
.navds-combobox__button-toggle-list {
|
|
238
221
|
&:hover {
|
|
239
222
|
color: var(--ax-text-accent);
|
|
240
223
|
|
|
@@ -405,10 +388,6 @@
|
|
|
405
388
|
}
|
|
406
389
|
|
|
407
390
|
@media (forced-colors: active) {
|
|
408
|
-
.navds-combobox__button-clear:hover {
|
|
409
|
-
color: highlight;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
391
|
.navds-combobox__wrapper-inner:has(.navds-combobox__input:focus-visible) {
|
|
413
392
|
outline-color: highlight;
|
|
414
393
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.navds-form-field--disabled {
|
|
26
|
-
opacity:
|
|
26
|
+
opacity: var(--ax-opacity-disabled);
|
|
27
27
|
cursor: not-allowed;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
.navds-form-field__readonly-icon {
|
|
43
43
|
margin-top: var(--ax-spacing-05);
|
|
44
|
-
margin-right: var(--ax-spacing-
|
|
44
|
+
margin-right: var(--ax-spacing-1);
|
|
45
45
|
flex-shrink: 0;
|
|
46
46
|
align-self: flex-start;
|
|
47
47
|
}
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
font-size: 1.5rem;
|
|
82
82
|
|
|
83
83
|
.navds-search--disabled & {
|
|
84
|
-
opacity:
|
|
84
|
+
opacity: var(--ax-opacity-disabled);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -105,6 +105,10 @@
|
|
|
105
105
|
--__axc-button-border-width: 1px;
|
|
106
106
|
--__axc-button-border-color: var(--ax-border-default);
|
|
107
107
|
|
|
108
|
+
&:not(:hover, :active) {
|
|
109
|
+
background-color: var(--ax-bg-input);
|
|
110
|
+
}
|
|
111
|
+
|
|
108
112
|
&:hover:not(:disabled) {
|
|
109
113
|
--__axc-button-border-color: var(--ax-border-accent-strong);
|
|
110
114
|
}
|
|
@@ -144,7 +148,7 @@
|
|
|
144
148
|
/* We can't re-use disabled-state for form-fields since opacity multiplies on search-button */
|
|
145
149
|
.navds-search--disabled {
|
|
146
150
|
.navds-search__input {
|
|
147
|
-
opacity:
|
|
151
|
+
opacity: var(--ax-opacity-disabled);
|
|
148
152
|
cursor: not-allowed;
|
|
149
153
|
}
|
|
150
154
|
}
|