@lemonriver/core 1.1.0 → 1.2.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 (92) hide show
  1. package/dist/{build-Dm7gVRhb.js → build-CSkdswfd.js} +1 -1
  2. package/dist/cli/bin.js +5 -5
  3. package/dist/{config-CubOIzrs.js → config-C5-myPY6.js} +129 -2
  4. package/dist/{dev-DgLeXPqp.js → dev-DHtYH8sw.js} +2 -2
  5. package/dist/{mcp-CjYDzcJa.js → mcp-B2UeO1un.js} +1 -1
  6. package/dist/{preview-CxXQpPk5.js → preview-C1B6-umF.js} +1 -1
  7. package/dist/{update-b1dSg_FW.js → update-DzL8fpcI.js} +1 -1
  8. package/dist/vite/index.js +1 -1
  9. package/package.json +5 -2
  10. package/release-notes.json +19 -0
  11. package/src/app/lemonriver/chrome/app-chrome.tsx +52 -0
  12. package/src/app/lemonriver/chrome/sidebar-extras.tsx +8 -1
  13. package/src/app/lemonriver/feedback/dialog.tsx +222 -0
  14. package/src/app/lemonriver/feedback/export.ts +21 -2
  15. package/src/app/lemonriver/feedback/first-success.ts +30 -0
  16. package/src/app/lemonriver/feedback/install.ts +18 -0
  17. package/src/app/lemonriver/feedback/model.ts +88 -0
  18. package/src/app/lemonriver/help/help-page.tsx +16 -1
  19. package/src/app/lemonriver/links.ts +16 -0
  20. package/src/app/lemonriver/settings/backup-section.tsx +13 -0
  21. package/src/app/lemonriver/settings/settings-page.tsx +20 -0
  22. package/src/app/lemonriver/share/editor-share.tsx +6 -3
  23. package/src/app/lemonriver/share/share-dialog.tsx +2 -0
  24. package/src/app/lemonriver/text/en.ts +45 -0
  25. package/src/app/lemonriver/text/es.ts +42 -0
  26. package/src/app/lemonriver/text/ja.ts +41 -0
  27. package/src/app/lemonriver/text/types.ts +44 -0
  28. package/src/app/lemonriver/text/zh-cn.ts +45 -0
  29. package/src/app/lemonriver/text/zh-tw.ts +45 -0
  30. package/src/app/lemonriver/theme/pages.ts +4 -0
  31. package/src/app/lemonriver/update/release-notes.ts +22 -0
  32. package/src/app/lemonriver/update/update-prompt.tsx +28 -4
  33. package/src/app/components/note-markdown.test.tsx +0 -42
  34. package/src/app/components/thumbnail-rail-scroll.test.ts +0 -60
  35. package/src/app/lemonriver/agent-prefs/prefs.test.ts +0 -173
  36. package/src/app/lemonriver/backup/guide.test.ts +0 -45
  37. package/src/app/lemonriver/backup/model.test.ts +0 -108
  38. package/src/app/lemonriver/backup/places.test.ts +0 -154
  39. package/src/app/lemonriver/board/blocks/classify.test.ts +0 -209
  40. package/src/app/lemonriver/board/layout.test.ts +0 -245
  41. package/src/app/lemonriver/board/model/agent-tasks.test.ts +0 -200
  42. package/src/app/lemonriver/board/model/apply-prompt.test.ts +0 -121
  43. package/src/app/lemonriver/board/model/cards.test.ts +0 -332
  44. package/src/app/lemonriver/board/model/changes.test.ts +0 -244
  45. package/src/app/lemonriver/board/model/filter.test.ts +0 -50
  46. package/src/app/lemonriver/board/model/history.test.ts +0 -71
  47. package/src/app/lemonriver/board/model/restructure.test.ts +0 -205
  48. package/src/app/lemonriver/board/model/self-check.test.ts +0 -329
  49. package/src/app/lemonriver/board/model/structure.test.ts +0 -350
  50. package/src/app/lemonriver/board/model/timing.test.ts +0 -113
  51. package/src/app/lemonriver/features.test.ts +0 -49
  52. package/src/app/lemonriver/feedback/pending-toast.test.ts +0 -44
  53. package/src/app/lemonriver/feedback/upload.test.ts +0 -26
  54. package/src/app/lemonriver/help/model.test.ts +0 -179
  55. package/src/app/lemonriver/home/brief.test.ts +0 -38
  56. package/src/app/lemonriver/home/drafts.test.ts +0 -23
  57. package/src/app/lemonriver/home/sorting.test.ts +0 -24
  58. package/src/app/lemonriver/home/time.test.ts +0 -33
  59. package/src/app/lemonriver/outline/files.test.ts +0 -90
  60. package/src/app/lemonriver/outline/model.test.ts +0 -751
  61. package/src/app/lemonriver/public-links.test.ts +0 -32
  62. package/src/app/lemonriver/routes.test.tsx +0 -54
  63. package/src/app/lemonriver/share/codes.test.ts +0 -49
  64. package/src/app/lemonriver/share/compare.test.ts +0 -199
  65. package/src/app/lemonriver/share/folder.test.ts +0 -42
  66. package/src/app/lemonriver/share/guide.test.ts +0 -78
  67. package/src/app/lemonriver/share/naming.test.ts +0 -70
  68. package/src/app/lemonriver/share/paths.test.ts +0 -116
  69. package/src/app/lemonriver/share/pdf.test.ts +0 -79
  70. package/src/app/lemonriver/templates/knobs.test.ts +0 -62
  71. package/src/app/lemonriver/templates/model.test.ts +0 -175
  72. package/src/app/lemonriver/templates/preview-content.test.ts +0 -117
  73. package/src/app/lemonriver/templates/recommend.test.ts +0 -71
  74. package/src/app/lemonriver/text/text.test.ts +0 -90
  75. package/src/app/lemonriver/theme/pages.test.ts +0 -74
  76. package/src/app/lemonriver/theme/themes.test.ts +0 -18
  77. package/src/app/lemonriver/trash/api.test.ts +0 -19
  78. package/src/app/lemonriver/update/prompt.test.ts +0 -84
  79. package/src/app/lemonriver/update/version.test.ts +0 -14
  80. package/src/app/lib/asset-filter.test.ts +0 -176
  81. package/src/app/lib/inspector/fiber.test.ts +0 -154
  82. package/src/app/lib/inspector/geometry.test.ts +0 -324
  83. package/src/app/lib/inspector/text-edit-timeline.test.ts +0 -121
  84. package/src/app/lib/note-markdown.test.ts +0 -147
  85. package/src/app/lib/pptx/css.test.ts +0 -205
  86. package/src/app/lib/pptx/ooxml.test.ts +0 -199
  87. package/src/app/lib/pptx/text-lines.test.ts +0 -82
  88. package/src/app/lib/print-ready.test.ts +0 -32
  89. package/src/app/lib/sdk.test.ts +0 -13
  90. package/src/app/lib/transition.test.ts +0 -31
  91. package/src/app/lib/use-document-title.test.ts +0 -14
  92. package/src/app/lib/utils.test.ts +0 -49
