@almadar/runtime 6.52.0 → 6.53.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.
@@ -1,7 +1,7 @@
1
- import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-EHFQOBQH.js';
2
- export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-EHFQOBQH.js';
1
+ import { createTickScheduler, EventBus, createUnifiedLoader, MockPersistenceAdapter, InMemoryPersistence, preprocessSchema, normalizeCallSiteConfigToValues, StateMachineManager, parseDurationString, validateEventPayload, formatPayloadValidationError, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, EffectExecutor } from './chunk-DERIA6MO.js';
2
+ export { InMemoryPersistence, collectDeclaredConfigDefaults } from './chunk-DERIA6MO.js';
3
3
  import { isValidCronExpression } from './chunk-OU3ITB5S.js';
4
- import { createContextFromBindings, resolveCallSitePayloadCaptures, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ORBJ5YEQ.js';
4
+ import { createContextFromBindings, resolveCallSitePayloadCaptures, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ZJ62H3ES.js';
5
5
  import './chunk-T4VDAB4C.js';
6
6
  import './chunk-SCRAHWOC.js';
7
7
  import './chunk-MLKGABMK.js';
@@ -84,17 +84,31 @@ function inlineNavItems(pages) {
84
84
  for (const page of pages) {
85
85
  if (isPageReference(page)) continue;
86
86
  const p = page;
87
- if (typeof p.path === "string" && typeof p.name === "string") {
88
- items.push({ href: p.path, label: p.name });
89
- }
87
+ if (typeof p.path !== "string" || typeof p.name !== "string") continue;
88
+ if (p.path.includes(":")) continue;
89
+ const item = {
90
+ href: p.path,
91
+ // `@label` annotation wins; else derive by stripping a trailing
92
+ // `Page` suffix from `name` (`ContactsPage` → `Contacts`).
93
+ label: p.label ?? deriveNavLabel(p.name)
94
+ };
95
+ if (typeof p.icon === "string") item.icon = p.icon;
96
+ items.push(item);
90
97
  }
91
98
  return items;
92
99
  }
100
+ function deriveNavLabel(name) {
101
+ if (name.endsWith("Page") && name.length > "Page".length) {
102
+ return name.slice(0, -"Page".length);
103
+ }
104
+ return name;
105
+ }
93
106
  function themeDataKey(theme) {
94
107
  if (theme === void 0) return "";
95
108
  if (typeof theme === "string") return theme;
96
109
  return theme.name;
97
110
  }
111
+ var DEFAULT_THEME_KEY = "minimalist-light";
98
112
  var OrbitalServerRuntime = class {
99
113
  orbitals = /* @__PURE__ */ new Map();
100
114
  eventBus;
@@ -1715,14 +1729,20 @@ var OrbitalServerRuntime = class {
1715
1729
  ...callSiteOverride ?? {}
1716
1730
  };
1717
1731
  }
1718
- const sigilPages = inlineNavItems(registered.schema.pages);
1732
+ const sigilPages = [];
1733
+ const seenPaths = /* @__PURE__ */ new Set();
1734
+ for (const reg of this.orbitals.values()) {
1735
+ for (const item of inlineNavItems(reg.schema.pages ?? [])) {
1736
+ if (seenPaths.has(item.href)) continue;
1737
+ seenPaths.add(item.href);
1738
+ sigilPages.push(item);
1739
+ }
1740
+ }
1719
1741
  if (sigilPages.length > 0) {
1720
1742
  bindings.pages = sigilPages;
1721
1743
  }
1722
- const sigilTheme = themeDataKey(registered.schema.theme);
1723
- if (sigilTheme) {
1724
- bindings.currentTheme = sigilTheme;
1725
- }
1744
+ const sigilTheme = themeDataKey(registered.schema.theme) || DEFAULT_THEME_KEY;
1745
+ bindings.currentTheme = sigilTheme;
1726
1746
  const entityFieldDefaults = collectDeclaredEntityDefaults(registered.entity);
1727
1747
  const traitFieldState = registered.traitFieldStates.get(this.sharedFieldKey(registered, traitName));
1728
1748
  if (entityFieldDefaults || traitFieldState) {
@@ -1,5 +1,5 @@
1
1
  import { parseCron, cronMinuteKey, cronMatches } from './chunk-OU3ITB5S.js';
2
- import { createContextFromBindings, interpolateValue, deferEntityBindings } from './chunk-ORBJ5YEQ.js';
2
+ import { createContextFromBindings, interpolateValue, deferEntityBindings } from './chunk-ZJ62H3ES.js';
3
3
  import { seedRandom, randomArrayElement, randomInt, shuffleArray, randomPastDate } from './chunk-T4VDAB4C.js';
4
4
  import { collectTraitRefsFromValue, collectTraitRefsFromEffects } from './chunk-SCRAHWOC.js';
5
5
  import { createLogger, setNamespaceLevel } from '@almadar/logger';
@@ -113,6 +113,38 @@ function interpolateValue(value, ctx) {
113
113
  }
114
114
  return value;
115
115
  }
116
+ function resolveConfigLeavesInLambdaBody(node, ctx) {
117
+ if (typeof node === "string") {
118
+ if (!node.startsWith("@config.") || node.includes(" ")) return node;
119
+ const resolved = resolveBinding(node, ctx);
120
+ deferLog.debug("lambda:config-leaf", () => ({
121
+ binding: node,
122
+ resolvedType: typeof resolved,
123
+ selfForward: resolved === node
124
+ }));
125
+ return resolved === node ? void 0 : resolved;
126
+ }
127
+ if (Array.isArray(node)) {
128
+ let changed = false;
129
+ const out = node.map((item) => {
130
+ const next = resolveConfigLeavesInLambdaBody(item, ctx);
131
+ if (next !== item) changed = true;
132
+ return next;
133
+ });
134
+ return changed ? out : node;
135
+ }
136
+ if (node !== null && typeof node === "object" && !(node instanceof Date)) {
137
+ let changed = false;
138
+ const out = {};
139
+ for (const [key, item] of Object.entries(node)) {
140
+ const next = resolveConfigLeavesInLambdaBody(item, ctx);
141
+ if (next !== item) changed = true;
142
+ out[key] = next;
143
+ }
144
+ return changed ? out : node;
145
+ }
146
+ return node;
147
+ }
116
148
  function deferEntityBindings(value, ctx, configHops = 0) {
117
149
  if (typeof value === "string") {
118
150
  if (containsEntityBinding(value) && !containsPayloadBinding(value)) {
@@ -133,7 +165,7 @@ function deferEntityBindings(value, ctx, configHops = 0) {
133
165
  }
134
166
  if (Array.isArray(value)) {
135
167
  if (value.length === 3 && value[0] === "fn" && typeof value[1] === "string") {
136
- return value;
168
+ return resolveConfigLeavesInLambdaBody(value, ctx);
137
169
  }
138
170
  if (isSExpression(value)) {
139
171
  if (containsEntityBinding(value) && !containsPayloadBinding(value)) {
@@ -203,7 +235,7 @@ function interpolateArray(value, ctx) {
203
235
  return value;
204
236
  }
205
237
  if (Array.isArray(value) && value.length === 3 && value[0] === "fn" && typeof value[1] === "string") {
206
- return value;
238
+ return resolveConfigLeavesInLambdaBody(value, ctx);
207
239
  }
208
240
  if (isSExpression(value)) {
209
241
  const result = evaluate(value, ctx);
@@ -1,2 +1,2 @@
1
- export { accessDeniedMessage, applyRowAccess, checkMutationAccess } from './chunk-ORBJ5YEQ.js';
1
+ export { accessDeniedMessage, applyRowAccess, checkMutationAccess } from './chunk-ZJ62H3ES.js';
2
2
  import './chunk-MLKGABMK.js';
package/dist/index.d.ts CHANGED
@@ -294,18 +294,6 @@ declare function interpolateValue(value: unknown, ctx: EvaluationContext): unkno
294
294
  type DeferredPatternValue = RuntimePatternValue | RenderBindingMarker | SExpr | Date | readonly DeferredPatternValue[] | {
295
295
  readonly [prop: string]: DeferredPatternValue;
296
296
  };
297
- /**
298
- * Carry `@entity`-dependent prop leaves into slot content as
299
- * `RenderBindingMarker`s instead of resolving them at flush time — the
300
- * renderer (`@almadar/ui`'s SlotContentRenderer) evaluates each marker
301
- * against the live entity store on every React render, the same model the
302
- * compiled shell uses. Everything else resolves eagerly through the same
303
- * `interpolateValue` path the non-deferring executor uses:
304
- * - payload-referencing leaves stay eager (`@payload` is event-scoped and
305
- * does not exist at render time);
306
- * - `fn` render lambdas pass through raw (they are already render-time);
307
- * - literal arrays (children lists) and plain objects recurse per item.
308
- */
309
297
  declare function deferEntityBindings(value: SExpr, ctx: EvaluationContext, configHops?: number): DeferredPatternValue;
310
298
  /**
311
299
  * Check if a value contains any binding references.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { EffectExecutor } from './chunk-EHFQOBQH.js';
2
- export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes } from './chunk-EHFQOBQH.js';
1
+ import { EffectExecutor } from './chunk-DERIA6MO.js';
2
+ export { EffectExecutor, EventBus, HANDLER_MANIFEST, InMemoryPersistence, MockPersistenceAdapter, StateMachineManager, TickScheduler, buildEmitsFromTraits, collectDeclaredConfigDefaults, collectDeclaredEntityDefaults, createInitialTraitState, createMockPersistence, createTestExecutor, createTickScheduler, createUnifiedLoader, findInitialState, findTransition, formatPayloadValidationError, getIsolatedCollectionName, getNamespacedEvent, isBrowser, isElectron, isNamespacedEvent, isNode, isValidDurationString, normalizeCallSiteConfigToValues, normalizeEventKey, parseDurationString, parseNamespacedEvent, preprocessSchema, processEvent, validateEventPayload, validatePayloadShapes } from './chunk-DERIA6MO.js';
3
3
  export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from './chunk-OU3ITB5S.js';
4
- import { createContextFromBindings, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ORBJ5YEQ.js';
5
- export { CALLSITE_PAYLOAD_PREFIX, applyRowAccess, checkMutationAccess, containsBindings, createContextFromBindings, createMinimalContext, deferEntityBindings, extractBindings, interpolateProps, interpolateValue, resolveCallSitePayloadCaptures } from './chunk-ORBJ5YEQ.js';
4
+ import { createContextFromBindings, applyRowAccess, checkMutationAccess, accessDeniedMessage } from './chunk-ZJ62H3ES.js';
5
+ export { CALLSITE_PAYLOAD_PREFIX, applyRowAccess, checkMutationAccess, containsBindings, createContextFromBindings, createMinimalContext, deferEntityBindings, extractBindings, interpolateProps, interpolateValue, resolveCallSitePayloadCaptures } from './chunk-ZJ62H3ES.js';
6
6
  import './chunk-T4VDAB4C.js';
7
7
  export { PERF_NAMESPACE, RendererContractViolationError, adjustSchemaForMockData, aggregateSlotContent, assertIsMultiSourceSlotManager, assertIsSlotManager, bindEventBus, bindTraitStateGetter, buildMockData, buildOrbitalsByTrait, clearPerf, createSlotSetter, ensureVerificationApi, getOrbitalVerification, perfEnd, perfStart, perfStore, perfTime, prepareSchemaForPreview, pushPerfEntry, validateSlotContent, wrapCallbackForEvent } from './chunk-FOFLEZRJ.js';
8
8
  export { collectEmbeddedTraits, collectTraitRefsFromResolvedTrait } from './chunk-SCRAHWOC.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/runtime",
3
- "version": "6.52.0",
3
+ "version": "6.53.0",
4
4
  "description": "Interpreted runtime for Almadar orbital applications (OrbitalServerRuntime)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -57,11 +57,11 @@
57
57
  "access": "public"
58
58
  },
59
59
  "dependencies": {
60
- "@almadar/core": "^10.54.0",
60
+ "@almadar/core": "^10.55.0",
61
61
  "@almadar/evaluator": "^2.40.0",
62
62
  "@almadar/logger": "^1.11.0",
63
63
  "@almadar/server": "^2.34.0",
64
- "@almadar/std": "^16.167.0"
64
+ "@almadar/std": "^16.168.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "express": "^5.0.0"