orcasvn-react-diagrams 0.2.6 → 0.2.8

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.
@@ -743,7 +743,7 @@ var createBasicState = function () { return ({
743
743
  var basicDemoConfig = ({
744
744
  id: 'basic',
745
745
  title: 'Basic Diagram',
746
- description: 'Elements, ports, link, and labels.',
746
+ description: 'Elements, ports, link, and labels. Drag empty paper to pan; use Shift + drag for marquee selection.',
747
747
  createState: createBasicState,
748
748
  elementShapes: baseElementShapes,
749
749
  portShapes: basePortShapes,
@@ -860,23 +860,44 @@ var linkPortCreationDemoConfig = ({
860
860
  var createNestedState = function () { return ({
861
861
  elements: [
862
862
  {
863
- id: 'parent-1',
864
- position: { x: 140, y: 140 },
865
- size: { width: 320, height: 240 },
863
+ id: 'parent-locked',
864
+ position: { x: 110, y: 140 },
865
+ size: { width: 300, height: 240 },
866
+ shapeId: 'panel',
867
+ childElementInteraction: { movable: false },
868
+ },
869
+ {
870
+ id: 'child-locked',
871
+ position: { x: 40, y: 60 },
872
+ size: { width: 160, height: 100 },
873
+ shapeId: 'default',
874
+ parentId: 'parent-locked',
875
+ },
876
+ {
877
+ id: 'parent-free',
878
+ position: { x: 470, y: 140 },
879
+ size: { width: 300, height: 240 },
866
880
  shapeId: 'panel',
867
881
  },
868
882
  {
869
- id: 'child-1',
883
+ id: 'child-free',
870
884
  position: { x: 40, y: 60 },
871
885
  size: { width: 160, height: 100 },
872
886
  shapeId: 'default',
873
- parentId: 'parent-1',
887
+ parentId: 'parent-free',
874
888
  },
875
889
  ],
876
890
  ports: [
877
891
  {
878
- id: 'child-port',
879
- elementId: 'child-1',
892
+ id: 'child-port-locked',
893
+ elementId: 'child-locked',
894
+ position: { x: 20, y: 20 },
895
+ shapeId: 'port-circle',
896
+ anchorCenter: true,
897
+ },
898
+ {
899
+ id: 'child-port-free',
900
+ elementId: 'child-free',
880
901
  position: { x: 20, y: 20 },
881
902
  shapeId: 'port-circle',
882
903
  anchorCenter: true,
@@ -885,28 +906,61 @@ var createNestedState = function () { return ({
885
906
  links: [],
886
907
  texts: [
887
908
  {
888
- id: 'child-label',
889
- content: 'Child',
890
- position: { x: 6, y: -16 },
891
- ownerId: 'child-1',
909
+ id: 'parent-locked-label',
910
+ content: 'Locked child drag',
911
+ position: { x: 12, y: 12 },
912
+ ownerId: 'parent-locked',
913
+ interaction: { movable: false, editable: false },
914
+ },
915
+ {
916
+ id: 'child-locked-label',
917
+ content: 'Drag disabled',
918
+ position: { x: 10, y: 10 },
919
+ ownerId: 'child-locked',
920
+ interaction: { movable: false, editable: false },
921
+ },
922
+ {
923
+ id: 'parent-free-label',
924
+ content: 'Movable child drag',
925
+ position: { x: 12, y: 12 },
926
+ ownerId: 'parent-free',
927
+ interaction: { movable: false, editable: false },
928
+ },
929
+ {
930
+ id: 'child-free-label',
931
+ content: 'Drag enabled',
932
+ position: { x: 10, y: 10 },
933
+ ownerId: 'child-free',
934
+ interaction: { movable: false, editable: false },
892
935
  },
893
936
  ],
894
937
  }); };
895
938
  var nestedDemoConfig = ({
896
939
  id: 'nested',
897
940
  title: 'Nested Elements',
898
- description: 'Parent/child elements with world positioning.',
941
+ description: 'Compare locked and movable child drag; locked children still move through API actions.',
899
942
  createState: createNestedState,
900
943
  elementShapes: baseElementShapes,
901
944
  portShapes: basePortShapes,
902
945
  defaultElementShapeId: 'default',
903
946
  defaultPortShapeId: 'port-circle',
904
947
  actions: [
948
+ {
949
+ id: 'move-locked-child-api',
950
+ label: 'Move locked child (API)',
951
+ run: function (editor, state) {
952
+ var child = state.elements.find(function (element) { return element.id === 'child-locked'; });
953
+ var parent = state.elements.find(function (element) { return element.id === 'parent-locked'; });
954
+ if (!child || !parent)
955
+ return;
956
+ editor.moveElementTo(child.id, parent.position.x + child.position.x + 30, parent.position.y + child.position.y + 10);
957
+ },
958
+ },
905
959
  {
906
960
  id: 'move-parent',
907
- label: 'Move parent',
961
+ label: 'Move locked parent',
908
962
  run: function (editor, state) {
909
- var parent = state.elements.find(function (element) { return element.id === 'parent-1'; });
963
+ var parent = state.elements.find(function (element) { return element.id === 'parent-locked'; });
910
964
  if (!parent)
911
965
  return;
912
966
  editor.moveElementTo(parent.id, parent.position.x + 40, parent.position.y + 20);
@@ -914,15 +968,15 @@ var nestedDemoConfig = ({
914
968
  },
915
969
  {
916
970
  id: 'add-child',
917
- label: 'Add child',
971
+ label: 'Add movable child',
918
972
  run: function (editor, state, demo, helpers) {
919
973
  var _a;
920
- var parent = state.elements.find(function (element) { return element.id === 'parent-1'; });
974
+ var parent = state.elements.find(function (element) { return element.id === 'parent-free'; });
921
975
  if (!parent)
922
976
  return;
923
977
  var offset = helpers.nextOffset();
924
978
  editor.addElement({
925
- id: "child-".concat(createId()),
979
+ id: "child-free-".concat(createId()),
926
980
  position: { x: 30 + offset, y: 50 + offset },
927
981
  size: { width: 140, height: 90 },
928
982
  shapeId: (_a = demo.defaultElementShapeId) !== null && _a !== void 0 ? _a : 'default',
@@ -1067,7 +1121,7 @@ var createSelectionState = function () { return ({
1067
1121
  texts: [
1068
1122
  {
1069
1123
  id: 'select-tip',
1070
- content: 'Click to select, drag to move, Delete/Backspace to remove.',
1124
+ content: 'Click to select, drag to move, drag empty paper to pan, Shift + drag to marquee-select.',
1071
1125
  position: { x: 80, y: 80 },
1072
1126
  },
1073
1127
  ],
@@ -1075,7 +1129,7 @@ var createSelectionState = function () { return ({
1075
1129
  var selectionDemoConfig = ({
1076
1130
  id: 'selection',
1077
1131
  title: 'Selection + Interaction',
1078
- description: 'Click to select, drag to move, marquee-select on empty space, delete to remove.',
1132
+ description: 'Click to select, drag to move, drag empty paper to pan, Shift + drag to marquee-select, delete to remove.',
1079
1133
  createState: createSelectionState,
1080
1134
  elementShapes: baseElementShapes,
1081
1135
  portShapes: basePortShapes,
@@ -1241,147 +1295,496 @@ var linkCancelDemoConfig = ({
1241
1295
  actions: [],
1242
1296
  });
1243
1297
 
1244
- var createAutoLayoutState = function () { return ({
1245
- elements: [
1246
- {
1247
- id: 'layout-row',
1248
- position: { x: 60, y: 80 },
1249
- size: { width: 180, height: 96 },
1250
- shapeId: 'panel',
1251
- layout: { mode: 'horizontal', padding: { x: 14, y: 12 }, gap: 14, align: 'center' },
1252
- },
1253
- { id: 'row-a', position: { x: 0, y: 0 }, size: { width: 62, height: 44 }, shapeId: 'default', parentId: 'layout-row' },
1254
- { id: 'row-b', position: { x: 0, y: 0 }, size: { width: 96, height: 32 }, shapeId: 'default', parentId: 'layout-row' },
1255
- { id: 'row-c', position: { x: 0, y: 0 }, size: { width: 54, height: 56 }, shapeId: 'default', parentId: 'layout-row' },
1256
- {
1257
- id: 'row-nested-owner',
1258
- position: { x: 0, y: 0 },
1259
- size: { width: 82, height: 82 },
1260
- shapeId: 'default',
1261
- parentId: 'layout-row',
1262
- layout: { mode: 'vertical', padding: { x: 8, y: 6 }, gap: 6, align: 'start' },
1263
- },
1264
- { id: 'row-nested-child-a', position: { x: 0, y: 0 }, size: { width: 60, height: 20 }, shapeId: 'default', parentId: 'row-nested-owner' },
1265
- { id: 'row-nested-child-b', position: { x: 0, y: 0 }, size: { width: 76, height: 22 }, shapeId: 'default', parentId: 'row-nested-owner' },
1266
- {
1267
- id: 'layout-column',
1268
- position: { x: 400, y: 70 },
1269
- size: { width: 120, height: 140 },
1270
- shapeId: 'panel',
1271
- layout: { mode: 'vertical', padding: { x: 12, y: 10 }, gap: 16, align: 'end' },
1272
- },
1273
- { id: 'col-a', position: { x: 0, y: 0 }, size: { width: 44, height: 28 }, shapeId: 'default', parentId: 'layout-column' },
1274
- { id: 'col-b', position: { x: 0, y: 0 }, size: { width: 70, height: 36 }, shapeId: 'default', parentId: 'layout-column' },
1275
- { id: 'col-c', position: { x: 0, y: 0 }, size: { width: 92, height: 44 }, shapeId: 'default', parentId: 'layout-column' },
1276
- {
1277
- id: 'layout-grid',
1278
- position: { x: 620, y: 70 },
1279
- size: { width: 160, height: 110 },
1280
- shapeId: 'panel',
1281
- layout: {
1282
- mode: 'grid',
1283
- padding: { x: 10, y: 10 },
1284
- gap: 10,
1285
- align: 'center',
1286
- autoResize: 'grow-shrink',
1287
- gridTemplate: [12, 4, 8],
1288
- gridChildWidthResizeEnabled: false,
1289
- childMinWidth: 24,
1290
- childMinHeight: 18,
1298
+ var createAutoLayoutState = function (lockComparisonChildren) {
1299
+ if (lockComparisonChildren === void 0) { lockComparisonChildren = true; }
1300
+ return ({
1301
+ elements: [
1302
+ {
1303
+ id: 'layout-row',
1304
+ position: { x: 60, y: 80 },
1305
+ size: { width: 180, height: 96 },
1306
+ shapeId: 'panel',
1307
+ layout: { mode: 'horizontal', padding: { x: 14, y: 12 }, gap: 14, align: 'center' },
1291
1308
  },
1292
- },
1293
- { id: 'grid-a', position: { x: 0, y: 0 }, size: { width: 36, height: 26 }, shapeId: 'default', parentId: 'layout-grid' },
1294
- { id: 'grid-b', position: { x: 0, y: 0 }, size: { width: 44, height: 24 }, shapeId: 'default', parentId: 'layout-grid' },
1295
- { id: 'grid-c', position: { x: 0, y: 0 }, size: { width: 50, height: 20 }, shapeId: 'default', parentId: 'layout-grid' },
1296
- { id: 'grid-d', position: { x: 0, y: 0 }, size: { width: 28, height: 30 }, shapeId: 'default', parentId: 'layout-grid' },
1297
- { id: 'grid-e', position: { x: 0, y: 0 }, size: { width: 52, height: 28 }, shapeId: 'default', parentId: 'layout-grid' },
1298
- {
1299
- id: 'layout-nested',
1300
- position: { x: 120, y: 260 },
1301
- size: { width: 190, height: 130 },
1302
- shapeId: 'panel',
1303
- layout: { mode: 'horizontal', padding: { x: 12, y: 12 }, gap: 12, align: 'start' },
1304
- },
1305
- {
1306
- id: 'nested-stack',
1307
- position: { x: 0, y: 0 },
1308
- size: { width: 90, height: 92 },
1309
- shapeId: 'default',
1310
- parentId: 'layout-nested',
1311
- layout: { mode: 'vertical', padding: { x: 8, y: 8 }, gap: 8, align: 'center' },
1312
- },
1313
- { id: 'stack-a', position: { x: 0, y: 0 }, size: { width: 60, height: 24 }, shapeId: 'default', parentId: 'nested-stack' },
1314
- { id: 'stack-b', position: { x: 0, y: 0 }, size: { width: 90, height: 30 }, shapeId: 'default', parentId: 'nested-stack' },
1315
- {
1316
- id: 'stack-overflow',
1317
- position: { x: 0, y: 0 },
1318
- size: { width: 110, height: 26 },
1319
- shapeId: 'default',
1320
- parentId: 'nested-stack',
1321
- },
1322
- { id: 'nested-peer', position: { x: 0, y: 0 }, size: { width: 50, height: 90 }, shapeId: 'default', parentId: 'layout-nested' },
1323
- {
1324
- id: 'layout-manual',
1325
- position: { x: 420, y: 260 },
1326
- size: { width: 190, height: 120 },
1327
- shapeId: 'panel',
1328
- },
1329
- { id: 'manual-a', position: { x: 12, y: 18 }, size: { width: 60, height: 30 }, shapeId: 'default', parentId: 'layout-manual' },
1330
- { id: 'manual-b', position: { x: 90, y: 60 }, size: { width: 68, height: 32 }, shapeId: 'default', parentId: 'layout-manual' },
1331
- ],
1332
- ports: [],
1333
- links: [],
1334
- texts: [
1335
- {
1336
- id: 'label-layout-row',
1337
- content: 'Row parent label lane',
1338
- position: { x: 8, y: 6 },
1339
- ownerId: 'layout-row',
1340
- layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1341
- },
1342
- { id: 'label-row-a', content: 'row-a', position: { x: 6, y: -14 }, ownerId: 'row-a' },
1343
- { id: 'label-row-b', content: 'row-b', position: { x: 6, y: -14 }, ownerId: 'row-b' },
1344
- { id: 'label-row-c', content: 'row-c', position: { x: 6, y: -14 }, ownerId: 'row-c' },
1345
- { id: 'label-row-nested-owner', content: 'owns children', position: { x: 6, y: -16 }, ownerId: 'row-nested-owner' },
1346
- {
1347
- id: 'label-layout-column',
1348
- content: 'Column parent label lane',
1349
- position: { x: 8, y: 6 },
1350
- ownerId: 'layout-column',
1351
- layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1352
- },
1353
- { id: 'label-col-a', content: 'col-a', position: { x: 6, y: -14 }, ownerId: 'col-a' },
1354
- { id: 'label-col-b', content: 'col-b', position: { x: 6, y: -14 }, ownerId: 'col-b' },
1355
- { id: 'label-col-c', content: 'col-c', position: { x: 6, y: -14 }, ownerId: 'col-c' },
1356
- {
1357
- id: 'label-layout-grid',
1358
- content: 'Grid template [12,4,8]',
1359
- position: { x: 8, y: 6 },
1360
- ownerId: 'layout-grid',
1361
- layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1362
- },
1363
- { id: 'label-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'grid-a' },
1364
- { id: 'label-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'grid-b' },
1365
- { id: 'label-grid-c', content: 'grid-c', position: { x: 6, y: -14 }, ownerId: 'grid-c' },
1366
- { id: 'label-grid-d', content: 'grid-d', position: { x: 6, y: -14 }, ownerId: 'grid-d' },
1367
- { id: 'label-grid-e', content: 'grid-e', position: { x: 6, y: -14 }, ownerId: 'grid-e' },
1368
- {
1369
- id: 'label-layout-nested',
1370
- content: 'Row + nested column lane',
1371
- position: { x: 6, y: 6 },
1372
- ownerId: 'layout-nested',
1373
- layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1374
- },
1375
- { id: 'label-nested-stack', content: 'nested stack', position: { x: 6, y: -16 }, ownerId: 'nested-stack' },
1376
- { id: 'label-stack-a', content: 'stack-a', position: { x: 6, y: -14 }, ownerId: 'stack-a' },
1377
- { id: 'label-stack-b', content: 'stack-b', position: { x: 6, y: -14 }, ownerId: 'stack-b' },
1378
- { id: 'label-stack-overflow', content: 'stack-overflow', position: { x: 6, y: -14 }, ownerId: 'stack-overflow' },
1379
- { id: 'label-nested-peer', content: 'nested-peer', position: { x: 6, y: -14 }, ownerId: 'nested-peer' },
1380
- { id: 'label-layout-manual', content: 'Manual (no layout)', position: { x: 6, y: -18 }, ownerId: 'layout-manual' },
1381
- { id: 'label-manual-a', content: 'manual-a', position: { x: 6, y: -14 }, ownerId: 'manual-a' },
1382
- { id: 'label-manual-b', content: 'manual-b', position: { x: 6, y: -14 }, ownerId: 'manual-b' },
1383
- ],
1384
- }); };
1309
+ { id: 'row-a', position: { x: 0, y: 0 }, size: { width: 62, height: 44 }, shapeId: 'default', parentId: 'layout-row' },
1310
+ { id: 'row-b', position: { x: 0, y: 0 }, size: { width: 96, height: 32 }, shapeId: 'default', parentId: 'layout-row' },
1311
+ { id: 'row-c', position: { x: 0, y: 0 }, size: { width: 54, height: 56 }, shapeId: 'default', parentId: 'layout-row' },
1312
+ {
1313
+ id: 'row-nested-owner',
1314
+ position: { x: 0, y: 0 },
1315
+ size: { width: 82, height: 82 },
1316
+ shapeId: 'default',
1317
+ parentId: 'layout-row',
1318
+ layout: { mode: 'vertical', padding: { x: 8, y: 6 }, gap: 6, align: 'start' },
1319
+ },
1320
+ { id: 'row-nested-child-a', position: { x: 0, y: 0 }, size: { width: 60, height: 20 }, shapeId: 'default', parentId: 'row-nested-owner' },
1321
+ { id: 'row-nested-child-b', position: { x: 0, y: 0 }, size: { width: 76, height: 22 }, shapeId: 'default', parentId: 'row-nested-owner' },
1322
+ {
1323
+ id: 'layout-column',
1324
+ position: { x: 400, y: 70 },
1325
+ size: { width: 120, height: 140 },
1326
+ shapeId: 'panel',
1327
+ layout: { mode: 'vertical', padding: { x: 12, y: 10 }, gap: 16, align: 'end' },
1328
+ },
1329
+ { id: 'col-a', position: { x: 0, y: 0 }, size: { width: 44, height: 28 }, shapeId: 'default', parentId: 'layout-column' },
1330
+ { id: 'col-b', position: { x: 0, y: 0 }, size: { width: 70, height: 36 }, shapeId: 'default', parentId: 'layout-column' },
1331
+ { id: 'col-c', position: { x: 0, y: 0 }, size: { width: 92, height: 44 }, shapeId: 'default', parentId: 'layout-column' },
1332
+ {
1333
+ id: 'layout-grid',
1334
+ position: { x: 620, y: 70 },
1335
+ size: { width: 160, height: 110 },
1336
+ shapeId: 'panel',
1337
+ layout: {
1338
+ mode: 'grid',
1339
+ padding: { x: 10, y: 10 },
1340
+ gap: 10,
1341
+ align: 'center',
1342
+ autoResize: 'grow-shrink',
1343
+ gridTemplate: [12, 4, 8],
1344
+ gridChildWidthResizeEnabled: true,
1345
+ childMinWidth: 24,
1346
+ childMinHeight: 18,
1347
+ },
1348
+ },
1349
+ { id: 'grid-a', position: { x: 0, y: 0 }, size: { width: 36, height: 26 }, shapeId: 'default', parentId: 'layout-grid' },
1350
+ { id: 'grid-b', position: { x: 0, y: 0 }, size: { width: 44, height: 24 }, shapeId: 'default', parentId: 'layout-grid' },
1351
+ { id: 'grid-c', position: { x: 0, y: 0 }, size: { width: 50, height: 20 }, shapeId: 'default', parentId: 'layout-grid' },
1352
+ { id: 'grid-d', position: { x: 0, y: 0 }, size: { width: 28, height: 30 }, shapeId: 'default', parentId: 'layout-grid' },
1353
+ { id: 'grid-e', position: { x: 0, y: 0 }, size: { width: 52, height: 28 }, shapeId: 'default', parentId: 'layout-grid' },
1354
+ {
1355
+ id: 'layout-nested',
1356
+ position: { x: 120, y: 260 },
1357
+ size: { width: 190, height: 130 },
1358
+ shapeId: 'panel',
1359
+ layout: { mode: 'horizontal', padding: { x: 12, y: 12 }, gap: 12, align: 'start' },
1360
+ },
1361
+ {
1362
+ id: 'nested-stack',
1363
+ position: { x: 0, y: 0 },
1364
+ size: { width: 90, height: 92 },
1365
+ shapeId: 'default',
1366
+ parentId: 'layout-nested',
1367
+ layout: { mode: 'vertical', padding: { x: 8, y: 8 }, gap: 8, align: 'center' },
1368
+ },
1369
+ { id: 'stack-a', position: { x: 0, y: 0 }, size: { width: 60, height: 24 }, shapeId: 'default', parentId: 'nested-stack' },
1370
+ { id: 'stack-b', position: { x: 0, y: 0 }, size: { width: 90, height: 30 }, shapeId: 'default', parentId: 'nested-stack' },
1371
+ {
1372
+ id: 'stack-overflow',
1373
+ position: { x: 0, y: 0 },
1374
+ size: { width: 110, height: 26 },
1375
+ shapeId: 'default',
1376
+ parentId: 'nested-stack',
1377
+ },
1378
+ { id: 'nested-peer', position: { x: 0, y: 0 }, size: { width: 50, height: 90 }, shapeId: 'default', parentId: 'layout-nested' },
1379
+ {
1380
+ id: 'layout-grid-deep',
1381
+ position: { x: 640, y: 250 },
1382
+ size: { width: 250, height: 180 },
1383
+ shapeId: 'panel',
1384
+ layout: {
1385
+ mode: 'grid',
1386
+ padding: { x: 12, y: 12 },
1387
+ gap: 12,
1388
+ align: 'center',
1389
+ autoResize: 'grow-shrink',
1390
+ gridTemplate: [4, 4, 4],
1391
+ gridChildWidthResizeEnabled: true,
1392
+ childMinWidth: 48,
1393
+ childMinHeight: 60,
1394
+ },
1395
+ },
1396
+ {
1397
+ id: 'deep-grid-leaf-left',
1398
+ position: { x: 0, y: 0 },
1399
+ size: { width: 58, height: 72 },
1400
+ shapeId: 'default',
1401
+ parentId: 'layout-grid-deep',
1402
+ },
1403
+ {
1404
+ id: 'deep-grid-nested-parent',
1405
+ position: { x: 0, y: 0 },
1406
+ size: { width: 108, height: 90 },
1407
+ shapeId: 'default',
1408
+ parentId: 'layout-grid-deep',
1409
+ layout: {
1410
+ mode: 'grid',
1411
+ padding: { x: 8, y: 8 },
1412
+ gap: 8,
1413
+ align: 'center',
1414
+ autoResize: 'grow-shrink',
1415
+ gridTemplate: [6, 6],
1416
+ gridChildWidthResizeEnabled: true,
1417
+ childMinWidth: 18,
1418
+ childMinHeight: 18,
1419
+ },
1420
+ },
1421
+ {
1422
+ id: 'deep-grid-leaf-right',
1423
+ position: { x: 0, y: 0 },
1424
+ size: { width: 52, height: 78 },
1425
+ shapeId: 'default',
1426
+ parentId: 'layout-grid-deep',
1427
+ },
1428
+ { id: 'deep-grid-a', position: { x: 0, y: 0 }, size: { width: 34, height: 24 }, shapeId: 'default', parentId: 'deep-grid-nested-parent' },
1429
+ { id: 'deep-grid-b', position: { x: 0, y: 0 }, size: { width: 40, height: 28 }, shapeId: 'default', parentId: 'deep-grid-nested-parent' },
1430
+ { id: 'deep-grid-c', position: { x: 0, y: 0 }, size: { width: 52, height: 24 }, shapeId: 'default', parentId: 'deep-grid-nested-parent' },
1431
+ { id: 'deep-grid-d', position: { x: 0, y: 0 }, size: { width: 28, height: 30 }, shapeId: 'default', parentId: 'deep-grid-nested-parent' },
1432
+ {
1433
+ id: 'layout-grid-empty-compare',
1434
+ position: { x: 930, y: 70 },
1435
+ size: { width: 280, height: 190 },
1436
+ shapeId: 'panel',
1437
+ layout: {
1438
+ mode: 'grid',
1439
+ padding: { x: 12, y: 12 },
1440
+ gap: 12,
1441
+ align: 'center',
1442
+ autoResize: 'grow-shrink',
1443
+ gridTemplate: [4, 4, 4],
1444
+ gridChildWidthResizeEnabled: true,
1445
+ childMinWidth: 44,
1446
+ childMinHeight: 52,
1447
+ },
1448
+ },
1449
+ {
1450
+ id: 'empty-grid-slot',
1451
+ position: { x: 0, y: 0 },
1452
+ size: { width: 28, height: 18 },
1453
+ shapeId: 'default',
1454
+ parentId: 'layout-grid-empty-compare',
1455
+ layout: {
1456
+ mode: 'grid',
1457
+ padding: { x: 8, y: 8 },
1458
+ gap: 8,
1459
+ align: 'center',
1460
+ autoResize: 'grow-shrink',
1461
+ gridTemplate: [6, 6],
1462
+ gridChildWidthResizeEnabled: true,
1463
+ },
1464
+ },
1465
+ {
1466
+ id: 'filled-grid-slot',
1467
+ position: { x: 0, y: 0 },
1468
+ size: { width: 92, height: 88 },
1469
+ shapeId: 'default',
1470
+ parentId: 'layout-grid-empty-compare',
1471
+ layout: {
1472
+ mode: 'grid',
1473
+ padding: { x: 8, y: 8 },
1474
+ gap: 8,
1475
+ align: 'center',
1476
+ autoResize: 'grow-shrink',
1477
+ gridTemplate: [6, 6],
1478
+ gridChildWidthResizeEnabled: true,
1479
+ childMinWidth: 18,
1480
+ childMinHeight: 18,
1481
+ },
1482
+ },
1483
+ {
1484
+ id: 'empty-grid-compare-leaf',
1485
+ position: { x: 0, y: 0 },
1486
+ size: { width: 60, height: 70 },
1487
+ shapeId: 'default',
1488
+ parentId: 'layout-grid-empty-compare',
1489
+ },
1490
+ { id: 'filled-grid-slot-a', position: { x: 0, y: 0 }, size: { width: 34, height: 22 }, shapeId: 'default', parentId: 'filled-grid-slot' },
1491
+ { id: 'filled-grid-slot-b', position: { x: 0, y: 0 }, size: { width: 40, height: 24 }, shapeId: 'default', parentId: 'filled-grid-slot' },
1492
+ { id: 'filled-grid-slot-c', position: { x: 0, y: 0 }, size: { width: 48, height: 22 }, shapeId: 'default', parentId: 'filled-grid-slot' },
1493
+ {
1494
+ id: 'layout-grid-mixed-modes',
1495
+ position: { x: 930, y: 320 },
1496
+ size: { width: 340, height: 240 },
1497
+ shapeId: 'panel',
1498
+ layout: {
1499
+ mode: 'grid',
1500
+ padding: { x: 12, y: 12 },
1501
+ gap: 12,
1502
+ align: 'center',
1503
+ autoResize: 'grow-shrink',
1504
+ gridTemplate: [4, 4, 4],
1505
+ gridChildWidthResizeEnabled: true,
1506
+ childMinWidth: 52,
1507
+ childMinHeight: 64,
1508
+ },
1509
+ },
1510
+ {
1511
+ id: 'mixed-grid-child',
1512
+ position: { x: 0, y: 0 },
1513
+ size: { width: 88, height: 88 },
1514
+ shapeId: 'default',
1515
+ parentId: 'layout-grid-mixed-modes',
1516
+ layout: {
1517
+ mode: 'grid',
1518
+ padding: { x: 8, y: 8 },
1519
+ gap: 8,
1520
+ align: 'center',
1521
+ autoResize: 'grow-shrink',
1522
+ gridTemplate: [6, 6],
1523
+ gridChildWidthResizeEnabled: true,
1524
+ childMinWidth: 18,
1525
+ childMinHeight: 18,
1526
+ },
1527
+ },
1528
+ {
1529
+ id: 'mixed-column-child',
1530
+ position: { x: 0, y: 0 },
1531
+ size: { width: 92, height: 96 },
1532
+ shapeId: 'default',
1533
+ parentId: 'layout-grid-mixed-modes',
1534
+ layout: {
1535
+ mode: 'vertical',
1536
+ padding: { x: 8, y: 8 },
1537
+ gap: 8,
1538
+ align: 'center',
1539
+ autoResize: 'grow-shrink',
1540
+ },
1541
+ },
1542
+ {
1543
+ id: 'mixed-row-child',
1544
+ position: { x: 0, y: 0 },
1545
+ size: { width: 104, height: 84 },
1546
+ shapeId: 'default',
1547
+ parentId: 'layout-grid-mixed-modes',
1548
+ layout: {
1549
+ mode: 'horizontal',
1550
+ padding: { x: 8, y: 8 },
1551
+ gap: 8,
1552
+ align: 'center',
1553
+ autoResize: 'grow-shrink',
1554
+ },
1555
+ },
1556
+ { id: 'mixed-grid-a', position: { x: 0, y: 0 }, size: { width: 34, height: 22 }, shapeId: 'default', parentId: 'mixed-grid-child' },
1557
+ { id: 'mixed-grid-b', position: { x: 0, y: 0 }, size: { width: 44, height: 24 }, shapeId: 'default', parentId: 'mixed-grid-child' },
1558
+ { id: 'mixed-column-a', position: { x: 0, y: 0 }, size: { width: 60, height: 20 }, shapeId: 'default', parentId: 'mixed-column-child' },
1559
+ { id: 'mixed-column-b', position: { x: 0, y: 0 }, size: { width: 68, height: 24 }, shapeId: 'default', parentId: 'mixed-column-child' },
1560
+ { id: 'mixed-row-a', position: { x: 0, y: 0 }, size: { width: 32, height: 28 }, shapeId: 'default', parentId: 'mixed-row-child' },
1561
+ { id: 'mixed-row-b', position: { x: 0, y: 0 }, size: { width: 44, height: 24 }, shapeId: 'default', parentId: 'mixed-row-child' },
1562
+ {
1563
+ id: 'layout-column-grid-tree',
1564
+ position: { x: 40, y: 520 },
1565
+ size: { width: 340, height: 220 },
1566
+ shapeId: 'panel',
1567
+ layout: { mode: 'vertical', padding: { x: 12, y: 12 }, gap: 12, align: 'start', autoResize: 'grow-shrink' },
1568
+ },
1569
+ {
1570
+ id: 'column-grid-tree-top',
1571
+ position: { x: 0, y: 0 },
1572
+ size: { width: 180, height: 88 },
1573
+ shapeId: 'default',
1574
+ parentId: 'layout-column-grid-tree',
1575
+ layout: {
1576
+ mode: 'grid',
1577
+ padding: { x: 8, y: 8 },
1578
+ gap: 8,
1579
+ align: 'center',
1580
+ autoResize: 'grow-shrink',
1581
+ gridTemplate: [6, 6],
1582
+ gridChildWidthResizeEnabled: true,
1583
+ childMinWidth: 18,
1584
+ childMinHeight: 18,
1585
+ },
1586
+ },
1587
+ {
1588
+ id: 'column-grid-tree-branch',
1589
+ position: { x: 0, y: 0 },
1590
+ size: { width: 220, height: 96 },
1591
+ shapeId: 'default',
1592
+ parentId: 'layout-column-grid-tree',
1593
+ layout: { mode: 'horizontal', padding: { x: 8, y: 8 }, gap: 8, align: 'center', autoResize: 'grow-shrink' },
1594
+ },
1595
+ { id: 'column-grid-top-a', position: { x: 0, y: 0 }, size: { width: 52, height: 22 }, shapeId: 'default', parentId: 'column-grid-tree-top' },
1596
+ { id: 'column-grid-top-b', position: { x: 0, y: 0 }, size: { width: 44, height: 24 }, shapeId: 'default', parentId: 'column-grid-tree-top' },
1597
+ {
1598
+ id: 'column-grid-tree-inner-grid',
1599
+ position: { x: 0, y: 0 },
1600
+ size: { width: 120, height: 84 },
1601
+ shapeId: 'default',
1602
+ parentId: 'column-grid-tree-branch',
1603
+ layout: {
1604
+ mode: 'grid',
1605
+ padding: { x: 8, y: 8 },
1606
+ gap: 8,
1607
+ align: 'center',
1608
+ autoResize: 'grow-shrink',
1609
+ gridTemplate: [6, 6],
1610
+ gridChildWidthResizeEnabled: true,
1611
+ childMinWidth: 18,
1612
+ childMinHeight: 18,
1613
+ },
1614
+ },
1615
+ { id: 'column-grid-tree-leaf', position: { x: 0, y: 0 }, size: { width: 58, height: 62 }, shapeId: 'default', parentId: 'column-grid-tree-branch' },
1616
+ { id: 'column-grid-inner-a', position: { x: 0, y: 0 }, size: { width: 30, height: 22 }, shapeId: 'default', parentId: 'column-grid-tree-inner-grid' },
1617
+ { id: 'column-grid-inner-b', position: { x: 0, y: 0 }, size: { width: 42, height: 24 }, shapeId: 'default', parentId: 'column-grid-tree-inner-grid' },
1618
+ {
1619
+ id: 'layout-lock-compare',
1620
+ position: { x: 420, y: 410 },
1621
+ size: { width: 240, height: 160 },
1622
+ shapeId: 'panel',
1623
+ layout: { mode: 'horizontal', padding: { x: 12, y: 12 }, gap: 12, align: 'start' },
1624
+ },
1625
+ {
1626
+ id: 'deep-lock-parent',
1627
+ position: { x: 0, y: 0 },
1628
+ size: { width: 110, height: 92 },
1629
+ shapeId: 'default',
1630
+ parentId: 'layout-lock-compare',
1631
+ childElementInteraction: lockComparisonChildren ? { movable: false } : undefined,
1632
+ },
1633
+ { id: 'deep-lock-child-a', position: { x: 12, y: 24 }, size: { width: 38, height: 24 }, shapeId: 'default', parentId: 'deep-lock-parent' },
1634
+ { id: 'deep-lock-child-b', position: { x: 56, y: 54 }, size: { width: 42, height: 24 }, shapeId: 'default', parentId: 'deep-lock-parent' },
1635
+ {
1636
+ id: 'deep-free-parent',
1637
+ position: { x: 0, y: 0 },
1638
+ size: { width: 110, height: 92 },
1639
+ shapeId: 'default',
1640
+ parentId: 'layout-lock-compare',
1641
+ },
1642
+ { id: 'deep-free-child-a', position: { x: 12, y: 24 }, size: { width: 38, height: 24 }, shapeId: 'default', parentId: 'deep-free-parent' },
1643
+ { id: 'deep-free-child-b', position: { x: 56, y: 54 }, size: { width: 42, height: 24 }, shapeId: 'default', parentId: 'deep-free-parent' },
1644
+ {
1645
+ id: 'layout-manual',
1646
+ position: { x: 420, y: 260 },
1647
+ size: { width: 190, height: 120 },
1648
+ shapeId: 'panel',
1649
+ },
1650
+ { id: 'manual-a', position: { x: 12, y: 18 }, size: { width: 60, height: 30 }, shapeId: 'default', parentId: 'layout-manual' },
1651
+ { id: 'manual-b', position: { x: 90, y: 60 }, size: { width: 68, height: 32 }, shapeId: 'default', parentId: 'layout-manual' },
1652
+ ],
1653
+ ports: [],
1654
+ links: [],
1655
+ texts: [
1656
+ {
1657
+ id: 'label-layout-row',
1658
+ content: 'Row parent label lane',
1659
+ position: { x: 8, y: 6 },
1660
+ ownerId: 'layout-row',
1661
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1662
+ },
1663
+ { id: 'label-row-a', content: 'row-a', position: { x: 6, y: -14 }, ownerId: 'row-a' },
1664
+ { id: 'label-row-b', content: 'row-b', position: { x: 6, y: -14 }, ownerId: 'row-b' },
1665
+ { id: 'label-row-c', content: 'row-c', position: { x: 6, y: -14 }, ownerId: 'row-c' },
1666
+ { id: 'label-row-nested-owner', content: 'owns children', position: { x: 6, y: -16 }, ownerId: 'row-nested-owner' },
1667
+ {
1668
+ id: 'label-layout-column',
1669
+ content: 'Column parent label lane',
1670
+ position: { x: 8, y: 6 },
1671
+ ownerId: 'layout-column',
1672
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1673
+ },
1674
+ { id: 'label-col-a', content: 'col-a', position: { x: 6, y: -14 }, ownerId: 'col-a' },
1675
+ { id: 'label-col-b', content: 'col-b', position: { x: 6, y: -14 }, ownerId: 'col-b' },
1676
+ { id: 'label-col-c', content: 'col-c', position: { x: 6, y: -14 }, ownerId: 'col-c' },
1677
+ {
1678
+ id: 'label-layout-grid',
1679
+ content: 'Grid template [12,4,8]',
1680
+ position: { x: 8, y: 6 },
1681
+ ownerId: 'layout-grid',
1682
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1683
+ },
1684
+ { id: 'label-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'grid-a' },
1685
+ { id: 'label-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'grid-b' },
1686
+ { id: 'label-grid-c', content: 'grid-c', position: { x: 6, y: -14 }, ownerId: 'grid-c' },
1687
+ { id: 'label-grid-d', content: 'grid-d', position: { x: 6, y: -14 }, ownerId: 'grid-d' },
1688
+ { id: 'label-grid-e', content: 'grid-e', position: { x: 6, y: -14 }, ownerId: 'grid-e' },
1689
+ {
1690
+ id: 'label-layout-nested',
1691
+ content: 'Row + nested column lane',
1692
+ position: { x: 6, y: 6 },
1693
+ ownerId: 'layout-nested',
1694
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1695
+ },
1696
+ { id: 'label-nested-stack', content: 'nested stack', position: { x: 6, y: -16 }, ownerId: 'nested-stack' },
1697
+ { id: 'label-stack-a', content: 'stack-a', position: { x: 6, y: -14 }, ownerId: 'stack-a' },
1698
+ { id: 'label-stack-b', content: 'stack-b', position: { x: 6, y: -14 }, ownerId: 'stack-b' },
1699
+ { id: 'label-stack-overflow', content: 'stack-overflow', position: { x: 6, y: -14 }, ownerId: 'stack-overflow' },
1700
+ { id: 'label-nested-peer', content: 'nested-peer', position: { x: 6, y: -14 }, ownerId: 'nested-peer' },
1701
+ {
1702
+ id: 'label-layout-grid-deep',
1703
+ content: 'Outer grid: all direct children snap',
1704
+ position: { x: 8, y: 6 },
1705
+ ownerId: 'layout-grid-deep',
1706
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1707
+ },
1708
+ { id: 'label-deep-grid-leaf-left', content: 'leaf resize/reorder', position: { x: 6, y: -16 }, ownerId: 'deep-grid-leaf-left' },
1709
+ { id: 'label-deep-grid-nested-parent', content: 'nested grid 12-unit child', position: { x: 6, y: -16 }, ownerId: 'deep-grid-nested-parent' },
1710
+ { id: 'label-deep-grid-leaf-right', content: 'leaf resize/reorder', position: { x: 6, y: -16 }, ownerId: 'deep-grid-leaf-right' },
1711
+ { id: 'label-deep-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'deep-grid-a' },
1712
+ { id: 'label-deep-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'deep-grid-b' },
1713
+ { id: 'label-deep-grid-c', content: 'grid-c', position: { x: 6, y: -14 }, ownerId: 'deep-grid-c' },
1714
+ { id: 'label-deep-grid-d', content: 'grid-d', position: { x: 6, y: -14 }, ownerId: 'deep-grid-d' },
1715
+ {
1716
+ id: 'label-layout-grid-empty-compare',
1717
+ content: 'Grid owner: empty vs filled nested grids',
1718
+ position: { x: 8, y: 6 },
1719
+ ownerId: 'layout-grid-empty-compare',
1720
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1721
+ },
1722
+ { id: 'label-empty-grid-slot', content: 'empty nested grid', position: { x: 6, y: -16 }, ownerId: 'empty-grid-slot' },
1723
+ { id: 'label-filled-grid-slot', content: 'nested grid with children', position: { x: 6, y: -16 }, ownerId: 'filled-grid-slot' },
1724
+ { id: 'label-empty-grid-compare-leaf', content: 'leaf sibling', position: { x: 6, y: -16 }, ownerId: 'empty-grid-compare-leaf' },
1725
+ { id: 'label-filled-grid-slot-a', content: 'slot-a', position: { x: 6, y: -14 }, ownerId: 'filled-grid-slot-a' },
1726
+ { id: 'label-filled-grid-slot-b', content: 'slot-b', position: { x: 6, y: -14 }, ownerId: 'filled-grid-slot-b' },
1727
+ { id: 'label-filled-grid-slot-c', content: 'slot-c', position: { x: 6, y: -14 }, ownerId: 'filled-grid-slot-c' },
1728
+ {
1729
+ id: 'label-layout-grid-mixed-modes',
1730
+ content: 'Grid owner: mixed child layout modes',
1731
+ position: { x: 8, y: 6 },
1732
+ ownerId: 'layout-grid-mixed-modes',
1733
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1734
+ },
1735
+ { id: 'label-mixed-grid-child', content: 'grid child', position: { x: 6, y: -16 }, ownerId: 'mixed-grid-child' },
1736
+ { id: 'label-mixed-column-child', content: 'vertical child', position: { x: 6, y: -16 }, ownerId: 'mixed-column-child' },
1737
+ { id: 'label-mixed-row-child', content: 'horizontal child', position: { x: 6, y: -16 }, ownerId: 'mixed-row-child' },
1738
+ { id: 'label-mixed-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'mixed-grid-a' },
1739
+ { id: 'label-mixed-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'mixed-grid-b' },
1740
+ { id: 'label-mixed-column-a', content: 'col-a', position: { x: 6, y: -14 }, ownerId: 'mixed-column-a' },
1741
+ { id: 'label-mixed-column-b', content: 'col-b', position: { x: 6, y: -14 }, ownerId: 'mixed-column-b' },
1742
+ { id: 'label-mixed-row-a', content: 'row-a', position: { x: 6, y: -14 }, ownerId: 'mixed-row-a' },
1743
+ { id: 'label-mixed-row-b', content: 'row-b', position: { x: 6, y: -14 }, ownerId: 'mixed-row-b' },
1744
+ {
1745
+ id: 'label-layout-column-grid-tree',
1746
+ content: 'Vertical owner with grid descendants',
1747
+ position: { x: 8, y: 6 },
1748
+ ownerId: 'layout-column-grid-tree',
1749
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1750
+ },
1751
+ { id: 'label-column-grid-tree-top', content: 'top-level grid child', position: { x: 6, y: -16 }, ownerId: 'column-grid-tree-top' },
1752
+ { id: 'label-column-grid-tree-branch', content: 'row branch with inner grid', position: { x: 6, y: -16 }, ownerId: 'column-grid-tree-branch' },
1753
+ { id: 'label-column-grid-top-a', content: 'top-a', position: { x: 6, y: -14 }, ownerId: 'column-grid-top-a' },
1754
+ { id: 'label-column-grid-top-b', content: 'top-b', position: { x: 6, y: -14 }, ownerId: 'column-grid-top-b' },
1755
+ { id: 'label-column-grid-tree-inner-grid', content: 'nested grid descendant', position: { x: 6, y: -16 }, ownerId: 'column-grid-tree-inner-grid' },
1756
+ { id: 'label-column-grid-tree-leaf', content: 'branch leaf', position: { x: 6, y: -14 }, ownerId: 'column-grid-tree-leaf' },
1757
+ { id: 'label-column-grid-inner-a', content: 'inner-a', position: { x: 6, y: -14 }, ownerId: 'column-grid-inner-a' },
1758
+ { id: 'label-column-grid-inner-b', content: 'inner-b', position: { x: 6, y: -14 }, ownerId: 'column-grid-inner-b' },
1759
+ {
1760
+ id: 'label-layout-lock-compare',
1761
+ content: 'Child drag lock comparison',
1762
+ position: { x: 8, y: 6 },
1763
+ ownerId: 'layout-lock-compare',
1764
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1765
+ },
1766
+ {
1767
+ id: 'label-deep-lock-parent',
1768
+ content: lockComparisonChildren ? 'parent lock: on' : 'parent lock: off',
1769
+ position: { x: 6, y: -16 },
1770
+ ownerId: 'deep-lock-parent',
1771
+ },
1772
+ {
1773
+ id: 'label-deep-lock-child-a',
1774
+ content: lockComparisonChildren ? 'drag target (locked)' : 'drag target (unlocked)',
1775
+ position: { x: 4, y: -14 },
1776
+ ownerId: 'deep-lock-child-a',
1777
+ },
1778
+ { id: 'label-deep-lock-child-b', content: 'api move still works', position: { x: 4, y: -14 }, ownerId: 'deep-lock-child-b' },
1779
+ { id: 'label-deep-free-parent', content: 'movable reference', position: { x: 6, y: -16 }, ownerId: 'deep-free-parent' },
1780
+ { id: 'label-deep-free-child-a', content: 'drag target', position: { x: 4, y: -14 }, ownerId: 'deep-free-child-a' },
1781
+ { id: 'label-deep-free-child-b', content: 'free sibling', position: { x: 4, y: -14 }, ownerId: 'deep-free-child-b' },
1782
+ { id: 'label-layout-manual', content: 'Manual (no layout)', position: { x: 6, y: -18 }, ownerId: 'layout-manual' },
1783
+ { id: 'label-manual-a', content: 'manual-a', position: { x: 6, y: -14 }, ownerId: 'manual-a' },
1784
+ { id: 'label-manual-b', content: 'manual-b', position: { x: 6, y: -14 }, ownerId: 'manual-b' },
1785
+ ],
1786
+ });
1787
+ };
1385
1788
  var autoLayoutDemoConfig = ({
1386
1789
  id: 'auto-layout',
1387
1790
  title: 'Element Auto-Layout + Label Lane',
@@ -4213,6 +4616,7 @@ var ElementModel = /** @class */ (function () {
4213
4616
  this.moveMode = data.moveMode;
4214
4617
  this.anchorCenter = data.anchorCenter;
4215
4618
  this.layout = data.layout;
4619
+ this.childElementInteraction = data.childElementInteraction;
4216
4620
  this.portMovement = data.portMovement;
4217
4621
  }
4218
4622
  ElementModel.prototype.setPosition = function (position) {
@@ -4250,6 +4654,7 @@ var ElementModel = /** @class */ (function () {
4250
4654
  moveMode: this.moveMode,
4251
4655
  anchorCenter: this.anchorCenter,
4252
4656
  layout: this.layout,
4657
+ childElementInteraction: this.childElementInteraction,
4253
4658
  portMovement: this.portMovement,
4254
4659
  };
4255
4660
  };
@@ -6113,6 +6518,8 @@ var AutoLayoutService = /** @class */ (function () {
6113
6518
  return this.applyResolvedLayout(parentId, parent, desiredPositions, desiredSizes, {
6114
6519
  width: newParentWidth,
6115
6520
  height: newParentHeight,
6521
+ }, {
6522
+ preserveResizedLayoutParentSize: true,
6116
6523
  });
6117
6524
  };
6118
6525
  AutoLayoutService.prototype.resolveGridCellWidths = function (rowInnerWidth, weights) {
@@ -6122,7 +6529,7 @@ var AutoLayoutService = /** @class */ (function () {
6122
6529
  var safeWeights = weights.map(function (weight) { return _this.clampGridUnits(weight); });
6123
6530
  return this.distributeWeightedSizes(Math.max(0, rowInnerWidth), safeWeights);
6124
6531
  };
6125
- AutoLayoutService.prototype.applyResolvedLayout = function (parentId, parent, desiredPositions, desiredSizes, parentSize) {
6532
+ AutoLayoutService.prototype.applyResolvedLayout = function (parentId, parent, desiredPositions, desiredSizes, parentSize, options) {
6126
6533
  var _this = this;
6127
6534
  var _a;
6128
6535
  var patches = [];
@@ -6141,7 +6548,7 @@ var AutoLayoutService = /** @class */ (function () {
6141
6548
  var resizePatches = _this.commandQueue.run(createResizeElementCommand(childId, fittedSize), _this.model);
6142
6549
  patches.push.apply(patches, resizePatches);
6143
6550
  movedPortIds.push.apply(movedPortIds, _this.collectElementPortIds(childId));
6144
- var nested = _this.applyLayoutForParent(childId);
6551
+ var nested = _this.applyLayoutForParent(childId, (options === null || options === void 0 ? void 0 : options.preserveResizedLayoutParentSize) ? { preserveParentSize: true } : undefined);
6145
6552
  patches.push.apply(patches, nested.patches);
6146
6553
  movedPortIds.push.apply(movedPortIds, nested.movedPortIds);
6147
6554
  }
@@ -8082,9 +8489,7 @@ var DiagramEngine = /** @class */ (function () {
8082
8489
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8083
8490
  if (!parentId)
8084
8491
  return false;
8085
- if (this.model.getChildren(element.id).length > 0)
8086
- return false;
8087
- if (element.layout && element.layout.mode !== 'manual')
8492
+ if (!this.isLeafGridChildResizeCandidate(element))
8088
8493
  return false;
8089
8494
  var parent = this.model.getElement(parentId);
8090
8495
  if (((_b = parent === null || parent === void 0 ? void 0 : parent.layout) === null || _b === void 0 ? void 0 : _b.mode) !== 'grid')
@@ -8092,16 +8497,7 @@ var DiagramEngine = /** @class */ (function () {
8092
8497
  return !Boolean(parent.layout.gridChildWidthResizeEnabled);
8093
8498
  };
8094
8499
  DiagramEngine.prototype.shouldAnchorAutoLayoutGridChildWidthToLeft = function (element) {
8095
- var _a, _b;
8096
- var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8097
- if (!parentId)
8098
- return false;
8099
- if (this.model.getChildren(element.id).length > 0)
8100
- return false;
8101
- if (element.layout && element.layout.mode !== 'manual')
8102
- return false;
8103
- var parent = this.model.getElement(parentId);
8104
- return Boolean(((_b = parent === null || parent === void 0 ? void 0 : parent.layout) === null || _b === void 0 ? void 0 : _b.mode) === 'grid' && parent.layout.gridChildWidthResizeEnabled);
8500
+ return this.isEnabledGridChildWidthResizeCandidate(element);
8105
8501
  };
8106
8502
  DiagramEngine.prototype.shouldRestrictAutoLayoutChildRightGrowth = function (element, handle, requestedWidth) {
8107
8503
  return false;
@@ -8111,41 +8507,55 @@ var DiagramEngine = /** @class */ (function () {
8111
8507
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8112
8508
  if (!parentId)
8113
8509
  return requestedWidth;
8114
- if (this.model.getChildren(element.id).length > 0)
8115
- return requestedWidth;
8116
- if (element.layout && element.layout.mode !== 'manual')
8117
- return requestedWidth;
8118
- var parent = this.model.getElement(parentId);
8119
- if (!(parent === null || parent === void 0 ? void 0 : parent.layout) || parent.layout.mode !== 'grid' || !parent.layout.gridChildWidthResizeEnabled)
8510
+ if (!this.isEnabledGridChildWidthResizeCandidate(element))
8120
8511
  return requestedWidth;
8121
8512
  return this.autoLayoutService.snapGridChildRequestedWidth(parentId, element.id, requestedWidth);
8122
8513
  };
8123
8514
  DiagramEngine.prototype.resolveGridChildWidthResizeTopologyChange = function (element, requestedWidth) {
8124
- var _a, _b, _c;
8515
+ var _a, _b;
8125
8516
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8126
8517
  if (!parentId)
8127
8518
  return null;
8128
- if (this.model.getChildren(element.id).length > 0)
8129
- return null;
8130
- if (element.layout && element.layout.mode !== 'manual')
8519
+ if (!this.isEnabledGridChildWidthResizeCandidate(element))
8131
8520
  return null;
8132
8521
  var parent = this.model.getElement(parentId);
8133
- if (!parent || ((_b = parent.layout) === null || _b === void 0 ? void 0 : _b.mode) !== 'grid' || !parent.layout.gridChildWidthResizeEnabled)
8522
+ if (!parent)
8134
8523
  return null;
8135
8524
  var topologyChange = this.autoLayoutService.resolveGridChildResizeTopologyChange(parentId, element.id, requestedWidth);
8136
8525
  if (!topologyChange)
8137
8526
  return null;
8527
+ var parentLayout = parent.layout;
8528
+ if (!parentLayout)
8529
+ return null;
8138
8530
  return {
8139
8531
  parentId: topologyChange.parentId,
8140
8532
  triggerChildId: topologyChange.triggerChildId,
8141
8533
  reason: topologyChange.reason,
8142
8534
  beforeRows: topologyChange.beforeRows,
8143
8535
  afterRows: topologyChange.afterRows,
8144
- beforeGridTemplate: parent.layout.gridTemplate ? __spreadArray([], parent.layout.gridTemplate, true) : undefined,
8145
- afterGridTemplate: __spreadArray([], ((_c = topologyChange.nextLayout.gridTemplate) !== null && _c !== void 0 ? _c : []), true),
8536
+ beforeGridTemplate: parentLayout.gridTemplate ? __spreadArray([], parentLayout.gridTemplate, true) : undefined,
8537
+ afterGridTemplate: __spreadArray([], ((_b = topologyChange.nextLayout.gridTemplate) !== null && _b !== void 0 ? _b : []), true),
8146
8538
  afterLayout: topologyChange.nextLayout,
8147
8539
  };
8148
8540
  };
8541
+ DiagramEngine.prototype.isLeafGridChildResizeCandidate = function (element) {
8542
+ if (this.model.getChildren(element.id).length > 0)
8543
+ return false;
8544
+ if (element.layout && element.layout.mode !== 'manual')
8545
+ return false;
8546
+ return true;
8547
+ };
8548
+ DiagramEngine.prototype.isEnabledGridChildWidthResizeCandidate = function (element) {
8549
+ var _a;
8550
+ var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8551
+ if (!parentId)
8552
+ return false;
8553
+ var parent = this.model.getElement(parentId);
8554
+ var layout = parent === null || parent === void 0 ? void 0 : parent.layout;
8555
+ if (!layout || layout.mode !== 'grid')
8556
+ return false;
8557
+ return Boolean(layout.gridChildWidthResizeEnabled);
8558
+ };
8149
8559
  DiagramEngine.prototype.getPortWorldPosition = function (id) {
8150
8560
  return this.model.getPortWorldPosition(id);
8151
8561
  };
@@ -10006,7 +10416,7 @@ var ellipseMidPointToIndex = function (value) {
10006
10416
  var KonvaInteraction = /** @class */ (function () {
10007
10417
  function KonvaInteraction(engine, config) {
10008
10418
  if (config === void 0) { config = {}; }
10009
- var _a, _b;
10419
+ var _a;
10010
10420
  this.linkDragContext = null;
10011
10421
  this.programmaticLinkSession = null;
10012
10422
  this.bound = false;
@@ -10030,7 +10440,6 @@ var KonvaInteraction = /** @class */ (function () {
10030
10440
  this.stage = config.stage;
10031
10441
  this.hitTester = (_a = config.hitTester) !== null && _a !== void 0 ? _a : new KonvaHitTester();
10032
10442
  this.renderer = config.renderer;
10033
- this.panKey = (_b = config.panKey) !== null && _b !== void 0 ? _b : 'Control';
10034
10443
  this.shapeRegistry = config.shapeRegistry;
10035
10444
  this.shapeHoverControls = this.normalizeShapeHoverControls(config.shapeHoverControls);
10036
10445
  this.onShapeHoverControlInteracted = config.onShapeHoverControlInteracted;
@@ -10198,7 +10607,10 @@ var KonvaInteraction = /** @class */ (function () {
10198
10607
  var hit = _this.resolveHit(point);
10199
10608
  var nativeEvent = event === null || event === void 0 ? void 0 : event.evt;
10200
10609
  var isMulti = Boolean(nativeEvent && (nativeEvent.ctrlKey || nativeEvent.metaKey || nativeEvent.shiftKey));
10201
- var isPanGesture = Boolean(nativeEvent && _this.isPanKeyPressed(nativeEvent) && nativeEvent.button === 0);
10610
+ var isPrimaryButton = !nativeEvent || nativeEvent.button === 0;
10611
+ var isEmptyPaper = !hit || hit.type === 'none';
10612
+ var isMarqueeGesture = Boolean(isPrimaryButton && isEmptyPaper && (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey));
10613
+ var isPanGesture = Boolean(isPrimaryButton && isEmptyPaper && !(nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey));
10202
10614
  var pointerInfo = _this.buildPointerInfo(point, nativeEvent);
10203
10615
  if ((hit === null || hit === void 0 ? void 0 : hit.type) === 'shape-hover-control') {
10204
10616
  var resolvedControl = _this.resolveShapeHoverControlFromHit(hit.id, point);
@@ -10256,11 +10668,14 @@ var KonvaInteraction = /** @class */ (function () {
10256
10668
  }
10257
10669
  return;
10258
10670
  }
10259
- if (!hit || hit.type === 'none') {
10671
+ if (isMarqueeGesture) {
10260
10672
  _this.dragState = { mode: 'marquee', start: point, isMulti: isMulti, hasMoved: false };
10261
10673
  (_d = _this.renderer) === null || _d === void 0 ? void 0 : _d.renderMarquee({ x: point.x, y: point.y, width: 0, height: 0 });
10262
10674
  return;
10263
10675
  }
10676
+ if (isEmptyPaper) {
10677
+ return;
10678
+ }
10264
10679
  if (hit.type === 'port') {
10265
10680
  var elementId = _this.engine.getPortElementId(hit.id);
10266
10681
  if (!elementId)
@@ -10325,6 +10740,7 @@ var KonvaInteraction = /** @class */ (function () {
10325
10740
  var element = _this.getElementById(hit.id);
10326
10741
  if (!element)
10327
10742
  return;
10743
+ var movable = _this.isElementMovable(hit.id);
10328
10744
  var anchor = element.anchorCenter ? 'center' : 'top-left';
10329
10745
  var base = element.anchorCenter
10330
10746
  ? {
@@ -10339,12 +10755,13 @@ var KonvaInteraction = /** @class */ (function () {
10339
10755
  offset: { x: point.x - base.x, y: point.y - base.y },
10340
10756
  start: __assign({}, base),
10341
10757
  anchor: anchor,
10758
+ movable: movable,
10342
10759
  startParentId: (_e = element.parentId) !== null && _e !== void 0 ? _e : null,
10343
10760
  selectionIds: _this.engine.getSelection(),
10344
10761
  isMulti: isMulti,
10345
10762
  hasMoved: false,
10346
10763
  };
10347
- _this.setCursor('grabbing');
10764
+ _this.setCursor(movable ? 'grabbing' : 'pointer');
10348
10765
  }
10349
10766
  }
10350
10767
  };
@@ -10402,6 +10819,9 @@ var KonvaInteraction = /** @class */ (function () {
10402
10819
  var dy = target.y - _this.dragState.start.y;
10403
10820
  var moved = Math.hypot(dx, dy) >= _this.dragThreshold;
10404
10821
  _this.dragState.hasMoved = _this.dragState.hasMoved || moved;
10822
+ if (!_this.dragState.movable) {
10823
+ return;
10824
+ }
10405
10825
  _this.engine.moveElementTo(_this.dragState.id, target.x, target.y);
10406
10826
  if (_this.renderer && _this.engine.getSelection().includes(_this.dragState.id)) {
10407
10827
  var element = _this.getElementById(_this.dragState.id);
@@ -10527,15 +10947,15 @@ var KonvaInteraction = /** @class */ (function () {
10527
10947
  var dx = point.x - _this.dragState.start.x;
10528
10948
  var dy = point.y - _this.dragState.start.y;
10529
10949
  _this.pan = {
10530
- x: _this.dragState.origin.x - dx * _this.panSpeed,
10531
- y: _this.dragState.origin.y - dy * _this.panSpeed,
10950
+ x: _this.dragState.origin.x + dx * _this.panSpeed,
10951
+ y: _this.dragState.origin.y + dy * _this.panSpeed,
10532
10952
  };
10533
10953
  _this.applyStageTransform();
10534
10954
  _this.engine.setViewport(_this.pan, _this.zoom);
10535
10955
  }
10536
10956
  };
10537
10957
  var pointerUp = function () {
10538
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10958
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
10539
10959
  var args = [];
10540
10960
  for (var _i = 0; _i < arguments.length; _i++) {
10541
10961
  args[_i] = arguments[_i];
@@ -10629,10 +11049,21 @@ var KonvaInteraction = /** @class */ (function () {
10629
11049
  _this.engine.emitPaperClick(pointerInfo);
10630
11050
  }
10631
11051
  }
10632
- if (((_h = _this.dragState) === null || _h === void 0 ? void 0 : _h.mode) === 'move' && _this.dragState.type === 'element') {
11052
+ if (((_h = _this.dragState) === null || _h === void 0 ? void 0 : _h.mode) === 'pan') {
11053
+ var point = pointerPoint !== null && pointerPoint !== void 0 ? pointerPoint : _this.dragState.start;
11054
+ var dx = point.x - _this.dragState.start.x;
11055
+ var dy = point.y - _this.dragState.start.y;
11056
+ var moved = Math.hypot(dx, dy) >= _this.dragThreshold;
11057
+ if (!moved) {
11058
+ _this.engine.setSelection([]);
11059
+ var pointerInfo = _this.buildPointerInfo(point, nativeEvent);
11060
+ _this.engine.emitPaperClick(pointerInfo);
11061
+ }
11062
+ }
11063
+ if (((_j = _this.dragState) === null || _j === void 0 ? void 0 : _j.mode) === 'move' && _this.dragState.type === 'element') {
10633
11064
  var element = _this.getElementById(_this.dragState.id);
10634
11065
  if (element) {
10635
- var endTopLeft = (_j = _this.engine.getElementWorldPosition(_this.dragState.id)) !== null && _j !== void 0 ? _j : element.position;
11066
+ var endTopLeft = (_k = _this.engine.getElementWorldPosition(_this.dragState.id)) !== null && _k !== void 0 ? _k : element.position;
10636
11067
  var endWorld = _this.dragState.anchor === 'center'
10637
11068
  ? {
10638
11069
  x: endTopLeft.x + element.size.width / 2,
@@ -10643,7 +11074,8 @@ var KonvaInteraction = /** @class */ (function () {
10643
11074
  x: endWorld.x - _this.dragState.start.x,
10644
11075
  y: endWorld.y - _this.dragState.start.y,
10645
11076
  };
10646
- var moved = _this.dragState.hasMoved || Math.hypot(delta.x, delta.y) > 0;
11077
+ var moved = _this.dragState.movable &&
11078
+ (_this.dragState.hasMoved || Math.hypot(delta.x, delta.y) > 0);
10647
11079
  if (moved) {
10648
11080
  _this.engine.emitElementDrop({
10649
11081
  elementId: _this.dragState.id,
@@ -10655,16 +11087,16 @@ var KonvaInteraction = /** @class */ (function () {
10655
11087
  anchor: _this.dragState.anchor,
10656
11088
  });
10657
11089
  }
10658
- else {
11090
+ else if (!_this.dragState.hasMoved) {
10659
11091
  var pointerInfo = _this.buildPointerInfo(pointerPoint !== null && pointerPoint !== void 0 ? pointerPoint : _this.dragState.start, nativeEvent);
10660
11092
  _this.engine.emitElementClick(_this.dragState.id, pointerInfo, _this.dragState.isMulti);
10661
11093
  }
10662
11094
  }
10663
11095
  }
10664
- if (((_k = _this.dragState) === null || _k === void 0 ? void 0 : _k.mode) === 'move' && _this.dragState.type === 'port') {
11096
+ if (((_l = _this.dragState) === null || _l === void 0 ? void 0 : _l.mode) === 'move' && _this.dragState.type === 'port') {
10665
11097
  var elementId = _this.engine.getPortElementId(_this.dragState.id);
10666
11098
  if (elementId) {
10667
- var pointerInfo = _this.buildPointerInfo((_l = pointerPoint !== null && pointerPoint !== void 0 ? pointerPoint : _this.engine.getPortWorldPosition(_this.dragState.id)) !== null && _l !== void 0 ? _l : { x: 0, y: 0 }, nativeEvent);
11099
+ var pointerInfo = _this.buildPointerInfo((_m = pointerPoint !== null && pointerPoint !== void 0 ? pointerPoint : _this.engine.getPortWorldPosition(_this.dragState.id)) !== null && _m !== void 0 ? _m : { x: 0, y: 0 }, nativeEvent);
10668
11100
  _this.engine.emitPortMouseUp({ portId: _this.dragState.id, elementId: elementId, pointer: pointerInfo });
10669
11101
  }
10670
11102
  }
@@ -10970,6 +11402,10 @@ var KonvaInteraction = /** @class */ (function () {
10970
11402
  this.setCursor('pointer');
10971
11403
  return;
10972
11404
  }
11405
+ if (hit.type === 'element' && !this.isElementMovable(hit.id)) {
11406
+ this.setCursor('pointer');
11407
+ return;
11408
+ }
10973
11409
  this.setCursor('grab');
10974
11410
  };
10975
11411
  KonvaInteraction.prototype.normalizeShapeHoverControls = function (controls) {
@@ -12195,6 +12631,14 @@ var KonvaInteraction = /** @class */ (function () {
12195
12631
  var _a, _b;
12196
12632
  return ((_b = (_a = this.getTextById(id)) === null || _a === void 0 ? void 0 : _a.interaction) === null || _b === void 0 ? void 0 : _b.movable) !== false;
12197
12633
  };
12634
+ KonvaInteraction.prototype.isElementMovable = function (id) {
12635
+ var _a;
12636
+ var element = this.getElementById(id);
12637
+ if (!(element === null || element === void 0 ? void 0 : element.parentId))
12638
+ return true;
12639
+ var parent = this.getElementById(element.parentId);
12640
+ return ((_a = parent === null || parent === void 0 ? void 0 : parent.childElementInteraction) === null || _a === void 0 ? void 0 : _a.movable) !== false;
12641
+ };
12198
12642
  KonvaInteraction.prototype.isTextEditable = function (id) {
12199
12643
  var _a, _b;
12200
12644
  return ((_b = (_a = this.getTextById(id)) === null || _a === void 0 ? void 0 : _a.interaction) === null || _b === void 0 ? void 0 : _b.editable) !== false;
@@ -12313,19 +12757,6 @@ var KonvaInteraction = /** @class */ (function () {
12313
12757
  var tag = target.tagName.toLowerCase();
12314
12758
  return tag === 'input' || tag === 'textarea' || tag === 'select';
12315
12759
  };
12316
- KonvaInteraction.prototype.isPanKeyPressed = function (event) {
12317
- switch (this.panKey) {
12318
- case 'Shift':
12319
- return event.shiftKey;
12320
- case 'Alt':
12321
- return event.altKey;
12322
- case 'Meta':
12323
- return event.metaKey;
12324
- case 'Control':
12325
- default:
12326
- return event.ctrlKey;
12327
- }
12328
- };
12329
12760
  return KonvaInteraction;
12330
12761
  }());
12331
12762
 
@@ -13694,11 +14125,19 @@ var parentOptions = [
13694
14125
  { id: 'layout-column', label: 'Vertical layout' },
13695
14126
  { id: 'layout-grid', label: 'Grid layout' },
13696
14127
  { id: 'layout-nested', label: 'Nested layout' },
14128
+ { id: 'layout-grid-deep', label: 'Nested grid' },
14129
+ { id: 'layout-grid-empty-compare', label: 'Grid empty vs filled' },
14130
+ { id: 'layout-grid-mixed-modes', label: 'Grid mixed child modes' },
14131
+ { id: 'layout-column-grid-tree', label: 'Non-grid with grid descendants' },
14132
+ { id: 'layout-lock-compare', label: 'Child lock compare' },
13697
14133
  { id: 'layout-manual', label: 'Manual (compare)' },
13698
14134
  ];
13699
14135
  var shortLabel = 'Parent label lane demo';
13700
14136
  var longLabel = 'Parent label lane demo with longer content to increase flexible reserved space and push children downward.';
13701
14137
  var defaultGridTemplateText = '[12,4,8]';
14138
+ var lockComparisonContainerId = 'layout-lock-compare';
14139
+ var lockParentId = 'deep-lock-parent';
14140
+ var lockTargetId = 'deep-lock-child-a';
13702
14141
  var serializeGridTemplate = function (template) {
13703
14142
  return Array.isArray(template) && template.length > 0 ? JSON.stringify(template) : defaultGridTemplateText;
13704
14143
  };
@@ -13737,11 +14176,13 @@ var parseGridTemplate = function (value) {
13737
14176
  };
13738
14177
  var AutoLayoutDemo = function () {
13739
14178
  var demo = autoLayoutDemoConfig;
13740
- var _a = useDemoEditor({
13741
- createState: demo.createState,
14179
+ var _a = React.useState(true), lockComparisonChildren = _a[0], setLockComparisonChildren = _a[1];
14180
+ var createState = React.useCallback(function () { return createAutoLayoutState(lockComparisonChildren); }, [lockComparisonChildren]);
14181
+ var _b = useDemoEditor({
14182
+ createState: createState,
13742
14183
  elementShapes: demo.elementShapes,
13743
14184
  portShapes: demo.portShapes,
13744
- }), containerRef = _a.containerRef, editorRef = _a.editorRef, diagramState = _a.diagramState, selection = _a.selection, snapEnabled = _a.snapEnabled, setSnapEnabled = _a.setSnapEnabled;
14185
+ }), containerRef = _b.containerRef, editorRef = _b.editorRef, diagramState = _b.diagramState, selection = _b.selection, snapEnabled = _b.snapEnabled, setSnapEnabled = _b.setSnapEnabled;
13745
14186
  var nextOffset = useOffsetSequence();
13746
14187
  var actionHelpers = React.useMemo(function () { return ({ nextOffset: nextOffset }); }, [nextOffset]);
13747
14188
  var controls = useDemoControls({
@@ -13753,25 +14194,25 @@ var AutoLayoutDemo = function () {
13753
14194
  setSnapEnabled: setSnapEnabled,
13754
14195
  actionHelpers: actionHelpers,
13755
14196
  });
13756
- var _b = React.useState(parentOptions[0].id), targetId = _b[0], setTargetId = _b[1];
13757
- var _c = React.useState('horizontal'), mode = _c[0], setMode = _c[1];
13758
- var _d = React.useState('center'), align = _d[0], setAlign = _d[1];
13759
- var _e = React.useState('grow'), autoResize = _e[0], setAutoResize = _e[1];
13760
- var _f = React.useState(12), padding = _f[0], setPadding = _f[1];
13761
- var _g = React.useState(12), gap = _g[0], setGap = _g[1];
13762
- var _h = React.useState('none'), childFitMainAxis = _h[0], setChildFitMainAxis = _h[1];
13763
- var _j = React.useState('none'), childFitCrossAxis = _j[0], setChildFitCrossAxis = _j[1];
13764
- var _k = React.useState(''), childMinWidth = _k[0], setChildMinWidth = _k[1];
13765
- var _l = React.useState(''), childMinHeight = _l[0], setChildMinHeight = _l[1];
13766
- var _m = React.useState(''), childMaxWidth = _m[0], setChildMaxWidth = _m[1];
13767
- var _o = React.useState(''), childMaxHeight = _o[0], setChildMaxHeight = _o[1];
13768
- var _p = React.useState(defaultGridTemplateText), gridTemplateText = _p[0], setGridTemplateText = _p[1];
13769
- var _q = React.useState(false), gridChildWidthResizeEnabled = _q[0], setGridChildWidthResizeEnabled = _q[1];
13770
- var _r = React.useState('none'), labelReservedMode = _r[0], setLabelReservedMode = _r[1];
13771
- var _s = React.useState(32), labelReservedFixedSize = _s[0], setLabelReservedFixedSize = _s[1];
13772
- var _t = React.useState(''), labelReservedMinSize = _t[0], setLabelReservedMinSize = _t[1];
13773
- var _u = React.useState(''), labelReservedMaxSize = _u[0], setLabelReservedMaxSize = _u[1];
13774
- var _v = React.useState('None yet'), lastTrigger = _v[0], setLastTrigger = _v[1];
14197
+ var _c = React.useState(parentOptions[0].id), targetId = _c[0], setTargetId = _c[1];
14198
+ var _d = React.useState('horizontal'), mode = _d[0], setMode = _d[1];
14199
+ var _e = React.useState('center'), align = _e[0], setAlign = _e[1];
14200
+ var _f = React.useState('grow'), autoResize = _f[0], setAutoResize = _f[1];
14201
+ var _g = React.useState(12), padding = _g[0], setPadding = _g[1];
14202
+ var _h = React.useState(12), gap = _h[0], setGap = _h[1];
14203
+ var _j = React.useState('none'), childFitMainAxis = _j[0], setChildFitMainAxis = _j[1];
14204
+ var _k = React.useState('none'), childFitCrossAxis = _k[0], setChildFitCrossAxis = _k[1];
14205
+ var _l = React.useState(''), childMinWidth = _l[0], setChildMinWidth = _l[1];
14206
+ var _m = React.useState(''), childMinHeight = _m[0], setChildMinHeight = _m[1];
14207
+ var _o = React.useState(''), childMaxWidth = _o[0], setChildMaxWidth = _o[1];
14208
+ var _p = React.useState(''), childMaxHeight = _p[0], setChildMaxHeight = _p[1];
14209
+ var _q = React.useState(defaultGridTemplateText), gridTemplateText = _q[0], setGridTemplateText = _q[1];
14210
+ var _r = React.useState(false), gridChildWidthResizeEnabled = _r[0], setGridChildWidthResizeEnabled = _r[1];
14211
+ var _s = React.useState('none'), labelReservedMode = _s[0], setLabelReservedMode = _s[1];
14212
+ var _t = React.useState(32), labelReservedFixedSize = _t[0], setLabelReservedFixedSize = _t[1];
14213
+ var _u = React.useState(''), labelReservedMinSize = _u[0], setLabelReservedMinSize = _u[1];
14214
+ var _v = React.useState(''), labelReservedMaxSize = _v[0], setLabelReservedMaxSize = _v[1];
14215
+ var _w = React.useState('None yet'), lastTrigger = _w[0], setLastTrigger = _w[1];
13775
14216
  React.useEffect(function () {
13776
14217
  var editor = editorRef.current;
13777
14218
  if (!editor)
@@ -13805,6 +14246,36 @@ var AutoLayoutDemo = function () {
13805
14246
  }
13806
14247
  }, [diagramState, targetId]);
13807
14248
  var targetElement = React.useMemo(function () { return diagramState === null || diagramState === void 0 ? void 0 : diagramState.elements.find(function (el) { return el.id === targetId; }); }, [diagramState, targetId]);
14249
+ var resolveElementWorldPosition = React.useCallback(function (elementId) {
14250
+ if (!diagramState)
14251
+ return null;
14252
+ var byId = new Map(diagramState.elements.map(function (element) { return [element.id, element]; }));
14253
+ var current = byId.get(elementId);
14254
+ if (!current)
14255
+ return null;
14256
+ var x = 0;
14257
+ var y = 0;
14258
+ while (current) {
14259
+ x += current.position.x;
14260
+ y += current.position.y;
14261
+ current = current.parentId ? byId.get(current.parentId) : undefined;
14262
+ }
14263
+ return { x: x, y: y };
14264
+ }, [diagramState]);
14265
+ var lockDemoContext = React.useMemo(function () {
14266
+ var _a;
14267
+ if (!diagramState)
14268
+ return null;
14269
+ var outer = diagramState.elements.find(function (el) { return el.id === lockComparisonContainerId; });
14270
+ var parent = diagramState.elements.find(function (el) { return el.id === lockParentId; });
14271
+ if (!outer || !parent)
14272
+ return null;
14273
+ return {
14274
+ outer: outer,
14275
+ parent: parent,
14276
+ isLocked: ((_a = parent.childElementInteraction) === null || _a === void 0 ? void 0 : _a.movable) === false,
14277
+ };
14278
+ }, [diagramState]);
13808
14279
  var targetOptions = React.useMemo(function () {
13809
14280
  var seen = new Set();
13810
14281
  var options = [];
@@ -13951,21 +14422,29 @@ var AutoLayoutDemo = function () {
13951
14422
  setLastTrigger('child removed');
13952
14423
  }
13953
14424
  };
13954
- var handleFocusResizeLockChild = function () {
14425
+ var handleFocusLockTarget = function () {
13955
14426
  var editor = editorRef.current;
13956
14427
  if (!editor)
13957
14428
  return;
13958
- setTargetId('layout-grid');
13959
- editor.setSelection(['grid-b']);
13960
- setLastTrigger('focus resize-lock child');
14429
+ setTargetId(lockParentId);
14430
+ editor.setSelection([lockTargetId]);
14431
+ setLastTrigger(lockComparisonChildren ? 'focus locked child' : 'focus unlocked comparison child');
13961
14432
  };
13962
- var handleFocusResizeLockParent = function () {
14433
+ var handleFocusLockParent = function () {
13963
14434
  var editor = editorRef.current;
13964
14435
  if (!editor)
13965
14436
  return;
13966
- setTargetId('layout-grid');
13967
- editor.setSelection(['layout-grid']);
13968
- setLastTrigger('focus resize-lock parent');
14437
+ setTargetId(lockParentId);
14438
+ editor.setSelection([lockParentId]);
14439
+ setLastTrigger('focus lock parent');
14440
+ };
14441
+ var handleMoveLockTargetViaApi = function () {
14442
+ var editor = editorRef.current;
14443
+ var parentWorld = resolveElementWorldPosition(lockParentId);
14444
+ if (!editor || !lockDemoContext || !parentWorld)
14445
+ return;
14446
+ editor.moveElementTo(lockTargetId, parentWorld.x + 56, parentWorld.y + 18);
14447
+ setLastTrigger(lockDemoContext.isLocked ? 'locked child moved by api' : 'comparison child moved by api');
13969
14448
  };
13970
14449
  var alignmentLabel = mode === 'horizontal'
13971
14450
  ? 'Vertical align (top/center/bottom)'
@@ -13976,10 +14455,19 @@ var AutoLayoutDemo = function () {
13976
14455
  React.createElement("div", { style: { marginBottom: 12 } },
13977
14456
  React.createElement("h2", { style: { marginTop: 0, marginBottom: 4 } }, demo.title),
13978
14457
  React.createElement("p", { style: { marginTop: 0 } }, "Try horizontal, vertical, grid, nested, and manual layout containers. Select a layout parent directly on the canvas or pick it from the list; the controls below always act on the current selection. Drag, resize, add, or remove children to see automatic reflow. Use fit controls, explicit child min/max constraints, auto-resize policy, 12-unit grid templates, and the optional grid child width-resize capability to validate current behavior."),
14458
+ React.createElement("p", { style: { marginTop: 0, fontSize: 13, color: '#333' } }, "Grid child width resize starts enabled for the seeded grid parents in this demo. With the capability on, horizontal drag can wrap rows automatically from a flat 12-unit slot array, resize direct grid children in 1/12 steps, and reorder peers by drag position. That now includes nested layout parents as well as leaf children. Turn the checkbox off on a selected grid parent to compare the older locked-width behavior where a mostly downward drag keeps width stable while height changes."),
13979
14459
  React.createElement("p", { style: { marginTop: 0, marginBottom: 0, fontSize: 13, color: '#333' } },
13980
- "Grid child width resize is disabled by default. With the capability off, select ",
13981
- React.createElement("code", null, "grid-b"),
13982
- " and drag a corner mostly downward: width stays stable while height changes. Turn the capability on to let horizontal drag wrap rows automatically from a flat 12-unit slot array, then resize children in 1/12 steps. Any corner can drive width changes, width always grows or shrinks on the right, siblings keep their own widths, and dragging can swap grid item order.")),
14460
+ "The seeded scenarios now cover empty nested grids, mixed child layout modes under one grid owner, and grid descendants inside a non-grid tree. Use ",
14461
+ React.createElement("code", null, "layout-grid-deep"),
14462
+ " for enabled 12-unit nested-child resize,",
14463
+ React.createElement("code", null, "layout-grid-empty-compare"),
14464
+ " for empty-versus-filled nested grid comparison, ",
14465
+ React.createElement("code", null, "layout-grid-mixed-modes"),
14466
+ "for direct-child layout mixing, and ",
14467
+ React.createElement("code", null, "layout-column-grid-tree"),
14468
+ " for a non-grid owner that still contains grid-layout descendants. The child drag lock comparison lives beside them in ",
14469
+ React.createElement("code", null, "layout-lock-compare"),
14470
+ ".")),
13983
14471
  React.createElement(DisplayBoxControls, { actions: demo.actions, snapEnabled: controls.snapEnabled, selectedLinkRouting: controls.selectedLinkRouting, canToggleLinkRouting: controls.canToggleLinkRouting, onReload: controls.handleReload, onZoomIn: controls.handleZoomIn, onZoomOut: controls.handleZoomOut, onResetViewport: controls.handleResetViewport, onToggleSnap: controls.handleToggleSnap, onManualRender: controls.handleManualRender, onToggleLinkRouting: controls.handleToggleLinkRouting, onAction: controls.handleAction, onExportImage: controls.handleExportImage, onClearExportPreview: controls.handleClearExportPreview, exportPreviewDataUrl: controls.exportPreviewDataUrl, exportError: controls.exportError }),
13984
14472
  React.createElement("div", { style: { display: 'grid', gap: 12, marginBottom: 12 } },
13985
14473
  React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center' } },
@@ -14032,6 +14520,14 @@ var AutoLayoutDemo = function () {
14032
14520
  React.createElement("label", { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
14033
14521
  React.createElement("input", { id: "grid-child-width-resize-enabled", type: "checkbox", checked: gridChildWidthResizeEnabled, onChange: function (event) { return setGridChildWidthResizeEnabled(event.target.checked); }, disabled: mode !== 'grid' }),
14034
14522
  "Enable 12-unit resize on child width drag"),
14523
+ React.createElement("label", { htmlFor: "lock-comparison-child-drag", style: { fontWeight: 600 } }, "Lock comparison child drag"),
14524
+ React.createElement("label", { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
14525
+ React.createElement("input", { id: "lock-comparison-child-drag", type: "checkbox", checked: lockComparisonChildren, onChange: function (event) {
14526
+ setLockComparisonChildren(event.target.checked);
14527
+ setTargetId(lockComparisonContainerId);
14528
+ setLastTrigger(event.target.checked ? 'comparison child drag locked' : 'comparison child drag unlocked');
14529
+ } }),
14530
+ "Reload parent-owned lock demo"),
14035
14531
  React.createElement("label", { htmlFor: "label-reserved-mode-select", style: { fontWeight: 600 } }, "Label lane"),
14036
14532
  React.createElement("select", { id: "label-reserved-mode-select", value: labelReservedMode, onChange: function (event) { return setLabelReservedMode(event.target.value); }, style: { padding: '6px 10px', minWidth: 120 }, disabled: mode === 'manual' },
14037
14533
  React.createElement("option", { value: "none" }, "None"),
@@ -14062,8 +14558,9 @@ var AutoLayoutDemo = function () {
14062
14558
  React.createElement("strong", null, lastTrigger)),
14063
14559
  React.createElement("button", { type: "button", onClick: function () { return handleSetLabelContent(shortLabel); }, style: { padding: '6px 10px' }, disabled: !targetElement || mode === 'manual' }, "Label short"),
14064
14560
  React.createElement("button", { type: "button", onClick: function () { return handleSetLabelContent(longLabel); }, style: { padding: '6px 10px' }, disabled: !targetElement || mode === 'manual' }, "Label long"),
14065
- React.createElement("button", { type: "button", onClick: handleFocusResizeLockChild, style: { padding: '6px 10px' } }, "Focus lock child"),
14066
- React.createElement("button", { type: "button", onClick: handleFocusResizeLockParent, style: { padding: '6px 10px' } }, "Focus lock parent")),
14561
+ React.createElement("button", { type: "button", onClick: handleFocusLockTarget, style: { padding: '6px 10px' } }, "Focus lock target"),
14562
+ React.createElement("button", { type: "button", onClick: handleFocusLockParent, style: { padding: '6px 10px' } }, "Focus lock parent"),
14563
+ React.createElement("button", { type: "button", onClick: handleMoveLockTargetViaApi, style: { padding: '6px 10px' } }, "Move lock target via API")),
14067
14564
  React.createElement("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
14068
14565
  React.createElement("div", null,
14069
14566
  React.createElement("div", { style: { fontWeight: 600, marginBottom: 6 } }, "Child order (axis or grid row-major)"),
@@ -14084,6 +14581,13 @@ var AutoLayoutDemo = function () {
14084
14581
  React.createElement("div", null,
14085
14582
  React.createElement("div", { style: { fontWeight: 600, marginBottom: 6 } }, "Scenario tips"),
14086
14583
  React.createElement("ul", { style: { marginTop: 0, paddingLeft: 18, fontSize: 13 } },
14584
+ React.createElement("li", null, "Nested grid: target layout-grid-deep to inspect an outer grid where all three direct children, including the nested grid parent, use enabled 12-unit resize."),
14585
+ React.createElement("li", null, "Select deep-grid-nested-parent and drag a horizontal resize handle; it should snap in grid units and then reflow inner children inside the resized container."),
14586
+ React.createElement("li", null, "Empty nested grid: target layout-grid-empty-compare and compare empty-grid-slot against filled-grid-slot. The empty nested grid should still occupy its assigned outer slot."),
14587
+ React.createElement("li", null, "Mixed grid children: target layout-grid-mixed-modes to inspect one grid owner whose direct children use grid, vertical, and horizontal auto-layout modes side by side."),
14588
+ React.createElement("li", null, "Non-grid with grid descendants: target layout-column-grid-tree to inspect a vertical parent that still contains grid-layout containers deeper in the subtree."),
14589
+ React.createElement("li", null, "Lock comparison: target layout-lock-compare, toggle Lock comparison child drag, then compare deep-lock-child-a and deep-free-child-a."),
14590
+ React.createElement("li", null, "Use Move lock target via API after locking; the child should still reposition because the policy only suppresses built-in drag."),
14087
14591
  React.createElement("li", null, "Resize lock: with grid child width resize off, select grid-b and drag diagonally; width should stay fixed."),
14088
14592
  React.createElement("li", null, "Enable grid child width resize, then shrink a full-width grid child; it should snap smaller without flashing, and later siblings should keep their own widths."),
14089
14593
  React.createElement("li", null, "Enable grid child width resize, then grow a child; siblings on the right should keep their own widths and only move down when they no longer fit."),