@jant/core 0.2.0 → 0.2.2

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/client.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Client-side JavaScript entry point
3
- * Includes all interactive components from basecoat-css
3
+ *
4
+ * Pure JS/TS exports only. CSS is handled via preset.css.
4
5
  */
5
6
  import "basecoat-css/all";
6
7
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,kBAAkB,CAAC"}
package/dist/client.js CHANGED
@@ -1,4 +1,6 @@
1
1
  /**
2
2
  * Client-side JavaScript entry point
3
- * Includes all interactive components from basecoat-css
4
- */ import "basecoat-css/all";
3
+ *
4
+ * Pure JS/TS exports only. CSS is handled via preset.css.
5
+ */ // BaseCoat interactive components (dialogs, dropdowns, etc.)
6
+ import "basecoat-css/all";
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * Asset paths for SSR
3
3
  *
4
- * Development: Uses source paths served by Vite dev server
5
- * Production: Uses paths that get patched at build time with actual hashes
4
+ * Development: Paths injected via vite.config.ts `define`
5
+ * Production: Paths replaced at build time with hashed filenames from manifest
6
6
  */
7
7
  interface Assets {
8
+ /** CSS path (prevents FOUC in dev, hashed in prod) */
8
9
  styles: string;
9
10
  client: string;
10
11
  datastar: string;
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/lib/assets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,MAAM;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB;AAmBD;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CASlC;AAGD,eAAO,MAAM,MAAM,QAAc,CAAC"}
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/lib/assets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,MAAM;IACd,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB;AAgBD;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAelC;AAGD,eAAO,MAAM,MAAM,QAAc,CAAC"}
@@ -1,17 +1,9 @@
1
1
  /**
2
2
  * Asset paths for SSR
3
3
  *
4
- * Development: Uses source paths served by Vite dev server
5
- * Production: Uses paths that get patched at build time with actual hashes
6
- */ // Development paths - use source files for HMR
7
- const DEV_ASSETS = {
8
- styles: "/node_modules/@jant/core/src/theme/styles/main.css",
9
- client: "/node_modules/@jant/core/src/client.ts",
10
- datastar: "/node_modules/@jant/core/static/assets/datastar.min.js",
11
- imageProcessor: "/node_modules/@jant/core/static/assets/image-processor.js"
12
- };
13
- // Production paths - these unique placeholders get replaced at build time
14
- // Format: __JANT_ASSET_<NAME>__ to avoid accidental matches
4
+ * Development: Paths injected via vite.config.ts `define`
5
+ * Production: Paths replaced at build time with hashed filenames from manifest
6
+ */ // Production paths - replaced at build time
15
7
  const PROD_ASSETS = {
16
8
  styles: "__JANT_ASSET_STYLES__",
17
9
  client: "__JANT_ASSET_CLIENT__",
@@ -22,8 +14,14 @@ const PROD_ASSETS = {
22
14
  * Get assets based on environment
23
15
  */ export function getAssets() {
24
16
  try {
25
- // import.meta.env is injected by Vite
26
- if (import.meta.env?.DEV) return DEV_ASSETS;
17
+ if (import.meta.env?.DEV) {
18
+ return {
19
+ styles: __JANT_DEV_STYLES__,
20
+ client: __JANT_DEV_CLIENT__,
21
+ datastar: __JANT_DEV_DATASTAR__,
22
+ imageProcessor: __JANT_DEV_IMAGE_PROCESSOR__
23
+ };
24
+ }
27
25
  } catch {
28
26
  // import.meta.env may not exist in all environments
29
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseLayout.d.ts","sourceRoot":"","sources":["../../../src/theme/layouts/BaseLayout.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,OAAO,CAAC;CACb;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA6B7D,CAAC"}
1
+ {"version":3,"file":"BaseLayout.d.ts","sourceRoot":"","sources":["../../../src/theme/layouts/BaseLayout.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,OAAO,CAAC;CACb;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA8B7D,CAAC"}
@@ -33,7 +33,7 @@ export const BaseLayout = ({ title, description, lang = "en", c, children })=>{
33
33
  name: "description",
34
34
  content: description
35
35
  }),
36
- /*#__PURE__*/ _jsx("link", {
36
+ assets.styles && /*#__PURE__*/ _jsx("link", {
37
37
  rel: "stylesheet",
38
38
  href: assets.styles
39
39
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jant/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A modern, open-source microblogging platform built on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,26 +15,24 @@
15
15
  "types": "./dist/theme/index.d.ts",
16
16
  "default": "./dist/theme/index.js"
17
17
  },
18
- "./theme/*": {
19
- "types": "./dist/theme/*.d.ts",
20
- "default": "./dist/theme/*.js"
21
- },
22
- "./dist/*": "./dist/*",
23
- "./static/*": "./static/*",
24
- "./migrations/*": "./migrations/*"
18
+ "./preset.css": "./src/preset.css",
19
+ "./client": "./src/client.ts",
20
+ "./*": "./*"
25
21
  },
26
22
  "files": [
27
23
  "bin",
28
24
  "dist",
29
25
  "static",
30
- "migrations"
26
+ "migrations",
27
+ "src/preset.css",
28
+ "src/styles",
29
+ "src/client.ts"
31
30
  ],
32
31
  "publishConfig": {
33
32
  "access": "public"
34
33
  },
35
34
  "dependencies": {
36
35
  "@lingui/core": "^5.9.0",
37
- "basecoat-css": "^0.3.10",
38
36
  "better-auth": "^1.4.18",
39
37
  "drizzle-orm": "^0.45.1",
40
38
  "hono": "^4.11.7",
@@ -43,7 +41,12 @@
43
41
  "uuidv7": "^1.1.0",
44
42
  "zod": "^4.3.6"
45
43
  },
44
+ "peerDependencies": {
45
+ "basecoat-css": "^0.3.0",
46
+ "tailwindcss": "^4.0.0"
47
+ },
46
48
  "devDependencies": {
49
+ "basecoat-css": "^0.3.10",
47
50
  "@cloudflare/vite-plugin": "^1.22.1",
48
51
  "@cloudflare/workers-types": "^4.20260131.0",
49
52
  "@eslint/js": "^9.39.2",
@@ -52,7 +55,6 @@
52
55
  "@lingui/swc-plugin": "^5.10.1",
53
56
  "@swc/cli": "^0.6.0",
54
57
  "@swc/core": "^1.15.11",
55
- "@tailwindcss/cli": "^4.1.18",
56
58
  "@tailwindcss/postcss": "^4.1.18",
57
59
  "@types/node": "^25.1.0",
58
60
  "@typescript-eslint/eslint-plugin": "^8.54.0",
@@ -100,9 +102,8 @@
100
102
  "dev": "pnpm db:migrate:local && vite dev",
101
103
  "dev:debug": "pnpm db:migrate:local && vite dev --port 19019",
102
104
  "build": "vite build",
103
- "build:lib": "swc src -d dist --strip-leading-paths && pnpm build:types && pnpm build:css",
105
+ "build:lib": "swc src -d dist --strip-leading-paths && pnpm build:types",
104
106
  "build:types": "tsc -p tsconfig.build.json",
105
- "build:css": "tailwindcss -i src/theme/styles/main.css -o dist/theme/styles/main.css --minify",
106
107
  "deploy": "pnpm build && wrangler deploy",
107
108
  "preview": "vite preview",
108
109
  "typecheck": "tsc --noEmit",
package/src/client.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Client-side JavaScript entry point
3
+ *
4
+ * Pure JS/TS exports only. CSS is handled via preset.css.
5
+ */
6
+
7
+ // BaseCoat interactive components (dialogs, dropdowns, etc.)
8
+ import "basecoat-css/all";
package/src/preset.css ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Jant Core Preset
3
+ *
4
+ * Encapsulates internal dependencies, component styles, and source paths.
5
+ * Users import this AFTER initializing Tailwind in their CSS entry.
6
+ */
7
+
8
+ /* 1. Internal dependencies */
9
+ @import "basecoat-css";
10
+
11
+ /* 2. Component styles (badges, utilities) */
12
+ @import "./styles/components.css";
13
+
14
+ /* 3. Source paths for Tailwind class scanning
15
+ Paths are relative to this file (src/).
16
+ Scans all TSX components for Tailwind classes. */
17
+ @source "./**/*.{ts,tsx}";
18
+
19
+ /* 4. Default theme variables */
20
+ @theme {
21
+ --radius-default: 0.5rem;
22
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @jant/core component styles
3
+ *
4
+ * These use Tailwind's @layer and @apply, so they must be imported
5
+ * AFTER Tailwind is initialized in the user's CSS entry.
6
+ */
7
+
8
+ /* Custom utilities */
9
+ @layer utilities {
10
+ .container {
11
+ @apply mx-auto max-w-2xl px-4;
12
+ }
13
+ }
14
+
15
+ /* Badge components */
16
+ @layer components {
17
+ .badge {
18
+ @apply inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium;
19
+ background-color: var(--color-secondary);
20
+ color: var(--color-secondary-foreground);
21
+ }
22
+
23
+ .badge-primary {
24
+ @apply inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium;
25
+ background-color: var(--color-primary);
26
+ color: var(--color-primary-foreground);
27
+ }
28
+
29
+ .badge-secondary {
30
+ @apply inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium;
31
+ background-color: var(--color-secondary);
32
+ color: var(--color-secondary-foreground);
33
+ }
34
+
35
+ .badge-outline {
36
+ @apply inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium;
37
+ @apply border bg-transparent;
38
+ border-color: var(--color-border);
39
+ color: var(--color-foreground);
40
+ }
41
+
42
+ .badge-destructive {
43
+ @apply inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium;
44
+ background-color: var(--color-destructive);
45
+ color: white;
46
+ }
47
+ }