@shware/workflow-ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -2
  3. package/dist/assets/iphone-17-pro-DzaacWSl.png +0 -0
  4. package/dist/assets/pixel-10-pro-back-7MDj1_lz.webp +0 -0
  5. package/dist/assets/pixel-10-pro-mask-Bi1deQ9Y.webp +0 -0
  6. package/dist/cli.d.mts +1 -0
  7. package/dist/cli.mjs +673 -0
  8. package/dist/cli.mjs.map +1 -0
  9. package/dist/config.d.mts +247 -0
  10. package/dist/config.d.mts.map +1 -0
  11. package/dist/config.mjs +27 -0
  12. package/dist/config.mjs.map +1 -0
  13. package/dist/index.d.mts +451 -0
  14. package/dist/index.d.mts.map +1 -0
  15. package/dist/index.mjs +2722 -0
  16. package/dist/index.mjs.map +1 -0
  17. package/dist/postgres.d.mts +34 -0
  18. package/dist/postgres.d.mts.map +1 -0
  19. package/dist/postgres.mjs +313 -0
  20. package/dist/postgres.mjs.map +1 -0
  21. package/package.json +93 -3
  22. package/src/app/assets/devices/iphone-17-pro.png +0 -0
  23. package/src/app/assets/devices/pixel-10-pro-back.webp +0 -0
  24. package/src/app/assets/devices/pixel-10-pro-mask.webp +0 -0
  25. package/src/app/assets/flags/AC.svg +1 -0
  26. package/src/app/assets/flags/AD.svg +1 -0
  27. package/src/app/assets/flags/AE.svg +1 -0
  28. package/src/app/assets/flags/AF.svg +1 -0
  29. package/src/app/assets/flags/AG.svg +1 -0
  30. package/src/app/assets/flags/AI.svg +1 -0
  31. package/src/app/assets/flags/AL.svg +1 -0
  32. package/src/app/assets/flags/AM.svg +1 -0
  33. package/src/app/assets/flags/AO.svg +1 -0
  34. package/src/app/assets/flags/AQ.svg +1 -0
  35. package/src/app/assets/flags/AR.svg +1 -0
  36. package/src/app/assets/flags/AS.svg +1 -0
  37. package/src/app/assets/flags/AT.svg +1 -0
  38. package/src/app/assets/flags/AU.svg +1 -0
  39. package/src/app/assets/flags/AW.svg +1 -0
  40. package/src/app/assets/flags/AX.svg +1 -0
  41. package/src/app/assets/flags/AZ.svg +1 -0
  42. package/src/app/assets/flags/BA.svg +1 -0
  43. package/src/app/assets/flags/BB.svg +1 -0
  44. package/src/app/assets/flags/BD.svg +1 -0
  45. package/src/app/assets/flags/BE.svg +1 -0
  46. package/src/app/assets/flags/BF.svg +1 -0
  47. package/src/app/assets/flags/BG.svg +1 -0
  48. package/src/app/assets/flags/BH.svg +1 -0
  49. package/src/app/assets/flags/BI.svg +1 -0
  50. package/src/app/assets/flags/BJ.svg +1 -0
  51. package/src/app/assets/flags/BL.svg +1 -0
  52. package/src/app/assets/flags/BM.svg +1 -0
  53. package/src/app/assets/flags/BN.svg +1 -0
  54. package/src/app/assets/flags/BO.svg +1 -0
  55. package/src/app/assets/flags/BQ-BO.svg +1 -0
  56. package/src/app/assets/flags/BQ-SA.svg +1 -0
  57. package/src/app/assets/flags/BQ-SE.svg +1 -0
  58. package/src/app/assets/flags/BQ.svg +1 -0
  59. package/src/app/assets/flags/BR.svg +1 -0
  60. package/src/app/assets/flags/BS.svg +1 -0
  61. package/src/app/assets/flags/BT.svg +1 -0
  62. package/src/app/assets/flags/BV.svg +1 -0
  63. package/src/app/assets/flags/BW.svg +1 -0
  64. package/src/app/assets/flags/BY.svg +1 -0
  65. package/src/app/assets/flags/BZ.svg +1 -0
  66. package/src/app/assets/flags/CA.svg +1 -0
  67. package/src/app/assets/flags/CC.svg +1 -0
  68. package/src/app/assets/flags/CD.svg +1 -0
  69. package/src/app/assets/flags/CF.svg +1 -0
  70. package/src/app/assets/flags/CG.svg +1 -0
  71. package/src/app/assets/flags/CH.svg +1 -0
  72. package/src/app/assets/flags/CI.svg +1 -0
  73. package/src/app/assets/flags/CK.svg +1 -0
  74. package/src/app/assets/flags/CL.svg +1 -0
  75. package/src/app/assets/flags/CM.svg +1 -0
  76. package/src/app/assets/flags/CN.svg +1 -0
  77. package/src/app/assets/flags/CO.svg +1 -0
  78. package/src/app/assets/flags/CR.svg +1 -0
  79. package/src/app/assets/flags/CU.svg +1 -0
  80. package/src/app/assets/flags/CV.svg +1 -0
  81. package/src/app/assets/flags/CW.svg +1 -0
  82. package/src/app/assets/flags/CX.svg +1 -0
  83. package/src/app/assets/flags/CY.svg +1 -0
  84. package/src/app/assets/flags/CZ.svg +1 -0
  85. package/src/app/assets/flags/DE.svg +1 -0
  86. package/src/app/assets/flags/DJ.svg +1 -0
  87. package/src/app/assets/flags/DK.svg +1 -0
  88. package/src/app/assets/flags/DM.svg +1 -0
  89. package/src/app/assets/flags/DO.svg +1 -0
  90. package/src/app/assets/flags/DZ.svg +1 -0
  91. package/src/app/assets/flags/EC.svg +1 -0
  92. package/src/app/assets/flags/EE.svg +1 -0
  93. package/src/app/assets/flags/EG.svg +1 -0
  94. package/src/app/assets/flags/EH.svg +1 -0
  95. package/src/app/assets/flags/ER.svg +1 -0
  96. package/src/app/assets/flags/ES-CT.svg +1 -0
  97. package/src/app/assets/flags/ES.svg +1 -0
  98. package/src/app/assets/flags/ET.svg +1 -0
  99. package/src/app/assets/flags/EU.svg +1 -0
  100. package/src/app/assets/flags/FI.svg +1 -0
  101. package/src/app/assets/flags/FJ.svg +1 -0
  102. package/src/app/assets/flags/FK.svg +1 -0
  103. package/src/app/assets/flags/FM.svg +1 -0
  104. package/src/app/assets/flags/FO.svg +1 -0
  105. package/src/app/assets/flags/FR.svg +1 -0
  106. package/src/app/assets/flags/GA.svg +1 -0
  107. package/src/app/assets/flags/GB-ENG.svg +1 -0
  108. package/src/app/assets/flags/GB-NIR.svg +1 -0
  109. package/src/app/assets/flags/GB-SCT.svg +1 -0
  110. package/src/app/assets/flags/GB-WLS.svg +1 -0
  111. package/src/app/assets/flags/GB.svg +1 -0
  112. package/src/app/assets/flags/GD.svg +1 -0
  113. package/src/app/assets/flags/GE.svg +1 -0
  114. package/src/app/assets/flags/GF.svg +1 -0
  115. package/src/app/assets/flags/GG.svg +1 -0
  116. package/src/app/assets/flags/GH.svg +1 -0
  117. package/src/app/assets/flags/GI.svg +1 -0
  118. package/src/app/assets/flags/GL.svg +1 -0
  119. package/src/app/assets/flags/GM.svg +1 -0
  120. package/src/app/assets/flags/GN.svg +1 -0
  121. package/src/app/assets/flags/GP.svg +1 -0
  122. package/src/app/assets/flags/GQ.svg +1 -0
  123. package/src/app/assets/flags/GR.svg +1 -0
  124. package/src/app/assets/flags/GS.svg +1 -0
  125. package/src/app/assets/flags/GT.svg +1 -0
  126. package/src/app/assets/flags/GU.svg +1 -0
  127. package/src/app/assets/flags/GW.svg +1 -0
  128. package/src/app/assets/flags/GY.svg +1 -0
  129. package/src/app/assets/flags/HK.svg +1 -0
  130. package/src/app/assets/flags/HM.svg +1 -0
  131. package/src/app/assets/flags/HN.svg +1 -0
  132. package/src/app/assets/flags/HR.svg +1 -0
  133. package/src/app/assets/flags/HT.svg +1 -0
  134. package/src/app/assets/flags/HU.svg +1 -0
  135. package/src/app/assets/flags/IC.svg +1 -0
  136. package/src/app/assets/flags/ID.svg +1 -0
  137. package/src/app/assets/flags/IE.svg +1 -0
  138. package/src/app/assets/flags/IL.svg +1 -0
  139. package/src/app/assets/flags/IM.svg +1 -0
  140. package/src/app/assets/flags/IN.svg +1 -0
  141. package/src/app/assets/flags/IO.svg +1 -0
  142. package/src/app/assets/flags/IQ.svg +1 -0
  143. package/src/app/assets/flags/IR.svg +1 -0
  144. package/src/app/assets/flags/IS.svg +1 -0
  145. package/src/app/assets/flags/IT.svg +1 -0
  146. package/src/app/assets/flags/JE.svg +1 -0
  147. package/src/app/assets/flags/JM.svg +1 -0
  148. package/src/app/assets/flags/JO.svg +1 -0
  149. package/src/app/assets/flags/JP.svg +1 -0
  150. package/src/app/assets/flags/KE.svg +1 -0
  151. package/src/app/assets/flags/KG.svg +1 -0
  152. package/src/app/assets/flags/KH.svg +1 -0
  153. package/src/app/assets/flags/KI.svg +1 -0
  154. package/src/app/assets/flags/KM.svg +1 -0
  155. package/src/app/assets/flags/KN.svg +1 -0
  156. package/src/app/assets/flags/KP.svg +1 -0
  157. package/src/app/assets/flags/KR.svg +1 -0
  158. package/src/app/assets/flags/KW.svg +1 -0
  159. package/src/app/assets/flags/KY.svg +1 -0
  160. package/src/app/assets/flags/KZ.svg +1 -0
  161. package/src/app/assets/flags/LA.svg +1 -0
  162. package/src/app/assets/flags/LB.svg +1 -0
  163. package/src/app/assets/flags/LC.svg +1 -0
  164. package/src/app/assets/flags/LI.svg +1 -0
  165. package/src/app/assets/flags/LK.svg +1 -0
  166. package/src/app/assets/flags/LR.svg +1 -0
  167. package/src/app/assets/flags/LS.svg +1 -0
  168. package/src/app/assets/flags/LT.svg +1 -0
  169. package/src/app/assets/flags/LU.svg +1 -0
  170. package/src/app/assets/flags/LV.svg +1 -0
  171. package/src/app/assets/flags/LY.svg +1 -0
  172. package/src/app/assets/flags/MA.svg +1 -0
  173. package/src/app/assets/flags/MC.svg +1 -0
  174. package/src/app/assets/flags/MD.svg +1 -0
  175. package/src/app/assets/flags/ME.svg +1 -0
  176. package/src/app/assets/flags/MF.svg +1 -0
  177. package/src/app/assets/flags/MG.svg +1 -0
  178. package/src/app/assets/flags/MH.svg +1 -0
  179. package/src/app/assets/flags/MK.svg +1 -0
  180. package/src/app/assets/flags/ML.svg +1 -0
  181. package/src/app/assets/flags/MM.svg +1 -0
  182. package/src/app/assets/flags/MN.svg +1 -0
  183. package/src/app/assets/flags/MO.svg +1 -0
  184. package/src/app/assets/flags/MP.svg +1 -0
  185. package/src/app/assets/flags/MQ.svg +1 -0
  186. package/src/app/assets/flags/MR.svg +1 -0
  187. package/src/app/assets/flags/MS.svg +1 -0
  188. package/src/app/assets/flags/MT.svg +1 -0
  189. package/src/app/assets/flags/MU.svg +1 -0
  190. package/src/app/assets/flags/MV.svg +1 -0
  191. package/src/app/assets/flags/MW.svg +1 -0
  192. package/src/app/assets/flags/MX.svg +1 -0
  193. package/src/app/assets/flags/MY.svg +1 -0
  194. package/src/app/assets/flags/MZ.svg +1 -0
  195. package/src/app/assets/flags/NA.svg +1 -0
  196. package/src/app/assets/flags/NC.svg +1 -0
  197. package/src/app/assets/flags/NE.svg +1 -0
  198. package/src/app/assets/flags/NF.svg +1 -0
  199. package/src/app/assets/flags/NG.svg +1 -0
  200. package/src/app/assets/flags/NI.svg +1 -0
  201. package/src/app/assets/flags/NL.svg +1 -0
  202. package/src/app/assets/flags/NO.svg +1 -0
  203. package/src/app/assets/flags/NP.svg +1 -0
  204. package/src/app/assets/flags/NR.svg +1 -0
  205. package/src/app/assets/flags/NU.svg +1 -0
  206. package/src/app/assets/flags/NZ.svg +1 -0
  207. package/src/app/assets/flags/OM.svg +1 -0
  208. package/src/app/assets/flags/PA.svg +1 -0
  209. package/src/app/assets/flags/PE.svg +1 -0
  210. package/src/app/assets/flags/PF.svg +1 -0
  211. package/src/app/assets/flags/PG.svg +1 -0
  212. package/src/app/assets/flags/PH.svg +1 -0
  213. package/src/app/assets/flags/PK.svg +1 -0
  214. package/src/app/assets/flags/PL.svg +1 -0
  215. package/src/app/assets/flags/PM.svg +1 -0
  216. package/src/app/assets/flags/PN.svg +1 -0
  217. package/src/app/assets/flags/PR.svg +1 -0
  218. package/src/app/assets/flags/PS.svg +1 -0
  219. package/src/app/assets/flags/PT.svg +1 -0
  220. package/src/app/assets/flags/PW.svg +1 -0
  221. package/src/app/assets/flags/PY.svg +1 -0
  222. package/src/app/assets/flags/QA.svg +1 -0
  223. package/src/app/assets/flags/RE.svg +1 -0
  224. package/src/app/assets/flags/README.md +6 -0
  225. package/src/app/assets/flags/RO.svg +1 -0
  226. package/src/app/assets/flags/RS.svg +1 -0
  227. package/src/app/assets/flags/RU.svg +1 -0
  228. package/src/app/assets/flags/RW.svg +1 -0
  229. package/src/app/assets/flags/SA.svg +1 -0
  230. package/src/app/assets/flags/SB.svg +1 -0
  231. package/src/app/assets/flags/SC.svg +1 -0
  232. package/src/app/assets/flags/SD.svg +1 -0
  233. package/src/app/assets/flags/SE.svg +1 -0
  234. package/src/app/assets/flags/SG.svg +1 -0
  235. package/src/app/assets/flags/SH.svg +1 -0
  236. package/src/app/assets/flags/SI.svg +1 -0
  237. package/src/app/assets/flags/SJ.svg +1 -0
  238. package/src/app/assets/flags/SK.svg +1 -0
  239. package/src/app/assets/flags/SL.svg +1 -0
  240. package/src/app/assets/flags/SM.svg +1 -0
  241. package/src/app/assets/flags/SN.svg +1 -0
  242. package/src/app/assets/flags/SO.svg +1 -0
  243. package/src/app/assets/flags/SR.svg +1 -0
  244. package/src/app/assets/flags/SS.svg +1 -0
  245. package/src/app/assets/flags/ST.svg +1 -0
  246. package/src/app/assets/flags/SV.svg +1 -0
  247. package/src/app/assets/flags/SX.svg +1 -0
  248. package/src/app/assets/flags/SY.svg +1 -0
  249. package/src/app/assets/flags/SZ.svg +1 -0
  250. package/src/app/assets/flags/TA.svg +1 -0
  251. package/src/app/assets/flags/TC.svg +1 -0
  252. package/src/app/assets/flags/TD.svg +1 -0
  253. package/src/app/assets/flags/TF.svg +1 -0
  254. package/src/app/assets/flags/TG.svg +1 -0
  255. package/src/app/assets/flags/TH.svg +1 -0
  256. package/src/app/assets/flags/TJ.svg +1 -0
  257. package/src/app/assets/flags/TK.svg +1 -0
  258. package/src/app/assets/flags/TL.svg +1 -0
  259. package/src/app/assets/flags/TM.svg +1 -0
  260. package/src/app/assets/flags/TN.svg +1 -0
  261. package/src/app/assets/flags/TO.svg +1 -0
  262. package/src/app/assets/flags/TR.svg +1 -0
  263. package/src/app/assets/flags/TT.svg +1 -0
  264. package/src/app/assets/flags/TV.svg +1 -0
  265. package/src/app/assets/flags/TW.svg +1 -0
  266. package/src/app/assets/flags/TZ.svg +1 -0
  267. package/src/app/assets/flags/UA.svg +1 -0
  268. package/src/app/assets/flags/UG.svg +1 -0
  269. package/src/app/assets/flags/UM.svg +1 -0
  270. package/src/app/assets/flags/US.svg +1 -0
  271. package/src/app/assets/flags/UY.svg +1 -0
  272. package/src/app/assets/flags/UZ.svg +1 -0
  273. package/src/app/assets/flags/VA.svg +1 -0
  274. package/src/app/assets/flags/VC.svg +1 -0
  275. package/src/app/assets/flags/VE.svg +1 -0
  276. package/src/app/assets/flags/VG.svg +1 -0
  277. package/src/app/assets/flags/VI.svg +1 -0
  278. package/src/app/assets/flags/VN.svg +1 -0
  279. package/src/app/assets/flags/VU.svg +1 -0
  280. package/src/app/assets/flags/WF.svg +1 -0
  281. package/src/app/assets/flags/WS.svg +1 -0
  282. package/src/app/assets/flags/XA.svg +1 -0
  283. package/src/app/assets/flags/XC.svg +1 -0
  284. package/src/app/assets/flags/XK.svg +1 -0
  285. package/src/app/assets/flags/XO.svg +1 -0
  286. package/src/app/assets/flags/YE.svg +1 -0
  287. package/src/app/assets/flags/YT.svg +1 -0
  288. package/src/app/assets/flags/ZA.svg +1 -0
  289. package/src/app/assets/flags/ZM.svg +1 -0
  290. package/src/app/assets/flags/ZW.svg +1 -0
  291. package/src/app/email-preview.ts +46 -0
  292. package/src/app/index.css +203 -0
  293. package/src/app/index.html +12 -0
  294. package/src/app/integrations/i18n/react-i18next.d.ts +11 -0
  295. package/src/app/integrations/i18n/root-provider.tsx +62 -0
  296. package/src/app/integrations/tanstack-query/devtools.tsx +6 -0
  297. package/src/app/integrations/tanstack-query/root-provider.tsx +37 -0
  298. package/src/app/integrations/theme/root-provider.tsx +75 -0
  299. package/src/app/integrations/toast/toast-provider.tsx +46 -0
  300. package/src/app/locales/en-US/common.ts +268 -0
  301. package/src/app/locales/zh-CN/common.ts +263 -0
  302. package/src/app/main.tsx +40 -0
  303. package/src/app/page-chrome.tsx +79 -0
  304. package/src/app/router.tsx +40 -0
  305. package/src/app/routes/__root.tsx +293 -0
  306. package/src/app/routes/emails.tsx +199 -0
  307. package/src/app/routes/home.tsx +87 -0
  308. package/src/app/routes/index.ts +19 -0
  309. package/src/app/routes/metrics.tsx +541 -0
  310. package/src/app/routes/segment-overview.tsx +211 -0
  311. package/src/app/routes/segments.tsx +236 -0
  312. package/src/app/routes/settings.tsx +90 -0
  313. package/src/app/routes/workflows.tsx +348 -0
  314. package/src/app/studio.ts +16 -0
  315. package/src/app/svg.d.ts +17 -0
  316. package/src/app/virtual-config.d.ts +6 -0
  317. package/src/cli.ts +110 -0
  318. package/src/components/avatar.tsx +57 -0
  319. package/src/components/breadcrumb.tsx +49 -0
  320. package/src/components/button/index.tsx +86 -0
  321. package/src/components/channel-icon.ts +39 -0
  322. package/src/components/chat-markup.tsx +109 -0
  323. package/src/components/corner-shape.ts +13 -0
  324. package/src/components/date-range.tsx +181 -0
  325. package/src/components/discord-preview.tsx +165 -0
  326. package/src/components/dropdown/index.tsx +172 -0
  327. package/src/components/email-defaults.tsx +40 -0
  328. package/src/components/email-list.tsx +149 -0
  329. package/src/components/email-thumbnail.tsx +123 -0
  330. package/src/components/flag.tsx +40 -0
  331. package/src/components/input/index.tsx +40 -0
  332. package/src/components/input/search-input.tsx +24 -0
  333. package/src/components/layout.ts +403 -0
  334. package/src/components/menu/index.tsx +118 -0
  335. package/src/components/metric-card.tsx +321 -0
  336. package/src/components/modal/index.tsx +70 -0
  337. package/src/components/nav-drawer.tsx +84 -0
  338. package/src/components/node-inspector.tsx +242 -0
  339. package/src/components/profile-drawer.tsx +331 -0
  340. package/src/components/push-preview.tsx +470 -0
  341. package/src/components/push-thumbnail.tsx +78 -0
  342. package/src/components/segment-list.tsx +184 -0
  343. package/src/components/select/index.tsx +70 -0
  344. package/src/components/series-chart.tsx +120 -0
  345. package/src/components/slack-preview.tsx +223 -0
  346. package/src/components/sparkline.tsx +58 -0
  347. package/src/components/tabs/index.tsx +45 -0
  348. package/src/components/template-refs.ts +110 -0
  349. package/src/components/templates-page.tsx +601 -0
  350. package/src/components/textarea/index.tsx +37 -0
  351. package/src/components/thumbnail-window.tsx +65 -0
  352. package/src/components/workflow-canvas.tsx +503 -0
  353. package/src/components/workflow-list.tsx +231 -0
  354. package/src/config.ts +288 -0
  355. package/src/generate.ts +56 -0
  356. package/src/index.ts +35 -0
  357. package/src/postgres.ts +415 -0
  358. package/src/server/project.ts +290 -0
  359. package/src/server.ts +500 -0
  360. package/src/utils/cn.ts +6 -0
  361. package/src/utils/label.ts +12 -0
  362. package/src/utils/lookup.ts +11 -0
  363. package/src/utils/template-content.ts +213 -0
