@almadar/ui 5.76.5 → 5.76.6

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.
@@ -22654,8 +22654,6 @@ function SimulationCanvas({
22654
22654
  preset: presetProp,
22655
22655
  width = 600,
22656
22656
  height = 400,
22657
- running,
22658
- speed = 1,
22659
22657
  bodies: externalBodies,
22660
22658
  className
22661
22659
  }) {
@@ -22666,59 +22664,6 @@ function SimulationCanvas({
22666
22664
  React114.useEffect(() => {
22667
22665
  bodiesRef.current = structuredClone(preset.bodies);
22668
22666
  }, [preset]);
22669
- const step = React114.useCallback(() => {
22670
- const dt = Math.min(1 / 60 * speed, 1 / 15);
22671
- const gx = preset.gravity?.x ?? 0;
22672
- const gy = preset.gravity?.y ?? 9.81;
22673
- const bodies = bodiesRef.current;
22674
- const maxVel = Math.max(width, height) * 5;
22675
- for (const body of bodies) {
22676
- if (body.fixed) continue;
22677
- body.vx += gx * dt;
22678
- body.vy += gy * dt;
22679
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
22680
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
22681
- body.x += body.vx * dt;
22682
- body.y += body.vy * dt;
22683
- if (body.y + body.radius > height) {
22684
- body.y = height - body.radius;
22685
- body.vy = -body.vy * 0.8;
22686
- }
22687
- if (body.y - body.radius < 0) {
22688
- body.y = body.radius;
22689
- body.vy = -body.vy * 0.8;
22690
- }
22691
- if (body.x + body.radius > width) {
22692
- body.x = width - body.radius;
22693
- body.vx = -body.vx * 0.8;
22694
- }
22695
- if (body.x - body.radius < 0) {
22696
- body.x = body.radius;
22697
- body.vx = -body.vx * 0.8;
22698
- }
22699
- }
22700
- if (preset.constraints) {
22701
- for (const c of preset.constraints) {
22702
- const a = bodies[c.bodyA];
22703
- const b = bodies[c.bodyB];
22704
- if (!a || !b) continue;
22705
- const dx = b.x - a.x;
22706
- const dy = b.y - a.y;
22707
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
22708
- const diff = (dist - c.length) / dist;
22709
- const fx = dx * diff * c.stiffness;
22710
- const fy = dy * diff * c.stiffness;
22711
- if (!a.fixed) {
22712
- a.vx += fx * dt;
22713
- a.vy += fy * dt;
22714
- }
22715
- if (!b.fixed) {
22716
- b.vx -= fx * dt;
22717
- b.vy -= fy * dt;
22718
- }
22719
- }
22720
- }
22721
- }, [preset, width, height, speed]);
22722
22667
  const draw = React114.useCallback(() => {
22723
22668
  const canvas = canvasRef.current;
22724
22669
  if (!canvas) return;
@@ -22820,21 +22765,8 @@ function SimulationCanvas({
22820
22765
  return interp.startLoop(drawInterpolated);
22821
22766
  }, [externalBodies !== void 0, interp.startLoop]);
22822
22767
  React114.useEffect(() => {
22823
- if (externalBodies !== void 0) return;
22824
- if (!running) return;
22825
- let raf;
22826
- const loop = () => {
22827
- step();
22828
- draw();
22829
- raf = requestAnimationFrame(loop);
22830
- };
22831
- raf = requestAnimationFrame(loop);
22832
- return () => cancelAnimationFrame(raf);
22833
- }, [running, step, draw, externalBodies]);
22834
- React114.useEffect(() => {
22835
- if (externalBodies !== void 0) return;
22836
22768
  draw();
22837
- }, [draw, externalBodies]);
22769
+ }, [draw]);
22838
22770
  React114.useEffect(() => {
22839
22771
  if (typeof window === "undefined") return;
22840
22772
  const canvas = canvasRef.current;
@@ -25956,7 +25888,7 @@ function generateDiff(oldVal, newVal) {
25956
25888
  }
25957
25889
  return diff;
25958
25890
  }
25959
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log4, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
25891
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log4, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
25960
25892
  var init_CodeBlock = __esm({
25961
25893
  "components/core/molecules/markdown/CodeBlock.tsx"() {
25962
25894
  init_cn();
@@ -26073,9 +26005,13 @@ var init_CodeBlock = __esm({
26073
26005
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
26074
26006
  DIFF_STYLES = {
26075
26007
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
26008
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
26076
26009
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
26077
- context: { bg: "", prefix: " ", text: "text-foreground" }
26010
+ removed: { bg: "bg-error/10", prefix: "-", text: "text-error" },
26011
+ context: { bg: "", prefix: " ", text: "text-foreground" },
26012
+ unchanged: { bg: "", prefix: " ", text: "text-foreground" }
26078
26013
  };
26014
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
26079
26015
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
26080
26016
  HIDDEN_LINE_NUMBERS = { display: "none" };
26081
26017
  CodeBlock = React114__namespace.default.memo(
@@ -26440,7 +26376,7 @@ var init_CodeBlock = __esm({
26440
26376
  }
26441
26377
  ),
26442
26378
  /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
26443
- const style = DIFF_STYLES[line.type];
26379
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
26444
26380
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
26445
26381
  showLineNumbers && /* @__PURE__ */ jsxRuntime.jsx(
26446
26382
  Typography,
@@ -29107,7 +29043,7 @@ var init_BookTableOfContents = __esm({
29107
29043
  style: { direction },
29108
29044
  children: [
29109
29045
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
29110
- parts.map((part, partIdx) => {
29046
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
29111
29047
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
29112
29048
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
29113
29049
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -43052,7 +42988,7 @@ var init_RichBlockEditor = __esm({
43052
42988
  changeEvent,
43053
42989
  readOnly = false,
43054
42990
  placeholder,
43055
- enableBlocks = false,
42991
+ enableBlocks = true,
43056
42992
  showToolbar = true,
43057
42993
  className
43058
42994
  }) => {
package/dist/avl/index.js CHANGED
@@ -22608,8 +22608,6 @@ function SimulationCanvas({
22608
22608
  preset: presetProp,
22609
22609
  width = 600,
22610
22610
  height = 400,
22611
- running,
22612
- speed = 1,
22613
22611
  bodies: externalBodies,
22614
22612
  className
22615
22613
  }) {
@@ -22620,59 +22618,6 @@ function SimulationCanvas({
22620
22618
  useEffect(() => {
22621
22619
  bodiesRef.current = structuredClone(preset.bodies);
22622
22620
  }, [preset]);
22623
- const step = useCallback(() => {
22624
- const dt = Math.min(1 / 60 * speed, 1 / 15);
22625
- const gx = preset.gravity?.x ?? 0;
22626
- const gy = preset.gravity?.y ?? 9.81;
22627
- const bodies = bodiesRef.current;
22628
- const maxVel = Math.max(width, height) * 5;
22629
- for (const body of bodies) {
22630
- if (body.fixed) continue;
22631
- body.vx += gx * dt;
22632
- body.vy += gy * dt;
22633
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
22634
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
22635
- body.x += body.vx * dt;
22636
- body.y += body.vy * dt;
22637
- if (body.y + body.radius > height) {
22638
- body.y = height - body.radius;
22639
- body.vy = -body.vy * 0.8;
22640
- }
22641
- if (body.y - body.radius < 0) {
22642
- body.y = body.radius;
22643
- body.vy = -body.vy * 0.8;
22644
- }
22645
- if (body.x + body.radius > width) {
22646
- body.x = width - body.radius;
22647
- body.vx = -body.vx * 0.8;
22648
- }
22649
- if (body.x - body.radius < 0) {
22650
- body.x = body.radius;
22651
- body.vx = -body.vx * 0.8;
22652
- }
22653
- }
22654
- if (preset.constraints) {
22655
- for (const c of preset.constraints) {
22656
- const a = bodies[c.bodyA];
22657
- const b = bodies[c.bodyB];
22658
- if (!a || !b) continue;
22659
- const dx = b.x - a.x;
22660
- const dy = b.y - a.y;
22661
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
22662
- const diff = (dist - c.length) / dist;
22663
- const fx = dx * diff * c.stiffness;
22664
- const fy = dy * diff * c.stiffness;
22665
- if (!a.fixed) {
22666
- a.vx += fx * dt;
22667
- a.vy += fy * dt;
22668
- }
22669
- if (!b.fixed) {
22670
- b.vx -= fx * dt;
22671
- b.vy -= fy * dt;
22672
- }
22673
- }
22674
- }
22675
- }, [preset, width, height, speed]);
22676
22621
  const draw = useCallback(() => {
22677
22622
  const canvas = canvasRef.current;
22678
22623
  if (!canvas) return;
@@ -22774,21 +22719,8 @@ function SimulationCanvas({
22774
22719
  return interp.startLoop(drawInterpolated);
22775
22720
  }, [externalBodies !== void 0, interp.startLoop]);
22776
22721
  useEffect(() => {
22777
- if (externalBodies !== void 0) return;
22778
- if (!running) return;
22779
- let raf;
22780
- const loop = () => {
22781
- step();
22782
- draw();
22783
- raf = requestAnimationFrame(loop);
22784
- };
22785
- raf = requestAnimationFrame(loop);
22786
- return () => cancelAnimationFrame(raf);
22787
- }, [running, step, draw, externalBodies]);
22788
- useEffect(() => {
22789
- if (externalBodies !== void 0) return;
22790
22722
  draw();
22791
- }, [draw, externalBodies]);
22723
+ }, [draw]);
22792
22724
  useEffect(() => {
22793
22725
  if (typeof window === "undefined") return;
22794
22726
  const canvas = canvasRef.current;
@@ -25910,7 +25842,7 @@ function generateDiff(oldVal, newVal) {
25910
25842
  }
25911
25843
  return diff;
25912
25844
  }
25913
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log4, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
25845
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log4, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
25914
25846
  var init_CodeBlock = __esm({
25915
25847
  "components/core/molecules/markdown/CodeBlock.tsx"() {
25916
25848
  init_cn();
@@ -26027,9 +25959,13 @@ var init_CodeBlock = __esm({
26027
25959
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
26028
25960
  DIFF_STYLES = {
26029
25961
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
25962
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
26030
25963
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
26031
- context: { bg: "", prefix: " ", text: "text-foreground" }
25964
+ removed: { bg: "bg-error/10", prefix: "-", text: "text-error" },
25965
+ context: { bg: "", prefix: " ", text: "text-foreground" },
25966
+ unchanged: { bg: "", prefix: " ", text: "text-foreground" }
26032
25967
  };
25968
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
26033
25969
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
26034
25970
  HIDDEN_LINE_NUMBERS = { display: "none" };
26035
25971
  CodeBlock = React114__default.memo(
@@ -26394,7 +26330,7 @@ var init_CodeBlock = __esm({
26394
26330
  }
26395
26331
  ),
26396
26332
  /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
26397
- const style = DIFF_STYLES[line.type];
26333
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
26398
26334
  return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
26399
26335
  showLineNumbers && /* @__PURE__ */ jsx(
26400
26336
  Typography,
@@ -29061,7 +28997,7 @@ var init_BookTableOfContents = __esm({
29061
28997
  style: { direction },
29062
28998
  children: [
29063
28999
  /* @__PURE__ */ jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
29064
- parts.map((part, partIdx) => {
29000
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
29065
29001
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
29066
29002
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
29067
29003
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -43006,7 +42942,7 @@ var init_RichBlockEditor = __esm({
43006
42942
  changeEvent,
43007
42943
  readOnly = false,
43008
42944
  placeholder,
43009
- enableBlocks = false,
42945
+ enableBlocks = true,
43010
42946
  showToolbar = true,
43011
42947
  className
43012
42948
  }) => {
@@ -25,7 +25,7 @@ export type CodeLanguage = (typeof CODE_LANGUAGES)[number];
25
25
  export declare function toCodeLanguage(value: string | undefined): CodeLanguage;
26
26
  export type CodeViewerMode = 'code' | 'diff';
27
27
  export interface DiffLine {
28
- type: 'add' | 'remove' | 'context';
28
+ type: 'add' | 'added' | 'remove' | 'removed' | 'context' | 'unchanged';
29
29
  content: string;
30
30
  lineNumber?: number;
31
31
  }
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * SimulationCanvas
3
3
  *
4
- * Self-contained 2D physics canvas for educational presets.
5
- * Runs its own Euler integration loop — no external physics hook needed.
6
- * When `bodies` prop is provided, an external model drives positions at ~30Hz
7
- * and the interpolation bridge smooths them to 60fps.
4
+ * Pure renderer: paints the initial preset bodies and, when the `bodies` prop
5
+ * is provided, interpolates externally-driven snapshots to 60fps.
6
+ * Physics integration is owned by the LOLO animTick this canvas does NOT
7
+ * self-advance positions.
8
8
  */
9
9
  import React from 'react';
10
10
  import type { PhysicsPreset, PhysicsBody } from '../../shared/lib/physicsTypes';
@@ -21,7 +21,7 @@ export interface SimulationCanvasProps {
21
21
  bodies?: readonly Pick<PhysicsBody, 'id' | 'x' | 'y'>[];
22
22
  className?: string;
23
23
  }
24
- export declare function SimulationCanvas({ preset: presetProp, width, height, running, speed, bodies: externalBodies, className, }: SimulationCanvasProps): React.JSX.Element;
24
+ export declare function SimulationCanvas({ preset: presetProp, width, height, bodies: externalBodies, className, }: SimulationCanvasProps): React.JSX.Element;
25
25
  export declare namespace SimulationCanvas {
26
26
  var displayName: string;
27
27
  }
@@ -12710,7 +12710,7 @@ function generateDiff(oldVal, newVal) {
12710
12710
  }
12711
12711
  return diff;
12712
12712
  }
12713
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS; exports.CodeBlock = void 0;
12713
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS; exports.CodeBlock = void 0;
12714
12714
  var init_CodeBlock = __esm({
12715
12715
  "components/core/molecules/markdown/CodeBlock.tsx"() {
12716
12716
  init_cn();
@@ -12827,9 +12827,13 @@ var init_CodeBlock = __esm({
12827
12827
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
12828
12828
  DIFF_STYLES = {
12829
12829
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
12830
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
12830
12831
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
12831
- context: { bg: "", prefix: " ", text: "text-foreground" }
12832
+ removed: { bg: "bg-error/10", prefix: "-", text: "text-error" },
12833
+ context: { bg: "", prefix: " ", text: "text-foreground" },
12834
+ unchanged: { bg: "", prefix: " ", text: "text-foreground" }
12832
12835
  };
12836
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
12833
12837
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12834
12838
  HIDDEN_LINE_NUMBERS = { display: "none" };
12835
12839
  exports.CodeBlock = React80__namespace.default.memo(
@@ -13194,7 +13198,7 @@ var init_CodeBlock = __esm({
13194
13198
  }
13195
13199
  ),
13196
13200
  /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
13197
- const style = DIFF_STYLES[line.type];
13201
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
13198
13202
  return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
13199
13203
  showLineNumbers && /* @__PURE__ */ jsxRuntime.jsx(
13200
13204
  exports.Typography,
@@ -15902,7 +15906,7 @@ var init_BookTableOfContents = __esm({
15902
15906
  style: { direction },
15903
15907
  children: [
15904
15908
  /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
15905
- parts.map((part, partIdx) => {
15909
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
15906
15910
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
15907
15911
  return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "sm", children: [
15908
15912
  /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", align: "center", children: [
@@ -35470,8 +35474,6 @@ function SimulationCanvas({
35470
35474
  preset: presetProp,
35471
35475
  width = 600,
35472
35476
  height = 400,
35473
- running,
35474
- speed = 1,
35475
35477
  bodies: externalBodies,
35476
35478
  className
35477
35479
  }) {
@@ -35482,59 +35484,6 @@ function SimulationCanvas({
35482
35484
  React80.useEffect(() => {
35483
35485
  bodiesRef.current = structuredClone(preset.bodies);
35484
35486
  }, [preset]);
35485
- const step = React80.useCallback(() => {
35486
- const dt = Math.min(1 / 60 * speed, 1 / 15);
35487
- const gx = preset.gravity?.x ?? 0;
35488
- const gy = preset.gravity?.y ?? 9.81;
35489
- const bodies = bodiesRef.current;
35490
- const maxVel = Math.max(width, height) * 5;
35491
- for (const body of bodies) {
35492
- if (body.fixed) continue;
35493
- body.vx += gx * dt;
35494
- body.vy += gy * dt;
35495
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
35496
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
35497
- body.x += body.vx * dt;
35498
- body.y += body.vy * dt;
35499
- if (body.y + body.radius > height) {
35500
- body.y = height - body.radius;
35501
- body.vy = -body.vy * 0.8;
35502
- }
35503
- if (body.y - body.radius < 0) {
35504
- body.y = body.radius;
35505
- body.vy = -body.vy * 0.8;
35506
- }
35507
- if (body.x + body.radius > width) {
35508
- body.x = width - body.radius;
35509
- body.vx = -body.vx * 0.8;
35510
- }
35511
- if (body.x - body.radius < 0) {
35512
- body.x = body.radius;
35513
- body.vx = -body.vx * 0.8;
35514
- }
35515
- }
35516
- if (preset.constraints) {
35517
- for (const c of preset.constraints) {
35518
- const a = bodies[c.bodyA];
35519
- const b = bodies[c.bodyB];
35520
- if (!a || !b) continue;
35521
- const dx = b.x - a.x;
35522
- const dy = b.y - a.y;
35523
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
35524
- const diff = (dist - c.length) / dist;
35525
- const fx = dx * diff * c.stiffness;
35526
- const fy = dy * diff * c.stiffness;
35527
- if (!a.fixed) {
35528
- a.vx += fx * dt;
35529
- a.vy += fy * dt;
35530
- }
35531
- if (!b.fixed) {
35532
- b.vx -= fx * dt;
35533
- b.vy -= fy * dt;
35534
- }
35535
- }
35536
- }
35537
- }, [preset, width, height, speed]);
35538
35487
  const draw = React80.useCallback(() => {
35539
35488
  const canvas = canvasRef.current;
35540
35489
  if (!canvas) return;
@@ -35636,21 +35585,8 @@ function SimulationCanvas({
35636
35585
  return interp.startLoop(drawInterpolated);
35637
35586
  }, [externalBodies !== void 0, interp.startLoop]);
35638
35587
  React80.useEffect(() => {
35639
- if (externalBodies !== void 0) return;
35640
- if (!running) return;
35641
- let raf;
35642
- const loop = () => {
35643
- step();
35644
- draw();
35645
- raf = requestAnimationFrame(loop);
35646
- };
35647
- raf = requestAnimationFrame(loop);
35648
- return () => cancelAnimationFrame(raf);
35649
- }, [running, step, draw, externalBodies]);
35650
- React80.useEffect(() => {
35651
- if (externalBodies !== void 0) return;
35652
35588
  draw();
35653
- }, [draw, externalBodies]);
35589
+ }, [draw]);
35654
35590
  React80.useEffect(() => {
35655
35591
  if (typeof window === "undefined") return;
35656
35592
  const canvas = canvasRef.current;
@@ -42012,7 +41948,7 @@ var init_RichBlockEditor = __esm({
42012
41948
  changeEvent,
42013
41949
  readOnly = false,
42014
41950
  placeholder,
42015
- enableBlocks = false,
41951
+ enableBlocks = true,
42016
41952
  showToolbar = true,
42017
41953
  className
42018
41954
  }) => {
@@ -12664,7 +12664,7 @@ function generateDiff(oldVal, newVal) {
12664
12664
  }
12665
12665
  return diff;
12666
12666
  }
12667
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12667
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
12668
12668
  var init_CodeBlock = __esm({
12669
12669
  "components/core/molecules/markdown/CodeBlock.tsx"() {
12670
12670
  init_cn();
@@ -12781,9 +12781,13 @@ var init_CodeBlock = __esm({
12781
12781
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
12782
12782
  DIFF_STYLES = {
12783
12783
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
12784
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
12784
12785
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
12785
- context: { bg: "", prefix: " ", text: "text-foreground" }
12786
+ removed: { bg: "bg-error/10", prefix: "-", text: "text-error" },
12787
+ context: { bg: "", prefix: " ", text: "text-foreground" },
12788
+ unchanged: { bg: "", prefix: " ", text: "text-foreground" }
12786
12789
  };
12790
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
12787
12791
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
12788
12792
  HIDDEN_LINE_NUMBERS = { display: "none" };
12789
12793
  CodeBlock = React80__default.memo(
@@ -13148,7 +13152,7 @@ var init_CodeBlock = __esm({
13148
13152
  }
13149
13153
  ),
13150
13154
  /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
13151
- const style = DIFF_STYLES[line.type];
13155
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
13152
13156
  return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
13153
13157
  showLineNumbers && /* @__PURE__ */ jsx(
13154
13158
  Typography,
@@ -15856,7 +15860,7 @@ var init_BookTableOfContents = __esm({
15856
15860
  style: { direction },
15857
15861
  children: [
15858
15862
  /* @__PURE__ */ jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
15859
- parts.map((part, partIdx) => {
15863
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
15860
15864
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
15861
15865
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
15862
15866
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -35424,8 +35428,6 @@ function SimulationCanvas({
35424
35428
  preset: presetProp,
35425
35429
  width = 600,
35426
35430
  height = 400,
35427
- running,
35428
- speed = 1,
35429
35431
  bodies: externalBodies,
35430
35432
  className
35431
35433
  }) {
@@ -35436,59 +35438,6 @@ function SimulationCanvas({
35436
35438
  useEffect(() => {
35437
35439
  bodiesRef.current = structuredClone(preset.bodies);
35438
35440
  }, [preset]);
35439
- const step = useCallback(() => {
35440
- const dt = Math.min(1 / 60 * speed, 1 / 15);
35441
- const gx = preset.gravity?.x ?? 0;
35442
- const gy = preset.gravity?.y ?? 9.81;
35443
- const bodies = bodiesRef.current;
35444
- const maxVel = Math.max(width, height) * 5;
35445
- for (const body of bodies) {
35446
- if (body.fixed) continue;
35447
- body.vx += gx * dt;
35448
- body.vy += gy * dt;
35449
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
35450
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
35451
- body.x += body.vx * dt;
35452
- body.y += body.vy * dt;
35453
- if (body.y + body.radius > height) {
35454
- body.y = height - body.radius;
35455
- body.vy = -body.vy * 0.8;
35456
- }
35457
- if (body.y - body.radius < 0) {
35458
- body.y = body.radius;
35459
- body.vy = -body.vy * 0.8;
35460
- }
35461
- if (body.x + body.radius > width) {
35462
- body.x = width - body.radius;
35463
- body.vx = -body.vx * 0.8;
35464
- }
35465
- if (body.x - body.radius < 0) {
35466
- body.x = body.radius;
35467
- body.vx = -body.vx * 0.8;
35468
- }
35469
- }
35470
- if (preset.constraints) {
35471
- for (const c of preset.constraints) {
35472
- const a = bodies[c.bodyA];
35473
- const b = bodies[c.bodyB];
35474
- if (!a || !b) continue;
35475
- const dx = b.x - a.x;
35476
- const dy = b.y - a.y;
35477
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
35478
- const diff = (dist - c.length) / dist;
35479
- const fx = dx * diff * c.stiffness;
35480
- const fy = dy * diff * c.stiffness;
35481
- if (!a.fixed) {
35482
- a.vx += fx * dt;
35483
- a.vy += fy * dt;
35484
- }
35485
- if (!b.fixed) {
35486
- b.vx -= fx * dt;
35487
- b.vy -= fy * dt;
35488
- }
35489
- }
35490
- }
35491
- }, [preset, width, height, speed]);
35492
35441
  const draw = useCallback(() => {
35493
35442
  const canvas = canvasRef.current;
35494
35443
  if (!canvas) return;
@@ -35590,21 +35539,8 @@ function SimulationCanvas({
35590
35539
  return interp.startLoop(drawInterpolated);
35591
35540
  }, [externalBodies !== void 0, interp.startLoop]);
35592
35541
  useEffect(() => {
35593
- if (externalBodies !== void 0) return;
35594
- if (!running) return;
35595
- let raf;
35596
- const loop = () => {
35597
- step();
35598
- draw();
35599
- raf = requestAnimationFrame(loop);
35600
- };
35601
- raf = requestAnimationFrame(loop);
35602
- return () => cancelAnimationFrame(raf);
35603
- }, [running, step, draw, externalBodies]);
35604
- useEffect(() => {
35605
- if (externalBodies !== void 0) return;
35606
35542
  draw();
35607
- }, [draw, externalBodies]);
35543
+ }, [draw]);
35608
35544
  useEffect(() => {
35609
35545
  if (typeof window === "undefined") return;
35610
35546
  const canvas = canvasRef.current;
@@ -41966,7 +41902,7 @@ var init_RichBlockEditor = __esm({
41966
41902
  changeEvent,
41967
41903
  readOnly = false,
41968
41904
  placeholder,
41969
- enableBlocks = false,
41905
+ enableBlocks = true,
41970
41906
  showToolbar = true,
41971
41907
  className
41972
41908
  }) => {
@@ -18899,8 +18899,6 @@ function SimulationCanvas({
18899
18899
  preset: presetProp,
18900
18900
  width = 600,
18901
18901
  height = 400,
18902
- running,
18903
- speed = 1,
18904
18902
  bodies: externalBodies,
18905
18903
  className
18906
18904
  }) {
@@ -18911,59 +18909,6 @@ function SimulationCanvas({
18911
18909
  React107.useEffect(() => {
18912
18910
  bodiesRef.current = structuredClone(preset.bodies);
18913
18911
  }, [preset]);
18914
- const step = React107.useCallback(() => {
18915
- const dt = Math.min(1 / 60 * speed, 1 / 15);
18916
- const gx = preset.gravity?.x ?? 0;
18917
- const gy = preset.gravity?.y ?? 9.81;
18918
- const bodies = bodiesRef.current;
18919
- const maxVel = Math.max(width, height) * 5;
18920
- for (const body of bodies) {
18921
- if (body.fixed) continue;
18922
- body.vx += gx * dt;
18923
- body.vy += gy * dt;
18924
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
18925
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
18926
- body.x += body.vx * dt;
18927
- body.y += body.vy * dt;
18928
- if (body.y + body.radius > height) {
18929
- body.y = height - body.radius;
18930
- body.vy = -body.vy * 0.8;
18931
- }
18932
- if (body.y - body.radius < 0) {
18933
- body.y = body.radius;
18934
- body.vy = -body.vy * 0.8;
18935
- }
18936
- if (body.x + body.radius > width) {
18937
- body.x = width - body.radius;
18938
- body.vx = -body.vx * 0.8;
18939
- }
18940
- if (body.x - body.radius < 0) {
18941
- body.x = body.radius;
18942
- body.vx = -body.vx * 0.8;
18943
- }
18944
- }
18945
- if (preset.constraints) {
18946
- for (const c of preset.constraints) {
18947
- const a = bodies[c.bodyA];
18948
- const b = bodies[c.bodyB];
18949
- if (!a || !b) continue;
18950
- const dx = b.x - a.x;
18951
- const dy = b.y - a.y;
18952
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
18953
- const diff = (dist - c.length) / dist;
18954
- const fx = dx * diff * c.stiffness;
18955
- const fy = dy * diff * c.stiffness;
18956
- if (!a.fixed) {
18957
- a.vx += fx * dt;
18958
- a.vy += fy * dt;
18959
- }
18960
- if (!b.fixed) {
18961
- b.vx -= fx * dt;
18962
- b.vy -= fy * dt;
18963
- }
18964
- }
18965
- }
18966
- }, [preset, width, height, speed]);
18967
18912
  const draw = React107.useCallback(() => {
18968
18913
  const canvas = canvasRef.current;
18969
18914
  if (!canvas) return;
@@ -19065,21 +19010,8 @@ function SimulationCanvas({
19065
19010
  return interp.startLoop(drawInterpolated);
19066
19011
  }, [externalBodies !== void 0, interp.startLoop]);
19067
19012
  React107.useEffect(() => {
19068
- if (externalBodies !== void 0) return;
19069
- if (!running) return;
19070
- let raf;
19071
- const loop = () => {
19072
- step();
19073
- draw();
19074
- raf = requestAnimationFrame(loop);
19075
- };
19076
- raf = requestAnimationFrame(loop);
19077
- return () => cancelAnimationFrame(raf);
19078
- }, [running, step, draw, externalBodies]);
19079
- React107.useEffect(() => {
19080
- if (externalBodies !== void 0) return;
19081
19013
  draw();
19082
- }, [draw, externalBodies]);
19014
+ }, [draw]);
19083
19015
  React107.useEffect(() => {
19084
19016
  if (typeof window === "undefined") return;
19085
19017
  const canvas = canvasRef.current;
@@ -23411,7 +23343,7 @@ function generateDiff(oldVal, newVal) {
23411
23343
  }
23412
23344
  return diff;
23413
23345
  }
23414
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
23346
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
23415
23347
  var init_CodeBlock = __esm({
23416
23348
  "components/core/molecules/markdown/CodeBlock.tsx"() {
23417
23349
  init_cn();
@@ -23528,9 +23460,13 @@ var init_CodeBlock = __esm({
23528
23460
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
23529
23461
  DIFF_STYLES = {
23530
23462
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23463
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23531
23464
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23532
- context: { bg: "", prefix: " ", text: "text-foreground" }
23465
+ removed: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23466
+ context: { bg: "", prefix: " ", text: "text-foreground" },
23467
+ unchanged: { bg: "", prefix: " ", text: "text-foreground" }
23533
23468
  };
23469
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
23534
23470
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
23535
23471
  HIDDEN_LINE_NUMBERS = { display: "none" };
23536
23472
  CodeBlock = React107__namespace.default.memo(
@@ -23895,7 +23831,7 @@ var init_CodeBlock = __esm({
23895
23831
  }
23896
23832
  ),
23897
23833
  /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
23898
- const style = DIFF_STYLES[line.type];
23834
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
23899
23835
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
23900
23836
  showLineNumbers && /* @__PURE__ */ jsxRuntime.jsx(
23901
23837
  Typography,
@@ -26562,7 +26498,7 @@ var init_BookTableOfContents = __esm({
26562
26498
  style: { direction },
26563
26499
  children: [
26564
26500
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
26565
- parts.map((part, partIdx) => {
26501
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
26566
26502
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
26567
26503
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
26568
26504
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -40507,7 +40443,7 @@ var init_RichBlockEditor = __esm({
40507
40443
  changeEvent,
40508
40444
  readOnly = false,
40509
40445
  placeholder,
40510
- enableBlocks = false,
40446
+ enableBlocks = true,
40511
40447
  showToolbar = true,
40512
40448
  className
40513
40449
  }) => {
@@ -18854,8 +18854,6 @@ function SimulationCanvas({
18854
18854
  preset: presetProp,
18855
18855
  width = 600,
18856
18856
  height = 400,
18857
- running,
18858
- speed = 1,
18859
18857
  bodies: externalBodies,
18860
18858
  className
18861
18859
  }) {
@@ -18866,59 +18864,6 @@ function SimulationCanvas({
18866
18864
  useEffect(() => {
18867
18865
  bodiesRef.current = structuredClone(preset.bodies);
18868
18866
  }, [preset]);
18869
- const step = useCallback(() => {
18870
- const dt = Math.min(1 / 60 * speed, 1 / 15);
18871
- const gx = preset.gravity?.x ?? 0;
18872
- const gy = preset.gravity?.y ?? 9.81;
18873
- const bodies = bodiesRef.current;
18874
- const maxVel = Math.max(width, height) * 5;
18875
- for (const body of bodies) {
18876
- if (body.fixed) continue;
18877
- body.vx += gx * dt;
18878
- body.vy += gy * dt;
18879
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
18880
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
18881
- body.x += body.vx * dt;
18882
- body.y += body.vy * dt;
18883
- if (body.y + body.radius > height) {
18884
- body.y = height - body.radius;
18885
- body.vy = -body.vy * 0.8;
18886
- }
18887
- if (body.y - body.radius < 0) {
18888
- body.y = body.radius;
18889
- body.vy = -body.vy * 0.8;
18890
- }
18891
- if (body.x + body.radius > width) {
18892
- body.x = width - body.radius;
18893
- body.vx = -body.vx * 0.8;
18894
- }
18895
- if (body.x - body.radius < 0) {
18896
- body.x = body.radius;
18897
- body.vx = -body.vx * 0.8;
18898
- }
18899
- }
18900
- if (preset.constraints) {
18901
- for (const c of preset.constraints) {
18902
- const a = bodies[c.bodyA];
18903
- const b = bodies[c.bodyB];
18904
- if (!a || !b) continue;
18905
- const dx = b.x - a.x;
18906
- const dy = b.y - a.y;
18907
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
18908
- const diff = (dist - c.length) / dist;
18909
- const fx = dx * diff * c.stiffness;
18910
- const fy = dy * diff * c.stiffness;
18911
- if (!a.fixed) {
18912
- a.vx += fx * dt;
18913
- a.vy += fy * dt;
18914
- }
18915
- if (!b.fixed) {
18916
- b.vx -= fx * dt;
18917
- b.vy -= fy * dt;
18918
- }
18919
- }
18920
- }
18921
- }, [preset, width, height, speed]);
18922
18867
  const draw = useCallback(() => {
18923
18868
  const canvas = canvasRef.current;
18924
18869
  if (!canvas) return;
@@ -19020,21 +18965,8 @@ function SimulationCanvas({
19020
18965
  return interp.startLoop(drawInterpolated);
19021
18966
  }, [externalBodies !== void 0, interp.startLoop]);
19022
18967
  useEffect(() => {
19023
- if (externalBodies !== void 0) return;
19024
- if (!running) return;
19025
- let raf;
19026
- const loop = () => {
19027
- step();
19028
- draw();
19029
- raf = requestAnimationFrame(loop);
19030
- };
19031
- raf = requestAnimationFrame(loop);
19032
- return () => cancelAnimationFrame(raf);
19033
- }, [running, step, draw, externalBodies]);
19034
- useEffect(() => {
19035
- if (externalBodies !== void 0) return;
19036
18968
  draw();
19037
- }, [draw, externalBodies]);
18969
+ }, [draw]);
19038
18970
  useEffect(() => {
19039
18971
  if (typeof window === "undefined") return;
19040
18972
  const canvas = canvasRef.current;
@@ -23366,7 +23298,7 @@ function generateDiff(oldVal, newVal) {
23366
23298
  }
23367
23299
  return diff;
23368
23300
  }
23369
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
23301
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log7, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
23370
23302
  var init_CodeBlock = __esm({
23371
23303
  "components/core/molecules/markdown/CodeBlock.tsx"() {
23372
23304
  init_cn();
@@ -23483,9 +23415,13 @@ var init_CodeBlock = __esm({
23483
23415
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
23484
23416
  DIFF_STYLES = {
23485
23417
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23418
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23486
23419
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23487
- context: { bg: "", prefix: " ", text: "text-foreground" }
23420
+ removed: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23421
+ context: { bg: "", prefix: " ", text: "text-foreground" },
23422
+ unchanged: { bg: "", prefix: " ", text: "text-foreground" }
23488
23423
  };
23424
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
23489
23425
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
23490
23426
  HIDDEN_LINE_NUMBERS = { display: "none" };
23491
23427
  CodeBlock = React107__default.memo(
@@ -23850,7 +23786,7 @@ var init_CodeBlock = __esm({
23850
23786
  }
23851
23787
  ),
23852
23788
  /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
23853
- const style = DIFF_STYLES[line.type];
23789
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
23854
23790
  return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
23855
23791
  showLineNumbers && /* @__PURE__ */ jsx(
23856
23792
  Typography,
@@ -26517,7 +26453,7 @@ var init_BookTableOfContents = __esm({
26517
26453
  style: { direction },
26518
26454
  children: [
26519
26455
  /* @__PURE__ */ jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
26520
- parts.map((part, partIdx) => {
26456
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
26521
26457
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
26522
26458
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
26523
26459
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -40462,7 +40398,7 @@ var init_RichBlockEditor = __esm({
40462
40398
  changeEvent,
40463
40399
  readOnly = false,
40464
40400
  placeholder,
40465
- enableBlocks = false,
40401
+ enableBlocks = true,
40466
40402
  showToolbar = true,
40467
40403
  className
40468
40404
  }) => {
@@ -19246,8 +19246,6 @@ function SimulationCanvas({
19246
19246
  preset: presetProp,
19247
19247
  width = 600,
19248
19248
  height = 400,
19249
- running,
19250
- speed = 1,
19251
19249
  bodies: externalBodies,
19252
19250
  className
19253
19251
  }) {
@@ -19258,59 +19256,6 @@ function SimulationCanvas({
19258
19256
  React105.useEffect(() => {
19259
19257
  bodiesRef.current = structuredClone(preset.bodies);
19260
19258
  }, [preset]);
19261
- const step = React105.useCallback(() => {
19262
- const dt = Math.min(1 / 60 * speed, 1 / 15);
19263
- const gx = preset.gravity?.x ?? 0;
19264
- const gy = preset.gravity?.y ?? 9.81;
19265
- const bodies = bodiesRef.current;
19266
- const maxVel = Math.max(width, height) * 5;
19267
- for (const body of bodies) {
19268
- if (body.fixed) continue;
19269
- body.vx += gx * dt;
19270
- body.vy += gy * dt;
19271
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
19272
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
19273
- body.x += body.vx * dt;
19274
- body.y += body.vy * dt;
19275
- if (body.y + body.radius > height) {
19276
- body.y = height - body.radius;
19277
- body.vy = -body.vy * 0.8;
19278
- }
19279
- if (body.y - body.radius < 0) {
19280
- body.y = body.radius;
19281
- body.vy = -body.vy * 0.8;
19282
- }
19283
- if (body.x + body.radius > width) {
19284
- body.x = width - body.radius;
19285
- body.vx = -body.vx * 0.8;
19286
- }
19287
- if (body.x - body.radius < 0) {
19288
- body.x = body.radius;
19289
- body.vx = -body.vx * 0.8;
19290
- }
19291
- }
19292
- if (preset.constraints) {
19293
- for (const c of preset.constraints) {
19294
- const a = bodies[c.bodyA];
19295
- const b = bodies[c.bodyB];
19296
- if (!a || !b) continue;
19297
- const dx = b.x - a.x;
19298
- const dy = b.y - a.y;
19299
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
19300
- const diff = (dist - c.length) / dist;
19301
- const fx = dx * diff * c.stiffness;
19302
- const fy = dy * diff * c.stiffness;
19303
- if (!a.fixed) {
19304
- a.vx += fx * dt;
19305
- a.vy += fy * dt;
19306
- }
19307
- if (!b.fixed) {
19308
- b.vx -= fx * dt;
19309
- b.vy -= fy * dt;
19310
- }
19311
- }
19312
- }
19313
- }, [preset, width, height, speed]);
19314
19259
  const draw = React105.useCallback(() => {
19315
19260
  const canvas = canvasRef.current;
19316
19261
  if (!canvas) return;
@@ -19412,21 +19357,8 @@ function SimulationCanvas({
19412
19357
  return interp.startLoop(drawInterpolated);
19413
19358
  }, [externalBodies !== void 0, interp.startLoop]);
19414
19359
  React105.useEffect(() => {
19415
- if (externalBodies !== void 0) return;
19416
- if (!running) return;
19417
- let raf;
19418
- const loop = () => {
19419
- step();
19420
- draw();
19421
- raf = requestAnimationFrame(loop);
19422
- };
19423
- raf = requestAnimationFrame(loop);
19424
- return () => cancelAnimationFrame(raf);
19425
- }, [running, step, draw, externalBodies]);
19426
- React105.useEffect(() => {
19427
- if (externalBodies !== void 0) return;
19428
19360
  draw();
19429
- }, [draw, externalBodies]);
19361
+ }, [draw]);
19430
19362
  React105.useEffect(() => {
19431
19363
  if (typeof window === "undefined") return;
19432
19364
  const canvas = canvasRef.current;
@@ -23375,7 +23307,7 @@ function generateDiff(oldVal, newVal) {
23375
23307
  }
23376
23308
  return diff;
23377
23309
  }
23378
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
23310
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
23379
23311
  var init_CodeBlock = __esm({
23380
23312
  "components/core/molecules/markdown/CodeBlock.tsx"() {
23381
23313
  init_cn();
@@ -23492,9 +23424,13 @@ var init_CodeBlock = __esm({
23492
23424
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
23493
23425
  DIFF_STYLES = {
23494
23426
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23427
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23495
23428
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23496
- context: { bg: "", prefix: " ", text: "text-foreground" }
23429
+ removed: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23430
+ context: { bg: "", prefix: " ", text: "text-foreground" },
23431
+ unchanged: { bg: "", prefix: " ", text: "text-foreground" }
23497
23432
  };
23433
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
23498
23434
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
23499
23435
  HIDDEN_LINE_NUMBERS = { display: "none" };
23500
23436
  CodeBlock = React105__namespace.default.memo(
@@ -23859,7 +23795,7 @@ var init_CodeBlock = __esm({
23859
23795
  }
23860
23796
  ),
23861
23797
  /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
23862
- const style = DIFF_STYLES[line.type];
23798
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
23863
23799
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
23864
23800
  showLineNumbers && /* @__PURE__ */ jsxRuntime.jsx(
23865
23801
  Typography,
@@ -26476,7 +26412,7 @@ var init_BookTableOfContents = __esm({
26476
26412
  style: { direction },
26477
26413
  children: [
26478
26414
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
26479
- parts.map((part, partIdx) => {
26415
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
26480
26416
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
26481
26417
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
26482
26418
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -40138,7 +40074,7 @@ var init_RichBlockEditor = __esm({
40138
40074
  changeEvent,
40139
40075
  readOnly = false,
40140
40076
  placeholder,
40141
- enableBlocks = false,
40077
+ enableBlocks = true,
40142
40078
  showToolbar = true,
40143
40079
  className
40144
40080
  }) => {
@@ -19201,8 +19201,6 @@ function SimulationCanvas({
19201
19201
  preset: presetProp,
19202
19202
  width = 600,
19203
19203
  height = 400,
19204
- running,
19205
- speed = 1,
19206
19204
  bodies: externalBodies,
19207
19205
  className
19208
19206
  }) {
@@ -19213,59 +19211,6 @@ function SimulationCanvas({
19213
19211
  useEffect(() => {
19214
19212
  bodiesRef.current = structuredClone(preset.bodies);
19215
19213
  }, [preset]);
19216
- const step = useCallback(() => {
19217
- const dt = Math.min(1 / 60 * speed, 1 / 15);
19218
- const gx = preset.gravity?.x ?? 0;
19219
- const gy = preset.gravity?.y ?? 9.81;
19220
- const bodies = bodiesRef.current;
19221
- const maxVel = Math.max(width, height) * 5;
19222
- for (const body of bodies) {
19223
- if (body.fixed) continue;
19224
- body.vx += gx * dt;
19225
- body.vy += gy * dt;
19226
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
19227
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
19228
- body.x += body.vx * dt;
19229
- body.y += body.vy * dt;
19230
- if (body.y + body.radius > height) {
19231
- body.y = height - body.radius;
19232
- body.vy = -body.vy * 0.8;
19233
- }
19234
- if (body.y - body.radius < 0) {
19235
- body.y = body.radius;
19236
- body.vy = -body.vy * 0.8;
19237
- }
19238
- if (body.x + body.radius > width) {
19239
- body.x = width - body.radius;
19240
- body.vx = -body.vx * 0.8;
19241
- }
19242
- if (body.x - body.radius < 0) {
19243
- body.x = body.radius;
19244
- body.vx = -body.vx * 0.8;
19245
- }
19246
- }
19247
- if (preset.constraints) {
19248
- for (const c of preset.constraints) {
19249
- const a = bodies[c.bodyA];
19250
- const b = bodies[c.bodyB];
19251
- if (!a || !b) continue;
19252
- const dx = b.x - a.x;
19253
- const dy = b.y - a.y;
19254
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
19255
- const diff = (dist - c.length) / dist;
19256
- const fx = dx * diff * c.stiffness;
19257
- const fy = dy * diff * c.stiffness;
19258
- if (!a.fixed) {
19259
- a.vx += fx * dt;
19260
- a.vy += fy * dt;
19261
- }
19262
- if (!b.fixed) {
19263
- b.vx -= fx * dt;
19264
- b.vy -= fy * dt;
19265
- }
19266
- }
19267
- }
19268
- }, [preset, width, height, speed]);
19269
19214
  const draw = useCallback(() => {
19270
19215
  const canvas = canvasRef.current;
19271
19216
  if (!canvas) return;
@@ -19367,21 +19312,8 @@ function SimulationCanvas({
19367
19312
  return interp.startLoop(drawInterpolated);
19368
19313
  }, [externalBodies !== void 0, interp.startLoop]);
19369
19314
  useEffect(() => {
19370
- if (externalBodies !== void 0) return;
19371
- if (!running) return;
19372
- let raf;
19373
- const loop = () => {
19374
- step();
19375
- draw();
19376
- raf = requestAnimationFrame(loop);
19377
- };
19378
- raf = requestAnimationFrame(loop);
19379
- return () => cancelAnimationFrame(raf);
19380
- }, [running, step, draw, externalBodies]);
19381
- useEffect(() => {
19382
- if (externalBodies !== void 0) return;
19383
19315
  draw();
19384
- }, [draw, externalBodies]);
19316
+ }, [draw]);
19385
19317
  useEffect(() => {
19386
19318
  if (typeof window === "undefined") return;
19387
19319
  const canvas = canvasRef.current;
@@ -23330,7 +23262,7 @@ function generateDiff(oldVal, newVal) {
23330
23262
  }
23331
23263
  return diff;
23332
23264
  }
23333
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
23265
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log5, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, DIFF_STYLE_FALLBACK, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
23334
23266
  var init_CodeBlock = __esm({
23335
23267
  "components/core/molecules/markdown/CodeBlock.tsx"() {
23336
23268
  init_cn();
@@ -23447,9 +23379,13 @@ var init_CodeBlock = __esm({
23447
23379
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
23448
23380
  DIFF_STYLES = {
23449
23381
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23382
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23450
23383
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23451
- context: { bg: "", prefix: " ", text: "text-foreground" }
23384
+ removed: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23385
+ context: { bg: "", prefix: " ", text: "text-foreground" },
23386
+ unchanged: { bg: "", prefix: " ", text: "text-foreground" }
23452
23387
  };
23388
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
23453
23389
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
23454
23390
  HIDDEN_LINE_NUMBERS = { display: "none" };
23455
23391
  CodeBlock = React105__default.memo(
@@ -23814,7 +23750,7 @@ var init_CodeBlock = __esm({
23814
23750
  }
23815
23751
  ),
23816
23752
  /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
23817
- const style = DIFF_STYLES[line.type];
23753
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
23818
23754
  return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
23819
23755
  showLineNumbers && /* @__PURE__ */ jsx(
23820
23756
  Typography,
@@ -26431,7 +26367,7 @@ var init_BookTableOfContents = __esm({
26431
26367
  style: { direction },
26432
26368
  children: [
26433
26369
  /* @__PURE__ */ jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
26434
- parts.map((part, partIdx) => {
26370
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
26435
26371
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
26436
26372
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
26437
26373
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -40093,7 +40029,7 @@ var init_RichBlockEditor = __esm({
40093
40029
  changeEvent,
40094
40030
  readOnly = false,
40095
40031
  placeholder,
40096
- enableBlocks = false,
40032
+ enableBlocks = true,
40097
40033
  showToolbar = true,
40098
40034
  className
40099
40035
  }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.76.5",
3
+ "version": "5.76.6",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [