@almadar/ui 5.13.2 → 5.13.3

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.
@@ -6309,7 +6309,7 @@ var init_Modal = __esm({
6309
6309
  document.body.style.overflow = "";
6310
6310
  };
6311
6311
  }, [isOpen]);
6312
- if (!isOpen) return null;
6312
+ if (!isOpen || typeof document === "undefined") return null;
6313
6313
  const handleClose = () => {
6314
6314
  if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
6315
6315
  onClose();
@@ -6319,124 +6319,127 @@ var init_Modal = __esm({
6319
6319
  handleClose();
6320
6320
  }
6321
6321
  };
6322
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6323
- /* @__PURE__ */ jsxRuntime.jsx(
6324
- exports.Overlay,
6325
- {
6326
- isVisible: isOpen,
6327
- onClick: handleOverlayClick,
6328
- className: "z-40"
6329
- }
6330
- ),
6331
- /* @__PURE__ */ jsxRuntime.jsx(
6332
- exports.Box,
6333
- {
6334
- className: cn(
6335
- "fixed inset-0 z-50 pointer-events-none",
6336
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6337
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6338
- ),
6339
- children: /* @__PURE__ */ jsxRuntime.jsxs(
6340
- exports.Dialog,
6341
- {
6342
- ref: modalRef,
6343
- open: true,
6344
- className: cn(
6345
- // Reset browser-default dialog chrome — we own styling. `static`
6346
- // overrides the user-agent `position: absolute` so the parent
6347
- // flex container's `justify-center` actually centers the dialog
6348
- // (without this, the dialog drops out of flex flow and `m-0`
6349
- // kills the user-agent's `margin: auto` centering, pinning the
6350
- // dialog to top-left).
6351
- "static m-0 p-0 border-0 bg-transparent",
6352
- // Pre-existing dialog frame
6353
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6354
- // Desktop sizing + viewport-aware floor.
6355
- sizeClasses5[size],
6356
- minWidthClasses[size],
6357
- "max-h-[80vh]",
6358
- // Mobile: take the entire screen. Override desktop max-w cap,
6359
- // full height, no rounded corners, no min-width.
6360
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6361
- lookStyles2[look],
6362
- className
6363
- ),
6364
- style: dragY > 0 ? {
6365
- transform: `translateY(${dragY}px)`,
6366
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
6367
- } : void 0,
6368
- ...title && { "aria-labelledby": "modal-title" },
6369
- children: [
6370
- /* @__PURE__ */ jsxRuntime.jsx(
6371
- exports.Box,
6372
- {
6373
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6374
- onPointerDown: (e) => {
6375
- if (!swipeDownToClose) return;
6376
- dragStartY.current = e.clientY;
6377
- isDragging.current = true;
6378
- e.target.setPointerCapture(e.pointerId);
6379
- },
6380
- onPointerMove: (e) => {
6381
- if (!isDragging.current) return;
6382
- const dy = Math.max(0, e.clientY - dragStartY.current);
6383
- setDragY(dy);
6384
- },
6385
- onPointerUp: () => {
6386
- if (!isDragging.current) return;
6387
- isDragging.current = false;
6388
- if (dragY > 100) {
6389
- handleClose();
6390
- }
6391
- setDragY(0);
6392
- },
6393
- onPointerCancel: () => {
6394
- isDragging.current = false;
6395
- setDragY(0);
6396
- },
6397
- children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "w-10 h-1 rounded-full bg-border" })
6398
- }
6322
+ return reactDom.createPortal(
6323
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6324
+ /* @__PURE__ */ jsxRuntime.jsx(
6325
+ exports.Overlay,
6326
+ {
6327
+ isVisible: isOpen,
6328
+ onClick: handleOverlayClick,
6329
+ className: "z-[1000]"
6330
+ }
6331
+ ),
6332
+ /* @__PURE__ */ jsxRuntime.jsx(
6333
+ exports.Box,
6334
+ {
6335
+ className: cn(
6336
+ "fixed inset-0 z-[1001] pointer-events-none",
6337
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6338
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6339
+ ),
6340
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
6341
+ exports.Dialog,
6342
+ {
6343
+ ref: modalRef,
6344
+ open: true,
6345
+ className: cn(
6346
+ // Reset browser-default dialog chrome we own styling. `static`
6347
+ // overrides the user-agent `position: absolute` so the parent
6348
+ // flex container's `justify-center` actually centers the dialog
6349
+ // (without this, the dialog drops out of flex flow and `m-0`
6350
+ // kills the user-agent's `margin: auto` centering, pinning the
6351
+ // dialog to top-left).
6352
+ "static m-0 p-0 border-0 bg-transparent",
6353
+ // Pre-existing dialog frame
6354
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6355
+ // Desktop sizing + viewport-aware floor.
6356
+ sizeClasses5[size],
6357
+ minWidthClasses[size],
6358
+ "max-h-[80vh]",
6359
+ // Mobile: take the entire screen. Override desktop max-w cap,
6360
+ // full height, no rounded corners, no min-width.
6361
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6362
+ lookStyles2[look],
6363
+ className
6399
6364
  ),
6400
- (title || showCloseButton) && /* @__PURE__ */ jsxRuntime.jsxs(
6401
- exports.Box,
6402
- {
6403
- className: cn(
6404
- "px-6 py-4 flex items-center justify-between",
6405
- "border-b-[length:var(--border-width)] border-border"
6406
- ),
6407
- children: [
6408
- title && /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6409
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
6410
- exports.Button,
6411
- {
6412
- variant: "ghost",
6413
- size: "sm",
6414
- icon: "x",
6415
- onClick: handleClose,
6416
- "data-event": "CLOSE",
6417
- "aria-label": "Close modal"
6365
+ style: dragY > 0 ? {
6366
+ transform: `translateY(${dragY}px)`,
6367
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
6368
+ } : void 0,
6369
+ ...title && { "aria-labelledby": "modal-title" },
6370
+ children: [
6371
+ /* @__PURE__ */ jsxRuntime.jsx(
6372
+ exports.Box,
6373
+ {
6374
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6375
+ onPointerDown: (e) => {
6376
+ if (!swipeDownToClose) return;
6377
+ dragStartY.current = e.clientY;
6378
+ isDragging.current = true;
6379
+ e.target.setPointerCapture(e.pointerId);
6380
+ },
6381
+ onPointerMove: (e) => {
6382
+ if (!isDragging.current) return;
6383
+ const dy = Math.max(0, e.clientY - dragStartY.current);
6384
+ setDragY(dy);
6385
+ },
6386
+ onPointerUp: () => {
6387
+ if (!isDragging.current) return;
6388
+ isDragging.current = false;
6389
+ if (dragY > 100) {
6390
+ handleClose();
6418
6391
  }
6419
- )
6420
- ]
6421
- }
6422
- ),
6423
- /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "flex-1 overflow-y-auto p-6", children }),
6424
- footer && /* @__PURE__ */ jsxRuntime.jsx(
6425
- exports.Box,
6426
- {
6427
- className: cn(
6428
- "px-6 py-4 bg-muted",
6429
- "border-t-[length:var(--border-width)] border-border"
6430
- ),
6431
- children: footer
6432
- }
6433
- )
6434
- ]
6435
- }
6436
- )
6437
- }
6438
- )
6439
- ] });
6392
+ setDragY(0);
6393
+ },
6394
+ onPointerCancel: () => {
6395
+ isDragging.current = false;
6396
+ setDragY(0);
6397
+ },
6398
+ children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "w-10 h-1 rounded-full bg-border" })
6399
+ }
6400
+ ),
6401
+ (title || showCloseButton) && /* @__PURE__ */ jsxRuntime.jsxs(
6402
+ exports.Box,
6403
+ {
6404
+ className: cn(
6405
+ "px-6 py-4 flex items-center justify-between",
6406
+ "border-b-[length:var(--border-width)] border-border"
6407
+ ),
6408
+ children: [
6409
+ title && /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6410
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
6411
+ exports.Button,
6412
+ {
6413
+ variant: "ghost",
6414
+ size: "sm",
6415
+ icon: "x",
6416
+ onClick: handleClose,
6417
+ "data-event": "CLOSE",
6418
+ "aria-label": "Close modal"
6419
+ }
6420
+ )
6421
+ ]
6422
+ }
6423
+ ),
6424
+ /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "flex-1 overflow-y-auto p-6", children }),
6425
+ footer && /* @__PURE__ */ jsxRuntime.jsx(
6426
+ exports.Box,
6427
+ {
6428
+ className: cn(
6429
+ "px-6 py-4 bg-muted",
6430
+ "border-t-[length:var(--border-width)] border-border"
6431
+ ),
6432
+ children: footer
6433
+ }
6434
+ )
6435
+ ]
6436
+ }
6437
+ )
6438
+ }
6439
+ )
6440
+ ] }),
6441
+ document.body
6442
+ );
6440
6443
  };
