@almadar/ui 2.16.0 → 2.16.1

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.
@@ -3977,6 +3977,16 @@ AvlBindingRef.displayName = "AvlBindingRef";
3977
3977
 
3978
3978
  // components/molecules/avl/avl-layout.ts
3979
3979
  function ringPositions(cx, cy, r, count, startAngle = -Math.PI / 2) {
3980
+ if (count === 0) return [];
3981
+ if (count === 1) {
3982
+ return [{ x: cx, y: cy, angle: 0 }];
3983
+ }
3984
+ if (count === 2) {
3985
+ return [
3986
+ { x: cx - r * 0.7, y: cy, angle: Math.PI },
3987
+ { x: cx + r * 0.7, y: cy, angle: 0 }
3988
+ ];
3989
+ }
3980
3990
  return Array.from({ length: count }, (_, i) => {
3981
3991
  const angle = startAngle + Math.PI * 2 * i / count;
3982
3992
  return {
@@ -4031,6 +4041,43 @@ var AvlStateMachine = ({
4031
4041
  ` }),
4032
4042
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r: r + 30, fill: `url(#${ids.grad})` }),
4033
4043
  transitions.map((tr, i) => {
4044
+ if (tr.from !== tr.to) return null;
4045
+ const idx = stateIndex.get(tr.from);
4046
+ if (idx === void 0) return null;
4047
+ const pos = positions[idx];
4048
+ const loopR = 20;
4049
+ const loopY = pos.y - stateHeight / 2 - 4;
4050
+ const d = `M${pos.x - 14},${loopY} C${pos.x - 14},${loopY - loopR * 2} ${pos.x + 14},${loopY - loopR * 2} ${pos.x + 14},${loopY}`;
4051
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
4052
+ /* @__PURE__ */ jsxRuntime.jsx(
4053
+ "path",
4054
+ {
4055
+ d,
4056
+ fill: "none",
4057
+ stroke: color,
4058
+ strokeWidth: 1.5,
4059
+ opacity: 0.7,
4060
+ markerEnd: `url(#${ids.grad})`
4061
+ }
4062
+ ),
4063
+ tr.event && /* @__PURE__ */ jsxRuntime.jsx(
4064
+ "text",
4065
+ {
4066
+ x: pos.x,
4067
+ y: loopY - loopR * 2 + 4,
4068
+ textAnchor: "middle",
4069
+ fill: color,
4070
+ fontSize: 9,
4071
+ fontFamily: "inherit",
4072
+ fontWeight: "bold",
4073
+ opacity: 0.8,
4074
+ children: tr.event
4075
+ }
4076
+ )
4077
+ ] }, `self-${i}`);
4078
+ }),
4079
+ transitions.map((tr, i) => {
4080
+ if (tr.from === tr.to) return null;
4034
4081
  const fromIdx = stateIndex.get(tr.from);
4035
4082
  const toIdx = stateIndex.get(tr.to);
4036
4083
  if (fromIdx === void 0 || toIdx === void 0) return null;
@@ -4490,6 +4537,42 @@ var AvlEmitListen = ({
4490
4537
  ] });
4491
4538
  };
4492
4539
  AvlEmitListen.displayName = "AvlEmitListen";
4540
+ var SLOT_PRESETS = {
4541
+ header: { x: 10, y: 5, width: 340, height: 35 },
4542
+ main: { x: 120, y: 50, width: 230, height: 195 },
4543
+ sidebar: { x: 10, y: 50, width: 100, height: 195 },
4544
+ modal: { x: 80, y: 60, width: 200, height: 140 },
4545
+ drawer: { x: 220, y: 50, width: 130, height: 195 },
4546
+ toast: { x: 220, y: 210, width: 130, height: 35 },
4547
+ footer: { x: 10, y: 220, width: 340, height: 30 },
4548
+ center: { x: 60, y: 50, width: 240, height: 195 },
4549
+ "hud-top": { x: 10, y: 5, width: 340, height: 30 },
4550
+ "hud-bottom": { x: 10, y: 220, width: 340, height: 30 }
4551
+ };
4552
+ function resolveSlot(slot, fallbackIdx) {
4553
+ if (slot.x !== void 0 && slot.y !== void 0 && slot.width !== void 0 && slot.height !== void 0) {
4554
+ return slot;
4555
+ }
4556
+ const preset = SLOT_PRESETS[slot.name];
4557
+ if (preset) {
4558
+ return {
4559
+ name: slot.name,
4560
+ x: slot.x ?? preset.x,
4561
+ y: slot.y ?? preset.y,
4562
+ width: slot.width ?? preset.width,
4563
+ height: slot.height ?? preset.height
4564
+ };
4565
+ }
4566
+ const col = fallbackIdx % 2;
4567
+ const row = Math.floor(fallbackIdx / 2);
4568
+ return {
4569
+ name: slot.name,
4570
+ x: 10 + col * 175,
4571
+ y: 50 + row * 100,
4572
+ width: 165,
4573
+ height: 90
4574
+ };
4575
+ }
4493
4576
  var AvlSlotMap = ({
4494
4577
  slots,
4495
4578
  pageWidth = 360,
@@ -4500,6 +4583,13 @@ var AvlSlotMap = ({
4500
4583
  }) => {
4501
4584
  const ox = (600 - pageWidth) / 2;
4502
4585
  const oy = (400 - pageHeight) / 2;
4586
+ let unknownIdx = 0;
4587
+ const resolvedSlots = slots.map((slot) => {
4588
+ const isUnknown = !SLOT_PRESETS[slot.name] && (slot.x === void 0 || slot.y === void 0);
4589
+ const resolved = resolveSlot(slot, isUnknown ? unknownIdx : 0);
4590
+ if (isUnknown) unknownIdx++;
4591
+ return resolved;
4592
+ });
4503
4593
  return /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
4504
4594
  animated && /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
4505
4595
  @keyframes avl-slot-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.25; } }
@@ -4544,7 +4634,7 @@ var AvlSlotMap = ({
4544
4634
  children: "Page Layout"
4545
4635
  }
4546
4636
  ),
4547
- slots.map((slot) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
4637
+ resolvedSlots.map((slot) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
4548
4638
  /* @__PURE__ */ jsxRuntime.jsx(
4549
4639
  "rect",
4550
4640
  {
@@ -505,10 +505,11 @@ declare const AvlEmitListen: React.FC<AvlEmitListenProps>;
505
505
 
506
506
  interface AvlSlotMapSlot {
507
507
  name: string;
508
- x: number;
509
- y: number;
510
- width: number;
511
- height: number;
508
+ /** Manual position overrides. Omit for auto-layout. */
509
+ x?: number;
510
+ y?: number;
511
+ width?: number;
512
+ height?: number;
512
513
  }
513
514
  interface AvlSlotMapProps {
514
515
  slots: AvlSlotMapSlot[];
@@ -3971,6 +3971,16 @@ AvlBindingRef.displayName = "AvlBindingRef";
3971
3971
 
3972
3972
  // components/molecules/avl/avl-layout.ts
3973
3973
  function ringPositions(cx, cy, r, count, startAngle = -Math.PI / 2) {
3974
+ if (count === 0) return [];
3975
+ if (count === 1) {
3976
+ return [{ x: cx, y: cy, angle: 0 }];
3977
+ }
3978
+ if (count === 2) {
3979
+ return [
3980
+ { x: cx - r * 0.7, y: cy, angle: Math.PI },
3981
+ { x: cx + r * 0.7, y: cy, angle: 0 }
3982
+ ];
3983
+ }
3974
3984
  return Array.from({ length: count }, (_, i) => {
3975
3985
  const angle = startAngle + Math.PI * 2 * i / count;
3976
3986
  return {
@@ -4025,6 +4035,43 @@ var AvlStateMachine = ({
4025
4035
  ` }),
4026
4036
  /* @__PURE__ */ jsx("circle", { cx, cy, r: r + 30, fill: `url(#${ids.grad})` }),
4027
4037
  transitions.map((tr, i) => {
4038
+ if (tr.from !== tr.to) return null;
4039
+ const idx = stateIndex.get(tr.from);
4040
+ if (idx === void 0) return null;
4041
+ const pos = positions[idx];
4042
+ const loopR = 20;
4043
+ const loopY = pos.y - stateHeight / 2 - 4;
4044
+ const d = `M${pos.x - 14},${loopY} C${pos.x - 14},${loopY - loopR * 2} ${pos.x + 14},${loopY - loopR * 2} ${pos.x + 14},${loopY}`;
4045
+ return /* @__PURE__ */ jsxs("g", { children: [
4046
+ /* @__PURE__ */ jsx(
4047
+ "path",
4048
+ {
4049
+ d,
4050
+ fill: "none",
4051
+ stroke: color,
4052
+ strokeWidth: 1.5,
4053
+ opacity: 0.7,
4054
+ markerEnd: `url(#${ids.grad})`
4055
+ }
4056
+ ),
4057
+ tr.event && /* @__PURE__ */ jsx(
4058
+ "text",
4059
+ {
4060
+ x: pos.x,
4061
+ y: loopY - loopR * 2 + 4,
4062
+ textAnchor: "middle",
4063
+ fill: color,
4064
+ fontSize: 9,
4065
+ fontFamily: "inherit",
4066
+ fontWeight: "bold",
4067
+ opacity: 0.8,
4068
+ children: tr.event
4069
+ }
4070
+ )
4071
+ ] }, `self-${i}`);
4072
+ }),
4073
+ transitions.map((tr, i) => {
4074
+ if (tr.from === tr.to) return null;
4028
4075
  const fromIdx = stateIndex.get(tr.from);
4029
4076
  const toIdx = stateIndex.get(tr.to);
4030
4077
  if (fromIdx === void 0 || toIdx === void 0) return null;
@@ -4484,6 +4531,42 @@ var AvlEmitListen = ({
4484
4531
  ] });
4485
4532
  };
4486
4533
  AvlEmitListen.displayName = "AvlEmitListen";
4534
+ var SLOT_PRESETS = {
4535
+ header: { x: 10, y: 5, width: 340, height: 35 },
4536
+ main: { x: 120, y: 50, width: 230, height: 195 },
4537
+ sidebar: { x: 10, y: 50, width: 100, height: 195 },
4538
+ modal: { x: 80, y: 60, width: 200, height: 140 },
4539
+ drawer: { x: 220, y: 50, width: 130, height: 195 },
4540
+ toast: { x: 220, y: 210, width: 130, height: 35 },
4541
+ footer: { x: 10, y: 220, width: 340, height: 30 },
4542
+ center: { x: 60, y: 50, width: 240, height: 195 },
4543
+ "hud-top": { x: 10, y: 5, width: 340, height: 30 },
4544
+ "hud-bottom": { x: 10, y: 220, width: 340, height: 30 }
4545
+ };
4546
+ function resolveSlot(slot, fallbackIdx) {
4547
+ if (slot.x !== void 0 && slot.y !== void 0 && slot.width !== void 0 && slot.height !== void 0) {
4548
+ return slot;
4549
+ }
4550
+ const preset = SLOT_PRESETS[slot.name];
4551
+ if (preset) {
4552
+ return {
4553
+ name: slot.name,
4554
+ x: slot.x ?? preset.x,
4555
+ y: slot.y ?? preset.y,
4556
+ width: slot.width ?? preset.width,
4557
+ height: slot.height ?? preset.height
4558
+ };
4559
+ }
4560
+ const col = fallbackIdx % 2;
4561
+ const row = Math.floor(fallbackIdx / 2);
4562
+ return {
4563
+ name: slot.name,
4564
+ x: 10 + col * 175,
4565
+ y: 50 + row * 100,
4566
+ width: 165,
4567
+ height: 90
4568
+ };
4569
+ }
4487
4570
  var AvlSlotMap = ({
4488
4571
  slots,
4489
4572
  pageWidth = 360,
@@ -4494,6 +4577,13 @@ var AvlSlotMap = ({
4494
4577
  }) => {
4495
4578
  const ox = (600 - pageWidth) / 2;
4496
4579
  const oy = (400 - pageHeight) / 2;
4580
+ let unknownIdx = 0;
4581
+ const resolvedSlots = slots.map((slot) => {
4582
+ const isUnknown = !SLOT_PRESETS[slot.name] && (slot.x === void 0 || slot.y === void 0);
4583
+ const resolved = resolveSlot(slot, isUnknown ? unknownIdx : 0);
4584
+ if (isUnknown) unknownIdx++;
4585
+ return resolved;
4586
+ });
4497
4587
  return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 600 400", xmlns: "http://www.w3.org/2000/svg", className, children: [
4498
4588
  animated && /* @__PURE__ */ jsx("style", { children: `
4499
4589
  @keyframes avl-slot-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.25; } }
@@ -4538,7 +4628,7 @@ var AvlSlotMap = ({
4538
4628
  children: "Page Layout"
4539
4629
  }
4540
4630
  ),
4541
- slots.map((slot) => /* @__PURE__ */ jsxs("g", { children: [
4631
+ resolvedSlots.map((slot) => /* @__PURE__ */ jsxs("g", { children: [
4542
4632
  /* @__PURE__ */ jsx(
4543
4633
  "rect",
4544
4634
  {