juo 0.3.0-alpha.0 → 0.3.0-alpha.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/README.md CHANGED
@@ -20,7 +20,7 @@ $ npm install -g juo
20
20
  $ juo COMMAND
21
21
  running command...
22
22
  $ juo (--version)
23
- juo/0.3.0-alpha.0 linux-x64 node-v22.21.0
23
+ juo/0.3.0-alpha.1 linux-x64 node-v22.21.0
24
24
  $ juo --help [COMMAND]
25
25
  USAGE
26
26
  $ juo COMMAND
package/bin/dev.js CHANGED
@@ -4,9 +4,19 @@ import {execute} from '@oclif/core'
4
4
  import {readFileSync} from 'node:fs'
5
5
  import {fileURLToPath} from 'node:url'
6
6
 
7
- const editorPkg = JSON.parse(
8
- readFileSync(fileURLToPath(new URL('../../editor/package.json', import.meta.url)), 'utf8'),
9
- )
10
- process.env.BLOCKS_EDITOR_VERSION = editorPkg.version
7
+ // Dev mode runs the TypeScript source through tsx, so tsdown's build-time
8
+ // `define` substitutions (see tsdown.config.ts) never happen. Reproduce them
9
+ // here from the workspace package.json files so `juo create` behaves like the
10
+ // built CLI.
11
+ const readVersion = (relPath) =>
12
+ JSON.parse(readFileSync(fileURLToPath(new URL(relPath, import.meta.url)), 'utf8')).version
13
+
14
+ process.env.BLOCKS_EDITOR_VERSION = readVersion('../../editor/package.json')
15
+ process.env.BLOCKS_EXTENSIONS_VERSION = readVersion('../../extensions/package.json')
16
+ // `__CUSTOMER_UI_VERSION__` / `__BLOCKS_VERSION__` are bare globals in
17
+ // packageGenerator.ts (tsdown defines in prod); set them on globalThis so the
18
+ // free identifiers resolve in dev.
19
+ globalThis.__CUSTOMER_UI_VERSION__ = `^${readVersion('../../../components/customer-ui/package.json')}`
20
+ globalThis.__BLOCKS_VERSION__ = `^${readVersion('../../core/package.json')}`
11
21
 
12
22
  await execute({development: true, dir: import.meta.url})
@@ -1,12 +1,12 @@
1
1
  import { t as BaseCommand } from "../../base-command-BQVnm_gK.js";
2
- import * as _oclif_core_interfaces5 from "@oclif/core/interfaces";
2
+ import * as _oclif_core_interfaces0 from "@oclif/core/interfaces";
3
3
 
4
4
  //#region src/commands/blocks/dev.d.ts
5
5
  declare class Dev extends BaseCommand<typeof Dev> {
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- port: _oclif_core_interfaces5.OptionFlag<number, _oclif_core_interfaces5.CustomOptions>;
9
+ port: _oclif_core_interfaces0.OptionFlag<number, _oclif_core_interfaces0.CustomOptions>;
10
10
  };
11
11
  run(): Promise<void>;
12
12
  private resolvePackageJsonPath;
@@ -1,13 +1,13 @@
1
1
  import { Command } from "@oclif/core";
2
- import * as _oclif_core_interfaces9 from "@oclif/core/interfaces";
2
+ import * as _oclif_core_interfaces1 from "@oclif/core/interfaces";
3
3
 
4
4
  //#region src/commands/create.d.ts