@@ -1,5 +1,5 @@
1
1
  import { r as printHeader, t as createCliLogger } from "./cli/bin.js";
2
- import { t as createViteConfig } from "./config-CubOIzrs.js";
2
+ import { t as createViteConfig } from "./config-C5-myPY6.js";
3
3
  import path from "node:path";
4
4
  import { build as build$1, mergeConfig } from "vite";
5
5
  //#region src/cli/build.ts
package/dist/cli/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { H as isFrameworkSpecifier, t as detectPackageManager, z as BIN_NAME } from "../update-b1dSg_FW.js";
2
+ import { B as BIN_NAME, U as isFrameworkSpecifier, t as detectPackageManager } from "../update-DzL8fpcI.js";
3
3
  import path from "node:path";
4
4
  import * as readline from "node:readline/promises";
5
5
  import { fileURLToPath } from "node:url";
@@ -449,21 +449,21 @@ async function run(argv) {
449
449
  program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").action(async (flags) => {
450
450
  if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
451
451
  await assertViteResolvesToCore();
452
- const { dev } = await import("../dev-DgLeXPqp.js");
452
+ const { dev } = await import("../dev-DHtYH8sw.js");
453
453
  await dev(flags);
454
454
  });
455
455
  program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
456
456
  await assertViteResolvesToCore();
457
- const { build } = await import("../build-Dm7gVRhb.js");
457
+ const { build } = await import("../build-CSkdswfd.js");
458
458
  await build(flags);
459
459
  });
460
460
  program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
461
461
  await assertViteResolvesToCore();
462
- const { preview } = await import("../preview-CxXQpPk5.js");
462
+ const { preview } = await import("../preview-C1B6-umF.js");
463
463
  await preview(flags);
464
464
  });