@@ -0,0 +1,470 @@
1
+ import { Camera, ChevronDown, Flashlight, Lock } from 'lucide-react';
2
+ import type { CSSProperties, ReactNode } from 'react';
3
+ import iphoneFrameUrl from '../app/assets/devices/iphone-17-pro.png';
4
+ import pixelBackUrl from '../app/assets/devices/pixel-10-pro-back.webp';
5
+ import pixelMaskUrl from '../app/assets/devices/pixel-10-pro-mask.webp';
6
+
7
+ /**
8
+ * Push-notification preview: the two platforms' lock screens, side by side.
9
+ *
10
+ * Emails render themselves — the preview is an iframe around real output. A
11
+ * push has no document of its own: what the user sees is the OS's chrome
12
+ * around two strings, so the preview must *draw* that chrome. Both platforms
13
+ * are shown at once because their layouts genuinely differ (iOS stacks
14
+ * notifications at the bottom of the lock screen, Android under the clock)
15
+ * and the copy has to survive both.
16
+ *
17
+ * The hardware is the vendors' own artwork, not ours: Apple's iPhone 17 Pro
18
+ * product bezel (developer.apple.com/design/resources, PNG with a transparent
19
+ * screen cutout the content shows through — the Dynamic Island is part of the
20
+ * bezel) and Google's Pixel 10 Pro device frame (AOSP's device-art-resources,
21
+ * the artwork behind Android Studio's screenshot framing: a `back` body layer
22
+ * under the content and a screen-sized `mask` overlay painting the corner
23
+ * bezels and the punch-hole camera over it).
24
+ *
25
+ * The software is drawn to the platforms' own design kits, at true scale:
26
+ * screen content renders at the device's logical resolution (402pt / 412dp)
27
+ * and is scaled into the frame's window, so every measurement below is the
28
+ * spec's own number. iOS notification metrics come from the iOS 26 Figma kit
29
+ * and a real device's lock screen (card 386w r28, padding 14/12, centred icon
30
+ * 38 r12, title SF 15/17 semibold −0.23,
31
+ * body 15/18 regular, time 15/17 top-right); Android lock-screen metrics
32
+ * follow Google's official Android UI Kit on Figma (leading 40dp app icon,
33
+ * bold 14sp title with an inline "• now", 14sp content line, a circled
34
+ * expander). Collapsed banners carry no rich image on either platform.
35
+ */
36
+ export interface PushPreviewProps {
37
+ /** App identity on the banner; falls back to the project title upstream. */
38
+ appName: string;
39
+ /** The notification title, as `content` returned it. */
40
+ title: string;
41
+ body: string;
42
+ scheme: 'light' | 'dark';
43
+ zoom: number;
44
+ }
45
+
46
+ /** The keynote clock: every device mockup shows 9:41. */
47
+ const CLOCK = '9:41';
48
+ /** Rendered device width; the frames' aspect ratios set everything else. */
49
+ const DEVICE_W = 300;
50
+
51
+ /** One frame asset's geometry: canvas size and the screen window inside it. */
52
+ interface FrameGeometry {
53
+ w: number;
54
+ h: number;
55
+ screen: { x: number; y: number; w: number; h: number };
56
+ /**
57
+ * Corner radius of the screen window, in the artwork's pixels. The content
58
+ * must round itself off: the window's corner arcs pass inside its bounding
59
+ * box, and past them the artwork is transparent (the outside of the device),
60
+ * so square content corners would poke out of the hardware.
61
+ */
62
+ screenRadius: number;
63
+ /** Logical width (pt / dp): screen content renders at this and scales down. */
64
+ logicalW: number;
65
+ }
66
+
67
+ /** Measured from the bezel PNG (alpha scan of the transparent cutout). */
68
+ const IPHONE: FrameGeometry = {
69
+ w: 1350,
70
+ h: 2760,
71
+ screen: { x: 72, y: 69, w: 1206, h: 2622 },
72
+ screenRadius: 185,
73
+ logicalW: 402,
74
+ };
75
+ /** From the frame's layout descriptor (display size/offset, corner_radius). */
76
+ const PIXEL: FrameGeometry = {
77
+ w: 1410,
78
+ h: 2968,
79
+ screen: { x: 59, y: 60, w: 1280, h: 2856 },
80
+ screenRadius: 99,
81
+ logicalW: 412,
82
+ };
83
+
84
+ /**
85
+ * Apple's continuous corner — a true squircle, not the studio's subtler 1.2.
86
+ * Falls back to plain border-radius where `corner-shape` is unsupported.
87
+ */
88
+ const squircle = { cornerShape: 'superellipse(2)' } as CSSProperties;
89
+
90
+ /** App icon stand-in: initial on a gradient, sized by the caller. */
91
+ function AppIcon({
92
+ name,
93
+ size,
94
+ radius,
95
+ shape,
96
+ className,
97
+ }: {
98
+ name: string;
99
+ size: number;
100
+ radius: number;
101
+ shape?: CSSProperties;
102
+ className?: string;
103
+ }) {
104
+ return (
105
+ <div
106
+ aria-hidden
107
+ className={`flex shrink-0 items-center justify-center font-semibold text-white ${className ?? ''}`}
108
+ style={{
109
+ width: size,
110
+ height: size,
111
+ borderRadius: radius,
112
+ fontSize: size * 0.48,
113
+ background: 'linear-gradient(135deg,#6366f1 0%,#8b5cf6 55%,#d946ef 100%)',
114
+ ...shape,
115
+ }}
116
+ >
117
+ {(name.trim().charAt(0) || 'A').toUpperCase()}
118
+ </div>
119
+ );
120
+ }
121
+
122
+ /**
123
+ * One device: platform label above, then the frame artwork with the software
124
+ * screen composited into its window. Children render at the device's logical
125
+ * resolution and are scaled to fit, so their styles use real pt / dp values.
126
+ */
127
+ function Device({
128
+ label,
129
+ dark,
130
+ geometry,
131
+ underlay,
132
+ overlay,
133
+ overlayPlacement = 'frame',
134
+ screenShape,
135
+ wallpaper,
136
+ children,
137
+ }: {
138
+ label: string;
139
+ dark: boolean;
140
+ geometry: FrameGeometry;
141
+ underlay?: string;
142
+ overlay: string;
143
+ /** Whether the overlay artwork spans the whole frame or just the screen window. */
144
+ overlayPlacement?: 'frame' | 'screen';
145
+ /** Extra corner treatment for the screen content (the iPhone's squircle). */
146
+ screenShape?: CSSProperties;
147
+ wallpaper: string;
148
+ children: ReactNode;
149
+ }) {
150
+ const scale = DEVICE_W / geometry.w;
151
+ const screenRect: CSSProperties = {
152
+ position: 'absolute',
153
+ left: geometry.screen.x * scale,
154
+ top: geometry.screen.y * scale,
155
+ width: geometry.screen.w * scale,
156
+ height: geometry.screen.h * scale,
157
+ };
158
+ const frameRect: CSSProperties = {
159
+ position: 'absolute',
160
+ inset: 0,
161
+ width: '100%',
162
+ height: '100%',
163
+ };
164
+ /* Logical canvas: spec-true units inside, one scale() to the frame window. */
165
+ const logicalScale = (geometry.screen.w * scale) / geometry.logicalW;
166
+ const logicalH = (geometry.screen.h / geometry.screen.w) * geometry.logicalW;
167
+ return (
168
+ <div className="shrink-0" style={{ width: DEVICE_W }}>
169
+ <div
170
+ className="mb-3 text-center text-[14px] font-semibold"
171
+ style={{ color: dark ? 'var(--color-gray-400)' : 'var(--color-gray-500)' }}
172
+ >
173
+ {label}
174
+ </div>
175
+ <div
176
+ className="relative"
177
+ style={{
178
+ width: DEVICE_W,
179
+ height: Math.round(geometry.h * scale),
180
+ filter: dark
181
+ ? 'drop-shadow(0 20px 40px rgba(0,0,0,0.55))'
182
+ : 'drop-shadow(0 20px 40px rgba(15,23,42,0.3))',
183
+ }}
184
+ >
185
+ {underlay !== undefined && <img src={underlay} alt="" style={frameRect} />}
186
+ <div
187
+ className="overflow-hidden"
188
+ style={{
189
+ ...screenRect,
190
+ borderRadius: geometry.screenRadius * scale,
191
+ background: wallpaper,
192
+ ...screenShape,
193
+ }}
194
+ >
195
+ <div
196
+ className="flex flex-col"
197
+ style={{
198
+ width: geometry.logicalW,
199
+ height: logicalH,
200
+ transform: `scale(${logicalScale})`,
201
+ transformOrigin: 'top left',
202
+ }}
203
+ >
204
+ {children}
205
+ </div>
206
+ </div>
207
+ <img
208
+ src={overlay}
209
+ alt=""
210
+ className="pointer-events-none"
211
+ style={overlayPlacement === 'screen' ? screenRect : frameRect}
212
+ />
213
+ </div>
214
+ </div>
215
+ );
216
+ }
217
+
218
+ /** iOS lock-screen wallpaper; the inspector's push thumbnail uses the same one. */
219
+ export const IOS_WALLPAPER = {
220
+ light: 'linear-gradient(170deg,#a9c4ff 0%,#d5b3f7 52%,#ffc0d3 100%)',
221
+ dark: 'linear-gradient(170deg,#26355f 0%,#45296b 52%,#131625 100%)',
222
+ };
223
+
224
+ const IOS_FACE: CSSProperties = {
225
+ fontFamily: "-apple-system, 'SF Pro Text', system-ui, sans-serif",
226
+ };
227
+
228
+ /**
229
+ * The banner alone, to the iOS 26 kit: 8pt side margins (386 wide on a 402pt
230
+ * screen), padding 14/12, a 10pt gap after the 38pt icon, and the time
231
+ * top-right. The lock screen composes it; the inspector thumbnail shows it bare.
232
+ */
233
+ export function IosBanner({
234
+ appName,
235
+ title,
236
+ body,
237
+ dark,
238
+ }: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {
239
+ const primary = dark ? 'rgba(255,255,255,0.96)' : 'rgba(0,0,0,0.9)';
240
+ const secondary = dark ? 'rgba(235,235,245,0.6)' : '#4D4D4D';
241
+ return (
242
+ <div
243
+ className="relative mx-[8px] shrink-0 rounded-[40px] px-[14px] py-[12px]"
244
+ style={{
245
+ ...IOS_FACE,
246
+ /* Liquid glass: brighter than the wallpaper, heavy blur, a specular rim. */
247
+ background: dark ? 'rgba(110,115,135,0.34)' : 'rgba(250,250,252,0.5)',
248
+ backdropFilter: 'blur(28px) saturate(180%)',
249
+ WebkitBackdropFilter: 'blur(28px) saturate(180%)',
250
+ boxShadow: dark
251
+ ? '0 8px 32px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.16)'
252
+ : '0 8px 32px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(255,255,255,0.55)',
253
+ ...squircle,
254
+ }}
255
+ >
256
+ <div className="flex gap-[10px]">
257
+ <AppIcon name={appName} size={38} radius={12} shape={squircle} className="self-center" />
258
+ <div className="min-w-0 flex-1 self-center">
259
+ <div
260
+ className="truncate text-[15px] leading-[17px] font-semibold tracking-[-0.23px]"
261
+ style={{ color: primary }}
262
+ >
263
+ {title}
264
+ </div>
265
+ <div
266
+ className="line-clamp-4 text-[15px] leading-[18px] tracking-[-0.23px]"
267
+ style={{ color: primary }}
268
+ >
269
+ {body}
270
+ </div>
271
+ </div>
272
+ <span
273
+ className="shrink-0 self-start text-[15px] leading-[17px]"
274
+ style={{ color: secondary }}
275
+ >
276
+ now
277
+ </span>
278
+ </div>
279
+ </div>
280
+ );
281
+ }
282
+
283
+ function IosDevice({
284
+ appName,
285
+ title,
286
+ body,
287
+ dark,
288
+ }: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {
289
+ return (
290
+ <Device
291
+ label="iOS"
292
+ dark={dark}
293
+ geometry={IPHONE}
294
+ overlay={iphoneFrameUrl}
295
+ screenShape={squircle}
296
+ wallpaper={dark ? IOS_WALLPAPER.dark : IOS_WALLPAPER.light}
297
+ >
298
+ <div className="relative flex min-h-0 flex-1 flex-col" style={IOS_FACE}>
299
+ {/*
300
+ Wallpaper glow, sitting behind the banner: frosted glass is invisible
301
+ over a flat gradient — the blur needs detail to smear. Two soft light
302
+ blobs give the backdrop-filter something to show.
303
+ */}
304
+ <div aria-hidden className="pointer-events-none absolute inset-0">
305
+ <div
306
+ className="absolute rounded-full"
307
+ style={{
308
+ left: 20,
309
+ top: 540,
310
+ width: 240,
311
+ height: 240,
312
+ background: `radial-gradient(circle, ${
313
+ dark ? 'rgba(125,110,255,0.4)' : 'rgba(255,255,255,0.75)'
314
+ }, transparent 65%)`,
315
+ }}
316
+ />
317
+ <div
318
+ className="absolute rounded-full"
319
+ style={{
320
+ right: -40,
321
+ top: 640,
322
+ width: 280,
323
+ height: 280,
324
+ background: `radial-gradient(circle, ${
325
+ dark ? 'rgba(70,150,255,0.32)' : 'rgba(255,170,205,0.7)'
326
+ }, transparent 65%)`,
327
+ }}
328
+ />
329
+ </div>
330
+ {/*
331
+ Lock-screen clock, at the kit's measured offsets (Examples/
332
+ Notifications): the 22pt medium date sits at y76 (26 tall), the
333
+ clock's glyphs at y119 with a 73pt cap height (a ~100pt face) — a
334
+ 17pt visual gap between them.
335
+ */}
336
+ <div
337
+ className="mt-[76px] shrink-0 text-center"
338
+ style={{ color: 'rgba(255,255,255,0.95)', textShadow: '0 1px 18px rgba(0,0,0,0.18)' }}
339
+ >
340
+ <div className="text-[22px] leading-[26px] font-medium">Monday, June 9</div>
341
+ <div className="mt-[3px] text-[100px] leading-[100px] font-semibold tracking-[-2px]">
342
+ {CLOCK}
343
+ </div>
344
+ </div>
345
+ {/* Wallpaper breathes; notifications rise from the bottom on iOS. */}
346
+ <div className="min-h-0 flex-1" />
347
+ <IosBanner appName={appName} title={title} body={body} dark={dark} />
348
+ {/* Flashlight / camera (50pt), and the home indicator. */}
349
+ <div className="mt-[24px] mb-[12px] flex shrink-0 items-center justify-between px-[52px]">
350
+ {[Flashlight, Camera].map((Icon, index) => (
351
+ <span
352
+ key={index}
353
+ className="flex size-[50px] items-center justify-center rounded-full backdrop-blur-md"
354
+ style={{ background: 'rgba(20,20,24,0.34)', color: 'rgba(255,255,255,0.92)' }}
355
+ >
356
+ <Icon size={22} strokeWidth={2} aria-hidden />
357
+ </span>
358
+ ))}
359
+ </div>
360
+ <div
361
+ className="mx-auto mb-[9px] h-[5px] w-[148px] shrink-0 rounded-full"
362
+ style={{ background: 'rgba(255,255,255,0.9)' }}
363
+ />
364
+ </div>
365
+ </Device>
366
+ );
367
+ }
368
+
369
+ function AndroidDevice({
370
+ appName,
371
+ title,
372
+ body,
373
+ dark,
374
+ }: Omit<PushPreviewProps, 'zoom' | 'scheme'> & { dark: boolean }) {
375
+ const face: CSSProperties = { fontFamily: "Roboto, 'Google Sans', system-ui, sans-serif" };
376
+ const primary = dark ? 'rgba(255,255,255,0.95)' : 'rgba(27,27,31,0.95)';
377
+ const secondary = dark ? 'rgba(255,255,255,0.65)' : 'rgba(68,71,78,0.8)';
378
+ /* Material You: the clock picks up the wallpaper's tone, dark on light. */
379
+ const clockColor = dark ? 'rgba(255,255,255,0.95)' : 'rgba(28,44,40,0.9)';
380
+ return (
381
+ <Device
382
+ label="Android"
383
+ dark={dark}
384
+ geometry={PIXEL}
385
+ underlay={pixelBackUrl}
386
+ overlay={pixelMaskUrl}
387
+ overlayPlacement="screen"
388
+ wallpaper={
389
+ dark
390
+ ? 'linear-gradient(170deg,#1d2b33 0%,#262040 58%,#0f1317 100%)'
391
+ : 'linear-gradient(170deg,#b6d2c8 0%,#a3c2b4 55%,#ddd3c0 100%)'
392
+ }
393
+ >
394
+ <div className="flex min-h-0 flex-1 flex-col" style={face}>
395
+ {/* Lock-screen clock: date over the clock, per the kit's templates. */}
396
+ <div className="mt-[88px] shrink-0 text-center" style={{ color: clockColor }}>
397
+ <div className="text-[16px] leading-[22px] font-medium">Mon, Jun 9</div>
398
+ <div className="text-[64px] leading-[1.1] font-normal">{CLOCK}</div>
399
+ </div>
400
+ {/*
401
+ Lock-screen notification, to Google's Android UI Kit: a full-width
402
+ card with 12dp margins, a leading 40dp app icon, a bold 14sp title
403
+ with the "• now" inline, a 14sp content line, then the circled
404
+ expander. App name never appears — the icon is the identity,
405
+ exactly as on the real lock screen.
406
+ */}
407
+ <div
408
+ className="mx-[12px] mt-[28px] shrink-0 rounded-[16px] p-[12px] backdrop-blur-md"
409
+ style={{
410
+ /* A step lighter than the wallpaper's darkest stop, so the card reads at night. */
411
+ background: dark ? 'rgba(64,68,76,0.78)' : 'rgba(255,255,255,0.92)',
412
+ boxShadow: dark
413
+ ? '0 4px 16px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.08)'
414
+ : '0 4px 16px rgba(0,0,0,0.12)',
415
+ }}
416
+ >
417
+ <div className="flex items-center gap-[12px]">
418
+ <AppIcon name={appName} size={40} radius={12} />
419
+ <div className="min-w-0 flex-1">
420
+ <div className="flex items-baseline gap-[6px]">
421
+ <span
422
+ className="min-w-0 truncate text-[14px] leading-[20px] font-bold"
423
+ style={{ color: primary }}
424
+ >
425
+ {title}
426
+ </span>
427
+ <span className="shrink-0 text-[14px] leading-[20px]" style={{ color: secondary }}>
428
+ • now
429
+ </span>
430
+ </div>
431
+ <div className="line-clamp-2 text-[14px] leading-[20px]" style={{ color: primary }}>
432
+ {body}
433
+ </div>
434
+ </div>
435
+ <span
436
+ className="flex size-[28px] shrink-0 items-center justify-center rounded-full"
437
+ style={{
438
+ background: dark ? 'rgba(255,255,255,0.12)' : 'rgba(27,27,31,0.08)',
439
+ color: secondary,
440
+ }}
441
+ >
442
+ <ChevronDown size={16} strokeWidth={2.5} aria-hidden />
443
+ </span>
444
+ </div>
445
+ </div>
446
+ <div className="min-h-0 flex-1" />
447
+ {/* The lock glyph above the gesture area. */}
448
+ <div
449
+ className="mb-[18px] flex shrink-0 justify-center"
450
+ style={{ color: dark ? 'rgba(255,255,255,0.85)' : 'rgba(28,44,40,0.8)' }}
451
+ >
452
+ <Lock size={18} strokeWidth={2.5} aria-hidden />
453
+ </div>
454
+ </div>
455
+ </Device>
456
+ );
457
+ }
458
+
459
+ export function PushPreview({ appName, title, body, scheme, zoom }: PushPreviewProps) {
460
+ const dark = scheme === 'dark';
461
+ return (
462
+ <div
463
+ className="flex flex-wrap items-start justify-center gap-12 pt-2"
464
+ style={{ transform: `scale(${zoom})`, transformOrigin: 'top center' }}
465
+ >
466
+ <IosDevice appName={appName} title={title} body={body} dark={dark} />
467
+ <AndroidDevice appName={appName} title={title} body={body} dark={dark} />
468
+ </div>
469
+ );
470
+ }
@@ -0,0 +1,78 @@
1
+ import { useTranslation } from 'react-i18next';
2
+ import { IOS_WALLPAPER, IosBanner } from './push-preview';
3
+ import { ThumbnailStatus, ThumbnailWindow } from './thumbnail-window';
4
+
5
+ /**
6
+ * The banner is drawn at its spec size (386pt wide) and zoomed to the card.
7
+ * `zoom` rather than `transform`: it scales layout too, so the wrapper is as
8
+ * tall as what it shows and the banner centres without measuring anything.
9
+ */
10
+ const BANNER_ZOOM = 0.68;
11
+
12
+ export interface PushThumbnailProps {
13
+ /** App identity on the banner; the project title upstream. */
14
+ appName: string;
15
+ /**
16
+ * The notification: the template's `content` over its validated preview props.
17
+ */
18
+ title: string;
19
+ body: string;
20
+ /** Why there is no notification to draw: the template refused its preview props. */
21
+ error?: string | undefined;
22
+ /** False when the IR references a template the push registry does not register. */
23
+ registered: boolean;
24
+ scheme: 'light' | 'dark';
25
+ /** Open the full preview — the button under the window. */
26
+ onOpen: () => void;
27
+ }
28
+
29
+ /**
30
+ * A push at postage-stamp size: the iOS banner on its wallpaper, nothing else.
31
+ * The full page draws both platforms' lock screens; at this size the phone
32
+ * chrome would say nothing the banner does not, so only the banner is shown.
33
+ */
34
+ export function PushThumbnail({
35
+ appName,
36
+ title,
37
+ body,
38
+ error,
39
+ registered,
40
+ scheme,
41
+ onOpen,
42
+ }: PushThumbnailProps) {
43
+ const { t } = useTranslation();
44
+ const dark = scheme === 'dark';
45
+ /* A refused template draws no banner: there is no notification to show. */
46
+ const drawn = registered && error === undefined;
47
+ return (
48
+ <ThumbnailWindow
49
+ className={drawn ? 'relative flex items-center' : undefined}
50
+ style={drawn ? { background: dark ? IOS_WALLPAPER.dark : IOS_WALLPAPER.light } : {}}
51
+ onOpen={registered ? onOpen : undefined}
52
+ >
53
+ {error !== undefined && registered ? (
54
+ <ThumbnailStatus tone="error">
55
+ <span className="whitespace-pre-line">{error}</span>
56
+ </ThumbnailStatus>
57
+ ) : drawn ? (
58
+ <>
59
+ {/* Light behind the glass, so the banner's blur has something to smear. */}
60
+ <div
61
+ aria-hidden
62
+ className="pointer-events-none absolute inset-0"
63
+ style={{
64
+ background: dark
65
+ ? 'radial-gradient(circle at 20% 30%, rgba(125,110,255,0.4), transparent 45%), radial-gradient(circle at 85% 80%, rgba(70,150,255,0.32), transparent 45%)'
66
+ : 'radial-gradient(circle at 20% 30%, rgba(255,255,255,0.75), transparent 45%), radial-gradient(circle at 85% 80%, rgba(255,170,205,0.7), transparent 45%)',
67
+ }}
68
+ />
69
+ <div className="relative w-full px-[12px]" style={{ zoom: BANNER_ZOOM }}>
70
+ <IosBanner appName={appName} title={title} body={body} dark={dark} />
71
+ </div>
72
+ </>
73
+ ) : (
74
+ <ThumbnailStatus>{t('emails.pushNotRegistered')}</ThumbnailStatus>
75
+ )}
76
+ </ThumbnailWindow>
77
+ );
78
+ }