@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.
@@ -10,8 +10,8 @@ var LucideIcons2 = require('lucide-react');
10
10
  var PhosphorIcons = require('@phosphor-icons/react');
11
11
  var TablerIcons = require('@tabler/icons-react');
12
12
  var FaIcons = require('react-icons/fa');
13
- var evaluator = require('@almadar/evaluator');
14
13
  var reactDom = require('react-dom');
14
+ var evaluator = require('@almadar/evaluator');
15
15
  var reactRouterDom = require('react-router-dom');
16
16
  var ReactMarkdown = require('react-markdown');
17
17
  var remarkGfm = require('remark-gfm');
@@ -6856,7 +6856,7 @@ var init_Modal = __esm({
6856
6856
  document.body.style.overflow = "";
6857
6857
  };
6858
6858
  }, [isOpen]);
6859
- if (!isOpen) return null;
6859
+ if (!isOpen || typeof document === "undefined") return null;
6860
6860
  const handleClose = () => {
6861
6861
  if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
6862
6862
  onClose();
@@ -6866,124 +6866,127 @@ var init_Modal = __esm({
6866
6866
  handleClose();
6867
6867
  }
6868
6868
  };
6869
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6870
- /* @__PURE__ */ jsxRuntime.jsx(
6871
- Overlay,
6872
- {
6873
- isVisible: isOpen,
6874
- onClick: handleOverlayClick,
6875
- className: "z-40"
6876
- }
6877
- ),
6878
- /* @__PURE__ */ jsxRuntime.jsx(
6879
- Box,
6880
- {
6881
- className: cn(
6882
- "fixed inset-0 z-50 pointer-events-none",
6883
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6884
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6885
- ),
6886
- children: /* @__PURE__ */ jsxRuntime.jsxs(
6887
- Dialog,
6888
- {
6889
- ref: modalRef,
6890
- open: true,
6891
- className: cn(
6892
- // Reset browser-default dialog chrome — we own styling. `static`
6893
- // overrides the user-agent `position: absolute` so the parent
6894
- // flex container's `justify-center` actually centers the dialog
6895
- // (without this, the dialog drops out of flex flow and `m-0`
6896
- // kills the user-agent's `margin: auto` centering, pinning the
6897
- // dialog to top-left).
6898
- "static m-0 p-0 border-0 bg-transparent",
6899
- // Pre-existing dialog frame
6900
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6901
- // Desktop sizing + viewport-aware floor.
6902
- sizeClasses2[size],
6903
- minWidthClasses[size],
6904
- "max-h-[80vh]",
6905
- // Mobile: take the entire screen. Override desktop max-w cap,
6906
- // full height, no rounded corners, no min-width.
6907
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6908
- lookStyles[look],
6909
- className
6910
- ),
6911
- style: dragY > 0 ? {
6912
- transform: `translateY(${dragY}px)`,
6913
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
6914
- } : void 0,
6915
- ...title && { "aria-labelledby": "modal-title" },
6916
- children: [
6917
- /* @__PURE__ */ jsxRuntime.jsx(
6918
- Box,
6919
- {
6920
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6921
- onPointerDown: (e) => {
6922
- if (!swipeDownToClose) return;
6923
- dragStartY.current = e.clientY;
6924
- isDragging.current = true;
6925
- e.target.setPointerCapture(e.pointerId);
6926
- },
6927
- onPointerMove: (e) => {
6928
- if (!isDragging.current) return;
6929
- const dy = Math.max(0, e.clientY - dragStartY.current);
6930
- setDragY(dy);
6931
- },
6932
- onPointerUp: () => {
6933
- if (!isDragging.current) return;
6934
- isDragging.current = false;
6935
- if (dragY > 100) {
6936
- handleClose();
6937
- }
6938
- setDragY(0);
6939
- },
6940
- onPointerCancel: () => {
6941
- isDragging.current = false;
6942
- setDragY(0);
6943
- },
6944
- children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6945
- }
6869
+ return reactDom.createPortal(
6870
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6871
+ /* @__PURE__ */ jsxRuntime.jsx(
6872
+ Overlay,
6873
+ {
6874
+ isVisible: isOpen,
6875
+ onClick: handleOverlayClick,
6876
+ className: "z-[1000]"
6877
+ }
6878
+ ),
6879
+ /* @__PURE__ */ jsxRuntime.jsx(
6880
+ Box,
6881
+ {
6882
+ className: cn(
6883
+ "fixed inset-0 z-[1001] pointer-events-none",
6884
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6885
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6886
+ ),
6887
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
6888
+ Dialog,
6889
+ {
6890
+ ref: modalRef,
6891
+ open: true,
6892
+ className: cn(
6893
+ // Reset browser-default dialog chrome we own styling. `static`
6894
+ // overrides the user-agent `position: absolute` so the parent
6895
+ // flex container's `justify-center` actually centers the dialog
6896
+ // (without this, the dialog drops out of flex flow and `m-0`
6897
+ // kills the user-agent's `margin: auto` centering, pinning the
6898
+ // dialog to top-left).
6899
+ "static m-0 p-0 border-0 bg-transparent",
6900
+ // Pre-existing dialog frame
6901
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6902
+ // Desktop sizing + viewport-aware floor.
6903
+ sizeClasses2[size],
6904
+ minWidthClasses[size],
6905
+ "max-h-[80vh]",
6906
+ // Mobile: take the entire screen. Override desktop max-w cap,
6907
+ // full height, no rounded corners, no min-width.
6908
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6909
+ lookStyles[look],
6910
+ className
6946
6911
  ),
6947
- (title || showCloseButton) && /* @__PURE__ */ jsxRuntime.jsxs(
6948
- Box,
6949
- {
6950
- className: cn(
6951
- "px-6 py-4 flex items-center justify-between",
6952
- "border-b-[length:var(--border-width)] border-border"
6953
- ),
6954
- children: [
6955
- title && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6956
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
6957
- Button,
6958
- {
6959
- variant: "ghost",
6960
- size: "sm",
6961
- icon: "x",
6962
- onClick: handleClose,
6963
- "data-event": "CLOSE",
6964
- "aria-label": "Close modal"
6912
+ style: dragY > 0 ? {
6913
+ transform: `translateY(${dragY}px)`,
6914
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
6915
+ } : void 0,
6916
+ ...title && { "aria-labelledby": "modal-title" },
6917
+ children: [
6918
+ /* @__PURE__ */ jsxRuntime.jsx(
6919
+ Box,
6920
+ {
6921
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6922
+ onPointerDown: (e) => {
6923
+ if (!swipeDownToClose) return;
6924
+ dragStartY.current = e.clientY;
6925
+ isDragging.current = true;
6926
+ e.target.setPointerCapture(e.pointerId);
6927
+ },
6928
+ onPointerMove: (e) => {
6929
+ if (!isDragging.current) return;
6930
+ const dy = Math.max(0, e.clientY - dragStartY.current);
6931
+ setDragY(dy);
6932
+ },
6933
+ onPointerUp: () => {
6934
+ if (!isDragging.current) return;
6935
+ isDragging.current = false;
6936
+ if (dragY > 100) {
6937
+ handleClose();
6965
6938
  }
6966
- )
6967
- ]
6968
- }
6969
- ),
6970
- /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6971
- footer && /* @__PURE__ */ jsxRuntime.jsx(
6972
- Box,
6973
- {
6974
- className: cn(
6975
- "px-6 py-4 bg-muted",
6976
- "border-t-[length:var(--border-width)] border-border"
6977
- ),
6978
- children: footer
6979
- }
6980
- )
6981
- ]
6982
- }
6983
- )
6984
- }
6985
- )
6986
- ] });
6939
+ setDragY(0);
6940
+ },
6941
+ onPointerCancel: () => {
6942
+ isDragging.current = false;
6943
+ setDragY(0);
6944
+ },
6945
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6946
+ }
6947
+ ),
6948
+ (title || showCloseButton) && /* @__PURE__ */ jsxRuntime.jsxs(
6949
+ Box,
6950
+ {
6951
+ className: cn(
6952
+ "px-6 py-4 flex items-center justify-between",
6953
+ "border-b-[length:var(--border-width)] border-border"
6954
+ ),
6955
+ children: [
6956
+ title && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6957
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
6958
+ Button,
6959
+ {
6960
+ variant: "ghost",
6961
+ size: "sm",
6962
+ icon: "x",
6963
+ onClick: handleClose,
6964
+ "data-event": "CLOSE",
6965
+ "aria-label": "Close modal"
6966
+ }
6967
+ )
6968
+ ]
6969
+ }
6970
+ ),
6971
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6972
+ footer && /* @__PURE__ */ jsxRuntime.jsx(
6973
+ Box,
6974
+ {
6975
+ className: cn(
6976
+ "px-6 py-4 bg-muted",
6977
+ "border-t-[length:var(--border-width)] border-border"
6978
+ ),
6979
+ children: footer
6980
+ }
6981
+ )
6982
+ ]
6983
+ }
6984
+ )
6985
+ }
6986
+ )
6987
+ ] }),
6988
+ document.body
6989
+ );
6987
6990
  };
