@ahmedrowaihi/pdf-forge-preview 1.0.0-canary.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 (351) hide show
  1. package/.next/BUILD_ID +1 -0
  2. package/.next/app-path-routes-manifest.json +7 -0
  3. package/.next/build/chunks/[root-of-the-server]__12fb5caf._.js +233 -0
  4. package/.next/build/chunks/[root-of-the-server]__12fb5caf._.js.map +8 -0
  5. package/.next/build/chunks/[root-of-the-server]__242deb00._.js +500 -0
  6. package/.next/build/chunks/[root-of-the-server]__242deb00._.js.map +11 -0
  7. package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_ad9a1eec._.js +13 -0
  8. package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_ad9a1eec._.js.map +5 -0
  9. package/.next/build/chunks/[turbopack]_runtime.js +795 -0
  10. package/.next/build/chunks/[turbopack]_runtime.js.map +10 -0
  11. package/.next/build/chunks/node_modules__pnpm_806d01c0._.js +6758 -0
  12. package/.next/build/chunks/node_modules__pnpm_806d01c0._.js.map +47 -0
  13. package/.next/build/package.json +1 -0
  14. package/.next/build/postcss.js +6 -0
  15. package/.next/build/postcss.js.map +5 -0
  16. package/.next/build-manifest.json +20 -0
  17. package/.next/diagnostics/build-diagnostics.json +6 -0
  18. package/.next/diagnostics/framework.json +1 -0
  19. package/.next/export-marker.json +6 -0
  20. package/.next/fallback-build-manifest.json +12 -0
  21. package/.next/images-manifest.json +66 -0
  22. package/.next/next-minimal-server.js.nft.json +1 -0
  23. package/.next/next-server.js.nft.json +1 -0
  24. package/.next/package.json +1 -0
  25. package/.next/prerender-manifest.json +65 -0
  26. package/.next/required-server-files.js +163 -0
  27. package/.next/required-server-files.json +163 -0
  28. package/.next/routes-manifest.json +77 -0
  29. package/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
  30. package/.next/server/app/_global-error/page/build-manifest.json +17 -0
  31. package/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
  32. package/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
  33. package/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
  34. package/.next/server/app/_global-error/page.js +11 -0
  35. package/.next/server/app/_global-error/page.js.map +5 -0
  36. package/.next/server/app/_global-error/page.js.nft.json +1 -0
  37. package/.next/server/app/_global-error/page_client-reference-manifest.js +2 -0
  38. package/.next/server/app/_global-error.html +2 -0
  39. package/.next/server/app/_global-error.meta +15 -0
  40. package/.next/server/app/_global-error.rsc +13 -0
  41. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
  42. package/.next/server/app/_global-error.segments/_full.segment.rsc +13 -0
  43. package/.next/server/app/_global-error.segments/_head.segment.rsc +6 -0
  44. package/.next/server/app/_global-error.segments/_index.segment.rsc +4 -0
  45. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  46. package/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
  47. package/.next/server/app/_not-found/page/build-manifest.json +17 -0
  48. package/.next/server/app/_not-found/page/next-font-manifest.json +16 -0
  49. package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
  50. package/.next/server/app/_not-found/page/server-reference-manifest.json +20 -0
  51. package/.next/server/app/_not-found/page.js +14 -0
  52. package/.next/server/app/_not-found/page.js.map +5 -0
  53. package/.next/server/app/_not-found/page.js.nft.json +1 -0
  54. package/.next/server/app/_not-found/page_client-reference-manifest.js +2 -0
  55. package/.next/server/app/favicon.ico/route/app-paths-manifest.json +3 -0
  56. package/.next/server/app/favicon.ico/route/build-manifest.json +11 -0
  57. package/.next/server/app/favicon.ico/route.js +6 -0
  58. package/.next/server/app/favicon.ico/route.js.map +5 -0
  59. package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
  60. package/.next/server/app/favicon.ico.body +0 -0
  61. package/.next/server/app/favicon.ico.meta +1 -0
  62. package/.next/server/app/page/app-paths-manifest.json +3 -0
  63. package/.next/server/app/page/build-manifest.json +17 -0
  64. package/.next/server/app/page/next-font-manifest.json +16 -0
  65. package/.next/server/app/page/react-loadable-manifest.json +1 -0
  66. package/.next/server/app/page/server-reference-manifest.json +20 -0
  67. package/.next/server/app/page.js +17 -0
  68. package/.next/server/app/page.js.map +5 -0
  69. package/.next/server/app/page.js.nft.json +1 -0
  70. package/.next/server/app/page_client-reference-manifest.js +2 -0
  71. package/.next/server/app/preview/[...slug]/page/app-paths-manifest.json +3 -0
  72. package/.next/server/app/preview/[...slug]/page/build-manifest.json +17 -0
  73. package/.next/server/app/preview/[...slug]/page/next-font-manifest.json +16 -0
  74. package/.next/server/app/preview/[...slug]/page/react-loadable-manifest.json +1 -0
  75. package/.next/server/app/preview/[...slug]/page/server-reference-manifest.json +65 -0
  76. package/.next/server/app/preview/[...slug]/page.js +19 -0
  77. package/.next/server/app/preview/[...slug]/page.js.map +5 -0
  78. package/.next/server/app/preview/[...slug]/page.js.nft.json +1 -0
  79. package/.next/server/app/preview/[...slug]/page_client-reference-manifest.js +2 -0
  80. package/.next/server/app-paths-manifest.json +7 -0
  81. package/.next/server/chunks/730ea_preview-server__next-internal_server_app_favicon_ico_route_actions_a71a8ae7.js +3 -0
  82. package/.next/server/chunks/730ea_preview-server__next-internal_server_app_favicon_ico_route_actions_a71a8ae7.js.map +1 -0
  83. package/.next/server/chunks/[externals]_next_dist_a6d89067._.js +3 -0
  84. package/.next/server/chunks/[externals]_next_dist_a6d89067._.js.map +1 -0
  85. package/.next/server/chunks/[root-of-the-server]__a62cd78d._.js +21 -0
  86. package/.next/server/chunks/[root-of-the-server]__a62cd78d._.js.map +1 -0
  87. package/.next/server/chunks/[turbopack]_runtime.js +795 -0
  88. package/.next/server/chunks/[turbopack]_runtime.js.map +10 -0
  89. package/.next/server/chunks/ssr/730ea_preview-server__next-internal_server_app__global-error_page_actions_986e2de5.js +3 -0
  90. package/.next/server/chunks/ssr/730ea_preview-server__next-internal_server_app__global-error_page_actions_986e2de5.js.map +1 -0
  91. package/.next/server/chunks/ssr/[root-of-the-server]__025eaae9._.js +3 -0
  92. package/.next/server/chunks/ssr/[root-of-the-server]__025eaae9._.js.map +1 -0
  93. package/.next/server/chunks/ssr/[root-of-the-server]__1536282c._.js +4 -0
  94. package/.next/server/chunks/ssr/[root-of-the-server]__1536282c._.js.map +1 -0
  95. package/.next/server/chunks/ssr/[root-of-the-server]__15cf9d36._.js +3 -0
  96. package/.next/server/chunks/ssr/[root-of-the-server]__15cf9d36._.js.map +1 -0
  97. package/.next/server/chunks/ssr/[root-of-the-server]__450f653e._.js +3 -0
  98. package/.next/server/chunks/ssr/[root-of-the-server]__450f653e._.js.map +1 -0
  99. package/.next/server/chunks/ssr/[root-of-the-server]__4874d0d7._.js +3 -0
  100. package/.next/server/chunks/ssr/[root-of-the-server]__4874d0d7._.js.map +1 -0
  101. package/.next/server/chunks/ssr/[root-of-the-server]__49771cdc._.js +3 -0
  102. package/.next/server/chunks/ssr/[root-of-the-server]__49771cdc._.js.map +1 -0
  103. package/.next/server/chunks/ssr/[root-of-the-server]__9ff74047._.js +3 -0
  104. package/.next/server/chunks/ssr/[root-of-the-server]__9ff74047._.js.map +1 -0
  105. package/.next/server/chunks/ssr/[root-of-the-server]__a9be37b1._.js +3 -0
  106. package/.next/server/chunks/ssr/[root-of-the-server]__a9be37b1._.js.map +1 -0
  107. package/.next/server/chunks/ssr/[root-of-the-server]__aeefe74e._.js +3 -0
  108. package/.next/server/chunks/ssr/[root-of-the-server]__aeefe74e._.js.map +1 -0
  109. package/.next/server/chunks/ssr/[root-of-the-server]__b13738d2._.js +3 -0
  110. package/.next/server/chunks/ssr/[root-of-the-server]__b13738d2._.js.map +1 -0
  111. package/.next/server/chunks/ssr/[root-of-the-server]__bb428c83._.js +4 -0
  112. package/.next/server/chunks/ssr/[root-of-the-server]__bb428c83._.js.map +1 -0
  113. package/.next/server/chunks/ssr/[root-of-the-server]__c61333e3._.js +10 -0
  114. package/.next/server/chunks/ssr/[root-of-the-server]__c61333e3._.js.map +1 -0
  115. package/.next/server/chunks/ssr/[root-of-the-server]__cb0c7b1a._.js +4 -0
  116. package/.next/server/chunks/ssr/[root-of-the-server]__cb0c7b1a._.js.map +1 -0
  117. package/.next/server/chunks/ssr/[root-of-the-server]__dafcae4c._.js +3 -0
  118. package/.next/server/chunks/ssr/[root-of-the-server]__dafcae4c._.js.map +1 -0
  119. package/.next/server/chunks/ssr/[root-of-the-server]__e47d0c07._.js +3 -0
  120. package/.next/server/chunks/ssr/[root-of-the-server]__e47d0c07._.js.map +1 -0
  121. package/.next/server/chunks/ssr/[root-of-the-server]__ecac8617._.js +31 -0
  122. package/.next/server/chunks/ssr/[root-of-the-server]__ecac8617._.js.map +1 -0
  123. package/.next/server/chunks/ssr/[root-of-the-server]__fd4bda25._.js +3 -0
  124. package/.next/server/chunks/ssr/[root-of-the-server]__fd4bda25._.js.map +1 -0
  125. package/.next/server/chunks/ssr/[turbopack]_runtime.js +795 -0
  126. package/.next/server/chunks/ssr/[turbopack]_runtime.js.map +10 -0
  127. package/.next/server/chunks/ssr/_19494208._.js +19 -0
  128. package/.next/server/chunks/ssr/_19494208._.js.map +1 -0
  129. package/.next/server/chunks/ssr/_810f54e9._.js +4 -0
  130. package/.next/server/chunks/ssr/_810f54e9._.js.map +1 -0
  131. package/.next/server/chunks/ssr/_aa01e67e._.js +4 -0
  132. package/.next/server/chunks/ssr/_aa01e67e._.js.map +1 -0
  133. package/.next/server/chunks/ssr/_bf10718b._.js +4 -0
  134. package/.next/server/chunks/ssr/_bf10718b._.js.map +1 -0
  135. package/.next/server/chunks/ssr/_c57c12df._.js +4 -0
  136. package/.next/server/chunks/ssr/_c57c12df._.js.map +1 -0
  137. package/.next/server/chunks/ssr/_d9b57cb8._.js +5 -0
  138. package/.next/server/chunks/ssr/_d9b57cb8._.js.map +1 -0
  139. package/.next/server/chunks/ssr/_e2a766a8._.js +3 -0
  140. package/.next/server/chunks/ssr/_e2a766a8._.js.map +1 -0
  141. package/.next/server/chunks/ssr/_e2b86512._.js +8 -0
  142. package/.next/server/chunks/ssr/_e2b86512._.js.map +1 -0
  143. package/.next/server/chunks/ssr/_ee8ea3aa._.js +19 -0
  144. package/.next/server/chunks/ssr/_ee8ea3aa._.js.map +1 -0
  145. package/.next/server/chunks/ssr/e8449_next_dist_5870db32._.js +3 -0
  146. package/.next/server/chunks/ssr/e8449_next_dist_5870db32._.js.map +1 -0
  147. package/.next/server/chunks/ssr/e8449_next_dist_client_components_builtin_forbidden_5542069c.js +3 -0
  148. package/.next/server/chunks/ssr/e8449_next_dist_client_components_builtin_forbidden_5542069c.js.map +1 -0
  149. package/.next/server/chunks/ssr/e8449_next_dist_client_components_builtin_global-error_d0870f3a.js +3 -0
  150. package/.next/server/chunks/ssr/e8449_next_dist_client_components_builtin_global-error_d0870f3a.js.map +1 -0
  151. package/.next/server/chunks/ssr/e8449_next_dist_client_components_builtin_unauthorized_4c01c8d5.js +3 -0
  152. package/.next/server/chunks/ssr/e8449_next_dist_client_components_builtin_unauthorized_4c01c8d5.js.map +1 -0
  153. package/.next/server/chunks/ssr/e8449_next_dist_client_components_d90ace34._.js +3 -0
  154. package/.next/server/chunks/ssr/e8449_next_dist_client_components_d90ace34._.js.map +1 -0
  155. package/.next/server/chunks/ssr/e8449_next_dist_esm_af7aafb8._.js +6 -0
  156. package/.next/server/chunks/ssr/e8449_next_dist_esm_af7aafb8._.js.map +1 -0
  157. package/.next/server/chunks/ssr/e8449_next_dist_esm_build_templates_app-page_f16f0848.js +4 -0
  158. package/.next/server/chunks/ssr/e8449_next_dist_esm_build_templates_app-page_f16f0848.js.map +1 -0
  159. package/.next/server/chunks/ssr/e8449_next_dist_f0d8a2cc._.js +4 -0
  160. package/.next/server/chunks/ssr/e8449_next_dist_f0d8a2cc._.js.map +1 -0
  161. package/.next/server/chunks/ssr/node_modules__pnpm_37510d96._.js +5 -0
  162. package/.next/server/chunks/ssr/node_modules__pnpm_37510d96._.js.map +1 -0
  163. package/.next/server/chunks/ssr/packages_preview-server_src_app_897ecf1c._.js +3 -0
  164. package/.next/server/chunks/ssr/packages_preview-server_src_app_897ecf1c._.js.map +1 -0
  165. package/.next/server/chunks/ssr/packages_preview-server_src_e17a2a9b._.js +3 -0
  166. package/.next/server/chunks/ssr/packages_preview-server_src_e17a2a9b._.js.map +1 -0
  167. package/.next/server/functions-config-manifest.json +4 -0
  168. package/.next/server/interception-route-rewrite-manifest.js +1 -0
  169. package/.next/server/middleware-build-manifest.js +21 -0
  170. package/.next/server/middleware-manifest.json +6 -0
  171. package/.next/server/next-font-manifest.js +1 -0
  172. package/.next/server/next-font-manifest.json +34 -0
  173. package/.next/server/pages/500.html +2 -0
  174. package/.next/server/pages-manifest.json +3 -0
  175. package/.next/server/server-reference-manifest.js +1 -0
  176. package/.next/server/server-reference-manifest.json +80 -0
  177. package/.next/static/cdYIhKFtJ0GB-yJK5ywz_/_buildManifest.js +11 -0
  178. package/.next/static/cdYIhKFtJ0GB-yJK5ywz_/_clientMiddlewareManifest.json +1 -0
  179. package/.next/static/cdYIhKFtJ0GB-yJK5ywz_/_ssgManifest.js +1 -0
  180. package/.next/static/chunks/0464c7ff175ee6ff.js +1 -0
  181. package/.next/static/chunks/10468413db24762a.js +14 -0
  182. package/.next/static/chunks/2de338262e51ef94.js +3 -0
  183. package/.next/static/chunks/37adc260f85da877.js +1 -0
  184. package/.next/static/chunks/521eee9903bc4d1f.js +5 -0
  185. package/.next/static/chunks/6051bd38272cb442.js +14 -0
  186. package/.next/static/chunks/8d433d4b9d701456.js +1 -0
  187. package/.next/static/chunks/92ba72595aad9df6.js +1 -0
  188. package/.next/static/chunks/959ed978a6e89a66.js +1 -0
  189. package/.next/static/chunks/a6dad97d9634a72d.js +1 -0
  190. package/.next/static/chunks/a6dad97d9634a72d.js.map +1 -0
  191. package/.next/static/chunks/a6db6456c5b75734.js +1 -0
  192. package/.next/static/chunks/c3ece0a7e3e07076.js +1 -0
  193. package/.next/static/chunks/d1b29a74f6814a03.css +3 -0
  194. package/.next/static/chunks/f7ec22614fe1c1fe.js +1 -0
  195. package/.next/static/chunks/turbopack-e062a8e6d6034eb0.js +4 -0
  196. package/.next/static/media/1bffadaabf893a1e-s.7cd81963.woff2 +0 -0
  197. package/.next/static/media/2bbe8d2671613f1f-s.76dcb0b2.woff2 +0 -0
  198. package/.next/static/media/2c55a0e60120577a-s.2a48534a.woff2 +0 -0
  199. package/.next/static/media/5476f68d60460930-s.c995e352.woff2 +0 -0
  200. package/.next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2 +0 -0
  201. package/.next/static/media/9c72aa0f40e4eef8-s.18a48cbc.woff2 +0 -0
  202. package/.next/static/media/SFMonoBold-s.p.b90ec775.otf +0 -0
  203. package/.next/static/media/SFMonoHeavy-s.p.545fe93b.otf +0 -0
  204. package/.next/static/media/SFMonoLight-s.p.7c5363a6.otf +0 -0
  205. package/.next/static/media/SFMonoMedium-s.p.a4fc9904.otf +0 -0
  206. package/.next/static/media/SFMonoRegular-s.p.04ea7bf3.otf +0 -0
  207. package/.next/static/media/SFMonoSemibold-s.p.2d2ddb43.otf +0 -0
  208. package/.next/static/media/ad66f9afd8947f86-s.7a40eb73.woff2 +0 -0
  209. package/.next/static/media/favicon.678eb597.ico +0 -0
  210. package/.next/static/media/logo.22a370b0.png +0 -0
  211. package/.next/trace +1 -0
  212. package/.next/trace-build +1 -0
  213. package/.next/turbopack +0 -0
  214. package/.next/types/routes.d.ts +58 -0
  215. package/.next/types/validator.ts +70 -0
  216. package/CHANGELOG.md +12 -0
  217. package/LICENSE.md +8 -0
  218. package/index.mjs +17 -0
  219. package/jsx-runtime/jsx-dev-runtime.js +26 -0
  220. package/module-punycode.d.ts +3 -0
  221. package/next-env.d.ts +6 -0
  222. package/next.config.mjs +15 -0
  223. package/package.json +78 -0
  224. package/postcss.config.js +5 -0
  225. package/readme.md +33 -0
  226. package/scripts/build-preview-server.mts +25 -0
  227. package/scripts/dev.mts +57 -0
  228. package/scripts/seed.mts +36 -0
  229. package/src/actions/export-single-template.ts +74 -0
  230. package/src/actions/get-template-path-from-slug.ts +32 -0
  231. package/src/actions/get-templates-directory-metadata-action.ts +19 -0
  232. package/src/actions/render-template-by-path.tsx +313 -0
  233. package/src/actions/safe-action.ts +15 -0
  234. package/src/animated-icons-data/help.json +1082 -0
  235. package/src/animated-icons-data/link.json +1309 -0
  236. package/src/animated-icons-data/load.json +443 -0
  237. package/src/animated-icons-data/mail.json +1320 -0
  238. package/src/app/env.ts +14 -0
  239. package/src/app/favicon.ico +0 -0
  240. package/src/app/fonts/SFMono/SFMonoBold.otf +0 -0
  241. package/src/app/fonts/SFMono/SFMonoBoldItalic.otf +0 -0
  242. package/src/app/fonts/SFMono/SFMonoHeavy.otf +0 -0
  243. package/src/app/fonts/SFMono/SFMonoHeavyItalic.otf +0 -0
  244. package/src/app/fonts/SFMono/SFMonoLight.otf +0 -0
  245. package/src/app/fonts/SFMono/SFMonoLightItalic.otf +0 -0
  246. package/src/app/fonts/SFMono/SFMonoMedium.otf +0 -0
  247. package/src/app/fonts/SFMono/SFMonoMediumItalic.otf +0 -0
  248. package/src/app/fonts/SFMono/SFMonoRegular.otf +0 -0
  249. package/src/app/fonts/SFMono/SFMonoRegularItalic.otf +0 -0
  250. package/src/app/fonts/SFMono/SFMonoSemibold.otf +0 -0
  251. package/src/app/fonts/SFMono/SFMonoSemiboldItalic.otf +0 -0
  252. package/src/app/fonts.ts +39 -0
  253. package/src/app/globals.css +136 -0
  254. package/src/app/layout.tsx +46 -0
  255. package/src/app/logo.png +0 -0
  256. package/src/app/page.tsx +52 -0
  257. package/src/app/preview/[...slug]/download-button.tsx +138 -0
  258. package/src/app/preview/[...slug]/error-overlay.tsx +58 -0
  259. package/src/app/preview/[...slug]/page.tsx +90 -0
  260. package/src/app/preview/[...slug]/preview.tsx +249 -0
  261. package/src/app/preview/[...slug]/template-frame.tsx +68 -0
  262. package/src/components/button.tsx +101 -0
  263. package/src/components/code-container.tsx +169 -0
  264. package/src/components/code-snippet.tsx +9 -0
  265. package/src/components/code.tsx +185 -0
  266. package/src/components/heading.tsx +113 -0
  267. package/src/components/icons/icon-arrow-down.tsx +16 -0
  268. package/src/components/icons/icon-base.tsx +26 -0
  269. package/src/components/icons/icon-bug.tsx +19 -0
  270. package/src/components/icons/icon-button.tsx +23 -0
  271. package/src/components/icons/icon-check.tsx +19 -0
  272. package/src/components/icons/icon-clipboard.tsx +40 -0
  273. package/src/components/icons/icon-cloud-alert.tsx +18 -0
  274. package/src/components/icons/icon-cloud-check.tsx +17 -0
  275. package/src/components/icons/icon-download.tsx +19 -0
  276. package/src/components/icons/icon-file.tsx +19 -0
  277. package/src/components/icons/icon-folder-open.tsx +19 -0
  278. package/src/components/icons/icon-folder.tsx +18 -0
  279. package/src/components/icons/icon-hide-sidebar.tsx +23 -0
  280. package/src/components/icons/icon-image.tsx +19 -0
  281. package/src/components/icons/icon-info.tsx +18 -0
  282. package/src/components/icons/icon-link.tsx +14 -0
  283. package/src/components/icons/icon-loader.tsx +16 -0
  284. package/src/components/icons/icon-monitor.tsx +19 -0
  285. package/src/components/icons/icon-moon.tsx +16 -0
  286. package/src/components/icons/icon-phone.tsx +26 -0
  287. package/src/components/icons/icon-reload.tsx +18 -0
  288. package/src/components/icons/icon-source.tsx +19 -0
  289. package/src/components/icons/icon-stamp.tsx +14 -0
  290. package/src/components/icons/icon-sun.tsx +74 -0
  291. package/src/components/icons/icon-warning.tsx +31 -0
  292. package/src/components/index.ts +7 -0
  293. package/src/components/logo.tsx +41 -0
  294. package/src/components/resizable-wrapper.tsx +269 -0
  295. package/src/components/shell.tsx +95 -0
  296. package/src/components/sidebar/file-tree-directory-children.tsx +142 -0
  297. package/src/components/sidebar/file-tree-directory.tsx +92 -0
  298. package/src/components/sidebar/file-tree.tsx +31 -0
  299. package/src/components/sidebar/index.ts +1 -0
  300. package/src/components/sidebar/sidebar.tsx +46 -0
  301. package/src/components/text.tsx +99 -0
  302. package/src/components/toolbar/checking-results.tsx +150 -0
  303. package/src/components/toolbar/code-preview-line-link.tsx +39 -0
  304. package/src/components/toolbar/results-table.tsx +0 -0
  305. package/src/components/toolbar/results.tsx +52 -0
  306. package/src/components/toolbar/toolbar-button.tsx +52 -0
  307. package/src/components/toolbar/use-cached-state.ts +36 -0
  308. package/src/components/toolbar.tsx +182 -0
  309. package/src/components/tooltip-content.tsx +31 -0
  310. package/src/components/tooltip.tsx +19 -0
  311. package/src/components/topbar/active-view-toggle-group.tsx +86 -0
  312. package/src/components/topbar/emulated-dark-mode-toggle.tsx +58 -0
  313. package/src/components/topbar/view-size-controls.tsx +173 -0
  314. package/src/components/topbar.tsx +59 -0
  315. package/src/contexts/preview.tsx +91 -0
  316. package/src/contexts/templates.tsx +57 -0
  317. package/src/contexts/toolbar.tsx +22 -0
  318. package/src/hooks/use-clamped-state.ts +24 -0
  319. package/src/hooks/use-fragment-identifier.ts +14 -0
  320. package/src/hooks/use-hot-reload.ts +31 -0
  321. package/src/hooks/use-rendering-metadata.ts +37 -0
  322. package/src/hooks/use-template-rendering-result.ts +58 -0
  323. package/src/utils/cn.ts +6 -0
  324. package/src/utils/constants.ts +8 -0
  325. package/src/utils/contains-template.ts +52 -0
  326. package/src/utils/convert-stack-with-sourcemap.ts +79 -0
  327. package/src/utils/copy-text-to-clipboard.ts +7 -0
  328. package/src/utils/create-jsx-runtime.ts +47 -0
  329. package/src/utils/esbuild/escape-string-for-regex.ts +3 -0
  330. package/src/utils/esbuild/renderring-utilities-exporter.ts +64 -0
  331. package/src/utils/get-line-and-column-from-offset.ts +11 -0
  332. package/src/utils/get-template-component.ts +158 -0
  333. package/src/utils/get-templates-directory-metadata.ts +195 -0
  334. package/src/utils/index.ts +6 -0
  335. package/src/utils/language-map.ts +7 -0
  336. package/src/utils/load-stream.ts +15 -0
  337. package/src/utils/register-spinner-autostopping.ts +28 -0
  338. package/src/utils/result.ts +49 -0
  339. package/src/utils/run-bundled-code.ts +86 -0
  340. package/src/utils/sanitize.ts +6 -0
  341. package/src/utils/sleep.ts +3 -0
  342. package/src/utils/snake-to-camel.ts +5 -0
  343. package/src/utils/static-node-modules-for-vm.ts +93 -0
  344. package/src/utils/style-text.ts +11 -0
  345. package/src/utils/types/as.ts +26 -0
  346. package/src/utils/types/error-object.ts +11 -0
  347. package/src/utils/types/hot-reload-change.ts +13 -0
  348. package/src/utils/types/template.ts +8 -0
  349. package/src/utils/unreachable.ts +8 -0
  350. package/templates/.gitkeep +0 -0
  351. package/tsconfig.json +47 -0
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import type { IconElement, IconProps } from './icon-base';
3
+ import { IconBase } from './icon-base';
4
+
5
+ export const IconMonitor = React.forwardRef<IconElement, Readonly<IconProps>>(
6
+ ({ ...props }, forwardedRef) => (
7
+ <IconBase ref={forwardedRef} {...props}>
8
+ <path
9
+ d="M9.75 15.25H17.25C18.3546 15.25 19.25 14.3546 19.25 13.25V6.75C19.25 5.64543 18.3546 4.75 17.25 4.75H6.75C5.64543 4.75 4.75 5.64543 4.75 6.75V13.25C4.75 14.3546 5.64543 15.25 6.75 15.25H9.75ZM9.75 15.25C9.75 15.25 10 18.25 8 19.25H16C14 18.25 14.25 15.25 14.25 15.25"
10
+ stroke="currentColor"
11
+ strokeLinecap="round"
12
+ strokeLinejoin="round"
13
+ strokeWidth="1.5"
14
+ />
15
+ </IconBase>
16
+ ),
17
+ );
18
+
19
+ IconMonitor.displayName = 'IconMonitor';
@@ -0,0 +1,16 @@
1
+ import type { IconProps } from './icon-base';
2
+ import { IconBase } from './icon-base';
3
+
4
+ export const IconMoon = ({ ...props }: IconProps) => (
5
+ <IconBase {...props}>
6
+ <path
7
+ stroke="currentColor"
8
+ strokeWidth="2"
9
+ strokeLinecap="round"
10
+ strokeLinejoin="round"
11
+ d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"
12
+ />
13
+ </IconBase>
14
+ );
15
+
16
+ IconMoon.displayName = 'IconMoon';
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+ import type { IconElement, IconProps } from './icon-base';
3
+ import { IconBase } from './icon-base';
4
+
5
+ export const IconPhone = React.forwardRef<IconElement, Readonly<IconProps>>(
6
+ ({ ...props }, forwardedRef) => (
7
+ <IconBase ref={forwardedRef} {...props}>
8
+ <path
9
+ d="M6.75 6.75C6.75 5.64543 7.64543 4.75 8.75 4.75H15.25C16.3546 4.75 17.25 5.64543 17.25 6.75V17.25C17.25 18.3546 16.3546 19.25 15.25 19.25H8.75C7.64543 19.25 6.75 18.3546 6.75 17.25V6.75Z"
10
+ stroke="currentColor"
11
+ strokeLinecap="round"
12
+ strokeLinejoin="round"
13
+ strokeWidth="1.5"
14
+ />
15
+ <path
16
+ d="M12.25 16.75H11.75"
17
+ stroke="currentColor"
18
+ strokeLinecap="round"
19
+ strokeLinejoin="round"
20
+ strokeWidth="1.5"
21
+ />
22
+ </IconBase>
23
+ ),
24
+ );
25
+
26
+ IconPhone.displayName = 'IconPhone';
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import type { IconElement, IconProps } from './icon-base';
3
+ import { IconBase } from './icon-base';
4
+
5
+ export const IconReload = React.forwardRef<IconElement, Readonly<IconProps>>(
6
+ ({ ...props }, forwardedRef) => (
7
+ <IconBase ref={forwardedRef} {...props}>
8
+ <path
9
+ fillRule="evenodd"
10
+ clipRule="evenodd"
11
+ d="M17.9354 12C17.9354 9.01537 15.5828 6.05264 11.9202 6.05264C8.96229 6.05264 7.50033 8.21724 6.87735 9.36841H8.72625C9.02024 9.36841 9.25858 9.60406 9.25858 9.89473C9.25858 10.1854 9.02024 10.421 8.72625 10.421H5.53232C5.23833 10.421 5 10.1854 5 9.89473V6.73684C5 6.44617 5.23833 6.21052 5.53232 6.21052C5.82631 6.21052 6.06465 6.44617 6.06465 6.73684V8.64548C6.81471 7.33819 8.54959 5 11.9202 5C16.2456 5 19 8.51094 19 12C19 15.4891 16.2456 19 11.9202 19C9.8507 19 8.12769 18.1904 6.9009 16.9562C6.24405 16.2954 5.73107 15.5148 5.38132 14.6744C5.26942 14.4057 5.39911 14.0981 5.67098 13.9875C5.94285 13.8768 6.25395 14.0051 6.36583 14.2738C6.66482 14.9921 7.10262 15.6574 7.66023 16.2183C8.69486 17.2593 10.1475 17.9474 11.9202 17.9474C15.5828 17.9474 17.9354 14.9846 17.9354 12Z"
12
+ fill="currentColor"
13
+ />
14
+ </IconBase>
15
+ ),
16
+ );
17
+
18
+ IconReload.displayName = 'IconReload';
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import type { IconElement, IconProps } from './icon-base';
3
+ import { IconBase } from './icon-base';
4
+
5
+ export const IconSource = React.forwardRef<IconElement, Readonly<IconProps>>(
6
+ ({ ...props }, forwardedRef) => (
7
+ <IconBase ref={forwardedRef} {...props}>
8
+ <path
9
+ d="M17.4 15L21 11.5L17.4 8M6.6 8L3 11.5L6.6 15M14.25 4.5L9.75 18.5"
10
+ stroke="currentColor"
11
+ strokeLinecap="round"
12
+ strokeLinejoin="round"
13
+ strokeWidth="1.5"
14
+ />
15
+ </IconBase>
16
+ ),
17
+ );
18
+
19
+ IconSource.displayName = 'IconSource';
@@ -0,0 +1,14 @@
1
+ import { forwardRef } from 'react';
2
+ import type { IconElement, IconProps } from './icon-base';
3
+ import { IconBase } from './icon-base';
4
+
5
+ export const IconStamp = forwardRef<IconElement, IconProps>((props, ref) => (
6
+ <IconBase {...props} ref={ref}>
7
+ <path
8
+ d="M9.122 4.388A2.25 2.25 0 0 1 11.368 2h1.31a2.25 2.25 0 0 1 2.247 2.388l-.604 9.862h4.202a2.25 2.25 0 0 1 2.25 2.25v3.25a.75.75 0 0 1-.75.75h-.5v.75a.75.75 0 0 1-.75.75h-13.5a.75.75 0 0 1-.75-.75v-.75h-.5a.75.75 0 0 1-.75-.75V16.5a2.25 2.25 0 0 1 2.25-2.25h4.203zM19.273 19v-2.5a.75.75 0 0 0-.75-.75h-13a.75.75 0 0 0-.75.75V19zM13.427 4.296a.75.75 0 0 0-.748-.796h-1.31a.75.75 0 0 0-.75.796l.61 9.954h1.589z"
9
+ fill="currentColor"
10
+ />
11
+ </IconBase>
12
+ ));
13
+
14
+ IconStamp.displayName = 'IconStamp';
@@ -0,0 +1,74 @@
1
+ import type { IconProps } from './icon-base';
2
+ import { IconBase } from './icon-base';
3
+
4
+ export const IconSun = ({ ...props }: IconProps) => (
5
+ <IconBase {...props}>
6
+ <circle
7
+ cx="12"
8
+ cy="12"
9
+ r="4"
10
+ stroke="currentColor"
11
+ strokeWidth="2"
12
+ strokeLinecap="round"
13
+ strokeLinejoin="round"
14
+ />
15
+ <path
16
+ stroke="currentColor"
17
+ strokeWidth="2"
18
+ strokeLinecap="round"
19
+ strokeLinejoin="round"
20
+ d="M12 2v2"
21
+ />
22
+ <path
23
+ stroke="currentColor"
24
+ strokeWidth="2"
25
+ strokeLinecap="round"
26
+ strokeLinejoin="round"
27
+ d="M12 20v2"
28
+ />
29
+ <path
30
+ stroke="currentColor"
31
+ strokeWidth="2"
32
+ strokeLinecap="round"
33
+ strokeLinejoin="round"
34
+ d="m4.93 4.93 1.41 1.41"
35
+ />
36
+ <path
37
+ stroke="currentColor"
38
+ strokeWidth="2"
39
+ strokeLinecap="round"
40
+ strokeLinejoin="round"
41
+ d="m17.66 17.66 1.41 1.41"
42
+ />
43
+ <path
44
+ stroke="currentColor"
45
+ strokeWidth="2"
46
+ strokeLinecap="round"
47
+ strokeLinejoin="round"
48
+ d="M2 12h2"
49
+ />
50
+ <path
51
+ stroke="currentColor"
52
+ strokeWidth="2"
53
+ strokeLinecap="round"
54
+ strokeLinejoin="round"
55
+ d="M20 12h2"
56
+ />
57
+ <path
58
+ stroke="currentColor"
59
+ strokeWidth="2"
60
+ strokeLinecap="round"
61
+ strokeLinejoin="round"
62
+ d="m6.34 17.66-1.41 1.41"
63
+ />
64
+ <path
65
+ stroke="currentColor"
66
+ strokeWidth="2"
67
+ strokeLinecap="round"
68
+ strokeLinejoin="round"
69
+ d="m19.07 4.93-1.41 1.41"
70
+ />
71
+ </IconBase>
72
+ );
73
+
74
+ IconSun.displayName = 'IconSun';
@@ -0,0 +1,31 @@
1
+ export const IconWarning = (props: React.ComponentProps<'svg'>) => (
2
+ <svg
3
+ width="13"
4
+ height="12"
5
+ viewBox="0 0 13 12"
6
+ fill="none"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ {...props}
9
+ >
10
+ <path
11
+ d="M10.8777 8.99999L6.87766 1.99999C6.79044 1.84609 6.66396 1.71808 6.51112 1.62902C6.35828 1.53997 6.18455 1.49304 6.00766 1.49304C5.83077 1.49304 5.65704 1.53997 5.5042 1.62902C5.35136 1.71808 5.22488 1.84609 5.13766 1.99999L1.13766 8.99999C1.0495 9.15267 1.00327 9.32594 1.00366 9.50224C1.00405 9.67855 1.05105 9.85161 1.13988 10.0039C1.22872 10.1562 1.35623 10.2823 1.50951 10.3694C1.66278 10.4565 1.83636 10.5016 2.01266 10.5H10.0127C10.1881 10.4998 10.3604 10.4535 10.5123 10.3656C10.6642 10.2778 10.7903 10.1515 10.8779 9.99955C10.9656 9.84756 11.0117 9.67518 11.0116 9.49973C11.0116 9.32428 10.9654 9.15193 10.8777 8.99999Z"
12
+ stroke="currentColor"
13
+ strokeLinecap="round"
14
+ strokeLinejoin="round"
15
+ />
16
+ <path
17
+ d="M6.0127 4.5V6.5"
18
+ stroke="currentColor"
19
+ strokeLinecap="round"
20
+ strokeLinejoin="round"
21
+ />
22
+ <path
23
+ d="M6.0127 8.5H6.01853"
24
+ stroke="currentColor"
25
+ strokeLinecap="round"
26
+ strokeLinejoin="round"
27
+ />
28
+ </svg>
29
+ );
30
+
31
+ IconWarning.displayName = 'IconCircleWarning';
@@ -0,0 +1,7 @@
1
+ export * from './button';
2
+ export * from './code';
3
+ export * from './heading';
4
+ export * from './logo';
5
+ export * from './sidebar';
6
+ export * from './text';
7
+ export * from './topbar';
@@ -0,0 +1,41 @@
1
+ import * as React from 'react';
2
+
3
+ export const Logo = () => {
4
+ const id = React.useId();
5
+ return (
6
+ <svg
7
+ fill="none"
8
+ height="30"
9
+ viewBox="0 0 180 32"
10
+ width="180"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ style={{ opacity: 0.9 }}
13
+ >
14
+ <g clipPath={`url(#${id})`}>
15
+ <path
16
+ clipRule="evenodd"
17
+ d="M24.4558 24.4853C25.2339 23.7073 25.3805 22.6549 25.2947 21.746C25.2078 20.8254 24.8697 19.8258 24.3896 18.8287C23.957 17.9302 23.3802 16.9745 22.6821 16C23.3802 15.0255 23.957 14.0698 24.3896 13.1713C24.8697 12.1742 25.2078 11.1746 25.2947 10.254C25.3805 9.34508 25.2339 8.29273 24.4558 7.51472C23.6778 6.73671 22.6255 6.59004 21.7165 6.67584C20.796 6.76273 19.7964 7.10086 18.7993 7.58094C17.9007 8.01357 16.945 8.59036 15.9706 9.28842C14.9961 8.59036 14.0404 8.01357 13.1418 7.58094C12.1447 7.10086 11.1451 6.76273 10.2246 6.67584C9.31564 6.59004 8.26329 6.73671 7.48528 7.51472C6.70727 8.29273 6.5606 9.34508 6.6464 10.254C6.7333 11.1746 7.07142 12.1742 7.5515 13.1713C7.98414 14.0698 8.56092 15.0255 9.25898 16C8.56092 16.9745 7.98414 17.9302 7.5515 18.8287C7.07142 19.8258 6.7333 20.8254 6.6464 21.746C6.5606 22.6549 6.70727 23.7073 7.48528 24.4853C8.26329 25.2633 9.31564 25.41 10.2246 25.3242C11.1451 25.2373 12.1447 24.8991 13.1418 24.4191C14.0404 23.9864 14.9961 23.4096 15.9706 22.7116C16.945 23.4096 17.9007 23.9864 18.7993 24.4191C19.7964 24.8991 20.796 25.2373 21.7165 25.3242C22.6255 25.41 23.6778 25.2633 24.4558 24.4853ZM15.9706 20.948C16.8399 20.2684 17.724 19.4874 18.591 18.6205C19.458 17.7535 20.239 16.8693 20.9186 16C20.239 15.1307 19.458 14.2465 18.591 13.3795C17.724 12.5126 16.8399 11.7316 15.9706 11.052C15.1012 11.7316 14.2171 12.5126 13.3501 13.3795C12.4831 14.2465 11.7021 15.1307 11.0225 16C11.7021 16.8693 12.4831 17.7535 13.3501 18.6205C14.2171 19.4874 15.1012 20.2684 15.9706 20.948ZM17.1498 21.8145C17.968 21.1558 18.7885 20.4195 19.5893 19.6187C20.39 18.818 21.1264 17.9974 21.7851 17.1792C23.7187 19.9919 24.4627 22.4819 23.4576 23.487C22.4524 24.4922 19.9625 23.7482 17.1498 21.8145ZM10.156 17.1792C10.8148 17.9974 11.5511 18.818 12.3518 19.6187C13.1526 20.4195 13.9731 21.1558 14.7914 21.8145C11.9786 23.7482 9.48871 24.4922 8.48355 23.487C7.47839 22.4819 8.22238 19.9919 10.156 17.1792ZM10.156 14.8208C10.8148 14.0026 11.5511 13.182 12.3518 12.3813C13.1526 11.5805 13.9731 10.8442 14.7914 10.1855C11.9786 8.25182 9.48871 7.50783 8.48355 8.51299C7.47839 9.51815 8.22238 12.0081 10.156 14.8208ZM17.1498 10.1855C17.968 10.8442 18.7885 11.5805 19.5893 12.3813C20.39 13.182 21.1264 14.0026 21.7851 14.8208C23.7187 12.0081 24.4627 9.51815 23.4576 8.51299C22.4524 7.50783 19.9625 8.25182 17.1498 10.1855Z"
18
+ fill="white"
19
+ fillRule="evenodd"
20
+ stroke="white"
21
+ strokeWidth="0.5"
22
+ />
23
+ </g>
24
+ <text
25
+ x="36"
26
+ y="20"
27
+ fill="white"
28
+ fontSize="12"
29
+ fontFamily="system-ui, -apple-system, sans-serif"
30
+ fontWeight="500"
31
+ >
32
+ React PDF Forge
33
+ </text>
34
+ <defs>
35
+ <clipPath id={id}>
36
+ <rect fill="white" height="32" rx="8" width="32" />
37
+ </clipPath>
38
+ </defs>
39
+ </svg>
40
+ );
41
+ };
@@ -0,0 +1,269 @@
1
+ import { Slot } from '@radix-ui/react-slot';
2
+ import {
3
+ type ComponentProps,
4
+ useCallback,
5
+ useEffect,
6
+ useRef,
7
+ useState,
8
+ } from 'react';
9
+ import { cn } from '../utils';
10
+ import { VIEW_PRESETS } from './topbar/view-size-controls';
11
+
12
+ type Direction = 'north' | 'south' | 'east' | 'west';
13
+
14
+ type ResizableWrapperProps = {
15
+ width: number;
16
+ height: number;
17
+
18
+ maxWidth: number;
19
+ maxHeight: number;
20
+ minWidth: number;
21
+ minHeight: number;
22
+
23
+ onResize: (newSize: number, direction: Direction) => void;
24
+ onResizeEnd?: () => void;
25
+
26
+ children: React.ReactNode;
27
+ } & Omit<ComponentProps<'div'>, 'onResize' | 'children'>;
28
+
29
+ export const makeIframeDocumentBubbleEvents = (iframe: HTMLIFrameElement) => {
30
+ const mouseMoveBubbler = (event: MouseEvent) => {
31
+ const bounds = iframe.getBoundingClientRect();
32
+ document.dispatchEvent(
33
+ new MouseEvent('mousemove', {
34
+ ...event,
35
+ clientX: event.clientX + bounds.x,
36
+ clientY: event.clientY + bounds.y,
37
+ }),
38
+ );
39
+ };
40
+ const mouseUpBubbler = (event: MouseEvent) => {
41
+ document.dispatchEvent(new MouseEvent('mouseup', event));
42
+ };
43
+ iframe.contentDocument?.addEventListener('mousemove', mouseMoveBubbler);
44
+ iframe.contentDocument?.addEventListener('mouseup', mouseUpBubbler);
45
+ return () => {
46
+ iframe.contentDocument?.removeEventListener('mousemove', mouseMoveBubbler);
47
+ iframe.contentDocument?.removeEventListener('mouseup', mouseUpBubbler);
48
+ };
49
+ };
50
+
51
+ export const ResizableWrapper = ({
52
+ width,
53
+ height,
54
+ onResize,
55
+ onResizeEnd,
56
+ children,
57
+
58
+ maxHeight,
59
+ maxWidth,
60
+ minHeight,
61
+ minWidth,
62
+
63
+ ...rest
64
+ }: ResizableWrapperProps) => {
65
+ const resizableRef = useRef<HTMLElement>(null);
66
+ const [isResizing, setIsResizing] = useState(false);
67
+ const mouseMoveListener = useRef<(event: MouseEvent) => void>(null);
68
+ const [direction, setDirection] = useState<Direction | null>(null);
69
+
70
+ const handleStopResizing = useCallback(() => {
71
+ if (mouseMoveListener.current) {
72
+ document.removeEventListener('mousemove', mouseMoveListener.current);
73
+ }
74
+ document.removeEventListener('mouseup', handleStopResizing);
75
+ setIsResizing(false);
76
+ setDirection(null);
77
+ onResizeEnd?.();
78
+ }, []);
79
+
80
+ const handleStartResizing = (direction: Direction) => {
81
+ mouseMoveListener.current = (event) => {
82
+ if (event.button === 0 && resizableRef.current) {
83
+ const isHorizontal = direction === 'east' || direction === 'west';
84
+
85
+ const mousePosition = isHorizontal ? event.clientX : event.clientY;
86
+ const resizableBoundingRect =
87
+ resizableRef.current.getBoundingClientRect();
88
+ const center = isHorizontal
89
+ ? resizableBoundingRect.x + resizableBoundingRect.width / 2
90
+ : resizableBoundingRect.y + resizableBoundingRect.height / 2;
91
+
92
+ const newPosition = Math.abs(mousePosition - center) * 2;
93
+
94
+ setIsResizing(true);
95
+ setDirection(direction);
96
+
97
+ const threshold = 12;
98
+
99
+ for (let i = 0; i < VIEW_PRESETS.length; i++) {
100
+ const preset = VIEW_PRESETS[i];
101
+
102
+ if (preset) {
103
+ if (
104
+ isHorizontal &&
105
+ newPosition > preset.dimensions.width - threshold &&
106
+ newPosition < preset.dimensions.width + threshold
107
+ ) {
108
+ onResize(preset.dimensions.width, direction);
109
+ return;
110
+ }
111
+
112
+ if (
113
+ !isHorizontal &&
114
+ newPosition > preset.dimensions.height - threshold &&
115
+ newPosition < preset.dimensions.height + threshold
116
+ ) {
117
+ onResize(preset.dimensions.height, direction);
118
+ return;
119
+ }
120
+ }
121
+ }
122
+
123
+ onResize(Math.abs(mousePosition - center) * 2, direction);
124
+ } else {
125
+ handleStopResizing();
126
+ }
127
+ };
128
+
129
+ document.addEventListener('mouseup', handleStopResizing);
130
+ document.addEventListener('mousemove', mouseMoveListener.current);
131
+ };
132
+
133
+ useEffect(() => {
134
+ if (!window.document) {
135
+ return;
136
+ }
137
+
138
+ return () => {
139
+ handleStopResizing();
140
+ };
141
+ }, []);
142
+
143
+ return (
144
+ <>
145
+ <div className="overflow-hidden absolute inset-0">
146
+ <div className="absolute mx-auto box-content -translate-x-1/2 -translate-y-1/2 left-1/2 top-1/2">
147
+ {VIEW_PRESETS.map((preset) => (
148
+ <div
149
+ key={preset.name}
150
+ className="-translate-x-1/2 -translate-y-1/2 absolute pointer-events-none select-none"
151
+ style={{
152
+ width: preset.dimensions.width,
153
+ height: preset.dimensions.height,
154
+ }}
155
+ >
156
+ {width === preset.dimensions.width &&
157
+ isResizing &&
158
+ (direction === 'east' || direction === 'west') && (
159
+ <>
160
+ <div className="absolute right-0 -top-[100vw] -bottom-[100vw] border-r-2 border-cyan-5" />
161
+ <div className="absolute left-0 -top-[100vw] -bottom-[100vw] border-l-2 border-cyan-5" />
162
+ </>
163
+ )}
164
+
165
+ {height === preset.dimensions.height &&
166
+ isResizing &&
167
+ (direction === 'north' || direction === 'south') && (
168
+ <>
169
+ <div className="absolute top-0 -left-[100vw] -right-[100vw] border-t-2 border-cyan-5" />
170
+ <div className="absolute bottom-0 -left-[100vw] -right-[100vw] border-b-2 border-cyan-5" />
171
+ </>
172
+ )}
173
+ </div>
174
+ ))}
175
+ </div>
176
+ </div>
177
+
178
+ <div
179
+ {...rest}
180
+ className={cn('relative mx-auto my-auto box-content', rest.className)}
181
+ >
182
+ <div
183
+ aria-label="resize-west"
184
+ aria-valuenow={width}
185
+ aria-valuemin={minWidth}
186
+ aria-valuemax={maxWidth}
187
+ className="-translate-x-1/2 -translate-y-1/2 absolute top-1/2 -left-2 cursor-w-resize p-2 [user-drag:none]"
188
+ onDragStart={(event) => event.preventDefault()}
189
+ draggable="false"
190
+ onMouseDown={() => {
191
+ handleStartResizing('west');
192
+ }}
193
+ role="slider"
194
+ tabIndex={0}
195
+ >
196
+ <div
197
+ className={cn('h-8 w-1 rounded-md bg-black/50 transition-colors', {
198
+ 'bg-black': direction === 'west',
199
+ })}
200
+ />
201
+ </div>
202
+ <div
203
+ aria-label="resize-east"
204
+ aria-valuenow={width}
205
+ aria-valuemin={minWidth}
206
+ aria-valuemax={maxWidth}
207
+ onDragStart={(event) => event.preventDefault()}
208
+ className="translate-x-1/2 -translate-y-1/2 absolute top-1/2 -right-2 cursor-e-resize p-2 [user-drag:none]"
209
+ draggable="false"
210
+ onMouseDown={() => {
211
+ handleStartResizing('east');
212
+ }}
213
+ role="slider"
214
+ tabIndex={0}
215
+ >
216
+ <div
217
+ className={cn('h-8 w-1 rounded-md bg-black/50 transition-colors', {
218
+ 'bg-black': direction === 'east',
219
+ })}
220
+ />
221
+ </div>
222
+ <div
223
+ aria-label="resize-north"
224
+ aria-valuenow={height}
225
+ aria-valuemin={minHeight}
226
+ aria-valuemax={maxHeight}
227
+ onDragStart={(event) => event.preventDefault()}
228
+ className="-translate-x-1/2 -translate-y-1/2 absolute -top-2 left-1/2 cursor-n-resize p-2 [user-drag:none]"
229
+ draggable="false"
230
+ onMouseDown={() => {
231
+ handleStartResizing('north');
232
+ }}
233
+ role="slider"
234
+ tabIndex={0}
235
+ >
236
+ <div
237
+ className={cn('h-1 w-8 rounded-md bg-black/50 transition-colors', {
238
+ 'bg-black': direction === 'north',
239
+ })}
240
+ />
241
+ </div>
242
+ <div
243
+ aria-label="resize-south"
244
+ aria-valuenow={height}
245
+ aria-valuemin={minHeight}
246
+ aria-valuemax={maxHeight}
247
+ onDragStart={(event) => event.preventDefault()}
248
+ className="-translate-x-1/2 translate-y-1/2 absolute -bottom-2 left-1/2 cursor-s-resize p-2 [user-drag:none]"
249
+ draggable="false"
250
+ onMouseDown={() => {
251
+ handleStartResizing('south');
252
+ }}
253
+ role="slider"
254
+ tabIndex={0}
255
+ >
256
+ <div
257
+ className={cn('h-1 w-8 rounded-md bg-black/50 transition-colors', {
258
+ 'bg-black': direction === 'south',
259
+ })}
260
+ />
261
+ </div>
262
+
263
+ <Slot ref={resizableRef} className={isResizing ? 'select-none' : ''}>
264
+ {children}
265
+ </Slot>
266
+ </div>
267
+ </>
268
+ );
269
+ };
@@ -0,0 +1,95 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { cn } from '../utils';
5
+ import { Logo } from './logo';
6
+ import { Sidebar } from './sidebar';
7
+
8
+ interface ShellProps {
9
+ children: React.ReactNode;
10
+ currentTemplateOpenSlug?: string;
11
+ }
12
+
13
+ interface ShellContextValue {
14
+ sidebarToggled: boolean;
15
+ toggleSidebar: () => void;
16
+ }
17
+
18
+ export const ShellContext = React.createContext<ShellContextValue | undefined>(
19
+ undefined,
20
+ );
21
+
22
+ export const Shell = ({ children, currentTemplateOpenSlug }: ShellProps) => {
23
+ const [sidebarToggled, setSidebarToggled] = React.useState(true);
24
+
25
+ return (
26
+ <ShellContext.Provider
27
+ value={{
28
+ toggleSidebar: () => setSidebarToggled((v) => !v),
29
+ sidebarToggled,
30
+ }}
31
+ >
32
+ <div
33
+ className={
34
+ 'flex h-17.5 items-center justify-between border-slate-6 border-b px-6 lg:hidden'
35
+ }
36
+ >
37
+ <div className="flex h-17.5 items-center">
38
+ <Logo />
39
+ </div>
40
+ <button
41
+ className="flex h-6 w-6 items-center justify-center rounded-sm text-white"
42
+ onClick={() => {
43
+ setSidebarToggled((v) => !v);
44
+ }}
45
+ type="button"
46
+ >
47
+ <svg
48
+ fill="none"
49
+ height="16"
50
+ stroke="white"
51
+ viewBox="0 0 15 15"
52
+ width="16"
53
+ xmlns="http://www.w3.org/2000/svg"
54
+ >
55
+ <title>Menu</title>
56
+ <path
57
+ clipRule="evenodd"
58
+ d="M1.5 3C1.22386 3 1 3.22386 1 3.5C1 3.77614 1.22386 4 1.5 4H13.5C13.7761 4 14 3.77614 14 3.5C14 3.22386 13.7761 3 13.5 3H1.5ZM1 7.5C1 7.22386 1.22386 7 1.5 7H13.5C13.7761 7 14 7.22386 14 7.5C14 7.77614 13.7761 8 13.5 8H1.5C1.22386 8 1 7.77614 1 7.5ZM1 11.5C1 11.2239 1.22386 11 1.5 11H13.5C13.7761 11 14 11.2239 14 11.5C14 11.7761 13.7761 12 13.5 12H1.5C1.22386 12 1 11.7761 1 11.5Z"
59
+ fill="currentColor"
60
+ fillRule="evenodd"
61
+ />
62
+ </svg>
63
+ </button>
64
+ </div>
65
+ <div className="w-dvw flex h-[calc(100dvh-4.375rem)] lg:h-dvh">
66
+ <React.Suspense>
67
+ <Sidebar
68
+ className={cn(
69
+ 'fixed top-17.5 left-0 z-9999 h-full max-h-full w-full max-w-full will-change-auto [transition:width_0.2s_ease-in-out]',
70
+ 'lg:static lg:inline-block lg:z-auto lg:max-h-full lg:w-[16rem]',
71
+ {
72
+ '-translate-x-full lg:translate-x-0': sidebarToggled,
73
+ 'lg:w-0': !sidebarToggled,
74
+ },
75
+ )}
76
+ currentTemplateOpenSlug={currentTemplateOpenSlug}
77
+ />
78
+ </React.Suspense>
79
+ <main
80
+ className={cn(
81
+ 'inline-block relative overflow-hidden will-change-[width]',
82
+ 'w-full h-full',
83
+ '[transition:width_0.2s_ease-in-out,transform_0.2s_ease-in-out]',
84
+ {
85
+ 'lg:w-[calc(100%-16rem)]': sidebarToggled,
86
+ 'opacity-0 lg:opacity-100': !sidebarToggled,
87
+ },
88
+ )}
89
+ >
90
+ {children}
91
+ </main>
92
+ </div>
93
+ </ShellContext.Provider>
94
+ );
95
+ };