@almadar/ui 5.21.3 → 5.21.5

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.
@@ -15,10 +15,6 @@ import { evaluate, createMinimalContext } from '@almadar/evaluator';
15
15
  import { useUISlots } from '@almadar/ui/context';
16
16
  import { Link, Outlet, useLocation } from 'react-router-dom';
17
17
  import ELK from 'elkjs/lib/elk.bundled.js';
18
- import ReactMarkdown from 'react-markdown';
19
- import remarkGfm from 'remark-gfm';
20
- import remarkMath from 'remark-math';
21
- import rehypeKatex from 'rehype-katex';
22
18
  import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light.js';
23
19
  import dark from 'react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js';
24
20
  import { orbLanguage, loloLanguage, ORB_COLORS } from '@almadar/syntax';
@@ -38,6 +34,10 @@ import langDiff from 'react-syntax-highlighter/dist/esm/languages/prism/diff.js'
38
34
  import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js';
39
35
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
40
36
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
37
+ import ReactMarkdown from 'react-markdown';
38
+ import remarkGfm from 'remark-gfm';
39
+ import remarkMath from 'remark-math';
40
+ import rehypeKatex from 'rehype-katex';
41
41
  import { isInlineTrait } from '@almadar/core';
42
42
  import { DndContext, pointerWithin, rectIntersection, closestCorners, useSensors, useSensor, PointerSensor, KeyboardSensor, useDroppable } from '@dnd-kit/core';