6988
6991
  Modal.displayName = "Modal";
6989
6992
  }
@@ -17552,7 +17555,7 @@ var init_CodeBlock = __esm({
17552
17555
  };
17553
17556
  };
17554
17557
  }, [errorLines]);
17555
- const isFoldable = foldableProp ?? (language === "orb" || language === "json");
17558
+ const isFoldable = foldableProp ?? true;
17556
17559
  const [collapsed, setCollapsed] = React98.useState(() => /* @__PURE__ */ new Set());
17557
17560
  const foldRegions = React98.useMemo(
17558
17561
  () => isFoldable ? computeFoldRegions(code) : [],
package/dist/avl/index.js CHANGED
@@ -10,8 +10,8 @@ import { Loader2, X, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil
10
10
  import * as PhosphorIcons from '@phosphor-icons/react';
11
11
  import * as TablerIcons from '@tabler/icons-react';
12
12
  import * as FaIcons from 'react-icons/fa';
13
- import { evaluate, createMinimalContext } from '@almadar/evaluator';
14
13
  import { createPortal } from 'react-dom';
14
+ import { evaluate, createMinimalContext } from '@almadar/evaluator';
15
15
  import { Link, Outlet, useLocation } from 'react-router-dom';
16
16
  import ReactMarkdown from 'react-markdown';
17
17
  import remarkGfm from 'remark-gfm';
@@ -6807,7 +6807,7 @@ var init_Modal = __esm({
6807
6807
  document.body.style.overflow = "";
6808
6808
  };
6809
6809
  }, [isOpen]);
6810
- if (!isOpen) return null;
6810
+ if (!isOpen || typeof document === "undefined") return null;
6811
6811
  const handleClose = () => {
6812
6812
  if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
6813
6813
  onClose();
@@ -6817,124 +6817,127 @@ var init_Modal = __esm({
6817
6817
  handleClose();
6818
6818
  }
6819
6819
  };
6820
- return /* @__PURE__ */ jsxs(Fragment, { children: [
6821
- /* @__PURE__ */ jsx(
6822
- Overlay,
6823
- {
6824
- isVisible: isOpen,
6825
- onClick: handleOverlayClick,
6826
- className: "z-40"
6827
- }
6828
- ),
6829
- /* @__PURE__ */ jsx(
6830
- Box,
6831
- {
6832
- className: cn(
6833
- "fixed inset-0 z-50 pointer-events-none",
6834
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6835
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6836
- ),
6837
- children: /* @__PURE__ */ jsxs(
6838
- Dialog,
6839
- {
6840
- ref: modalRef,
6841
- open: true,
6842
- className: cn(
6843
- // Reset browser-default dialog chrome — we own styling. `static`
6844
- // overrides the user-agent `position: absolute` so the parent
6845
- // flex container's `justify-center` actually centers the dialog
6846
- // (without this, the dialog drops out of flex flow and `m-0`
6847
- // kills the user-agent's `margin: auto` centering, pinning the
6848
- // dialog to top-left).
6849
- "static m-0 p-0 border-0 bg-transparent",
6850
- // Pre-existing dialog frame
6851
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6852
- // Desktop sizing + viewport-aware floor.
6853
- sizeClasses2[size],
6854
- minWidthClasses[size],
6855
- "max-h-[80vh]",
6856
- // Mobile: take the entire screen. Override desktop max-w cap,
6857
- // full height, no rounded corners, no min-width.
6858
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6859
- lookStyles[look],
6860
- className
6861
- ),
6862
- style: dragY > 0 ? {
6863
- transform: `translateY(${dragY}px)`,
6864
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
6865
- } : void 0,
6866
- ...title && { "aria-labelledby": "modal-title" },
6867
- children: [
6868
- /* @__PURE__ */ jsx(
6869
- Box,
6870
- {
6871
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6872
- onPointerDown: (e) => {
6873
- if (!swipeDownToClose) return;
6874
- dragStartY.current = e.clientY;
6875
- isDragging.current = true;
6876
- e.target.setPointerCapture(e.pointerId);
6877
- },
6878
- onPointerMove: (e) => {
6879
- if (!isDragging.current) return;
6880
- const dy = Math.max(0, e.clientY - dragStartY.current);
6881
- setDragY(dy);
6882
- },
6883
- onPointerUp: () => {
6884
- if (!isDragging.current) return;
6885
- isDragging.current = false;
6886
- if (dragY > 100) {
6887
- handleClose();
6888
- }
6889
- setDragY(0);
6890
- },
6891
- onPointerCancel: () => {
6892
- isDragging.current = false;
6893
- setDragY(0);
6894
- },
6895
- children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6896
- }
6820
+ return createPortal(
6821
+ /* @__PURE__ */ jsxs(Fragment, { children: [
6822
+ /* @__PURE__ */ jsx(
6823
+ Overlay,
6824
+ {
6825
+ isVisible: isOpen,
6826
+ onClick: handleOverlayClick,
6827
+ className: "z-[1000]"
6828
+ }
6829
+ ),
6830
+ /* @__PURE__ */ jsx(
6831
+ Box,
6832
+ {
6833
+ className: cn(
6834
+ "fixed inset-0 z-[1001] pointer-events-none",
6835
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
6836
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
6837
+ ),
6838
+ children: /* @__PURE__ */ jsxs(
6839
+ Dialog,
6840
+ {
6841
+ ref: modalRef,
6842
+ open: true,
6843
+ className: cn(
6844
+ // Reset browser-default dialog chrome we own styling. `static`
6845
+ // overrides the user-agent `position: absolute` so the parent
6846
+ // flex container's `justify-center` actually centers the dialog
6847
+ // (without this, the dialog drops out of flex flow and `m-0`
6848
+ // kills the user-agent's `margin: auto` centering, pinning the
6849
+ // dialog to top-left).
6850
+ "static m-0 p-0 border-0 bg-transparent",
6851
+ // Pre-existing dialog frame
6852
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
6853
+ // Desktop sizing + viewport-aware floor.
6854
+ sizeClasses2[size],
6855
+ minWidthClasses[size],
6856
+ "max-h-[80vh]",
6857
+ // Mobile: take the entire screen. Override desktop max-w cap,
6858
+ // full height, no rounded corners, no min-width.
6859
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
6860
+ lookStyles[look],
6861
+ className
6897
6862
  ),
6898
- (title || showCloseButton) && /* @__PURE__ */ jsxs(
6899
- Box,
6900
- {
6901
- className: cn(
6902
- "px-6 py-4 flex items-center justify-between",
6903
- "border-b-[length:var(--border-width)] border-border"
6904
- ),
6905
- children: [
6906
- title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6907
- showCloseButton && /* @__PURE__ */ jsx(
6908
- Button,
6909
- {
6910
- variant: "ghost",
6911
- size: "sm",
6912
- icon: "x",
6913
- onClick: handleClose,
6914
- "data-event": "CLOSE",
6915
- "aria-label": "Close modal"
6863
+ style: dragY > 0 ? {
6864
+ transform: `translateY(${dragY}px)`,
6865
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
6866
+ } : void 0,
6867
+ ...title && { "aria-labelledby": "modal-title" },
6868
+ children: [
6869
+ /* @__PURE__ */ jsx(
6870
+ Box,
6871
+ {
6872
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
6873
+ onPointerDown: (e) => {
6874
+ if (!swipeDownToClose) return;
6875
+ dragStartY.current = e.clientY;
6876
+ isDragging.current = true;
6877
+ e.target.setPointerCapture(e.pointerId);
6878
+ },
6879
+ onPointerMove: (e) => {
6880
+ if (!isDragging.current) return;
6881
+ const dy = Math.max(0, e.clientY - dragStartY.current);
6882
+ setDragY(dy);
6883
+ },
6884
+ onPointerUp: () => {
6885
+ if (!isDragging.current) return;
6886
+ isDragging.current = false;
6887
+ if (dragY > 100) {
6888
+ handleClose();
6916
6889
  }
6917
- )
6918
- ]
6919
- }
6920
- ),
6921
- /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6922
- footer && /* @__PURE__ */ jsx(
6923
- Box,
6924
- {
6925
- className: cn(
6926
- "px-6 py-4 bg-muted",
6927
- "border-t-[length:var(--border-width)] border-border"
6928
- ),
6929
- children: footer
6930
- }
6931
- )
6932
- ]
6933
- }
6934
- )
6935
- }
6936
- )
6937
- ] });
6890
+ setDragY(0);
6891
+ },
6892
+ onPointerCancel: () => {
6893
+ isDragging.current = false;
6894
+ setDragY(0);
6895
+ },
6896
+ children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
6897
+ }
6898
+ ),
6899
+ (title || showCloseButton) && /* @__PURE__ */ jsxs(
6900
+ Box,
6901
+ {
6902
+ className: cn(
6903
+ "px-6 py-4 flex items-center justify-between",
6904
+ "border-b-[length:var(--border-width)] border-border"
6905
+ ),
6906
+ children: [
6907
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
6908
+ showCloseButton && /* @__PURE__ */ jsx(
6909
+ Button,
6910
+ {
6911
+ variant: "ghost",
6912
+ size: "sm",
6913
+ icon: "x",
6914
+ onClick: handleClose,
6915
+ "data-event": "CLOSE",
6916
+ "aria-label": "Close modal"
6917
+ }
6918
+ )
6919
+ ]
6920
+ }
6921
+ ),
6922
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
6923
+ footer && /* @__PURE__ */ jsx(
6924
+ Box,
6925
+ {
6926
+ className: cn(
6927
+ "px-6 py-4 bg-muted",
6928
+ "border-t-[length:var(--border-width)] border-border"
6929
+ ),
6930
+ children: footer
6931
+ }
6932
+ )
6933
+ ]
6934
+ }
6935
+ )
6936
+ }
6937
+ )
6938
+ ] }),
6939
+ document.body
6940
+ );
6938
6941
  };
6939
6942
  Modal.displayName = "Modal";
6940
6943
  }
@@ -17503,7 +17506,7 @@ var init_CodeBlock = __esm({
17503
17506
  };
17504
17507
  };
17505
17508
  }, [errorLines]);
17506
- const isFoldable = foldableProp ?? (language === "orb" || language === "json");
17509
+ const isFoldable = foldableProp ?? true;
17507
17510
  const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
17508
17511
  const foldRegions = useMemo(
17509
17512
  () => isFoldable ? computeFoldRegions(code) : [],