@akanjs/cli 0.9.31 → 0.9.32

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/cjs/index.js CHANGED
@@ -3549,6 +3549,7 @@ var import_ink2 = require("ink");
3549
3549
  var import_react2 = __toESM(require("react"), 1);
3550
3550
  var HEADER_HEIGHT = 1;
3551
3551
  var FOOTER_HEIGHT = 5;
3552
+ var OUTER_BORDER_HEIGHT = 2;
3552
3553
  var BORDER_HEIGHT = 2;
3553
3554
  var MultiScrollList = ({ logList, maxLength = 100 }) => {
3554
3555
  const [width, height] = useStdoutDimensions();
@@ -3557,7 +3558,9 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
3557
3558
  const [scrollPos, setScrollPos] = (0, import_react2.useState)(0);
3558
3559
  const [tabIndex, setTabIndex] = (0, import_react2.useState)(0);
3559
3560
  const [isRunning, setIsRunning] = (0, import_react2.useState)(false);
3560
- const [boxHeight, setBoxHeight] = (0, import_react2.useState)(height - HEADER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
3561
+ const [boxHeight, setBoxHeight] = (0, import_react2.useState)(
3562
+ height - HEADER_HEIGHT - OUTER_BORDER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT
3563
+ );
3561
3564
  const getLimitedLogs = (logs) => {
3562
3565
  return logs.length > maxLength ? logs.slice(logs.length - maxLength) : logs;
3563
3566
  };
@@ -3632,14 +3635,14 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
3632
3635
  }
3633
3636
  }, [logList, isRunning, scrollPos, tabIndex, boxHeight, maxLength]);
3634
3637
  (0, import_react2.useEffect)(() => {
3635
- setBoxHeight(height - HEADER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
3638
+ setBoxHeight(height - HEADER_HEIGHT - OUTER_BORDER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
3636
3639
  }, [height]);
3637
3640
  (0, import_react2.useEffect)(() => {
3638
3641
  setLengthMap(new Map(logList.map((log, index) => [index, Math.min(log.logs.length, maxLength)])));
3639
3642
  }, [logList, maxLength]);
3640
- return /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width, height, flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width, height: "80%", flexDirection: "row" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: 30, height: "100%", flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, null, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "List ", tabIndex + 1, "/", logList.length)), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { borderStyle: "round", borderColor: "blackBright", width: "100%", height: "100%", flexDirection: "column" }, logList.map((log, index) => {
3643
+ return /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width, height, borderStyle: "round", borderColor: "blackBright", flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: "100%", height: boxHeight + BORDER_HEIGHT + HEADER_HEIGHT, flexDirection: "row" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: 30, height: "100%", flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, null, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "List ", tabIndex + 1, "/", logList.length)), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { borderStyle: "round", borderColor: "blackBright", width: "100%", height: "100%", flexDirection: "column" }, logList.map((log, index) => {
3641
3644
  return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { color: index === tabIndex ? "green" : "white" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "\u25CF"), "\xA0", log.title.length > 25 ? log.title.slice(0, 25) + "..." : log.title));
3642
- }))), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width, height: boxHeight + 3, flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, logList[tabIndex].title), /* @__PURE__ */ import_react2.default.createElement(
3645
+ }))), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: "100%", height: "100%", flexDirection: "column" }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { height: 1 }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { color: logList[tabIndex].color }, logList[tabIndex].title)), /* @__PURE__ */ import_react2.default.createElement(
3643
3646
  import_ink2.Box,
3644
3647
  {
3645
3648
  borderStyle: isRunning ? "double" : "round",
@@ -3649,11 +3652,11 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
3649
3652
  height: "100%"
3650
3653
  },
3651
3654
  scrollPos > 0 ? /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, focusLog.slice(0, focusLog.length - 1).map((log, index) => {
3652
- return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { key: index }, index, ": ", log));
3655
+ return /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { key: index }, log);
3653
3656
  }), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "Scrolling... +", scrollPos)) : focusLog.map((log, index) => {
3654
- return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { key: index }, index, ": ", log));
3657
+ return /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { key: index }, log);
3655
3658
  })
