@almadar/ui 6.28.0 → 6.29.0
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/{EntityBindingContext-C6FgxdfG.d.cts → EntityBindingContext-UyeCfEBS.d.cts} +13 -0
- package/dist/{EntityBindingContext-C6FgxdfG.d.ts → EntityBindingContext-UyeCfEBS.d.ts} +13 -0
- package/dist/avl/index.cjs +69 -42
- package/dist/avl/index.js +69 -42
- package/dist/components/index.cjs +50 -40
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +50 -40
- package/dist/providers/index.cjs +51 -40
- package/dist/providers/index.d.cts +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +51 -40
- package/dist/runtime/index.cjs +69 -42
- package/dist/runtime/index.d.cts +16 -2
- package/dist/runtime/index.d.ts +16 -2
- package/dist/runtime/index.js +69 -42
- package/package.json +5 -5
package/dist/runtime/index.js
CHANGED
|
@@ -2862,6 +2862,13 @@ var init_slot_types = __esm({
|
|
|
2862
2862
|
nextRefId = 1;
|
|
2863
2863
|
}
|
|
2864
2864
|
});
|
|
2865
|
+
var SlotContainedContext;
|
|
2866
|
+
var init_slotContained = __esm({
|
|
2867
|
+
"lib/slotContained.ts"() {
|
|
2868
|
+
"use client";
|
|
2869
|
+
SlotContainedContext = createContext(false);
|
|
2870
|
+
}
|
|
2871
|
+
});
|
|
2865
2872
|
function buildForkPaths(x, y, branches, scale) {
|
|
2866
2873
|
const inLength = 30 * scale;
|
|
2867
2874
|
const outLength = 30 * scale;
|
|
@@ -35623,7 +35630,6 @@ function TableView({
|
|
|
35623
35630
|
columns,
|
|
35624
35631
|
fields,
|
|
35625
35632
|
itemActions,
|
|
35626
|
-
maxInlineActions,
|
|
35627
35633
|
itemClickEvent = "",
|
|
35628
35634
|
selectable = false,
|
|
35629
35635
|
selectEvent,
|
|
@@ -35657,8 +35663,7 @@ function TableView({
|
|
|
35657
35663
|
const [localSelected, setLocalSelected] = React87__default.useState(/* @__PURE__ */ new Set());
|
|
35658
35664
|
const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
|
|
35659
35665
|
const actionDefs = Array.isArray(itemActions) ? itemActions : [];
|
|
35660
|
-
const
|
|
35661
|
-
const overflowActions = maxInlineActions != null ? actionDefs.slice(maxInlineActions) : actionDefs;
|
|
35666
|
+
const overflowActions = actionDefs;
|
|
35662
35667
|
const fireAction = (action, row) => eventBus.emit(`UI:${action.event}`, {
|
|
35663
35668
|
id: row.id,
|
|
35664
35669
|
row
|
|
@@ -35840,7 +35845,7 @@ function TableView({
|
|
|
35840
35845
|
}
|
|
35841
35846
|
return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate text-foreground", children: formatCell(raw, col.format, relationsData?.[col.field ?? col.key]) }) }, col.key);
|
|
35842
35847
|
}),
|
|
35843
|
-
hasActions && /* @__PURE__ */
|
|
35848
|
+
hasActions && /* @__PURE__ */ jsx(
|
|
35844
35849
|
HStack,
|
|
35845
35850
|
{
|
|
35846
35851
|
gap: "xs",
|
|
@@ -35854,38 +35859,20 @@ function TableView({
|
|
|
35854
35859
|
"border-l border-[var(--color-border)]",
|
|
35855
35860
|
lk.striped && index % 2 === 1 ? "bg-[var(--color-surface-subtle)]" : "bg-[var(--color-card)] group-hover:bg-[var(--color-surface-subtle)]"
|
|
35856
35861
|
),
|
|
35857
|
-
children:
|
|
35858
|
-
|
|
35859
|
-
|
|
35860
|
-
|
|
35861
|
-
|
|
35862
|
-
|
|
35863
|
-
|
|
35864
|
-
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
|
|
35868
|
-
|
|
35869
|
-
|
|
35870
|
-
|
|
35871
|
-
},
|
|
35872
|
-
action.event
|
|
35873
|
-
)),
|
|
35874
|
-
overflowActions.length > 0 && /* @__PURE__ */ jsx(
|
|
35875
|
-
Menu,
|
|
35876
|
-
{
|
|
35877
|
-
position: "bottom-end",
|
|
35878
|
-
trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", "data-row-id": String(row.id), children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
35879
|
-
items: overflowActions.map((action) => ({
|
|
35880
|
-
label: action.label,
|
|
35881
|
-
icon: action.icon,
|
|
35882
|
-
event: action.event,
|
|
35883
|
-
variant: action.variant === "danger" ? "danger" : "default",
|
|
35884
|
-
onClick: () => fireAction(action, row)
|
|
35885
|
-
}))
|
|
35886
|
-
}
|
|
35887
|
-
)
|
|
35888
|
-
]
|
|
35862
|
+
children: overflowActions.length > 0 && /* @__PURE__ */ jsx(
|
|
35863
|
+
Menu,
|
|
35864
|
+
{
|
|
35865
|
+
position: "bottom-end",
|
|
35866
|
+
trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", "data-row-id": String(row.id), children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
35867
|
+
items: overflowActions.map((action) => ({
|
|
35868
|
+
label: action.label,
|
|
35869
|
+
icon: action.icon,
|
|
35870
|
+
event: action.event,
|
|
35871
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
35872
|
+
onClick: () => fireAction(action, row)
|
|
35873
|
+
}))
|
|
35874
|
+
}
|
|
35875
|
+
)
|
|
35889
35876
|
}
|
|
35890
35877
|
)
|
|
35891
35878
|
]
|
|
@@ -45173,6 +45160,7 @@ var init_DetailPanel = __esm({
|
|
|
45173
45160
|
init_EmptyState();
|
|
45174
45161
|
init_cn();
|
|
45175
45162
|
init_portalRoot();
|
|
45163
|
+
init_slotContained();
|
|
45176
45164
|
init_format();
|
|
45177
45165
|
init_getNestedValue();
|
|
45178
45166
|
init_relationLabel();
|
|
@@ -45204,6 +45192,7 @@ var init_DetailPanel = __esm({
|
|
|
45204
45192
|
}) => {
|
|
45205
45193
|
const eventBus = useEventBus();
|
|
45206
45194
|
const { t } = useTranslate();
|
|
45195
|
+
const contained = useContext(SlotContainedContext);
|
|
45207
45196
|
const [titleDraft, setTitleDraft] = React87__default.useState(null);
|
|
45208
45197
|
const isFieldDefArray = (arr) => {
|
|
45209
45198
|
if (!arr || arr.length === 0) return false;
|
|
@@ -45591,8 +45580,9 @@ var init_DetailPanel = __esm({
|
|
|
45591
45580
|
if (!slideOver) {
|
|
45592
45581
|
return /* @__PURE__ */ jsx(Box, { className, children: content });
|
|
45593
45582
|
}
|
|
45594
|
-
const panel = /* @__PURE__ */ jsx(Box, { className: cn("fixed inset-y-0 right-0 w-full max-w-2xl bg-card shadow-lg z-50 overflow-y-auto p-6", className), children: content });
|
|
45595
|
-
|
|
45583
|
+
const panel = /* @__PURE__ */ jsx(Box, { className: cn(contained ? "absolute" : "fixed", "inset-y-0 right-0 w-full max-w-2xl bg-card shadow-lg z-50 overflow-y-auto p-6", className), children: content });
|
|
45584
|
+
if (contained || typeof document === "undefined") return panel;
|
|
45585
|
+
return createPortal(panel, getOrCreatePortalRoot());
|
|
45596
45586
|
};
|
|
45597
45587
|
DetailPanel.displayName = "DetailPanel";
|
|
45598
45588
|
}
|
|
@@ -52089,6 +52079,7 @@ var init_component_registry_generated = __esm({
|
|
|
52089
52079
|
// components/core/organisms/UISlotRenderer.tsx
|
|
52090
52080
|
var UISlotRenderer_exports = {};
|
|
52091
52081
|
__export(UISlotRenderer_exports, {
|
|
52082
|
+
SlotContainedContext: () => SlotContainedContext,
|
|
52092
52083
|
SlotContentRenderer: () => SlotContentRenderer,
|
|
52093
52084
|
SuspenseConfigProvider: () => SuspenseConfigProvider,
|
|
52094
52085
|
UISlotComponent: () => UISlotComponent,
|
|
@@ -52261,6 +52252,25 @@ function renderContainedPortal(t, slot, content, onDismiss) {
|
|
|
52261
52252
|
}
|
|
52262
52253
|
);
|
|
52263
52254
|
case "drawer":
|
|
52255
|
+
if (content.pattern === "detail-panel" && content.props.slideOver === true) {
|
|
52256
|
+
return /* @__PURE__ */ jsx(
|
|
52257
|
+
Box,
|
|
52258
|
+
{
|
|
52259
|
+
id: slotId,
|
|
52260
|
+
className: "absolute inset-0 z-50 overflow-hidden",
|
|
52261
|
+
style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
|
|
52262
|
+
onClick: onDismiss,
|
|
52263
|
+
children: /* @__PURE__ */ jsx(
|
|
52264
|
+
Box,
|
|
52265
|
+
{
|
|
52266
|
+
className: "absolute inset-y-0 right-0 pointer-events-auto",
|
|
52267
|
+
onClick: (e) => e.stopPropagation(),
|
|
52268
|
+
children: slotContent
|
|
52269
|
+
}
|
|
52270
|
+
)
|
|
52271
|
+
}
|
|
52272
|
+
);
|
|
52273
|
+
}
|
|
52264
52274
|
return /* @__PURE__ */ jsx(
|
|
52265
52275
|
Box,
|
|
52266
52276
|
{
|
|
@@ -53112,7 +53122,7 @@ function UISlotRenderer({
|
|
|
53112
53122
|
}
|
|
53113
53123
|
return wrapped;
|
|
53114
53124
|
}
|
|
53115
|
-
var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext,
|
|
53125
|
+
var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SLOT_SKELETON_MAP, CONTENT_NODE_SLOTS, PATTERNS_WITH_CHILDREN, traitRefPresenceCache;
|
|
53116
53126
|
var init_UISlotRenderer = __esm({
|
|
53117
53127
|
"components/core/organisms/UISlotRenderer.tsx"() {
|
|
53118
53128
|
"use client";
|
|
@@ -53127,6 +53137,7 @@ var init_UISlotRenderer = __esm({
|
|
|
53127
53137
|
init_cn();
|
|
53128
53138
|
init_format();
|
|
53129
53139
|
init_portalRoot();
|
|
53140
|
+
init_slotContained();
|
|
53130
53141
|
init_ErrorBoundary();
|
|
53131
53142
|
init_Skeleton();
|
|
53132
53143
|
init_renderer();
|
|
@@ -53136,7 +53147,6 @@ var init_UISlotRenderer = __esm({
|
|
|
53136
53147
|
scopeWrapLog = createLogger("almadar:ui:scope-wrap");
|
|
53137
53148
|
TRAIT_BINDING_RE = /^@trait\.([A-Z][A-Za-z0-9]*)$/;
|
|
53138
53149
|
SuspenseConfigContext = createContext({ enabled: false });
|
|
53139
|
-
SlotContainedContext = createContext(false);
|
|
53140
53150
|
SuspenseConfigProvider.displayName = "SuspenseConfigProvider";
|
|
53141
53151
|
SLOT_SKELETON_MAP = {
|
|
53142
53152
|
main: "table",
|
|
@@ -54604,6 +54614,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
54604
54614
|
const normalizedEvent = normalizeEventKey(eventKey);
|
|
54605
54615
|
return managerRef.current.canHandleEvent(traitName, normalizedEvent);
|
|
54606
54616
|
}, []);
|
|
54617
|
+
const commitServerEntity = useCallback((traitName, entity) => {
|
|
54618
|
+
traitFieldStatesRef.current.set(traitName, entity);
|
|
54619
|
+
}, []);
|
|
54607
54620
|
useEffect(() => {
|
|
54608
54621
|
const allEvents = /* @__PURE__ */ new Set();
|
|
54609
54622
|
for (const binding of traitBindings) {
|
|
@@ -54767,7 +54780,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
54767
54780
|
sendEvent,
|
|
54768
54781
|
getTraitState,
|
|
54769
54782
|
canHandleEvent,
|
|
54770
|
-
entityBindingSource
|
|
54783
|
+
entityBindingSource,
|
|
54784
|
+
commitServerEntity
|
|
54771
54785
|
};
|
|
54772
54786
|
}
|
|
54773
54787
|
var resolvedSchemaLog = createLogger("almadar:ui:resolved-schema");
|
|
@@ -55006,6 +55020,8 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
|
|
|
55006
55020
|
[serverActiveTraits]
|
|
55007
55021
|
);
|
|
55008
55022
|
const uiSlots = useUISlots();
|
|
55023
|
+
const commitServerEntityRef = useRef(() => {
|
|
55024
|
+
});
|
|
55009
55025
|
const onEventProcessed = useCallback((event, payload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted, results, entityByTrait) => {
|
|
55010
55026
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
55011
55027
|
const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
|
|
@@ -55022,12 +55038,18 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
|
|
|
55022
55038
|
}
|
|
55023
55039
|
void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted, results, entityByTrait, user ?? void 0).then(({ effects, meta }) => {
|
|
55024
55040
|
recordServerResponse(name, event, { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
|
|
55041
|
+
if (meta.entityByTrait) {
|
|
55042
|
+
for (const [traitName, entity] of Object.entries(meta.entityByTrait)) {
|
|
55043
|
+
commitServerEntityRef.current(traitName, entity);
|
|
55044
|
+
}
|
|
55045
|
+
}
|
|
55025
55046
|
applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNamesRef.current, onNavigateBack);
|
|
55026
55047
|
});
|
|
55027
55048
|
}
|
|
55028
55049
|
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits, user]);
|
|
55029
55050
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, navigateBack: onNavigateBack, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, initPayload: routeParams } : { navigate: onNavigate, navigateBack: onNavigateBack, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, initPayload: routeParams };
|
|
55030
|
-
const { sendEvent, entityBindingSource } = useTraitStateMachine(traits2, uiSlots, opts);
|
|
55051
|
+
const { sendEvent, entityBindingSource, commitServerEntity } = useTraitStateMachine(traits2, uiSlots, opts);
|
|
55052
|
+
commitServerEntityRef.current = commitServerEntity;
|
|
55031
55053
|
const initSentRef = useRef(false);
|
|
55032
55054
|
const prevTraitsRef = useRef(void 0);
|
|
55033
55055
|
const paramsKey = JSON.stringify(routeParams ?? {});
|
|
@@ -55079,6 +55101,11 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
|
|
|
55079
55101
|
user ?? void 0
|
|
55080
55102
|
);
|
|
55081
55103
|
recordServerResponse(name, "INIT", { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
|
|
55104
|
+
if (meta.entityByTrait) {
|
|
55105
|
+
for (const [traitName, entity] of Object.entries(meta.entityByTrait)) {
|
|
55106
|
+
commitServerEntityRef.current(traitName, entity);
|
|
55107
|
+
}
|
|
55108
|
+
}
|
|
55082
55109
|
const effectTraces = [
|
|
55083
55110
|
{ type: "fetch", args: [], status: "executed" },
|
|
55084
55111
|
...effects.map((eff) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.29.0",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
"access": "public"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
|
-
"@almadar/core": "^10.
|
|
122
|
-
"@almadar/evaluator": "^2.
|
|
121
|
+
"@almadar/core": "^10.96.0",
|
|
122
|
+
"@almadar/evaluator": "^2.47.0",
|
|
123
123
|
"@almadar/logger": "^1.12.0",
|
|
124
|
-
"@almadar/runtime": "^6.
|
|
125
|
-
"@almadar/std": "^16.
|
|
124
|
+
"@almadar/runtime": "^6.83.0",
|
|
125
|
+
"@almadar/std": "^16.220.0",
|
|
126
126
|
"@almadar/syntax": "^1.17.0",
|
|
127
127
|
"@dnd-kit/core": "^6.3.1",
|
|
128
128
|
"@dnd-kit/sortable": "^10.0.0",
|