@almadar/core 9.11.0 → 10.1.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 +44 -2
- package/dist/builders.js.map +1 -1
- package/dist/{compose-behaviors-CC57nx7Q.d.ts → compose-behaviors-CPisdINZ.d.ts} +1 -1
- package/dist/factory/index.d.ts +3 -3
- package/dist/index.d.ts +7 -7
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/{schema-B3LLJzA1.d.ts → schema-D6Y8TfW3.d.ts} +2 -2
- package/dist/{trait-BGCXN5LO.d.ts → trait-gH8M3N0M.d.ts} +41 -2
- package/dist/types/index.d.ts +7 -74
- package/dist/types/index.js +6 -1
- package/dist/types/index.js.map +1 -1
- package/dist/{types-BQcbhvP3.d.ts → types-JMLj6eu1.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-gH8M3N0M.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-D6Y8TfW3.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-CPisdINZ.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
|
@@ -318,7 +318,12 @@ var TraitConfigValueSchema = z.lazy(
|
|
|
318
318
|
var TraitConfigSchema = z.record(TraitConfigValueSchema);
|
|
319
319
|
var ConfigFieldDeclarationSchema = z.object({
|
|
320
320
|
type: z.string(),
|
|
321
|
-
default: TraitConfigValueSchema.optional()
|
|
321
|
+
default: TraitConfigValueSchema.optional(),
|
|
322
|
+
label: z.string().optional(),
|
|
323
|
+
description: z.string().optional(),
|
|
324
|
+
tier: z.string().optional(),
|
|
325
|
+
values: z.array(z.string()).optional(),
|
|
326
|
+
synonyms: z.string().optional()
|
|
322
327
|
});
|
|
323
328
|
var DeclaredTraitConfigSchema = z.record(
|
|
324
329
|
ConfigFieldDeclarationSchema
|
|
@@ -1150,6 +1155,43 @@ z.object({
|
|
|
1150
1155
|
suggestedGuards: z.array(SuggestedGuardSchema).optional()
|
|
1151
1156
|
});
|
|
1152
1157
|
|
|
1158
|
+
// src/builders/apply-config-overrides.ts
|
|
1159
|
+
function overrideTrait(trait, values) {
|
|
1160
|
+
if ("scope" in trait) {
|
|
1161
|
+
const config = trait.config;
|
|
1162
|
+
if (config === void 0) return trait;
|
|
1163
|
+
const next = { ...config };
|
|
1164
|
+
for (const [field, value] of Object.entries(values)) {
|
|
1165
|
+
const decl = config[field];
|
|
1166
|
+
if (decl !== void 0) {
|
|
1167
|
+
next[field] = { ...decl, default: value };
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
return { ...trait, config: next };
|
|
1171
|
+
}
|
|
1172
|
+
const base = trait.config !== void 0 ? { ...trait.config } : {};
|
|
1173
|
+
return { ...trait, config: { ...base, ...values } };
|
|
1174
|
+
}
|
|
1175
|
+
function traitIdentity(trait) {
|
|
1176
|
+
if (trait.name !== void 0) return trait.name;
|
|
1177
|
+
return "ref" in trait ? trait.ref : void 0;
|
|
1178
|
+
}
|
|
1179
|
+
function applyTraitConfigOverrides(schema, overrides) {
|
|
1180
|
+
if (overrides === void 0 || Object.keys(overrides).length === 0) return schema;
|
|
1181
|
+
return {
|
|
1182
|
+
...schema,
|
|
1183
|
+
orbitals: schema.orbitals.map((orbital) => ({
|
|
1184
|
+
...orbital,
|
|
1185
|
+
traits: orbital.traits.map((trait) => {
|
|
1186
|
+
if (typeof trait === "string") return trait;
|
|
1187
|
+
const id = traitIdentity(trait);
|
|
1188
|
+
const values = id !== void 0 ? overrides[id] : void 0;
|
|
1189
|
+
return values !== void 0 ? overrideTrait(trait, values) : trait;
|
|
1190
|
+
})
|
|
1191
|
+
}))
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1153
1195
|
// src/builders/layout-strategy.ts
|
|
1154
1196
|
function hasSequentialChain(wiring) {
|
|
1155
1197
|
if (wiring.length < 2) {
|
|
@@ -1683,6 +1725,6 @@ function pipe(orbitals, events, appName) {
|
|
|
1683
1725
|
};
|
|
1684
1726
|
}
|
|
1685
1727
|
|
|
1686
|
-
export { applyEventWiring, compose, composeBehaviors, connect, detectLayoutStrategy, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeOrbitals, pipe, plural, wire };
|
|
1728
|
+
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
1729
|
//# sourceMappingURL=builders.js.map
|
|
1688
1730
|
//# sourceMappingURL=builders.js.map
|