5
5
  declare class Create extends Command {
6
6
  static description: string;
7
7
  static flags: {
8
- quickstart: _oclif_core_interfaces9.BooleanFlag<boolean>;
9
- storybook: _oclif_core_interfaces9.BooleanFlag<boolean>;
10
- verbose: _oclif_core_interfaces9.BooleanFlag<boolean>;
8
+ quickstart: _oclif_core_interfaces1.BooleanFlag<boolean>;
9
+ storybook: _oclif_core_interfaces1.BooleanFlag<boolean>;
10
+ verbose: _oclif_core_interfaces1.BooleanFlag<boolean>;
11
11
  };
12
12
  run(): Promise<void>;
13
13
  private getProjectConfig;
@@ -1,5 +1,5 @@
1
1
  import { r as BaseTemplateGenerator } from "../juoTemplateGenerator-RkinYN2l.js";
2
- import { t as PackageGenerator } from "../packageGenerator-Bx2FAq2Y.js";
2
+ import { t as PackageGenerator } from "../packageGenerator-D81lWXTA.js";
3
3
  import { t as Generate } from "../generate-BiHo2p9_.js";
4
4
  import { Command, Flags } from "@oclif/core";
5
5
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
@@ -21,7 +21,8 @@ var ConfigFilesGenerator = class extends BaseTemplateGenerator {
21
21
  var DevHarnessGenerator = class extends BaseTemplateGenerator {
22
22
  generate(destDir, options) {
23
23
  this.renderTemplate("dev", destDir, {
24
- editorVersion: "0.25.0-alpha.1",
24
+ editorVersion: "0.25.0-alpha.2",
25
+ extensionsVersion: "1.12.0-alpha.1",
25
26
  tailwind: options.tailwind
26
27
  });
27
28
  }
@@ -1,15 +1,15 @@
1
1
  import { Command } from "@oclif/core";
2
- import * as _oclif_core_interfaces0 from "@oclif/core/interfaces";
2
+ import * as _oclif_core_interfaces6 from "@oclif/core/interfaces";
3
3
 
4
4
  //#region src/commands/generate.d.ts
5
5
  declare class Generate extends Command {
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- name: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
10
- tailwind: _oclif_core_interfaces0.BooleanFlag<boolean>;
11
- type: _oclif_core_interfaces0.OptionFlag<string, _oclif_core_interfaces0.CustomOptions>;
12
- verbose: _oclif_core_interfaces0.BooleanFlag<boolean>;
9
+ name: _oclif_core_interfaces6.OptionFlag<string | undefined, _oclif_core_interfaces6.CustomOptions>;
10
+ tailwind: _oclif_core_interfaces6.BooleanFlag<boolean>;
11
+ type: _oclif_core_interfaces6.OptionFlag<string, _oclif_core_interfaces6.CustomOptions>;
12
+ verbose: _oclif_core_interfaces6.BooleanFlag<boolean>;
13
13
  };
14
14
  static id: string;
15
15
  run(): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { t as BaseCommand } from "../../base-command-BQVnm_gK.js";
2
- import * as _oclif_core_interfaces7 from "@oclif/core/interfaces";
2
+ import * as _oclif_core_interfaces4 from "@oclif/core/interfaces";
3
3
 
4
4
  //#region src/commands/publish/index.d.ts
5
5
  declare class Publish extends BaseCommand<typeof Publish> {
@@ -7,7 +7,7 @@ declare class Publish extends BaseCommand<typeof Publish> {
7
7
  static description: string;
8
8
  static examples: string[];
9
9
  static flags: {
10
- theme: _oclif_core_interfaces7.OptionFlag<string, _oclif_core_interfaces7.CustomOptions>;
10
+ theme: _oclif_core_interfaces4.OptionFlag<string, _oclif_core_interfaces4.CustomOptions>;
11
11
  };
12
12
  getAllFiles(dirPath: string, basePath: string): string[];
13
13
  run(): Promise<void>;
@@ -8,6 +8,7 @@ interface TemplateScope {
8
8
  tailwind?: boolean;
9
9
  };
10
10
  editorVersion?: string;
11
+ extensionsVersion?: string;
11
12
  tailwind?: boolean;
12
13
  }
13
14
  declare abstract class BaseTemplateGenerator {
package/dist/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { n as StoryGenerator, r as BaseTemplateGenerator, t as JuoTemplateGenerator } from "../juoTemplateGenerator-RkinYN2l.js";
2
- import { t as PackageGenerator } from "../packageGenerator-Bx2FAq2Y.js";
2
+ import { t as PackageGenerator } from "../packageGenerator-D81lWXTA.js";
3
3
 
4
4
  export { BaseTemplateGenerator, JuoTemplateGenerator, PackageGenerator, StoryGenerator };
@@ -16,9 +16,6 @@ const FRAMEWORK_CONFIGS = {
16
16
  },
17
17
  react: {
18
18
  dependencies: {
19
- "@juo/blocks": "^1.0.0",
20
- "@mantine/core": "7.5.3",
21
- "@mantine/hooks": "7.5.3",
22
19
  react: "^18.2.0",
23
20
  "react-dom": "^18.2.0"
24
21
  },
@@ -53,8 +50,8 @@ var PackageGenerator = class {
53
50
  "postcss-prefix-selector": "^2.1.1",
54
51
  prettier: "^3.5.3",
55
52
  ...options.tailwind ? {
56
- "@tailwindcss/vite": "^4.1.17",
57
- tailwindcss: "^4.1.17"
53
+ autoprefixer: "^10.4.19",
54
+ tailwindcss: "^3.3.5"
58
55
  } : {},
59
56
  ...options.storybook ? { storybook: "^10.0.7" } : {},
60
57
  typebox: "^1.0.51",
@@ -83,6 +80,7 @@ var PackageGenerator = class {
83
80
  });
84
81
  const frameworkConfig = FRAMEWORK_CONFIGS[options.framework];
85
82
  baseConfig.dependencies = {
83
+ "@juo/blocks": "^1.12.0-alpha.2",
86
84
  "@juo/customer-ui": "^0.5.0-alpha.4",
87
85
  ...baseConfig.dependencies,
88
86
  ...frameworkConfig.dependencies
@@ -179,5 +179,5 @@
179
179
  ]
180
180
  }
181
181
  },
182
- "version": "0.3.0-alpha.0"
182
+ "version": "0.3.0-alpha.1"
183
183
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "juo",
3
3
  "description": "A CLI tool for the Juo platform",
4
- "version": "0.3.0-alpha.0",
4
+ "version": "0.3.0-alpha.1",
5
5
  "author": "Juo (https://juo.io)",
6
6
  "bin": {
7
7
  "juo": "./bin/run.js"
@@ -1,5 +1,4 @@
1
1
  import { useState } from "react";
2
- import { MantineProvider } from "@mantine/core";
3
2
  import type { Props } from ".";
4
3
 
5
4
  const FrameworkIcon = ({ className }: { className: string }) => {
@@ -54,24 +53,22 @@ export function {{ block.clsName }}(props: Props) {
54
53
  const [count, setCount] = useState(props.initialCount ?? 0);
55
54
 
56
55
  return (
57
- <MantineProvider>
58
- <juo-card>
59
- <div className="font-[540] flex gap-8 justify-between items-center py-10 px-10">
60
- <div className="flex items-center gap-[14px]">
61
- <div className="flex items-center gap-2">
62
- <FrameworkIcon className="w-9 h-9 fill-current text-black" />
63
- <TypeScriptIcon className="w-10 h-10 fill-current text-black" />
64
- </div>
65
- <div className="flex flex-col self-center">
66
- <p className="text-[12px] leading-4 text-[#696969]">
67
- {props.subtitle}
68
- </p>
69
- <p className="text-[15px] leading-none text-[#111]">{props.title}</p>
70
- </div>
56
+ <juo-card>
57
+ <div className="font-[540] flex gap-8 justify-between items-center py-10 px-10">
58
+ <div className="flex items-center gap-[14px]">
59
+ <div className="flex items-center gap-2">
60
+ <FrameworkIcon className="w-9 h-9 fill-current text-black" />
61
+ <TypeScriptIcon className="w-10 h-10 fill-current text-black" />
62
+ </div>
63
+ <div className="flex flex-col self-center">
64
+ <p className="text-[12px] leading-4 text-[#696969]">
65
+ {props.subtitle}
66
+ </p>
67
+ <p className="text-[15px] leading-none text-[#111]">{props.title}</p>
71
68
  </div>
72
- <juo-button onClick={() => setCount(count + 1)}>count: is {count}</juo-button>
73
69
  </div>
74
- </juo-card>
75
- </MantineProvider>
70
+ <juo-button onClick={() => setCount(count + 1)}>count: is {count}</juo-button>
71
+ </div>
72
+ </juo-card>
76
73
  );
77
74
  }
@@ -0,0 +1,5 @@
1
+ // Your blocks theme entry. `vite build` bundles this file in library mode into
2
+ // the artifact the Juo runtime loads in production, so it must export
3
+ // `registerBlocks`. Only your project's blocks belong here — the dev preview
4
+ // (theme shell + native blocks) lives in `vite/` and never ships in this bundle.
5
+ export * from "./blocks/register";
@@ -23,7 +23,7 @@ export default defineConfig({
23
23
  },
24
24
  build: {
25
25
  lib: {
26
- entry: "src/blocks/register.ts",
26
+ entry: "src/main.ts",
27
27
  formats: ["es"],
28
28
  fileName: "index",
29
29
  },
@@ -4,11 +4,18 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Juo Blocks Dev</title>
7
+ <script type="importmap">
8
+ {
9
+ "imports": {
10
+ "@juo/blocks": "/vite/blocks-shim.ts"
11
+ }
12
+ }
13
+ </script>
7
14
  </head>
8
15
  <body>
9
16
  <juo-context-root>
10
17
  <div id="app"></div>
11
18
  </juo-context-root>
12
- <script type="module" src="/src/main.ts"></script>
19
+ <script type="module" src="/vite/theme-shell.ts"></script>
13
20
  </body>
14
21
  </html>
@@ -0,0 +1,6 @@
1
+ // Re-exports the locally installed @juo/blocks. The CDN-hosted
2
+ // @juo/blocks-extensions bundle externalizes "@juo/blocks", so the index.html
3
+ // import map points that bare specifier at this shim — ensuring the native
4
+ // blocks register into the SAME @juo/blocks instance the theme shell uses
5
+ // (Vite dedupes both to one pre-bundled module). Dev-harness only.
6
+ export * from "@juo/blocks";
@@ -35,7 +35,7 @@ export default function juo(): Plugin {
35
35
  server.config.logger.info(
36
36
  `\n juo editor ${base}/editor` +
37
37
  `\n editor view mode ${base}/` +
38
- `\n blocks bundle ${base}/src/blocks/register.ts\n`,
38
+ `\n blocks bundle ${base}/src/main.ts\n`,
39
39
  );
40
40
  });
41
41
  },
@@ -1,6 +1,10 @@
1
+ // Dev-only theme shell. Lives outside the project's `src/` so the author's
2
+ // source tree contains only their blocks. Vite serves this file directly (see
3
+ // the <script> + import map injected in index.html); it never enters the built
4
+ // blocks bundle (whose entry is `src/blocks/register.ts`).
1
5
  import "@juo/blocks/web-components/editor";
2
- {% if tailwind %}import "./tailwind.css";
3
- {% else %}import "./styles.css";
6
+ {% if tailwind %}import "../src/tailwind.css";
7
+ {% else %}import "../src/styles.css";
4
8
  {% endif %}
5
9
  import {
6
10
  createBlockInstance,
@@ -17,7 +21,12 @@ import {
17
21
  createTranslationService,
18
22
  untracked,
19
23
  } from "@juo/blocks";
20
- import { registerBlocks as registerProjectBlocks } from "./blocks/register";
24
+ import { registerBlocks as registerProjectBlocks } from "../src/main";
25
+ // Native blocks shipped by @juo/blocks-extensions, loaded from CDN. Its bare
26
+ // "@juo/blocks" import is bridged to the local instance via the index.html
27
+ // import map (see vite/blocks-shim.ts).
28
+ // @ts-expect-error Remote, untyped module
29
+ import { blocks as nativeBlocks } from "https://cdn.juo.io/web/blocks/juo/{{ extensionsVersion }}/extensions.js";
21
30
 
22
31
  const homePageBlock = defineBlock("HomePage", {
23
32
  displayName: "Home page",
@@ -56,6 +65,7 @@ const homePageBlock = defineBlock("HomePage", {
56
65
  });
57
66
 
58
67
  function registerBlocks() {
68
+ Object.values(nativeBlocks).forEach((block) => registerBlock(block));
59
69
  registerProjectBlocks();
60
70
  registerBlock(homePageBlock);
61
71
  }
@@ -0,0 +1,6 @@
1
+ import autoprefixer from "autoprefixer";
2
+ import tailwindcss from "tailwindcss";
3
+
4
+ export default {
5
+ plugins: [tailwindcss(), autoprefixer()],
6
+ };
@@ -1,4 +1,6 @@
1
- @import "tailwindcss";
2
1
  @import "@juo/customer-ui/design-tokens.css";
3
2
  @import "@juo/customer-ui/theme-modes.css";
4
- @import "@juo/customer-ui/tailwind-v4.css";
3
+
4
+ @tailwind base;
5
+ @tailwind components;
6
+ @tailwind utilities;
@@ -0,0 +1,15 @@
1
+ /* eslint-disable @typescript-eslint/no-require-imports */
2
+ /** @type {import('tailwindcss').Config} */
3
+ module.exports = {
4
+ presets: [{ theme: { extend: require("@juo/customer-ui/tailwind-v3").theme } }],
5
+ content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx,vue}"],
6
+ theme: {
7
+ extend: {
8
+ colors: {
9
+ primary: "var(--primary)",
10
+ muted: "var(--muted)",
11
+ },
12
+ },
13
+ },
14
+ plugins: [],
15
+ };
@@ -1,35 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import tailwindcss from "@tailwindcss/vite";
3
- import svgr from "vite-plugin-svgr";
4
- import juo from "./vite/juo-editor-plugin";
5
- {% if framework == "react" %}
6
- import react from "@vitejs/plugin-react";
7
- {% elsif framework == "preact" %}
8
- import preact from "@preact/preset-vite";
9
- {% endif %}
10
-
11
- export default defineConfig({
12
- define: {
13
- "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
14
- },
15
- plugins: [tailwindcss(), juo(){% if framework == "react" %}, react(){% endif %}{% if framework == "preact" %}, preact(){% endif %},
16
- svgr({
17
- svgrOptions: {
18
- icon: true,
19
- },
20
- }),
21
- ],
22
- preview: {
23
- cors: true,
24
- },
25
- build: {
26
- lib: {
27
- entry: "src/blocks/register.ts",
28
- formats: ["es"],
29
- fileName: "index",
30
- },
31
- rollupOptions: {
32
- external: [/^@juo\/blocks/],
33
- },
34
- },
35
- });