@almadar/ui 4.0.1 → 4.2.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 +231 -134
- package/dist/avl/index.js +231 -134
- package/dist/components/index.cjs +227 -102
- package/dist/components/index.js +227 -102
- package/dist/components/molecules/DataGrid.d.ts +10 -0
- package/dist/context/index.cjs +204 -100
- package/dist/context/index.js +204 -100
- package/dist/hooks/index.cjs +204 -100
- package/dist/hooks/index.js +204 -100
- package/dist/hooks/useUISlots.d.ts +22 -5
- package/dist/providers/index.cjs +23 -2
- package/dist/providers/index.js +23 -2
- package/dist/runtime/index.cjs +52 -31
- package/dist/runtime/index.js +52 -31
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -18337,6 +18337,16 @@ function statusVariant2(value) {
|
|
|
18337
18337
|
if (["new", "created", "scheduled", "queued", "info"].includes(v)) return "info";
|
|
18338
18338
|
return "default";
|
|
18339
18339
|
}
|
|
18340
|
+
function resolveBadgeVariant(field, value) {
|
|
18341
|
+
const fromMap = field.colorMap?.[value];
|
|
18342
|
+
if (fromMap) {
|
|
18343
|
+
const normalised = fromMap === "destructive" ? "danger" : fromMap;
|
|
18344
|
+
if (BADGE_VARIANTS.has(normalised)) {
|
|
18345
|
+
return normalised;
|
|
18346
|
+
}
|
|
18347
|
+
}
|
|
18348
|
+
return statusVariant2(value);
|
|
18349
|
+
}
|
|
18340
18350
|
function formatDate2(value) {
|
|
18341
18351
|
if (!value) return "";
|
|
18342
18352
|
const d = new Date(String(value));
|
|
@@ -18550,7 +18560,7 @@ function DataGrid({
|
|
|
18550
18560
|
if (val === void 0 || val === null) return null;
|
|
18551
18561
|
return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "items-center", children: [
|
|
18552
18562
|
field.icon && /* @__PURE__ */ jsx(Icon, { name: field.icon, size: "xs" }),
|
|
18553
|
-
/* @__PURE__ */ jsx(Badge, { variant:
|
|
18563
|
+
/* @__PURE__ */ jsx(Badge, { variant: resolveBadgeVariant(field, String(val)), children: String(val) })
|
|
18554
18564
|
] }, field.name);
|
|
18555
18565
|
}) })
|
|
18556
18566
|
] }),
|
|
@@ -18643,7 +18653,7 @@ function DataGrid({
|
|
|
18643
18653
|
)
|
|
18644
18654
|
] });
|
|
18645
18655
|
}
|
|
18646
|
-
var gapStyles6;
|
|
18656
|
+
var BADGE_VARIANTS, gapStyles6;
|
|
18647
18657
|
var init_DataGrid = __esm({
|
|
18648
18658
|
"components/molecules/DataGrid.tsx"() {
|
|
18649
18659
|
"use client";
|
|
@@ -18658,6 +18668,17 @@ var init_DataGrid = __esm({
|
|
|
18658
18668
|
init_Button();
|
|
18659
18669
|
init_Icon();
|
|
18660
18670
|
init_InfiniteScrollSentinel();
|
|
18671
|
+
BADGE_VARIANTS = /* @__PURE__ */ new Set([
|
|
18672
|
+
"default",
|
|
18673
|
+
"primary",
|
|
18674
|
+
"secondary",
|
|
18675
|
+
"success",
|
|
18676
|
+
"warning",
|
|
18677
|
+
"danger",
|
|
18678
|
+
"error",
|
|
18679
|
+
"info",
|
|
18680
|
+
"neutral"
|
|
18681
|
+
]);
|
|
18661
18682
|
gapStyles6 = {
|
|
18662
18683
|
none: "gap-0",
|
|
18663
18684
|
sm: "gap-2",
|
|
@@ -37783,6 +37804,34 @@ var init_UISlotRenderer = __esm({
|
|
|
37783
37804
|
|
|
37784
37805
|
// hooks/index.ts
|
|
37785
37806
|
init_useEventBus();
|
|
37807
|
+
var ALL_SLOTS = [
|
|
37808
|
+
"main",
|
|
37809
|
+
"sidebar",
|
|
37810
|
+
"modal",
|
|
37811
|
+
"drawer",
|
|
37812
|
+
"overlay",
|
|
37813
|
+
"center",
|
|
37814
|
+
"toast",
|
|
37815
|
+
"hud-top",
|
|
37816
|
+
"hud-bottom",
|
|
37817
|
+
"hud-left",
|
|
37818
|
+
"hud-right",
|
|
37819
|
+
"floating"
|
|
37820
|
+
];
|
|
37821
|
+
ALL_SLOTS.reduce(
|
|
37822
|
+
(acc, slot) => {
|
|
37823
|
+
acc[slot] = null;
|
|
37824
|
+
return acc;
|
|
37825
|
+
},
|
|
37826
|
+
{}
|
|
37827
|
+
);
|
|
37828
|
+
ALL_SLOTS.reduce(
|
|
37829
|
+
(acc, slot) => {
|
|
37830
|
+
acc[slot] = {};
|
|
37831
|
+
return acc;
|
|
37832
|
+
},
|
|
37833
|
+
{}
|
|
37834
|
+
);
|
|
37786
37835
|
|
|
37787
37836
|
// hooks/useUIEvents.ts
|
|
37788
37837
|
init_useEventBus();
|
|
@@ -38825,13 +38874,11 @@ function SlotBridge() {
|
|
|
38825
38874
|
return null;
|
|
38826
38875
|
}
|
|
38827
38876
|
function applyServerEffects(effects, uiSlots, onNavigate) {
|
|
38828
|
-
const perSlotRenders = /* @__PURE__ */ new Map();
|
|
38829
38877
|
for (const eff of effects) {
|
|
38830
38878
|
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
38831
38879
|
const patternRecord = eff.pattern;
|
|
38832
38880
|
const { type: patternType, children, ...inlineProps } = patternRecord;
|
|
38833
38881
|
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
38834
|
-
const sourceTrait = eff.traitName ?? "server";
|
|
38835
38882
|
uiSlots.render({
|
|
38836
38883
|
target: eff.slot,
|
|
38837
38884
|
pattern: patternType,
|
|
@@ -38839,38 +38886,12 @@ function applyServerEffects(effects, uiSlots, onNavigate) {
|
|
|
38839
38886
|
...inlineProps,
|
|
38840
38887
|
...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
|
|
38841
38888
|
},
|
|
38842
|
-
sourceTrait
|
|
38843
|
-
});
|
|
38844
|
-
const bucket = perSlotRenders.get(eff.slot) ?? [];
|
|
38845
|
-
bucket.push({
|
|
38846
|
-
sourceTrait,
|
|
38847
|
-
pattern: {
|
|
38848
|
-
type: patternType,
|
|
38849
|
-
...inlineProps,
|
|
38850
|
-
...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
|
|
38851
|
-
}
|
|
38889
|
+
sourceTrait: eff.traitName ?? "server"
|
|
38852
38890
|
});
|
|
38853
|
-
perSlotRenders.set(eff.slot, bucket);
|
|
38854
38891
|
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
38855
38892
|
onNavigate(eff.route, eff.params);
|
|
38856
38893
|
}
|
|
38857
38894
|
}
|
|
38858
|
-
for (const [slot, bucket] of perSlotRenders) {
|
|
38859
|
-
const distinctSources = new Set(bucket.map((b) => b.sourceTrait));
|
|
38860
|
-
if (distinctSources.size <= 1) continue;
|
|
38861
|
-
uiSlots.render({
|
|
38862
|
-
target: slot,
|
|
38863
|
-
pattern: "stack",
|
|
38864
|
-
props: {
|
|
38865
|
-
direction: "vertical",
|
|
38866
|
-
gap: "lg",
|
|
38867
|
-
children: bucket.map((b) => b.pattern)
|
|
38868
|
-
},
|
|
38869
|
-
// Use a synthetic wrapper source trait; individual traits' frames
|
|
38870
|
-
// already live in the per-trait index from the per-effect loop.
|
|
38871
|
-
sourceTrait: "__multi_source_stack__"
|
|
38872
|
-
});
|
|
38873
|
-
}
|
|
38874
38895
|
}
|
|
38875
38896
|
function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback, persistence }) {
|
|
38876
38897
|
const slotsActions = useSlotsActions();
|