@almadar/ui 4.28.0 → 4.29.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/avl/index.cjs +127 -16
- package/dist/avl/index.css +1 -1
- package/dist/avl/index.js +128 -17
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.css +1 -1
- package/dist/components/index.js +2 -2
- package/dist/docs/index.cjs +2 -2
- package/dist/docs/index.js +2 -2
- package/dist/marketing/index.cjs +2 -2
- package/dist/marketing/index.js +2 -2
- package/dist/providers/index.cjs +2 -2
- package/dist/providers/index.css +1 -1
- package/dist/providers/index.js +2 -2
- package/dist/runtime/index.cjs +2 -2
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/index.js +2 -2
- package/package.json +14 -8
package/dist/avl/index.cjs
CHANGED
|
@@ -182,7 +182,7 @@ var init_types = __esm({
|
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
|
|
185
|
-
// node_modules
|
|
185
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
186
186
|
function r(e) {
|
|
187
187
|
var t, f, n = "";
|
|
188
188
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -197,11 +197,11 @@ function clsx() {
|
|
|
197
197
|
return n;
|
|
198
198
|
}
|
|
199
199
|
var init_clsx = __esm({
|
|
200
|
-
"node_modules
|
|
200
|
+
"node_modules/clsx/dist/clsx.mjs"() {
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
203
|
|
|
204
|
-
// node_modules
|
|
204
|
+
// node_modules/tailwind-merge/dist/bundle-mjs.mjs
|
|
205
205
|
function twJoin() {
|
|
206
206
|
let index = 0;
|
|
207
207
|
let argument;
|
|
@@ -245,7 +245,7 @@ function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
|
245
245
|
}
|
|
246
246
|
var CLASS_PART_SEPARATOR, createClassGroupUtils, getGroupRecursive, arbitraryPropertyRegex, getGroupIdForArbitraryProperty, createClassMap, processClassesRecursively, getPart, isThemeGetter, getPrefixedClassGroupEntries, createLruCache, IMPORTANT_MODIFIER, createParseClassName, sortModifiers, createConfigUtils, SPLIT_CLASSES_REGEX, mergeClassList, toValue, fromTheme, arbitraryValueRegex, fractionRegex, stringLengths, tshirtUnitRegex, lengthUnitRegex, colorFunctionRegex, shadowRegex, imageRegex, isLength, isArbitraryLength, isNumber, isArbitraryNumber, isInteger, isPercent, isArbitraryValue, isTshirtSize, sizeLabels, isArbitrarySize, isArbitraryPosition, imageLabels, isArbitraryImage, isArbitraryShadow, isAny, getIsArbitraryValue, isLengthOnly, isNever, isShadow, isImage, getDefaultConfig, twMerge;
|
|
247
247
|
var init_bundle_mjs = __esm({
|
|
248
|
-
"node_modules
|
|
248
|
+
"node_modules/tailwind-merge/dist/bundle-mjs.mjs"() {
|
|
249
249
|
CLASS_PART_SEPARATOR = "-";
|
|
250
250
|
createClassGroupUtils = (config) => {
|
|
251
251
|
const classMap = createClassMap(config);
|
|
@@ -12838,9 +12838,9 @@ var init_ScaledDiagram = __esm({
|
|
|
12838
12838
|
}
|
|
12839
12839
|
});
|
|
12840
12840
|
|
|
12841
|
-
// node_modules
|
|
12841
|
+
// node_modules/katex/dist/katex.min.css
|
|
12842
12842
|
var init_katex_min = __esm({
|
|
12843
|
-
"node_modules
|
|
12843
|
+
"node_modules/katex/dist/katex.min.css"() {
|
|
12844
12844
|
}
|
|
12845
12845
|
});
|
|
12846
12846
|
var MarkdownContent;
|
|
@@ -50433,6 +50433,11 @@ function formatPayloadTooltip(fields) {
|
|
|
50433
50433
|
);
|
|
50434
50434
|
return `{ ${parts.join(", ")} }`;
|
|
50435
50435
|
}
|
|
50436
|
+
function entityNameOf(ref) {
|
|
50437
|
+
if (!ref) return void 0;
|
|
50438
|
+
if (typeof ref === "string") return ref;
|
|
50439
|
+
return "name" in ref ? ref.name : void 0;
|
|
50440
|
+
}
|
|
50436
50441
|
var ScreenSizeContext = React118.createContext("tablet");
|
|
50437
50442
|
var PatternSelectionContext = React118.createContext({ selected: null, select: () => {
|
|
50438
50443
|
} });
|
|
@@ -50473,19 +50478,116 @@ function buildOrbitalSchema(fullSchema, orbitalName) {
|
|
|
50473
50478
|
if (!orbital) return fullSchema;
|
|
50474
50479
|
return { ...fullSchema, name: `${fullSchema.name}__${orbitalName}`, orbitals: [orbital] };
|
|
50475
50480
|
}
|
|
50476
|
-
function
|
|
50481
|
+
function generateMockPayload(payloadSchema, schema, linkedEntity, mockData) {
|
|
50482
|
+
const payload = {};
|
|
50483
|
+
if (!payloadSchema || payloadSchema.length === 0) return payload;
|
|
50484
|
+
const entityNames = /* @__PURE__ */ new Set();
|
|
50485
|
+
for (const orb of schema.orbitals ?? []) {
|
|
50486
|
+
const name = entityNameOf(orb.entity);
|
|
50487
|
+
if (name) entityNames.add(name);
|
|
50488
|
+
}
|
|
50489
|
+
const linkedRows = linkedEntity ? mockData?.[linkedEntity] ?? [] : [];
|
|
50490
|
+
const linkedFirstRow = linkedRows[0];
|
|
50491
|
+
const valueForType = (rawType, entityType) => {
|
|
50492
|
+
const type = rawType.replace(/!$/, "").trim();
|
|
50493
|
+
const arrayMatch = /^\[\s*(\w+)\s*\]$/.exec(type);
|
|
50494
|
+
if (arrayMatch) {
|
|
50495
|
+
return mockData?.[arrayMatch[1]] ?? linkedRows;
|
|
50496
|
+
}
|
|
50497
|
+
if (type === "array") return linkedRows;
|
|
50498
|
+
if (type === "entity") {
|
|
50499
|
+
const target = entityType && mockData?.[entityType] ? entityType : linkedEntity;
|
|
50500
|
+
return (target && mockData?.[target]?.[0]) ?? linkedFirstRow ?? {};
|
|
50501
|
+
}
|
|
50502
|
+
if (entityNames.has(type)) {
|
|
50503
|
+
return mockData?.[type]?.[0] ?? linkedFirstRow ?? {};
|
|
50504
|
+
}
|
|
50505
|
+
switch (type) {
|
|
50506
|
+
case "string":
|
|
50507
|
+
return "Sample";
|
|
50508
|
+
case "number":
|
|
50509
|
+
return 1;
|
|
50510
|
+
case "boolean":
|
|
50511
|
+
return false;
|
|
50512
|
+
case "object":
|
|
50513
|
+
return {};
|
|
50514
|
+
case "date":
|
|
50515
|
+
case "datetime":
|
|
50516
|
+
case "timestamp":
|
|
50517
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
50518
|
+
default:
|
|
50519
|
+
return void 0;
|
|
50520
|
+
}
|
|
50521
|
+
};
|
|
50522
|
+
const setByPath = (target, path, value) => {
|
|
50523
|
+
const parts = path.split(".");
|
|
50524
|
+
let cur = target;
|
|
50525
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
50526
|
+
const k = parts[i];
|
|
50527
|
+
const next = cur[k];
|
|
50528
|
+
if (next === null || typeof next !== "object" || Array.isArray(next)) {
|
|
50529
|
+
cur[k] = {};
|
|
50530
|
+
}
|
|
50531
|
+
cur = cur[k];
|
|
50532
|
+
}
|
|
50533
|
+
cur[parts[parts.length - 1]] = value;
|
|
50534
|
+
};
|
|
50535
|
+
for (const field of payloadSchema) {
|
|
50536
|
+
let value = valueForType(field.type, field.entityType);
|
|
50537
|
+
if (linkedFirstRow !== void 0 && field.name.includes(".") && (typeof value === "string" || typeof value === "number" || typeof value === "boolean")) {
|
|
50538
|
+
const tail = field.name.split(".").pop();
|
|
50539
|
+
const fromRow = linkedFirstRow[tail];
|
|
50540
|
+
if (fromRow !== void 0) value = fromRow;
|
|
50541
|
+
}
|
|
50542
|
+
setByPath(payload, field.name, value);
|
|
50543
|
+
}
|
|
50544
|
+
return payload;
|
|
50545
|
+
}
|
|
50546
|
+
function substitutePayloadBindings(effects, payload) {
|
|
50547
|
+
const isPayloadObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v) && !(v instanceof Date);
|
|
50548
|
+
const getByPath = (path) => {
|
|
50549
|
+
let cur = payload;
|
|
50550
|
+
for (const k of path.split(".")) {
|
|
50551
|
+
if (!isPayloadObject(cur)) return void 0;
|
|
50552
|
+
cur = cur[k];
|
|
50553
|
+
}
|
|
50554
|
+
return cur;
|
|
50555
|
+
};
|
|
50556
|
+
const replaceValue = (v) => {
|
|
50557
|
+
if (typeof v === "string" && v.startsWith("@payload.")) {
|
|
50558
|
+
const resolved = getByPath(v.slice("@payload.".length));
|
|
50559
|
+
return resolved === void 0 ? v : resolved;
|
|
50560
|
+
}
|
|
50561
|
+
if (Array.isArray(v)) return v.map(replaceValue);
|
|
50562
|
+
if (v && typeof v === "object" && !(v instanceof Date)) {
|
|
50563
|
+
const out = {};
|
|
50564
|
+
for (const [k, inner] of Object.entries(v)) {
|
|
50565
|
+
out[k] = replaceValue(inner);
|
|
50566
|
+
}
|
|
50567
|
+
return out;
|
|
50568
|
+
}
|
|
50569
|
+
return v;
|
|
50570
|
+
};
|
|
50571
|
+
const tree = JSON.parse(JSON.stringify(effects));
|
|
50572
|
+
const substituted = replaceValue(tree);
|
|
50573
|
+
return substituted;
|
|
50574
|
+
}
|
|
50575
|
+
function findEmitContract(trait, event) {
|
|
50576
|
+
return trait.emits?.find((e) => e.event === event);
|
|
50577
|
+
}
|
|
50578
|
+
function buildTransitionSchema(fullSchema, orbitalName, traitName, transitionEvent, fromState, toState, mockData) {
|
|
50477
50579
|
const orbital = (fullSchema.orbitals ?? []).find((o) => o.name === orbitalName);
|
|
50478
50580
|
if (!orbital) return fullSchema;
|
|
50479
50581
|
const clonedOrbital = JSON.parse(JSON.stringify(orbital));
|
|
50480
50582
|
const traits2 = clonedOrbital.traits ?? [];
|
|
50481
50583
|
for (let ti = 0; ti < traits2.length; ti++) {
|
|
50482
50584
|
const trait = traits2[ti];
|
|
50483
|
-
if (
|
|
50585
|
+
if (!core.isInlineTrait(trait)) continue;
|
|
50484
50586
|
const traitObj = trait;
|
|
50485
50587
|
if (traitObj.name !== traitName) continue;
|
|
50486
50588
|
const sm = traitObj.stateMachine;
|
|
50487
50589
|
if (!sm) continue;
|
|
50488
|
-
const allTransitions = sm.transitions;
|
|
50590
|
+
const allTransitions = sm.transitions ?? [];
|
|
50489
50591
|
const targetTransition = fromState && toState ? allTransitions.find((t) => t.event === transitionEvent && t.from === fromState && t.to === toState) ?? allTransitions.find((t) => t.event === transitionEvent) : allTransitions.find((t) => t.event === transitionEvent);
|
|
50490
50592
|
if (!targetTransition?.effects) continue;
|
|
50491
50593
|
const renderUIEffects = [];
|
|
@@ -50495,14 +50597,22 @@ function buildTransitionSchema(fullSchema, orbitalName, traitName, transitionEve
|
|
|
50495
50597
|
}
|
|
50496
50598
|
}
|
|
50497
50599
|
if (renderUIEffects.length === 0) continue;
|
|
50498
|
-
const
|
|
50600
|
+
const linkedEntity = traitObj.linkedEntity ?? entityNameOf(clonedOrbital.entity);
|
|
50601
|
+
const emitContract = findEmitContract(traitObj, transitionEvent);
|
|
50602
|
+
const mockPayload = generateMockPayload(
|
|
50603
|
+
emitContract?.payloadSchema,
|
|
50604
|
+
fullSchema,
|
|
50605
|
+
linkedEntity,
|
|
50606
|
+
mockData
|
|
50607
|
+
);
|
|
50608
|
+
const seededEffects = substitutePayloadBindings(renderUIEffects, mockPayload);
|
|
50609
|
+
traitObj.stateMachine = {
|
|
50499
50610
|
states: [{ name: "preview", isInitial: true }],
|
|
50500
50611
|
events: [{ key: "INIT", name: "INIT" }],
|
|
50501
|
-
transitions: [{ from: "preview", to: "preview", event: "INIT", effects:
|
|
50612
|
+
transitions: [{ from: "preview", to: "preview", event: "INIT", effects: seededEffects }]
|
|
50502
50613
|
};
|
|
50503
|
-
|
|
50504
|
-
|
|
50505
|
-
traits2[ti].listens = [];
|
|
50614
|
+
traitObj.emits = [];
|
|
50615
|
+
traitObj.listens = [];
|
|
50506
50616
|
break;
|
|
50507
50617
|
}
|
|
50508
50618
|
const targetTrait = traits2.find((t) => {
|
|
@@ -50568,11 +50678,12 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
50568
50678
|
data.traitName,
|
|
50569
50679
|
data.transitionEvent,
|
|
50570
50680
|
data.fromState,
|
|
50571
|
-
data.toState
|
|
50681
|
+
data.toState,
|
|
50682
|
+
data._mockData
|
|
50572
50683
|
);
|
|
50573
50684
|
}
|
|
50574
50685
|
return buildOrbitalSchema(fullSchema, data.orbitalName);
|
|
50575
|
-
}, [data._fullSchema, data.orbitalName, data.traitName, data.transitionEvent, data.fromState, data.toState, isExpanded]);
|
|
50686
|
+
}, [data._fullSchema, data._mockData, data.orbitalName, data.traitName, data.transitionEvent, data.fromState, data.toState, isExpanded]);
|
|
50576
50687
|
const handleContentClick = React118.useCallback((e) => {
|
|
50577
50688
|
e.stopPropagation();
|
|
50578
50689
|
const target = e.target;
|
package/dist/avl/index.css
CHANGED
package/dist/avl/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import langDiff from 'react-syntax-highlighter/dist/esm/languages/prism/diff.js'
|
|
|
30
30
|
import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js';
|
|
31
31
|
import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
|
|
32
32
|
import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
|
|
33
|
-
import { FieldTypeSchema, isEntityCall, schemaToIR, getPage, isCircuitEvent
|
|
33
|
+
import { FieldTypeSchema, isInlineTrait, isEntityCall, schemaToIR, getPage, isCircuitEvent } from '@almadar/core';
|
|
34
34
|
import { useThree, useFrame, Canvas } from '@react-three/fiber';
|
|
35
35
|
import * as THREE6 from 'three';
|
|
36
36
|
import { Vector3, QuadraticBezierCurve3, MathUtils, Quaternion } from 'three';
|
|
@@ -136,7 +136,7 @@ var init_types = __esm({
|
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
// node_modules
|
|
139
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
140
140
|
function r(e) {
|
|
141
141
|
var t, f, n = "";
|
|
142
142
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -151,11 +151,11 @@ function clsx() {
|
|
|
151
151
|
return n;
|
|
152
152
|
}
|
|
153
153
|
var init_clsx = __esm({
|
|
154
|
-
"node_modules
|
|
154
|
+
"node_modules/clsx/dist/clsx.mjs"() {
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
// node_modules
|
|
158
|
+
// node_modules/tailwind-merge/dist/bundle-mjs.mjs
|
|
159
159
|
function twJoin() {
|
|
160
160
|
let index = 0;
|
|
161
161
|
let argument;
|
|
@@ -199,7 +199,7 @@ function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
|
199
199
|
}
|
|
200
200
|
var CLASS_PART_SEPARATOR, createClassGroupUtils, getGroupRecursive, arbitraryPropertyRegex, getGroupIdForArbitraryProperty, createClassMap, processClassesRecursively, getPart, isThemeGetter, getPrefixedClassGroupEntries, createLruCache, IMPORTANT_MODIFIER, createParseClassName, sortModifiers, createConfigUtils, SPLIT_CLASSES_REGEX, mergeClassList, toValue, fromTheme, arbitraryValueRegex, fractionRegex, stringLengths, tshirtUnitRegex, lengthUnitRegex, colorFunctionRegex, shadowRegex, imageRegex, isLength, isArbitraryLength, isNumber, isArbitraryNumber, isInteger, isPercent, isArbitraryValue, isTshirtSize, sizeLabels, isArbitrarySize, isArbitraryPosition, imageLabels, isArbitraryImage, isArbitraryShadow, isAny, getIsArbitraryValue, isLengthOnly, isNever, isShadow, isImage, getDefaultConfig, twMerge;
|
|
201
201
|
var init_bundle_mjs = __esm({
|
|
202
|
-
"node_modules
|
|
202
|
+
"node_modules/tailwind-merge/dist/bundle-mjs.mjs"() {
|
|
203
203
|
CLASS_PART_SEPARATOR = "-";
|
|
204
204
|
createClassGroupUtils = (config) => {
|
|
205
205
|
const classMap = createClassMap(config);
|
|
@@ -12792,9 +12792,9 @@ var init_ScaledDiagram = __esm({
|
|
|
12792
12792
|
}
|
|
12793
12793
|
});
|
|
12794
12794
|
|
|
12795
|
-
// node_modules
|
|
12795
|
+
// node_modules/katex/dist/katex.min.css
|
|
12796
12796
|
var init_katex_min = __esm({
|
|
12797
|
-
"node_modules
|
|
12797
|
+
"node_modules/katex/dist/katex.min.css"() {
|
|
12798
12798
|
}
|
|
12799
12799
|
});
|
|
12800
12800
|
var MarkdownContent;
|
|
@@ -50387,6 +50387,11 @@ function formatPayloadTooltip(fields) {
|
|
|
50387
50387
|
);
|
|
50388
50388
|
return `{ ${parts.join(", ")} }`;
|
|
50389
50389
|
}
|
|
50390
|
+
function entityNameOf(ref) {
|
|
50391
|
+
if (!ref) return void 0;
|
|
50392
|
+
if (typeof ref === "string") return ref;
|
|
50393
|
+
return "name" in ref ? ref.name : void 0;
|
|
50394
|
+
}
|
|
50390
50395
|
var ScreenSizeContext = createContext("tablet");
|
|
50391
50396
|
var PatternSelectionContext = createContext({ selected: null, select: () => {
|
|
50392
50397
|
} });
|
|
@@ -50427,19 +50432,116 @@ function buildOrbitalSchema(fullSchema, orbitalName) {
|
|
|
50427
50432
|
if (!orbital) return fullSchema;
|
|
50428
50433
|
return { ...fullSchema, name: `${fullSchema.name}__${orbitalName}`, orbitals: [orbital] };
|
|
50429
50434
|
}
|
|
50430
|
-
function
|
|
50435
|
+
function generateMockPayload(payloadSchema, schema, linkedEntity, mockData) {
|
|
50436
|
+
const payload = {};
|
|
50437
|
+
if (!payloadSchema || payloadSchema.length === 0) return payload;
|
|
50438
|
+
const entityNames = /* @__PURE__ */ new Set();
|
|
50439
|
+
for (const orb of schema.orbitals ?? []) {
|
|
50440
|
+
const name = entityNameOf(orb.entity);
|
|
50441
|
+
if (name) entityNames.add(name);
|
|
50442
|
+
}
|
|
50443
|
+
const linkedRows = linkedEntity ? mockData?.[linkedEntity] ?? [] : [];
|
|
50444
|
+
const linkedFirstRow = linkedRows[0];
|
|
50445
|
+
const valueForType = (rawType, entityType) => {
|
|
50446
|
+
const type = rawType.replace(/!$/, "").trim();
|
|
50447
|
+
const arrayMatch = /^\[\s*(\w+)\s*\]$/.exec(type);
|
|
50448
|
+
if (arrayMatch) {
|
|
50449
|
+
return mockData?.[arrayMatch[1]] ?? linkedRows;
|
|
50450
|
+
}
|
|
50451
|
+
if (type === "array") return linkedRows;
|
|
50452
|
+
if (type === "entity") {
|
|
50453
|
+
const target = entityType && mockData?.[entityType] ? entityType : linkedEntity;
|
|
50454
|
+
return (target && mockData?.[target]?.[0]) ?? linkedFirstRow ?? {};
|
|
50455
|
+
}
|
|
50456
|
+
if (entityNames.has(type)) {
|
|
50457
|
+
return mockData?.[type]?.[0] ?? linkedFirstRow ?? {};
|
|
50458
|
+
}
|
|
50459
|
+
switch (type) {
|
|
50460
|
+
case "string":
|
|
50461
|
+
return "Sample";
|
|
50462
|
+
case "number":
|
|
50463
|
+
return 1;
|
|
50464
|
+
case "boolean":
|
|
50465
|
+
return false;
|
|
50466
|
+
case "object":
|
|
50467
|
+
return {};
|
|
50468
|
+
case "date":
|
|
50469
|
+
case "datetime":
|
|
50470
|
+
case "timestamp":
|
|
50471
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
50472
|
+
default:
|
|
50473
|
+
return void 0;
|
|
50474
|
+
}
|
|
50475
|
+
};
|
|
50476
|
+
const setByPath = (target, path, value) => {
|
|
50477
|
+
const parts = path.split(".");
|
|
50478
|
+
let cur = target;
|
|
50479
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
50480
|
+
const k = parts[i];
|
|
50481
|
+
const next = cur[k];
|
|
50482
|
+
if (next === null || typeof next !== "object" || Array.isArray(next)) {
|
|
50483
|
+
cur[k] = {};
|
|
50484
|
+
}
|
|
50485
|
+
cur = cur[k];
|
|
50486
|
+
}
|
|
50487
|
+
cur[parts[parts.length - 1]] = value;
|
|
50488
|
+
};
|
|
50489
|
+
for (const field of payloadSchema) {
|
|
50490
|
+
let value = valueForType(field.type, field.entityType);
|
|
50491
|
+
if (linkedFirstRow !== void 0 && field.name.includes(".") && (typeof value === "string" || typeof value === "number" || typeof value === "boolean")) {
|
|
50492
|
+
const tail = field.name.split(".").pop();
|
|
50493
|
+
const fromRow = linkedFirstRow[tail];
|
|
50494
|
+
if (fromRow !== void 0) value = fromRow;
|
|
50495
|
+
}
|
|
50496
|
+
setByPath(payload, field.name, value);
|
|
50497
|
+
}
|
|
50498
|
+
return payload;
|
|
50499
|
+
}
|
|
50500
|
+
function substitutePayloadBindings(effects, payload) {
|
|
50501
|
+
const isPayloadObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v) && !(v instanceof Date);
|
|
50502
|
+
const getByPath = (path) => {
|
|
50503
|
+
let cur = payload;
|
|
50504
|
+
for (const k of path.split(".")) {
|
|
50505
|
+
if (!isPayloadObject(cur)) return void 0;
|
|
50506
|
+
cur = cur[k];
|
|
50507
|
+
}
|
|
50508
|
+
return cur;
|
|
50509
|
+
};
|
|
50510
|
+
const replaceValue = (v) => {
|
|
50511
|
+
if (typeof v === "string" && v.startsWith("@payload.")) {
|
|
50512
|
+
const resolved = getByPath(v.slice("@payload.".length));
|
|
50513
|
+
return resolved === void 0 ? v : resolved;
|
|
50514
|
+
}
|
|
50515
|
+
if (Array.isArray(v)) return v.map(replaceValue);
|
|
50516
|
+
if (v && typeof v === "object" && !(v instanceof Date)) {
|
|
50517
|
+
const out = {};
|
|
50518
|
+
for (const [k, inner] of Object.entries(v)) {
|
|
50519
|
+
out[k] = replaceValue(inner);
|
|
50520
|
+
}
|
|
50521
|
+
return out;
|
|
50522
|
+
}
|
|
50523
|
+
return v;
|
|
50524
|
+
};
|
|
50525
|
+
const tree = JSON.parse(JSON.stringify(effects));
|
|
50526
|
+
const substituted = replaceValue(tree);
|
|
50527
|
+
return substituted;
|
|
50528
|
+
}
|
|
50529
|
+
function findEmitContract(trait, event) {
|
|
50530
|
+
return trait.emits?.find((e) => e.event === event);
|
|
50531
|
+
}
|
|
50532
|
+
function buildTransitionSchema(fullSchema, orbitalName, traitName, transitionEvent, fromState, toState, mockData) {
|
|
50431
50533
|
const orbital = (fullSchema.orbitals ?? []).find((o) => o.name === orbitalName);
|
|
50432
50534
|
if (!orbital) return fullSchema;
|
|
50433
50535
|
const clonedOrbital = JSON.parse(JSON.stringify(orbital));
|
|
50434
50536
|
const traits2 = clonedOrbital.traits ?? [];
|
|
50435
50537
|
for (let ti = 0; ti < traits2.length; ti++) {
|
|
50436
50538
|
const trait = traits2[ti];
|
|
50437
|
-
if (
|
|
50539
|
+
if (!isInlineTrait(trait)) continue;
|
|
50438
50540
|
const traitObj = trait;
|
|
50439
50541
|
if (traitObj.name !== traitName) continue;
|
|
50440
50542
|
const sm = traitObj.stateMachine;
|
|
50441
50543
|
if (!sm) continue;
|
|
50442
|
-
const allTransitions = sm.transitions;
|
|
50544
|
+
const allTransitions = sm.transitions ?? [];
|
|
50443
50545
|
const targetTransition = fromState && toState ? allTransitions.find((t) => t.event === transitionEvent && t.from === fromState && t.to === toState) ?? allTransitions.find((t) => t.event === transitionEvent) : allTransitions.find((t) => t.event === transitionEvent);
|
|
50444
50546
|
if (!targetTransition?.effects) continue;
|
|
50445
50547
|
const renderUIEffects = [];
|
|
@@ -50449,14 +50551,22 @@ function buildTransitionSchema(fullSchema, orbitalName, traitName, transitionEve
|
|
|
50449
50551
|
}
|
|
50450
50552
|
}
|
|
50451
50553
|
if (renderUIEffects.length === 0) continue;
|
|
50452
|
-
const
|
|
50554
|
+
const linkedEntity = traitObj.linkedEntity ?? entityNameOf(clonedOrbital.entity);
|
|
50555
|
+
const emitContract = findEmitContract(traitObj, transitionEvent);
|
|
50556
|
+
const mockPayload = generateMockPayload(
|
|
50557
|
+
emitContract?.payloadSchema,
|
|
50558
|
+
fullSchema,
|
|
50559
|
+
linkedEntity,
|
|
50560
|
+
mockData
|
|
50561
|
+
);
|
|
50562
|
+
const seededEffects = substitutePayloadBindings(renderUIEffects, mockPayload);
|
|
50563
|
+
traitObj.stateMachine = {
|
|
50453
50564
|
states: [{ name: "preview", isInitial: true }],
|
|
50454
50565
|
events: [{ key: "INIT", name: "INIT" }],
|
|
50455
|
-
transitions: [{ from: "preview", to: "preview", event: "INIT", effects:
|
|
50566
|
+
transitions: [{ from: "preview", to: "preview", event: "INIT", effects: seededEffects }]
|
|
50456
50567
|
};
|
|
50457
|
-
|
|
50458
|
-
|
|
50459
|
-
traits2[ti].listens = [];
|
|
50568
|
+
traitObj.emits = [];
|
|
50569
|
+
traitObj.listens = [];
|
|
50460
50570
|
break;
|
|
50461
50571
|
}
|
|
50462
50572
|
const targetTrait = traits2.find((t) => {
|
|
@@ -50522,11 +50632,12 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
50522
50632
|
data.traitName,
|
|
50523
50633
|
data.transitionEvent,
|
|
50524
50634
|
data.fromState,
|
|
50525
|
-
data.toState
|
|
50635
|
+
data.toState,
|
|
50636
|
+
data._mockData
|
|
50526
50637
|
);
|
|
50527
50638
|
}
|
|
50528
50639
|
return buildOrbitalSchema(fullSchema, data.orbitalName);
|
|
50529
|
-
}, [data._fullSchema, data.orbitalName, data.traitName, data.transitionEvent, data.fromState, data.toState, isExpanded]);
|
|
50640
|
+
}, [data._fullSchema, data._mockData, data.orbitalName, data.traitName, data.transitionEvent, data.fromState, data.toState, isExpanded]);
|
|
50530
50641
|
const handleContentClick = useCallback((e) => {
|
|
50531
50642
|
e.stopPropagation();
|
|
50532
50643
|
const target = e.target;
|
|
@@ -8974,9 +8974,9 @@ var init_ScaledDiagram = __esm({
|
|
|
8974
8974
|
}
|
|
8975
8975
|
});
|
|
8976
8976
|
|
|
8977
|
-
// node_modules
|
|
8977
|
+
// node_modules/katex/dist/katex.min.css
|
|
8978
8978
|
var init_katex_min = __esm({
|
|
8979
|
-
"node_modules
|
|
8979
|
+
"node_modules/katex/dist/katex.min.css"() {
|
|
8980
8980
|
}
|
|
8981
8981
|
});
|
|
8982
8982
|
exports.MarkdownContent = void 0;
|
package/dist/components/index.js
CHANGED
|
@@ -8929,9 +8929,9 @@ var init_ScaledDiagram = __esm({
|
|
|
8929
8929
|
}
|
|
8930
8930
|
});
|
|
8931
8931
|
|
|
8932
|
-
// node_modules
|
|
8932
|
+
// node_modules/katex/dist/katex.min.css
|
|
8933
8933
|
var init_katex_min = __esm({
|
|
8934
|
-
"node_modules
|
|
8934
|
+
"node_modules/katex/dist/katex.min.css"() {
|
|
8935
8935
|
}
|
|
8936
8936
|
});
|
|
8937
8937
|
var MarkdownContent;
|
package/dist/docs/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React5__default = /*#__PURE__*/_interopDefault(React5);
|
|
28
28
|
var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
|
|
29
29
|
|
|
30
|
-
// node_modules
|
|
30
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
31
31
|
function r(e) {
|
|
32
32
|
var t, f, n = "";
|
|
33
33
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -42,7 +42,7 @@ function clsx() {
|
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// node_modules
|
|
45
|
+
// node_modules/tailwind-merge/dist/bundle-mjs.mjs
|
|
46
46
|
var CLASS_PART_SEPARATOR = "-";
|
|
47
47
|
var createClassGroupUtils = (config) => {
|
|
48
48
|
const classMap = createClassMap(config);
|
package/dist/docs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import * as LucideIcons from 'lucide-react';
|
|
4
4
|
import { Loader2, ChevronDown, X } from 'lucide-react';
|
|
5
5
|
|
|
6
|
-
// node_modules
|
|
6
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
7
7
|
function r(e) {
|
|
8
8
|
var t, f, n = "";
|
|
9
9
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -18,7 +18,7 @@ function clsx() {
|
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// node_modules
|
|
21
|
+
// node_modules/tailwind-merge/dist/bundle-mjs.mjs
|
|
22
22
|
var CLASS_PART_SEPARATOR = "-";
|
|
23
23
|
var createClassGroupUtils = (config) => {
|
|
24
24
|
const classMap = createClassMap(config);
|
package/dist/marketing/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React6__default = /*#__PURE__*/_interopDefault(React6);
|
|
28
28
|
var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
|
|
29
29
|
|
|
30
|
-
// node_modules
|
|
30
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
31
31
|
function r(e) {
|
|
32
32
|
var t, f3, n = "";
|
|
33
33
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -42,7 +42,7 @@ function clsx() {
|
|
|
42
42
|
return n;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// node_modules
|
|
45
|
+
// node_modules/tailwind-merge/dist/bundle-mjs.mjs
|
|
46
46
|
var CLASS_PART_SEPARATOR = "-";
|
|
47
47
|
var createClassGroupUtils = (config) => {
|
|
48
48
|
const classMap = createClassMap(config);
|
package/dist/marketing/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import * as LucideIcons from 'lucide-react';
|
|
4
4
|
import { Loader2, Check, User } from 'lucide-react';
|
|
5
5
|
|
|
6
|
-
// node_modules
|
|
6
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
7
7
|
function r(e) {
|
|
8
8
|
var t, f3, n = "";
|
|
9
9
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -18,7 +18,7 @@ function clsx() {
|
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// node_modules
|
|
21
|
+
// node_modules/tailwind-merge/dist/bundle-mjs.mjs
|
|
22
22
|
var CLASS_PART_SEPARATOR = "-";
|
|
23
23
|
var createClassGroupUtils = (config) => {
|
|
24
24
|
const classMap = createClassMap(config);
|
package/dist/providers/index.cjs
CHANGED
|
@@ -9595,9 +9595,9 @@ var init_ScaledDiagram = __esm({
|
|
|
9595
9595
|
}
|
|
9596
9596
|
});
|
|
9597
9597
|
|
|
9598
|
-
// node_modules
|
|
9598
|
+
// node_modules/katex/dist/katex.min.css
|
|
9599
9599
|
var init_katex_min = __esm({
|
|
9600
|
-
"node_modules
|
|
9600
|
+
"node_modules/katex/dist/katex.min.css"() {
|
|
9601
9601
|
}
|
|
9602
9602
|
});
|
|
9603
9603
|
var MarkdownContent;
|
package/dist/providers/index.css
CHANGED
package/dist/providers/index.js
CHANGED
|
@@ -9550,9 +9550,9 @@ var init_ScaledDiagram = __esm({
|
|
|
9550
9550
|
}
|
|
9551
9551
|
});
|
|
9552
9552
|
|
|
9553
|
-
// node_modules
|
|
9553
|
+
// node_modules/katex/dist/katex.min.css
|
|
9554
9554
|
var init_katex_min = __esm({
|
|
9555
|
-
"node_modules
|
|
9555
|
+
"node_modules/katex/dist/katex.min.css"() {
|
|
9556
9556
|
}
|
|
9557
9557
|
});
|
|
9558
9558
|
var MarkdownContent;
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -9495,9 +9495,9 @@ var init_ScaledDiagram = __esm({
|
|
|
9495
9495
|
}
|
|
9496
9496
|
});
|
|
9497
9497
|
|
|
9498
|
-
// node_modules
|
|
9498
|
+
// node_modules/katex/dist/katex.min.css
|
|
9499
9499
|
var init_katex_min = __esm({
|
|
9500
|
-
"node_modules
|
|
9500
|
+
"node_modules/katex/dist/katex.min.css"() {
|
|
9501
9501
|
}
|
|
9502
9502
|
});
|
|
9503
9503
|
var MarkdownContent;
|
package/dist/runtime/index.css
CHANGED
package/dist/runtime/index.js
CHANGED
|
@@ -9450,9 +9450,9 @@ var init_ScaledDiagram = __esm({
|
|
|
9450
9450
|
}
|
|
9451
9451
|
});
|
|
9452
9452
|
|
|
9453
|
-
// node_modules
|
|
9453
|
+
// node_modules/katex/dist/katex.min.css
|
|
9454
9454
|
var init_katex_min = __esm({
|
|
9455
|
-
"node_modules
|
|
9455
|
+
"node_modules/katex/dist/katex.min.css"() {
|
|
9456
9456
|
}
|
|
9457
9457
|
});
|
|
9458
9458
|
var MarkdownContent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.0",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -121,6 +121,13 @@
|
|
|
121
121
|
"registry": "https://registry.npmjs.org",
|
|
122
122
|
"access": "public"
|
|
123
123
|
},
|
|
124
|
+
"scripts": {
|
|
125
|
+
"build": "tsup && tsc -p tsconfig.build.json",
|
|
126
|
+
"build:watch": "tsup --watch",
|
|
127
|
+
"storybook": "storybook dev -p 6006",
|
|
128
|
+
"build-storybook": "storybook build -o storybook-static",
|
|
129
|
+
"typecheck": "tsc --noEmit"
|
|
130
|
+
},
|
|
124
131
|
"dependencies": {
|
|
125
132
|
"@almadar/core": ">=7.12.0",
|
|
126
133
|
"@almadar/evaluator": ">=2.9.2",
|
|
@@ -212,11 +219,10 @@
|
|
|
212
219
|
"hooks"
|
|
213
220
|
],
|
|
214
221
|
"homepage": "https://github.com/almadar-io/almadar#readme",
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
"typecheck": "tsc --noEmit"
|
|
222
|
+
"pnpm": {
|
|
223
|
+
"overrides": {
|
|
224
|
+
"@types/react": "^19.0.0",
|
|
225
|
+
"@types/react-dom": "^19.0.0"
|
|
226
|
+
}
|
|
221
227
|
}
|
|
222
|
-
}
|
|
228
|
+
}
|