@almadar/ui 5.14.1 → 5.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.
- package/dist/avl/index.cjs +222 -61
- package/dist/avl/index.js +222 -61
- package/dist/components/index.cjs +68 -22
- package/dist/components/index.js +68 -22
- package/dist/context/index.cjs +5 -1
- package/dist/context/index.js +5 -1
- package/dist/hooks/index.cjs +5 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/useUISlots.d.ts +14 -0
- package/dist/providers/index.cjs +63 -21
- package/dist/providers/index.js +63 -21
- package/dist/runtime/index.cjs +82 -26
- package/dist/runtime/index.js +82 -26
- package/package.json +2 -2
package/dist/avl/index.js
CHANGED
|
@@ -5436,7 +5436,11 @@ function useUISlotManager() {
|
|
|
5436
5436
|
priority: config.priority ?? 0,
|
|
5437
5437
|
animation: config.animation ?? "fade",
|
|
5438
5438
|
onDismiss: config.onDismiss,
|
|
5439
|
-
sourceTrait: config.sourceTrait
|
|
5439
|
+
sourceTrait: config.sourceTrait,
|
|
5440
|
+
slot: config.target,
|
|
5441
|
+
transitionEvent: config.transitionEvent,
|
|
5442
|
+
fromState: config.fromState,
|
|
5443
|
+
entity: config.entity
|
|
5440
5444
|
};
|
|
5441
5445
|
if (config.autoDismissMs && config.autoDismissMs > 0) {
|
|
5442
5446
|
content.autoDismissAt = Date.now() + config.autoDismissMs;
|
|
@@ -14573,13 +14577,13 @@ var init_MapView = __esm({
|
|
|
14573
14577
|
shadowSize: [41, 41]
|
|
14574
14578
|
});
|
|
14575
14579
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
14576
|
-
const { useEffect:
|
|
14580
|
+
const { useEffect: useEffect90, useRef: useRef89, useCallback: useCallback130, useState: useState125 } = React98__default;
|
|
14577
14581
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
14578
14582
|
const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
14579
14583
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
14580
14584
|
const map = useMap();
|
|
14581
|
-
const prevRef =
|
|
14582
|
-
|
|
14585
|
+
const prevRef = useRef89({ centerLat, centerLng, zoom });
|
|
14586
|
+
useEffect90(() => {
|
|
14583
14587
|
const prev = prevRef.current;
|
|
14584
14588
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
14585
14589
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -14590,7 +14594,7 @@ var init_MapView = __esm({
|
|
|
14590
14594
|
}
|
|
14591
14595
|
function MapClickHandler({ onMapClick }) {
|
|
14592
14596
|
const map = useMap();
|
|
14593
|
-
|
|
14597
|
+
useEffect90(() => {
|
|
14594
14598
|
if (!onMapClick) return;
|
|
14595
14599
|
const handler = (e) => {
|
|
14596
14600
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -26105,6 +26109,21 @@ var init_DashboardLayout = __esm({
|
|
|
26105
26109
|
};
|
|
26106
26110
|
const [sidebarOpen, setSidebarOpen] = useState(false);
|
|
26107
26111
|
const [userMenuOpen, setUserMenuOpen] = useState(false);
|
|
26112
|
+
const layoutRef = useRef(null);
|
|
26113
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
26114
|
+
useEffect(() => {
|
|
26115
|
+
const el = layoutRef.current;
|
|
26116
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
26117
|
+
const ro = new ResizeObserver((entries) => {
|
|
26118
|
+
const w = entries[0]?.contentRect.width ?? el.clientWidth;
|
|
26119
|
+
setIsMobile(w < 1024);
|
|
26120
|
+
});
|
|
26121
|
+
ro.observe(el);
|
|
26122
|
+
return () => ro.disconnect();
|
|
26123
|
+
}, []);
|
|
26124
|
+
useEffect(() => {
|
|
26125
|
+
if (!isMobile && sidebarOpen) setSidebarOpen(false);
|
|
26126
|
+
}, [isMobile, sidebarOpen]);
|
|
26108
26127
|
const location = useLocation();
|
|
26109
26128
|
const ctxPagePath = useCurrentPagePath();
|
|
26110
26129
|
const activePath = currentPath ?? ctxPagePath ?? location.pathname;
|
|
@@ -26117,15 +26136,15 @@ var init_DashboardLayout = __esm({
|
|
|
26117
26136
|
const showBottomNav = layoutMode === "bottomnav";
|
|
26118
26137
|
const isTopNav = layoutMode === "topnav";
|
|
26119
26138
|
return /* @__PURE__ */ jsxs(
|
|
26120
|
-
|
|
26139
|
+
Box,
|
|
26121
26140
|
{
|
|
26122
|
-
|
|
26123
|
-
className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
|
|
26141
|
+
ref: layoutRef,
|
|
26142
|
+
className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
|
|
26124
26143
|
children: [
|
|
26125
|
-
showSidebar && sidebarOpen && /* @__PURE__ */ jsx(
|
|
26144
|
+
showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsx(
|
|
26126
26145
|
Box,
|
|
26127
26146
|
{
|
|
26128
|
-
className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20
|
|
26147
|
+
className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
|
|
26129
26148
|
onClick: () => setSidebarOpen(false)
|
|
26130
26149
|
}
|
|
26131
26150
|
),
|
|
@@ -26135,11 +26154,16 @@ var init_DashboardLayout = __esm({
|
|
|
26135
26154
|
as: "aside",
|
|
26136
26155
|
className: cn(
|
|
26137
26156
|
"z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
|
|
26138
|
-
"
|
|
26139
|
-
"transform transition-transform duration-200 ease-in-out",
|
|
26140
|
-
"flex flex-col",
|
|
26141
|
-
sidebarOpen ? "translate-x-0" : "-translate-x-full"
|
|
26157
|
+
"flex flex-col"
|
|
26142
26158
|
),
|
|
26159
|
+
style: isMobile ? {
|
|
26160
|
+
position: "fixed",
|
|
26161
|
+
top: 0,
|
|
26162
|
+
bottom: 0,
|
|
26163
|
+
left: 0,
|
|
26164
|
+
transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
|
|
26165
|
+
transition: "transform 200ms ease-in-out"
|
|
26166
|
+
} : { position: "static", transform: "none" },
|
|
26143
26167
|
children: [
|
|
26144
26168
|
/* @__PURE__ */ jsxs(
|
|
26145
26169
|
HStack,
|
|
@@ -26168,11 +26192,11 @@ var init_DashboardLayout = __esm({
|
|
|
26168
26192
|
}
|
|
26169
26193
|
)
|
|
26170
26194
|
] }),
|
|
26171
|
-
/* @__PURE__ */ jsx(
|
|
26195
|
+
isMobile && /* @__PURE__ */ jsx(
|
|
26172
26196
|
Button,
|
|
26173
26197
|
{
|
|
26174
26198
|
variant: "ghost",
|
|
26175
|
-
className: "
|
|
26199
|
+
className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
|
|
26176
26200
|
onClick: () => setSidebarOpen(false),
|
|
26177
26201
|
children: /* @__PURE__ */ jsx(Icon, { name: "x", className: "h-5 w-5" })
|
|
26178
26202
|
}
|
|
@@ -26213,11 +26237,11 @@ var init_DashboardLayout = __esm({
|
|
|
26213
26237
|
justify: "between",
|
|
26214
26238
|
className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
|
|
26215
26239
|
children: [
|
|
26216
|
-
showSidebar && /* @__PURE__ */ jsx(
|
|
26240
|
+
showSidebar && isMobile && /* @__PURE__ */ jsx(
|
|
26217
26241
|
Button,
|
|
26218
26242
|
{
|
|
26219
26243
|
variant: "ghost",
|
|
26220
|
-
className: "
|
|
26244
|
+
className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
|
|
26221
26245
|
onClick: () => setSidebarOpen(true),
|
|
26222
26246
|
"aria-label": "Open sidebar",
|
|
26223
26247
|
children: /* @__PURE__ */ jsx(Icon, { name: "menu", className: "h-5 w-5" })
|
|
@@ -56310,7 +56334,7 @@ function getToastPosition(position) {
|
|
|
56310
56334
|
return "top-4 right-4";
|
|
56311
56335
|
}
|
|
56312
56336
|
}
|
|
56313
|
-
function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait) {
|
|
56337
|
+
function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait, orbCtx) {
|
|
56314
56338
|
if (children === void 0 || children === null) return null;
|
|
56315
56339
|
const childrenArray = Array.isArray(children) ? children : typeof children === "string" || typeof children === "object" && "type" in children ? [children] : [];
|
|
56316
56340
|
if (childrenArray.length === 0) return null;
|
|
@@ -56341,8 +56365,11 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
56341
56365
|
nodeId: child._id,
|
|
56342
56366
|
// Inherit sourceTrait from the parent slot so nested patterns
|
|
56343
56367
|
// (e.g. form-section inside a stack) can resolve entityDef via
|
|
56344
|
-
// the trait's linkedEntity for form-field enrichment.
|
|
56345
|
-
|
|
56368
|
+
// the trait's linkedEntity for form-field enrichment. The orbCtx
|
|
56369
|
+
// (slot/transition/state/entity) propagates the same way so every
|
|
56370
|
+
// nested node carries a complete contextual-edit address.
|
|
56371
|
+
...sourceTrait !== void 0 && { sourceTrait },
|
|
56372
|
+
...orbCtx ?? {}
|
|
56346
56373
|
};
|
|
56347
56374
|
return /* @__PURE__ */ jsx(
|
|
56348
56375
|
SlotContentRenderer,
|
|
@@ -56458,7 +56485,12 @@ function SlotContentRenderer({
|
|
|
56458
56485
|
const isSingleChild = typeof childrenConfig === "string" || typeof childrenConfig === "object" && childrenConfig !== null && !Array.isArray(childrenConfig) && "type" in childrenConfig;
|
|
56459
56486
|
const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0 || isSingleChild;
|
|
56460
56487
|
const myPath = patternPath ?? "root";
|
|
56461
|
-
const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait
|
|
56488
|
+
const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait, {
|
|
56489
|
+
slot: content.slot,
|
|
56490
|
+
transitionEvent: content.transitionEvent,
|
|
56491
|
+
fromState: content.fromState,
|
|
56492
|
+
entity: content.entity
|
|
56493
|
+
}) : void 0;
|
|
56462
56494
|
const incomingChildren = content.props.children;
|
|
56463
56495
|
const childrenIsRenderFn = typeof incomingChildren === "function";
|
|
56464
56496
|
const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
|
|
@@ -56505,6 +56537,13 @@ function SlotContentRenderer({
|
|
|
56505
56537
|
"data-pattern-path": myPath,
|
|
56506
56538
|
"data-pattern-type": content.pattern,
|
|
56507
56539
|
"data-accepts-children": acceptsChildren ? "true" : void 0,
|
|
56540
|
+
"data-orb-trait": content.sourceTrait,
|
|
56541
|
+
"data-orb-slot": content.slot,
|
|
56542
|
+
"data-orb-transition": content.transitionEvent,
|
|
56543
|
+
"data-orb-state": content.fromState,
|
|
56544
|
+
"data-orb-entity": content.entity,
|
|
56545
|
+
"data-orb-path": myPath,
|
|
56546
|
+
"data-orb-pattern": content.pattern,
|
|
56508
56547
|
children: renderedChildren !== void 0 ? /* @__PURE__ */ jsx(PatternComponent, { ...finalProps, children: renderedChildren }) : /* @__PURE__ */ jsx(PatternComponent, { ...finalProps })
|
|
56509
56548
|
}
|
|
56510
56549
|
);
|
|
@@ -56517,6 +56556,13 @@ function SlotContentRenderer({
|
|
|
56517
56556
|
"data-id": content.id,
|
|
56518
56557
|
"data-node-id": content.nodeId,
|
|
56519
56558
|
"data-source-trait": content.sourceTrait,
|
|
56559
|
+
"data-orb-trait": content.sourceTrait,
|
|
56560
|
+
"data-orb-slot": content.slot,
|
|
56561
|
+
"data-orb-transition": content.transitionEvent,
|
|
56562
|
+
"data-orb-state": content.fromState,
|
|
56563
|
+
"data-orb-entity": content.entity,
|
|
56564
|
+
"data-orb-path": patternPath ?? "root",
|
|
56565
|
+
"data-orb-pattern": content.pattern,
|
|
56520
56566
|
children: content.props.children ?? /* @__PURE__ */ jsxs(Box, { className: "p-4 text-sm text-muted-foreground border border-dashed border-border rounded", children: [
|
|
56521
56567
|
"Unknown pattern: ",
|
|
56522
56568
|
content.pattern,
|
|
@@ -60368,7 +60414,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60368
60414
|
embeddedTraitsRef.current = options?.embeddedTraits;
|
|
60369
60415
|
}, [options?.embeddedTraits]);
|
|
60370
60416
|
const flushSlot = useCallback(
|
|
60371
|
-
(traitName, slot, patterns) => {
|
|
60417
|
+
(traitName, slot, patterns, source) => {
|
|
60372
60418
|
const slots = uiSlotsRef.current;
|
|
60373
60419
|
const embedded = embeddedTraitsRef.current;
|
|
60374
60420
|
if (patterns.length === 0) {
|
|
@@ -60397,7 +60443,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60397
60443
|
pattern: patternType,
|
|
60398
60444
|
props,
|
|
60399
60445
|
priority: 0,
|
|
60400
|
-
animation: "fade"
|
|
60446
|
+
animation: "fade",
|
|
60447
|
+
transitionEvent: source?.event,
|
|
60448
|
+
fromState: source?.state,
|
|
60449
|
+
entity: source?.entity
|
|
60401
60450
|
});
|
|
60402
60451
|
return;
|
|
60403
60452
|
}
|
|
@@ -60411,7 +60460,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60411
60460
|
target: slot,
|
|
60412
60461
|
pattern: patternType,
|
|
60413
60462
|
props,
|
|
60414
|
-
sourceTrait: traitName
|
|
60463
|
+
sourceTrait: traitName,
|
|
60464
|
+
transitionEvent: source?.event,
|
|
60465
|
+
fromState: source?.state,
|
|
60466
|
+
entity: source?.entity
|
|
60415
60467
|
});
|
|
60416
60468
|
},
|
|
60417
60469
|
[]
|
|
@@ -60544,7 +60596,11 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60544
60596
|
}
|
|
60545
60597
|
}
|
|
60546
60598
|
for (const [slot, patterns] of pendingSlots) {
|
|
60547
|
-
flushSlot(binding.trait.name, slot, patterns
|
|
60599
|
+
flushSlot(binding.trait.name, slot, patterns, {
|
|
60600
|
+
event: `tick:${tick.name}`,
|
|
60601
|
+
state: currentState,
|
|
60602
|
+
entity: binding.linkedEntity
|
|
60603
|
+
});
|
|
60548
60604
|
}
|
|
60549
60605
|
}, [flushSlot]);
|
|
60550
60606
|
useEffect(() => {
|
|
@@ -60796,7 +60852,11 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60796
60852
|
transition: `${result.previousState}->${result.newState}`,
|
|
60797
60853
|
cleared: patterns.length === 0
|
|
60798
60854
|
});
|
|
60799
|
-
flushSlot(traitName, slot, patterns
|
|
60855
|
+
flushSlot(traitName, slot, patterns, {
|
|
60856
|
+
event: eventKey,
|
|
60857
|
+
state: result.previousState,
|
|
60858
|
+
entity: binding.linkedEntity
|
|
60859
|
+
});
|
|
60800
60860
|
}
|
|
60801
60861
|
} catch (error) {
|
|
60802
60862
|
stateLog.error("transition:effect-error", {
|
|
@@ -62564,15 +62624,9 @@ function buildTransitionSchema(fullSchema, orbitalName, traitName, transitionEve
|
|
|
62564
62624
|
return { ...fullSchema, name: `${fullSchema.name}__${orbitalName}__${traitName}__${transitionEvent}`, orbitals: [clonedOrbital] };
|
|
62565
62625
|
}
|
|
62566
62626
|
var SELECTION_STYLES = `
|
|
62567
|
-
.orb-preview-live [data-pattern]
|
|
62568
|
-
outline: 2px dashed var(--color-primary);
|
|
62569
|
-
outline-offset: 1px;
|
|
62627
|
+
.orb-preview-live [data-pattern] {
|
|
62570
62628
|
cursor: pointer;
|
|
62571
62629
|
}
|
|
62572
|
-
.orb-preview-live [data-pattern].pattern-selected {
|
|
62573
|
-
outline: 2px solid var(--color-primary);
|
|
62574
|
-
outline-offset: 1px;
|
|
62575
|
-
}
|
|
62576
62630
|
.orb-preview-live.drag-active [data-accepts-children="true"] {
|
|
62577
62631
|
outline: 2px dashed var(--color-primary);
|
|
62578
62632
|
outline-offset: -2px;
|
|
@@ -62589,15 +62643,66 @@ var SELECTION_STYLES = `
|
|
|
62589
62643
|
pointer-events: none;
|
|
62590
62644
|
}
|
|
62591
62645
|
`;
|
|
62646
|
+
function absUnion(el) {
|
|
62647
|
+
const own = el.getBoundingClientRect();
|
|
62648
|
+
if (own.width > 0 || own.height > 0) {
|
|
62649
|
+
return { top: own.top, left: own.left, right: own.right, bottom: own.bottom };
|
|
62650
|
+
}
|
|
62651
|
+
let r2 = null;
|
|
62652
|
+
for (const child of Array.from(el.children)) {
|
|
62653
|
+
const box = absUnion(child);
|
|
62654
|
+
if (!box) continue;
|
|
62655
|
+
r2 = r2 ? {
|
|
62656
|
+
top: Math.min(r2.top, box.top),
|
|
62657
|
+
left: Math.min(r2.left, box.left),
|
|
62658
|
+
right: Math.max(r2.right, box.right),
|
|
62659
|
+
bottom: Math.max(r2.bottom, box.bottom)
|
|
62660
|
+
} : box;
|
|
62661
|
+
}
|
|
62662
|
+
return r2;
|
|
62663
|
+
}
|
|
62664
|
+
function rectRelativeTo(el, container) {
|
|
62665
|
+
const u = absUnion(el);
|
|
62666
|
+
if (!u) return null;
|
|
62667
|
+
const base = container.getBoundingClientRect();
|
|
62668
|
+
return { top: u.top - base.top, left: u.left - base.left, width: u.right - u.left, height: u.bottom - u.top };
|
|
62669
|
+
}
|
|
62670
|
+
function buildFocus(el, orbitalName) {
|
|
62671
|
+
if (!orbitalName) return null;
|
|
62672
|
+
const path = el.getAttribute("data-orb-path") ?? el.getAttribute("data-pattern-path");
|
|
62673
|
+
const patternType = el.getAttribute("data-orb-pattern") ?? el.getAttribute("data-pattern");
|
|
62674
|
+
const trait = el.getAttribute("data-orb-trait") ?? el.getAttribute("data-source-trait");
|
|
62675
|
+
const focus = {
|
|
62676
|
+
level: "node",
|
|
62677
|
+
orbital: orbitalName,
|
|
62678
|
+
label: patternType ?? trait ?? "element"
|
|
62679
|
+
};
|
|
62680
|
+
if (path !== null) focus.path = path;
|
|
62681
|
+
if (trait !== null) focus.trait = trait;
|
|
62682
|
+
if (patternType !== null) focus.patternType = patternType;
|
|
62683
|
+
const transition = el.getAttribute("data-orb-transition");
|
|
62684
|
+
if (transition !== null) focus.transition = transition;
|
|
62685
|
+
const state = el.getAttribute("data-orb-state");
|
|
62686
|
+
if (state !== null) focus.state = state;
|
|
62687
|
+
const slot = el.getAttribute("data-orb-slot");
|
|
62688
|
+
if (slot !== null) focus.slot = slot;
|
|
62689
|
+
const entity = el.getAttribute("data-orb-entity");
|
|
62690
|
+
if (entity !== null) focus.entity = entity;
|
|
62691
|
+
return focus;
|
|
62692
|
+
}
|
|
62592
62693
|
var OrbPreviewNodeInner = (props) => {
|
|
62593
62694
|
const data = props.data;
|
|
62594
62695
|
const screenSize = useContext(ScreenSizeContext);
|
|
62595
62696
|
const preset = SCREEN_SIZE_PRESETS[screenSize];
|
|
62596
62697
|
const { select } = useContext(PatternSelectionContext);
|
|
62698
|
+
const eventBus = useEventBus();
|
|
62597
62699
|
const contentRef = useRef(null);
|
|
62598
62700
|
const [hovered, setHovered] = useState(false);
|
|
62599
62701
|
const handleMouseEnter = useCallback(() => setHovered(true), []);
|
|
62600
62702
|
const handleMouseLeave = useCallback(() => setHovered(false), []);
|
|
62703
|
+
const [selectedRect, setSelectedRect] = useState(null);
|
|
62704
|
+
const [hoverRect, setHoverRect] = useState(null);
|
|
62705
|
+
const lastHoverElRef = useRef(null);
|
|
62601
62706
|
const role = data.stateRole ?? "default";
|
|
62602
62707
|
const colors = ROLE_COLORS[role] ?? ROLE_COLORS.default;
|
|
62603
62708
|
const eventSources = data.eventSources ?? [];
|
|
@@ -62630,13 +62735,14 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
62630
62735
|
e.stopPropagation();
|
|
62631
62736
|
const target = e.target;
|
|
62632
62737
|
const patternEl = target.closest("[data-pattern]");
|
|
62633
|
-
contentRef.current
|
|
62738
|
+
const container = contentRef.current;
|
|
62739
|
+
container?.querySelectorAll(".pattern-selected").forEach((el) => {
|
|
62634
62740
|
el.classList.remove("pattern-selected");
|
|
62635
62741
|
});
|
|
62636
|
-
if (patternEl) {
|
|
62742
|
+
if (patternEl && container) {
|
|
62637
62743
|
patternEl.classList.add("pattern-selected");
|
|
62638
|
-
const
|
|
62639
|
-
|
|
62744
|
+
const rect = rectRelativeTo(patternEl, container);
|
|
62745
|
+
setSelectedRect(rect);
|
|
62640
62746
|
select({
|
|
62641
62747
|
patternType: patternEl.getAttribute("data-pattern") ?? "unknown",
|
|
62642
62748
|
// `data-pattern-path` is the SExpr tree path (`children.0.…`) emitted by
|
|
@@ -62647,18 +62753,33 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
62647
62753
|
patternId: patternEl.getAttribute("data-pattern-path") ?? void 0,
|
|
62648
62754
|
sourceTrait: patternEl.getAttribute("data-source-trait") ?? void 0,
|
|
62649
62755
|
nodeData: data,
|
|
62650
|
-
rect:
|
|
62651
|
-
top: elRect.top - nodeRect.top,
|
|
62652
|
-
left: elRect.left - nodeRect.left,
|
|
62653
|
-
width: elRect.width,
|
|
62654
|
-
height: elRect.height
|
|
62655
|
-
} : void 0
|
|
62756
|
+
rect: rect ?? void 0
|
|
62656
62757
|
});
|
|
62758
|
+
const focus = buildFocus(patternEl, data.orbitalName);
|
|
62759
|
+
if (focus) eventBus.emit("UI:ELEMENT_SELECTED", { focus: { ...focus } });
|
|
62657
62760
|
} else {
|
|
62761
|
+
setSelectedRect(null);
|
|
62658
62762
|
select(null);
|
|
62659
|
-
|
|
62660
|
-
|
|
62661
|
-
|
|
62763
|
+
eventBus.emit("UI:ELEMENT_SELECTED", { focus: null });
|
|
62764
|
+
}
|
|
62765
|
+
}, [data, select, eventBus]);
|
|
62766
|
+
const handleContentMouseMove = useCallback((e) => {
|
|
62767
|
+
const container = contentRef.current;
|
|
62768
|
+
if (!container) return;
|
|
62769
|
+
const el = e.target.closest("[data-pattern]");
|
|
62770
|
+
if (el === lastHoverElRef.current) return;
|
|
62771
|
+
lastHoverElRef.current = el;
|
|
62772
|
+
setHoverRect(el ? rectRelativeTo(el, container) : null);
|
|
62773
|
+
}, []);
|
|
62774
|
+
const handleContentMouseLeave = useCallback(() => {
|
|
62775
|
+
lastHoverElRef.current = null;
|
|
62776
|
+
setHoverRect(null);
|
|
62777
|
+
}, []);
|
|
62778
|
+
useEffect(() => {
|
|
62779
|
+
setSelectedRect(null);
|
|
62780
|
+
setHoverRect(null);
|
|
62781
|
+
lastHoverElRef.current = null;
|
|
62782
|
+
}, [orbitalSchema]);
|
|
62662
62783
|
const [dragActive, setDragActive] = useState(false);
|
|
62663
62784
|
useEffect(() => {
|
|
62664
62785
|
const unsub1 = eventBus.on("UI:DRAG_START", (e) => {
|
|
@@ -62877,26 +62998,66 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
62877
62998
|
src.event
|
|
62878
62999
|
)) })
|
|
62879
63000
|
] }),
|
|
62880
|
-
/* @__PURE__ */
|
|
63001
|
+
/* @__PURE__ */ jsxs(
|
|
62881
63002
|
Box,
|
|
62882
63003
|
{
|
|
62883
63004
|
ref: setContentRef,
|
|
62884
|
-
className: `orb-preview-live nodrag${dragActive || l2IsOver ? " drag-active" : ""}`,
|
|
63005
|
+
className: `orb-preview-live nodrag relative${dragActive || l2IsOver ? " drag-active" : ""}`,
|
|
62885
63006
|
onClick: handleContentClick,
|
|
62886
|
-
|
|
62887
|
-
|
|
62888
|
-
|
|
62889
|
-
|
|
62890
|
-
|
|
62891
|
-
/* @__PURE__ */ jsx(Box, { style: { minHeight: preset.minHeight }, children: /* @__PURE__ */ jsx(
|
|
62892
|
-
BrowserPlayground,
|
|
63007
|
+
onMouseMove: handleContentMouseMove,
|
|
63008
|
+
onMouseLeave: handleContentMouseLeave,
|
|
63009
|
+
children: [
|
|
63010
|
+
hoverRect && /* @__PURE__ */ jsx(
|
|
63011
|
+
"div",
|
|
62893
63012
|
{
|
|
62894
|
-
|
|
62895
|
-
|
|
62896
|
-
|
|
63013
|
+
"aria-hidden": true,
|
|
63014
|
+
style: {
|
|
63015
|
+
position: "absolute",
|
|
63016
|
+
pointerEvents: "none",
|
|
63017
|
+
top: hoverRect.top,
|
|
63018
|
+
left: hoverRect.left,
|
|
63019
|
+
width: hoverRect.width,
|
|
63020
|
+
height: hoverRect.height,
|
|
63021
|
+
outline: "2px dashed var(--color-primary)",
|
|
63022
|
+
outlineOffset: "1px",
|
|
63023
|
+
borderRadius: "2px",
|
|
63024
|
+
zIndex: 20
|
|
63025
|
+
}
|
|
62897
63026
|
}
|
|
62898
|
-
)
|
|
62899
|
-
|
|
63027
|
+
),
|
|
63028
|
+
selectedRect && /* @__PURE__ */ jsx(
|
|
63029
|
+
"div",
|
|
63030
|
+
{
|
|
63031
|
+
"aria-hidden": true,
|
|
63032
|
+
style: {
|
|
63033
|
+
position: "absolute",
|
|
63034
|
+
pointerEvents: "none",
|
|
63035
|
+
top: selectedRect.top,
|
|
63036
|
+
left: selectedRect.left,
|
|
63037
|
+
width: selectedRect.width,
|
|
63038
|
+
height: selectedRect.height,
|
|
63039
|
+
outline: "2px solid var(--color-primary)",
|
|
63040
|
+
outlineOffset: "1px",
|
|
63041
|
+
borderRadius: "2px",
|
|
63042
|
+
zIndex: 21
|
|
63043
|
+
}
|
|
63044
|
+
}
|
|
63045
|
+
),
|
|
63046
|
+
orbitalSchema ? (
|
|
63047
|
+
// L1 and L2 both auto-grow with content. L2's `buildTransitionSchema`
|
|
63048
|
+
// rewrites portal slots (modal/drawer/overlay/center) to `main`, so
|
|
63049
|
+
// the rendered pattern lands inline in the main slot and contributes
|
|
63050
|
+
// to the card's height — same height model as L1 orbital cards.
|
|
63051
|
+
/* @__PURE__ */ jsx(Box, { style: { minHeight: preset.minHeight }, children: /* @__PURE__ */ jsx(
|
|
63052
|
+
BrowserPlayground,
|
|
63053
|
+
{
|
|
63054
|
+
schema: orbitalSchema,
|
|
63055
|
+
mode: "mock",
|
|
63056
|
+
height: "auto"
|
|
63057
|
+
}
|
|
63058
|
+
) })
|
|
63059
|
+
) : /* @__PURE__ */ jsx(Box, { className: "flex items-center justify-center", style: { minHeight: preset.minHeight }, children: /* @__PURE__ */ jsx(Typography, { variant: "small", className: "text-muted-foreground", children: "No preview available" }) })
|
|
63060
|
+
]
|
|
62900
63061
|
}
|
|
62901
63062
|
),
|
|
62902
63063
|
/* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Left, style: TARGET_HANDLE_STYLE }),
|