appos 0.4.2-0 → 0.5.0-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 (65) hide show
  1. package/dist/exports/api/index.d.mts +5 -4
  2. package/dist/exports/api/index.mjs +117 -15
  3. package/dist/exports/api/orm.d.mts +1 -1
  4. package/dist/exports/api/orm.mjs +1 -1
  5. package/dist/exports/api/workflows/index.d.mts +4 -3
  6. package/dist/exports/api/workflows/index.mjs +2 -2
  7. package/dist/exports/app-context-B1VJ9qnH.mjs +3 -0
  8. package/dist/exports/auth-DVv5fNvd.d.mts +874 -0
  9. package/dist/exports/cli/index.d.mts +4 -3
  10. package/dist/exports/cli/index.mjs +90 -16
  11. package/dist/exports/{constants-DbBfpyC3.mjs → constants-BicCnEiJ.mjs} +7 -1
  12. package/dist/exports/{index-B3m3Uvsl.d.mts → index-D3decHVs.d.mts} +470 -876
  13. package/dist/exports/{instrumentation-DrvjMp7J.mjs → instrumentation-DkoLNAtz.mjs} +1 -1
  14. package/dist/exports/instrumentation.d.mts +1 -1
  15. package/dist/exports/instrumentation.mjs +1 -1
  16. package/dist/exports/{mock-CURQkGUm.mjs → mock-2jMk5l3y.mjs} +1 -1
  17. package/dist/exports/{openapi-C7QT3gNU.mjs → openapi-uisUTLq7.mjs} +154 -109
  18. package/dist/exports/{orm-CQk1S10H.d.mts → orm-CJrd147z.d.mts} +1 -1
  19. package/dist/exports/{orm-BYSfGzG0.mjs → orm-COJ9l6sS.mjs} +1 -1
  20. package/dist/exports/{send-email-Do8SjZL7.mjs → send-email-CXxlkfFL.mjs} +13 -1
  21. package/dist/exports/{server-lUTkWRNL.mjs → server-CA4aI0U6.mjs} +15 -9
  22. package/dist/exports/ssr-BsfNjYlJ.mjs +16 -0
  23. package/dist/exports/storybook/index.d.ts +43 -0
  24. package/dist/exports/storybook/index.js +43 -0
  25. package/dist/exports/tests/api.d.mts +4 -3
  26. package/dist/exports/tests/api.mjs +7 -7
  27. package/dist/exports/tests/mock.mjs +1 -1
  28. package/dist/exports/vite/index.mjs +51 -2
  29. package/dist/exports/web/index.d.ts +1173 -363
  30. package/dist/exports/web/index.js +1860 -843
  31. package/dist/exports/web/routes.d.mts +137 -0
  32. package/dist/exports/{ssr-C4ZXh5DE.mjs → web/routes.mjs} +28 -86
  33. package/dist/exports/web/ssr.d.mts +6 -248
  34. package/dist/exports/web/ssr.mjs +2 -2
  35. package/package.json +39 -12
  36. package/src/storybook/.storybook/main.ts +100 -0
  37. package/src/storybook/.storybook/manager.ts +75 -0
  38. package/src/storybook/.storybook/preview.ts +37 -0
  39. package/src/storybook/components/ColorGrid.tsx +324 -0
  40. package/src/storybook/components/IconGallery.tsx +268 -0
  41. package/src/storybook/components/SpacingScale.tsx +236 -0
  42. package/src/storybook/components/TypographyScale.tsx +277 -0
  43. package/src/storybook/components/index.ts +3 -0
  44. package/src/storybook/docs/Introduction.mdx +29 -0
  45. package/src/storybook/docs/foundations/Colors.mdx +27 -0
  46. package/src/storybook/docs/foundations/Icons.mdx +26 -0
  47. package/src/storybook/docs/foundations/Spacing.mdx +23 -0
  48. package/src/storybook/docs/foundations/Typography.mdx +39 -0
  49. package/src/storybook/vite.config.ts +24 -0
  50. package/src/web/lib/colors.ts +220 -0
  51. package/src/web/routes/auth/_layout.tsx +14 -8
  52. package/src/web/routes/auth/forgot-password.tsx +3 -1
  53. package/src/web/routes/auth/phone-otp.tsx +1 -2
  54. package/src/web/routes/auth/utils.ts +30 -170
  55. package/src/web/ui/button.stories.tsx +260 -0
  56. package/src/web/ui/globals.css +2 -0
  57. package/src/web/ui/locales/en/ui.json +49 -32
  58. package/src/web/ui/locales/zh-CN/ui.json +53 -36
  59. package/src/web/ui/locales/zh-TW/ui.json +53 -36
  60. package/dist/exports/app-context-deZa7oJC.mjs +0 -3
  61. /package/dist/exports/{app-context-DoFRTUi5.mjs → app-context-LF4QmPUC.mjs} +0 -0
  62. /package/dist/exports/{chunk-Db_DmN2K.mjs → chunk-CHSICr2d.mjs} +0 -0
  63. /package/dist/exports/{instrumentation-B0Ev9PvT.d.mts → instrumentation-CFIspF8-.d.mts} +0 -0
  64. /package/dist/exports/{vite-compat-CeAU9UrA.mjs → vite-compat-CICObU9F.mjs} +0 -0
  65. /package/dist/exports/{youch-handler-BEWxHUsu.mjs → youch-handler-CHwX0Fou.mjs} +0 -0
@@ -1,6 +1,7 @@
1
- import { z as Container } from "../index-B3m3Uvsl.mjs";
2
- import "../orm-CQk1S10H.mjs";
3
- import "../instrumentation-B0Ev9PvT.mjs";
1
+ import "../auth-DVv5fNvd.mjs";
2
+ import { z as Container } from "../index-D3decHVs.mjs";
3
+ import "../orm-CJrd147z.mjs";
4
+ import "../instrumentation-CFIspF8-.mjs";
4
5
  import { z } from "zod";
5
6
  import { ChildProcess } from "node:child_process";
6
7
  import * as p from "@clack/prompts";
@@ -1,10 +1,10 @@
1
- import "../app-context-DoFRTUi5.mjs";
2
- import { a as loadWorkflows, h as loadEvents } from "../send-email-Do8SjZL7.mjs";
3
- import { a as DATABASES_DIR, c as FIXTURES_DIR, h as WEB_DIR, i as COMMANDS_DIR, m as TEST_EXTENSIONS, n as BUILD_DIR, s as FILE_EXT, t as APPOS_DIR, u as MAIN_ENTRY } from "../constants-DbBfpyC3.mjs";
4
- import { _ as defineMigrationOpts } from "../openapi-C7QT3gNU.mjs";
5
- import "../instrumentation-DrvjMp7J.mjs";
6
- import { t as defineServer } from "../server-lUTkWRNL.mjs";
7
- import "../ssr-C4ZXh5DE.mjs";
1
+ import "../app-context-LF4QmPUC.mjs";
2
+ import { a as loadWorkflows, h as loadEvents } from "../send-email-CXxlkfFL.mjs";
3
+ import { a as DATABASES_DIR, c as FILE_EXT, d as MAIN_ENTRY, g as WEB_DIR, h as TEST_EXTENSIONS, i as COMMANDS_DIR, l as FIXTURES_DIR, n as BUILD_DIR, t as APPOS_DIR } from "../constants-BicCnEiJ.mjs";
4
+ import { _ as defineMigrationOpts } from "../openapi-uisUTLq7.mjs";
5
+ import "../instrumentation-DkoLNAtz.mjs";
6
+ import { t as defineServer } from "../server-CA4aI0U6.mjs";
7
+ import "../ssr-BsfNjYlJ.mjs";
8
8
  import { createRequire } from "node:module";
9
9
  import { z } from "zod";
10
10
  import path, { dirname, join } from "node:path";
