@almadar/ui 4.22.1 → 4.22.3

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.
@@ -10268,6 +10268,25 @@ var init_renderer = __esm({
10268
10268
  init_init();
10269
10269
  }
10270
10270
  });
10271
+
10272
+ // runtime/wrapCallbackForEvent.ts
10273
+ function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
10274
+ const argNames = (callbackArgs ?? []).map((a) => a.name);
10275
+ if (argNames.length === 0) {
10276
+ return () => emit(qualifiedEvent);
10277
+ }
10278
+ return (...args) => {
10279
+ const payload = {};
10280
+ for (let i = 0; i < argNames.length; i += 1) {
10281
+ payload[argNames[i]] = args[i];
10282
+ }
10283
+ emit(qualifiedEvent, payload);
10284
+ };
10285
+ }
10286
+ var init_wrapCallbackForEvent = __esm({
10287
+ "runtime/wrapCallbackForEvent.ts"() {
10288
+ }
10289
+ });
10271
10290
  var variantBorderClasses, variantIconColors, iconMap3, Alert;
10272
10291
  var init_Alert = __esm({
10273
10292
  "components/molecules/Alert.tsx"() {
@@ -47070,6 +47089,7 @@ function SlotContentRenderer({
47070
47089
  );
47071
47090
  }
47072
47091
  }
47092
+ const eventBus = useEventBus();
47073
47093
  const schemaCtx = useEntitySchemaOptional();
47074
47094
  let entityDef;
47075
47095
  if (typeof entityProp === "string" && entityProp.length > 0 && schemaCtx) {
@@ -47091,6 +47111,20 @@ function SlotContentRenderer({
47091
47111
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
47092
47112
  const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
47093
47113
  const renderedProps = renderPatternProps(restProps, onDismiss);
47114
+ const patternDef = patterns.getPatternDefinition(content.pattern);
47115
+ const propsSchema = patternDef?.propsSchema;
47116
+ if (propsSchema) {
47117
+ for (const [propKey, propValue] of Object.entries(renderedProps)) {
47118
+ if (typeof propValue !== "string") continue;
47119
+ const propDef = propsSchema[propKey];
47120
+ if (!propDef || propDef.kind !== "callback") continue;
47121
+ renderedProps[propKey] = wrapCallbackForEvent(
47122
+ `UI:${propValue}`,
47123
+ propDef.callbackArgs,
47124
+ (eventKey, payload) => eventBus.emit(eventKey, payload)
47125
+ );
47126
+ }
47127
+ }
47094
47128
  const finalProps = renderedProps;
47095
47129
  const resolvedItems = Array.isArray(
47096
47130
  finalProps.entity
@@ -47217,6 +47251,7 @@ var init_UISlotRenderer = __esm({
47217
47251
  init_logger();
47218
47252
  init_Skeleton();
47219
47253
  init_renderer();
47254
+ init_wrapCallbackForEvent();
47220
47255
  init_TraitFrame();
47221
47256
  init_component_registry_generated();
47222
47257
  scopeWrapLog = createLogger("almadar:ui:scope-wrap");
package/dist/avl/index.js CHANGED
@@ -5,7 +5,7 @@ import React127__default, { createContext, useContext, useRef, useState, useCall
5
5
  import * as LucideIcons from 'lucide-react';
6
6
  import { Loader2, ChevronDown, X, Check, Copy, AlertTriangle, Info, AlertCircle, CheckCircle, List, Printer, ChevronRight, ChevronLeft, Code, FileText, WrapText, Trash2, Settings, Menu as Menu$1, Search, Bell, LogOut, ZoomOut, ZoomIn, Download, FileQuestion, Inbox, XCircle, Filter, Plus, Pause, Play, RotateCcw, Package, Calendar, Pencil, Eye, MoreHorizontal, Image as Image$1, Upload, Minus, ArrowLeft, HelpCircle, ChevronUp, Eraser, Star, TrendingUp, TrendingDown, ArrowUp, ArrowDown, MoreVertical, Sun, Moon, Circle, Clock, CheckCircle2, ArrowRight, FileWarning, SkipForward, Bug, Send, Wrench, User, Tag, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
7
7
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
8
- import { getComponentForPattern as getComponentForPattern$1, getPatternDefinition, isEntityAwarePattern } from '@almadar/patterns';
8
+ import { getPatternDefinition, getComponentForPattern as getComponentForPattern$1, isEntityAwarePattern } from '@almadar/patterns';
9
9
  import { createPortal } from 'react-dom';
10
10
  import { Link, Outlet, useLocation } from 'react-router-dom';
11
11
  import ReactMarkdown from 'react-markdown';
@@ -10222,6 +10222,25 @@ var init_renderer = __esm({
10222
10222
  init_init();
10223
10223
  }
10224
10224
  });
10225
+
10226
+ // runtime/wrapCallbackForEvent.ts
10227
+ function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
10228
+ const argNames = (callbackArgs ?? []).map((a) => a.name);
10229
+ if (argNames.length === 0) {
10230
+ return () => emit(qualifiedEvent);
10231
+ }
10232
+ return (...args) => {
10233
+ const payload = {};
10234
+ for (let i = 0; i < argNames.length; i += 1) {
10235
+ payload[argNames[i]] = args[i];
10236
+ }
10237
+ emit(qualifiedEvent, payload);
10238
+ };
10239
+ }
10240
+ var init_wrapCallbackForEvent = __esm({
10241
+ "runtime/wrapCallbackForEvent.ts"() {
10242
+ }
10243
+ });
10225
10244
  var variantBorderClasses, variantIconColors, iconMap3, Alert;
10226
10245
  var init_Alert = __esm({
10227
10246
  "components/molecules/Alert.tsx"() {
@@ -47024,6 +47043,7 @@ function SlotContentRenderer({
47024
47043
  );
47025
47044
  }
47026
47045
  }
47046
+ const eventBus = useEventBus();
47027
47047
  const schemaCtx = useEntitySchemaOptional();
47028
47048
  let entityDef;
47029
47049
  if (typeof entityProp === "string" && entityProp.length > 0 && schemaCtx) {
@@ -47045,6 +47065,20 @@ function SlotContentRenderer({
47045
47065
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
47046
47066
  const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
47047
47067
  const renderedProps = renderPatternProps(restProps, onDismiss);
47068
+ const patternDef = getPatternDefinition(content.pattern);
47069
+ const propsSchema = patternDef?.propsSchema;
47070
+ if (propsSchema) {
47071
+ for (const [propKey, propValue] of Object.entries(renderedProps)) {
47072
+ if (typeof propValue !== "string") continue;
47073
+ const propDef = propsSchema[propKey];
47074
+ if (!propDef || propDef.kind !== "callback") continue;
47075
+ renderedProps[propKey] = wrapCallbackForEvent(
47076
+ `UI:${propValue}`,
47077
+ propDef.callbackArgs,
47078
+ (eventKey, payload) => eventBus.emit(eventKey, payload)
47079
+ );
47080
+ }
47081
+ }
47048
47082
  const finalProps = renderedProps;
47049
47083
  const resolvedItems = Array.isArray(
47050
47084
  finalProps.entity
@@ -47171,6 +47205,7 @@ var init_UISlotRenderer = __esm({
47171
47205
  init_logger();
47172
47206
  init_Skeleton();
47173
47207
  init_renderer();
47208
+ init_wrapCallbackForEvent();
47174
47209
  init_TraitFrame();
47175
47210
  init_component_registry_generated();
47176
47211
  scopeWrapLog = createLogger("almadar:ui:scope-wrap");
@@ -6,8 +6,10 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
6
6
  size?: BadgeSize;
7
7
  /** Numeric count or amount to display in badge */
8
8
  amount?: number;
9
- /** Badge label text (alternative to children for schema-driven rendering) */
10
- label?: string;
9
+ /** Badge label text (alternative to children for schema-driven rendering).
10
+ * Numeric values are auto-coerced to string for rendering — common case
11
+ * is unread counts, error counts, status codes, etc. */
12
+ label?: string | number;
11
13
  /** Icon name (Lucide icon string) or React node */
12
14
  icon?: React.ReactNode;
13
15
  }
@@ -5425,6 +5425,25 @@ var init_renderer = __esm({
5425
5425
  init_init();
5426
5426
  }
5427
5427
  });
5428
+
5429
+ // runtime/wrapCallbackForEvent.ts
5430
+ function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
5431
+ const argNames = (callbackArgs ?? []).map((a) => a.name);
5432
+ if (argNames.length === 0) {
5433
+ return () => emit(qualifiedEvent);
5434
+ }
5435
+ return (...args) => {
5436
+ const payload = {};
5437
+ for (let i = 0; i < argNames.length; i += 1) {
5438
+ payload[argNames[i]] = args[i];
5439
+ }
5440
+ emit(qualifiedEvent, payload);
5441
+ };
5442
+ }
5443
+ var init_wrapCallbackForEvent = __esm({
5444
+ "runtime/wrapCallbackForEvent.ts"() {
5445
+ }
5446
+ });
5428
5447
  var variantBorderClasses, variantIconColors, iconMap3; exports.Alert = void 0;
5429
5448
  var init_Alert = __esm({
5430
5449
  "components/molecules/Alert.tsx"() {
@@ -37816,6 +37835,7 @@ function SlotContentRenderer({
37816
37835
  );
37817
37836
  }
37818
37837
  }
37838
+ const eventBus = useEventBus();
37819
37839
  const schemaCtx = useEntitySchemaOptional();
37820
37840
  let entityDef;
37821
37841
  if (typeof entityProp === "string" && entityProp.length > 0 && schemaCtx) {
@@ -37837,6 +37857,20 @@ function SlotContentRenderer({
37837
37857
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
37838
37858
  const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
37839
37859
  const renderedProps = renderPatternProps(restProps, onDismiss);
37860
+ const patternDef = patterns.getPatternDefinition(content.pattern);
37861
+ const propsSchema = patternDef?.propsSchema;
37862
+ if (propsSchema) {
37863
+ for (const [propKey, propValue] of Object.entries(renderedProps)) {
37864
+ if (typeof propValue !== "string") continue;
37865
+ const propDef = propsSchema[propKey];
37866
+ if (!propDef || propDef.kind !== "callback") continue;
37867
+ renderedProps[propKey] = wrapCallbackForEvent(
37868
+ `UI:${propValue}`,
37869
+ propDef.callbackArgs,
37870
+ (eventKey, payload) => eventBus.emit(eventKey, payload)
37871
+ );
37872
+ }
37873
+ }
37840
37874
  const finalProps = renderedProps;
37841
37875
  const resolvedItems = Array.isArray(
37842
37876
  finalProps.entity
@@ -37961,6 +37995,7 @@ var init_UISlotRenderer = __esm({
37961
37995
  init_logger();
37962
37996
  init_Skeleton();
37963
37997
  init_renderer();
37998
+ init_wrapCallbackForEvent();
37964
37999
  init_TraitFrame();
37965
38000
  init_component_registry_generated();
37966
38001
  scopeWrapLog = createLogger("almadar:ui:scope-wrap");
@@ -7,7 +7,7 @@ import * as LucideIcons from 'lucide-react';
7
7
  import { Loader2, X, AlertTriangle, Info, AlertCircle, CheckCircle, ChevronDown, List, Printer, ChevronRight, ChevronLeft, XCircle, Wrench, RotateCcw, Send, Code, FileText, WrapText, Check, Copy, Zap, Sword, Move, Heart, Shield, Trash2, Settings, Menu as Menu$1, Search, Bell, LogOut, ChevronUp, MoreHorizontal, Bug, ZoomOut, ZoomIn, Download, Pause, Play, Package, Calendar, Pencil, Eye, Image as Image$1, Upload, ArrowRight, ArrowLeft, Eraser, SkipForward, TrendingUp, TrendingDown, Minus, ArrowUp, ArrowDown, MoreVertical, Circle, Clock, CheckCircle2, HelpCircle, FileQuestion, Inbox, Plus, User, Filter, Star, FileWarning, Tag, DollarSign, Sun, Moon } from 'lucide-react';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
10
- import { getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
10
+ import { getPatternDefinition, getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
11
11
  import { createPortal } from 'react-dom';
12
12
  import { Link, Outlet, useLocation } from 'react-router-dom';
13
13
  import ReactMarkdown from 'react-markdown';
@@ -5380,6 +5380,25 @@ var init_renderer = __esm({
5380
5380
  init_init();
5381
5381
  }
5382
5382
  });
5383
+
5384
+ // runtime/wrapCallbackForEvent.ts
5385
+ function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
5386
+ const argNames = (callbackArgs ?? []).map((a) => a.name);
5387
+ if (argNames.length === 0) {
5388
+ return () => emit(qualifiedEvent);
5389
+ }
5390
+ return (...args) => {
5391
+ const payload = {};
5392
+ for (let i = 0; i < argNames.length; i += 1) {
5393
+ payload[argNames[i]] = args[i];
5394
+ }
5395
+ emit(qualifiedEvent, payload);
5396
+ };
5397
+ }
5398
+ var init_wrapCallbackForEvent = __esm({
5399
+ "runtime/wrapCallbackForEvent.ts"() {
5400
+ }
5401
+ });
5383
5402
  var variantBorderClasses, variantIconColors, iconMap3, Alert;
5384
5403
  var init_Alert = __esm({
5385
5404
  "components/molecules/Alert.tsx"() {
@@ -37771,6 +37790,7 @@ function SlotContentRenderer({
37771
37790
  );
37772
37791
  }
37773
37792
  }
37793
+ const eventBus = useEventBus();
37774
37794
  const schemaCtx = useEntitySchemaOptional();
37775
37795
  let entityDef;
37776
37796
  if (typeof entityProp === "string" && entityProp.length > 0 && schemaCtx) {
@@ -37792,6 +37812,20 @@ function SlotContentRenderer({
37792
37812
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
37793
37813
  const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
37794
37814
  const renderedProps = renderPatternProps(restProps, onDismiss);
37815
+ const patternDef = getPatternDefinition(content.pattern);
37816
+ const propsSchema = patternDef?.propsSchema;
37817
+ if (propsSchema) {
37818
+ for (const [propKey, propValue] of Object.entries(renderedProps)) {
37819
+ if (typeof propValue !== "string") continue;
37820
+ const propDef = propsSchema[propKey];
37821
+ if (!propDef || propDef.kind !== "callback") continue;
37822
+ renderedProps[propKey] = wrapCallbackForEvent(
37823
+ `UI:${propValue}`,
37824
+ propDef.callbackArgs,
37825
+ (eventKey, payload) => eventBus.emit(eventKey, payload)
37826
+ );
37827
+ }
37828
+ }
37795
37829
  const finalProps = renderedProps;
37796
37830
  const resolvedItems = Array.isArray(
37797
37831
  finalProps.entity
@@ -37916,6 +37950,7 @@ var init_UISlotRenderer = __esm({
37916
37950
  init_logger();
37917
37951
  init_Skeleton();
37918
37952
  init_renderer();
37953
+ init_wrapCallbackForEvent();
37919
37954
  init_TraitFrame();
37920
37955
  init_component_registry_generated();
37921
37956
  scopeWrapLog = createLogger("almadar:ui:scope-wrap");
@@ -195,8 +195,10 @@ interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
195
195
  size?: BadgeSize;
196
196
  /** Numeric count or amount to display in badge */
197
197
  amount?: number;
198
- /** Badge label text (alternative to children for schema-driven rendering) */
199
- label?: string;
198
+ /** Badge label text (alternative to children for schema-driven rendering).
199
+ * Numeric values are auto-coerced to string for rendering — common case
200
+ * is unread counts, error counts, status codes, etc. */
201
+ label?: string | number;
200
202
  /** Icon name (Lucide icon string) or React node */
201
203
  icon?: React.ReactNode;
202
204
  }
@@ -7063,6 +7063,25 @@ var init_renderer = __esm({
7063
7063
  init_init();
7064
7064
  }
7065
7065
  });
7066
+
7067
+ // runtime/wrapCallbackForEvent.ts
7068
+ function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
7069
+ const argNames = (callbackArgs ?? []).map((a) => a.name);
7070
+ if (argNames.length === 0) {
7071
+ return () => emit(qualifiedEvent);
7072
+ }
7073
+ return (...args) => {
7074
+ const payload = {};
7075
+ for (let i = 0; i < argNames.length; i += 1) {
7076
+ payload[argNames[i]] = args[i];
7077
+ }
7078
+ emit(qualifiedEvent, payload);
7079
+ };
7080
+ }
7081
+ var init_wrapCallbackForEvent = __esm({
7082
+ "runtime/wrapCallbackForEvent.ts"() {
7083
+ }
7084
+ });
7066
7085
  var variantBorderClasses, variantIconColors, iconMap3, Alert;
7067
7086
  var init_Alert = __esm({
7068
7087
  "components/molecules/Alert.tsx"() {
@@ -38336,6 +38355,7 @@ function SlotContentRenderer({
38336
38355
  );
38337
38356
  }
38338
38357
  }
38358
+ const eventBus = useEventBus();
38339
38359
  const schemaCtx = useEntitySchemaOptional();
38340
38360
  let entityDef;
38341
38361
  if (typeof entityProp === "string" && entityProp.length > 0 && schemaCtx) {
@@ -38357,6 +38377,20 @@ function SlotContentRenderer({
38357
38377
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
38358
38378
  const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
38359
38379
  const renderedProps = renderPatternProps(restProps, onDismiss);
38380
+ const patternDef = patterns.getPatternDefinition(content.pattern);
38381
+ const propsSchema = patternDef?.propsSchema;
38382
+ if (propsSchema) {
38383
+ for (const [propKey, propValue] of Object.entries(renderedProps)) {
38384
+ if (typeof propValue !== "string") continue;
38385
+ const propDef = propsSchema[propKey];
38386
+ if (!propDef || propDef.kind !== "callback") continue;
38387
+ renderedProps[propKey] = wrapCallbackForEvent(
38388
+ `UI:${propValue}`,
38389
+ propDef.callbackArgs,
38390
+ (eventKey, payload) => eventBus.emit(eventKey, payload)
38391
+ );
38392
+ }
38393
+ }
38360
38394
  const finalProps = renderedProps;
38361
38395
  const resolvedItems = Array.isArray(
38362
38396
  finalProps.entity
@@ -38481,6 +38515,7 @@ var init_UISlotRenderer = __esm({
38481
38515
  init_logger();
38482
38516
  init_Skeleton();
38483
38517
  init_renderer();
38518
+ init_wrapCallbackForEvent();
38484
38519
  init_TraitFrame();
38485
38520
  init_component_registry_generated();
38486
38521
  scopeWrapLog = createLogger("almadar:ui:scope-wrap");
@@ -8,7 +8,7 @@ import * as LucideIcons from 'lucide-react';
8
8
  import { X, AlertTriangle, Info, AlertCircle, CheckCircle, Loader2, List, Printer, ChevronRight, ChevronLeft, Check, Copy, Code, FileText, WrapText, Trash2, Settings, Menu as Menu$1, Search, Bell, ChevronDown, LogOut, ZoomOut, ZoomIn, Download, FileQuestion, Inbox, XCircle, Filter, Plus, Pause, Play, RotateCcw, Package, Calendar, Pencil, Eye, MoreHorizontal, Image as Image$1, Upload, Minus, ArrowLeft, HelpCircle, ChevronUp, Eraser, Star, TrendingUp, TrendingDown, ArrowUp, ArrowDown, MoreVertical, Sun, Moon, Circle, Clock, CheckCircle2, ArrowRight, FileWarning, SkipForward, Bug, Send, Wrench, User, Tag, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
9
9
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
10
10
  import { useUISlots } from '@almadar/ui/context';
11
- import { getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
11
+ import { getPatternDefinition, getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
12
12
  import { createPortal } from 'react-dom';
13
13
  import { Link, Outlet, useLocation } from 'react-router-dom';
14
14
  import ReactMarkdown from 'react-markdown';
@@ -7018,6 +7018,25 @@ var init_renderer = __esm({
7018
7018
  init_init();
7019
7019
  }
7020
7020
  });
7021
+
7022
+ // runtime/wrapCallbackForEvent.ts
7023
+ function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
7024
+ const argNames = (callbackArgs ?? []).map((a) => a.name);
7025
+ if (argNames.length === 0) {
7026
+ return () => emit(qualifiedEvent);
7027
+ }
7028
+ return (...args) => {
7029
+ const payload = {};
7030
+ for (let i = 0; i < argNames.length; i += 1) {
7031
+ payload[argNames[i]] = args[i];
7032
+ }
7033
+ emit(qualifiedEvent, payload);
7034
+ };
7035
+ }
7036
+ var init_wrapCallbackForEvent = __esm({
7037
+ "runtime/wrapCallbackForEvent.ts"() {
7038
+ }
7039
+ });
7021
7040
  var variantBorderClasses, variantIconColors, iconMap3, Alert;
7022
7041
  var init_Alert = __esm({
7023
7042
  "components/molecules/Alert.tsx"() {
@@ -38291,6 +38310,7 @@ function SlotContentRenderer({
38291
38310
  );
38292
38311
  }
38293
38312
  }
38313
+ const eventBus = useEventBus();
38294
38314
  const schemaCtx = useEntitySchemaOptional();
38295
38315
  let entityDef;
38296
38316
  if (typeof entityProp === "string" && entityProp.length > 0 && schemaCtx) {
@@ -38312,6 +38332,20 @@ function SlotContentRenderer({
38312
38332
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
38313
38333
  const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
38314
38334
  const renderedProps = renderPatternProps(restProps, onDismiss);
38335
+ const patternDef = getPatternDefinition(content.pattern);
38336
+ const propsSchema = patternDef?.propsSchema;
38337
+ if (propsSchema) {
38338
+ for (const [propKey, propValue] of Object.entries(renderedProps)) {
38339
+ if (typeof propValue !== "string") continue;
38340
+ const propDef = propsSchema[propKey];
38341
+ if (!propDef || propDef.kind !== "callback") continue;
38342
+ renderedProps[propKey] = wrapCallbackForEvent(
38343
+ `UI:${propValue}`,
38344
+ propDef.callbackArgs,
38345
+ (eventKey, payload) => eventBus.emit(eventKey, payload)
38346
+ );
38347
+ }
38348
+ }
38315
38349
  const finalProps = renderedProps;
38316
38350
  const resolvedItems = Array.isArray(
38317
38351
  finalProps.entity
@@ -38436,6 +38470,7 @@ var init_UISlotRenderer = __esm({
38436
38470
  init_logger();
38437
38471
  init_Skeleton();
38438
38472
  init_renderer();
38473
+ init_wrapCallbackForEvent();
38439
38474
  init_TraitFrame();
38440
38475
  init_component_registry_generated();
38441
38476
  scopeWrapLog = createLogger("almadar:ui:scope-wrap");
@@ -6958,6 +6958,25 @@ var init_renderer = __esm({
6958
6958
  init_init();
6959
6959
  }
6960
6960
  });
6961
+
6962
+ // runtime/wrapCallbackForEvent.ts
6963
+ function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
6964
+ const argNames = (callbackArgs ?? []).map((a) => a.name);
6965
+ if (argNames.length === 0) {
6966
+ return () => emit(qualifiedEvent);
6967
+ }
6968
+ return (...args) => {
6969
+ const payload = {};
6970
+ for (let i = 0; i < argNames.length; i += 1) {
6971
+ payload[argNames[i]] = args[i];
6972
+ }
6973
+ emit(qualifiedEvent, payload);
6974
+ };
6975
+ }
6976
+ var init_wrapCallbackForEvent = __esm({
6977
+ "runtime/wrapCallbackForEvent.ts"() {
6978
+ }
6979
+ });
6961
6980
  var variantBorderClasses, variantIconColors, iconMap3, Alert;
6962
6981
  var init_Alert = __esm({
6963
6982
  "components/molecules/Alert.tsx"() {
@@ -37929,6 +37948,7 @@ function SlotContentRenderer({
37929
37948
  );
37930
37949
  }
37931
37950
  }
37951
+ const eventBus = useEventBus();
37932
37952
  const schemaCtx = useEntitySchemaOptional();
37933
37953
  let entityDef;
37934
37954
  if (typeof entityProp === "string" && entityProp.length > 0 && schemaCtx) {
@@ -37950,6 +37970,20 @@ function SlotContentRenderer({
37950
37970
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
37951
37971
  const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
37952
37972
  const renderedProps = renderPatternProps(restProps, onDismiss);
37973
+ const patternDef = patterns.getPatternDefinition(content.pattern);
37974
+ const propsSchema = patternDef?.propsSchema;
37975
+ if (propsSchema) {
37976
+ for (const [propKey, propValue] of Object.entries(renderedProps)) {
37977
+ if (typeof propValue !== "string") continue;
37978
+ const propDef = propsSchema[propKey];
37979
+ if (!propDef || propDef.kind !== "callback") continue;
37980
+ renderedProps[propKey] = wrapCallbackForEvent(
37981
+ `UI:${propValue}`,
37982
+ propDef.callbackArgs,
37983
+ (eventKey, payload) => eventBus.emit(eventKey, payload)
37984
+ );
37985
+ }
37986
+ }
37953
37987
  const finalProps = renderedProps;
37954
37988
  const resolvedItems = Array.isArray(
37955
37989
  finalProps.entity
@@ -38074,6 +38108,7 @@ var init_UISlotRenderer = __esm({
38074
38108
  init_logger();
38075
38109
  init_Skeleton();
38076
38110
  init_renderer();
38111
+ init_wrapCallbackForEvent();
38077
38112
  init_TraitFrame();
38078
38113
  init_component_registry_generated();
38079
38114
  scopeWrapLog = createLogger("almadar:ui:scope-wrap");
@@ -39153,6 +39188,9 @@ function useTrait(traitName) {
39153
39188
  return context.getTrait(traitName);
39154
39189
  }
39155
39190
 
39191
+ // runtime/index.ts
39192
+ init_wrapCallbackForEvent();
39193
+
39156
39194
  // runtime/OrbPreview.tsx
39157
39195
  init_Box();
39158
39196
  init_Typography();
@@ -39931,3 +39969,4 @@ exports.useServerBridge = useServerBridge;
39931
39969
  exports.useTrait = useTrait;
39932
39970
  exports.useTraitContext = useTraitContext;
39933
39971
  exports.useTraitStateMachine = useTraitStateMachine;
39972
+ exports.wrapCallbackForEvent = wrapCallbackForEvent;
@@ -11,6 +11,7 @@ export { useResolvedSchema, type ResolvedSchemaResult, clearSchemaCache } from '
11
11
  export { EntitySchemaProvider, useEntitySchema, useEntityDefinition, useEntitySchemaOptional, type EntitySchemaContextValue, type EntitySchemaProviderProps, } from './EntitySchemaContext';
12
12
  export { TraitProvider, TraitContext, useTraitContext, useTrait, type TraitContextValue, type TraitInstance, type TraitProviderProps, } from './TraitProvider';
13
13
  export type { SlotPatternEntry, SlotSource } from './ui/slot-types';
14
+ export { wrapCallbackForEvent } from './wrapCallbackForEvent';
14
15
  export { createClientEffectHandlers, type ClientEventBus, type SlotSetter, type CreateClientEffectHandlersOptions, } from './createClientEffectHandlers';
15
16
  export { OrbPreview, type OrbPreviewProps } from './OrbPreview';
16
17
  export { BrowserPlayground, type BrowserPlaygroundProps } from './BrowserPlayground';
@@ -8,7 +8,7 @@ import * as LucideIcons from 'lucide-react';
8
8
  import { X, AlertTriangle, Info, AlertCircle, CheckCircle, Loader2, List, Printer, ChevronRight, ChevronLeft, Check, Copy, Code, FileText, WrapText, Trash2, Settings, Menu as Menu$1, Search, Bell, ChevronDown, LogOut, ZoomOut, ZoomIn, Download, FileQuestion, Inbox, XCircle, Filter, Plus, Pause, Play, RotateCcw, Package, Calendar, Pencil, Eye, MoreHorizontal, Image as Image$1, Upload, Minus, ArrowLeft, HelpCircle, ChevronUp, Eraser, Star, TrendingUp, TrendingDown, ArrowUp, ArrowDown, MoreVertical, Sun, Moon, Circle, Clock, CheckCircle2, ArrowRight, FileWarning, SkipForward, Bug, Send, Wrench, User, Tag, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
9
9
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
10
10
  import { useUISlots, UISlotProvider } from '@almadar/ui/context';
11
- import { getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
11
+ import { getPatternDefinition, getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
12
12
  import { createPortal } from 'react-dom';
13
13
  import { Link, Outlet, useLocation } from 'react-router-dom';
14
14
  import ReactMarkdown from 'react-markdown';
@@ -6913,6 +6913,25 @@ var init_renderer = __esm({
6913
6913
  init_init();
6914
6914
  }
6915
6915
  });
6916
+
6917
+ // runtime/wrapCallbackForEvent.ts
6918
+ function wrapCallbackForEvent(qualifiedEvent, callbackArgs, emit) {
6919
+ const argNames = (callbackArgs ?? []).map((a) => a.name);
6920
+ if (argNames.length === 0) {
6921
+ return () => emit(qualifiedEvent);
6922
+ }
6923
+ return (...args) => {
6924
+ const payload = {};
6925
+ for (let i = 0; i < argNames.length; i += 1) {
6926
+ payload[argNames[i]] = args[i];
6927
+ }
6928
+ emit(qualifiedEvent, payload);
6929
+ };
6930
+ }
6931
+ var init_wrapCallbackForEvent = __esm({
6932
+ "runtime/wrapCallbackForEvent.ts"() {
6933
+ }
6934
+ });
6916
6935
  var variantBorderClasses, variantIconColors, iconMap3, Alert;
6917
6936
  var init_Alert = __esm({
6918
6937
  "components/molecules/Alert.tsx"() {
@@ -37884,6 +37903,7 @@ function SlotContentRenderer({
37884
37903
  );
37885
37904
  }
37886
37905
  }
37906
+ const eventBus = useEventBus();
37887
37907
  const schemaCtx = useEntitySchemaOptional();
37888
37908
  let entityDef;
37889
37909
  if (typeof entityProp === "string" && entityProp.length > 0 && schemaCtx) {
@@ -37905,6 +37925,20 @@ function SlotContentRenderer({
37905
37925
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
37906
37926
  const restProps = childrenIsRenderFn ? { ...restPropsNoChildren, children: incomingChildren } : restPropsNoChildren;
37907
37927
  const renderedProps = renderPatternProps(restProps, onDismiss);
37928
+ const patternDef = getPatternDefinition(content.pattern);
37929
+ const propsSchema = patternDef?.propsSchema;
37930
+ if (propsSchema) {
37931
+ for (const [propKey, propValue] of Object.entries(renderedProps)) {
37932
+ if (typeof propValue !== "string") continue;
37933
+ const propDef = propsSchema[propKey];
37934
+ if (!propDef || propDef.kind !== "callback") continue;
37935
+ renderedProps[propKey] = wrapCallbackForEvent(
37936
+ `UI:${propValue}`,
37937
+ propDef.callbackArgs,
37938
+ (eventKey, payload) => eventBus.emit(eventKey, payload)
37939
+ );
37940
+ }
37941
+ }
37908
37942
  const finalProps = renderedProps;
37909
37943
  const resolvedItems = Array.isArray(
37910
37944
  finalProps.entity
@@ -38029,6 +38063,7 @@ var init_UISlotRenderer = __esm({
38029
38063
  init_logger();
38030
38064
  init_Skeleton();
38031
38065
  init_renderer();
38066
+ init_wrapCallbackForEvent();
38032
38067
  init_TraitFrame();
38033
38068
  init_component_registry_generated();
38034
38069
  scopeWrapLog = createLogger("almadar:ui:scope-wrap");
@@ -39108,6 +39143,9 @@ function useTrait(traitName) {
39108
39143
  return context.getTrait(traitName);
39109
39144
  }
39110
39145
 
39146
+ // runtime/index.ts
39147
+ init_wrapCallbackForEvent();
39148
+
39111
39149
  // runtime/OrbPreview.tsx
39112
39150
  init_Box();
39113
39151
  init_Typography();
@@ -39867,4 +39905,4 @@ function BrowserPlayground({
39867
39905
  );
39868
39906
  }
39869
39907
 
39870
- export { BrowserPlayground, EntitySchemaProvider, OrbPreview, ServerBridgeProvider, TraitContext, TraitProvider, adjustSchemaForMockData, buildMockData, clearSchemaCache, createClientEffectHandlers, prepareSchemaForPreview, useEntityDefinition, useEntitySchema, useEntitySchemaOptional, useResolvedSchema, useServerBridge, useTrait, useTraitContext, useTraitStateMachine };
39908
+ export { BrowserPlayground, EntitySchemaProvider, OrbPreview, ServerBridgeProvider, TraitContext, TraitProvider, adjustSchemaForMockData, buildMockData, clearSchemaCache, createClientEffectHandlers, prepareSchemaForPreview, useEntityDefinition, useEntitySchema, useEntitySchemaOptional, useResolvedSchema, useServerBridge, useTrait, useTraitContext, useTraitStateMachine, wrapCallbackForEvent };
@@ -0,0 +1,16 @@
1
+ import type { PatternCallbackArg } from '@almadar/patterns';
2
+ import type { EventPayload, EventPayloadValue } from '@almadar/core';
3
+ /**
4
+ * Build the runtime wrapper that turns a string-typed callback prop
5
+ * (e.g. `onTabChange: "TAB_CHANGED"`) into a function the component can
6
+ * invoke. The wrapper consumes the component's positional callback args
7
+ * by name and dispatches an OBJECT payload `{ argName: value, ... }` so
8
+ * the bus carries the trait's declared event payload, not a raw
9
+ * positional spread. Mirrors the codegen wrapper in
10
+ * `orbital-shell-typescript/src/codegen/pattern.rs` (C2 compiled path).
11
+ *
12
+ * Single-sourcing this logic across runtime and codegen (shared shape,
13
+ * not shared code — codegen emits string source) is what keeps the two
14
+ * paths from silently diverging on payload shape.
15
+ */
16
+ export declare function wrapCallbackForEvent(qualifiedEvent: string, callbackArgs: PatternCallbackArg[] | undefined, emit: (eventKey: string, payload?: EventPayload) => void): (...args: EventPayloadValue[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.22.1",
3
+ "version": "4.22.3",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",
@@ -120,7 +120,7 @@
120
120
  "dependencies": {
121
121
  "@almadar/core": "^7.10.0",
122
122
  "@almadar/evaluator": ">=2.9.2",
123
- "@almadar/patterns": ">=2.17.1",
123
+ "@almadar/patterns": "^2.20.2",
124
124
  "@almadar/runtime": "^6.0.0",
125
125
  "@almadar/std": ">=6.4.1",
126
126
  "@almadar/syntax": ">=1.3.1",