@almadar/ui 5.76.4 → 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.
@@ -1169,14 +1169,17 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
1169
1169
  Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
1170
1170
  return Wrapped;
1171
1171
  }
1172
+ function isComponentLike(v) {
1173
+ return v != null && (typeof v === "function" || typeof v === "object");
1174
+ }
1172
1175
  function resolveLucide(name) {
1173
1176
  if (lucideAliases[name]) return lucideAliases[name];
1174
1177
  const pascal = kebabToPascal(name);
1175
1178
  const lucideMap = LucideIcons2__namespace;
1176
1179
  const direct = lucideMap[pascal];
1177
- if (direct && typeof direct === "function") return direct;
1180
+ if (isComponentLike(direct)) return direct;
1178
1181
  const asIs = lucideMap[name];
1179
- if (asIs && typeof asIs === "function") return asIs;
1182
+ if (isComponentLike(asIs)) return asIs;
1180
1183
  return LucideIcons2__namespace.HelpCircle;
1181
1184
  }
1182
1185
  function resolvePhosphor(name, weight, family) {
@@ -1820,12 +1823,13 @@ function resolveIcon(name) {
1820
1823
  }
1821
1824
  function doResolve(name) {
1822
1825
  if (iconAliases[name]) return iconAliases[name];
1826
+ const isComponentLike2 = (v) => v != null && (typeof v === "function" || typeof v === "object");
1823
1827
  const pascalName = kebabToPascal2(name);
1824
1828
  const lucideMap = LucideIcons2__namespace;
1825
1829
  const directLookup = lucideMap[pascalName];
1826
- if (directLookup && typeof directLookup === "object") return directLookup;
1830
+ if (isComponentLike2(directLookup)) return directLookup;
1827
1831
  const asIs = lucideMap[name];
1828
- if (asIs && typeof asIs === "object") return asIs;
1832
+ if (isComponentLike2(asIs)) return asIs;
1829
1833
  return LucideIcons2__namespace.HelpCircle;
1830
1834
  }
1831
1835
  var colorTokenClasses, iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
@@ -19242,8 +19246,6 @@ function SimulationCanvas({
19242
19246
  preset: presetProp,
19243
19247
  width = 600,
19244
19248
  height = 400,
19245
- running,
19246
- speed = 1,
19247
19249
  bodies: externalBodies,
19248
19250
  className
19249
19251
  }) {
@@ -19254,59 +19256,6 @@ function SimulationCanvas({
19254
19256
  React105.useEffect(() => {
19255
19257
  bodiesRef.current = structuredClone(preset.bodies);
19256
19258
  }, [preset]);
19257
- const step = React105.useCallback(() => {
19258
- const dt = Math.min(1 / 60 * speed, 1 / 15);
19259
- const gx = preset.gravity?.x ?? 0;
19260
- const gy = preset.gravity?.y ?? 9.81;
19261
- const bodies = bodiesRef.current;
19262
- const maxVel = Math.max(width, height) * 5;
19263
- for (const body of bodies) {
19264
- if (body.fixed) continue;
19265
- body.vx += gx * dt;
19266
- body.vy += gy * dt;
19267
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
19268
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
19269
- body.x += body.vx * dt;
19270
- body.y += body.vy * dt;
19271
- if (body.y + body.radius > height) {
19272
- body.y = height - body.radius;
19273
- body.vy = -body.vy * 0.8;
19274
- }
19275
- if (body.y - body.radius < 0) {
19276
- body.y = body.radius;
19277
- body.vy = -body.vy * 0.8;
19278
- }
19279
- if (body.x + body.radius > width) {
19280
- body.x = width - body.radius;
19281
- body.vx = -body.vx * 0.8;
19282
- }
19283
- if (body.x - body.radius < 0) {
19284
- body.x = body.radius;
19285
- body.vx = -body.vx * 0.8;
19286
- }
19287
- }
19288
- if (preset.constraints) {
19289
- for (const c of preset.constraints) {
19290
- const a = bodies[c.bodyA];
19291
- const b = bodies[c.bodyB];
19292
- if (!a || !b) continue;
19293
- const dx = b.x - a.x;
19294
- const dy = b.y - a.y;
19295
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
19296
- const diff = (dist - c.length) / dist;
19297
- const fx = dx * diff * c.stiffness;
19298
- const fy = dy * diff * c.stiffness;
19299
- if (!a.fixed) {
19300
- a.vx += fx * dt;
19301
- a.vy += fy * dt;
19302
- }
19303
- if (!b.fixed) {
19304
- b.vx -= fx * dt;
19305
- b.vy -= fy * dt;
19306
- }
19307
- }
19308
- }
19309
- }, [preset, width, height, speed]);
19310
19259
  const draw = React105.useCallback(() => {
19311
19260
  const canvas = canvasRef.current;
19312
19261
  if (!canvas) return;
@@ -19408,21 +19357,8 @@ function SimulationCanvas({
19408
19357
  return interp.startLoop(drawInterpolated);
19409
19358
  }, [externalBodies !== void 0, interp.startLoop]);
19410
19359
  React105.useEffect(() => {
19411
- if (externalBodies !== void 0) return;
19412
- if (!running) return;
19413
- let raf;
19414
- const loop = () => {
19415
- step();
19416
- draw();
19417
- raf = requestAnimationFrame(loop);
19418
- };
19419
- raf = requestAnimationFrame(loop);
19420
- return () => cancelAnimationFrame(raf);
19421
- }, [running, step, draw, externalBodies]);
19422
- React105.useEffect(() => {
19423
- if (externalBodies !== void 0) return;
19424
19360
  draw();
19425
- }, [draw, externalBodies]);
19361
+ }, [draw]);
19426
19362
  React105.useEffect(() => {
19427
19363
  if (typeof window === "undefined") return;
19428
19364
  const canvas = canvasRef.current;
@@ -23371,7 +23307,7 @@ function generateDiff(oldVal, newVal) {
23371
23307
  }
23372
23308
  return diff;
23373
23309
  }
23374
- 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;
23375
23311
  var init_CodeBlock = __esm({
23376
23312
  "components/core/molecules/markdown/CodeBlock.tsx"() {
23377
23313
  init_cn();
@@ -23488,9 +23424,13 @@ var init_CodeBlock = __esm({
23488
23424
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
23489
23425
  DIFF_STYLES = {
23490
23426
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23427
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23491
23428
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23492
- 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" }
23493
23432
  };
23433
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
23494
23434
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
23495
23435
  HIDDEN_LINE_NUMBERS = { display: "none" };
23496
23436
  CodeBlock = React105__namespace.default.memo(
@@ -23855,7 +23795,7 @@ var init_CodeBlock = __esm({
23855
23795
  }
23856
23796
  ),
23857
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) => {
23858
- const style = DIFF_STYLES[line.type];
23798
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
23859
23799
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
23860
23800
  showLineNumbers && /* @__PURE__ */ jsxRuntime.jsx(
23861
23801
  Typography,
@@ -26472,7 +26412,7 @@ var init_BookTableOfContents = __esm({
26472
26412
  style: { direction },
26473
26413
  children: [
26474
26414
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
26475
- parts.map((part, partIdx) => {
26415
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
26476
26416
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
26477
26417
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
26478
26418
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -40134,7 +40074,7 @@ var init_RichBlockEditor = __esm({
40134
40074
  changeEvent,
40135
40075
  readOnly = false,
40136
40076
  placeholder,
40137
- enableBlocks = false,
40077
+ enableBlocks = true,
40138
40078
  showToolbar = true,
40139
40079
  className
40140
40080
  }) => {
@@ -1124,14 +1124,17 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
1124
1124
  Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
1125
1125
  return Wrapped;
1126
1126
  }
1127
+ function isComponentLike(v) {
1128
+ return v != null && (typeof v === "function" || typeof v === "object");
1129
+ }
1127
1130
  function resolveLucide(name) {
1128
1131
  if (lucideAliases[name]) return lucideAliases[name];
1129
1132
  const pascal = kebabToPascal(name);
1130
1133
  const lucideMap = LucideIcons2;
1131
1134
  const direct = lucideMap[pascal];
1132
- if (direct && typeof direct === "function") return direct;
1135
+ if (isComponentLike(direct)) return direct;
1133
1136
  const asIs = lucideMap[name];
1134
- if (asIs && typeof asIs === "function") return asIs;
1137
+ if (isComponentLike(asIs)) return asIs;
1135
1138
  return LucideIcons2.HelpCircle;
1136
1139
  }
1137
1140
  function resolvePhosphor(name, weight, family) {
@@ -1775,12 +1778,13 @@ function resolveIcon(name) {
1775
1778
  }
1776
1779
  function doResolve(name) {
1777
1780
  if (iconAliases[name]) return iconAliases[name];
1781
+ const isComponentLike2 = (v) => v != null && (typeof v === "function" || typeof v === "object");
1778
1782
  const pascalName = kebabToPascal2(name);
1779
1783
  const lucideMap = LucideIcons2;
1780
1784
  const directLookup = lucideMap[pascalName];
1781
- if (directLookup && typeof directLookup === "object") return directLookup;
1785
+ if (isComponentLike2(directLookup)) return directLookup;
1782
1786
  const asIs = lucideMap[name];
1783
- if (asIs && typeof asIs === "object") return asIs;
1787
+ if (isComponentLike2(asIs)) return asIs;
1784
1788
  return LucideIcons2.HelpCircle;
1785
1789
  }
1786
1790
  var colorTokenClasses, iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
@@ -19197,8 +19201,6 @@ function SimulationCanvas({
19197
19201
  preset: presetProp,
19198
19202
  width = 600,
19199
19203
  height = 400,
19200
- running,
19201
- speed = 1,
19202
19204
  bodies: externalBodies,
19203
19205
  className
19204
19206
  }) {
@@ -19209,59 +19211,6 @@ function SimulationCanvas({
19209
19211
  useEffect(() => {
19210
19212
  bodiesRef.current = structuredClone(preset.bodies);
19211
19213
  }, [preset]);
19212
- const step = useCallback(() => {
19213
- const dt = Math.min(1 / 60 * speed, 1 / 15);
19214
- const gx = preset.gravity?.x ?? 0;
19215
- const gy = preset.gravity?.y ?? 9.81;
19216
- const bodies = bodiesRef.current;
19217
- const maxVel = Math.max(width, height) * 5;
19218
- for (const body of bodies) {
19219
- if (body.fixed) continue;
19220
- body.vx += gx * dt;
19221
- body.vy += gy * dt;
19222
- body.vx = Math.max(-maxVel, Math.min(maxVel, body.vx));
19223
- body.vy = Math.max(-maxVel, Math.min(maxVel, body.vy));
19224
- body.x += body.vx * dt;
19225
- body.y += body.vy * dt;
19226
- if (body.y + body.radius > height) {
19227
- body.y = height - body.radius;
19228
- body.vy = -body.vy * 0.8;
19229
- }
19230
- if (body.y - body.radius < 0) {
19231
- body.y = body.radius;
19232
- body.vy = -body.vy * 0.8;
19233
- }
19234
- if (body.x + body.radius > width) {
19235
- body.x = width - body.radius;
19236
- body.vx = -body.vx * 0.8;
19237
- }
19238
- if (body.x - body.radius < 0) {
19239
- body.x = body.radius;
19240
- body.vx = -body.vx * 0.8;
19241
- }
19242
- }
19243
- if (preset.constraints) {
19244
- for (const c of preset.constraints) {
19245
- const a = bodies[c.bodyA];
19246
- const b = bodies[c.bodyB];
19247
- if (!a || !b) continue;
19248
- const dx = b.x - a.x;
19249
- const dy = b.y - a.y;
19250
- const dist = Math.sqrt(dx * dx + dy * dy) || 1e-3;
19251
- const diff = (dist - c.length) / dist;
19252
- const fx = dx * diff * c.stiffness;
19253
- const fy = dy * diff * c.stiffness;
19254
- if (!a.fixed) {
19255
- a.vx += fx * dt;
19256
- a.vy += fy * dt;
19257
- }
19258
- if (!b.fixed) {
19259
- b.vx -= fx * dt;
19260
- b.vy -= fy * dt;
19261
- }
19262
- }
19263
- }
19264
- }, [preset, width, height, speed]);
19265
19214
  const draw = useCallback(() => {
19266
19215
  const canvas = canvasRef.current;
19267
19216
  if (!canvas) return;
@@ -19363,21 +19312,8 @@ function SimulationCanvas({
19363
19312
  return interp.startLoop(drawInterpolated);
19364
19313
  }, [externalBodies !== void 0, interp.startLoop]);
19365
19314
  useEffect(() => {
19366
- if (externalBodies !== void 0) return;
19367
- if (!running) return;
19368
- let raf;
19369
- const loop = () => {
19370
- step();
19371
- draw();
19372
- raf = requestAnimationFrame(loop);
19373
- };
19374
- raf = requestAnimationFrame(loop);
19375
- return () => cancelAnimationFrame(raf);
19376
- }, [running, step, draw, externalBodies]);
19377
- useEffect(() => {
19378
- if (externalBodies !== void 0) return;
19379
19315
  draw();
19380
- }, [draw, externalBodies]);
19316
+ }, [draw]);
19381
19317
  useEffect(() => {
19382
19318
  if (typeof window === "undefined") return;
19383
19319
  const canvas = canvasRef.current;
@@ -23326,7 +23262,7 @@ function generateDiff(oldVal, newVal) {
23326
23262
  }
23327
23263
  return diff;
23328
23264
  }
23329
- 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;
23330
23266
  var init_CodeBlock = __esm({
23331
23267
  "components/core/molecules/markdown/CodeBlock.tsx"() {
23332
23268
  init_cn();
@@ -23443,9 +23379,13 @@ var init_CodeBlock = __esm({
23443
23379
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
23444
23380
  DIFF_STYLES = {
23445
23381
  add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23382
+ added: { bg: "bg-success/10", prefix: "+", text: "text-success" },
23446
23383
  remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
23447
- 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" }
23448
23387
  };
23388
+ DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
23449
23389
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
23450
23390
  HIDDEN_LINE_NUMBERS = { display: "none" };
23451
23391
  CodeBlock = React105__default.memo(
@@ -23810,7 +23750,7 @@ var init_CodeBlock = __esm({
23810
23750
  }
23811
23751
  ),
23812
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) => {
23813
- const style = DIFF_STYLES[line.type];
23753
+ const style = DIFF_STYLES[line.type] ?? DIFF_STYLE_FALLBACK;
23814
23754
  return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
23815
23755
  showLineNumbers && /* @__PURE__ */ jsx(
23816
23756
  Typography,
@@ -26427,7 +26367,7 @@ var init_BookTableOfContents = __esm({
26427
26367
  style: { direction },
26428
26368
  children: [
26429
26369
  /* @__PURE__ */ jsx(Typography, { variant: "h1", className: "text-3xl font-bold text-center mb-4", children: t("book.tableOfContents") }),
26430
- parts.map((part, partIdx) => {
26370
+ (Array.isArray(parts) ? parts : []).map((part, partIdx) => {
26431
26371
  const chapters = Array.isArray(part.chapters) ? part.chapters : [];
26432
26372
  return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
26433
26373
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -40089,7 +40029,7 @@ var init_RichBlockEditor = __esm({
40089
40029
  changeEvent,
40090
40030
  readOnly = false,
40091
40031
  placeholder,
40092
- enableBlocks = false,
40032
+ enableBlocks = true,
40093
40033
  showToolbar = true,
40094
40034
  className
40095
40035
  }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.76.4",
3
+ "version": "5.76.6",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [