handoff-app 2.0.0-9 → 2.0.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.
Files changed (312) hide show
  1. package/AGENTS.md +90 -1
  2. package/{Changelog.md → CHANGELOG.md} +105 -1
  3. package/CLAUDE.md +92 -1
  4. package/{License.md → LICENSE.md} +1 -1
  5. package/README.md +818 -406
  6. package/RECIPES.md +975 -0
  7. package/UPGRADE.md +57 -9
  8. package/components.json +20 -20
  9. package/config/docs/foundations/colors/guidelines.md +0 -1
  10. package/config/docs/foundations/colors.md +0 -1
  11. package/config/docs/foundations/effects/guidelines.md +0 -1
  12. package/config/docs/foundations/effects/resources.md +0 -1
  13. package/config/docs/foundations/effects.md +0 -1
  14. package/config/docs/foundations/fonts.md +0 -1
  15. package/config/docs/foundations/grid.md +0 -1
  16. package/config/docs/foundations/icon.md +0 -1
  17. package/config/docs/foundations/icons/guidelines.md +0 -1
  18. package/config/docs/foundations/icons.md +0 -1
  19. package/config/docs/foundations/images/guidelines.md +0 -1
  20. package/config/docs/foundations/images/resources.md +0 -1
  21. package/config/docs/foundations/images.md +0 -1
  22. package/config/docs/foundations/logo/resources.md +0 -1
  23. package/config/docs/foundations/logo.md +0 -1
  24. package/config/docs/foundations/typography/guidelines.md +0 -1
  25. package/config/docs/foundations/typography/resources.md +0 -1
  26. package/config/docs/foundations/typography.md +0 -1
  27. package/config/docs/foundations.md +0 -1
  28. package/config/docs/guidelines.md +0 -1
  29. package/config/docs/index.md +0 -1
  30. package/config/docs/system/tokens/foundations/colors.md +0 -4
  31. package/config/docs/system/tokens/foundations/effects.md +0 -4
  32. package/config/docs/system/tokens/foundations/typography.md +0 -2
  33. package/config/docs/system.md +0 -2
  34. package/config/templates/page.md +2 -1
  35. package/config/templates/page.mdx +2 -1
  36. package/dist/ai/connections.d.ts +66 -0
  37. package/dist/ai/connections.js +149 -0
  38. package/dist/ai/define.d.ts +10 -0
  39. package/dist/ai/define.js +13 -0
  40. package/dist/ai/types.d.ts +26 -0
  41. package/dist/ai/types.js +10 -0
  42. package/dist/app-builder/build.d.ts +14 -7
  43. package/dist/app-builder/build.js +195 -66
  44. package/dist/app-builder/client-config.js +3 -2
  45. package/dist/app-builder/paths.d.ts +0 -12
  46. package/dist/app-builder/paths.js +3 -20
  47. package/dist/app-builder/static-export.js +1 -1
  48. package/dist/app-builder/vercel-output.d.ts +1 -1
  49. package/dist/app-builder/vercel-output.js +5 -4
  50. package/dist/cache/build-cache.d.ts +27 -4
  51. package/dist/cache/build-cache.js +114 -47
  52. package/dist/cache/build-inputs.d.ts +13 -0
  53. package/dist/cache/build-inputs.js +19 -0
  54. package/dist/cache/index.d.ts +2 -1
  55. package/dist/cache/index.js +5 -1
  56. package/dist/cli/create.js +1 -2
  57. package/dist/cli.js +1 -1
  58. package/dist/commands/build/index.d.ts +1 -1
  59. package/dist/commands/build/index.js +1 -1
  60. package/dist/commands/utils.d.ts +3 -3
  61. package/dist/config/defaults.js +7 -4
  62. package/dist/config/from-env.d.ts +4 -0
  63. package/dist/config/from-env.js +38 -1
  64. package/dist/config/helpers.js +2 -2
  65. package/dist/config/index.d.ts +0 -1
  66. package/dist/config/index.js +1 -4
  67. package/dist/config/loader.js +26 -2
  68. package/dist/config/resolve-env.d.ts +2 -1
  69. package/dist/config/resolve-env.js +28 -12
  70. package/dist/config/runtime.js +1 -1
  71. package/dist/index.d.ts +12 -7
  72. package/dist/index.js +18 -22
  73. package/dist/nav/index.d.ts +2 -2
  74. package/dist/nav/registry.d.ts +3 -3
  75. package/dist/nav/registry.js +1 -1
  76. package/dist/nav/workspace.d.ts +3 -3
  77. package/dist/nav/workspace.js +1 -1
  78. package/dist/pipeline/figma.d.ts +13 -2
  79. package/dist/pipeline/figma.js +86 -46
  80. package/dist/pipeline/styles.js +1 -1
  81. package/dist/pipeline/validation.d.ts +1 -1
  82. package/dist/pipeline/validation.js +3 -3
  83. package/dist/providers.d.ts +10 -0
  84. package/dist/providers.js +13 -0
  85. package/dist/registry/asset-storage/define.d.ts +5 -5
  86. package/dist/registry/asset-storage/define.js +4 -4
  87. package/dist/registry/asset-storage/resolve.d.ts +9 -19
  88. package/dist/registry/asset-storage/resolve.js +33 -21
  89. package/dist/registry/asset-storage/types.d.ts +37 -17
  90. package/dist/registry/asset-storage/types.js +5 -5
  91. package/dist/registry/auth/ai-keys.d.ts +32 -0
  92. package/dist/registry/auth/ai-keys.js +69 -0
  93. package/dist/registry/auth/crypto.d.ts +17 -0
  94. package/dist/registry/auth/crypto.js +61 -1
  95. package/dist/registry/auth/index.d.ts +2 -1
  96. package/dist/registry/auth/index.js +11 -2
  97. package/dist/registry/checkout/index.d.ts +2 -1
  98. package/dist/registry/checkout/index.js +57 -127
  99. package/dist/registry/client.js +53 -17
  100. package/dist/registry/db/driver.js +3 -3
  101. package/dist/registry/db/schema.d.ts +261 -3
  102. package/dist/registry/db/schema.js +29 -4
  103. package/dist/registry/email/define.d.ts +10 -0
  104. package/dist/registry/email/define.js +13 -0
  105. package/dist/registry/email/providers/smtp.d.ts +10 -0
  106. package/dist/registry/email/providers/smtp.js +73 -0
  107. package/dist/registry/email/resolve.d.ts +28 -0
  108. package/dist/registry/email/resolve.js +74 -0
  109. package/dist/registry/email/types.d.ts +24 -0
  110. package/dist/registry/email/types.js +6 -0
  111. package/dist/registry/path.d.ts +2 -0
  112. package/dist/registry/path.js +11 -1
  113. package/dist/registry/publish/errors.js +4 -0
  114. package/dist/registry/publish/index.js +2 -0
  115. package/dist/registry/publish/package.d.ts +6 -0
  116. package/dist/registry/publish/package.js +29 -1
  117. package/dist/registry/transfer.d.ts +4 -0
  118. package/dist/store/registry.d.ts +3 -3
  119. package/dist/store/registry.js +4 -4
  120. package/dist/transformers/preview/component/builder.d.ts +1 -9
  121. package/dist/transformers/preview/component/builder.js +17 -17
  122. package/dist/transformers/preview/component/css.d.ts +2 -1
  123. package/dist/transformers/preview/component/css.js +8 -5
  124. package/dist/transformers/preview/component/html.d.ts +3 -1
  125. package/dist/transformers/preview/component/html.js +6 -2
  126. package/dist/transformers/preview/component/javascript.d.ts +2 -1
  127. package/dist/transformers/preview/component/javascript.js +10 -4
  128. package/dist/transformers/utils/build.d.ts +9 -0
  129. package/dist/transformers/utils/build.js +27 -5
  130. package/dist/types/config.d.ts +129 -18
  131. package/dist/utils/path.d.ts +1 -5
  132. package/dist/utils/path.js +6 -23
  133. package/docs/api.md +6 -4
  134. package/docs/cli.md +275 -54
  135. package/drizzle/0007_add_ai_keys.sql +11 -0
  136. package/drizzle/0008_add_source_dir.sql +2 -0
  137. package/drizzle/meta/0007_snapshot.json +2013 -0
  138. package/drizzle/meta/0008_snapshot.json +2025 -0
  139. package/drizzle/meta/_journal.json +14 -0
  140. package/package.json +19 -8
  141. package/src/ai/README.md +42 -0
  142. package/src/ai/connections.ts +189 -0
  143. package/src/ai/define.ts +15 -0
  144. package/src/ai/types.ts +30 -0
  145. package/src/app/components/AiAssistant/AiAssistantPanel.tsx +144 -0
  146. package/src/app/components/AiAssistant/AiAssistantProvider.tsx +215 -0
  147. package/src/app/components/AiAssistant/AiConversation.tsx +737 -0
  148. package/src/app/components/AiAssistant/AiToolResult.tsx +99 -0
  149. package/src/app/components/AiAssistant/dockState.ts +86 -0
  150. package/src/app/components/AiAssistant/toolLabel.ts +24 -0
  151. package/src/app/components/AiAssistant/useAiChat.ts +147 -0
  152. package/src/app/components/AiAssistant/useAiConnections.ts +86 -0
  153. package/src/app/components/AiAssistant/usePageContext.ts +63 -0
  154. package/src/app/components/Auth/AccountLayout.tsx +58 -19
  155. package/src/app/components/Auth/AuthShell.tsx +27 -33
  156. package/src/app/components/Auth/RegistryInstallGate.tsx +4 -8
  157. package/src/app/components/Auth/installStatus.ts +29 -0
  158. package/src/app/components/Component/Preview.tsx +5 -2
  159. package/src/app/components/Foundations/ColorGrid.tsx +13 -14
  160. package/src/app/components/Layout/Header.tsx +21 -15
  161. package/src/app/components/Layout/Main.tsx +2 -2
  162. package/src/app/components/Markdown/MarkdownComponents.tsx +30 -32
  163. package/src/app/components/McpIntegration/McpConfigDialog.tsx +12 -51
  164. package/src/app/components/Navigation/MobileNav.tsx +2 -2
  165. package/src/app/components/Navigation/SideNav.tsx +1 -15
  166. package/src/app/components/context/NavProvider.tsx +7 -3
  167. package/src/app/components/ui/attachment.tsx +50 -0
  168. package/src/app/components/ui/bubble.tsx +57 -0
  169. package/src/app/components/ui/button.tsx +3 -1
  170. package/src/app/components/ui/confirm-dialog.tsx +87 -0
  171. package/src/app/components/ui/dialog.tsx +7 -2
  172. package/src/app/components/ui/marker.tsx +56 -0
  173. package/src/app/components/ui/sidebar.tsx +3 -1
  174. package/src/app/components/util/index.ts +3 -12
  175. package/src/app/css/index.css +64 -0
  176. package/src/app/lib/ai/auth.ts +33 -0
  177. package/src/app/lib/ai/context.ts +99 -0
  178. package/src/app/lib/ai/model.ts +79 -0
  179. package/src/app/lib/ai/prompt.ts +36 -0
  180. package/src/app/lib/ai/resolve.ts +97 -0
  181. package/src/app/lib/ai/tools.ts +120 -0
  182. package/src/app/lib/api/methods.ts +13 -0
  183. package/src/app/lib/asset-storage.ts +35 -36
  184. package/src/app/lib/auth/api.ts +4 -12
  185. package/src/app/lib/auth/email.ts +96 -23
  186. package/src/app/lib/docs-api/page-rendering.ts +1 -1
  187. package/src/app/lib/docs-api/registry.ts +2 -3
  188. package/src/app/lib/docs-api/runtime-config.ts +47 -21
  189. package/src/app/lib/mcp/components.ts +523 -0
  190. package/src/app/lib/mcp/page-url.ts +24 -0
  191. package/src/app/lib/mcp/pages.ts +84 -0
  192. package/src/app/lib/mcp/result.ts +33 -0
  193. package/src/app/lib/mcp/server.ts +39 -318
  194. package/src/app/lib/mcp/tokens.ts +334 -0
  195. package/src/app/lib/mcp/tool.ts +19 -0
  196. package/src/app/lib/registry-api/asset-transfer.ts +119 -11
  197. package/src/app/lib/registry-api/errors.ts +2 -0
  198. package/src/app/lib/registry-api/handler.ts +7 -1
  199. package/src/app/lib/registry-api/transfer.ts +28 -6
  200. package/src/app/lib/server-module.ts +34 -0
  201. package/src/app/lib/utils.ts +20 -0
  202. package/src/app/next.config.mjs +26 -24
  203. package/src/app/pages/[...slug]/index.tsx +2 -1
  204. package/src/app/pages/_app.tsx +6 -2
  205. package/src/app/pages/_document.tsx +6 -0
  206. package/src/app/pages/account/ai.tsx +183 -0
  207. package/src/app/pages/account/index.tsx +68 -68
  208. package/src/app/pages/account/tokens.tsx +37 -7
  209. package/src/app/pages/account/users.tsx +75 -15
  210. package/src/app/pages/api/account/ai/keys/[connectionId].ts +60 -0
  211. package/src/app/pages/api/account/ai/keys/index.ts +20 -0
  212. package/src/app/pages/api/admin/users/[id]/[action].ts +80 -11
  213. package/src/app/pages/api/admin/users/index.ts +2 -2
  214. package/src/app/pages/api/ai/chat.ts +115 -0
  215. package/src/app/pages/api/ai/connections.ts +23 -0
  216. package/src/app/pages/api/auth/request-reset.ts +14 -16
  217. package/src/app/pages/api/docs/nav.json.ts +1 -1
  218. package/src/app/pages/api/install.ts +3 -3
  219. package/src/app/pages/api/mcp.ts +6 -0
  220. package/src/app/pages/api/registry/transfer/assets/blobs/[hash]/complete.ts +11 -0
  221. package/src/app/pages/api/registry/transfer/assets/blobs/[hash]/upload.ts +12 -0
  222. package/src/app/pages/api/registry/transfer/assets/blobs/[hash].ts +1 -1
  223. package/src/app/pages/cli/device.tsx +10 -5
  224. package/src/app/pages/foundations/colors.tsx +9 -8
  225. package/src/app/pages/foundations/index.tsx +3 -3
  226. package/src/app/pages/index.tsx +2 -2
  227. package/src/app/pages/install.tsx +7 -2
  228. package/src/app/pages/login.tsx +32 -27
  229. package/src/app/pages/reset-password.tsx +21 -20
  230. package/src/app/pages/system/component/[component]/index.tsx +2 -5
  231. package/src/app/pages/system/index.tsx +11 -11
  232. package/src/app/pages/system/pattern/[pattern]/index.tsx +2 -2
  233. package/src/app/pages/system/tokens/components/[component]/index.tsx +0 -4
  234. package/src/app-builder/README.md +2 -1
  235. package/src/app-builder/build.ts +218 -73
  236. package/src/app-builder/client-config.ts +3 -2
  237. package/src/app-builder/paths.ts +3 -22
  238. package/src/app-builder/static-export.ts +1 -1
  239. package/src/app-builder/vercel-output.ts +5 -4
  240. package/src/cache/README.md +4 -1
  241. package/src/cache/build-cache.ts +128 -43
  242. package/src/cache/build-inputs.ts +28 -0
  243. package/src/cache/index.ts +4 -0
  244. package/src/cli/create.ts +1 -2
  245. package/src/cli.ts +1 -1
  246. package/src/commands/build/index.ts +1 -1
  247. package/src/config/README.md +10 -9
  248. package/src/config/defaults.ts +7 -4
  249. package/src/config/from-env.ts +33 -0
  250. package/src/config/helpers.ts +1 -3
  251. package/src/config/index.ts +0 -3
  252. package/src/config/loader.ts +25 -3
  253. package/src/config/resolve-env.ts +28 -15
  254. package/src/config/runtime.ts +1 -1
  255. package/src/index.ts +33 -29
  256. package/src/nav/index.ts +2 -2
  257. package/src/nav/registry.ts +3 -3
  258. package/src/nav/workspace.ts +3 -3
  259. package/src/pipeline/README.md +1 -1
  260. package/src/pipeline/figma.ts +98 -49
  261. package/src/pipeline/styles.ts +1 -1
  262. package/src/pipeline/validation.ts +3 -3
  263. package/src/providers.ts +18 -0
  264. package/src/registry/asset-storage/define.ts +6 -6
  265. package/src/registry/asset-storage/resolve.ts +38 -37
  266. package/src/registry/asset-storage/types.ts +39 -17
  267. package/src/registry/auth/ai-keys.ts +62 -0
  268. package/src/registry/auth/crypto.ts +63 -1
  269. package/src/registry/auth/index.ts +11 -1
  270. package/src/registry/checkout/index.ts +60 -138
  271. package/src/registry/client.ts +60 -20
  272. package/src/registry/db/driver.ts +2 -2
  273. package/src/registry/db/schema.ts +49 -22
  274. package/src/registry/email/define.ts +15 -0
  275. package/src/registry/email/providers/smtp.ts +39 -0
  276. package/src/registry/email/resolve.ts +94 -0
  277. package/src/registry/email/types.ts +28 -0
  278. package/src/registry/path.ts +11 -0
  279. package/src/registry/publish/errors.ts +4 -0
  280. package/src/registry/publish/index.ts +3 -1
  281. package/src/registry/publish/package.ts +33 -0
  282. package/src/registry/transfer.ts +4 -0
  283. package/src/store/registry.ts +7 -7
  284. package/src/transformers/preview/component/builder.ts +19 -25
  285. package/src/transformers/preview/component/css.ts +9 -4
  286. package/src/transformers/preview/component/html.ts +6 -2
  287. package/src/transformers/preview/component/javascript.ts +14 -4
  288. package/src/transformers/utils/build.ts +22 -4
  289. package/src/types/config.ts +142 -20
  290. package/src/utils/README.md +1 -1
  291. package/src/utils/path.ts +6 -29
  292. package/templates/default/handoff.config.js.tpl +10 -2
  293. package/templates/default/handoff.config.ts.tpl +10 -2
  294. package/templates/default/handoff.config.with-examples.js.tpl +10 -2
  295. package/templates/default/handoff.config.with-examples.ts.tpl +10 -2
  296. package/templates/default/package.json.tpl +2 -2
  297. package/.editorconfig +0 -19
  298. package/.eslintrc.json +0 -4
  299. package/.prettierignore +0 -0
  300. package/.prettierrc.json +0 -8
  301. package/.vscode/settings.json +0 -17
  302. package/dist/config/validator.d.ts +0 -9
  303. package/dist/config/validator.js +0 -24
  304. package/dist/registry/asset-storage/adapters/vercel-blob.d.ts +0 -17
  305. package/dist/registry/asset-storage/adapters/vercel-blob.js +0 -87
  306. package/src/app/components/old/Header.tsx +0 -89
  307. package/src/app/lib/mcp/shape.ts +0 -596
  308. package/src/app/pages/assets/fonts.tsx +0 -129
  309. package/src/app/pages/assets/index.tsx +0 -91
  310. package/src/app/pages/assets/logos.tsx +0 -75
  311. package/src/config/validator.ts +0 -22
  312. package/src/registry/asset-storage/adapters/vercel-blob.ts +0 -51
@@ -1,17 +0,0 @@
1
- {
2
- "editor.defaultFormatter": "esbenp.prettier-vscode",
3
- "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
4
- "editor.formatOnSave": true,
5
- "editor.codeActionsOnSave": {
6
- "source.organizeImports": "explicit"
7
- },
8
- "[xml]": {
9
- "editor.defaultFormatter": "redhat.vscode-xml"
10
- },
11
- "[typescriptreact]": {
12
- "editor.defaultFormatter": "vscode.typescript-language-features"
13
- },
14
- "[markdown]": {
15
- "editor.defaultFormatter": "unifiedjs.vscode-remark"
16
- }
17
- }
@@ -1,9 +0,0 @@
1
- import { ResolvedConfig } from '../types/config';
2
- /**
3
- * Validates that the configuration has the required Figma credentials.
4
- *
5
- * @param config - The config to validate.
6
- * @returns The validated config (same reference).
7
- * @throws {Error} If required Figma credentials are missing.
8
- */
9
- export declare const validateConfig: (config: ResolvedConfig) => ResolvedConfig;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateConfig = void 0;
4
- const logger_1 = require("../utils/logger");
5
- /**
6
- * Validates that the configuration has the required Figma credentials.
7
- *
8
- * @param config - The config to validate.
9
- * @returns The validated config (same reference).
10
- * @throws {Error} If required Figma credentials are missing.
11
- */
12
- const validateConfig = (config) => {
13
- // TODO: Check to see if the exported folder exists before we run start
14
- if (!config.figma_project_id) {
15
- logger_1.Logger.error('Figma Project ID missing. Please set HANDOFF_FIGMA_PROJECT_ID or run "handoff-app fetch".');
16
- throw new Error('Cannot initialize configuration');
17
- }
18
- if (!config.dev_access_token) {
19
- logger_1.Logger.error('Figma Access Token missing. Please set HANDOFF_DEV_ACCESS_TOKEN or run "handoff-app fetch".');
20
- throw new Error('Cannot initialize configuration');
21
- }
22
- return config;
23
- };
24
- exports.validateConfig = validateConfig;
@@ -1,17 +0,0 @@
1
- /**
2
- * Pre-packaged Vercel Blob asset storage adapter.
3
- *
4
- * Ships with Handoff and is selected via `runtime.registry.assetStorage.adapter: "vercel-blob"`. The
5
- * read/write token is read from `process.env[tokenEnv]` at request time (never persisted in config).
6
- * Blobs are stored public and content-addressed by hash, so reads resolve to a direct provider URL
7
- * (a `redirect` result), keeping large payloads out of the serverless function body/response.
8
- *
9
- * The `@vercel/blob` SDK is loaded lazily so it is only pulled into memory (and traced into the
10
- * registry bundle) when this adapter is actually used.
11
- */
12
- import type { AssetStorage } from '../types';
13
- /** Build a Vercel Blob storage adapter bound to a token env-var name + non-secret options. */
14
- export declare const createVercelBlobStorage: (params: {
15
- tokenEnv: string;
16
- options: Record<string, unknown>;
17
- }) => AssetStorage;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- /**
3
- * Pre-packaged Vercel Blob asset storage adapter.
4
- *
5
- * Ships with Handoff and is selected via `runtime.registry.assetStorage.adapter: "vercel-blob"`. The
6
- * read/write token is read from `process.env[tokenEnv]` at request time (never persisted in config).
7
- * Blobs are stored public and content-addressed by hash, so reads resolve to a direct provider URL
8
- * (a `redirect` result), keeping large payloads out of the serverless function body/response.
9
- *
10
- * The `@vercel/blob` SDK is loaded lazily so it is only pulled into memory (and traced into the
11
- * registry bundle) when this adapter is actually used.
12
- */
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.createVercelBlobStorage = void 0;
47
- /** Build a Vercel Blob storage adapter bound to a token env-var name + non-secret options. */
48
- const createVercelBlobStorage = (params) => {
49
- const prefix = typeof params.options.prefix === 'string' && params.options.prefix.trim() ? params.options.prefix.trim() : 'handoff/assets';
50
- const resolveToken = () => {
51
- var _a;
52
- const token = (_a = process.env[params.tokenEnv]) === null || _a === void 0 ? void 0 : _a.trim();
53
- if (!token) {
54
- throw new Error(`Vercel Blob storage is configured but the token env var "${params.tokenEnv}" is not set. ` +
55
- 'Set it to a Blob read/write token, or change runtime.registry.assetStorage.token.');
56
- }
57
- return token;
58
- };
59
- return {
60
- put(_a) {
61
- return __awaiter(this, arguments, void 0, function* ({ hash, bytes, contentType }) {
62
- const { put } = yield Promise.resolve().then(() => __importStar(require('@vercel/blob')));
63
- // Content-addressed pathname + no random suffix so the same bytes map to a stable, dedupable key.
64
- const result = yield put(`${prefix}/${hash}`, bytes, {
65
- access: 'public',
66
- token: resolveToken(),
67
- contentType,
68
- addRandomSuffix: false,
69
- });
70
- return { storageRef: result.url };
71
- });
72
- },
73
- get(storageRef) {
74
- return __awaiter(this, void 0, void 0, function* () {
75
- // Public blob URLs are directly fetchable; redirect the client to avoid proxying bytes.
76
- return { kind: 'redirect', url: storageRef };
77
- });
78
- },
79
- delete(storageRef) {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- const { del } = yield Promise.resolve().then(() => __importStar(require('@vercel/blob')));
82
- yield del(storageRef, { token: resolveToken() });
83
- });
84
- },
85
- };
86
- };
87
- exports.createVercelBlobStorage = createVercelBlobStorage;
@@ -1,89 +0,0 @@
1
- import { ClientConfig } from '@handoff/types/config';
2
- import Link from 'next/link';
3
- import React from 'react';
4
- import NavLink from '../NavLink';
5
- import { useNav } from '../context/NavProvider';
6
-
7
- interface HeaderProps {
8
- config: ClientConfig;
9
- }
10
-
11
- function Header({ config }: HeaderProps) {
12
- const { menu } = useNav();
13
- const [mobile, setMobile] = React.useState('');
14
- const toggle = () => {
15
- if (mobile === 'is-active') {
16
- setMobile('');
17
- } else {
18
- setMobile('is-active');
19
- }
20
- };
21
-
22
- return (
23
- <>
24
- <header id="site-header" className="c-site-header">
25
- <div className="o-container-fluid">
26
- <div className="c-site-header__wrapper">
27
- <div>
28
- <div className="c-site-menu">
29
- <button className={`c-hamburger-icon c-hamburger-icon--slider ${mobile}`} onClick={toggle}>
30
- <div className="c-hamburger-icon__box">
31
- <div className="c-hamburger-icon__inner"></div>
32
- </div>
33
- </button>
34
- </div>
35
- <div className="c-site-title">
36
- <Link href="/" className="c-site-logo c-site-logo--basic" title="" rel="home" aria-label="logo">
37
- {/* eslint-disable-next-line @next/next/no-img-element */}
38
- <img src={`${process.env.HANDOFF_APP_BASE_PATH ?? ''}/logo.svg`} alt={config?.app?.title} />
39
- </Link>
40
- </div>
41
-
42
- <nav className="c-site-nav">
43
- <ul>
44
- {menu.map((item) => (
45
- <li key={item.path}>
46
- <NavLink href={`${item.path}`}>{item.title}</NavLink>
47
- </li>
48
- ))}
49
- </ul>
50
- </nav>
51
- </div>
52
- <div>
53
- {
54
- // TODO: Reimpliment cmd k search
55
- false && <small>hit cmd+k to search</small>
56
- }
57
- </div>
58
- </div>
59
- </div>
60
- </header>
61
- <div className={`c-offcanvas c-offcanvas--menu ${mobile}`}>
62
- <div className="c-offcanvas__inner">
63
- <nav className="c-mobilenav">
64
- <ul className="c-mobilenav__menu">
65
- {menu.map((item) => (
66
- <li key={`mobile-${item.path}`}>
67
- <NavLink href={`${item.path}`}>{item.title}</NavLink>
68
- {item.subSections.length > 0 && (
69
- <ul className="c-mobilenav__submenu">
70
- {item.subSections
71
- .filter((sub) => sub.path)
72
- .map((sub) => (
73
- <li key={sub.path}>
74
- <NavLink href={`${sub.path}`}>{sub.title}</NavLink>
75
- </li>
76
- ))}
77
- </ul>
78
- )}
79
- </li>
80
- ))}
81
- </ul>
82
- </nav>
83
- </div>
84
- </div>
85
- </>
86
- );
87
- }
88
-
89
- export default Header;