zion 2.0.5 → 2.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +100 -21
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/app.tsx
4
4
  import { useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
5
- import { Box as Box6, Text as Text8, useApp, useInput as useInput2, useStdout as useStdout2 } from "ink";
5
+ import { Box as Box7, Text as Text10, useApp, useInput as useInput2, useStdout as useStdout2 } from "ink";
6
6
 
7
7
  // src/components/BlogDetailView.tsx
8
8
  import { useEffect } from "react";
@@ -24,7 +24,8 @@ var NAV_LINKS = [
24
24
  var COLORS = {
25
25
  subtle: "gray",
26
26
  text: "white",
27
- selectedBlog: "#006f3c"
27
+ selectedBlog: "#006f3c",
28
+ link: "#5c9fd4"
28
29
  };
29
30
 
30
31
  // src/components/HintBar.tsx
@@ -187,6 +188,9 @@ function loadBlogPostList() {
187
188
  function loadBlogPost(slug) {
188
189
  return fetchJson(`${BASE_URL}/api/posts/${slug}`);
189
190
  }
191
+ function loadPortfolioList() {
192
+ return fetchJson(`${BASE_URL}/api/portfolio`);
193
+ }
190
194
  function formatDate(dateStr) {
191
195
  const date = /* @__PURE__ */ new Date(dateStr + "T00:00:00");
192
196
  return date.toLocaleDateString("en-US", {
@@ -221,7 +225,7 @@ function HomeView({ aboutTitle, aboutContent, contentWidth }) {
221
225
  return /* @__PURE__ */ jsxs4(Fragment3, { children: [
222
226
  /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text5, { bold: true, color: "white", children: aboutTitle }) }),
223
227
  /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Markdown, { width: contentWidth, children: aboutContent }) }),
224
- /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(HintBar, { text: "Hint: b: blog | q, ctrl+c: quit" }) })
228
+ /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(HintBar, { text: "Hint: b: blog | p: portfolio | q, ctrl+c: quit" }) })
225
229
  ] });
226
230
  }
227
231
 
@@ -236,11 +240,50 @@ function NavBar() {
236
240
  ] }, link.name)) });
237
241
  }
238
242
 
243
+ // src/components/PortfolioListView.tsx
244
+ import { Box as Box6, Text as Text8 } from "ink";
245
+ import { ScrollView as ScrollView3 } from "ink-scroll-view";
246
+
247
+ // src/components/ui/Badge.tsx
248
+ import { Text as Text7 } from "ink";
249
+ import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
250
+ function Badge({ color, background, children }) {
251
+ return /* @__PURE__ */ jsxs6(Fragment4, { children: [
252
+ /* @__PURE__ */ jsx7(Text7, { color: background, children: "\uE0B6" }),
253
+ /* @__PURE__ */ jsx7(Text7, { color, backgroundColor: background, bold: true, children }),
254
+ /* @__PURE__ */ jsx7(Text7, { color: background, children: "\uE0B4" })
255
+ ] });
256
+ }
257
+
258
+ // src/components/PortfolioListView.tsx
259
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
260
+ function PortfolioListView({ projects, highlightedIndex, scrollRef, viewportHeight }) {
261
+ return /* @__PURE__ */ jsxs7(Fragment5, { children: [
262
+ /* @__PURE__ */ jsx8(Box6, { marginTop: 1, height: viewportHeight, flexDirection: "column", children: /* @__PURE__ */ jsx8(ScrollView3, { ref: scrollRef, children: projects.map((project, idx) => {
263
+ const isSelected = idx === highlightedIndex;
264
+ const prefix = isSelected ? "\u203A " : " ";
265
+ return /* @__PURE__ */ jsxs7(Box6, { flexDirection: "column", marginBottom: 2, children: [
266
+ /* @__PURE__ */ jsxs7(Box6, { flexDirection: "row", children: [
267
+ /* @__PURE__ */ jsx8(Text8, { bold: isSelected, color: isSelected ? COLORS.selectedBlog : void 0, children: prefix }),
268
+ /* @__PURE__ */ jsx8(Text8, { bold: isSelected, color: isSelected ? COLORS.selectedBlog : COLORS.text, children: project.title })
269
+ ] }),
270
+ /* @__PURE__ */ jsx8(Box6, { marginLeft: 3, paddingBottom: 1, children: /* @__PURE__ */ jsxs7(Text8, { color: COLORS.subtle, children: [
271
+ project.description,
272
+ " "
273
+ ] }) }),
274
+ project.links && project.links.length > 0 && /* @__PURE__ */ jsx8(Box6, { marginLeft: 3, flexDirection: "column", paddingBottom: 1, children: project.links.map((link, linkIdx) => /* @__PURE__ */ jsx8(Text8, { color: COLORS.link, children: link.url }, linkIdx)) }),
275
+ project.tools && project.tools.length > 0 && /* @__PURE__ */ jsx8(Box6, { marginLeft: 3, flexDirection: "row", gap: 1, paddingBottom: 1, children: project.tools.map((tool, toolIdx) => /* @__PURE__ */ jsx8(Box6, { children: /* @__PURE__ */ jsx8(Badge, { color: "white", background: "gray", children: tool }) }, toolIdx)) })
276
+ ] }, idx);
277
+ }) }) }),
278
+ /* @__PURE__ */ jsx8(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx8(HintBar, { text: "Hint: h/j/k: back, down, up | q: quit" }) })
279
+ ] });
280
+ }
281
+
239
282
  // src/components/ui/AnimatedText.tsx