465
465
  program.command("mcp").description("Run the LemonRiver MCP server over stdio, for the agent working in this folder").action(async () => {
466
- const { runMcp } = await import("../mcp-CjYDzcJa.js");
466
+ const { runMcp } = await import("../mcp-B2UeO1un.js");
467
467
  await runMcp(process.cwd(), {
468
468
  input: process.stdin,
469
469
  output: process.stdout
@@ -1,5 +1,5 @@
1
1
  import { n as defaultDesign } from "./design-Cpqx7SJs.js";
2
- import { A as reorderNotesArrayInSource, B as CONFIG_FILES, C as duplicatePageInDefaultExportInSource, D as removePageFromDefaultExportInSource, E as removeNotesElementInSource, F as validateSlideName, H as isFrameworkSpecifier, I as declaredFrameworkSpecifier, L as isLoopbackRequest, M as rmSlideDir, N as slugifyTitle, O as renameSlideDir, P as updateMetaTitleInSource, R as validateMutationRequest, S as duplicateNotesElementInSource, T as readMetaTitleInSource, _ as writeManifest, a as json, b as SLIDE_ID_RE, c as readSlideSource, d as foldersManifestPath, f as newFolderId, g as validateReorder, h as validateName, i as BodyTooLargeError, j as resolveSlideEntry, k as reorderDefaultExportPagesInSource, l as resolveSlideEntryPath, m as validateIcon, n as registerUpdateRoutes, o as makeContext, p as readManifest, r as runCommand, s as readBody, t as detectPackageManager, u as FOLDER_ID_RE, v as shortId, w as duplicateSlideDir, x as createBlankSlideDir } from "./update-b1dSg_FW.js";
2
+ import { A as reorderNotesArrayInSource, C as duplicatePageInDefaultExportInSource, D as removePageFromDefaultExportInSource, E as removeNotesElementInSource, F as validateSlideName, I as declaredFrameworkSpecifier, L as readFrameworkDependency, M as rmSlideDir, N as slugifyTitle, O as renameSlideDir, P as updateMetaTitleInSource, R as isLoopbackRequest, S as duplicateNotesElementInSource, T as readMetaTitleInSource, U as isFrameworkSpecifier, V as CONFIG_FILES, _ as writeManifest, a as json, b as SLIDE_ID_RE, c as readSlideSource, d as foldersManifestPath, f as newFolderId, g as validateReorder, h as validateName, i as BodyTooLargeError, j as resolveSlideEntry, k as reorderDefaultExportPagesInSource, l as resolveSlideEntryPath, m as validateIcon, n as registerUpdateRoutes, o as makeContext, p as readManifest, r as runCommand, s as readBody, t as detectPackageManager, u as FOLDER_ID_RE, v as shortId, w as duplicateSlideDir, x as createBlankSlideDir, z as validateMutationRequest } from "./update-DzL8fpcI.js";
3
3
  import { n as readServerInfo } from "./client-DpO_eR9X.js";
4
4
  import { createRequire } from "node:module";
5
5
  import path from "node:path";
@@ -7758,6 +7758,88 @@ function registerOutlineRoutes(server, ctx) {
7758
7758
  });
7759
7759
  }
7760
7760
  //#endregion
7761
+ //#region src/lemonriver/release-notes/notes.ts
7762
+ function notesFileIn(workspaceCwd, pkg) {
7763
+ return path.join(workspaceCwd, "node_modules", pkg, "release-notes.json");
7764
+ }
7765
+ function versionFileIn(workspaceCwd, pkg) {
7766
+ return path.join(workspaceCwd, "node_modules", pkg, "package.json");
7767
+ }
7768
+ /**
7769
+ * The copy an update just installed. Reading the running package instead would
7770
+ * describe the version the user has just left. An alias installs under the name
7771
+ * the workspace declared, so that key, not the package's own name, is the path.
7772
+ */
7773
+ function installedNotesFile(workspaceCwd, pkg) {
7774
+ return notesFileIn(workspaceCwd, pkg);
7775
+ }
7776
+ function installedNotesFileFor(workspaceCwd) {
7777
+ return installedNotesFile(workspaceCwd, readFrameworkDependency(workspaceCwd).key);
7778
+ }
7779
+ function installedVersionFileFor(workspaceCwd) {
7780
+ return versionFileIn(workspaceCwd, readFrameworkDependency(workspaceCwd).key);
7781
+ }
7782
+ function localeKeyFor(id) {
7783
+ return id === "zh-CN" || id === "zh-TW" ? id : "en";
7784
+ }
7785
+ function stringList(raw) {
7786
+ if (!Array.isArray(raw) || raw.length === 0) return null;
7787
+ const out = raw.filter((item) => typeof item === "string" && item.trim() !== "");
7788
+ return out.length > 0 ? out : null;
7789
+ }
7790
+ function sanitizeNotes(raw) {
7791
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return {};
7792
+ const out = {};
7793
+ for (const [version, byLocale] of Object.entries(raw)) {
7794
+ if (typeof byLocale !== "object" || byLocale === null || Array.isArray(byLocale)) continue;
7795
+ const entry = {};
7796
+ for (const locale of [
7797
+ "zh-CN",
7798
+ "zh-TW",
7799
+ "en"
7800
+ ]) {
7801
+ const list = stringList(byLocale[locale]);
7802
+ if (list) entry[locale] = list;
7803
+ }
7804
+ if (Object.keys(entry).length > 0) out[version] = entry;
7805
+ }
7806
+ return out;
7807
+ }
7808
+ /** The notes for one installed version, in the reader's language; ja and es read English. */
7809
+ async function readReleaseNotes(file, version, locale) {
7810
+ try {
7811
+ const entry = sanitizeNotes(JSON.parse(await fs$1.readFile(file, "utf8")))[version];
7812
+ if (!entry) return null;
7813
+ return entry[localeKeyFor(locale)] ?? entry.en ?? null;
7814
+ } catch {
7815
+ return null;
7816
+ }
7817
+ }
7818
+ async function readInstalledVersion(file) {
7819
+ try {
7820
+ const body = JSON.parse(await fs$1.readFile(file, "utf8"));
7821
+ return typeof body.version === "string" && body.version !== "" ? body.version : null;
7822
+ } catch {
7823
+ return null;
7824
+ }
7825
+ }
7826
+ //#endregion
7827
+ //#region src/lemonriver/release-notes/routes.ts
7828
+ function registerReleaseNotesRoutes(server, ctx) {
7829
+ server.middlewares.use("/__lr/release-notes", async (req, res, next) => {
7830
+ if ((req.method ?? "GET") !== "GET") return next();
7831
+ if (!isLoopbackRequest(req)) return json(res, 403, { error: "local requests only" });
7832
+ const locale = new URL(req.url ?? "/", "http://local").searchParams.get("locale") ?? "en";
7833
+ const version = await readInstalledVersion(installedVersionFileFor(ctx.userCwd));
7834
+ const notes = version ? await readReleaseNotes(installedNotesFileFor(ctx.userCwd), version, locale) : null;
7835
+ res.setHeader("cache-control", "no-store");
7836
+ return json(res, 200, notes ? {
7837
+ version,
7838
+ notes
7839
+ } : { notes: null });
7840
+ });
7841
+ }
7842
+ //#endregion
7761
7843
  //#region src/app/lemonriver/share/compare.ts
7762
7844
  const ENTRY_NAMES$1 = [
7763
7845
  "index.tsx",
@@ -8653,6 +8735,45 @@ function registerTemplateRoutes(server, ctx) {
8653
8735
  }));
8654
8736
  }
