@brickflow/ui 0.0.45 → 0.0.46
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/module.json +1 -1
- package/dist/module.mjs +56 -3
- package/package.json +2 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,10 +1,63 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, resolvePath, addTypeTemplate, addTemplate, updateTemplates, addImportsDir, addComponentsDir } from '@nuxt/kit';
|
|
2
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
3
3
|
import { createJiti } from 'jiti';
|
|
4
|
-
import {
|
|
5
|
-
import { basename, extname, dirname, resolve, relative
|
|
4
|
+
import { mkdir, access, readFile, writeFile, readdir } from 'node:fs/promises';
|
|
5
|
+
import { join, parse, basename, extname, dirname, resolve, relative } from 'node:path';
|
|
6
6
|
import { isBrickflowUiStyleReference, getBrickflowUiStyleReferencePath, defineBrickflowUi } from '../dist/runtime/tailwind.js';
|
|
7
|
-
import {
|
|
7
|
+
import { generateFonts, FontAssetType, OtherAssetType } from 'fantasticon';
|
|
8
|
+
|
|
9
|
+
const getIconFontCssPath$1 = (outputDir, name) => join(outputDir, `${name}.minify.css`);
|
|
10
|
+
async function generateIcons({ inputDir, name, outputDir }) {
|
|
11
|
+
await mkdir(outputDir, { recursive: true });
|
|
12
|
+
await generateFonts({
|
|
13
|
+
assetTypes: [OtherAssetType.CSS, OtherAssetType.JSON],
|
|
14
|
+
fontsUrl: ".",
|
|
15
|
+
fontTypes: [FontAssetType.EOT, FontAssetType.WOFF2, FontAssetType.WOFF],
|
|
16
|
+
formatOptions: {
|
|
17
|
+
json: {
|
|
18
|
+
indent: 2
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
inputDir,
|
|
22
|
+
name,
|
|
23
|
+
normalize: true,
|
|
24
|
+
outputDir
|
|
25
|
+
});
|
|
26
|
+
let cssSourceFile;
|
|
27
|
+
for (const file of [`${name}.css`, "icons.css", "icon.css"]) {
|
|
28
|
+
try {
|
|
29
|
+
await access(join(outputDir, file));
|
|
30
|
+
cssSourceFile = file;
|
|
31
|
+
break;
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!cssSourceFile) {
|
|
36
|
+
throw new Error(`CSS output file was not generated for icon set "${name}"`);
|
|
37
|
+
}
|
|
38
|
+
const cssPath = join(outputDir, cssSourceFile);
|
|
39
|
+
const minifiedCssPath = join(outputDir, `${parse(cssSourceFile).name}.minify.css`);
|
|
40
|
+
const cssContent = await readFile(cssPath, "utf8");
|
|
41
|
+
const normalizedCssContent = normalizeGeneratedCss(cssContent);
|
|
42
|
+
if (normalizedCssContent !== cssContent) {
|
|
43
|
+
await writeFile(cssPath, normalizedCssContent);
|
|
44
|
+
}
|
|
45
|
+
await writeFile(minifiedCssPath, minifyCss(normalizedCssContent));
|
|
46
|
+
return {
|
|
47
|
+
cssPath,
|
|
48
|
+
minifiedCssPath
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function minifyCss(css) {
|
|
52
|
+
return css.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;\}/g, "}").trim();
|
|
53
|
+
}
|
|
54
|
+
function normalizeGeneratedCss(css) {
|
|
55
|
+
return `${css.replace(/"/g, "'").replace(/^ {4}/gm, " ").replace(/src: ([^\n]+),\n([^\n]+),\n([^\n]+);/, "src:\n $1,\n $2,\n $3;").replace(
|
|
56
|
+
/i\[class\^='icon-'\]:before, i\[class\*=' icon-'\]:before \{/,
|
|
57
|
+
"i[class^='icon-']:before,\ni[class*=' icon-']:before {"
|
|
58
|
+
).replace(/\n{3,}/g, "\n\n").trim()}
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
8
61
|
|
|
9
62
|
const ICON_FILE_PATTERN = /\.svg$/i;
|
|
10
63
|
const ICON_FONT_NAME = "brickflow-icon";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brickflow/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "brickflow UI Nuxt module.",
|
|
6
6
|
"files": [
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@brickflow/cli": "workspace:*",
|
|
37
36
|
"@tailwindcss/vite": "4.3.3",
|
|
37
|
+
"fantasticon": "4.1.0",
|
|
38
38
|
"jiti": "2.7.0",
|
|
39
39
|
"tailwindcss": "4.3.3"
|
|
40
40
|
},
|