registry_B7C18axh.mjs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. globalThis.process ??= {}; globalThis.process.env ??= {};
  2. import { s as ssr, e as escape, a as createComponent, b as ssrHydrationKey, d as ssrStyleProperty, S as Show, f as createSignal, g as ssrAttribute, D as Dynamic } from './_@astro-renderers_DpxbEuk7.mjs';
  3. var _tmpl$$9 = ["<div", ' style="', '">', "</div>"], _tmpl$2$9 = ["<div", ' style="', '"><div style="', '">', "</div><!--$-->", "<!--/--></div>"];
  4. function Clock(props) {
  5. const [time] = createSignal("");
  6. return ssr(_tmpl$2$9, ssrHydrationKey(), ssrStyleProperty("border:", "1px solid var(--border)") + ssrStyleProperty(";padding:", "1rem") + ssrStyleProperty(";width:", "100%") + ssrStyleProperty(";height:", "100%") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";display:", "flex") + ssrStyleProperty(";flex-direction:", "column") + ssrStyleProperty(";justify-content:", "center") + ssrStyleProperty(";align-items:", "center") + ssrStyleProperty(";background:", "var(--bg, #fff)"), ssrStyleProperty("font-size:", "clamp(0.8rem, 3.5vw + 0.5vh, 2.5rem)") + ssrStyleProperty(";font-weight:", "bold") + ssrStyleProperty(";text-align:", "center") + ssrStyleProperty(";word-break:", "break-word") + ssrStyleProperty(";line-height:", "1.2"), escape(time()), escape(createComponent(Show, {
  7. get when() {
  8. return props.settings.showLabel;
  9. },
  10. get children() {
  11. return ssr(_tmpl$$9, ssrHydrationKey(), ssrStyleProperty("margin-top:", "0.5rem") + ssrStyleProperty(";color:", "var(--gray)") + ssrStyleProperty(";font-size:", "clamp(0.6rem, 1.5vw + 0.5vh, 1rem)") + ssrStyleProperty(";text-align:", "center") + ssrStyleProperty(";line-height:", "1.4"), escape(props.settings.label) || "Current Time");
  12. }
  13. })));
  14. }
  15. const clockSchema = {
  16. name: "Clock",
  17. description: "Display current time and date",
  18. settingsSchema: {
  19. format: {
  20. type: "select",
  21. label: "Time Format",
  22. default: "24h",
  23. options: ["12h", "24h"],
  24. required: true
  25. },
  26. timeFormat: {
  27. type: "select",
  28. label: "Display Format",
  29. default: "HH:MM:SS",
  30. options: ["HH:MM:SS", "HH:MM", "HH only"]
  31. },
  32. showDate: {
  33. type: "boolean",
  34. label: "Show Date",
  35. default: true
  36. },
  37. showLabel: {
  38. type: "boolean",
  39. label: "Show Label",
  40. default: true
  41. },
  42. label: {
  43. type: "string",
  44. label: "Custom Label",
  45. default: "Current Time"
  46. },
  47. refreshRate: {
  48. type: "number",
  49. label: "Refresh Rate (seconds)",
  50. default: 1
  51. }
  52. }
  53. };
  54. var _tmpl$$8 = ["<div", ' style="', '"><div style="', '">', '</div><div style="', '">', "</div><!--$-->", "<!--/--></div>"], _tmpl$2$8 = ["<div", ' style="', '">', "</div>"];
  55. const priceCache = /* @__PURE__ */ new Map();
  56. const errorCache = /* @__PURE__ */ new Map();
  57. function CryptoPrice(props) {
  58. const widgetKey = `${props.settings.symbol}-${props.settings.currency}`;
  59. const [price] = createSignal(priceCache.get(widgetKey) || "Loading...");
  60. const [error] = createSignal(errorCache.get(widgetKey) || "");
  61. return ssr(_tmpl$$8, ssrHydrationKey(), ssrStyleProperty("border:", "1px solid var(--border)") + ssrStyleProperty(";padding:", "1rem") + ssrStyleProperty(";width:", "100%") + ssrStyleProperty(";height:", "100%") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";display:", "flex") + ssrStyleProperty(";flex-direction:", "column") + ssrStyleProperty(";justify-content:", "center") + ssrStyleProperty(";align-items:", "center") + ssrStyleProperty(";background:", "var(--bg, #fff)"), ssrStyleProperty("margin-bottom:", "0.5rem") + ssrStyleProperty(";font-weight:", "bold") + ssrStyleProperty(";font-size:", "clamp(0.7rem, 2vw + 0.5vh, 1.5rem)") + ssrStyleProperty(";text-align:", "center") + ssrStyleProperty(";line-height:", "1.3"), escape(props.settings.symbol) || "BTC", ssrStyleProperty("font-size:", "clamp(0.8rem, 3.5vw + 0.5vh, 2.5rem)") + ssrStyleProperty(";font-weight:", "bold") + ssrStyleProperty(";text-align:", "center") + ssrStyleProperty(";word-break:", "break-word") + ssrStyleProperty(";line-height:", "1.2"), escape(error()) || escape(price()), props.settings.showLabel && ssr(_tmpl$2$8, ssrHydrationKey(), ssrStyleProperty("margin-top:", "0.5rem") + ssrStyleProperty(";color:", "var(--gray)") + ssrStyleProperty(";font-size:", "clamp(0.6rem, 1.5vw + 0.5vh, 1rem)") + ssrStyleProperty(";text-align:", "center") + ssrStyleProperty(";line-height:", "1.4"), escape(props.settings.label) || "Price"));
  62. }
  63. const cryptoPriceSchema = {
  64. name: "Crypto Price",
  65. description: "Display cryptocurrency price from CoinGecko API",
  66. settingsSchema: {
  67. symbol: {
  68. type: "string",
  69. label: "Crypto Symbol (e.g., bitcoin, ethereum)",
  70. default: "bitcoin",
  71. required: true
  72. },
  73. currency: {
  74. type: "string",
  75. label: "Currency (e.g., USD, EUR)",
  76. default: "USD",
  77. required: true
  78. },
  79. refreshIntervalValue: {
  80. type: "number",
  81. label: "Refresh Interval",
  82. default: 1,
  83. required: true
  84. },
  85. refreshIntervalUnit: {
  86. type: "select",
  87. label: "Unit",
  88. options: ["seconds", "minutes", "hours", "days"],
  89. default: "minutes",
  90. required: true
  91. },
  92. showLabel: {
  93. type: "boolean",
  94. label: "Show Label",
  95. default: true
  96. },
  97. label: {
  98. type: "string",
  99. label: "Custom Label",
  100. default: "Price"
  101. }
  102. }
  103. };
  104. var _tmpl$$7 = ["<div", ' style="', '">', "</div>"], _tmpl$2$7 = ["<div", ' style="', '"><!--$-->', "<!--/-->°<!--$-->", "<!--/--></div>"], _tmpl$3$2 = ["<div", ' style="', '"><div>💧 <!--$-->', "<!--/-->%</div><div>💨 <!--$-->", "<!--/--> m/s</div></div>"], _tmpl$4$1 = ["<div", ' style="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"];
  105. function Weather(props) {
  106. const [weather] = createSignal(null);
  107. const [error] = createSignal("");
  108. return ssr(_tmpl$4$1, ssrHydrationKey(), ssrStyleProperty("border:", "1px solid var(--border)") + ssrStyleProperty(";padding:", "1rem") + ssrStyleProperty(";width:", "100%") + ssrStyleProperty(";height:", "100%") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";display:", "flex") + ssrStyleProperty(";flex-direction:", "column") + ssrStyleProperty(";justify-content:", "center") + ssrStyleProperty(";align-items:", "center") + ssrStyleProperty(";background:", "var(--bg, #fff)"), escape(createComponent(Show, {
  109. get when() {
  110. return error();
  111. },
  112. get children() {
  113. return ssr(_tmpl$$7, ssrHydrationKey(), ssrStyleProperty("color:", "#ff4444") + ssrStyleProperty(";font-size:", "clamp(0.7rem, 2vw + 0.5vh, 1rem)") + ssrStyleProperty(";text-align:", "center"), escape(error()));
  114. }
  115. })), escape(createComponent(Show, {
  116. get when() {
  117. return !error() && weather();
  118. },
  119. get children() {
  120. return [ssr(_tmpl$$7, ssrHydrationKey(), ssrStyleProperty("font-size:", "clamp(0.7rem, 2vw + 0.5vh, 1.2rem)") + ssrStyleProperty(";font-weight:", "bold") + ssrStyleProperty(";margin-bottom:", "0.5rem") + ssrStyleProperty(";text-align:", "center"), props.settings.lat && props.settings.lon ? `${escape(props.settings.lat)}, ${escape(props.settings.lon)}` : escape(props.settings.city) || "London"), ssr(_tmpl$2$7, ssrHydrationKey(), ssrStyleProperty("font-size:", "clamp(1.5rem, 5vw + 1vh, 3.5rem)") + ssrStyleProperty(";font-weight:", "bold") + ssrStyleProperty(";text-align:", "center") + ssrStyleProperty(";line-height:", "1.1"), escape(weather()?.temp), props.settings.units === "metric" ? "C" : "F"), ssr(_tmpl$$7, ssrHydrationKey(), ssrStyleProperty("font-size:", "clamp(0.7rem, 1.8vw + 0.5vh, 1.1rem)") + ssrStyleProperty(";text-align:", "center") + ssrStyleProperty(";margin-top:", "0.3rem") + ssrStyleProperty(";text-transform:", "capitalize") + ssrStyleProperty(";color:", "var(--gray)"), escape(weather()?.description)), createComponent(Show, {
  121. get when() {
  122. return props.settings.showDetails;
  123. },
  124. get children() {
  125. return ssr(_tmpl$3$2, ssrHydrationKey(), ssrStyleProperty("display:", "flex") + ssrStyleProperty(";gap:", "1rem") + ssrStyleProperty(";margin-top:", "0.8rem") + ssrStyleProperty(";font-size:", "clamp(0.6rem, 1.5vw + 0.5vh, 0.9rem)") + ssrStyleProperty(";color:", "var(--gray)"), escape(weather()?.humidity), escape(weather()?.windSpeed));
  126. }
  127. })];
  128. }
  129. })));
  130. }
  131. const weatherSchema = {
  132. name: "Weather",
  133. description: "Display current weather from OpenWeatherMap API",
  134. settingsSchema: {
  135. city: {
  136. type: "string",
  137. label: "City Name",
  138. default: "London",
  139. required: false
  140. },
  141. lat: {
  142. type: "string",
  143. label: "Latitude (optional, overrides city)",
  144. default: "",
  145. required: false
  146. },
  147. lon: {
  148. type: "string",
  149. label: "Longitude (optional, overrides city)",
  150. default: "",
  151. required: false
  152. },
  153. apiKey: {
  154. type: "string",
  155. label: "OpenWeatherMap API Key",
  156. default: "",
  157. required: true
  158. },
  159. units: {
  160. type: "select",
  161. label: "Temperature Units",
  162. default: "metric",
  163. options: ["metric", "imperial"]
  164. },
  165. showDetails: {
  166. type: "boolean",
  167. label: "Show Humidity & Wind",
  168. default: true
  169. },
  170. refreshIntervalValue: {
  171. type: "number",
  172. label: "Refresh Interval",
  173. default: 10,
  174. required: true
  175. },
  176. refreshIntervalUnit: {
  177. type: "select",
  178. label: "Unit",
  179. options: ["seconds", "minutes", "hours", "days"],
  180. default: "minutes",
  181. required: true
  182. }
  183. }
  184. };
  185. var _tmpl$$6 = ["<div", ' style="', '"><div style="', '">Σ</div><div style="', '">', '</div><div style="', '">Stoic Wisdom</div></div>'], _tmpl$2$6 = ["<div", ' style="', '">', "</div>"], _tmpl$3$1 = ["<div", ' style="', '">"<!--$-->', '<!--/-->"</div>'], _tmpl$4 = ["<div", ' style="', '">— <!--$-->', "<!--/--></div>"];
  186. const quoteCache = /* @__PURE__ */ new Map();
  187. function StoicQuote(props) {
  188. const widgetKey = "stoic-quote";
  189. const initialQuote = quoteCache.get(widgetKey) || {
  190. text: "Loading wisdom...",
  191. author: ""
  192. };
  193. const [quote] = createSignal(initialQuote);
  194. const [error] = createSignal("");
  195. const [renderKey] = createSignal(0);
  196. const showAuthor = () => props.settings.showAuthor !== false;
  197. const fontSize = () => props.settings.fontSize || "medium";
  198. const getSizes = () => {
  199. const fontSizeMap = {
  200. small: {
  201. quote: "clamp(0.7rem, 1.5vw, 1.2rem)",
  202. author: "clamp(0.6rem, 1.2vw, 0.9rem)"
  203. },
  204. medium: {
  205. quote: "clamp(0.9rem, 2vw, 1.5rem)",
  206. author: "clamp(0.7rem, 1.5vw, 1.1rem)"
  207. },
  208. large: {
  209. quote: "clamp(1.1rem, 2.5vw, 2rem)",
  210. author: "clamp(0.8rem, 1.8vw, 1.3rem)"
  211. }
  212. };
  213. return fontSizeMap[fontSize()] || fontSizeMap.medium;
  214. };
  215. return ssr(_tmpl$$6, ssrHydrationKey() + ssrAttribute("data-render-key", escape(renderKey(), true), false), ssrStyleProperty("border:", "1px solid var(--border)") + ssrStyleProperty(";padding:", "1rem") + ssrStyleProperty(";width:", "100%") + ssrStyleProperty(";height:", "100%") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";display:", "flex") + ssrStyleProperty(";flex-direction:", "column") + ssrStyleProperty(";justify-content:", "center") + ssrStyleProperty(";align-items:", "center") + ssrStyleProperty(";background:", "var(--bg, #fff)") + ssrStyleProperty(";position:", "relative"), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";top:", "0.5rem") + ssrStyleProperty(";left:", "0.5rem") + ssrStyleProperty(";font-size:", "1.5rem") + ssrStyleProperty(";line-height:", "1") + ssrStyleProperty(";color:", "var(--border, #ccc)") + ssrStyleProperty(";font-family:", "Georgia, serif") + ssrStyleProperty(";font-weight:", "bold") + ssrStyleProperty(";opacity:", "0.3"), ssrStyleProperty("text-align:", "center") + ssrStyleProperty(";max-width:", "95%"), error() ? ssr(_tmpl$2$6, ssrHydrationKey(), ssrStyleProperty("color:", "var(--gray, #999)"), escape(error())) : escape([ssr(_tmpl$3$1, ssrHydrationKey(), ssrStyleProperty("font-size:", escape(getSizes().quote, true)) + ssrStyleProperty(";line-height:", "1.4") + ssrStyleProperty(";font-style:", "italic"), escape(quote().text)), showAuthor() && quote().author && ssr(_tmpl$4, ssrHydrationKey(), ssrStyleProperty("margin-top:", "0.5rem") + ssrStyleProperty(";font-size:", escape(getSizes().author, true)) + ssrStyleProperty(";color:", "var(--gray, #666)") + ssrStyleProperty(";font-weight:", "500"), escape(quote().author))]), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";bottom:", "8px") + ssrStyleProperty(";left:", "8px") + ssrStyleProperty(";font-size:", "0.7rem") + ssrStyleProperty(";color:", "var(--gray, #999)") + ssrStyleProperty(";text-transform:", "uppercase") + ssrStyleProperty(";letter-spacing:", "0.05em") + ssrStyleProperty(";opacity:", "0.5"));
  216. }
  217. const stoicQuoteSchema = {
  218. name: "Stoic Quote",
  219. description: "Display stoic wisdom from Marcus Aurelius, Seneca, and Epictetus",
  220. settingsSchema: {
  221. fontSize: {
  222. type: "select",
  223. label: "Font Size",
  224. options: ["small", "medium", "large"],
  225. default: "medium"
  226. },
  227. showAuthor: {
  228. type: "boolean",
  229. label: "Show Author",
  230. default: true
  231. },
  232. refreshIntervalValue: {
  233. type: "number",
  234. label: "Refresh Interval",
  235. default: 1,
  236. required: true
  237. },
  238. refreshIntervalUnit: {
  239. type: "select",
  240. label: "Unit",
  241. options: ["seconds", "minutes", "hours", "days"],
  242. default: "hours",
  243. required: true
  244. }
  245. }
  246. };
  247. const widgetRegistry = {
  248. "crypto-price": {
  249. schema: cryptoPriceSchema,
  250. Component: CryptoPrice
  251. },
  252. clock: {
  253. schema: clockSchema,
  254. Component: Clock
  255. },
  256. weather: {
  257. schema: weatherSchema,
  258. Component: Weather
  259. },
  260. "stoic-quote": {
  261. schema: stoicQuoteSchema,
  262. Component: StoicQuote
  263. }
  264. };
  265. function getWidget(type) {
  266. return widgetRegistry[type];
  267. }
  268. var _tmpl$$5 = ["<div", ' style="', '"><!--$-->', "<!--/--><!--$-->", '<!--/--><div style="', '">', "</div></div>"], _tmpl$2$5 = ["<button", ' style="', '">×</button>'], _tmpl$3 = ["<div", ' class="resize-handle" style="', '"></div>'];
  269. function WidgetRenderer(props) {
  270. const widgetDef = getWidget(props.config.type);
  271. const [isDragging] = createSignal(false);
  272. const [isResizing] = createSignal(false);
  273. const size = () => props.config.size || {
  274. width: 200,
  275. height: 150
  276. };
  277. return createComponent(Show, {
  278. when: widgetDef,
  279. children: (widget) => ssr(_tmpl$$5, ssrHydrationKey() + ssrAttribute("data-widget-id", escape(props.config.id, true), false), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";width:", `${escape(size().width, true)}px`) + ssrStyleProperty(";height:", `${escape(size().height, true)}px`) + ssrStyleProperty(";cursor:", props.locked ? "default" : isDragging() ? "grabbing" : "grab") + ssrStyleProperty(";user-select:", "none") + ssrStyleProperty(";transition:", isDragging() || isResizing() ? "none" : "box-shadow 0.2s") + ssrStyleProperty(";box-shadow:", isDragging() || isResizing() ? "0 8px 16px rgba(0,0,0,0.2)" : "0 2px 4px rgba(0,0,0,0.1)") + ssrStyleProperty(";z-index:", isDragging() || isResizing() ? "100" : "1"), !props.locked && props.onRemove && ssr(_tmpl$2$5, ssrHydrationKey(), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";top:", "-8px") + ssrStyleProperty(";right:", "-8px") + ssrStyleProperty(";z-index:", "10") + ssrStyleProperty(";padding:", "0") + ssrStyleProperty(";font-size:", "1rem") + ssrStyleProperty(";background:", "#ff4444") + ssrStyleProperty(";color:", "white") + ssrStyleProperty(";border:", "none") + ssrStyleProperty(";border-radius:", "50%") + ssrStyleProperty(";cursor:", "pointer") + ssrStyleProperty(";width:", "24px") + ssrStyleProperty(";height:", "24px") + ssrStyleProperty(";display:", "flex") + ssrStyleProperty(";align-items:", "center") + ssrStyleProperty(";justify-content:", "center") + ssrStyleProperty(";font-weight:", "bold")), !props.locked && (!props.gridCells || props.gridCells.length === 0) && ssr(_tmpl$3, ssrHydrationKey(), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";bottom:", "0") + ssrStyleProperty(";right:", "0") + ssrStyleProperty(";width:", "20px") + ssrStyleProperty(";height:", "20px") + ssrStyleProperty(";cursor:", "nwse-resize") + ssrStyleProperty(";z-index:", "10") + ssrStyleProperty(";background:", "linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.2) 50%)") + ssrStyleProperty(";border-bottom-right-radius:", "4px")), ssrStyleProperty("width:", "100%") + ssrStyleProperty(";height:", "100%") + ssrStyleProperty(";overflow:", "auto"), escape(createComponent(Dynamic, {
  280. get component() {
  281. return widget().Component;
  282. },
  283. get settings() {
  284. return props.config.settings;
  285. }
  286. })))
  287. });
  288. }
  289. var _tmpl$$4 = ["<div", ' style="', '">', "</div>"], _tmpl$2$4 = ["<div", ' style="', '"></div>'];
  290. const simpleGridTemplate = {
  291. id: "simple",
  292. name: "Simple 2x2 Grid",
  293. description: "Basic 2x2 grid layout",
  294. width: 800,
  295. height: 600,
  296. background: "#1a1a1a",
  297. cells: [{
  298. id: "cell-1",
  299. x: 10,
  300. y: 10,
  301. width: 385,
  302. height: 285
  303. }, {
  304. id: "cell-2",
  305. x: 405,
  306. y: 10,
  307. width: 385,
  308. height: 285
  309. }, {
  310. id: "cell-3",
  311. x: 10,
  312. y: 305,
  313. width: 385,
  314. height: 285
  315. }, {
  316. id: "cell-4",
  317. x: 405,
  318. y: 305,
  319. width: 385,
  320. height: 285
  321. }]
  322. };
  323. function SimpleGrid() {
  324. return ssr(_tmpl$$4, ssrHydrationKey(), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";width:", `${escape(simpleGridTemplate.width, true)}px`) + ssrStyleProperty(";height:", `${escape(simpleGridTemplate.height, true)}px`) + ssrStyleProperty(";background:", escape(simpleGridTemplate.background, true)) + ssrStyleProperty(";pointer-events:", "none"), escape(simpleGridTemplate.cells.map((cell) => ssr(_tmpl$2$4, ssrHydrationKey() + ssrAttribute("data-grid-cell", escape(cell.id, true), false), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";left:", `${escape(cell.x, true)}px`) + ssrStyleProperty(";top:", `${escape(cell.y, true)}px`) + ssrStyleProperty(";width:", `${escape(cell.width, true)}px`) + ssrStyleProperty(";height:", `${escape(cell.height, true)}px`) + ssrStyleProperty(";border:", "2px dashed rgba(255, 255, 255, 0.2)") + ssrStyleProperty(";border-radius:", "12px") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";background:", "rgba(255, 255, 255, 0.03)")))));
  325. }
  326. var _tmpl$$3 = ["<div", ' style="', '">', "</div>"], _tmpl$2$3 = ["<div", ' style="', '"></div>'];
  327. const threeColumnGridTemplate = {
  328. id: "threeColumn",
  329. name: "Three Column Layout",
  330. description: "Sidebar, main content, and right panel",
  331. width: 1200,
  332. height: 800,
  333. background: "#1a1a1a",
  334. cells: [
  335. // Left sidebar - narrow
  336. {
  337. id: "sidebar-left",
  338. x: 10,
  339. y: 10,
  340. width: 200,
  341. height: 780
  342. },
  343. // Main content area - wide
  344. {
  345. id: "main-top",
  346. x: 220,
  347. y: 10,
  348. width: 760,
  349. height: 380
  350. },
  351. {
  352. id: "main-bottom-left",
  353. x: 220,
  354. y: 400,
  355. width: 370,
  356. height: 390
  357. },
  358. {
  359. id: "main-bottom-right",
  360. x: 600,
  361. y: 400,
  362. width: 380,
  363. height: 390
  364. },
  365. // Right panel - medium
  366. {
  367. id: "panel-top",
  368. x: 990,
  369. y: 10,
  370. width: 200,
  371. height: 380
  372. },
  373. {
  374. id: "panel-bottom",
  375. x: 990,
  376. y: 400,
  377. width: 200,
  378. height: 390
  379. }
  380. ]
  381. };
  382. function ThreeColumnGrid() {
  383. return ssr(_tmpl$$3, ssrHydrationKey(), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";width:", `${escape(threeColumnGridTemplate.width, true)}px`) + ssrStyleProperty(";height:", `${escape(threeColumnGridTemplate.height, true)}px`) + ssrStyleProperty(";background:", escape(threeColumnGridTemplate.background, true)) + ssrStyleProperty(";pointer-events:", "none"), escape(threeColumnGridTemplate.cells.map((cell) => ssr(_tmpl$2$3, ssrHydrationKey() + ssrAttribute("data-grid-cell", escape(cell.id, true), false), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";left:", `${escape(cell.x, true)}px`) + ssrStyleProperty(";top:", `${escape(cell.y, true)}px`) + ssrStyleProperty(";width:", `${escape(cell.width, true)}px`) + ssrStyleProperty(";height:", `${escape(cell.height, true)}px`) + ssrStyleProperty(";border:", "2px dashed rgba(255, 255, 255, 0.2)") + ssrStyleProperty(";border-radius:", "12px") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";background:", "rgba(255, 255, 255, 0.03)")))));
  384. }
  385. var _tmpl$$2 = ["<div", ' style="', '">', "</div>"], _tmpl$2$2 = ["<div", ' style="', '"></div>'];
  386. const dashboardGridTemplate = {
  387. id: "dashboard",
  388. name: "Dashboard Layout",
  389. description: "Professional dashboard with header and mixed sizes",
  390. width: 1400,
  391. height: 900,
  392. background: "#1a1a1a",
  393. cells: [
  394. // Header row - full width
  395. {
  396. id: "header",
  397. x: 10,
  398. y: 10,
  399. width: 1380,
  400. height: 120
  401. },
  402. // Main metrics row
  403. {
  404. id: "metric-1",
  405. x: 10,
  406. y: 140,
  407. width: 330,
  408. height: 200
  409. },
  410. {
  411. id: "metric-2",
  412. x: 350,
  413. y: 140,
  414. width: 330,
  415. height: 200
  416. },
  417. {
  418. id: "metric-3",
  419. x: 690,
  420. y: 140,
  421. width: 330,
  422. height: 200
  423. },
  424. {
  425. id: "metric-4",
  426. x: 1030,
  427. y: 140,
  428. width: 360,
  429. height: 200
  430. },
  431. // Middle row - large chart on left, two stacked on right
  432. {
  433. id: "chart-main",
  434. x: 10,
  435. y: 350,
  436. width: 880,
  437. height: 540
  438. },
  439. {
  440. id: "info-top",
  441. x: 900,
  442. y: 350,
  443. width: 490,
  444. height: 260
  445. },
  446. {
  447. id: "info-bottom",
  448. x: 900,
  449. y: 620,
  450. width: 490,
  451. height: 270
  452. }
  453. ]
  454. };
  455. function DashboardGrid() {
  456. return ssr(_tmpl$$2, ssrHydrationKey(), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";width:", `${escape(dashboardGridTemplate.width, true)}px`) + ssrStyleProperty(";height:", `${escape(dashboardGridTemplate.height, true)}px`) + ssrStyleProperty(";background:", escape(dashboardGridTemplate.background, true)) + ssrStyleProperty(";pointer-events:", "none"), escape(dashboardGridTemplate.cells.map((cell) => ssr(_tmpl$2$2, ssrHydrationKey() + ssrAttribute("data-grid-cell", escape(cell.id, true), false), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";left:", `${escape(cell.x, true)}px`) + ssrStyleProperty(";top:", `${escape(cell.y, true)}px`) + ssrStyleProperty(";width:", `${escape(cell.width, true)}px`) + ssrStyleProperty(";height:", `${escape(cell.height, true)}px`) + ssrStyleProperty(";border:", "2px dashed rgba(255, 255, 255, 0.2)") + ssrStyleProperty(";border-radius:", "12px") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";background:", "rgba(255, 255, 255, 0.03)")))));
  457. }
  458. var _tmpl$$1 = ["<div", ' style="', '">', "</div>"], _tmpl$2$1 = ["<div", ' style="', '"></div>'];
  459. const sidebarContentGridTemplate = {
  460. id: "sidebarContent",
  461. name: "Sidebar Content Layout",
  462. description: "Two long sidebars with large content in middle",
  463. width: 1400,
  464. height: 900,
  465. background: "#1a1a1a",
  466. cells: [
  467. // Left sidebar - single long bar
  468. {
  469. id: "left-sidebar",
  470. x: 10,
  471. y: 10,
  472. width: 280,
  473. height: 880
  474. },
  475. // Main content - centered between sidebars
  476. // Math: left ends at 290, right starts at 1110
  477. // Available: 1110 - 290 = 820px
  478. // Center: 290 + (820 - 800)/2 = 300
  479. {
  480. id: "main-content",
  481. x: 300,
  482. y: 10,
  483. width: 800,
  484. height: 880
  485. },
  486. // Right sidebar - single long bar
  487. {
  488. id: "right-sidebar",
  489. x: 1110,
  490. y: 10,
  491. width: 280,
  492. height: 880
  493. }
  494. ]
  495. };
  496. function SidebarContentGrid() {
  497. return ssr(_tmpl$$1, ssrHydrationKey(), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";width:", `${escape(sidebarContentGridTemplate.width, true)}px`) + ssrStyleProperty(";height:", `${escape(sidebarContentGridTemplate.height, true)}px`) + ssrStyleProperty(";background:", escape(sidebarContentGridTemplate.background, true)) + ssrStyleProperty(";pointer-events:", "none"), escape(sidebarContentGridTemplate.cells.map((cell) => ssr(_tmpl$2$1, ssrHydrationKey() + ssrAttribute("data-grid-cell", escape(cell.id, true), false), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";left:", `${escape(cell.x, true)}px`) + ssrStyleProperty(";top:", `${escape(cell.y, true)}px`) + ssrStyleProperty(";width:", `${escape(cell.width, true)}px`) + ssrStyleProperty(";height:", `${escape(cell.height, true)}px`) + ssrStyleProperty(";border:", "2px dashed rgba(255, 255, 255, 0.2)") + ssrStyleProperty(";border-radius:", "12px") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";background:", "rgba(255, 255, 255, 0.03)")))));
  498. }
  499. var _tmpl$ = ["<div", ' style="', '">', "</div>"], _tmpl$2 = ["<div", ' style="', '"></div>'];
  500. const centeredFocusGridTemplate = {
  501. id: "centeredFocus",
  502. name: "Centered Focus Layout",
  503. description: "2 center items with left sidebar boxes and tall right panel",
  504. width: 1520,
  505. height: 760,
  506. background: "#1a1a1a",
  507. cells: [
  508. // Left sidebar - 2 stacked boxes
  509. {
  510. id: "left-top",
  511. x: 10,
  512. y: 10,
  513. width: 390,
  514. height: 340
  515. },
  516. {
  517. id: "left-bottom",
  518. x: 10,
  519. y: 360,
  520. width: 390,
  521. height: 390
  522. },
  523. // Center - 2 items (short wide on top, larger below)
  524. {
  525. id: "center-top",
  526. x: 410,
  527. y: 10,
  528. width: 760,
  529. height: 250
  530. },
  531. {
  532. id: "center-bottom",
  533. x: 410,
  534. y: 270,
  535. width: 760,
  536. height: 480
  537. },
  538. // Right sidebar - single tall item
  539. {
  540. id: "right-tall",
  541. x: 1180,
  542. y: 10,
  543. width: 330,
  544. height: 740
  545. }
  546. ]
  547. };
  548. function CenteredFocusGrid() {
  549. return ssr(_tmpl$, ssrHydrationKey(), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";width:", `${escape(centeredFocusGridTemplate.width, true)}px`) + ssrStyleProperty(";height:", `${escape(centeredFocusGridTemplate.height, true)}px`) + ssrStyleProperty(";background:", escape(centeredFocusGridTemplate.background, true)) + ssrStyleProperty(";pointer-events:", "none"), escape(centeredFocusGridTemplate.cells.map((cell) => ssr(_tmpl$2, ssrHydrationKey() + ssrAttribute("data-grid-cell", escape(cell.id, true), false), ssrStyleProperty("position:", "absolute") + ssrStyleProperty(";left:", `${escape(cell.x, true)}px`) + ssrStyleProperty(";top:", `${escape(cell.y, true)}px`) + ssrStyleProperty(";width:", `${escape(cell.width, true)}px`) + ssrStyleProperty(";height:", `${escape(cell.height, true)}px`) + ssrStyleProperty(";border:", "2px dashed rgba(255, 255, 255, 0.2)") + ssrStyleProperty(";border-radius:", "12px") + ssrStyleProperty(";box-sizing:", "border-box") + ssrStyleProperty(";background:", "rgba(255, 255, 255, 0.03)")))));
  550. }
  551. const gridRegistry = {
  552. simple: {
  553. template: simpleGridTemplate,
  554. Component: SimpleGrid
  555. },
  556. threeColumn: {
  557. template: threeColumnGridTemplate,
  558. Component: ThreeColumnGrid
  559. },
  560. dashboard: {
  561. template: dashboardGridTemplate,
  562. Component: DashboardGrid
  563. },
  564. sidebarContent: {
  565. template: sidebarContentGridTemplate,
  566. Component: SidebarContentGrid
  567. },
  568. centeredFocus: {
  569. template: centeredFocusGridTemplate,
  570. Component: CenteredFocusGrid
  571. }
  572. };
  573. function getGrid(id) {
  574. return gridRegistry[id];
  575. }
  576. function getAllGrids() {
  577. return Object.values(gridRegistry);
  578. }
  579. export { WidgetRenderer as W, getAllGrids as a, getGrid as g, widgetRegistry as w };