240
283
  import chalk from "chalk";
241
284
  import { useEffect as useEffect2, useState } from "react";
242
- import { Text as Text7 } from "ink";
243
- import { jsx as jsx7 } from "react/jsx-runtime";
285
+ import { Text as Text9 } from "ink";
286
+ import { jsx as jsx9 } from "react/jsx-runtime";
244
287
  function hexToRgb(hex) {
245
288
  const h = hex.replace("#", "");
246
289
  const n = h.length === 3 ? parseInt(h[0] + h[0] + h[1] + h[1] + h[2] + h[2], 16) : parseInt(h, 16);
@@ -396,7 +439,7 @@ function AnimatedText({
396
439
  if (underline) animated = chalk.underline(animated);
397
440
  if (strikethrough) animated = chalk.strikethrough(animated);
398
441
  if (dimColor) animated = chalk.dim(animated);
399
- return /* @__PURE__ */ jsx7(Text7, { children: animated });
442
+ return /* @__PURE__ */ jsx9(Text9, { children: animated });
400
443
  }
401
444
 
402
445
  // src/hooks/useListNavigation.ts
@@ -450,7 +493,7 @@ function useListNavigation({ length, onSelect, isActive }) {
450
493
  }
451
494
 
452
495
  // src/app.tsx
453
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
496
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
454
497
  function App() {
455
498
  const { exit } = useApp();
456
499
  const { stdout } = useStdout2();
@@ -462,6 +505,7 @@ function App() {
462
505
  const [aboutContent, setAboutContent] = useState3("");
463
506
  const [blogPosts, setBlogPosts] = useState3([]);
464
507
  const [currentPost, setCurrentPost] = useState3(null);
508
+ const [portfolioProjects, setPortfolioProjects] = useState3([]);
465
509
  const [loading, setLoading] = useState3("about");
466
510
  const detailScrollRef = useRef2(null);
467
511
  const addError = (key, message) => setErrors((prev) => ({ ...prev, [key]: message }));
@@ -489,6 +533,10 @@ function App() {
489
533
  });
490
534
  }
491
535
  });