3656
- ))), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { dimColor: true }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "You can use the following shortcuts:"), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "tab"), " to switch tab.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "up"), " and ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "down"), " to scroll.", " ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "shift"), " to scroll faster.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "space"), " to scroll.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "escape"), " to stop scrolling.")));
3659
+ ))), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Box, { width: "100%", height: FOOTER_HEIGHT }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { dimColor: true }, /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, null, "You can use the following shortcuts:"), /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "tab"), " to switch tab.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "up"), " and ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "down"), " to scroll.", " ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "shift"), " to scroll faster. (x10)", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "space"), " to scroll.", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Newline, null), "* ", /* @__PURE__ */ import_react2.default.createElement(import_ink2.Text, { backgroundColor: "green" }, "escape"), " to stop scrolling.")));
3657
3660
  };
3658
3661
 
3659
3662
  // pkgs/@akanjs/cli/src/application/application.interface.tsx
@@ -5593,6 +5596,8 @@ var ModuleScript = class {
5593
5596
  async createModuleTemplate(sys3, name) {
5594
5597
  const executor = ModuleExecutor.from(sys3, name);
5595
5598
  await this.#runner.createModuleTemplate(executor);
5599
+ const akanConfig = await sys3.getConfig();
5600
+ await sys3.scan({ akanConfig });
5596
5601
  }
5597
5602
  async createModule(sys3, name, description, schemaDescription) {
5598
5603
  const session = new AiSession("createModule", { workspace: sys3.workspace, cacheKey: name });
@@ -26,7 +26,6 @@ function getContent(scanResult, dict) {
26
26
  return {
27
27
  filename: "page.tsx",
28
28
  content: `
29
- import { AiOutlineTeam } from "react-icons/ai";
30
29
  import { Load } from "@akanjs/ui";
31
30
  import { fetch, usePage, ${dict.Model} } from "${dict.appName}/client";
32
31
  import type { CsrConfig } from "@akanjs/client";
@@ -49,7 +48,7 @@ export default function Page({ params }: PageProps) {
49
48
  <div className="container">
50
49
  <div className="flex justify-between m-4 mt-8">
51
50
  <div className="text-xl text-primary flex gap-2 items-center">
52
- <AiOutlineTeam /> {l("shared.updateModel", { model: l("${dict.model}.modelName") })}
51
+ {l("shared.updateModel", { model: l("${dict.model}.modelName") })}
53
52
  </div>
54
53
  </div>
55
54
  <Load.Edit
@@ -29,8 +29,6 @@ function getContent(scanResult, dict) {
29
29
  import { ${dict.Model}, fetch, usePage } from "${dict.appName}/client";
30
30
  import { Link } from "@akanjs/ui";
31
31
  import { Load } from "@akanjs/ui";
32
- import { getSelf } from "@akanjs/client";
33
- import { AiOutlineEdit } from "react-icons/ai";
34
32
  import type { CsrConfig } from "@akanjs/client";
35
33
 
36
34
  interface PageProps {
@@ -52,7 +50,6 @@ export async function generateMetadata({ params }: PageProps) {
52
50
  }
53
51
  export default function Page({ params }: PageProps) {
54
52
  const { l } = usePage();
55
- const self = getSelf({ unauthorize: "/signin" });
56
53
  return (
57
54
  <Load.Page
58
55
  of={Page}
@@ -67,7 +64,6 @@ export default function Page({ params }: PageProps) {
67
64
  ${dict.Model}.Zone.View view={${dict.model}View} />
68
65
  <Link href={\`/${dict.model}/\${${dict.model}.id}/edit\`}>
69
66
  <button className="btn">
70
- <AiOutlineEdit />
71
67
  {l("shared.updateModel", { model: l("${dict.model}.modelName") })}
72
68
  </button>
73
69
  </Link>
@@ -26,15 +26,12 @@ function getContent(scanResult, dict) {
26
26
  return {
27
27
  filename: "page.tsx",
28
28
  content: `
29
- import { AiOutlineTeam } from "react-icons/ai";
30
29
  import { Load } from "@akanjs/ui";
31
30
  import { cnst, fetch, usePage, ${dict.Model} } from "${dict.appName}/client";
32
- import { getSelf } from "@akanjs/client";
33
31
  import type { CsrConfig } from "@akanjs/client";
34
32
 
35
33
  export default function Page() {
36
34
  const { l } = usePage();
37
- const self = getSelf({ unauthorize: "/signin" });
38
35
  return (
39
36
  <Load.Page
40
37
  of={Page}
@@ -46,7 +43,7 @@ export default function Page() {
46
43
  <div className="container">
47
44
  <div className="flex justify-between m-4 mt-8">
48
45
  <div className="text-xl text-primary flex gap-2 items-center">
49
- <AiOutlineTeam /> {l("shared.createModel", { model: l("${dict.model}.modelName") })}
46
+ + {l("shared.createModel", { model: l("${dict.model}.modelName") })}
50
47
  </div>
51
48
  </div>
52
49
  <Load.Edit
@@ -27,14 +27,11 @@ function getContent(scanResult, dict) {
27
27
  filename: "page.tsx",
28
28
  content: `
29
29
  import { ${dict.Model}, fetch, usePage } from "${dict.appName}/client";
30
- import { Link } from "@akanjs/ui";
31
- import { Load } from "@akanjs/ui";
32
- import { getSelf } from "@akanjs/client";
30
+ import { Link, Load } from "@akanjs/ui";
33
31
  import type { CsrConfig } from "@akanjs/client";
34
32
 
35
33
  export default function Page() {
36
34
  const { l } = usePage();
37
- const self = getSelf({ unauthorize: "/signin" });
38
35
  return (
39
36
  <Load.Page
40
37
  of={Page}
@@ -0,0 +1,62 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/crudSinglePage/page.tsx
20
+ var page_exports = {};
21
+ __export(page_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(page_exports);
25
+ function getContent(scanResult, dict) {
26
+ return {
27
+ filename: "page.tsx",
28
+ content: `
29
+ import type { CsrConfig } from "@akanjs/client";
30
+ import { Load, Model } from "@akanjs/ui";
31
+ import { ${dict.Model}, type cnst, fetch, usePage } from "@${dict.appName}/client";
32
+
33
+ export default function Page() {
34
+ const { l } = usePage();
35
+ return (
36
+ <Load.Page
37
+ of={Page}
38
+ loader={async () => {
39
+ const { ${dict.model}InitInPublic } = await fetch.init${dict.Model}InPublic();
40
+ return { ${dict.model}InitInPublic } as const;
41
+ }}
42
+ render={({ ${dict.model}InitInPublic }) => (
43
+ <>
44
+ <div className="animate-fadeIn flex items-center gap-4 px-4 pt-4">
45
+ <div className="text-lg font-bold md:text-4xl">{l("${dict.model}.modelName")}</div>
46
+ <Model.New className="btn btn-ghost" sliceName="${dict.model}InPublic" renderTitle="id">
47
+ <${dict.Model}.Template.General />
48
+ </Model.New>
49
+ </div>
50
+ <${dict.Model}.Zone.Card
51
+ className="animate-fadeIn mt-2 grid w-full grid-cols-1 justify-center gap-4 md:grid-cols-2 xl:grid-cols-3"
52
+ init={${dict.model}InitInPublic}
53
+ />
54
+ </>
55
+ )}
56
+ />
57
+ );
58
+ }
59
+ Page.csrConfig = { transition: "none" } satisfies CsrConfig;
60
+ `
61
+ };
62
+ }
@@ -27,13 +27,14 @@ function getContent(scanResult, dict) {
27
27
  filename: `${dict.Model}.Unit.tsx`,
28
28
  content: `
29
29
  import { ModelProps } from "@akanjs/client";
30
- import { cnst, ${dict.Model} } from "@${dict.sysName}/client";
30
+ import { cnst, usePage } from "@${dict.sysName}/client";
31
31
  import { Link } from "@akanjs/ui";
32
32
 
33
33
  export const Card = ({ ${dict.model}, href }: ModelProps<"${dict.model}", cnst.Light${dict.Model}>) => {
34
+ const { l } = usePage();
34
35
  return (
35
36
  <Link href={href} className="animate-fadeIn w-full h-36 flex rounded-lg shadow-sm hover:shadow-lg duration-300">
36
- <div>{${dict.model}.id}</div>
37
+ <div>{l("${dict.model}.id")}:{${dict.model}.id}</div>
37
38
  </Link>
38
39
  );
39
40
  };
package/esm/index.js CHANGED
@@ -3531,6 +3531,7 @@ import { Box, Newline, Text, useInput } from "ink";
3531
3531
  import React, { useEffect as useEffect2, useState as useState2 } from "react";
3532
3532
  var HEADER_HEIGHT = 1;
3533
3533
  var FOOTER_HEIGHT = 5;
3534
+ var OUTER_BORDER_HEIGHT = 2;
3534
3535
  var BORDER_HEIGHT = 2;
3535
3536
  var MultiScrollList = ({ logList, maxLength = 100 }) => {
3536
3537
  const [width, height] = useStdoutDimensions();
@@ -3539,7 +3540,9 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
3539
3540
  const [scrollPos, setScrollPos] = useState2(0);
3540
3541
  const [tabIndex, setTabIndex] = useState2(0);
3541
3542
  const [isRunning, setIsRunning] = useState2(false);
3542
- const [boxHeight, setBoxHeight] = useState2(height - HEADER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
3543
+ const [boxHeight, setBoxHeight] = useState2(
3544
+ height - HEADER_HEIGHT - OUTER_BORDER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT
3545
+ );
3543
3546
  const getLimitedLogs = (logs) => {
3544
3547
  return logs.length > maxLength ? logs.slice(logs.length - maxLength) : logs;
3545
3548
  };
@@ -3614,14 +3617,14 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
3614
3617
  }
3615
3618
  }, [logList, isRunning, scrollPos, tabIndex, boxHeight, maxLength]);
3616
3619
  useEffect2(() => {
3617
- setBoxHeight(height - HEADER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
3620
+ setBoxHeight(height - HEADER_HEIGHT - OUTER_BORDER_HEIGHT - FOOTER_HEIGHT - BORDER_HEIGHT);
3618
3621
  }, [height]);
3619
3622
  useEffect2(() => {
3620
3623
  setLengthMap(new Map(logList.map((log, index) => [index, Math.min(log.logs.length, maxLength)])));
3621
3624
  }, [logList, maxLength]);
3622
- return /* @__PURE__ */ React.createElement(Box, { width, height, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { width, height: "80%", flexDirection: "row" }, /* @__PURE__ */ React.createElement(Box, { width: 30, height: "100%", flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, null, "List ", tabIndex + 1, "/", logList.length)), /* @__PURE__ */ React.createElement(Box, { borderStyle: "round", borderColor: "blackBright", width: "100%", height: "100%", flexDirection: "column" }, logList.map((log, index) => {
3625
+ return /* @__PURE__ */ React.createElement(Box, { width, height, borderStyle: "round", borderColor: "blackBright", flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { width: "100%", height: boxHeight + BORDER_HEIGHT + HEADER_HEIGHT, flexDirection: "row" }, /* @__PURE__ */ React.createElement(Box, { width: 30, height: "100%", flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, null, "List ", tabIndex + 1, "/", logList.length)), /* @__PURE__ */ React.createElement(Box, { borderStyle: "round", borderColor: "blackBright", width: "100%", height: "100%", flexDirection: "column" }, logList.map((log, index) => {
3623
3626
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Text, { color: index === tabIndex ? "green" : "white" }, /* @__PURE__ */ React.createElement(Text, null, "\u25CF"), "\xA0", log.title.length > 25 ? log.title.slice(0, 25) + "..." : log.title));
3624
- }))), /* @__PURE__ */ React.createElement(Box, { width, height: boxHeight + 3, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, null, logList[tabIndex].title), /* @__PURE__ */ React.createElement(
3627
+ }))), /* @__PURE__ */ React.createElement(Box, { width: "100%", height: "100%", flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { height: 1 }, /* @__PURE__ */ React.createElement(Text, { color: logList[tabIndex].color }, logList[tabIndex].title)), /* @__PURE__ */ React.createElement(
3625
3628
  Box,
3626
3629
  {
3627
3630
  borderStyle: isRunning ? "double" : "round",
@@ -3631,11 +3634,11 @@ var MultiScrollList = ({ logList, maxLength = 100 }) => {
3631
3634
  height: "100%"
3632
3635
  },
3633
3636
  scrollPos > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, focusLog.slice(0, focusLog.length - 1).map((log, index) => {
3634
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Text, { key: index }, index, ": ", log));
3637
+ return /* @__PURE__ */ React.createElement(Text, { key: index }, log);
3635
3638
  }), /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "Scrolling... +", scrollPos)) : focusLog.map((log, index) => {
3636
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Text, { key: index }, index, ": ", log));
3639
+ return /* @__PURE__ */ React.createElement(Text, { key: index }, log);
3637
3640
  })
3638
- ))), /* @__PURE__ */ React.createElement(Box, { width }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, /* @__PURE__ */ React.createElement(Text, null, "You can use the following shortcuts:"), /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "tab"), " to switch tab.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "up"), " and ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "down"), " to scroll.", " ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "shift"), " to scroll faster.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "space"), " to scroll.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "escape"), " to stop scrolling.")));
3641
+ ))), /* @__PURE__ */ React.createElement(Box, { width: "100%", height: FOOTER_HEIGHT }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, /* @__PURE__ */ React.createElement(Text, null, "You can use the following shortcuts:"), /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "tab"), " to switch tab.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "up"), " and ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "down"), " to scroll.", " ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "shift"), " to scroll faster. (x10)", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "space"), " to scroll.", /* @__PURE__ */ React.createElement(Newline, null), "* ", /* @__PURE__ */ React.createElement(Text, { backgroundColor: "green" }, "escape"), " to stop scrolling.")));
3639
3642
  };
