@rotorsoft/act-diagram 0.1.1 → 0.1.2

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 +1 @@
1
- {"version":3,"file":"build-model.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/build-model.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAGV,WAAW,EAEX,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAqF3B,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAIF,wBAAgB,UAAU,CACxB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,OAAO,EAAE,EAChB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAyNxC"}
1
+ {"version":3,"file":"build-model.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/build-model.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAGV,WAAW,EAEX,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAqF3B,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAIF,wBAAgB,UAAU,CACxB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,OAAO,EAAE,EAChB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAqQxC"}
package/dist/index.cjs CHANGED
@@ -247,11 +247,40 @@ function buildModel(result, files, expectedSlices) {
247
247
  model.reactions.push(r);
248
248
  }
249
249
  const entryPath = a._sourceFile ?? "app.ts";
250
+ const actSliceNames = new Set(
251
+ (a.slices ?? []).filter((s) => s != null).map((s) => s._varName ?? "").filter(Boolean)
252
+ );
253
+ for (const sl of model.slices) {
254
+ if (sl.error && !actSliceNames.has(sl.name)) {
255
+ const actSrc = files.find((f) => f.path === entryPath)?.content ?? "";
256
+ if (actSrc.includes(sl.name)) {
257
+ actSliceNames.add(sl.name);
258
+ }
259
+ }
260
+ }
261
+ const entrySlices = model.slices.filter((s) => actSliceNames.has(s.name));
262
+ const sliceStateKeys = new Set(entrySlices.flatMap((s) => s.states));
263
+ const actStateKeys = /* @__PURE__ */ new Set();
264
+ for (const s of a.states ?? []) {
265
+ try {
266
+ if (s && s._tag === "State") {
267
+ actStateKeys.add(s._modelKey ?? s.name);
268
+ }
269
+ } catch {
270
+ }
271
+ }
272
+ const allStateKeys = /* @__PURE__ */ new Set([...actStateKeys, ...sliceStateKeys]);
273
+ const actProjNames = new Set(
274
+ (a.projections ?? []).filter((p) => p && p._tag === "Projection").map((p) => p.target)
275
+ );
276
+ for (const sl of entrySlices) {
277
+ for (const pn of sl.projections) actProjNames.add(pn);
278
+ }
250
279
  model.entries.push({
251
280
  path: entryPath,
252
- states: model.states,
253
- slices: model.slices,
254
- projections: model.projections,
281
+ states: model.states.filter((s) => allStateKeys.has(s.varName)),
282
+ slices: entrySlices,
283
+ projections: model.projections.filter((p) => actProjNames.has(p.name)),
255
284
  reactions: a.reactions ?? []
256
285
  });
257
286
  }