536
+ const portfolioList = useListNavigation({
537
+ length: portfolioProjects.length,
538
+ isActive: currentView === "portfolioList"
539
+ });
492
540
  useEffect4(() => {
493
541
  loadAboutContent().then((result) => {
494
542
  setLoading(null);
@@ -504,6 +552,7 @@ function App() {
504
552
  const contentWidth = Math.max(Math.min(Math.floor(columns * 2 / 3), 80), 40);
505
553
  const blogListVPHeight = Math.min(blogPosts.length, Math.min(Math.floor(rows / 2), 20));
506
554
  const blogDetailVPHeight = Math.min(Math.floor(rows / 2), 25);
555
+ const portfolioListVPHeight = Math.min(Math.floor(rows / 2), 20);
507
556
  const visibleErrors = [];
508
557
  if (currentView === "home" && errors.about) visibleErrors.push(errors.about);
509
558
  if (currentView === "blogList") {
@@ -511,6 +560,7 @@ function App() {
511
560
  if (errors.post) visibleErrors.push(errors.post);
512
561
  }
513
562
  if (currentView === "blogDetail" && errors.post) visibleErrors.push(errors.post);
563
+ if (currentView === "portfolioList" && errors.portfolio) visibleErrors.push(errors.portfolio);
514
564
  useInput2((input, key) => {
515
565
  if (input === "q" || key.ctrl && input === "c") {
516
566
  exit();
@@ -533,6 +583,21 @@ function App() {
533
583
  }
534
584
  });
535
585
  }
586
+ } else if (input === "p") {
587
+ setCurrentView("portfolioList");
588
+ portfolioList.reset();
589
+ if (portfolioProjects.length === 0) {
590
+ setLoading("portfolio");
591
+ loadPortfolioList().then((result) => {
592
+ setLoading(null);
593
+ if (result.ok) {
594
+ clearError("portfolio");
595
+ setPortfolioProjects(result.data);
596
+ } else {
597
+ addError("portfolio", result.error);
598
+ }
599
+ });
600
+ }
536
601
  }
537
602
  break;
538
603
  case "blogList":
@@ -540,6 +605,11 @@ function App() {
540
605
  setCurrentView("home");
541
606
  }
542
607
  break;
608
+ case "portfolioList":
609
+ if (input === "h") {
610
+ setCurrentView("home");
611
+ }
612
+ break;
543
613
  case "blogDetail":
544
614
  if (input === "h") {
545
615
  setCurrentView("blogList");
@@ -552,12 +622,12 @@ function App() {
552
622
  break;
553
623
  }
554
624
  });
555
- return /* @__PURE__ */ jsx8(Box6, { width: columns, height: rows, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", width: contentWidth, children: [
556
- /* @__PURE__ */ jsx8(NavBar, {}),
557
- visibleErrors.length > 0 && /* @__PURE__ */ jsx8(Box6, { marginTop: 1, flexDirection: "column", children: visibleErrors.map((err, i) => /* @__PURE__ */ jsx8(Text8, { color: "red", children: err }, i)) }),
558
- loading && /* @__PURE__ */ jsx8(Box6, { paddingY: 2, children: /* @__PURE__ */ jsx8(AnimatedText, { name: "radar", speed: 0.6, children: "Loading" }) }),
559
- currentView === "home" && !loading && /* @__PURE__ */ jsx8(HomeView, { aboutTitle, aboutContent, contentWidth }),
560
- currentView === "blogList" && !loading && /* @__PURE__ */ jsx8(
625
+ return /* @__PURE__ */ jsx10(Box7, { width: columns, height: rows, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs8(Box7, { flexDirection: "column", width: contentWidth, children: [
626
+ /* @__PURE__ */ jsx10(NavBar, {}),
627
+ visibleErrors.length > 0 && /* @__PURE__ */ jsx10(Box7, { marginTop: 1, flexDirection: "column", children: visibleErrors.map((err, i) => /* @__PURE__ */ jsx10(Text10, { color: "red", children: err }, i)) }),
628
+ loading && /* @__PURE__ */ jsx10(Box7, { paddingY: 2, children: /* @__PURE__ */ jsx10(AnimatedText, { name: "radar", speed: 0.6, children: "Loading" }) }),
629
+ currentView === "home" && !loading && /* @__PURE__ */ jsx10(HomeView, { aboutTitle, aboutContent, contentWidth }),
630
+ currentView === "blogList" && !loading && /* @__PURE__ */ jsx10(
561
631
  BlogListView,
562
632
  {
563
633
  posts: blogPosts,
@@ -566,7 +636,7 @@ function App() {
566
636
  viewportHeight: blogListVPHeight
567
637
  }
568
638
  ),
569
- currentView === "blogDetail" && currentPost && /* @__PURE__ */ jsx8(
639
+ currentView === "blogDetail" && currentPost && /* @__PURE__ */ jsx10(
570
640
  BlogDetailView,
571
641
  {
572
642
  post: currentPost,
@@ -574,6 +644,15 @@ function App() {
574
644
  viewportHeight: blogDetailVPHeight,
575
645
  contentWidth
576
646
  }
647
+ ),
648
+ currentView === "portfolioList" && !loading && /* @__PURE__ */ jsx10(
649
+ PortfolioListView,
650
+ {
651
+ projects: portfolioProjects,
652
+ highlightedIndex: portfolioList.highlightedIndex,
653
+ scrollRef: portfolioList.scrollRef,
654
+ viewportHeight: portfolioListVPHeight
655
+ }
577
656
  )
578
657
  ] }) });
579
658
  }
@@ -583,8 +662,8 @@ import { render as inkRender } from "ink";
583
662
 
584
663
  // src/lib/Screen.tsx
585
664
  import { useCallback, useEffect as useEffect5, useState as useState4 } from "react";
586
- import { Box as Box7, useStdout as useStdout3 } from "ink";
587
- import { jsx as jsx9 } from "react/jsx-runtime";
665
+ import { Box as Box8, useStdout as useStdout3 } from "ink";
666
+ import { jsx as jsx11 } from "react/jsx-runtime";
588
667
  function Screen({ children }) {
589
668
  const { stdout } = useStdout3();
590
669
  const getSize = useCallback(() => ({ height: stdout.rows, width: stdout.columns }), [stdout]);
@@ -596,17 +675,17 @@ function Screen({ children }) {
596
675
  stdout.off("resize", onResize);
597
676
  };
598
677
  }, [stdout, getSize]);
599
- return /* @__PURE__ */ jsx9(Box7, { height: size.height, width: size.width, children });
678
+ return /* @__PURE__ */ jsx11(Box8, { height: size.height, width: size.width, children });
600
679
  }
601
680
 
602
681
  // src/lib/render.tsx
603
- import { jsx as jsx10 } from "react/jsx-runtime";
682
+ import { jsx as jsx12 } from "react/jsx-runtime";
604
683
  var ENTER_ALT_BUFFER = "\x1B[?1049h";
605
684
  var EXIT_ALT_BUFFER = "\x1B[?1049l";
606
685
  var CLEAR_SCREEN = "\x1B[2J\x1B[H";
607
686
  function render(node, options) {
608
687
  process.stdout.write(ENTER_ALT_BUFFER + CLEAR_SCREEN);
609
- const element = /* @__PURE__ */ jsx10(Screen, { children: node });
688
+ const element = /* @__PURE__ */ jsx12(Screen, { children: node });
610
689
  const instance = inkRender(element, options);
611
690
  setImmediate(() => instance.rerender(element));
612
691
  const cleanup = () => process.stdout.write(EXIT_ALT_BUFFER);
@@ -627,5 +706,5 @@ function render(node, options) {
627
706
  }
628
707
 
629
708
  // src/cli.tsx
630
- import { jsx as jsx11 } from "react/jsx-runtime";
631
- render(/* @__PURE__ */ jsx11(App, {}));
709
+ import { jsx as jsx13 } from "react/jsx-runtime";
710
+ render(/* @__PURE__ */ jsx13(App, {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zion",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",