@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.
- package/LICENSE +21 -0
- package/README.md +180 -2
- package/dist/assets/iphone-17-pro-DzaacWSl.png +0 -0
- package/dist/assets/pixel-10-pro-back-7MDj1_lz.webp +0 -0
- package/dist/assets/pixel-10-pro-mask-Bi1deQ9Y.webp +0 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +673 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/config.d.mts +247 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +27 -0
- package/dist/config.mjs.map +1 -0
- package/dist/index.d.mts +451 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2722 -0
- package/dist/index.mjs.map +1 -0
- package/dist/postgres.d.mts +34 -0
- package/dist/postgres.d.mts.map +1 -0
- package/dist/postgres.mjs +313 -0
- package/dist/postgres.mjs.map +1 -0
- package/package.json +93 -3
- package/src/app/assets/devices/iphone-17-pro.png +0 -0
- package/src/app/assets/devices/pixel-10-pro-back.webp +0 -0
- package/src/app/assets/devices/pixel-10-pro-mask.webp +0 -0
- package/src/app/assets/flags/AC.svg +1 -0
- package/src/app/assets/flags/AD.svg +1 -0
- package/src/app/assets/flags/AE.svg +1 -0
- package/src/app/assets/flags/AF.svg +1 -0
- package/src/app/assets/flags/AG.svg +1 -0
- package/src/app/assets/flags/AI.svg +1 -0
- package/src/app/assets/flags/AL.svg +1 -0
- package/src/app/assets/flags/AM.svg +1 -0
- package/src/app/assets/flags/AO.svg +1 -0
- package/src/app/assets/flags/AQ.svg +1 -0
- package/src/app/assets/flags/AR.svg +1 -0
- package/src/app/assets/flags/AS.svg +1 -0
- package/src/app/assets/flags/AT.svg +1 -0
- package/src/app/assets/flags/AU.svg +1 -0
- package/src/app/assets/flags/AW.svg +1 -0
- package/src/app/assets/flags/AX.svg +1 -0
- package/src/app/assets/flags/AZ.svg +1 -0
- package/src/app/assets/flags/BA.svg +1 -0
- package/src/app/assets/flags/BB.svg +1 -0
- package/src/app/assets/flags/BD.svg +1 -0
- package/src/app/assets/flags/BE.svg +1 -0
- package/src/app/assets/flags/BF.svg +1 -0
- package/src/app/assets/flags/BG.svg +1 -0
- package/src/app/assets/flags/BH.svg +1 -0
- package/src/app/assets/flags/BI.svg +1 -0
- package/src/app/assets/flags/BJ.svg +1 -0
- package/src/app/assets/flags/BL.svg +1 -0
- package/src/app/assets/flags/BM.svg +1 -0
- package/src/app/assets/flags/BN.svg +1 -0
- package/src/app/assets/flags/BO.svg +1 -0
- package/src/app/assets/flags/BQ-BO.svg +1 -0
- package/src/app/assets/flags/BQ-SA.svg +1 -0
- package/src/app/assets/flags/BQ-SE.svg +1 -0
- package/src/app/assets/flags/BQ.svg +1 -0
- package/src/app/assets/flags/BR.svg +1 -0
- package/src/app/assets/flags/BS.svg +1 -0
- package/src/app/assets/flags/BT.svg +1 -0
- package/src/app/assets/flags/BV.svg +1 -0
- package/src/app/assets/flags/BW.svg +1 -0
- package/src/app/assets/flags/BY.svg +1 -0
- package/src/app/assets/flags/BZ.svg +1 -0
- package/src/app/assets/flags/CA.svg +1 -0
- package/src/app/assets/flags/CC.svg +1 -0
- package/src/app/assets/flags/CD.svg +1 -0
- package/src/app/assets/flags/CF.svg +1 -0
- package/src/app/assets/flags/CG.svg +1 -0
- package/src/app/assets/flags/CH.svg +1 -0
- package/src/app/assets/flags/CI.svg +1 -0
- package/src/app/assets/flags/CK.svg +1 -0
- package/src/app/assets/flags/CL.svg +1 -0
- package/src/app/assets/flags/CM.svg +1 -0
- package/src/app/assets/flags/CN.svg +1 -0
- package/src/app/assets/flags/CO.svg +1 -0
- package/src/app/assets/flags/CR.svg +1 -0
- package/src/app/assets/flags/CU.svg +1 -0
- package/src/app/assets/flags/CV.svg +1 -0
- package/src/app/assets/flags/CW.svg +1 -0
- package/src/app/assets/flags/CX.svg +1 -0
- package/src/app/assets/flags/CY.svg +1 -0
- package/src/app/assets/flags/CZ.svg +1 -0
- package/src/app/assets/flags/DE.svg +1 -0
- package/src/app/assets/flags/DJ.svg +1 -0
- package/src/app/assets/flags/DK.svg +1 -0
- package/src/app/assets/flags/DM.svg +1 -0
- package/src/app/assets/flags/DO.svg +1 -0
- package/src/app/assets/flags/DZ.svg +1 -0
- package/src/app/assets/flags/EC.svg +1 -0
- package/src/app/assets/flags/EE.svg +1 -0
- package/src/app/assets/flags/EG.svg +1 -0
- package/src/app/assets/flags/EH.svg +1 -0
- package/src/app/assets/flags/ER.svg +1 -0
- package/src/app/assets/flags/ES-CT.svg +1 -0
- package/src/app/assets/flags/ES.svg +1 -0
- package/src/app/assets/flags/ET.svg +1 -0
- package/src/app/assets/flags/EU.svg +1 -0
- package/src/app/assets/flags/FI.svg +1 -0
- package/src/app/assets/flags/FJ.svg +1 -0
- package/src/app/assets/flags/FK.svg +1 -0
- package/src/app/assets/flags/FM.svg +1 -0
- package/src/app/assets/flags/FO.svg +1 -0
- package/src/app/assets/flags/FR.svg +1 -0
- package/src/app/assets/flags/GA.svg +1 -0
- package/src/app/assets/flags/GB-ENG.svg +1 -0
- package/src/app/assets/flags/GB-NIR.svg +1 -0
- package/src/app/assets/flags/GB-SCT.svg +1 -0
- package/src/app/assets/flags/GB-WLS.svg +1 -0
- package/src/app/assets/flags/GB.svg +1 -0
- package/src/app/assets/flags/GD.svg +1 -0
- package/src/app/assets/flags/GE.svg +1 -0
- package/src/app/assets/flags/GF.svg +1 -0
- package/src/app/assets/flags/GG.svg +1 -0
- package/src/app/assets/flags/GH.svg +1 -0
- package/src/app/assets/flags/GI.svg +1 -0
- package/src/app/assets/flags/GL.svg +1 -0
- package/src/app/assets/flags/GM.svg +1 -0
- package/src/app/assets/flags/GN.svg +1 -0
- package/src/app/assets/flags/GP.svg +1 -0
- package/src/app/assets/flags/GQ.svg +1 -0
- package/src/app/assets/flags/GR.svg +1 -0
- package/src/app/assets/flags/GS.svg +1 -0
- package/src/app/assets/flags/GT.svg +1 -0
- package/src/app/assets/flags/GU.svg +1 -0
- package/src/app/assets/flags/GW.svg +1 -0
- package/src/app/assets/flags/GY.svg +1 -0
- package/src/app/assets/flags/HK.svg +1 -0
- package/src/app/assets/flags/HM.svg +1 -0
- package/src/app/assets/flags/HN.svg +1 -0
- package/src/app/assets/flags/HR.svg +1 -0
- package/src/app/assets/flags/HT.svg +1 -0
- package/src/app/assets/flags/HU.svg +1 -0
- package/src/app/assets/flags/IC.svg +1 -0
- package/src/app/assets/flags/ID.svg +1 -0
- package/src/app/assets/flags/IE.svg +1 -0
- package/src/app/assets/flags/IL.svg +1 -0
- package/src/app/assets/flags/IM.svg +1 -0
- package/src/app/assets/flags/IN.svg +1 -0
- package/src/app/assets/flags/IO.svg +1 -0
- package/src/app/assets/flags/IQ.svg +1 -0
- package/src/app/assets/flags/IR.svg +1 -0
- package/src/app/assets/flags/IS.svg +1 -0
- package/src/app/assets/flags/IT.svg +1 -0
- package/src/app/assets/flags/JE.svg +1 -0
- package/src/app/assets/flags/JM.svg +1 -0
- package/src/app/assets/flags/JO.svg +1 -0
- package/src/app/assets/flags/JP.svg +1 -0
- package/src/app/assets/flags/KE.svg +1 -0
- package/src/app/assets/flags/KG.svg +1 -0
- package/src/app/assets/flags/KH.svg +1 -0
- package/src/app/assets/flags/KI.svg +1 -0
- package/src/app/assets/flags/KM.svg +1 -0
- package/src/app/assets/flags/KN.svg +1 -0
- package/src/app/assets/flags/KP.svg +1 -0
- package/src/app/assets/flags/KR.svg +1 -0
- package/src/app/assets/flags/KW.svg +1 -0
- package/src/app/assets/flags/KY.svg +1 -0
- package/src/app/assets/flags/KZ.svg +1 -0
- package/src/app/assets/flags/LA.svg +1 -0
- package/src/app/assets/flags/LB.svg +1 -0
- package/src/app/assets/flags/LC.svg +1 -0
- package/src/app/assets/flags/LI.svg +1 -0
- package/src/app/assets/flags/LK.svg +1 -0
- package/src/app/assets/flags/LR.svg +1 -0
- package/src/app/assets/flags/LS.svg +1 -0
- package/src/app/assets/flags/LT.svg +1 -0
- package/src/app/assets/flags/LU.svg +1 -0
- package/src/app/assets/flags/LV.svg +1 -0
- package/src/app/assets/flags/LY.svg +1 -0
- package/src/app/assets/flags/MA.svg +1 -0
- package/src/app/assets/flags/MC.svg +1 -0
- package/src/app/assets/flags/MD.svg +1 -0
- package/src/app/assets/flags/ME.svg +1 -0
- package/src/app/assets/flags/MF.svg +1 -0
- package/src/app/assets/flags/MG.svg +1 -0
- package/src/app/assets/flags/MH.svg +1 -0
- package/src/app/assets/flags/MK.svg +1 -0
- package/src/app/assets/flags/ML.svg +1 -0
- package/src/app/assets/flags/MM.svg +1 -0
- package/src/app/assets/flags/MN.svg +1 -0
- package/src/app/assets/flags/MO.svg +1 -0
- package/src/app/assets/flags/MP.svg +1 -0
- package/src/app/assets/flags/MQ.svg +1 -0
- package/src/app/assets/flags/MR.svg +1 -0
- package/src/app/assets/flags/MS.svg +1 -0
- package/src/app/assets/flags/MT.svg +1 -0
- package/src/app/assets/flags/MU.svg +1 -0
- package/src/app/assets/flags/MV.svg +1 -0
- package/src/app/assets/flags/MW.svg +1 -0
- package/src/app/assets/flags/MX.svg +1 -0
- package/src/app/assets/flags/MY.svg +1 -0
- package/src/app/assets/flags/MZ.svg +1 -0
- package/src/app/assets/flags/NA.svg +1 -0
- package/src/app/assets/flags/NC.svg +1 -0
- package/src/app/assets/flags/NE.svg +1 -0
- package/src/app/assets/flags/NF.svg +1 -0
- package/src/app/assets/flags/NG.svg +1 -0
- package/src/app/assets/flags/NI.svg +1 -0
- package/src/app/assets/flags/NL.svg +1 -0
- package/src/app/assets/flags/NO.svg +1 -0
- package/src/app/assets/flags/NP.svg +1 -0
- package/src/app/assets/flags/NR.svg +1 -0
- package/src/app/assets/flags/NU.svg +1 -0
- package/src/app/assets/flags/NZ.svg +1 -0
- package/src/app/assets/flags/OM.svg +1 -0
- package/src/app/assets/flags/PA.svg +1 -0
- package/src/app/assets/flags/PE.svg +1 -0
- package/src/app/assets/flags/PF.svg +1 -0
- package/src/app/assets/flags/PG.svg +1 -0
- package/src/app/assets/flags/PH.svg +1 -0
- package/src/app/assets/flags/PK.svg +1 -0
- package/src/app/assets/flags/PL.svg +1 -0
- package/src/app/assets/flags/PM.svg +1 -0
- package/src/app/assets/flags/PN.svg +1 -0
- package/src/app/assets/flags/PR.svg +1 -0
- package/src/app/assets/flags/PS.svg +1 -0
- package/src/app/assets/flags/PT.svg +1 -0
- package/src/app/assets/flags/PW.svg +1 -0
- package/src/app/assets/flags/PY.svg +1 -0
- package/src/app/assets/flags/QA.svg +1 -0
- package/src/app/assets/flags/RE.svg +1 -0
- package/src/app/assets/flags/README.md +6 -0
- package/src/app/assets/flags/RO.svg +1 -0
- package/src/app/assets/flags/RS.svg +1 -0
- package/src/app/assets/flags/RU.svg +1 -0
- package/src/app/assets/flags/RW.svg +1 -0
- package/src/app/assets/flags/SA.svg +1 -0
- package/src/app/assets/flags/SB.svg +1 -0
- package/src/app/assets/flags/SC.svg +1 -0
- package/src/app/assets/flags/SD.svg +1 -0
- package/src/app/assets/flags/SE.svg +1 -0
- package/src/app/assets/flags/SG.svg +1 -0
- package/src/app/assets/flags/SH.svg +1 -0
- package/src/app/assets/flags/SI.svg +1 -0
- package/src/app/assets/flags/SJ.svg +1 -0
- package/src/app/assets/flags/SK.svg +1 -0
- package/src/app/assets/flags/SL.svg +1 -0
- package/src/app/assets/flags/SM.svg +1 -0
- package/src/app/assets/flags/SN.svg +1 -0
- package/src/app/assets/flags/SO.svg +1 -0
- package/src/app/assets/flags/SR.svg +1 -0
- package/src/app/assets/flags/SS.svg +1 -0
- package/src/app/assets/flags/ST.svg +1 -0
- package/src/app/assets/flags/SV.svg +1 -0
- package/src/app/assets/flags/SX.svg +1 -0
- package/src/app/assets/flags/SY.svg +1 -0
- package/src/app/assets/flags/SZ.svg +1 -0
- package/src/app/assets/flags/TA.svg +1 -0
- package/src/app/assets/flags/TC.svg +1 -0
- package/src/app/assets/flags/TD.svg +1 -0
- package/src/app/assets/flags/TF.svg +1 -0
- package/src/app/assets/flags/TG.svg +1 -0
- package/src/app/assets/flags/TH.svg +1 -0
- package/src/app/assets/flags/TJ.svg +1 -0
- package/src/app/assets/flags/TK.svg +1 -0
- package/src/app/assets/flags/TL.svg +1 -0
- package/src/app/assets/flags/TM.svg +1 -0
- package/src/app/assets/flags/TN.svg +1 -0
- package/src/app/assets/flags/TO.svg +1 -0
- package/src/app/assets/flags/TR.svg +1 -0
- package/src/app/assets/flags/TT.svg +1 -0
- package/src/app/assets/flags/TV.svg +1 -0
- package/src/app/assets/flags/TW.svg +1 -0
- package/src/app/assets/flags/TZ.svg +1 -0
- package/src/app/assets/flags/UA.svg +1 -0
- package/src/app/assets/flags/UG.svg +1 -0
- package/src/app/assets/flags/UM.svg +1 -0
- package/src/app/assets/flags/US.svg +1 -0
- package/src/app/assets/flags/UY.svg +1 -0
- package/src/app/assets/flags/UZ.svg +1 -0
- package/src/app/assets/flags/VA.svg +1 -0
- package/src/app/assets/flags/VC.svg +1 -0
- package/src/app/assets/flags/VE.svg +1 -0
- package/src/app/assets/flags/VG.svg +1 -0
- package/src/app/assets/flags/VI.svg +1 -0
- package/src/app/assets/flags/VN.svg +1 -0
- package/src/app/assets/flags/VU.svg +1 -0
- package/src/app/assets/flags/WF.svg +1 -0
- package/src/app/assets/flags/WS.svg +1 -0
- package/src/app/assets/flags/XA.svg +1 -0
- package/src/app/assets/flags/XC.svg +1 -0
- package/src/app/assets/flags/XK.svg +1 -0
- package/src/app/assets/flags/XO.svg +1 -0
- package/src/app/assets/flags/YE.svg +1 -0
- package/src/app/assets/flags/YT.svg +1 -0
- package/src/app/assets/flags/ZA.svg +1 -0
- package/src/app/assets/flags/ZM.svg +1 -0
- package/src/app/assets/flags/ZW.svg +1 -0
- package/src/app/email-preview.ts +46 -0
- package/src/app/index.css +203 -0
- package/src/app/index.html +12 -0
- package/src/app/integrations/i18n/react-i18next.d.ts +11 -0
- package/src/app/integrations/i18n/root-provider.tsx +62 -0
- package/src/app/integrations/tanstack-query/devtools.tsx +6 -0
- package/src/app/integrations/tanstack-query/root-provider.tsx +37 -0
- package/src/app/integrations/theme/root-provider.tsx +75 -0
- package/src/app/integrations/toast/toast-provider.tsx +46 -0
- package/src/app/locales/en-US/common.ts +268 -0
- package/src/app/locales/zh-CN/common.ts +263 -0
- package/src/app/main.tsx +40 -0
- package/src/app/page-chrome.tsx +79 -0
- package/src/app/router.tsx +40 -0
- package/src/app/routes/__root.tsx +293 -0
- package/src/app/routes/emails.tsx +199 -0
- package/src/app/routes/home.tsx +87 -0
- package/src/app/routes/index.ts +19 -0
- package/src/app/routes/metrics.tsx +541 -0
- package/src/app/routes/segment-overview.tsx +211 -0
- package/src/app/routes/segments.tsx +236 -0
- package/src/app/routes/settings.tsx +90 -0
- package/src/app/routes/workflows.tsx +348 -0
- package/src/app/studio.ts +16 -0
- package/src/app/svg.d.ts +17 -0
- package/src/app/virtual-config.d.ts +6 -0
- package/src/cli.ts +110 -0
- package/src/components/avatar.tsx +57 -0
- package/src/components/breadcrumb.tsx +49 -0
- package/src/components/button/index.tsx +86 -0
- package/src/components/channel-icon.ts +39 -0
- package/src/components/chat-markup.tsx +109 -0
- package/src/components/corner-shape.ts +13 -0
- package/src/components/date-range.tsx +181 -0
- package/src/components/discord-preview.tsx +165 -0
- package/src/components/dropdown/index.tsx +172 -0
- package/src/components/email-defaults.tsx +40 -0
- package/src/components/email-list.tsx +149 -0
- package/src/components/email-thumbnail.tsx +123 -0
- package/src/components/flag.tsx +40 -0
- package/src/components/input/index.tsx +40 -0
- package/src/components/input/search-input.tsx +24 -0
- package/src/components/layout.ts +403 -0
- package/src/components/menu/index.tsx +118 -0
- package/src/components/metric-card.tsx +321 -0
- package/src/components/modal/index.tsx +70 -0
- package/src/components/nav-drawer.tsx +84 -0
- package/src/components/node-inspector.tsx +242 -0
- package/src/components/profile-drawer.tsx +331 -0
- package/src/components/push-preview.tsx +470 -0
- package/src/components/push-thumbnail.tsx +78 -0
- package/src/components/segment-list.tsx +184 -0
- package/src/components/select/index.tsx +70 -0
- package/src/components/series-chart.tsx +120 -0
- package/src/components/slack-preview.tsx +223 -0
- package/src/components/sparkline.tsx +58 -0
- package/src/components/tabs/index.tsx +45 -0
- package/src/components/template-refs.ts +110 -0
- package/src/components/templates-page.tsx +601 -0
- package/src/components/textarea/index.tsx +37 -0
- package/src/components/thumbnail-window.tsx +65 -0
- package/src/components/workflow-canvas.tsx +503 -0
- package/src/components/workflow-list.tsx +231 -0
- package/src/config.ts +288 -0
- package/src/generate.ts +56 -0
- package/src/index.ts +35 -0
- package/src/postgres.ts +415 -0
- package/src/server/project.ts +290 -0
- package/src/server.ts +500 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/label.ts +12 -0
- package/src/utils/lookup.ts +11 -0
- package/src/utils/template-content.ts +213 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#012169" d="M0 0h513v342H0z"/><path fill="#ffc72c" d="m384.8 174.7-46.2 46.2c8.7 16.7 26.1 28.1 46.2 28.1s37.6-11.4 46.2-28.1l-46.2-46.2z"/><path fill="#006129" stroke="#fff" stroke-width="3" d="M332.7 93v81.8c0 39.8 52 52 52 52s52-12.2 52-52V93h-104z"/><path fill="#FFF" d="M373.6 130.1h22.3v59.5h-22.3z"/><circle fill="#9c4c00" cx="384.8" cy="130.1" r="11.2"/><g fill="#ffc72c"><path d="M347.6 107.8h14.9v14.9h-14.9zM347.6 141.3h14.9v14.9h-14.9zM347.6 174.7h14.9v14.9h-14.9zM407.1 107.8H422v14.9h-14.9zM407.1 141.3H422v14.9h-14.9zM407.1 174.7H422v14.9h-14.9z"/></g><path fill="#012169" d="M0 0h256.5v171H0z"/><g fill="#FFF"><path d="M256.5 0v30.6l-45.3 25.2h45.3v59.4h-59.2l59.2 32.9V171h-26.7l-73.7-40.9V171h-55.7v-48.7L12.8 171H0v-30.6l45.3-25.2H0V55.8h59.2L0 22.9V0h26.7l73.7 40.9V0h55.7v48.7L243.7 0z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM100.4 55.8 0 0v15.8l72 40z"/></g><g fill="#D80027"><path d="M144.3 0h-32.1v69.5H0v32h112.2V171h32.1v-69.5h112.2v-32H144.3z"/><path d="M156.1 115.2 256.5 171v-15.8l-72-40zM72 115.2l-72 40V171l100.4-55.8zM100.4 55.8 0 0v15.8l72 40zM184.5 55.8l72-40V0L156.1 55.8z"/></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#FFF" d="M0 0h512v341.3H0z"/><path fill="#1583C4" d="m397.7 166.3-51 97.7c-1.1 2-.3 4.5 1.8 5.6 2 1.1 4.5.3 5.6-1.8l51-97.7c1-2.1.1-4.6-2-5.5-2-.9-4.3-.2-5.4 1.7z"/><path fill="#1583C4" d="m404.9 188-57.8 75.4c-1.3 1.9-.8 4.5 1.1 5.8 1.7 1.2 4.1.9 5.5-.7l57.8-75.4c1.4-1.8 1.1-4.4-.8-5.8-1.8-1.5-4.4-1.1-5.8.7z"/><path fill="#1583C4" d="m379 181.3-32.5 83.1c-.8 2.1.2 4.6 2.4 5.4 2.1.8 4.6-.2 5.4-2.4l32.5-83.1c.7-2.2-.4-4.5-2.6-5.3-2.1-.6-4.3.4-5.2 2.3z"/><path fill="#409347" d="M122.1 171.9c.4 1.7 1.2 4.7 2.2 8.5 1.7 6.4 3.6 12.8 5.6 18.7 2.3 6.9 14.7 31.4 20.2 39.1 6.9 9.7 14.1 19.3 21.5 28.6 1.6 1.9 4.5 2.1 6.4.5 1.8-1.6 2.1-4.3.7-6.2-7.3-9.2-14.4-18.6-21.2-28.2-4.2-5.8-17.2-31.1-19-36.7-2.9-8.7-5.4-17.6-7.6-26.5-.5-2.4-2.9-4-5.3-3.5s-4 2.9-3.5 5.3c-.1.2 0 .3 0 .4z"/><g fill="#FFD836" stroke="#231F20" stroke-miterlimit="10"><path d="M297.1 114.9S279.5 42.8 261 42.8c-6.9 0-11.9-.6-15.4 6.4-.9 1.7-20.7-1.6-19.1 20.8.5 6.9 1.1-9.8 14.9-3.4 6.3 3-16.4 48.2-16.4 48.2h72.1z"/><path d="m466.1 48.4-90.9 22c-75.3 18.3-42.1 44.4-42.1 44.4l-72.1 12-72.1-12s33.2-26.1-42.1-44.4l-90.9-22C43.1 45.3 38.1 51.8 45.3 63c0 0 106.6 104 126.8 112 20.2 8.1 40.8 0 40.8 0s-14.9 8.7-24 24c-9.2 15.3-4.6 34.7-38.9 40.2-5.5 6.6-5 14 2.9 19.9 7.9 5.8 72.1-48.1 72.1-48.1s-24 24.4-24 36.1c0 5.1 44.1 53.8 60.1 53.8s60.1-48.7 60.1-53.8c0-11.7-24-36.1-24-36.1s64.2 53.9 72.1 48.1 11.4-19.3 2.8-19.9c-28-1.8-29.7-24.9-38.9-40.2-9.2-15.3-24-24-24-24s20.6 8.1 40.8 0S476.7 63 476.7 63c7.2-11.2 2.3-17.7-10.6-14.6z"/></g><path fill="#FFF" stroke="#231F20" stroke-miterlimit="10" d="M201.3 111.8v80.3c0 45.7 59.7 59.7 59.7 59.7s59.7-14 59.7-59.7v-80.3H201.3z"/><g fill="#D80027"><path d="M225.2 137.7V235c8.2 6 17 10.2 23.9 12.9V137.7h-23.9zM296.8 137.7V235c-8.2 6-17 10.2-23.9 12.9V137.7h23.9z"/></g><path fill="#0052B4" d="M201.3 111.8h119.4v37.9H201.3z"/><path fill="#1583C4" d="m60.1 210.5-21.9-58.1H15.7l31.8 80.8h25.2l31.5-80.8H81.7zM451.5 151.9h18.9v81.7h-18.9z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M196.641 85.337H0v341.326h512V85.337z"/><path fill="#FFDA44" d="m256 157.279 22.663 69.747H352l-59.332 43.106 22.664 69.749L256 296.774l-59.332 43.107 22.664-69.749L160 227.026h73.337z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path d="M0 85.337h512v341.326H0z"/><path fill="#6DA544" d="M512 256v170.663H0L215.185 256z"/><path fill="#D80027" d="M512 85.337V256H215.185L0 85.337z"/><path d="M221.001 239.304 26.868 85.337H8.956l208.168 165.098H512v-11.131zM8.956 426.663h17.912l194.133-153.967H512v-11.131H217.124zM0 92.44v14.206L188.317 256 0 405.354v14.205L206.229 256z"/><g fill="#FFDA44"><path d="M8.956 85.337H0v7.103L206.229 256 0 419.559v7.104h8.956l208.168-165.098H512v-11.13H217.124z"/><path d="M63.718 292.382v-14.295c14.265 0 25.87-11.606 25.87-25.869 0-10.092-8.211-18.303-18.304-18.303-6.875 0-12.469 5.593-12.469 12.469 0 4.397 3.577 7.974 7.974 7.974a4.514 4.514 0 0 0 4.508-4.508h14.295c0 10.368-8.435 18.804-18.802 18.804-12.279-.002-22.269-9.993-22.269-22.271 0-14.758 12.006-26.764 26.764-26.764 17.975 0 32.599 14.623 32.599 32.599 0 22.145-18.018 40.164-40.166 40.164z"/></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100"><path fill="#D80B30" d="M0 0h150v100H0z"/><path fill="#00318A" d="M0 0h20v44.33H0z"/><path fill="#FFF" d="M20 0h20v44.33H20z"/><path fill="none" stroke="#FFF" stroke-width="3" d="M0 44.33h62.75V0"/><path fill="#FFF" d="M108.08 43.29 87.96 23.17h40.25l-20.13 20.12zm-6.7 6.71L81.25 29.88v40.25L101.38 50zm6.7 6.71L87.96 76.83h40.25l-20.13-20.12zm6.71-6.71 20.13-20.13v40.25L114.79 50z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.331h512v341.337H0z"/><path fill="#0052B4" d="M0 85.331h256v170.663H0z"/><g fill="#FFF"><path d="m165.483 181.79 2.764 8.504h8.939l-7.232 5.254 2.763 8.503-7.234-5.255-7.233 5.255 2.763-8.503-7.233-5.254h8.94zM120.579 115.007l4.606 14.173h14.9l-12.055 8.757 4.605 14.171-12.056-8.758-12.054 8.758 4.605-14.171-12.056-8.757h14.901zM165.101 129.848l4.606 14.172h14.9l-12.055 8.757 4.604 14.173-12.055-8.76-12.054 8.76 4.604-14.173-12.055-8.757h14.9zM129.909 189.211l4.606 14.172h14.9l-12.055 8.758 4.604 14.171-12.055-8.759-12.054 8.759 4.604-14.171-12.055-8.758h14.9zM90.899 152.108l4.605 14.173h14.9l-12.055 8.757 4.604 14.173-12.054-8.76-12.055 8.76 4.604-14.173-12.055-8.757h14.9z"/></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFF" d="M0 0h513v342H0z"/><g fill="#6DA544"><path d="M0 0h513v48.8H0zM0 97.5h513v48.8H0zM0 195h513v48.8H0zM0 292.6h513v48.8H0z"/></g><path fill="#D80027" d="M0 0h256.5v146.3H0z"/><path fill="#FFF" d="m116.9 114.4-7.5-14.8V69.9L128 59l18.6 10.9v22.3l7.4-7.4 4.2 3-4.2 11.8-14.9 14.8z"/><circle fill="#FFF" cx="82" cy="82.8" r="5.4"/><circle fill="#FFF" cx="90.8" cy="61.7" r="5.4"/><circle fill="#FFF" cx="106.6" cy="46.2" r="5.4"/><circle fill="#FFF" cx="128" cy="40.8" r="5.4"/><circle fill="#FFF" cx="149.4" cy="46.2" r="5.4"/><circle fill="#FFF" cx="165.2" cy="61.7" r="5.4"/><circle fill="#FFF" cx="174" cy="82.8" r="5.4"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600"><path d="M0 0h900v600H0z" fill="#fff"/><circle fill="#e30a17" cx="300" cy="300" r="150"/><circle cx="337.5" cy="300" r="120" fill="#fff"/><path fill="#e30a17" d="M0 60h900v60H0zm0 420h900v60H0zm417.5-180 135.676-44.084-83.852 115.413V228.671l83.852 115.413z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.33"><path fill="#0052B4" d="M0 0h512v341.34H0z"/><g fill="#FFF"><path d="m220.72 42.63 7.95 16.11 17.77 2.58-12.86 12.54 3.04 17.7-15.9-8.36-15.9 8.36 3.03-17.7-12.86-12.54 17.78-2.58zM291.28 42.57l7.95 16.1 17.78 2.59-12.86 12.53 3.03 17.71-15.9-8.36-15.9 8.36 3.04-17.71-12.86-12.53 17.77-2.59zM353.36 53.93l7.95 16.11 17.77 2.58-12.86 12.54 3.04 17.7-15.9-8.35-15.9 8.35 3.04-17.7-12.87-12.54 17.78-2.58zM416.37 72.23l7.95 16.11 17.77 2.59-12.86 12.53 3.04 17.71-15.9-8.36-15.9 8.36 3.03-17.71-12.86-12.53 17.78-2.59zM158.64 53.93l7.95 16.11 17.78 2.58-12.87 12.54 3.04 17.7-15.9-8.35-15.9 8.35 3.04-17.7-12.86-12.54 17.77-2.58zM95.63 72.23l7.95 16.11 17.78 2.59-12.86 12.53 3.03 17.71-15.9-8.36-15.9 8.36 3.04-17.71-12.86-12.53 17.77-2.59z"/></g><path fill="#FFDA44" d="m217.53 259.33-27.22-13.61-27.22-54.43h27.22l27.22-27.22 13.61-27.22 27.22-13.61 13.61 13.61 27.22 13.61v13.61l13.61 13.61 40.83 27.22L340 245.73l-40.83 40.83-13.61-27.22-40.83 27.22v27.22l-13.61-13.61-13.59-40.84z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 450 300"><path fill="#FFF" d="M0 0h450v300H0z"/><path fill="red" d="M0 100h450v200H0z"/><path fill="#FFDF00" d="M0 200h450v100H0z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFF" d="M0 85.337h512v341.326H0z"/><path fill="#D80027" d="M0 85.337h512v113.775H0z"/><path d="M0 312.888h512v113.775H0z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 90 60"><path fill="#FFF" d="M0 0h90v60H0z"/><path stroke="#7f7f7f" stroke-width=".25" fill="#ABABAB" d="M75.6 39.6c-1.1.7 0 1.8-.6 1.9-.6.1-1.5-1.4-.2-2.5 1.6-1.5 5.8 0 5.9 4.3 0 2.2-.9 6.8-7.2 6.8-7.6 0-11.4-5.7-11.4-11.4 0-4.8 3.7-13.5 6.5-14.6 3.1-1.2 6.7-3.5 6.8-5 0-.5-1.4-.1-3.3.9-3.1 1.7-6.6 2.5-6.6 1.4s2.9-3.1 4-4.6c1.2-1.6.9-5.5 3-5.5 7.6 0 9.9 7.7 7 11.7-1.9 2.6 4.3 1 4.3 1s0 5.3-3.2 7.3c-3 1.8-4.8 3.9-4.8 3.9s.2-4.6-.5-3.9c-.6.7-11.1 4.5-10.3 12 .3 3 4.5 5.4 8.5 5.2s5.7-2.4 5.8-4.9c.1-3.9-3-4.4-3.7-4zM10.7 43.6c.1 2.5 1.8 4.7 5.8 4.9s8.2-2.2 8.5-5.2c.8-7.5-9.7-11.3-10.3-12-.7-.7-.5 3.9-.5 3.9s-1.8-2.1-4.8-3.9c-3.2-2-3.2-7.3-3.2-7.3s6.2 1.6 4.3-1c-2.9-4-.6-11.7 7-11.7 2.1 0 1.8 3.9 3 5.5 1.1 1.5 4 3.5 4 4.6s-3.5.3-6.6-1.4c-1.9-1-3.3-1.4-3.3-.9.1 1.5 3.7 3.8 6.8 5 2.8 1.1 6.5 9.8 6.5 14.6 0 5.7-3.8 11.4-11.4 11.4-6.3 0-7.2-4.6-7.2-6.8.1-4.3 4.3-5.8 5.9-4.3 1.2 1.1.4 2.7-.2 2.5-.6-.1.6-1.2-.6-1.9-.6-.4-3.7.1-3.7 4z"/><path fill="#DE393A" d="M31 28.8v14c0 1.9 2.1 1.6 2.1 1.6h9.3c1.2 0 2.6 2.3 2.6 2.3s1.4-2.3 2.5-2.3h9.6s2 .2 2-1.8V28.7H31z"/><path fill="#3951A3" d="M31 13.1h28v15.7H31z"/><path fill="#FFF" d="M50.1 16.5c-.4 2.4-2.5 4.2-5.1 4.2-2.5 0-4.6-1.8-5.1-4.2-.5.9-.8 1.9-.8 3 0 3.3 2.6 5.9 5.9 5.9 3.3 0 5.9-2.6 5.9-5.9 0-1.1-.3-2.1-.8-3z"/><circle fill="#FEE05F" cx="39.1" cy="36.5" r="3"/><circle fill="#FEE05F" cx="50.9" cy="36.5" r="3"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFF" d="M0 85.337h512v341.326H0z"/><path d="M114.024 256.001 0 141.926v228.17z"/><path fill="#ffb915" d="M161.192 256 0 94.7v47.226l114.024 114.075L0 370.096v47.138z"/><path fill="#007847" d="M509.833 289.391c.058-.44.804-.878 2.167-1.318v-65.464H222.602L85.33 85.337H0V94.7L161.192 256 0 417.234v9.429h85.33l137.272-137.272h287.231z"/><path fill="#000c8a" d="M503.181 322.783H236.433l-103.881 103.88H512v-103.88z"/><path fill="#e1392d" d="M503.181 189.217H512V85.337H132.552l103.881 103.88z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.331h512v341.337H0z"/><path fill="#FF9811" d="M490.668 195.476h-48c0-8.836-7.164-16-16-16s-16 7.164-16 16h-48c0 8.836 7.697 16 16.533 16h-.533c0 8.836 7.162 16 16 16 0 8.836 7.162 16 16 16h32c8.836 0 16-7.164 16-16 8.836 0 16-7.164 16-16h-.533c8.837 0 16.533-7.164 16.533-16z"/><path fill="#D80027" d="M341.337 255.994h56.888v170.663h-56.888z"/><path fill="#FF9811" d="M455.112 255.994H512v170.663h-56.888z"/><path d="M398.225 255.994h56.888v170.663h-56.888z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path d="M0 85.333h512V426.67H0z"/><g fill="#FFDA44"><path d="M0 134.196h512v48.868H0zM0 329.668h512v48.868H0z"/></g><path fill="#057f44" d="M0 85.333h512v48.868H0z"/><g fill="#D80027"><path d="M0 183.069h512v48.868H0zM0 280.806h512v48.868H0z"/></g><path fill="#057f44" d="M0 378.542h512v48.128H0z"/><path fill="#FFF" d="M276.992 255.996 106.329 426.659H0V85.333h106.329z"/><path d="M256 255.996 85.334 426.662h20.987l170.667-170.666L106.321 85.33H85.334z"/><path fill="#D80027" d="m102.465 202.57 13.259 40.812h42.917l-34.718 25.226 13.26 40.814-34.718-25.224-34.72 25.224 13.262-40.814-34.718-25.226h42.915z"/><path fill="#FFDA44" d="m138.94 259.335-34.559-12.243s-2.553-23.955-2.708-24.766c-1.173-6.18-6.603-10.851-13.123-10.851-7.376 0-13.357 5.98-13.357 13.357 0 1.223.178 2.402.486 3.528l-9.689 9.755h17.229c0 17.882-13.344 17.882-13.344 35.691l7.402 17.809h44.522l7.422-17.809h-.004a17.782 17.782 0 0 0 1.381-5.231c6.397-2.589 8.342-9.24 8.342-9.24z"/></svg>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { render } from '@react-email/render';
|
|
2
|
+
import type { EmailTemplate } from '@shware/workflow';
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import { createElement } from 'react';
|
|
5
|
+
import {
|
|
6
|
+
type Props,
|
|
7
|
+
type TemplateFailure,
|
|
8
|
+
entryIdentity,
|
|
9
|
+
prepareEmail,
|
|
10
|
+
renderFailure,
|
|
11
|
+
} from '../utils/template-content';
|
|
12
|
+
|
|
13
|
+
/** One preview render: the document, or the reason there is none — never both. */
|
|
14
|
+
export type EmailPreviewResult =
|
|
15
|
+
| { status: 'ok'; html: string; subject: string | undefined }
|
|
16
|
+
| { status: 'invalid'; failure: TemplateFailure };
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Render one registered template to HTML; the query keeps it off the render
|
|
20
|
+
* path. Every surface that previews the same template with the same props —
|
|
21
|
+
* the templates page, the canvas inspector — shares one render.
|
|
22
|
+
*
|
|
23
|
+
* The key carries the entry's identity and the props, so an HMR edit (a new
|
|
24
|
+
* module object) or an in-memory prop change is a new render that validates
|
|
25
|
+
* again, and a refusal is this render's result rather than an error sitting
|
|
26
|
+
* beside the last success. A definition parses its props first (see
|
|
27
|
+
* prepareEmail); a component that throws is a failure too.
|
|
28
|
+
*/
|
|
29
|
+
export function useEmailPreview(mod: EmailTemplate | undefined, key: string, props?: Props) {
|
|
30
|
+
return useQuery({
|
|
31
|
+
queryKey: ['email-preview', key, entryIdentity(mod), props ?? null],
|
|
32
|
+
queryFn: async (): Promise<EmailPreviewResult> => {
|
|
33
|
+
if (mod === undefined) throw new Error(`no email registered for '${key}'`);
|
|
34
|
+
const prepared = prepareEmail(mod, key, props);
|
|
35
|
+
if (!prepared.ok) return { status: 'invalid', failure: prepared.failure };
|
|
36
|
+
const { component, props: parsed, subject } = prepared.email;
|
|
37
|
+
try {
|
|
38
|
+
return { status: 'ok', html: await render(createElement(component, parsed)), subject };
|
|
39
|
+
} catch (error) {
|
|
40
|
+
return { status: 'invalid', failure: renderFailure(error) };
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
enabled: mod !== undefined,
|
|
44
|
+
retry: false,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
@import '@fontsource-variable/inter';
|
|
2
|
+
@import 'tailwindcss';
|
|
3
|
+
@import '@xyflow/react/dist/style.css';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Tailwind's automatic content detection starts from the project being served,
|
|
7
|
+
* which is the user's — so the studio's own sources must be declared. Paths are
|
|
8
|
+
* relative to this file.
|
|
9
|
+
*/
|
|
10
|
+
@source '.';
|
|
11
|
+
@source '../components';
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Class-driven, not media-driven. Tailwind's stock `dark:` follows the OS, which
|
|
15
|
+
* would half-flip the studio for anyone running dark mode while the rest of the
|
|
16
|
+
* app stays light. This keeps the dark styles inert until a `dark` class exists.
|
|
17
|
+
*/
|
|
18
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
19
|
+
|
|
20
|
+
@theme {
|
|
21
|
+
--font-sans: 'Inter Variable', ui-sans-serif, system-ui, sans-serif;
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Type scale, shared with the template app so every product speaks one ramp.
|
|
25
|
+
* Components only use these steps — never arbitrary values like text-[13px].
|
|
26
|
+
*/
|
|
27
|
+
--text-xs: 0.75rem;
|
|
28
|
+
--text-xs--line-height: 1rem;
|
|
29
|
+
--text-sm: 0.875rem;
|
|
30
|
+
--text-sm--line-height: 1.25rem;
|
|
31
|
+
--text-md: 1rem;
|
|
32
|
+
--text-md--line-height: 1.5rem;
|
|
33
|
+
--text-lg: 1.125rem;
|
|
34
|
+
--text-lg--line-height: 1.75rem;
|
|
35
|
+
--text-xl: 1.25rem;
|
|
36
|
+
--text-xl--line-height: 1.75rem;
|
|
37
|
+
--text-2xl: 1.5rem;
|
|
38
|
+
--text-2xl--line-height: 2rem;
|
|
39
|
+
--text-3xl: 1.875rem;
|
|
40
|
+
--text-3xl--line-height: 2.375rem;
|
|
41
|
+
--text-4xl: 2.25rem;
|
|
42
|
+
--text-4xl--line-height: 2.75rem;
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* The studio's grey scale. Everything addresses it as `gray-*` and nothing
|
|
46
|
+
* addresses a Tailwind palette by name; these eleven values are the single
|
|
47
|
+
* place a ramp is chosen. Swap them for another and the whole app follows,
|
|
48
|
+
* SVG fills included — they read the same variables.
|
|
49
|
+
*/
|
|
50
|
+
--color-gray-50: oklch(0.985 0 0);
|
|
51
|
+
--color-gray-100: oklch(0.967 0.001 286.375);
|
|
52
|
+
--color-gray-200: oklch(0.92 0.004 286.32);
|
|
53
|
+
--color-gray-300: oklch(0.871 0.006 286.286);
|
|
54
|
+
--color-gray-400: oklch(0.705 0.015 286.067);
|
|
55
|
+
--color-gray-500: oklch(0.552 0.016 285.938);
|
|
56
|
+
--color-gray-600: oklch(0.442 0.017 285.786);
|
|
57
|
+
--color-gray-700: oklch(0.37 0.013 285.805);
|
|
58
|
+
--color-gray-800: oklch(0.274 0.006 286.033);
|
|
59
|
+
--color-gray-900: oklch(0.21 0.006 285.885);
|
|
60
|
+
--color-gray-950: oklch(0.141 0.005 285.823);
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* Semantic aliases — the only colours components should name. The ramp above
|
|
64
|
+
* is a palette; these are roles, and they are what flips between themes. The
|
|
65
|
+
* studio is monochrome, so `accent` stays reserved for the one-per-view call
|
|
66
|
+
* to action — currently Tailwind's sky.
|
|
67
|
+
*/
|
|
68
|
+
--color-accent: var(--color-sky-600);
|
|
69
|
+
--color-accent-hover: oklch(from var(--color-accent) l c h / 0.1);
|
|
70
|
+
/* Focus/selection halo. Derived, so it follows the accent into dark mode. */
|
|
71
|
+
--color-accent-ring: oklch(from var(--color-accent) l c h / 0.25);
|
|
72
|
+
--color-primary: var(--color-gray-900);
|
|
73
|
+
--color-secondary: var(--color-gray-600);
|
|
74
|
+
--color-muted: var(--color-gray-500);
|
|
75
|
+
--color-border: var(--color-gray-200);
|
|
76
|
+
--color-hover: var(--color-gray-50);
|
|
77
|
+
--color-selected: var(--color-gray-100);
|
|
78
|
+
/*
|
|
79
|
+
* Surfaces: the page is the backdrop, cards are what sits on it. The chrome
|
|
80
|
+
* (rail, header) is `card`, so the content area reads as inset. Dark mode
|
|
81
|
+
* makes the same split the other way round — a black page under grey cards.
|
|
82
|
+
*/
|
|
83
|
+
--color-page: var(--color-gray-50);
|
|
84
|
+
--color-card: #fff;
|
|
85
|
+
/*
|
|
86
|
+
* Form controls, same roles as the template app so ported fields just work.
|
|
87
|
+
* A field is the top of the surface stack, so it is white: it lifts off the
|
|
88
|
+
* grey page, and on a white card its border is what draws the box.
|
|
89
|
+
*/
|
|
90
|
+
--color-textfield: #fff;
|
|
91
|
+
--color-placeholder: var(--color-gray-400);
|
|
92
|
+
/*
|
|
93
|
+
* The canvas surface, set explicitly because react-flow's dark colorMode
|
|
94
|
+
* otherwise paints its own `--xy-background-color-default` (#141414), which
|
|
95
|
+
* lands right next to the card colour and flattens the cards into it.
|
|
96
|
+
*/
|
|
97
|
+
--color-canvas: var(--color-gray-50);
|
|
98
|
+
--color-edge: var(--color-gray-300);
|
|
99
|
+
/* react-flow's default dot is #91919a, outside the ramp; this replaces it. */
|
|
100
|
+
--color-grid: var(--color-gray-400);
|
|
101
|
+
/*
|
|
102
|
+
* Node icons, one hue per NodeCategory rather than per icon: the point is to
|
|
103
|
+
* tell a message from a wait from a branch at a glance, and six colours do
|
|
104
|
+
* that where fifteen would just be noise. Exit stays grey — it is an ending,
|
|
105
|
+
* not a kind of work.
|
|
106
|
+
*/
|
|
107
|
+
--color-icon-trigger: var(--color-amber-500);
|
|
108
|
+
--color-icon-message: var(--color-sky-500);
|
|
109
|
+
--color-icon-delay: var(--color-violet-500);
|
|
110
|
+
--color-icon-control: var(--color-pink-500);
|
|
111
|
+
--color-icon-data: var(--color-emerald-500);
|
|
112
|
+
--color-icon-exit: var(--color-muted);
|
|
113
|
+
--color-card-shadow: oklch(from var(--color-gray-900) l c h / 0.08);
|
|
114
|
+
/*
|
|
115
|
+
* Chart series, deepening as the funnel narrows. The ramp has to invert
|
|
116
|
+
* between themes: `gray-900` is the strongest line on a white page and an
|
|
117
|
+
* invisible one on a black page.
|
|
118
|
+
*/
|
|
119
|
+
--color-chart-1: var(--color-gray-400);
|
|
120
|
+
--color-chart-2: var(--color-gray-500);
|
|
121
|
+
--color-chart-3: var(--color-gray-700);
|
|
122
|
+
--color-chart-4: var(--color-gray-900);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.dark {
|
|
126
|
+
color-scheme: dark;
|
|
127
|
+
--color-accent: var(--color-sky-400);
|
|
128
|
+
--color-primary: var(--color-gray-100);
|
|
129
|
+
--color-secondary: var(--color-gray-400);
|
|
130
|
+
--color-muted: var(--color-gray-500);
|
|
131
|
+
--color-border: var(--color-gray-800);
|
|
132
|
+
/*
|
|
133
|
+
* Same as the sidebar's card colour: row hovers on the black page match the
|
|
134
|
+
* rail. Popups sit on `card` (also gray-900), so their item highlight uses
|
|
135
|
+
* `selected`, one step brighter, or it would vanish.
|
|
136
|
+
*/
|
|
137
|
+
--color-hover: var(--color-gray-900);
|
|
138
|
+
--color-selected: var(--color-gray-800);
|
|
139
|
+
--color-page: #000;
|
|
140
|
+
--color-card: var(--color-gray-900);
|
|
141
|
+
/*
|
|
142
|
+
* Same rule as light — the field sits above every surface it can land on.
|
|
143
|
+
* Here that means clearing both the black page and a `card`, which rules out
|
|
144
|
+
* `gray-900`; `gray-800` is the one step that reads against both.
|
|
145
|
+
*/
|
|
146
|
+
--color-textfield: var(--color-gray-800);
|
|
147
|
+
/* Lifted with the field it sits in: gray-600 on gray-800 reads as disabled. */
|
|
148
|
+
--color-placeholder: var(--color-gray-500);
|
|
149
|
+
/* Pure black under the grid, so the cards above it have the most room to lift. */
|
|
150
|
+
--color-canvas: #000;
|
|
151
|
+
--color-edge: var(--color-gray-700);
|
|
152
|
+
--color-grid: var(--color-gray-700);
|
|
153
|
+
/* One step brighter, so the hues keep their bite against a dark card. */
|
|
154
|
+
--color-icon-trigger: var(--color-amber-400);
|
|
155
|
+
--color-icon-message: var(--color-sky-400);
|
|
156
|
+
--color-icon-delay: var(--color-violet-400);
|
|
157
|
+
--color-icon-control: var(--color-pink-400);
|
|
158
|
+
--color-icon-data: var(--color-emerald-400);
|
|
159
|
+
--color-icon-exit: var(--color-muted);
|
|
160
|
+
--color-card-shadow: oklch(from var(--color-gray-950) l c h / 0.6);
|
|
161
|
+
--color-chart-1: var(--color-gray-600);
|
|
162
|
+
--color-chart-2: var(--color-gray-500);
|
|
163
|
+
--color-chart-3: var(--color-gray-300);
|
|
164
|
+
--color-chart-4: var(--color-gray-100);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/*
|
|
168
|
+
* react-flow's own chrome (the zoom controls) on the studio's ramp instead of
|
|
169
|
+
* its stock palette. Its components read `--xy-*` with a `-default` fallback,
|
|
170
|
+
* so setting the un-suffixed names wins in both of its colour modes. Unlayered
|
|
171
|
+
* on purpose: react-flow's stylesheet is unlayered too, and a rule inside
|
|
172
|
+
* @layer base would lose to it. Only custom properties are set here, so no
|
|
173
|
+
* utility class can be shadowed.
|
|
174
|
+
*/
|
|
175
|
+
.react-flow {
|
|
176
|
+
--xy-controls-button-background-color: var(--color-card);
|
|
177
|
+
--xy-controls-button-background-color-hover: var(--color-selected);
|
|
178
|
+
--xy-controls-button-color: var(--color-secondary);
|
|
179
|
+
--xy-controls-button-color-hover: var(--color-primary);
|
|
180
|
+
--xy-controls-button-border-color: var(--color-border);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/*
|
|
184
|
+
* Must stay inside @layer base. Unlayered rules beat every layered one in the
|
|
185
|
+
* cascade, so an unlayered `* { margin: 0 }` here would silently defeat every
|
|
186
|
+
* `mt-*` / `ml-*` utility in the app.
|
|
187
|
+
*/
|
|
188
|
+
@layer base {
|
|
189
|
+
html,
|
|
190
|
+
body,
|
|
191
|
+
#root {
|
|
192
|
+
height: 100%;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* So a bare `border` picks up the themed colour rather than currentColor. */
|
|
196
|
+
*,
|
|
197
|
+
::after,
|
|
198
|
+
::before,
|
|
199
|
+
::backdrop,
|
|
200
|
+
::file-selector-button {
|
|
201
|
+
border-color: var(--color-border, currentColor);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Workflow Studio</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="./main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'i18next';
|
|
2
|
+
import type common from '../../locales/en-US/common';
|
|
3
|
+
import type { defaultNS } from './root-provider';
|
|
4
|
+
|
|
5
|
+
/** en-US is the source of truth for key names, so a missing key fails to compile. */
|
|
6
|
+
declare module 'i18next' {
|
|
7
|
+
interface CustomTypeOptions {
|
|
8
|
+
defaultNS: typeof defaultNS;
|
|
9
|
+
resources: { common: typeof common };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createInstance, type i18n } from 'i18next';
|
|
2
|
+
import languageDetector from 'i18next-browser-languagedetector';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { I18nextProvider, initReactI18next } from 'react-i18next';
|
|
5
|
+
import enUS from '../../locales/en-US/common';
|
|
6
|
+
import zhCN from '../../locales/zh-CN/common';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Studio interface copy.
|
|
10
|
+
*
|
|
11
|
+
* Locales are imported statically rather than fetched by a backend plugin:
|
|
12
|
+
* there are two of them and the studio is a dev tool, so bundling both beats
|
|
13
|
+
* an extra request and the loading state that comes with it.
|
|
14
|
+
*/
|
|
15
|
+
export const defaultNS = 'common';
|
|
16
|
+
|
|
17
|
+
export const supportedLngs = ['en-US', 'zh-CN'] as const;
|
|
18
|
+
export type SupportedLng = (typeof supportedLngs)[number];
|
|
19
|
+
|
|
20
|
+
export const languageNames: Record<SupportedLng, string> = {
|
|
21
|
+
'en-US': 'English',
|
|
22
|
+
'zh-CN': '简体中文',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const resources = {
|
|
26
|
+
'en-US': { common: enUS },
|
|
27
|
+
'zh-CN': { common: zhCN },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function getI18nContext(): { i18n: i18n } {
|
|
31
|
+
const i18n = createInstance();
|
|
32
|
+
|
|
33
|
+
i18n.on('languageChanged', (lang) => {
|
|
34
|
+
if (typeof document !== 'undefined') document.documentElement.lang = lang;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
void i18n
|
|
38
|
+
.use(initReactI18next)
|
|
39
|
+
.use(languageDetector)
|
|
40
|
+
.init({
|
|
41
|
+
resources,
|
|
42
|
+
ns: [defaultNS],
|
|
43
|
+
defaultNS,
|
|
44
|
+
supportedLngs: [...supportedLngs],
|
|
45
|
+
/*
|
|
46
|
+
* English is the default; a browser reporting a bare `zh` still lands on
|
|
47
|
+
* zh-CN. Note this must not be `nonExplicitSupportedLngs` — that strips
|
|
48
|
+
* the region off the *detected* code before testing it against
|
|
49
|
+
* supportedLngs, so `en-US` becomes `en`, matches nothing here, and every
|
|
50
|
+
* lookup falls through to the raw key.
|
|
51
|
+
*/
|
|
52
|
+
fallbackLng: { zh: ['zh-CN'], 'zh-Hans': ['zh-CN'], default: ['en-US'] },
|
|
53
|
+
detection: { order: ['localStorage', 'navigator'], caches: ['localStorage'] },
|
|
54
|
+
interpolation: { escapeValue: false },
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return { i18n };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function I18nProvider({ i18n, children }: { i18n: i18n; children: ReactNode }) {
|
|
61
|
+
return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MutationCache, QueryCache, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { toast } from 'sonner';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Query client for the studio.
|
|
7
|
+
*
|
|
8
|
+
* Every failure surfaces as a toast: the data here comes from the user's own
|
|
9
|
+
* `stats` functions, and a silent failure would look identical to "no data",
|
|
10
|
+
* which is exactly the confusion the reports view is meant to avoid.
|
|
11
|
+
*/
|
|
12
|
+
export function getTanstackQueryContext() {
|
|
13
|
+
const onError = (error: Error) => {
|
|
14
|
+
toast.error(error.message || 'Something went wrong');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const queryClient = new QueryClient({
|
|
18
|
+
queryCache: new QueryCache({ onError }),
|
|
19
|
+
mutationCache: new MutationCache({ onError }),
|
|
20
|
+
defaultOptions: {
|
|
21
|
+
// Definitions are read from the local filesystem and stats from the user's
|
|
22
|
+
// own source; neither benefits from aggressive background refetching.
|
|
23
|
+
queries: { staleTime: 30_000, refetchOnWindowFocus: false, retry: 1 },
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return { queryClient };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface Props {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
queryClient: QueryClient;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function TanstackQueryProvider({ children, queryClient }: Props) {
|
|
36
|
+
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type ReactNode, createContext, useCallback, useContext, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Light / dark / follow-the-OS, applied as a `dark` class on <html>.
|
|
5
|
+
*
|
|
6
|
+
* A class rather than a media query, because `system` has to be a choice the
|
|
7
|
+
* user can override — and because the studio's `dark:` variant is bound to the
|
|
8
|
+
* class, so nothing flips halfway.
|
|
9
|
+
*/
|
|
10
|
+
export const themes = ['light', 'dark', 'system'] as const;
|
|
11
|
+
export type Theme = (typeof themes)[number];
|
|
12
|
+
|
|
13
|
+
const STORAGE_KEY = 'workflow-ui-theme';
|
|
14
|
+
|
|
15
|
+
function readStored(): Theme {
|
|
16
|
+
if (typeof localStorage === 'undefined') return 'system';
|
|
17
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
18
|
+
return themes.find((theme) => theme === stored) ?? 'system';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const prefersDark = () =>
|
|
22
|
+
typeof matchMedia === 'undefined' ? false : matchMedia('(prefers-color-scheme: dark)').matches;
|
|
23
|
+
|
|
24
|
+
/** Runs before React mounts, so the first paint is already the right theme. */
|
|
25
|
+
export function applyStoredTheme() {
|
|
26
|
+
const theme = readStored();
|
|
27
|
+
document.documentElement.classList.toggle(
|
|
28
|
+
'dark',
|
|
29
|
+
theme === 'dark' || (theme === 'system' && prefersDark())
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface ThemeContextValue {
|
|
34
|
+
/** What the user chose — `system` stays `system`, it does not collapse to the resolved value. */
|
|
35
|
+
theme: Theme;
|
|
36
|
+
/** What that currently means. */
|
|
37
|
+
resolved: 'light' | 'dark';
|
|
38
|
+
setTheme: (theme: Theme) => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
|
|
42
|
+
|
|
43
|
+
export function ThemeProvider({ children }: { children: ReactNode }) {
|
|
44
|
+
const [theme, setThemeState] = useState<Theme>(readStored);
|
|
45
|
+
const [systemDark, setSystemDark] = useState(prefersDark);
|
|
46
|
+
|
|
47
|
+
/* Track the OS only while `system` is selected; an explicit choice ignores it. */
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (theme !== 'system' || typeof matchMedia === 'undefined') return;
|
|
50
|
+
const query = matchMedia('(prefers-color-scheme: dark)');
|
|
51
|
+
const onChange = (event: MediaQueryListEvent) => setSystemDark(event.matches);
|
|
52
|
+
query.addEventListener('change', onChange);
|
|
53
|
+
setSystemDark(query.matches);
|
|
54
|
+
return () => query.removeEventListener('change', onChange);
|
|
55
|
+
}, [theme]);
|
|
56
|
+
|
|
57
|
+
const resolved = theme === 'system' ? (systemDark ? 'dark' : 'light') : theme;
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
document.documentElement.classList.toggle('dark', resolved === 'dark');
|
|
61
|
+
}, [resolved]);
|
|
62
|
+
|
|
63
|
+
const setTheme = useCallback((next: Theme) => {
|
|
64
|
+
setThemeState(next);
|
|
65
|
+
localStorage.setItem(STORAGE_KEY, next);
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
return <ThemeContext value={{ theme, resolved, setTheme }}>{children}</ThemeContext>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function useTheme(): ThemeContextValue {
|
|
72
|
+
const context = useContext(ThemeContext);
|
|
73
|
+
if (context === undefined) throw new Error('useTheme must be used inside ThemeProvider');
|
|
74
|
+
return context;
|
|
75
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { CircleAlert, CircleCheck, Info, TriangleAlert, X } from 'lucide-react';
|
|
3
|
+
import type { CSSProperties } from 'react';
|
|
4
|
+
import { Toaster } from 'sonner';
|
|
5
|
+
import { useTheme } from '../theme/root-provider';
|
|
6
|
+
|
|
7
|
+
/** Toasts, styled to match the canvas: superellipse corners, Inter, the gray ramp. */
|
|
8
|
+
export function ToastProvider() {
|
|
9
|
+
const { resolved } = useTheme();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Toaster
|
|
13
|
+
theme={resolved}
|
|
14
|
+
position="top-center"
|
|
15
|
+
icons={{
|
|
16
|
+
success: <CircleCheck className="size-5 text-emerald-500" strokeWidth={2} />,
|
|
17
|
+
info: <Info className="size-5 text-blue-500" strokeWidth={2} />,
|
|
18
|
+
warning: <TriangleAlert className="size-5 text-amber-500" strokeWidth={2} />,
|
|
19
|
+
error: <CircleAlert className="size-5 text-red-500" strokeWidth={2} />,
|
|
20
|
+
close: <X className="size-4" strokeWidth={2} />,
|
|
21
|
+
}}
|
|
22
|
+
closeButton
|
|
23
|
+
style={{ '--gap': '12px', '--width': '360px' } as CSSProperties}
|
|
24
|
+
toastOptions={{
|
|
25
|
+
unstyled: true,
|
|
26
|
+
closeButton: false,
|
|
27
|
+
// Long enough to read without racing the close button
|
|
28
|
+
duration: 5000,
|
|
29
|
+
style: { cornerShape: 'superellipse(1.2)' } as CSSProperties,
|
|
30
|
+
classNames: {
|
|
31
|
+
toast: clsx(
|
|
32
|
+
'flex w-90 items-center gap-x-2 font-sans',
|
|
33
|
+
'bg-card ring-border rounded-2xl py-4 pr-4 pl-3 ring-1',
|
|
34
|
+
'shadow-[0_4px_12px_var(--color-card-shadow)]'
|
|
35
|
+
),
|
|
36
|
+
title: 'text-sm font-medium text-primary',
|
|
37
|
+
description: 'mt-1 text-xs font-normal text-muted',
|
|
38
|
+
closeButton: clsx(
|
|
39
|
+
'text-muted hover:text-primary order-last ml-auto size-5 p-0.5',
|
|
40
|
+
'transition-colors duration-200'
|
|
41
|
+
),
|
|
42
|
+
},
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|