@trops/dash-core 0.1.332 → 0.1.334

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/dist/index.js CHANGED
@@ -27351,6 +27351,21 @@ var WorkspaceModel = function WorkspaceModel(workspaceItem) {
27351
27351
  workspace.layout = "layout" in obj ? obj["layout"] : [];
27352
27352
  workspace.pages = "pages" in obj ? obj["pages"] : [];
27353
27353
  workspace.activePageId = "activePageId" in obj ? obj["activePageId"] : null;
27354
+
27355
+ // Always-pages model: every workspace must have at least one page.
27356
+ // If the source data is single-page (empty pages array but populated
27357
+ // layout), wrap the layout into pages[0] now so renderers always have
27358
+ // a page to display. Idempotent: a no-op if pages is already populated.
27359
+ if (!Array.isArray(workspace.pages) || workspace.pages.length === 0) {
27360
+ var page = {
27361
+ id: "page-".concat(workspace.id || Date.now()),
27362
+ name: workspace.name || "Page 1",
27363
+ order: 0,
27364
+ layout: workspace.layout || []
27365
+ };
27366
+ workspace.pages = [page];
27367
+ workspace.activePageId = page.id;
27368
+ }
27354
27369
  workspace.sidebarEnabled = "sidebarEnabled" in obj ? obj["sidebarEnabled"] : false;
27355
27370
  workspace.sidebarLayout = "sidebarLayout" in obj ? obj["sidebarLayout"] : [];
27356
27371
  workspace.sidebarWidth = "sidebarWidth" in obj ? obj["sidebarWidth"] : 280;
@@ -52298,63 +52313,19 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
52298
52313
  children: [toasts.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
52299
52314
  className: "fixed bottom-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none w-80",
52300
52315
  children: toasts.map(function (t) {
52301
- var typeStyles = {
52302
- success: {
52303
- bg: "bg-emerald-950/95",
52304
- border: "border-emerald-500",
52305
- accent: "text-emerald-400",
52306
- icon: "circle-check"
52307
- },
52308
- error: {
52309
- bg: "bg-rose-950/95",
52310
- border: "border-rose-500",
52311
- accent: "text-rose-400",
52312
- icon: "circle-xmark"
52313
- },
52314
- warning: {
52315
- bg: "bg-amber-950/95",
52316
- border: "border-amber-500",
52317
- accent: "text-amber-400",
52318
- icon: "triangle-exclamation"
52319
- },
52320
- info: {
52321
- bg: "bg-sky-950/95",
52322
- border: "border-sky-500",
52323
- accent: "text-sky-400",
52324
- icon: "circle-info"
52325
- }
52326
- };
52327
- var style = typeStyles[t.type] || typeStyles.info;
52328
52316
  return /*#__PURE__*/jsxRuntime.jsx("div", {
52329
- className: "pointer-events-auto rounded-md border-l-4 ".concat(style.border, " ").concat(style.bg, " shadow-lg p-3 text-white animate-in slide-in-from-right"),
52330
- role: "status",
52331
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
52332
- className: "flex items-start gap-3",
52333
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
52334
- icon: style.icon,
52335
- className: "h-4 w-4 mt-0.5 flex-shrink-0 ".concat(style.accent)
52336
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
52337
- className: "flex-1 min-w-0",
52338
- children: [t.title && /*#__PURE__*/jsxRuntime.jsx("div", {
52339
- className: "font-semibold text-sm ".concat(style.accent),
52340
- children: t.title
52341
- }), t.message && /*#__PURE__*/jsxRuntime.jsx("div", {
52342
- className: "text-sm text-white/90 break-words",
52343
- children: t.message
52344
- })]
52345
- }), /*#__PURE__*/jsxRuntime.jsx("button", {
52346
- type: "button",
52347
- onClick: function onClick() {
52348
- return setToasts(function (prev) {
52349
- return prev.filter(function (x) {
52350
- return x.id !== t.id;
52351
- });
52317
+ className: "pointer-events-auto",
52318
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Toast, {
52319
+ type: t.type,
52320
+ title: t.title,
52321
+ message: t.message,
52322
+ onClose: function onClose() {
52323
+ return setToasts(function (prev) {
52324
+ return prev.filter(function (x) {
52325
+ return x.id !== t.id;
52352
52326
  });
52353
- },
52354
- className: "text-white/60 hover:text-white text-lg leading-none flex-shrink-0",
52355
- "aria-label": "Close toast",
52356
- children: "\xD7"
52357
- })]
52327
+ });
52328
+ }
52358
52329
  })
52359
52330
  }, t.id);
52360
52331
  })