@almadar/core 10.0.0 → 10.2.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/builders.d.ts +27 -4
- package/dist/builders.js +53 -2
- package/dist/builders.js.map +1 -1
- package/dist/{compose-behaviors-DAYTsIWZ.d.ts → compose-behaviors-DM0gUoSO.d.ts} +1 -1
- package/dist/factory/index.d.ts +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/{schema-BetbBFJb.d.ts → schema-lxLUgVSb.d.ts} +98 -98
- package/dist/{trait-CjyEE6Di.d.ts → trait-Bhssodu6.d.ts} +102 -26
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.js +16 -2
- package/dist/types/index.js.map +1 -1
- package/dist/{types-KzrHszR_.d.ts → types-Bz0Zxvd_.d.ts} +1 -1
- package/package.json +1 -1
package/dist/builders.d.ts
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
import { U as UISlot, E as Effect,
|
|
2
|
-
import { U as UseDeclaration, E as EntityRef, P as PageRef,
|
|
1
|
+
import { T as TraitConfig, U as UISlot, E as Effect, a as Trait, R as RenderBinding, b as RenderUIEffect, c as TraitEventContract, d as Entity, e as TraitEventListener, f as EntityField, g as EntityPersistence, h as EntityRow, i as TraitRef, j as TraitReference } from './trait-Bhssodu6.js';
|
|
2
|
+
import { O as OrbitalSchema, U as UseDeclaration, E as EntityRef, P as PageRef, a as OrbitalDefinition, b as Page, c as PageRefObject } from './schema-lxLUgVSb.js';
|
|
3
3
|
import { S as SExpr } from './expression-BVRFm0sV.js';
|
|
4
|
-
export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-
|
|
4
|
+
export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-DM0gUoSO.js';
|
|
5
5
|
import { AnyPatternConfig } from '@almadar/patterns';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Apply trait config overrides to a schema — pure, returns a new schema.
|
|
10
|
+
*
|
|
11
|
+
* Used by config-driven preview surfaces (the playground property inspector and
|
|
12
|
+
* the verify config-sweep) to render a behavior with different `config` values
|
|
13
|
+
* WITHOUT recompiling: the override is written onto the matching trait, then the
|
|
14
|
+
* schema is re-registered and re-rendered.
|
|
15
|
+
*
|
|
16
|
+
* The resolved schema's traits are inlined `Trait`s whose `config` is the
|
|
17
|
+
* DECLARED schema (`{ field: { type, default, ... } }`), so an override patches
|
|
18
|
+
* each field's `default`. A trait that instead carries call-site value config
|
|
19
|
+
* (a `{ ref, config }` reference) gets the values merged directly.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Return a new schema with `config` overrides applied to traits whose identity
|
|
26
|
+
* (`name`, falling back to `ref`) matches a key in `overrides`. Fields not
|
|
27
|
+
* declared on the trait are ignored — overrides never invent config.
|
|
28
|
+
*/
|
|
29
|
+
declare function applyTraitConfigOverrides(schema: OrbitalSchema, overrides: Readonly<Record<string, TraitConfig>>): OrbitalSchema;
|
|
30
|
+
|
|
8
31
|
/**
|
|
9
32
|
* Layout-Trait Builders
|
|
10
33
|
*
|
|
@@ -437,4 +460,4 @@ declare function compose(orbitals: (OrbitalDefinition | OrbitalSchema)[], pages:
|
|
|
437
460
|
*/
|
|
438
461
|
declare function pipe(orbitals: (OrbitalDefinition | OrbitalSchema)[], events: TraitEventContract[], appName?: string): OrbitalSchema;
|
|
439
462
|
|
|
440
|
-
export { type ComposeConnection, type ComposePage, type MakeAtomOrbitalOpts, type MakeAtomOrbitalTraitOverrides, type MakeEntityOpts, type MakeLayoutTraitOpts, type MakeOrbitalWithUsesOpts, type MakePageOpts, type MakePageRefOpts, type MakePageRefOptsTyped, type MakeTraitRefOpts, type MakeTraitRefOptsTyped, compose, connect, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeOrbitals, pipe, plural, wire };
|
|
463
|
+
export { type ComposeConnection, type ComposePage, type MakeAtomOrbitalOpts, type MakeAtomOrbitalTraitOverrides, type MakeEntityOpts, type MakeLayoutTraitOpts, type MakeOrbitalWithUsesOpts, type MakePageOpts, type MakePageRefOpts, type MakePageRefOptsTyped, type MakeTraitRefOpts, type MakeTraitRefOptsTyped, applyTraitConfigOverrides, compose, connect, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeOrbitals, pipe, plural, wire };
|
package/dist/builders.js
CHANGED
|
@@ -185,6 +185,14 @@ z.object({
|
|
|
185
185
|
basePath: z.string(),
|
|
186
186
|
mappings: z.record(AssetMappingSchema)
|
|
187
187
|
});
|
|
188
|
+
var AssetCatalogEntrySchema = z.object({
|
|
189
|
+
url: z.string(),
|
|
190
|
+
name: z.string(),
|
|
191
|
+
category: z.string(),
|
|
192
|
+
kind: z.enum(["image", "spritesheet", "audio", "scene", "portrait", "model", "other"]),
|
|
193
|
+
thumbnailUrl: z.string().optional()
|
|
194
|
+
});
|
|
195
|
+
z.array(AssetCatalogEntrySchema);
|
|
188
196
|
|
|
189
197
|
// src/types/entity.ts
|
|
190
198
|
var EntityPersistenceSchema = z.enum([
|
|
@@ -318,7 +326,13 @@ var TraitConfigValueSchema = z.lazy(
|
|
|
318
326
|
var TraitConfigSchema = z.record(TraitConfigValueSchema);
|
|
319
327
|
var ConfigFieldDeclarationSchema = z.object({
|
|
320
328
|
type: z.string(),
|
|
321
|
-
default: TraitConfigValueSchema.optional()
|
|
329
|
+
default: TraitConfigValueSchema.optional(),
|
|
330
|
+
label: z.string().optional(),
|
|
331
|
+
description: z.string().optional(),
|
|
332
|
+
tier: z.string().optional(),
|
|
333
|
+
values: z.array(z.string()).optional(),
|
|
334
|
+
synonyms: z.string().optional(),
|
|
335
|
+
control: z.enum(["icon", "asset", "color", "text", "number", "boolean", "select"]).optional()
|
|
322
336
|
});
|
|
323
337
|
var DeclaredTraitConfigSchema = z.record(
|
|
324
338
|
ConfigFieldDeclarationSchema
|
|
@@ -1150,6 +1164,43 @@ z.object({
|
|
|
1150
1164
|
suggestedGuards: z.array(SuggestedGuardSchema).optional()
|
|
1151
1165
|
});
|
|
1152
1166
|
|
|
1167
|
+
// src/builders/apply-config-overrides.ts
|
|
1168
|
+
function overrideTrait(trait, values) {
|
|
1169
|
+
if ("scope" in trait) {
|
|
1170
|
+
const config = trait.config;
|
|
1171
|
+
if (config === void 0) return trait;
|
|
1172
|
+
const next = { ...config };
|
|
1173
|
+
for (const [field, value] of Object.entries(values)) {
|
|
1174
|
+
const decl = config[field];
|
|
1175
|
+
if (decl !== void 0) {
|
|
1176
|
+
next[field] = { ...decl, default: value };
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return { ...trait, config: next };
|
|
1180
|
+
}
|
|
1181
|
+
const base = trait.config !== void 0 ? { ...trait.config } : {};
|
|
1182
|
+
return { ...trait, config: { ...base, ...values } };
|
|
1183
|
+
}
|
|
1184
|
+
function traitIdentity(trait) {
|
|
1185
|
+
if (trait.name !== void 0) return trait.name;
|
|
1186
|
+
return "ref" in trait ? trait.ref : void 0;
|
|
1187
|
+
}
|
|
1188
|
+
function applyTraitConfigOverrides(schema, overrides) {
|
|
1189
|
+
if (overrides === void 0 || Object.keys(overrides).length === 0) return schema;
|
|
1190
|
+
return {
|
|
1191
|
+
...schema,
|
|
1192
|
+
orbitals: schema.orbitals.map((orbital) => ({
|
|
1193
|
+
...orbital,
|
|
1194
|
+
traits: orbital.traits.map((trait) => {
|
|
1195
|
+
if (typeof trait === "string") return trait;
|
|
1196
|
+
const id = traitIdentity(trait);
|
|
1197
|
+
const values = id !== void 0 ? overrides[id] : void 0;
|
|
1198
|
+
return values !== void 0 ? overrideTrait(trait, values) : trait;
|
|
1199
|
+
})
|
|
1200
|
+
}))
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1153
1204
|
// src/builders/layout-strategy.ts
|
|
1154
1205
|
function hasSequentialChain(wiring) {
|
|
1155
1206
|
if (wiring.length < 2) {
|
|
@@ -1683,6 +1734,6 @@ function pipe(orbitals, events, appName) {
|
|
|
1683
1734
|
};
|
|
1684
1735
|
}
|
|
1685
1736
|
|
|
1686
|
-
export { applyEventWiring, compose, composeBehaviors, connect, detectLayoutStrategy, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeOrbitals, pipe, plural, wire };
|
|
1737
|
+
export { applyEventWiring, applyTraitConfigOverrides, compose, composeBehaviors, connect, detectLayoutStrategy, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeOrbitals, pipe, plural, wire };
|
|
1687
1738
|
//# sourceMappingURL=builders.js.map
|
|
1688
1739
|
//# sourceMappingURL=builders.js.map
|