6441
6444
  exports.Modal.displayName = "Modal";
6442
6445
  }
@@ -12488,7 +12491,7 @@ var init_CodeBlock = __esm({
12488
12491
  };
12489
12492
  };
12490
12493
  }, [errorLines]);
12491
- const isFoldable = foldableProp ?? (language === "orb" || language === "json");
12494
+ const isFoldable = foldableProp ?? true;
12492
12495
  const [collapsed, setCollapsed] = React80.useState(() => /* @__PURE__ */ new Set());
12493
12496
  const foldRegions = React80.useMemo(
12494
12497
  () => isFoldable ? computeFoldRegions(code) : [],
@@ -6260,7 +6260,7 @@ var init_Modal = __esm({
6260
6260
  document.body.style.overflow = "";
6261
6261
  };
6262
6262
  }, [isOpen]);
6263
- if (!isOpen) return null;
6263
+ if (!isOpen || typeof document === "undefined") return null;
6264
6264
  const handleClose = () => {
6265
6265
  if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
6266
6266
  onClose();
@@ -6270,124 +6270,127 @@ var init_Modal = __esm({
6270
6270
  handleClose();
6271
6271
  }
6272
6272
  };
6273
- return /* @__PURE__ */ jsxs(Fragment, { children: [
6274
- /* @__PURE__ */ jsx(
6275
- Overlay,
6276
- {
6277
- isVisible: isOpen,
6278
- onClick: handleOverlayClick,
6279
- className: "z-40"
6280
- }
6281
- ),
6282
- /* @__PURE__ */ jsx(
6283
- Box,
6284
- {
6285
- className: cn(
6286
- "fixed inset-0 z-50 pointer-events-none",
6287
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6288
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6289
- ),
6290
- children: /* @__PURE__ */ jsxs(
6291
- Dialog,
6292
- {
6293
- ref: modalRef,
6294
- open: true,
6295
- className: cn(
6296
- // Reset browser-default dialog chrome — we own styling. `static`
6297
- // overrides the user-agent `position: absolute` so the parent
6298
- // flex container's `justify-center` actually centers the dialog
6299
- // (without this, the dialog drops out of flex flow and `m-0`
6300
- // kills the user-agent's `margin: auto` centering, pinning the
6301
- // dialog to top-left).
6302
- "static m-0 p-0 border-0 bg-transparent",
6303
- // Pre-existing dialog frame
6304
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6305
- // Desktop sizing + viewport-aware floor.
6306
- sizeClasses5[size],
6307
- minWidthClasses[size],
6308
- "max-h-[80vh]",
6309
- // Mobile: take the entire screen. Override desktop max-w cap,
6310
- // full height, no rounded corners, no min-width.
6311
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6312
- lookStyles2[look],
6313
- className
6314
- ),
6315
- style: dragY > 0 ? {
6316
- transform: `translateY(${dragY}px)`,
6317
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
6318
- } : void 0,
6319
- ...title && { "aria-labelledby": "modal-title" },
6320
- children: [
6321
- /* @__PURE__ */ jsx(
6322
- Box,
6323
- {
6324
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6325
- onPointerDown: (e) => {
6326
- if (!swipeDownToClose) return;
6327
- dragStartY.current = e.clientY;
6328
- isDragging.current = true;
6329
- e.target.setPointerCapture(e.pointerId);
6330
- },
6331
- onPointerMove: (e) => {
6332
- if (!isDragging.current) return;
6333
- const dy = Math.max(0, e.clientY - dragStartY.current);
6334
- setDragY(dy);
6335
- },
6336
- onPointerUp: () => {
6337
- if (!isDragging.current) return;
6338
- isDragging.current = false;
6339
- if (dragY > 100) {
6340
- handleClose();
6341
- }
6342
- setDragY(0);
6343
- },
6344
- onPointerCancel: () => {
6345
- isDragging.current = false;
6346
- setDragY(0);
6347
- },
6348
- children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6349
- }
6273
+ return createPortal(
6274
+ /* @__PURE__ */ jsxs(Fragment, { children: [
6275
+ /* @__PURE__ */ jsx(
6276
+ Overlay,
6277
+ {
6278
+ isVisible: isOpen,
6279
+ onClick: handleOverlayClick,
6280
+ className: "z-[1000]"
6281
+ }
6282
+ ),
6283
+ /* @__PURE__ */ jsx(
6284
+ Box,
6285
+ {
6286
+ className: cn(
6287
+ "fixed inset-0 z-[1001] pointer-events-none",
6288
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6289
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6290
+ ),
6291
+ children: /* @__PURE__ */ jsxs(
6292
+ Dialog,
6293
+ {
6294
+ ref: modalRef,
6295
+ open: true,
6296
+ className: cn(
6297
+ // Reset browser-default dialog chrome we own styling. `static`
6298
+ // overrides the user-agent `position: absolute` so the parent
6299
+ // flex container's `justify-center` actually centers the dialog
6300
+ // (without this, the dialog drops out of flex flow and `m-0`
6301
+ // kills the user-agent's `margin: auto` centering, pinning the
6302
+ // dialog to top-left).
6303
+ "static m-0 p-0 border-0 bg-transparent",
6304
+ // Pre-existing dialog frame
6305
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6306
+ // Desktop sizing + viewport-aware floor.
6307
+ sizeClasses5[size],
6308
+ minWidthClasses[size],
6309
+ "max-h-[80vh]",
6310
+ // Mobile: take the entire screen. Override desktop max-w cap,
6311
+ // full height, no rounded corners, no min-width.
6312
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6313
+ lookStyles2[look],
6314
+ className
6350
6315
  ),
6351
- (title || showCloseButton) && /* @__PURE__ */ jsxs(
6352
- Box,
6353
- {
6354
- className: cn(
6355
- "px-6 py-4 flex items-center justify-between",
6356
- "border-b-[length:var(--border-width)] border-border"
6357
- ),
6358
- children: [
6359
- title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6360
- showCloseButton && /* @__PURE__ */ jsx(
6361
- Button,
6362
- {
6363
- variant: "ghost",
6364
- size: "sm",
6365
- icon: "x",
6366
- onClick: handleClose,
6367
- "data-event": "CLOSE",
6368
- "aria-label": "Close modal"
6316
+ style: dragY > 0 ? {
6317
+ transform: `translateY(${dragY}px)`,
6318
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
6319
+ } : void 0,
6320
+ ...title && { "aria-labelledby": "modal-title" },
6321
+ children: [
6322
+ /* @__PURE__ */ jsx(
6323
+ Box,
6324
+ {
6325
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6326
+ onPointerDown: (e) => {
6327
+ if (!swipeDownToClose) return;
6328
+ dragStartY.current = e.clientY;
6329
+ isDragging.current = true;
6330
+ e.target.setPointerCapture(e.pointerId);
6331
+ },
6332
+ onPointerMove: (e) => {
6333
+ if (!isDragging.current) return;
6334
+ const dy = Math.max(0, e.clientY - dragStartY.current);
6335
+ setDragY(dy);
6336
+ },
6337
+ onPointerUp: () => {
6338
+ if (!isDragging.current) return;
6339
+ isDragging.current = false;
6340
+ if (dragY > 100) {
6341
+ handleClose();
6369
6342
  }
6370
- )
6371
- ]
6372
- }
6373
- ),
6374
- /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6375
- footer && /* @__PURE__ */ jsx(
6376
- Box,
6377
- {
6378
- className: cn(
6379
- "px-6 py-4 bg-muted",
6380
- "border-t-[length:var(--border-width)] border-border"
6381
- ),
6382
- children: footer
6383
- }
6384
- )
6385
- ]
6386
- }
6387
- )
6388
- }
6389
- )
6390
- ] });
6343
+ setDragY(0);
6344
+ },
6345
+ onPointerCancel: () => {
6346
+ isDragging.current = false;
6347
+ setDragY(0);
6348
+ },
6349
+ children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6350
+ }
6351
+ ),
6352
+ (title || showCloseButton) && /* @__PURE__ */ jsxs(
6353
+ Box,
6354
+ {
6355
+ className: cn(
6356
+ "px-6 py-4 flex items-center justify-between",
6357
+ "border-b-[length:var(--border-width)] border-border"
6358
+ ),
6359
+ children: [
6360
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6361
+ showCloseButton && /* @__PURE__ */ jsx(
6362
+ Button,
6363
+ {
6364
+ variant: "ghost",
6365
+ size: "sm",
6366
+ icon: "x",
6367
+ onClick: handleClose,
6368
+ "data-event": "CLOSE",
6369
+ "aria-label": "Close modal"
6370
+ }
6371
+ )
6372
+ ]
6373
+ }
6374
+ ),
6375
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6376
+ footer && /* @__PURE__ */ jsx(
6377
+ Box,
6378
+ {
6379
+ className: cn(
6380
+ "px-6 py-4 bg-muted",
6381
+ "border-t-[length:var(--border-width)] border-border"
6382
+ ),
6383
+ children: footer
6384
+ }
6385
+ )
6386
+ ]
6387
+ }
6388
+ )
6389
+ }
6390
+ )
6391
+ ] }),
6392
+ document.body
6393
+ );
6391
6394
  };
6392
6395
  Modal.displayName = "Modal";
6393
6396
  }
@@ -12439,7 +12442,7 @@ var init_CodeBlock = __esm({
12439
12442
  };
12440
12443
  };
12441
12444
  }, [errorLines]);
12442
- const isFoldable = foldableProp ?? (language === "orb" || language === "json");
12445
+ const isFoldable = foldableProp ?? true;
12443
12446
  const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
12444
12447
  const foldRegions = useMemo(
12445
12448
  () => isFoldable ? computeFoldRegions(code) : [],
@@ -19,7 +19,7 @@ export interface CodeBlockProps {
19
19
  showLanguageBadge?: boolean;
20
20
  /** Maximum height before scrolling */
21
21
  maxHeight?: string;
22
- /** Enable JSON-style code folding (default: true for json/orb) */
22
+ /** Enable brace-based code folding of multi-line `{}`/`[]` blocks (default: true). */
23
23
  foldable?: boolean;
24
24
  /** Additional CSS classes */
25
25
  className?: string;