8655
8737
  //#endregion
8738
+ //#region src/lemonriver/feedback/install.ts
8739
+ const SHELLS = /^(?:zsh|bash|sh|fish|pwsh|powershell|node|npm|pnpm|yarn|bun)$/;
8740
+ /**
8741
+ * Installed app when the workspace is the one the installer creates and the
8742
+ * launch came from the app bundle; command line when a shell or package runner
8743
+ * started it. Anything else is unknown rather than a guess.
8744
+ */
8745
+ function installKindFor(workspace, parentCommand, home = os.homedir()) {
8746
+ if (path.resolve(workspace) !== path.join(home, "LemonRiver")) return "unknown";
8747
+ if (/LemonRiver\.app/i.test(parentCommand)) return "app";
8748
+ const program = path.basename(parentCommand.trim().split(/\s+/)[0] ?? "").replace(/^-/, "");
8749
+ if (SHELLS.test(program)) return "cli";
8750
+ return "unknown";
8751
+ }
8752
+ function parentCommandOf(pid) {
8753
+ return new Promise((resolve) => {
8754
+ execFile("ps", [
8755
+ "-o",
8756
+ "command=",
8757
+ "-p",
8758
+ String(pid)
8759
+ ], (err, stdout) => resolve(err ? "" : stdout.trim()));
8760
+ });
8761
+ }
8762
+ async function detectInstallKind(workspace) {
8763
+ return installKindFor(workspace, await parentCommandOf(process.ppid));
8764
+ }
8765
+ /** The macOS version exactly as `sw_vers` prints it, or null when there is none. */
8766
+ function macVersionFrom(stdout) {
8767
+ const version = stdout.trim();
8768
+ return /^\d+(?:\.\d+)*$/.test(version) ? version : null;
8769
+ }
8770
+ async function detectMacOsVersion() {
8771
+ if (process.platform !== "darwin") return null;
8772
+ return await new Promise((resolve) => {
8773
+ execFile("sw_vers", ["-productVersion"], (err, stdout) => resolve(err ? null : macVersionFrom(stdout)));
8774
+ });
8775
+ }
8776
+ //#endregion
8656
8777
  //#region src/lemonriver/workspace/routes.ts
