@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.
@@ -14,10 +14,6 @@ import { evaluate, createMinimalContext } from '@almadar/evaluator';
14
14
  import { createPortal } from 'react-dom';
15
15
  import { Link, Outlet, useLocation } from 'react-router-dom';
16
16
  import ELK from 'elkjs/lib/elk.bundled.js';
17
- import ReactMarkdown from 'react-markdown';
18
- import remarkGfm from 'remark-gfm';
19
- import remarkMath from 'remark-math';
20
- import rehypeKatex from 'rehype-katex';
21
17
  import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light.js';
22
18
  import dark from 'react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js';
23
19
  import { orbLanguage, loloLanguage, ORB_COLORS } from '@almadar/syntax';
@@ -37,6 +33,10 @@ import langDiff from 'react-syntax-highlighter/dist/esm/languages/prism/diff.js'
37
33
  import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js';
38
34
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
39
35
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
36
+ import ReactMarkdown from 'react-markdown';
37
+ import remarkGfm from 'remark-gfm';
38
+ import remarkMath from 'remark-math';
39
+ import rehypeKatex from 'rehype-katex';
40
40
  import { isInlineTrait } from '@almadar/core';
41
41
  import { DndContext, useSensors, useSensor, PointerSensor, KeyboardSensor, useDroppable, pointerWithin, rectIntersection, closestCorners } from '@dnd-kit/core';