@@ -431,14 +431,33 @@ var build_default = defineCommand({
431
431
  } catch {
432
432
  hasWebDir = false;
433
433
  }
434
- if (hasWebDir) try {
435
- await ctx.spinner("Building React Router app", async () => {
436
- const viteBin = await findBin("vite");
437
- await ctx.exec(viteBin, ["build"]);
438
- });
439
- ctx.success("Built React Router app successfully");
440
- } catch (error) {
441
- ctx.fail(error instanceof Error ? error.message : String(error));
434
+ if (hasWebDir) {
435
+ try {
436
+ await ctx.spinner("Building React Router app", async () => {
437
+ const viteBin = await findBin("vite");
438
+ await ctx.exec(viteBin, ["build"]);
439
+ });
440
+ ctx.success("Built React Router app successfully");
441
+ } catch (error) {
442
+ ctx.fail(error instanceof Error ? error.message : String(error));
443
+ }
444
+ const configDir = join(dirname(createRequire(import.meta.url).resolve("appos/package.json")), "src/storybook/.storybook");
445
+ if (existsSync(configDir)) try {
446
+ await ctx.spinner("Building design system", async () => {
447
+ const storybookBin = await findBin("storybook");
448
+ await ctx.exec(storybookBin, [
449
+ "build",
450
+ "-o",
451
+ `${BUILD_DIR}/storybook`,
452
+ "--config-dir",
453
+ configDir,
454
+ "--quiet"
455
+ ]);
456
+ });
457
+ ctx.success("Built design system successfully");
458
+ } catch (error) {
459
+ ctx.warn(`Storybook build failed: ${error instanceof Error ? error.message : String(error)}`);
460
+ }
442
461
  }
443
462
  const entryPoints = await collectEntryPoints();
444
463
  const outdir = `./${BUILD_DIR}`;
@@ -1404,7 +1423,7 @@ var preview_default = defineCommand({
1404
1423
 
1405
1424
  //#endregion
1406
1425
  //#region package.json
1407
- var version = "0.4.2-0";
1426
+ var version = "0.5.0-0";
1408
1427
 
1409
1428
  //#endregion
1410
1429
  //#region src/cli/commands/repl.ts
@@ -1526,6 +1545,7 @@ var start_default = defineCommand({
1526
1545
  const startWorker = !opts.service || opts.service === "worker";
1527
1546
  let server = null;
1528
1547
  let worker = null;
1548
+ let storybookProc = null;
1529
1549
  let isShuttingDown = false;
1530
1550
  /**
1531
1551
  * Graceful shutdown handler.
@@ -1535,6 +1555,10 @@ var start_default = defineCommand({
1535
1555
  isShuttingDown = true;
1536
1556
  logger.info(`Shutdown initiated (${signal})`);
1537
1557
  try {
1558
+ if (storybookProc && !storybookProc.killed) {
1559
+ storybookProc.kill("SIGKILL");
1560
+ logger.info("Design system stopped");
1561
+ }
1538
1562
  if (server) {
1539
1563
  await server.stop();
1540
1564
  logger.info("HTTP server stopped");
@@ -1560,6 +1584,56 @@ var start_default = defineCommand({
1560
1584
  server = await defineServer({ container });
1561
1585
  await server.start();
1562
1586
  logger.info(`HTTP server ready at http://${server.host}:${server.port} ${runtimeInfo}`);
1587
+ if (process.env.NODE_ENV !== "production") {
1588
+ const configDir = join(dirname(createRequire(import.meta.url).resolve("appos/package.json")), "src/storybook/.storybook");
1589
+ let binPath = "";
1590
+ let dir = process.cwd();
1591
+ while (dir !== "/") {
1592
+ const candidate = join(dir, "node_modules", ".bin");
1593
+ if (existsSync(candidate)) {
1594
+ binPath = candidate;
1595
+ break;
1596
+ }
1597
+ dir = dirname(dir);
1598
+ }
1599
+ const { spawn: spawn$1 } = await import("node:child_process");
1600
+ storybookProc = spawn$1("storybook", [
1601
+ "dev",
1602
+ "-p",
1603
+ "6006",
1604
+ "--no-open",
1605
+ "--config-dir",
1606
+ configDir
1607
+ ], {
1608
+ stdio: "ignore",
1609
+ cwd: process.cwd(),
1610
+ env: {
1611
+ ...process.env,
1612
+ PATH: binPath ? `${binPath}:${process.env.PATH}` : process.env.PATH
1613
+ }
1614
+ });
1615
+ storybookProc.on("exit", (code) => {
1616
+ if (code !== 0 && code !== null && !isShuttingDown) logger.error(`Design system exited with code ${code}`);
1617
+ storybookProc = null;
1618
+ });
1619
+ storybookProc.on("error", (err) => {
1620
+ if (!isShuttingDown) logger.error(`Design system spawn error: ${err.message}`);
1621
+ });
1622
+ /**
1623
+ * Waits for a port to become available by polling.
1624
+ */
1625
+ const waitForPort = async (port, timeout) => {
1626
+ const start = Date.now();
1627
+ while (Date.now() - start < timeout) try {
1628
+ await fetch(`http://localhost:${port}`);
1629
+ return true;
1630
+ } catch {
1631
+ await new Promise((r) => setTimeout(r, 200));
1632
+ }
1633
+ return false;
1634
+ };
1635
+ if (!await waitForPort(6006, 3e4) && storybookProc && !storybookProc.killed) logger.warn("Design system slow to start, /design may not be ready yet");
1636
+ }
1563
1637
  }
1564
1638
  }
1565
1639
  });
@@ -163,6 +163,12 @@ const FIXTURES_DIR = "__fixtures__";
163
163
  * @default [".test.ts", ".spec.ts"]
164
164
  */
165
165
  const TEST_EXTENSIONS = [".test.ts", ".spec.ts"];
166
+ /**
167
+ * URL path for Storybook design system.
168
+ *
169
+ * @default "/design"
170
+ */
171
+ const DESIGN_SYSTEM_PATH = "/design";
166
172
 
167
173
  //#endregion
168
- export { DATABASES_DIR as a, FIXTURES_DIR as c, MIDDLEWARE_DIR as d, PUBLIC_DIR as f, WORKFLOWS_DIR as g, WEB_DIR as h, COMMANDS_DIR as i, LOCALES_DIR as l, TEST_EXTENSIONS as m, BUILD_DIR as n, EVENTS_DIR as o, ROUTES_DIR as p, BUILD_OUTPUT_DIR as r, FILE_EXT as s, APPOS_DIR as t, MAIN_ENTRY as u };
174
+ export { WORKFLOWS_DIR as _, DATABASES_DIR as a, FILE_EXT as c, MAIN_ENTRY as d, MIDDLEWARE_DIR as f, WEB_DIR as g, TEST_EXTENSIONS as h, COMMANDS_DIR as i, FIXTURES_DIR as l, ROUTES_DIR as m, BUILD_DIR as n, DESIGN_SYSTEM_PATH as o, PUBLIC_DIR as p, BUILD_OUTPUT_DIR as r, EVENTS_DIR as s, APPOS_DIR as t, LOCALES_DIR as u };