@editframe/elements 0.25.0-beta.0 → 0.25.1-beta.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/package.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
2
  "name": "@editframe/elements",
3
- "version": "0.25.0-beta.0",
3
+ "version": "0.25.1-beta.0",
4
4
  "description": "",
5
- "exports": {
6
- ".": "./dist/index.js",
7
- "./package.json": "./package.json"
8
- },
9
5
  "type": "module",
10
6
  "scripts": {
11
7
  "typecheck": "tsc --noEmit --emitDeclarationOnly false",
12
- "build": "tsdown",
8
+ "build": "tsdown && node scripts/build-css.js",
13
9
  "build:watch": "tsdown --watch",
14
10
  "typedoc": "typedoc --json ./types.json --plugin typedoc-plugin-zod --excludeExternals ./src && jq -c . ./types.json > ./types.tmp.json && mv ./types.tmp.json ./types.json"
15
11
  },
@@ -17,7 +13,7 @@
17
13
  "license": "UNLICENSED",
18
14
  "dependencies": {
19
15
  "@bramus/style-observer": "^1.3.0",
20
- "@editframe/assets": "0.25.0-beta.0",
16
+ "@editframe/assets": "0.25.1-beta.0",
21
17
  "@lit/context": "^1.1.6",
22
18
  "@lit/task": "^1.0.3",
23
19
  "@opentelemetry/api": "^1.9.0",
@@ -36,9 +32,35 @@
36
32
  "@types/dom-webcodecs": "^0.1.11",
37
33
  "@types/node": "^20.14.13",
38
34
  "autoprefixer": "^10.4.19",
35
+ "postcss": "^8.4.38",
36
+ "tailwindcss": "^3.4.3",
39
37
  "typescript": "^5.5.4"
40
38
  },
41
39
  "main": "./dist/index.js",
42
40
  "module": "./dist/index.js",
43
- "types": "./dist/index.d.ts"
41
+ "types": "./dist/index.d.ts",
42
+ "exports": {
43
+ ".": {
44
+ "import": {
45
+ "types": "./dist/index.d.ts",
46
+ "default": "./dist/index.js"
47
+ }
48
+ },
49
+ "./package.json": "./package.json",
50
+ "./styles.css": "./dist/style.css",
51
+ "./types.json": "./types.json"
52
+ },
53
+ "publishConfig": {
54
+ "exports": {
55
+ ".": {
56
+ "import": {
57
+ "types": "./dist/index.d.ts",
58
+ "default": "./dist/index.js"
59
+ }
60
+ },
61
+ "./package.json": "./package.json",
62
+ "./styles.css": "./dist/style.css",
63
+ "./types.json": "./types.json"
64
+ }
65
+ }
44
66
  }
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+
3
+ import autoprefixer from "autoprefixer";
4
+ import { mkdirSync, readFileSync, writeFileSync } from "fs";
5
+ import { dirname, join } from "path";
6
+ import postcss from "postcss";
7
+ import tailwindcss from "tailwindcss";
8
+ import { fileURLToPath } from "url";
9
+
10
+ const __dirname = dirname(fileURLToPath(import.meta.url));
11
+ const srcDir = join(__dirname, "..", "src");
12
+ const distDir = join(__dirname, "..", "dist");
13
+
14
+ // Ensure dist directory exists
15
+ mkdirSync(distDir, { recursive: true });
16
+
17
+ // Read source CSS
18
+ const cssPath = join(srcDir, "elements.css");
19
+ const css = readFileSync(cssPath, "utf-8");
20
+
21
+ // Process through PostCSS
22
+ console.log("Processing CSS through Tailwind and PostCSS...");
23
+
24
+ postcss([
25
+ tailwindcss({
26
+ content: [join(srcDir, "**/*.ts")],
27
+ }),
28
+ autoprefixer(),
29
+ ])
30
+ .process(css, { from: cssPath, to: join(distDir, "style.css") })
31
+ .then((result) => {
32
+ writeFileSync(join(distDir, "style.css"), result.css);
33
+ if (result.map) {
34
+ writeFileSync(join(distDir, "style.css.map"), result.map.toString());
35
+ }
36
+ console.log("✅ CSS processed and written to dist/style.css");
37
+ })
38
+ .catch((error) => {
39
+ console.error("❌ CSS processing failed:", error);
40
+ process.exit(1);
41
+ });
package/tsdown.config.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import path from "node:path";
3
-
3
+ import autoprefixer from "autoprefixer";
4
+ import postcss from "postcss";
5
+ import tailwindcss from "tailwindcss";
4
6
  import { defineConfig, type Plugin } from "tsdown";
5
7
 
6
8
  import { createTsdownConfig } from "../tsdown.config.base.ts";
7
9
 
8
- // Plugin to handle CSS ?inline imports
10
+ // Plugin to handle CSS ?inline imports with Tailwind processing
9
11
  const inlineCssPlugin = (): Plugin => ({
10
12
  name: "inline-css",
11
13
  resolveId(source, importer) {
@@ -18,10 +20,24 @@ const inlineCssPlugin = (): Plugin => ({
18
20
  }
19
21
  return null;
20
22
  },
21
- load(id) {
23
+ async load(id) {
22
24
  if (id.endsWith("?inline")) {
23
25
  const filePath = id.replace("?inline", "");
24
26
  const css = readFileSync(filePath, "utf-8");
27
+
28
+ // Process through Tailwind if it contains @tailwind directives
29
+ if (css.includes("@tailwind")) {
30
+ const srcDir = path.resolve(path.dirname(filePath));
31
+ const result = await postcss([
32
+ tailwindcss({
33
+ content: [path.join(srcDir, "**/*.ts")],
34
+ }),
35
+ autoprefixer(),
36
+ ]).process(css, { from: filePath });
37
+
38
+ return `export default ${JSON.stringify(result.css)}`;
39
+ }
40
+
25
41
  return `export default ${JSON.stringify(css)}`;
26
42
  }
27
43
  return null;
@@ -32,5 +48,10 @@ export default defineConfig(
32
48
  createTsdownConfig({
33
49
  plugins: [inlineCssPlugin()],
34
50
  external: [/@editframe\/assets/],
51
+ publint: false, // Disabled because CSS is built after tsdown
52
+ additionalExports: {
53
+ "./styles.css": "./dist/style.css",
54
+ "./types.json": "./types.json",
55
+ },
35
56
  }),
36
57
  );
@@ -1,9 +0,0 @@
1
- /* biome-ignore lint/suspicious/noUnknownAtRules: @tailwind is a valid Tailwind CSS directive */
2
- @tailwind base;
3
- /* biome-ignore lint/suspicious/noUnknownAtRules: @tailwind is a valid Tailwind CSS directive */
4
- @tailwind components;
5
- /* biome-ignore lint/suspicious/noUnknownAtRules: @tailwind is a valid Tailwind CSS directive */
6
- @tailwind utilities;
7
-
8
-
9
- /*# sourceMappingURL=elements-ZhsB7B5N.css.map*/
@@ -1 +0,0 @@
1
- {"version":3,"file":"elements-ZhsB7B5N.css","names":[],"sources":["../src/elements.css"],"sourcesContent":["/* biome-ignore lint/suspicious/noUnknownAtRules: @tailwind is a valid Tailwind CSS directive */\n@tailwind base;\n/* biome-ignore lint/suspicious/noUnknownAtRules: @tailwind is a valid Tailwind CSS directive */\n@tailwind components;\n/* biome-ignore lint/suspicious/noUnknownAtRules: @tailwind is a valid Tailwind CSS directive */\n@tailwind utilities;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA"}
package/dist/elements.js DELETED
File without changes