eventmodeler 0.6.8 → 0.6.9

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.
Files changed (2) hide show
  1. package/dist/index.js +60 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2576,6 +2576,33 @@ function getEntry(doc, scope, id) {
2576
2576
  return;
2577
2577
  return entry instanceof Y4.AbstractType ? entry.toJSON() : entry;
2578
2578
  }
2579
+ // ../packages/canvas-model/src/dimensions.ts
2580
+ var ELEMENT_DIMENSIONS = {
2581
+ commandSticky: { width: 160, height: 100 },
2582
+ eventSticky: { width: 160, height: 100 },
2583
+ readModelSticky: { width: 160, height: 100 },
2584
+ screen: { width: 180, height: 120 },
2585
+ processor: { width: 120, height: 120 },
2586
+ slice: { width: 300, height: 200 },
2587
+ aggregate: { width: 300, height: 200 },
2588
+ actor: { width: 300, height: 200 },
2589
+ chapter: { width: 800, height: 1200 },
2590
+ note: { width: 200, height: 150 },
2591
+ externalEvent: { width: 160, height: 100 },
2592
+ context: { width: 300, height: 200 },
2593
+ swimLane: { width: 300, height: 200 }
2594
+ };
2595
+ var FIXED_SIZE_SCOPE_DIMENSIONS = {
2596
+ commands: ELEMENT_DIMENSIONS.commandSticky,
2597
+ events: ELEMENT_DIMENSIONS.eventSticky,
2598
+ readModels: ELEMENT_DIMENSIONS.readModelSticky,
2599
+ screens: ELEMENT_DIMENSIONS.screen,
2600
+ processors: ELEMENT_DIMENSIONS.processor,
2601
+ externalEvents: ELEMENT_DIMENSIONS.externalEvent
2602
+ };
2603
+ function canonicalSizeForScope(scope) {
2604
+ return FIXED_SIZE_SCOPE_DIMENSIONS[scope];
2605
+ }
2579
2606
  // ../packages/canvas-model/src/actions.ts
2580
2607
  import * as Y5 from "yjs";
2581
2608
  // ../packages/canvas-model/src/containment.ts
@@ -2705,7 +2732,7 @@ var FieldTypeSchema = z.enum([
2705
2732
  "Custom"
2706
2733
  ]);
2707
2734
  var FieldBase = z.object({
2708
- id: z.string().uuid().optional(),
2735
+ id: z.string().uuid().default(() => crypto.randomUUID()),
2709
2736
  name: z.string().min(1),
2710
2737
  fieldType: FieldTypeSchema,
2711
2738
  isList: z.boolean().optional(),
@@ -3704,6 +3731,22 @@ function knownTypeAliases() {
3704
3731
  return TYPES.map((t) => t.type);
3705
3732
  }
3706
3733
 
3734
+ // src/lib/enforce-size.ts
3735
+ function enforceCanonicalSize(meta, entry) {
3736
+ const dims = canonicalSizeForScope(meta.scope);
3737
+ if (!dims)
3738
+ return;
3739
+ const hadW = typeof entry.width === "number";
3740
+ const hadH = typeof entry.height === "number";
3741
+ const mismatched = hadW && entry.width !== dims.width || hadH && entry.height !== dims.height;
3742
+ entry.width = dims.width;
3743
+ entry.height = dims.height;
3744
+ if (mismatched) {
3745
+ return `${meta.type} is a fixed-size element; using canonical ${dims.width}x${dims.height}.`;
3746
+ }
3747
+ return;
3748
+ }
3749
+
3707
3750
  // src/commands/create.ts
3708
3751
  var CREATE_HELP = `
3709
3752
  Place a new element described by a JSON shape. The JSON is validated against
@@ -3714,6 +3757,12 @@ type-specific fields (e.g. \`status\` on slices, \`fields\` on stickies).
3714
3757
  Notes use \`title\` instead of \`name\`. The CLI fills in the id and modelId
3715
3758
  automatically — agents do not need to supply them.
3716
3759
 
3760
+ Fixed-size elements (command, event, read-model, screen, processor,
3761
+ external-event) are not resizable in the editor: the CLI always writes their
3762
+ canonical dimensions, so width/height are optional and any supplied size is
3763
+ overridden (a note is printed when it differs). Containers (slice, chapter,
3764
+ context, …) are resizable — pass the size you want.
3765
+
3717
3766
  Screens accept an optional \`design\` field — an Excalidraw scene as a JSON
3718
3767
  array of elements. The CLI converts the array to the Y.Doc representation that
3719
3768
  the canvas streams in realtime, so passing valid Excalidraw JSON is enough:
@@ -3745,6 +3794,11 @@ function registerCreateCommands(program) {
3745
3794
  console.error(`Invalid JSON: ${err.message}`);
3746
3795
  process.exit(2);
3747
3796
  }
3797
+ if (parsed && typeof parsed === "object") {
3798
+ const note = enforceCanonicalSize(meta, parsed);
3799
+ if (note)
3800
+ console.error(note);
3801
+ }
3748
3802
  const validation = validateEntry(meta.scope, parsed);
3749
3803
  if (!validation.ok) {
3750
3804
  console.error(`Validation failed for ${meta.type}:`);
@@ -3874,6 +3928,11 @@ function registerUpdateCommands(program) {
3874
3928
  console.error(`Invalid JSON: ${err.message}`);
3875
3929
  process.exit(2);
3876
3930
  }
3931
+ if (parsed && typeof parsed === "object") {
3932
+ const note = enforceCanonicalSize(meta, parsed);
3933
+ if (note)
3934
+ console.error(note);
3935
+ }
3877
3936
  const validation = validateEntry(meta.scope, parsed);
3878
3937
  if (!validation.ok) {
3879
3938
  console.error(`Validation failed for ${meta.type}:`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eventmodeler",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "CLI tool for event modeling - explore, design, and generate code from your event models",
5
5
  "type": "module",
6
6
  "repository": {