42
42
  import { useSortable, arrayMove, sortableKeyboardCoordinates, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
@@ -12298,137 +12298,6 @@ var init_katex_min = __esm({
12298
12298
  "node_modules/katex/dist/katex.min.css"() {
12299
12299
  }
12300
12300
  });
12301
- var MarkdownContent;
12302
- var init_MarkdownContent = __esm({
12303
- "components/core/molecules/markdown/MarkdownContent.tsx"() {
12304
- init_katex_min();
12305
- init_Box();
12306
- init_useTranslate();
12307
- init_cn();
12308
- MarkdownContent = React79__default.memo(
12309
- ({ content, direction, className }) => {
12310
- const { t: _t } = useTranslate();
12311
- const safeContent = typeof content === "string" ? content : String(content ?? "");
12312
- return /* @__PURE__ */ jsx(
12313
- Box,
12314
- {
12315
- className: cn("prose max-w-none", className),
12316
- style: {
12317
- color: "var(--color-foreground)",
12318
- "--tw-prose-body": "var(--color-foreground)",
12319
- "--tw-prose-headings": "var(--color-foreground)",
12320
- "--tw-prose-lead": "var(--color-muted-foreground)",
12321
- "--tw-prose-links": "var(--color-primary)",
12322
- "--tw-prose-bold": "var(--color-foreground)",
12323
- "--tw-prose-counters": "var(--color-muted-foreground)",
12324
- "--tw-prose-bullets": "var(--color-muted-foreground)",
12325
- "--tw-prose-hr": "var(--color-border)",
12326
- "--tw-prose-quotes": "var(--color-foreground)",
12327
- "--tw-prose-quote-borders": "var(--color-primary)",
12328
- "--tw-prose-captions": "var(--color-muted-foreground)",
12329
- "--tw-prose-code": "var(--color-foreground)",
12330
- "--tw-prose-pre-code": "var(--color-foreground)",
12331
- "--tw-prose-pre-bg": "var(--color-muted)",
12332
- "--tw-prose-th-borders": "var(--color-border)",
12333
- "--tw-prose-td-borders": "var(--color-border)",
12334
- direction
12335
- },
12336
- children: /* @__PURE__ */ jsx(
12337
- ReactMarkdown,
12338
- {
12339
- remarkPlugins: [remarkMath, remarkGfm],
12340
- rehypePlugins: [
12341
- [rehypeKatex, { strict: false, throwOnError: false }]
12342
- ],
12343
- components: {
12344
- // Handle inline code only — fenced code blocks are parsed out separately
12345
- code({ className: codeClassName, children, ...props }) {
12346
- return /* @__PURE__ */ jsx(
12347
- "code",
12348
- {
12349
- ...props,
12350
- className: codeClassName,
12351
- style: {
12352
- backgroundColor: "var(--color-muted)",
12353
- color: "var(--color-foreground)",
12354
- border: "1px solid var(--color-border)",
12355
- padding: "0.125rem 0.375rem",
12356
- borderRadius: "0.25rem",
12357
- fontSize: "0.875em",
12358
- fontFamily: "ui-monospace, monospace"
12359
- },
12360
- children
12361
- }
12362
- );
12363
- },
12364
- // Style links
12365
- a({ href, children, ...props }) {
12366
- return /* @__PURE__ */ jsx(
12367
- "a",
12368
- {
12369
- href,
12370
- ...props,
12371
- className: "text-[var(--color-primary)] hover:underline",
12372
- target: href?.startsWith("http") ? "_blank" : void 0,
12373
- rel: href?.startsWith("http") ? "noopener noreferrer" : void 0,
12374
- children
12375
- }
12376
- );
12377
- },
12378
- // Style tables
12379
- table({ children, ...props }) {
12380
- return /* @__PURE__ */ jsx("div", { className: "overflow-x-auto my-4", children: /* @__PURE__ */ jsx(
12381
- "table",
12382
- {
12383
- ...props,
12384
- className: "min-w-full border-collapse border border-[var(--color-border)]",
12385
- children
12386
- }
12387
- ) });
12388
- },
12389
- th({ children, ...props }) {
12390
- return /* @__PURE__ */ jsx(
12391
- "th",
12392
- {
12393
- ...props,
12394
- className: "border border-[var(--color-border)] bg-[var(--color-muted)] px-4 py-2 text-left font-semibold",
12395
- children
12396
- }
12397
- );
12398
- },
12399
- td({ children, ...props }) {
12400
- return /* @__PURE__ */ jsx(
12401
- "td",
12402
- {
12403
- ...props,
12404
- className: "border border-[var(--color-border)] px-4 py-2",
12405
- children
12406
- }
12407
- );
12408
- },
12409
- // Style blockquotes
12410
- blockquote({ children, ...props }) {
12411
- return /* @__PURE__ */ jsx(
12412
- "blockquote",
12413
- {
12414
- ...props,
12415
- className: "border-l-4 border-[var(--color-primary)] pl-4 italic text-[var(--color-foreground)] my-4",
12416
- children
12417
- }
12418
- );
12419
- }
12420
- },
12421
- children: safeContent
12422
- }
12423
- )
12424
- }
12425
- );
12426
- },
12427
- (prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
12428
- );
12429
- MarkdownContent.displayName = "MarkdownContent";
12430
- }
12431
- });
12432
12301
  function computeFoldRegions(code) {
12433
12302
  const lines = code.split("\n");
12434
12303
  const regions = [];
@@ -12974,6 +12843,181 @@ var init_CodeBlock = __esm({
12974
12843
  CodeBlock.displayName = "CodeBlock";
12975
12844
  }
12976
12845
  });
12846
+ var MarkdownContent;
12847
+ var init_MarkdownContent = __esm({
12848
+ "components/core/molecules/markdown/MarkdownContent.tsx"() {
12849
+ init_katex_min();
12850
+ init_Box();
12851
+ init_CodeBlock();
12852
+ init_useTranslate();
12853
+ init_cn();
12854
+ MarkdownContent = React79__default.memo(
12855
+ ({ content, direction, className }) => {
12856
+ const { t: _t } = useTranslate();
12857
+ const safeContent = typeof content === "string" ? content : String(content ?? "");
12858
+ return /* @__PURE__ */ jsx(
12859
+ Box,
12860
+ {
12861
+ className: cn("prose max-w-none", className),
12862
+ style: {
12863
+ color: "var(--color-foreground)",
12864
+ "--tw-prose-body": "var(--color-foreground)",
12865
+ "--tw-prose-headings": "var(--color-foreground)",
12866
+ "--tw-prose-lead": "var(--color-muted-foreground)",
12867
+ "--tw-prose-links": "var(--color-primary)",
12868
+ "--tw-prose-bold": "var(--color-foreground)",
12869
+ "--tw-prose-counters": "var(--color-muted-foreground)",
12870
+ "--tw-prose-bullets": "var(--color-muted-foreground)",
12871
+ "--tw-prose-hr": "var(--color-border)",
12872
+ "--tw-prose-quotes": "var(--color-foreground)",
12873
+ "--tw-prose-quote-borders": "var(--color-primary)",
12874
+ "--tw-prose-captions": "var(--color-muted-foreground)",
12875
+ "--tw-prose-code": "var(--color-foreground)",
12876
+ "--tw-prose-pre-code": "var(--color-foreground)",
12877
+ "--tw-prose-pre-bg": "var(--color-muted)",
12878
+ "--tw-prose-th-borders": "var(--color-border)",
12879
+ "--tw-prose-td-borders": "var(--color-border)",
12880
+ direction
12881
+ },
12882
+ children: /* @__PURE__ */ jsx(
12883
+ ReactMarkdown,
12884
+ {
12885
+ remarkPlugins: [remarkMath, remarkGfm],
12886
+ rehypePlugins: [
12887
+ [rehypeKatex, { strict: false, throwOnError: false }]
12888
+ ],
12889
+ components: {
12890
+ code({
12891
+ className: codeClassName,
12892
+ children,
12893
+ inline,
12894
+ ...props
12895
+ }) {
12896
+ if (!inline) {
12897
+ const match = /language-(\w+)/.exec(codeClassName ?? "");
12898
+ const code = String(children).replace(/\n$/, "");
12899
+ if (match) {
12900
+ return /* @__PURE__ */ jsx(
12901
+ CodeBlock,
12902
+ {
12903
+ code,
12904
+ language: match[1],
12905
+ maxHeight: "60vh"
12906
+ }
12907
+ );
12908
+ }
12909
+ return /* @__PURE__ */ jsx(
12910
+ "pre",
12911
+ {
12912
+ style: {
12913
+ backgroundColor: "var(--color-muted)",
12914
+ color: "var(--color-foreground)",
12915
+ padding: "1rem",
12916
+ borderRadius: "0.5rem",
12917
+ overflow: "auto",
12918
+ margin: 0
12919
+ },
12920
+ children: /* @__PURE__ */ jsx(
12921
+ "code",
12922
+ {
12923
+ ...props,
12924
+ className: codeClassName,
12925
+ style: {
12926
+ fontFamily: "ui-monospace, monospace",
12927
+ fontSize: "0.875em"
12928
+ },
12929
+ children
12930
+ }
12931
+ )
12932
+ }
12933
+ );
12934
+ }
12935
+ return /* @__PURE__ */ jsx(
12936
+ "code",
12937
+ {
12938
+ ...props,
12939
+ className: codeClassName,
12940
+ style: {
12941
+ backgroundColor: "var(--color-muted)",
12942
+ color: "var(--color-foreground)",
12943
+ border: "1px solid var(--color-border)",
12944
+ padding: "0.125rem 0.375rem",
12945
+ borderRadius: "0.25rem",
12946
+ fontSize: "0.875em",
12947
+ fontFamily: "ui-monospace, monospace"
12948
+ },
12949
+ children
12950
+ }
12951
+ );
12952
+ },
12953
+ // Style links
12954
+ a({ href, children, ...props }) {
12955
+ return /* @__PURE__ */ jsx(
12956
+ "a",
12957
+ {
12958
+ href,
12959
+ ...props,
12960
+ className: "text-[var(--color-primary)] hover:underline",
12961
+ target: href?.startsWith("http") ? "_blank" : void 0,
12962
+ rel: href?.startsWith("http") ? "noopener noreferrer" : void 0,
12963
+ children
12964
+ }
12965
+ );
12966
+ },
12967
+ // Style tables
12968
+ table({ children, ...props }) {
12969
+ return /* @__PURE__ */ jsx("div", { className: "overflow-x-auto my-4", children: /* @__PURE__ */ jsx(
12970
+ "table",
12971
+ {
12972
+ ...props,
12973
+ className: "min-w-full border-collapse border border-[var(--color-border)]",
12974
+ children
12975
+ }
12976
+ ) });
12977
+ },
12978
+ th({ children, ...props }) {
12979
+ return /* @__PURE__ */ jsx(
12980
+ "th",
12981
+ {
12982
+ ...props,
12983
+ className: "border border-[var(--color-border)] bg-[var(--color-muted)] px-4 py-2 text-left font-semibold",
12984
+ children
12985
+ }
12986
+ );
12987
+ },
12988
+ td({ children, ...props }) {
12989
+ return /* @__PURE__ */ jsx(
12990
+ "td",
12991
+ {
12992
+ ...props,
12993
+ className: "border border-[var(--color-border)] px-4 py-2",
12994
+ children
12995
+ }
12996
+ );
12997
+ },
12998
+ // Style blockquotes
12999
+ blockquote({ children, ...props }) {
13000
+ return /* @__PURE__ */ jsx(
13001
+ "blockquote",
13002
+ {
13003
+ ...props,
13004
+ className: "border-l-4 border-[var(--color-primary)] pl-4 italic text-[var(--color-foreground)] my-4",
13005
+ children
13006
+ }
13007
+ );
13008
+ }
13009
+ },
13010
+ children: safeContent
13011
+ }
13012
+ )
13013
+ }
13014
+ );
13015
+ },
13016
+ (prev, next) => prev.content === next.content && prev.className === next.className && prev.direction === next.direction
13017
+ );
13018
+ MarkdownContent.displayName = "MarkdownContent";
13019
+ }
13020
+ });
12977
13021
  function useLongPress(onLongPress, options = {}) {
12978
13022
  const { duration = 500, moveThreshold = 10 } = options;
12979
13023
  const timerRef = useRef(null);