@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.cjs
CHANGED
|
@@ -5485,7 +5485,11 @@ function useUISlotManager() {
|
|
|
5485
5485
|
priority: config.priority ?? 0,
|
|
5486
5486
|
animation: config.animation ?? "fade",
|
|
5487
5487
|
onDismiss: config.onDismiss,
|
|
5488
|
-
sourceTrait: config.sourceTrait
|
|
5488
|
+
sourceTrait: config.sourceTrait,
|
|
5489
|
+
slot: config.target,
|
|
5490
|
+
transitionEvent: config.transitionEvent,
|
|
5491
|
+
fromState: config.fromState,
|
|
5492
|
+
entity: config.entity
|
|
5489
5493
|
};
|
|
5490
5494
|
if (config.autoDismissMs && config.autoDismissMs > 0) {
|
|
5491
5495
|
content.autoDismissAt = Date.now() + config.autoDismissMs;
|
|
@@ -14622,13 +14626,13 @@ var init_MapView = __esm({
|
|
|
14622
14626
|
shadowSize: [41, 41]
|
|
14623
14627
|
});
|
|
14624
14628
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
14625
|
-
const { useEffect:
|
|
14629
|
+
const { useEffect: useEffect90, useRef: useRef89, useCallback: useCallback130, useState: useState125 } = React98__namespace.default;
|
|
14626
14630
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
14627
14631
|
const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
14628
14632
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
14629
14633
|
const map = useMap();
|
|
14630
|
-
const prevRef =
|
|
14631
|
-
|
|
14634
|
+
const prevRef = useRef89({ centerLat, centerLng, zoom });
|
|
14635
|
+
useEffect90(() => {
|
|
14632
14636
|
const prev = prevRef.current;
|
|
14633
14637
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
14634
14638
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -14639,7 +14643,7 @@ var init_MapView = __esm({
|
|
|
14639
14643
|
}
|
|
14640
14644
|
function MapClickHandler({ onMapClick }) {
|
|
14641
14645
|
const map = useMap();
|
|
14642
|
-
|
|
14646
|
+
useEffect90(() => {
|
|
14643
14647
|
if (!onMapClick) return;
|
|
14644
14648
|
const handler = (e) => {
|
|
14645
14649
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -26154,6 +26158,21 @@ var init_DashboardLayout = __esm({
|
|
|
26154
26158
|
};
|
|
26155
26159
|
const [sidebarOpen, setSidebarOpen] = React98.useState(false);
|
|
26156
26160
|
const [userMenuOpen, setUserMenuOpen] = React98.useState(false);
|
|
26161
|
+
const layoutRef = React98.useRef(null);
|
|
26162
|
+
const [isMobile, setIsMobile] = React98.useState(false);
|
|
26163
|
+
React98.useEffect(() => {
|
|
26164
|
+
const el = layoutRef.current;
|
|
26165
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
26166
|
+
const ro = new ResizeObserver((entries) => {
|
|
26167
|
+
const w = entries[0]?.contentRect.width ?? el.clientWidth;
|
|
26168
|
+
setIsMobile(w < 1024);
|
|
26169
|
+
});
|
|
26170
|
+
ro.observe(el);
|
|
26171
|
+
return () => ro.disconnect();
|
|
26172
|
+
}, []);
|
|
26173
|
+
React98.useEffect(() => {
|
|
26174
|
+
if (!isMobile && sidebarOpen) setSidebarOpen(false);
|
|
26175
|
+
}, [isMobile, sidebarOpen]);
|
|
26157
26176
|
const location = reactRouterDom.useLocation();
|
|
26158
26177
|
const ctxPagePath = useCurrentPagePath();
|
|
26159
26178
|
const activePath = currentPath ?? ctxPagePath ?? location.pathname;
|
|
@@ -26166,15 +26185,15 @@ var init_DashboardLayout = __esm({
|
|
|
26166
26185
|
const showBottomNav = layoutMode === "bottomnav";
|
|
26167
26186
|
const isTopNav = layoutMode === "topnav";
|
|
26168
26187
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
26169
|
-
|
|
26188
|
+
Box,
|
|
26170
26189
|
{
|
|
26171
|
-
|
|
26172
|
-
className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
|
|
26190
|
+
ref: layoutRef,
|
|
26191
|
+
className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
|
|
26173
26192
|
children: [
|
|
26174
|
-
showSidebar && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
26193
|
+
showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
26175
26194
|
Box,
|
|
26176
26195
|
{
|
|
26177
|
-
className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20
|
|
26196
|
+
className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
|
|
26178
26197
|
onClick: () => setSidebarOpen(false)
|
|
26179
26198
|
}
|
|
26180
26199
|
),
|
|
@@ -26184,11 +26203,16 @@ var init_DashboardLayout = __esm({
|
|
|
26184
26203
|
as: "aside",
|
|
26185
26204
|
className: cn(
|
|
26186
26205
|
"z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
|
|
26187
|
-
"
|
|
26188
|
-
"transform transition-transform duration-200 ease-in-out",
|
|
26189
|
-
"flex flex-col",
|
|
26190
|
-
sidebarOpen ? "translate-x-0" : "-translate-x-full"
|
|
26206
|
+
"flex flex-col"
|
|
26191
26207
|
),
|
|
26208
|
+
style: isMobile ? {
|
|
26209
|
+
position: "fixed",
|
|
26210
|
+
top: 0,
|
|
26211
|
+
bottom: 0,
|
|
26212
|
+
left: 0,
|
|
26213
|
+
transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
|
|
26214
|
+
transition: "transform 200ms ease-in-out"
|
|
26215
|
+
} : { position: "static", transform: "none" },
|
|
26192
26216
|
children: [
|
|
26193
26217
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
26194
26218
|
HStack,
|
|
@@ -26217,11 +26241,11 @@ var init_DashboardLayout = __esm({
|
|
|
26217
26241
|
}
|
|
26218
26242
|
)
|
|
26219
26243
|
] }),
|
|
26220
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
26244
|
+
isMobile && /* @__PURE__ */ jsxRuntime.jsx(
|
|
26221
26245
|
Button,
|
|
26222
26246
|
{
|
|
26223
26247
|
variant: "ghost",
|
|
26224
|
-
className: "
|
|
26248
|
+
className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
|
|
26225
26249
|
onClick: () => setSidebarOpen(false),
|
|
26226
26250
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "x", className: "h-5 w-5" })
|
|
26227
26251
|
}
|
|
@@ -26262,11 +26286,11 @@ var init_DashboardLayout = __esm({
|
|
|
26262
26286
|
justify: "between",
|
|
26263
26287
|
className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
|
|
26264
26288
|
children: [
|
|
26265
|
-
showSidebar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
26289
|
+
showSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsx(
|
|
26266
26290
|
Button,
|
|
26267
26291
|
{
|
|
26268
26292
|
variant: "ghost",
|
|
26269
|
-
className: "
|
|
26293
|
+
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",
|
|
26270
26294
|
onClick: () => setSidebarOpen(true),
|
|
26271
26295
|
"aria-label": "Open sidebar",
|
|
26272
26296
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "menu", className: "h-5 w-5" })
|
|
@@ -56359,7 +56383,7 @@ function getToastPosition(position) {
|
|
|
56359
56383
|
return "top-4 right-4";
|
|
56360
56384
|
}
|
|
56361
56385
|
}
|
|
56362
|
-
function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait) {
|
|
56386
|
+
function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait, orbCtx) {
|
|
56363
56387
|
if (children === void 0 || children === null) return null;
|
|
56364
56388
|
const childrenArray = Array.isArray(children) ? children : typeof children === "string" || typeof children === "object" && "type" in children ? [children] : [];
|
|
56365
56389
|
if (childrenArray.length === 0) return null;
|
|
@@ -56390,8 +56414,11 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
56390
56414
|
nodeId: child._id,
|
|
56391
56415
|
// Inherit sourceTrait from the parent slot so nested patterns
|
|
56392
56416
|
// (e.g. form-section inside a stack) can resolve entityDef via
|
|
56393
|
-
// the trait's linkedEntity for form-field enrichment.
|
|
56394
|
-
|
|
56417
|
+
// the trait's linkedEntity for form-field enrichment. The orbCtx
|
|
56418
|
+
// (slot/transition/state/entity) propagates the same way so every
|
|
56419
|
+
// nested node carries a complete contextual-edit address.
|
|
56420
|
+
...sourceTrait !== void 0 && { sourceTrait },
|
|
56421
|
+
...orbCtx ?? {}
|
|
56395
56422
|
};
|
|
56396
56423
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
56397
56424
|
SlotContentRenderer,
|
|
@@ -56507,7 +56534,12 @@ function SlotContentRenderer({
|
|
|
56507
56534
|
const isSingleChild = typeof childrenConfig === "string" || typeof childrenConfig === "object" && childrenConfig !== null && !Array.isArray(childrenConfig) && "type" in childrenConfig;
|
|
56508
56535
|
const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0 || isSingleChild;
|
|
56509
56536
|
const myPath = patternPath ?? "root";
|
|
56510
|
-
const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait
|
|
56537
|
+
const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait, {
|
|
56538
|
+
slot: content.slot,
|
|
56539
|
+
transitionEvent: content.transitionEvent,
|
|
56540
|
+
fromState: content.fromState,
|
|
56541
|
+
entity: content.entity
|
|
56542
|
+
}) : void 0;
|
|
56511
56543
|
const incomingChildren = content.props.children;
|
|
56512
56544
|
const childrenIsRenderFn = typeof incomingChildren === "function";
|
|
56513
56545
|
const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
|
|
@@ -56554,6 +56586,13 @@ function SlotContentRenderer({
|
|
|
56554
56586
|
"data-pattern-path": myPath,
|
|
56555
56587
|
"data-pattern-type": content.pattern,
|
|
56556
56588
|
"data-accepts-children": acceptsChildren ? "true" : void 0,
|
|
56589
|
+
"data-orb-trait": content.sourceTrait,
|
|
56590
|
+
"data-orb-slot": content.slot,
|
|
56591
|
+
"data-orb-transition": content.transitionEvent,
|
|
56592
|
+
"data-orb-state": content.fromState,
|
|
56593
|
+
"data-orb-entity": content.entity,
|
|
56594
|
+
"data-orb-path": myPath,
|
|
56595
|
+
"data-orb-pattern": content.pattern,
|
|
56557
56596
|
children: renderedChildren !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps, children: renderedChildren }) : /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps })
|
|
56558
56597
|
}
|
|
56559
56598
|
);
|
|
@@ -56566,6 +56605,13 @@ function SlotContentRenderer({
|
|
|
56566
56605
|
"data-id": content.id,
|
|
56567
56606
|
"data-node-id": content.nodeId,
|
|
56568
56607
|
"data-source-trait": content.sourceTrait,
|
|
56608
|
+
"data-orb-trait": content.sourceTrait,
|
|
56609
|
+
"data-orb-slot": content.slot,
|
|
56610
|
+
"data-orb-transition": content.transitionEvent,
|
|
56611
|
+
"data-orb-state": content.fromState,
|
|
56612
|
+
"data-orb-entity": content.entity,
|
|
56613
|
+
"data-orb-path": patternPath ?? "root",
|
|
56614
|
+
"data-orb-pattern": content.pattern,
|
|
56569
56615
|
children: content.props.children ?? /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "p-4 text-sm text-muted-foreground border border-dashed border-border rounded", children: [
|
|
56570
56616
|
"Unknown pattern: ",
|
|
56571
56617
|
content.pattern,
|
|
@@ -60417,7 +60463,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60417
60463
|
embeddedTraitsRef.current = options?.embeddedTraits;
|
|
60418
60464
|
}, [options?.embeddedTraits]);
|
|
60419
60465
|
const flushSlot = React98.useCallback(
|
|
60420
|
-
(traitName, slot, patterns) => {
|
|
60466
|
+
(traitName, slot, patterns, source) => {
|
|
60421
60467
|
const slots = uiSlotsRef.current;
|
|
60422
60468
|
const embedded = embeddedTraitsRef.current;
|
|
60423
60469
|
if (patterns.length === 0) {
|
|
@@ -60446,7 +60492,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60446
60492
|
pattern: patternType,
|
|
60447
60493
|
props,
|
|
60448
60494
|
priority: 0,
|
|
60449
|
-
animation: "fade"
|
|
60495
|
+
animation: "fade",
|
|
60496
|
+
transitionEvent: source?.event,
|
|
60497
|
+
fromState: source?.state,
|
|
60498
|
+
entity: source?.entity
|
|
60450
60499
|
});
|
|
60451
60500
|
return;
|
|
60452
60501
|
}
|
|
@@ -60460,7 +60509,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60460
60509
|
target: slot,
|
|
60461
60510
|
pattern: patternType,
|
|
60462
60511
|
props,
|
|
60463
|
-
sourceTrait: traitName
|
|
60512
|
+
sourceTrait: traitName,
|
|
60513
|
+
transitionEvent: source?.event,
|
|
60514
|
+
fromState: source?.state,
|
|
60515
|
+
entity: source?.entity
|
|
60464
60516
|
});
|
|
60465
60517
|
},
|
|
60466
60518
|
[]
|
|
@@ -60593,7 +60645,11 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60593
60645
|
}
|
|
60594
60646
|
}
|
|
60595
60647
|
for (const [slot, patterns] of pendingSlots) {
|
|
60596
|
-
flushSlot(binding.trait.name, slot, patterns
|
|
60648
|
+
flushSlot(binding.trait.name, slot, patterns, {
|
|
60649
|
+
event: `tick:${tick.name}`,
|
|
60650
|
+
state: currentState,
|
|
60651
|
+
entity: binding.linkedEntity
|
|
60652
|
+
});
|
|
60597
60653
|
}
|
|
60598
60654
|
}, [flushSlot]);
|
|
60599
60655
|
React98.useEffect(() => {
|
|
@@ -60845,7 +60901,11 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
60845
60901
|
transition: `${result.previousState}->${result.newState}`,
|
|
60846
60902
|
cleared: patterns.length === 0
|
|
60847
60903
|
});
|
|
60848
|
-
flushSlot(traitName, slot, patterns
|
|
60904
|
+
flushSlot(traitName, slot, patterns, {
|
|
60905
|
+
event: eventKey,
|
|
60906
|
+
state: result.previousState,
|
|
60907
|
+
entity: binding.linkedEntity
|
|
60908
|
+
});
|
|
60849
60909
|
}
|
|
60850
60910
|
} catch (error) {
|
|
60851
60911
|
stateLog.error("transition:effect-error", {
|
|
@@ -62613,15 +62673,9 @@ function buildTransitionSchema(fullSchema, orbitalName, traitName, transitionEve
|
|
|
62613
62673
|
return { ...fullSchema, name: `${fullSchema.name}__${orbitalName}__${traitName}__${transitionEvent}`, orbitals: [clonedOrbital] };
|
|
62614
62674
|
}
|
|
62615
62675
|
var SELECTION_STYLES = `
|
|
62616
|
-
.orb-preview-live [data-pattern]
|
|
62617
|
-
outline: 2px dashed var(--color-primary);
|
|
62618
|
-
outline-offset: 1px;
|
|
62676
|
+
.orb-preview-live [data-pattern] {
|
|
62619
62677
|
cursor: pointer;
|
|
62620
62678
|
}
|
|
62621
|
-
.orb-preview-live [data-pattern].pattern-selected {
|
|
62622
|
-
outline: 2px solid var(--color-primary);
|
|
62623
|
-
outline-offset: 1px;
|
|
62624
|
-
}
|
|
62625
62679
|
.orb-preview-live.drag-active [data-accepts-children="true"] {
|
|
62626
62680
|
outline: 2px dashed var(--color-primary);
|
|
62627
62681
|
outline-offset: -2px;
|
|
@@ -62638,15 +62692,66 @@ var SELECTION_STYLES = `
|
|
|
62638
62692
|
pointer-events: none;
|
|
62639
62693
|
}
|
|
62640
62694
|
`;
|
|
62695
|
+
function absUnion(el) {
|
|
62696
|
+
const own = el.getBoundingClientRect();
|
|
62697
|
+
if (own.width > 0 || own.height > 0) {
|
|
62698
|
+
return { top: own.top, left: own.left, right: own.right, bottom: own.bottom };
|
|
62699
|
+
}
|
|
62700
|
+
let r2 = null;
|
|
62701
|
+
for (const child of Array.from(el.children)) {
|
|
62702
|
+
const box = absUnion(child);
|
|
62703
|
+
if (!box) continue;
|
|
62704
|
+
r2 = r2 ? {
|
|
62705
|
+
top: Math.min(r2.top, box.top),
|
|
62706
|
+
left: Math.min(r2.left, box.left),
|
|
62707
|
+
right: Math.max(r2.right, box.right),
|
|
62708
|
+
bottom: Math.max(r2.bottom, box.bottom)
|
|
62709
|
+
} : box;
|
|
62710
|
+
}
|
|
62711
|
+
return r2;
|
|
62712
|
+
}
|
|
62713
|
+
function rectRelativeTo(el, container) {
|
|
62714
|
+
const u = absUnion(el);
|
|
62715
|
+
if (!u) return null;
|
|
62716
|
+
const base = container.getBoundingClientRect();
|
|
62717
|
+
return { top: u.top - base.top, left: u.left - base.left, width: u.right - u.left, height: u.bottom - u.top };
|
|
62718
|
+
}
|
|
62719
|
+
function buildFocus(el, orbitalName) {
|
|
62720
|
+
if (!orbitalName) return null;
|
|
62721
|
+
const path = el.getAttribute("data-orb-path") ?? el.getAttribute("data-pattern-path");
|
|
62722
|
+
const patternType = el.getAttribute("data-orb-pattern") ?? el.getAttribute("data-pattern");
|
|
62723
|
+
const trait = el.getAttribute("data-orb-trait") ?? el.getAttribute("data-source-trait");
|
|
62724
|
+
const focus = {
|
|
62725
|
+
level: "node",
|
|
62726
|
+
orbital: orbitalName,
|
|
62727
|
+
label: patternType ?? trait ?? "element"
|
|
62728
|
+
};
|
|
62729
|
+
if (path !== null) focus.path = path;
|
|
62730
|
+
if (trait !== null) focus.trait = trait;
|
|
62731
|
+
if (patternType !== null) focus.patternType = patternType;
|
|
62732
|
+
const transition = el.getAttribute("data-orb-transition");
|
|
62733
|
+
if (transition !== null) focus.transition = transition;
|
|
62734
|
+
const state = el.getAttribute("data-orb-state");
|
|
62735
|
+
if (state !== null) focus.state = state;
|
|
62736
|
+
const slot = el.getAttribute("data-orb-slot");
|
|
62737
|
+
if (slot !== null) focus.slot = slot;
|
|
62738
|
+
const entity = el.getAttribute("data-orb-entity");
|
|
62739
|
+
if (entity !== null) focus.entity = entity;
|
|
62740
|
+
return focus;
|
|
62741
|
+
}
|
|
62641
62742
|
var OrbPreviewNodeInner = (props) => {
|
|
62642
62743
|
const data = props.data;
|
|
62643
62744
|
const screenSize = React98.useContext(ScreenSizeContext);
|
|
62644
62745
|
const preset = SCREEN_SIZE_PRESETS[screenSize];
|
|
62645
62746
|
const { select } = React98.useContext(PatternSelectionContext);
|
|
62747
|
+
const eventBus = useEventBus();
|
|
62646
62748
|
const contentRef = React98.useRef(null);
|
|
62647
62749
|
const [hovered, setHovered] = React98.useState(false);
|
|
62648
62750
|
const handleMouseEnter = React98.useCallback(() => setHovered(true), []);
|
|
62649
62751
|
const handleMouseLeave = React98.useCallback(() => setHovered(false), []);
|
|
62752
|
+
const [selectedRect, setSelectedRect] = React98.useState(null);
|
|
62753
|
+
const [hoverRect, setHoverRect] = React98.useState(null);
|
|
62754
|
+
const lastHoverElRef = React98.useRef(null);
|
|
62650
62755
|
const role = data.stateRole ?? "default";
|
|
62651
62756
|
const colors = ROLE_COLORS[role] ?? ROLE_COLORS.default;
|
|
62652
62757
|
const eventSources = data.eventSources ?? [];
|
|
@@ -62679,13 +62784,14 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
62679
62784
|
e.stopPropagation();
|
|
62680
62785
|
const target = e.target;
|
|
62681
62786
|
const patternEl = target.closest("[data-pattern]");
|
|
62682
|
-
contentRef.current
|
|
62787
|
+
const container = contentRef.current;
|
|
62788
|
+
container?.querySelectorAll(".pattern-selected").forEach((el) => {
|
|
62683
62789
|
el.classList.remove("pattern-selected");
|
|
62684
62790
|
});
|
|
62685
|
-
if (patternEl) {
|
|
62791
|
+
if (patternEl && container) {
|
|
62686
62792
|
patternEl.classList.add("pattern-selected");
|
|
62687
|
-
const
|
|
62688
|
-
|
|
62793
|
+
const rect = rectRelativeTo(patternEl, container);
|
|
62794
|
+
setSelectedRect(rect);
|
|
62689
62795
|
select({
|
|
62690
62796
|
patternType: patternEl.getAttribute("data-pattern") ?? "unknown",
|
|
62691
62797
|
// `data-pattern-path` is the SExpr tree path (`children.0.…`) emitted by
|
|
@@ -62696,18 +62802,33 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
62696
62802
|
patternId: patternEl.getAttribute("data-pattern-path") ?? void 0,
|
|
62697
62803
|
sourceTrait: patternEl.getAttribute("data-source-trait") ?? void 0,
|
|
62698
62804
|
nodeData: data,
|
|
62699
|
-
rect:
|
|
62700
|
-
top: elRect.top - nodeRect.top,
|
|
62701
|
-
left: elRect.left - nodeRect.left,
|
|
62702
|
-
width: elRect.width,
|
|
62703
|
-
height: elRect.height
|
|
62704
|
-
} : void 0
|
|
62805
|
+
rect: rect ?? void 0
|
|
62705
62806
|
});
|
|
62807
|
+
const focus = buildFocus(patternEl, data.orbitalName);
|
|
62808
|
+
if (focus) eventBus.emit("UI:ELEMENT_SELECTED", { focus: { ...focus } });
|
|
62706
62809
|
} else {
|
|
62810
|
+
setSelectedRect(null);
|
|
62707
62811
|
select(null);
|
|
62708
|
-
|
|
62709
|
-
|
|
62710
|
-
|
|
62812
|
+
eventBus.emit("UI:ELEMENT_SELECTED", { focus: null });
|
|
62813
|
+
}
|
|
62814
|
+
}, [data, select, eventBus]);
|
|
62815
|
+
const handleContentMouseMove = React98.useCallback((e) => {
|
|
62816
|
+
const container = contentRef.current;
|
|
62817
|
+
if (!container) return;
|
|
62818
|
+
const el = e.target.closest("[data-pattern]");
|
|
62819
|
+
if (el === lastHoverElRef.current) return;
|
|
62820
|
+
lastHoverElRef.current = el;
|
|
62821
|
+
setHoverRect(el ? rectRelativeTo(el, container) : null);
|
|
62822
|
+
}, []);
|
|
62823
|
+
const handleContentMouseLeave = React98.useCallback(() => {
|
|
62824
|
+
lastHoverElRef.current = null;
|
|
62825
|
+
setHoverRect(null);
|
|
62826
|
+
}, []);
|
|
62827
|
+
React98.useEffect(() => {
|
|
62828
|
+
setSelectedRect(null);
|
|
62829
|
+
setHoverRect(null);
|
|
62830
|
+
lastHoverElRef.current = null;
|
|
62831
|
+
}, [orbitalSchema]);
|
|
62711
62832
|
const [dragActive, setDragActive] = React98.useState(false);
|
|
62712
62833
|
React98.useEffect(() => {
|
|
62713
62834
|
const unsub1 = eventBus.on("UI:DRAG_START", (e) => {
|
|
@@ -62926,26 +63047,66 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
62926
63047
|
src.event
|
|
62927
63048
|
)) })
|
|
62928
63049
|
] }),
|
|
62929
|
-
/* @__PURE__ */ jsxRuntime.
|
|
63050
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
62930
63051
|
Box,
|
|
62931
63052
|
{
|
|
62932
63053
|
ref: setContentRef,
|
|
62933
|
-
className: `orb-preview-live nodrag${dragActive || l2IsOver ? " drag-active" : ""}`,
|
|
63054
|
+
className: `orb-preview-live nodrag relative${dragActive || l2IsOver ? " drag-active" : ""}`,
|
|
62934
63055
|
onClick: handleContentClick,
|
|
62935
|
-
|
|
62936
|
-
|
|
62937
|
-
|
|
62938
|
-
|
|
62939
|
-
|
|
62940
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { style: { minHeight: preset.minHeight }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
62941
|
-
BrowserPlayground,
|
|
63056
|
+
onMouseMove: handleContentMouseMove,
|
|
63057
|
+
onMouseLeave: handleContentMouseLeave,
|
|
63058
|
+
children: [
|
|
63059
|
+
hoverRect && /* @__PURE__ */ jsxRuntime.jsx(
|
|
63060
|
+
"div",
|
|
62942
63061
|
{
|
|
62943
|
-
|
|
62944
|
-
|
|
62945
|
-
|
|
63062
|
+
"aria-hidden": true,
|
|
63063
|
+
style: {
|
|
63064
|
+
position: "absolute",
|
|
63065
|
+
pointerEvents: "none",
|
|
63066
|
+
top: hoverRect.top,
|
|
63067
|
+
left: hoverRect.left,
|
|
63068
|
+
width: hoverRect.width,
|
|
63069
|
+
height: hoverRect.height,
|
|
63070
|
+
outline: "2px dashed var(--color-primary)",
|
|
63071
|
+
outlineOffset: "1px",
|
|
63072
|
+
borderRadius: "2px",
|
|
63073
|
+
zIndex: 20
|
|
63074
|
+
}
|
|
62946
63075
|
}
|
|
62947
|
-
)
|
|
62948
|
-
|
|
63076
|
+
),
|
|
63077
|
+
selectedRect && /* @__PURE__ */ jsxRuntime.jsx(
|
|
63078
|
+
"div",
|
|
63079
|
+
{
|
|
63080
|
+
"aria-hidden": true,
|
|
63081
|
+
style: {
|
|
63082
|
+
position: "absolute",
|
|
63083
|
+
pointerEvents: "none",
|
|
63084
|
+
top: selectedRect.top,
|
|
63085
|
+
left: selectedRect.left,
|
|
63086
|
+
width: selectedRect.width,
|
|
63087
|
+
height: selectedRect.height,
|
|
63088
|
+
outline: "2px solid var(--color-primary)",
|
|
63089
|
+
outlineOffset: "1px",
|
|
63090
|
+
borderRadius: "2px",
|
|
63091
|
+
zIndex: 21
|
|
63092
|
+
}
|
|
63093
|
+
}
|
|
63094
|
+
),
|
|
63095
|
+
orbitalSchema ? (
|
|
63096
|
+
// L1 and L2 both auto-grow with content. L2's `buildTransitionSchema`
|
|
63097
|
+
// rewrites portal slots (modal/drawer/overlay/center) to `main`, so
|
|
63098
|
+
// the rendered pattern lands inline in the main slot and contributes
|
|
63099
|
+
// to the card's height — same height model as L1 orbital cards.
|
|
63100
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { style: { minHeight: preset.minHeight }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
63101
|
+
BrowserPlayground,
|
|
63102
|
+
{
|
|
63103
|
+
schema: orbitalSchema,
|
|
63104
|
+
mode: "mock",
|
|
63105
|
+
height: "auto"
|
|
63106
|
+
}
|
|
63107
|
+
) })
|
|
63108
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex items-center justify-center", style: { minHeight: preset.minHeight }, children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", className: "text-muted-foreground", children: "No preview available" }) })
|
|
63109
|
+
]
|
|
62949
63110
|
}
|
|
62950
63111
|
),
|
|
62951
63112
|
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "target", position: react.Position.Left, style: TARGET_HANDLE_STYLE }),
|