43
43
  import { useSortable, arrayMove, sortableKeyboardCoordinates, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
@@ -13773,137 +13773,6 @@ var init_katex_min = __esm({
13773
13773
  "node_modules/katex/dist/katex.min.css"() {
13774
13774
  }
13775
13775
  });
13776
- var MarkdownContent;
13777
- var init_MarkdownContent = __esm({
13778
- "components/core/molecules/markdown/MarkdownContent.tsx"() {
13779
- init_katex_min();
13780
- init_Box();
13781
- init_useTranslate();
13782
- init_cn();
13783
- MarkdownContent = React85__default.memo(
13784
- ({ content, direction, className }) => {
13785
- const { t: _t } = useTranslate();
13786
- const safeContent = typeof content === "string" ? content : String(content ?? "");
13787
- return /* @__PURE__ */ jsx(
13788
- Box,
13789
- {
13790
- className: cn("prose max-w-none", className),
13791
- style: {
13792
- color: "var(--color-foreground)",
13793
- "--tw-prose-body": "var(--color-foreground)",
13794
- "--tw-prose-headings": "var(--color-foreground)",
13795
- "--tw-prose-lead": "var(--color-muted-foreground)",
13796
- "--tw-prose-links": "var(--color-primary)",
13797
- "--tw-prose-bold": "var(--color-foreground)",
13798
- "--tw-prose-counters": "var(--color-muted-foreground)",
13799
- "--tw-prose-bullets": "var(--color-muted-foreground)",
13800
- "--tw-prose-hr": "var(--color-border)",
13801
- "--tw-prose-quotes": "var(--color-foreground)",
13802
- "--tw-prose-quote-borders": "var(--color-primary)",
13803
- "--tw-prose-captions": "var(--color-muted-foreground)",
13804
- "--tw-prose-code": "var(--color-foreground)",
13805
- "--tw-prose-pre-code": "var(--color-foreground)",
13806
- "--tw-prose-pre-bg": "var(--color-muted)",
13807
- "--tw-prose-th-borders": "var(--color-border)",
13808
- "--tw-prose-td-borders": "var(--color-border)",
13809
- direction
13810
- },
13811
- children: /* @__PURE__ */ jsx(
13812
- ReactMarkdown,
13813
- {
13814
- remarkPlugins: [remarkMath, remarkGfm],
13815
- rehypePlugins: [
13816
- [rehypeKatex, { strict: false, throwOnError: false }]
13817
- ],
13818
- components: {
13819
- // Handle inline code only — fenced code blocks are parsed out separately
13820
- code({ className: codeClassName, children, ...props }) {
13821
- return /* @__PURE__ */ jsx(
13822
- "code",
13823
- {
13824
- ...props,
13825
- className: codeClassName,
13826
- style: {
13827
- backgroundColor: "var(--color-muted)",
13828
- color: "var(--color-foreground)",
13829
- border: "1px solid var(--color-border)",
13830
- padding: "0.125rem 0.375rem",
13831
- borderRadius: "0.25rem",
13832
- fontSize: "0.875em",
13833
- fontFamily: "ui-monospace, monospace"
13834
- },
13835
- children
13836
- }
13837
- );
13838
- },
13839
- // Style links
13840
- a({ href, children, ...props }) {
13841
- return /* @__PURE__ */ jsx(
13842
- "a",
13843
- {
13844
- href,
13845
- ...props,
13846
- className: "text-[var(--color-primary)] hover:underline",
13847
- target: href?.startsWith("http") ? "_blank" : void 0,
13848
- rel: href?.startsWith("http") ? "noopener noreferrer" : void 0,
13849
- children
13850
- }
13851
- );
13852
- },
13853
- // Style tables
13854
- table({ children, ...props }) {
13855
- return /* @__PURE__ */ jsx("div", { className: "overflow-x-auto my-4", children: /* @__PURE__ */ jsx(
13856
- "table",
13857
- {
13858
- ...props,
13859
- className: "min-w-full border-collapse border border-[var(--color-border)]",
13860
- children
13861
- }
13862
- ) });
13863
- },
13864
- th({ children, ...props }) {
13865
- return /* @__PURE__ */ jsx(
13866
- "th",
13867
- {
13868
- ...props,
13869
- className: "border border-[var(--color-border)] bg-[var(--color-muted)] px-4 py-2 text-left font-semibold",
13870
- children
13871
- }
13872
- );
13873
- },
13874
- td({ children, ...props }) {
13875
- return /* @__PURE__ */ jsx(
13876
- "td",
13877
- {
13878
- ...props,
13879
- className: "border border-[var(--color-border)] px-4 py-2",
13880
- children
13881
- }
13882
- );
13883
- },
13884
- // Style blockquotes
13885
- blockquote({ children, ...props }) {
13886
- return /* @__PURE__ */ jsx(
13887
- "blockquote",
13888
- {
13889
- ...props,
13890
- className: "border-l-4 border-[var(--color-primary)] pl-4 italic text-[var(--color-foreground)] my-4",
13891
- children
13892
- }
13893
- );
13894
- }
13895
- },
13896
- children: safeContent
13897
- }
13898
- )
13899
- }
13900
- );
13901
- },
13902
- (prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
13903
- );
13904
- MarkdownContent.displayName = "MarkdownContent";
13905
- }
13906
- });
13907
13776
  function computeFoldRegions(code) {
13908
13777
  const lines = code.split("\n");
13909
13778
  const regions = [];
@@ -14449,6 +14318,181 @@ var init_CodeBlock = __esm({
14449
14318
  CodeBlock.displayName = "CodeBlock";
14450
14319
  }
14451
14320
  });
14321
+ var MarkdownContent;
14322
+ var init_MarkdownContent = __esm({
14323
+ "components/core/molecules/markdown/MarkdownContent.tsx"() {
14324
+ init_katex_min();
14325
+ init_Box();
14326
+ init_CodeBlock();
14327
+ init_useTranslate();
14328
+ init_cn();
14329
+ MarkdownContent = React85__default.memo(
14330
+ ({ content, direction, className }) => {
14331
+ const { t: _t } = useTranslate();
14332
+ const safeContent = typeof content === "string" ? content : String(content ?? "");
14333
+ return /* @__PURE__ */ jsx(
14334
+ Box,
14335
+ {
14336
+ className: cn("prose max-w-none", className),
14337
+ style: {
14338
+ color: "var(--color-foreground)",
14339
+ "--tw-prose-body": "var(--color-foreground)",
14340
+ "--tw-prose-headings": "var(--color-foreground)",
14341
+ "--tw-prose-lead": "var(--color-muted-foreground)",
14342
+ "--tw-prose-links": "var(--color-primary)",
14343
+ "--tw-prose-bold": "var(--color-foreground)",
14344
+ "--tw-prose-counters": "var(--color-muted-foreground)",
14345
+ "--tw-prose-bullets": "var(--color-muted-foreground)",
14346
+ "--tw-prose-hr": "var(--color-border)",
14347
+ "--tw-prose-quotes": "var(--color-foreground)",
14348
+ "--tw-prose-quote-borders": "var(--color-primary)",
14349
+ "--tw-prose-captions": "var(--color-muted-foreground)",
14350
+ "--tw-prose-code": "var(--color-foreground)",
14351
+ "--tw-prose-pre-code": "var(--color-foreground)",
14352
+ "--tw-prose-pre-bg": "var(--color-muted)",
14353
+ "--tw-prose-th-borders": "var(--color-border)",
14354
+ "--tw-prose-td-borders": "var(--color-border)",
14355
+ direction
14356
+ },
14357
+ children: /* @__PURE__ */ jsx(
14358
+ ReactMarkdown,
14359
+ {
14360
+ remarkPlugins: [remarkMath, remarkGfm],
14361
+ rehypePlugins: [
14362
+ [rehypeKatex, { strict: false, throwOnError: false }]
14363
+ ],
14364
+ components: {
14365
+ code({
14366
+ className: codeClassName,
14367
+ children,
14368
+ inline,
14369
+ ...props
14370
+ }) {
14371
+ if (!inline) {
14372
+ const match = /language-(\w+)/.exec(codeClassName ?? "");
14373
+ const code = String(children).replace(/\n$/, "");
14374
+ if (match) {
14375
+ return /* @__PURE__ */ jsx(
14376
+ CodeBlock,
14377
+ {
14378
+ code,
14379
+ language: match[1],
14380
+ maxHeight: "60vh"
14381
+ }
14382
+ );
14383
+ }
14384
+ return /* @__PURE__ */ jsx(
14385
+ "pre",
14386
+ {
14387
+ style: {
14388
+ backgroundColor: "var(--color-muted)",
14389
+ color: "var(--color-foreground)",
14390
+ padding: "1rem",
14391
+ borderRadius: "0.5rem",
14392
+ overflow: "auto",
14393
+ margin: 0
14394
+ },
14395
+ children: /* @__PURE__ */ jsx(
14396
+ "code",
14397
+ {
14398
+ ...props,
14399
+ className: codeClassName,
14400
+ style: {
14401
+ fontFamily: "ui-monospace, monospace",
14402
+ fontSize: "0.875em"
14403
+ },
14404
+ children
14405
+ }
14406
+ )
14407
+ }
14408
+ );
14409
+ }
14410
+ return /* @__PURE__ */ jsx(
14411
+ "code",
14412
+ {
14413
+ ...props,
14414
+ className: codeClassName,
14415
+ style: {
14416
+ backgroundColor: "var(--color-muted)",
14417
+ color: "var(--color-foreground)",
14418
+ border: "1px solid var(--color-border)",
14419
+ padding: "0.125rem 0.375rem",
14420
+ borderRadius: "0.25rem",
14421
+ fontSize: "0.875em",
14422
+ fontFamily: "ui-monospace, monospace"
14423
+ },
14424
+ children
14425
+ }
14426
+ );
14427
+ },
14428
+ // Style links
14429
+ a({ href, children, ...props }) {
14430
+ return /* @__PURE__ */ jsx(
14431
+ "a",
14432
+ {
14433
+ href,
14434
+ ...props,
14435
+ className: "text-[var(--color-primary)] hover:underline",
14436
+ target: href?.startsWith("http") ? "_blank" : void 0,
14437
+ rel: href?.startsWith("http") ? "noopener noreferrer" : void 0,
14438
+ children
14439
+ }
14440
+ );
14441
+ },
14442
+ // Style tables
14443
+ table({ children, ...props }) {
14444
+ return /* @__PURE__ */ jsx("div", { className: "overflow-x-auto my-4", children: /* @__PURE__ */ jsx(
14445
+ "table",
14446
+ {
14447
+ ...props,
14448
+ className: "min-w-full border-collapse border border-[var(--color-border)]",
14449
+ children
14450
+ }
14451
+ ) });
14452
+ },
14453
+ th({ children, ...props }) {
14454
+ return /* @__PURE__ */ jsx(
14455
+ "th",
14456
+ {
14457
+ ...props,
14458
+ className: "border border-[var(--color-border)] bg-[var(--color-muted)] px-4 py-2 text-left font-semibold",
14459
+ children
14460
+ }
14461
+ );
14462
+ },
14463
+ td({ children, ...props }) {
14464
+ return /* @__PURE__ */ jsx(
14465
+ "td",
14466
+ {
14467
+ ...props,
14468
+ className: "border border-[var(--color-border)] px-4 py-2",
14469
+ children
14470
+ }
14471
+ );
14472
+ },
14473
+ // Style blockquotes
14474
+ blockquote({ children, ...props }) {
14475
+ return /* @__PURE__ */ jsx(
14476
+ "blockquote",
14477
+ {
14478
+ ...props,
14479
+ className: "border-l-4 border-[var(--color-primary)] pl-4 italic text-[var(--color-foreground)] my-4",
14480
+ children
14481
+ }
14482
+ );
14483
+ }
14484
+ },
14485
+ children: safeContent
14486
+ }
14487
+ )
14488
+ }
14489
+ );
14490
+ },
14491
+ (prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
14492
+ );
14493
+ MarkdownContent.displayName = "MarkdownContent";
14494
+ }
14495
+ });
14452
14496
  function useLongPress(onLongPress, options = {}) {
14453
14497
  const { duration = 500, moveThreshold = 10 } = options;
14454
14498
  const timerRef = useRef(null);