3640
3643
 
3641
3644
  // pkgs/@akanjs/cli/src/application/application.interface.tsx
@@ -5575,6 +5578,8 @@ var ModuleScript = class {
5575
5578
  async createModuleTemplate(sys3, name) {
5576
5579
  const executor = ModuleExecutor.from(sys3, name);
5577
5580
  await this.#runner.createModuleTemplate(executor);
5581
+ const akanConfig = await sys3.getConfig();
5582
+ await sys3.scan({ akanConfig });
5578
5583
  }
5579
5584
  async createModule(sys3, name, description, schemaDescription) {
5580
5585
  const session = new AiSession("createModule", { workspace: sys3.workspace, cacheKey: name });
@@ -3,7 +3,6 @@ function getContent(scanResult, dict) {
3
3
  return {
4
4
  filename: "page.tsx",
5
5
  content: `
6
- import { AiOutlineTeam } from "react-icons/ai";
7
6
  import { Load } from "@akanjs/ui";
8
7
  import { fetch, usePage, ${dict.Model} } from "${dict.appName}/client";
9
8
  import type { CsrConfig } from "@akanjs/client";
@@ -26,7 +25,7 @@ export default function Page({ params }: PageProps) {
26
25
  <div className="container">
27
26
  <div className="flex justify-between m-4 mt-8">
28
27
  <div className="text-xl text-primary flex gap-2 items-center">
29
- <AiOutlineTeam /> {l("shared.updateModel", { model: l("${dict.model}.modelName") })}
28
+ {l("shared.updateModel", { model: l("${dict.model}.modelName") })}
30
29
  </div>
31
30
  </div>
32
31
  <Load.Edit
@@ -6,8 +6,6 @@ function getContent(scanResult, dict) {
6
6
  import { ${dict.Model}, fetch, usePage } from "${dict.appName}/client";
7
7
  import { Link } from "@akanjs/ui";
8
8
  import { Load } from "@akanjs/ui";
9
- import { getSelf } from "@akanjs/client";
10
- import { AiOutlineEdit } from "react-icons/ai";
11
9
  import type { CsrConfig } from "@akanjs/client";
12
10
 
13
11
  interface PageProps {
@@ -29,7 +27,6 @@ export async function generateMetadata({ params }: PageProps) {
29
27
  }
30
28
  export default function Page({ params }: PageProps) {
31
29
  const { l } = usePage();
32
- const self = getSelf({ unauthorize: "/signin" });
33
30
  return (
34
31
  <Load.Page
35
32
  of={Page}
@@ -44,7 +41,6 @@ export default function Page({ params }: PageProps) {
44
41
  ${dict.Model}.Zone.View view={${dict.model}View} />
45
42
  <Link href={\`/${dict.model}/\${${dict.model}.id}/edit\`}>
46
43
  <button className="btn">
47
- <AiOutlineEdit />
48
44
  {l("shared.updateModel", { model: l("${dict.model}.modelName") })}
49
45
  </button>
50
46
  </Link>
@@ -3,15 +3,12 @@ function getContent(scanResult, dict) {
3
3
  return {
4
4
  filename: "page.tsx",
5
5
  content: `
6
- import { AiOutlineTeam } from "react-icons/ai";
7
6
  import { Load } from "@akanjs/ui";
8
7
  import { cnst, fetch, usePage, ${dict.Model} } from "${dict.appName}/client";
9
- import { getSelf } from "@akanjs/client";
10
8
  import type { CsrConfig } from "@akanjs/client";
11
9
 
12
10
  export default function Page() {
13
11
  const { l } = usePage();
14
- const self = getSelf({ unauthorize: "/signin" });
15
12
  return (
16
13
  <Load.Page
17
14
  of={Page}
@@ -23,7 +20,7 @@ export default function Page() {
23
20
  <div className="container">
24
21
  <div className="flex justify-between m-4 mt-8">
25
22
  <div className="text-xl text-primary flex gap-2 items-center">
26
- <AiOutlineTeam /> {l("shared.createModel", { model: l("${dict.model}.modelName") })}
23
+ + {l("shared.createModel", { model: l("${dict.model}.modelName") })}
27
24
  </div>
28
25
  </div>
29
26
  <Load.Edit
@@ -4,14 +4,11 @@ function getContent(scanResult, dict) {
4
4
  filename: "page.tsx",
5
5
  content: `
6
6
  import { ${dict.Model}, fetch, usePage } from "${dict.appName}/client";
7
- import { Link } from "@akanjs/ui";
8
- import { Load } from "@akanjs/ui";
9
- import { getSelf } from "@akanjs/client";
7
+ import { Link, Load } from "@akanjs/ui";
10
8
  import type { CsrConfig } from "@akanjs/client";
11
9
 
12
10
  export default function Page() {
13
11
  const { l } = usePage();
14
- const self = getSelf({ unauthorize: "/signin" });
15
12
  return (
16
13
  <Load.Page
17
14
  of={Page}
@@ -0,0 +1,42 @@
1
+ // pkgs/@akanjs/cli/src/templates/crudSinglePage/page.tsx
2
+ function getContent(scanResult, dict) {
3
+ return {
4
+ filename: "page.tsx",
5
+ content: `
6
+ import type { CsrConfig } from "@akanjs/client";
7
+ import { Load, Model } from "@akanjs/ui";
8
+ import { ${dict.Model}, type cnst, fetch, usePage } from "@${dict.appName}/client";
9
+
10
+ export default function Page() {
11
+ const { l } = usePage();
12
+ return (
13
+ <Load.Page
14
+ of={Page}
15
+ loader={async () => {
16
+ const { ${dict.model}InitInPublic } = await fetch.init${dict.Model}InPublic();
17
+ return { ${dict.model}InitInPublic } as const;
18
+ }}
19
+ render={({ ${dict.model}InitInPublic }) => (
20
+ <>
21
+ <div className="animate-fadeIn flex items-center gap-4 px-4 pt-4">
22
+ <div className="text-lg font-bold md:text-4xl">{l("${dict.model}.modelName")}</div>
23
+ <Model.New className="btn btn-ghost" sliceName="${dict.model}InPublic" renderTitle="id">
24
+ <${dict.Model}.Template.General />
25
+ </Model.New>
26
+ </div>
27
+ <${dict.Model}.Zone.Card
28
+ className="animate-fadeIn mt-2 grid w-full grid-cols-1 justify-center gap-4 md:grid-cols-2 xl:grid-cols-3"
29
+ init={${dict.model}InitInPublic}
30
+ />
31
+ </>
32
+ )}
33
+ />
34
+ );
35
+ }
36
+ Page.csrConfig = { transition: "none" } satisfies CsrConfig;
37
+ `
38
+ };
39
+ }
40
+ export {
41
+ getContent as default
42
+ };
@@ -4,13 +4,14 @@ function getContent(scanResult, dict) {
4
4
  filename: `${dict.Model}.Unit.tsx`,
5
5
  content: `
6
6
  import { ModelProps } from "@akanjs/client";
7
- import { cnst, ${dict.Model} } from "@${dict.sysName}/client";
7
+ import { cnst, usePage } from "@${dict.sysName}/client";
8
8
  import { Link } from "@akanjs/ui";
9
9
 
10
10
  export const Card = ({ ${dict.model}, href }: ModelProps<"${dict.model}", cnst.Light${dict.Model}>) => {
11
+ const { l } = usePage();
11
12
  return (
12
13
  <Link href={href} className="animate-fadeIn w-full h-36 flex rounded-lg shadow-sm hover:shadow-lg duration-300">
13
- <div>{${dict.model}.id}</div>
14
+ <div>{l("${dict.model}.id")}:{${dict.model}.id}</div>
14
15
  </Link>
15
16
  );
16
17
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "sourceType": "module",
4
4
  "name": "@akanjs/cli",
5
- "version": "0.9.31",
5
+ "version": "0.9.32",
6
6
  "bin": {
7
7
  "akan": "esm/index.js"
8
8
  },
@@ -0,0 +1,11 @@
1
+ import type { AppScanResult, LibScanResult } from "@akanjs/config";
2
+ interface Dict {
3
+ Model: string;
4
+ model: string;
5
+ appName: string;
6
+ }
7
+ export default function getContent(scanResult: AppScanResult | LibScanResult | null, dict: Dict): {
8
+ filename: string;
9
+ content: string;
10
+ };
11
+ export {};