8657
8778
  function revealFolder(target) {
8658
8779
  const command = process.platform === "darwin" ? "open" : "xdg-open";
@@ -8665,7 +8786,12 @@ function registerWorkspaceRoutes(server, ctx) {
8665
8786
  const method = req.method ?? "GET";
8666
8787
  if (pathname === "/" || pathname === "") {
8667
8788
  if (method !== "GET") return next();
8668
- return json(res, 200, { path: ctx.userCwd });
8789
+ Promise.all([detectInstallKind(ctx.userCwd), detectMacOsVersion()]).then(([install, os]) => json(res, 200, {
8790
+ path: ctx.userCwd,
8791
+ install,
8792
+ os
8793
+ }));
8794
+ return;
8669
8795
  }
8670
8796
  if (pathname === "/reveal") {
8671
8797
  if (method !== "POST") return next();
@@ -8684,6 +8810,7 @@ function registerLemonRiverRoutes(server, ctx) {
8684
8810
  registerOutlineRoutes(server, ctx);
8685
8811
  registerTemplateRoutes(server, ctx);
8686
8812
  registerShareRoutes(server, ctx);
8813
+ registerReleaseNotesRoutes(server, ctx);
8687
8814
  registerBackupRoutes(server, ctx);
8688
8815
  registerGuideRoutes(server, ctx);
8689
8816
  registerAgentProviderRoutes(server, ctx);
@@ -1,6 +1,6 @@
1
- import { V as PKG_NAMES } from "./update-b1dSg_FW.js";
1
+ import { H as PKG_NAMES } from "./update-DzL8fpcI.js";
2
2
  import { a as printUrls, c as startupDuration, i as printShortcutsHint, n as formatError, r as printHeader, s as shortcutsEnabled, t as createCliLogger } from "./cli/bin.js";
3
- import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-CubOIzrs.js";
3
+ import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-C5-myPY6.js";
4
4
  import path from "node:path";
5
5
  import { existsSync } from "node:fs";
6
6
  import { fork } from "node:child_process";
@@ -1,4 +1,4 @@
1
- import { b as SLIDE_ID_RE } from "./update-b1dSg_FW.js";
1
+ import { b as SLIDE_ID_RE } from "./update-DzL8fpcI.js";
2
2
  import { o as readVersion } from "./cli/bin.js";
3
3
  import { t as callDevServer } from "./client-DpO_eR9X.js";
4
4
  import { createInterface } from "node:readline";
@@ -1,5 +1,5 @@
1
1
  import { a as printUrls, c as startupDuration, i as printShortcutsHint, r as printHeader, s as shortcutsEnabled, t as createCliLogger } from "./cli/bin.js";
2
- import { t as createViteConfig } from "./config-CubOIzrs.js";
2
+ import { t as createViteConfig } from "./config-C5-myPY6.js";
3
3
  import { mergeConfig, preview as preview$1 } from "vite";
4
4
  //#region src/cli/preview.ts
5
5
  async function preview(opts = {}) {
@@ -1097,4 +1097,4 @@ function registerUpdateRoutes(server, ctx) {
1097
1097
  });
1098
1098
  }
1099
1099
  //#endregion
1100
- export { reorderNotesArrayInSource as A, CONFIG_FILES as B, duplicatePageInDefaultExportInSource as C, removePageFromDefaultExportInSource as D, removeNotesElementInSource as E, validateSlideName as F, isFrameworkSpecifier as H, declaredFrameworkSpecifier as I, isLoopbackRequest as L, rmSlideDir as M, slugifyTitle as N, renameSlideDir as O, updateMetaTitleInSource as P, validateMutationRequest as R, duplicateNotesElementInSource as S, readMetaTitleInSource as T, PKG_NAMES as V, writeManifest as _, json as a, SLIDE_ID_RE as b, readSlideSource as c, foldersManifestPath as d, newFolderId as f, validateReorder as g, validateName as h, BodyTooLargeError as i, resolveSlideEntry as j, reorderDefaultExportPagesInSource as k, resolveSlideEntryPath as l, validateIcon as m, registerUpdateRoutes as n, makeContext as o, readManifest as p, runCommand as r, readBody as s, detectPackageManager as t, FOLDER_ID_RE as u, shortId as v, duplicateSlideDir as w, createBlankSlideDir as x, BLANK_SLIDE_TITLE as y, BIN_NAME as z };
1100
+ export { reorderNotesArrayInSource as A, BIN_NAME as B, duplicatePageInDefaultExportInSource as C, removePageFromDefaultExportInSource as D, removeNotesElementInSource as E, validateSlideName as F, PKG_NAMES as H, declaredFrameworkSpecifier as I, readFrameworkDependency as L, rmSlideDir as M, slugifyTitle as N, renameSlideDir as O, updateMetaTitleInSource as P, isLoopbackRequest as R, duplicateNotesElementInSource as S, readMetaTitleInSource as T, isFrameworkSpecifier as U, CONFIG_FILES as V, writeManifest as _, json as a, SLIDE_ID_RE as b, readSlideSource as c, foldersManifestPath as d, newFolderId as f, validateReorder as g, validateName as h, BodyTooLargeError as i, resolveSlideEntry as j, reorderDefaultExportPagesInSource as k, resolveSlideEntryPath as l, validateIcon as m, registerUpdateRoutes as n, makeContext as o, readManifest as p, runCommand as r, readBody as s, detectPackageManager as t, FOLDER_ID_RE as u, shortId as v, duplicateSlideDir as w, createBlankSlideDir as x, BLANK_SLIDE_TITLE as y, validateMutationRequest as z };
@@ -1,2 +1,2 @@
1
- import { t as createViteConfig } from "../config-CubOIzrs.js";
1
+ import { t as createViteConfig } from "../config-C5-myPY6.js";
2
2
  export { createViteConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemonriver/core",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "The LemonRiver runtime: deck viewer, story board, present mode, agent panel and export.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -28,7 +28,7 @@
28
28
  "bin.js",
29
29
  "dist",
30
30
  "env.d.ts",
31
- "src/app",
31
+ "src/app/**/*.*",
32
32
  "src/locale",
33
33
  "src/agent/prompt.ts",
34
34
  "src/agent/provider.ts",
@@ -36,7 +36,10 @@
36
36
  "src/editing/placeholder-id.ts",
37
37
  "!src/**/*.test.ts",
38
38
  "!src/**/*.test.tsx",
39
+ "!src/**/__tests__/**",
40
+ "!src/**/__fixtures__/**",
39
41
  "skills",
42
+ "release-notes.json",
40
43
  "README.md"
41
44
  ],
42
45
  "engines": {
@@ -0,0 +1,19 @@
1
+ {
2
+ "1.2.0": {
3
+ "zh-CN": [
4
+ "侧栏多了「反馈」,可以填问卷或发邮件告诉我们遇到的问题和想要的功能。",
5
+ "编辑页右上角的「分享」按钮改成和旁边按钮一样的样式。",
6
+ "更新完成后,这里会告诉你新版本改了什么。"
7
+ ],
8
+ "zh-TW": [
9
+ "側欄多了「回饋」,可以填問卷或寄郵件告訴我們遇到的問題和想要的功能。",
10
+ "編輯頁右上角的「分享」按鈕改成和旁邊按鈕一樣的樣式。",
11
+ "更新完成後,這裡會告訴你新版本改了什麼。"
12
+ ],
13
+ "en": [
14
+ "A new Feedback entry in the sidebar lets you tell us about problems and ideas by form or email.",
15
+ "The Share button in the editor now looks like the buttons beside it.",
16
+ "After an update, this notice tells you what the new version changed."
17
+ ]
18
+ }
19
+ }
@@ -2,6 +2,13 @@ import { useEffect } from 'react';
2
2
  import { useLocation, useNavigate } from 'react-router-dom';
3
3
  import { toast } from 'sonner';
4
4
  import { format } from '@/lib/use-locale';
5
+ import { FeedbackHost, openFeedback } from '../feedback/dialog';
6
+ import {
7
+ feedbackAsked,
8
+ markFeedbackAsked,
9
+ noteSuccess,
10
+ onFirstSuccess,
11
+ } from '../feedback/first-success';
5
12
  import { OfflineBanner } from '../feedback/offline-banner';
6
13
  import { takePendingToast } from '../feedback/pending-toast';
7
14
  import { Toaster } from '../feedback/toaster';
@@ -94,6 +101,49 @@ function useMcpResponder() {
94
101
  useEffect(() => installMcpResponder(), []);
95
102
  }
96
103
 
104
+ const FIRST_SUCCESS_TOAST = 'lr-feedback-first';
105
+
106
+ function useFirstSuccessPrompt() {
107
+ const lr = useLrText();
108
+ useEffect(() => {
109
+ const notify = () => {
110
+ if (feedbackAsked()) return;
111
+ markFeedbackAsked();
112
+ toast(lr.feedback.firstSuccessTitle, {
113
+ id: FIRST_SUCCESS_TOAST,
114
+ duration: 12000,
115
+ action: {
116
+ label: lr.feedback.smooth,
117
+ onClick: () => toast.dismiss(FIRST_SUCCESS_TOAST),
118
+ },
119
+ cancel: {
120
+ label: lr.feedback.notSmooth,
121
+ onClick: () => {
122
+ toast.dismiss(FIRST_SUCCESS_TOAST);
123
+ openFeedback({ category: 'issue' });
124
+ },
125
+ },
126
+ });
127
+ };
128
+ const off = onFirstSuccess(notify);
129
+ // Exports leave no callback of ours behind: the browser download pops up an
130
+ // anchor with `download`, and the PDF path ends with afterprint.
131
+ const onClick = (event: MouseEvent) => {
132
+ if ((event.target as Element | null)?.closest?.('a[download]')) noteSuccess();
133
+ };
134
+ const onAfterPrint = () => {
135
+ if (document.getElementById('os-print-root')) noteSuccess();
136
+ };
137
+ document.addEventListener('click', onClick, true);
138
+ window.addEventListener('afterprint', onAfterPrint);
139
+ return () => {
140
+ off();
141
+ document.removeEventListener('click', onClick, true);
142
+ window.removeEventListener('afterprint', onAfterPrint);
143
+ };
144
+ }, [lr]);
145
+ }
146
+
97
147
  /** Everything LemonRiver adds around the routes. Sits where the official toaster was. */
98
148
  export function AppChrome() {
99
149
  const reduceMotion = useReduceMotionSetting();
@@ -102,6 +152,7 @@ export function AppChrome() {
102
152
  useDecksChangedReload();
103
153
  usePendingToast();
104
154
  useMcpResponder();
155
+ useFirstSuccessPrompt();
105
156
 
106
157
  useEffect(() => {
107
158
  applyReduceMotion(reduceMotion);
@@ -113,6 +164,7 @@ export function AppChrome() {
113
164
  {import.meta.env.DEV && <OfflineBanner />}
114
165
  <SidebarExtras />
115
166
  <UpdatePrompt />
167
+ <FeedbackHost />
116
168
  </>
117
169
  );
118
170
  }
@@ -1,9 +1,10 @@
1
- import { BookOpen, LayoutTemplate, Plus, Settings, Trash2 } from 'lucide-react';
1
+ import { BookOpen, LayoutTemplate, MessageSquare, Plus, Settings, Trash2 } from 'lucide-react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { useLocation, useNavigate } from 'react-router-dom';
4
4
  import { Button } from '@/components/ui/button';
5
5
  import { useCreateDeck } from '@/lib/agent/use-agent';
6
6
  import { isFeatureEnabled } from '../features';
7
+ import { openFeedback } from '../feedback/dialog';
7
8
  import { useTemplateLibrary } from '../templates/use-library';
8
9
  import { useLrText } from '../text';
9
10
  import { pageForPath } from '../theme/pages';
@@ -60,6 +61,12 @@ export function SidebarExtras() {
60
61
  onSelect={() => navigate('/help#guide')}
61
62
  />
62
63
  )}
64
+ <NavRow
65
+ icon={<MessageSquare className="size-4" strokeWidth={1.75} />}
66
+ label={lr.feedback.sidebar}
67
+ current={false}
68
+ onSelect={() => openFeedback()}
69
+ />
63
70
  {isFeatureEnabled('settings') && (
64
71
  <NavRow
65
72
  icon={<Settings className="size-4" strokeWidth={1.75} />}
@@ -0,0 +1,222 @@
1
+ import { useEffect, useMemo, useState } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import { Button } from '@/components/ui/button';
4
+ import {
5
+ Dialog,
6
+ DialogContent,
7
+ DialogDescription,
8
+ DialogFooter,
9
+ DialogHeader,
10
+ DialogTitle,
11
+ } from '@/components/ui/dialog';
12
+ import { format } from '@/lib/use-locale';
13
+ import { FEEDBACK_EMAIL, FEEDBACK_FORM_URL } from '../links';
14
+ import { appVersion } from '../share/client';
15
+ import { useLrText } from '../text';
16
+ import { pageForPath } from '../theme/pages';
17
+ import { workspaceSignals } from './install';
18
+ import {
19
+ buildFeedbackInfo,
20
+ type FeedbackCategory,
21
+ type FeedbackErrorKind,
22
+ type FeedbackRequest,
23
+ type InstallKind,
24
+ mailtoHref,
25
+ osLabelFor,
26
+ } from './model';
27
+
28
+ const OPEN_EVENT = 'lemonriver:feedback-open';
29
+
30
+ export function openFeedback(request: FeedbackRequest = {}): void {
31
+ window.dispatchEvent(new CustomEvent(OPEN_EVENT, { detail: request }));
32
+ }
33
+
34
+ const CATEGORIES: FeedbackCategory[] = ['issue', 'idea', 'other'];
35
+
36
+ export function FeedbackHost() {
37
+ const lr = useLrText();
38
+ const { pathname } = useLocation();
39
+ const [request, setRequest] = useState<(FeedbackRequest & { page: string }) | null>(null);
40
+ const [category, setCategory] = useState<FeedbackCategory>('other');
41
+ const [version, setVersion] = useState('');
42
+ const [install, setInstall] = useState<InstallKind>('unknown');
43
+ const [osVersion, setOsVersion] = useState<string | null>(null);
44
+ const [copied, setCopied] = useState(false);
45
+
46
+ useEffect(() => {
47
+ const onOpen = (event: Event) => {
48
+ const detail = (event as CustomEvent<FeedbackRequest>).detail ?? {};
49
+ setCategory(detail.category ?? 'other');
50
+ setCopied(false);
51
+ setRequest({ ...detail, page: pathname });
52
+ void appVersion()
53
+ .then(setVersion)
54
+ .catch(() => setVersion(''));
55
+ void workspaceSignals()
56
+ .then((signals) => {
57
+ setInstall(signals.install);
58
+ setOsVersion(signals.os);
59
+ })
60
+ .catch(() => {
61
+ setInstall('unknown');
62
+ setOsVersion(null);
63
+ });
64
+ };
65
+ window.addEventListener(OPEN_EVENT, onOpen);
66
+ return () => window.removeEventListener(OPEN_EVENT, onOpen);
67
+ }, [pathname]);
68
+
69
+ const f = lr.feedback;
70
+ const info = useMemo(
71
+ () =>
72
+ buildFeedbackInfo(
73
+ {
74
+ version: version || f.unknown,
75
+ os: osLabelFor(osVersion),
76
+ install,
77
+ page: pageForPath(request?.page ?? '/'),
78
+ errorKind: (request?.errorKind as FeedbackErrorKind | null | undefined) ?? null,
79
+ },
80
+ {
81
+ fields: {
82
+ version: f.fieldVersion,
83
+ os: f.fieldOs,
84
+ install: f.fieldInstall,
85
+ page: f.fieldPage,
86
+ error: f.fieldError,
87
+ },
88
+ separator: f.separator,
89
+ unknown: f.unknown,
90
+ installs: { app: f.installApp, cli: f.installCli, unknown: f.unknown },
91
+ pages: {
92
+ home: f.pageHome,
93
+ editor: f.pageEditor,
94
+ board: f.pageBoard,
95
+ outline: f.pageOutline,
96
+ settings: f.pageSettings,
97
+ help: f.pageHelp,
98
+ other: f.pageOther,
99
+ },
100
+ errors: { export: f.errorExport, update: f.errorUpdate, backup: f.errorBackup },
101
+ },
102
+ ),
103
+ [version, install, osVersion, request, f],
104
+ );
105
+
106
+ const categoryLabel =
107
+ category === 'issue' ? f.categoryIssue : category === 'idea' ? f.categoryIdea : f.categoryOther;
108
+
109
+ const copy = async () => {
110
+ try {
111
+ await navigator.clipboard.writeText(info);
112
+ } catch {}
113
+ setCopied(true);
114
+ };
115
+
116
+ const openForm = () => {
117
+ window.open(FEEDBACK_FORM_URL, '_blank', 'noopener');
118
+ void copy();
119
+ };
120
+
121
+ const close = (next: boolean) => {
122
+ if (!next) setRequest(null);
123
+ };
124
+
125
+ return (
126
+ <Dialog open={request !== null} onOpenChange={close}>
127
+ <DialogContent className="sm:max-w-[520px]" data-lr-feedback-dialog>
128
+ <DialogHeader>
129
+ <DialogTitle>{f.title}</DialogTitle>
130
+ <DialogDescription>{f.intro}</DialogDescription>
131
+ </DialogHeader>
132
+
133
+ <fieldset className="flex flex-wrap gap-1.5" aria-label={f.title}>
134
+ {CATEGORIES.map((kind) => {
135
+ const label =
136
+ kind === 'issue'
137
+ ? f.categoryIssue
138
+ : kind === 'idea'
139
+ ? f.categoryIdea
140
+ : f.categoryOther;
141
+ return (
142
+ <button
143
+ key={kind}
144
+ type="button"
145
+ aria-pressed={category === kind}
146
+ data-lr-feedback-category={kind}
147
+ onClick={() => setCategory(kind)}
148
+ className={
149
+ category === kind
150
+ ? 'min-h-8 rounded-full border border-[var(--lr-accent)] bg-[var(--lr-accent-soft)] px-3 py-1 text-[12.5px] font-medium text-foreground'
151
+ : 'min-h-8 rounded-full border border-border bg-card px-3 py-1 text-[12.5px] font-medium text-muted-foreground hover:border-[var(--lr-text-3)]'
152
+ }
153
+ >
154
+ {label}
155
+ </button>
156
+ );
157
+ })}
158
+ </fieldset>
159
+
160
+ <pre
161
+ data-lr-feedback-info
162
+ className="mt-1 whitespace-pre-wrap break-words rounded-[8px] border border-border bg-muted/40 px-3 py-2 font-mono text-[12px] leading-relaxed text-muted-foreground"
163
+ >
164
+ {info}
165
+ </pre>
166
+
167
+ {copied && (
168
+ <p data-lr-feedback-copied className="text-[12.5px] text-muted-foreground">
169
+ {f.copied}
170
+ </p>
171
+ )}
172
+
173
+ {!FEEDBACK_FORM_URL && !FEEDBACK_EMAIL && (
174
+ <p data-lr-feedback-no-channel className="text-[12.5px] text-muted-foreground">
175
+ {f.noChannel}
176
+ </p>
177
+ )}
178
+
179
+ <DialogFooter className="sm:justify-start">
180
+ {FEEDBACK_FORM_URL !== '' && (
181
+ <Button
182
+ type="button"
183
+ variant="outline"
184
+ size="sm"
185
+ data-lr-feedback-form
186
+ onClick={openForm}
187
+ >
188
+ {f.openForm}
189
+ </Button>
190
+ )}
191
+ {FEEDBACK_EMAIL !== '' && (
192
+ <Button
193
+ variant="outline"
194
+ size="sm"
195
+ data-lr-feedback-email
196
+ render={
197
+ <a
198
+ href={mailtoHref(
199
+ FEEDBACK_EMAIL,
200
+ format(f.mailSubject, { category: categoryLabel }),
201
+ `${info}\n\n${f.mailBodyPlaceholder}`,
202
+ )}
203
+ />
204
+ }
205
+ >
206
+ {f.sendEmail}
207
+ </Button>
208
+ )}
209
+ <Button
210
+ type="button"
211
+ variant="outline"
212
+ size="sm"
213
+ data-lr-feedback-copy
214
+ onClick={() => void copy()}
215
+ >
216
+ {f.copyInfo}
217
+ </Button>
218
+ </DialogFooter>
219
+ </DialogContent>
220
+ </Dialog>
221
+ );
222
+ }
@@ -1,7 +1,26 @@
1
+ import { createElement } from 'react';
2
+ import { Button } from '@/components/ui/button';
1
3
  import type { Locale } from '../../../locale/types';
2
4
  import { lrTextFor } from '../text/all';
5
+ import { openFeedback } from './dialog';
3
6
 
4
7
  /** What to tell someone whose export just failed, under the official message. */
5
- export function exportFailedHint(t: Locale): string {
6
- return lrTextFor(t.id).feedback.exportFailedHint;
8
+ export function exportFailedHint(t: Locale) {
9
+ const lr = lrTextFor(t.id);
10
+ return createElement(
11
+ 'span',
12
+ { className: 'flex flex-col items-start gap-1.5' },
13
+ createElement('span', null, lr.feedback.exportFailedHint),
14
+ createElement(
15
+ Button,
16
+ {
17
+ type: 'button',
18
+ variant: 'outline',
19
+ size: 'sm',
20
+ onClick: () => openFeedback({ category: 'issue', errorKind: 'export' }),
21
+ ...({ 'data-lr-feedback-this': '' } as Record<string, string>),
22
+ },
23
+ lr.feedback.feedbackThis,
24
+ ),
25
+ );
7
26
  }