orcasvn-react-diagrams 0.2.6 → 0.2.7

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.
@@ -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',
@@ -1241,147 +1295,266 @@ 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-lock-compare',
1434
+ position: { x: 420, y: 410 },
1435
+ size: { width: 240, height: 160 },
1436
+ shapeId: 'panel',
1437
+ layout: { mode: 'horizontal', padding: { x: 12, y: 12 }, gap: 12, align: 'start' },
1438
+ },
1439
+ {
1440
+ id: 'deep-lock-parent',
1441
+ position: { x: 0, y: 0 },
1442
+ size: { width: 110, height: 92 },
1443
+ shapeId: 'default',
1444
+ parentId: 'layout-lock-compare',
1445
+ childElementInteraction: lockComparisonChildren ? { movable: false } : undefined,
1446
+ },
1447
+ { id: 'deep-lock-child-a', position: { x: 12, y: 24 }, size: { width: 38, height: 24 }, shapeId: 'default', parentId: 'deep-lock-parent' },
1448
+ { id: 'deep-lock-child-b', position: { x: 56, y: 54 }, size: { width: 42, height: 24 }, shapeId: 'default', parentId: 'deep-lock-parent' },
1449
+ {
1450
+ id: 'deep-free-parent',
1451
+ position: { x: 0, y: 0 },
1452
+ size: { width: 110, height: 92 },
1453
+ shapeId: 'default',
1454
+ parentId: 'layout-lock-compare',
1455
+ },
1456
+ { id: 'deep-free-child-a', position: { x: 12, y: 24 }, size: { width: 38, height: 24 }, shapeId: 'default', parentId: 'deep-free-parent' },
1457
+ { id: 'deep-free-child-b', position: { x: 56, y: 54 }, size: { width: 42, height: 24 }, shapeId: 'default', parentId: 'deep-free-parent' },
1458
+ {
1459
+ id: 'layout-manual',
1460
+ position: { x: 420, y: 260 },
1461
+ size: { width: 190, height: 120 },
1462
+ shapeId: 'panel',
1463
+ },
1464
+ { id: 'manual-a', position: { x: 12, y: 18 }, size: { width: 60, height: 30 }, shapeId: 'default', parentId: 'layout-manual' },
1465
+ { id: 'manual-b', position: { x: 90, y: 60 }, size: { width: 68, height: 32 }, shapeId: 'default', parentId: 'layout-manual' },
1466
+ ],
1467
+ ports: [],
1468
+ links: [],
1469
+ texts: [
1470
+ {
1471
+ id: 'label-layout-row',
1472
+ content: 'Row parent label lane',
1473
+ position: { x: 8, y: 6 },
1474
+ ownerId: 'layout-row',
1475
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1476
+ },
1477
+ { id: 'label-row-a', content: 'row-a', position: { x: 6, y: -14 }, ownerId: 'row-a' },
1478
+ { id: 'label-row-b', content: 'row-b', position: { x: 6, y: -14 }, ownerId: 'row-b' },
1479
+ { id: 'label-row-c', content: 'row-c', position: { x: 6, y: -14 }, ownerId: 'row-c' },
1480
+ { id: 'label-row-nested-owner', content: 'owns children', position: { x: 6, y: -16 }, ownerId: 'row-nested-owner' },
1481
+ {
1482
+ id: 'label-layout-column',
1483
+ content: 'Column parent label lane',
1484
+ position: { x: 8, y: 6 },
1485
+ ownerId: 'layout-column',
1486
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1487
+ },
1488
+ { id: 'label-col-a', content: 'col-a', position: { x: 6, y: -14 }, ownerId: 'col-a' },
1489
+ { id: 'label-col-b', content: 'col-b', position: { x: 6, y: -14 }, ownerId: 'col-b' },
1490
+ { id: 'label-col-c', content: 'col-c', position: { x: 6, y: -14 }, ownerId: 'col-c' },
1491
+ {
1492
+ id: 'label-layout-grid',
1493
+ content: 'Grid template [12,4,8]',
1494
+ position: { x: 8, y: 6 },
1495
+ ownerId: 'layout-grid',
1496
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1497
+ },
1498
+ { id: 'label-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'grid-a' },
1499
+ { id: 'label-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'grid-b' },
1500
+ { id: 'label-grid-c', content: 'grid-c', position: { x: 6, y: -14 }, ownerId: 'grid-c' },
1501
+ { id: 'label-grid-d', content: 'grid-d', position: { x: 6, y: -14 }, ownerId: 'grid-d' },
1502
+ { id: 'label-grid-e', content: 'grid-e', position: { x: 6, y: -14 }, ownerId: 'grid-e' },
1503
+ {
1504
+ id: 'label-layout-nested',
1505
+ content: 'Row + nested column lane',
1506
+ position: { x: 6, y: 6 },
1507
+ ownerId: 'layout-nested',
1508
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1509
+ },
1510
+ { id: 'label-nested-stack', content: 'nested stack', position: { x: 6, y: -16 }, ownerId: 'nested-stack' },
1511
+ { id: 'label-stack-a', content: 'stack-a', position: { x: 6, y: -14 }, ownerId: 'stack-a' },
1512
+ { id: 'label-stack-b', content: 'stack-b', position: { x: 6, y: -14 }, ownerId: 'stack-b' },
1513
+ { id: 'label-stack-overflow', content: 'stack-overflow', position: { x: 6, y: -14 }, ownerId: 'stack-overflow' },
1514
+ { id: 'label-nested-peer', content: 'nested-peer', position: { x: 6, y: -14 }, ownerId: 'nested-peer' },
1515
+ {
1516
+ id: 'label-layout-grid-deep',
1517
+ content: 'Outer grid: all direct children snap',
1518
+ position: { x: 8, y: 6 },
1519
+ ownerId: 'layout-grid-deep',
1520
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1521
+ },
1522
+ { id: 'label-deep-grid-leaf-left', content: 'leaf resize/reorder', position: { x: 6, y: -16 }, ownerId: 'deep-grid-leaf-left' },
1523
+ { id: 'label-deep-grid-nested-parent', content: 'nested grid 12-unit child', position: { x: 6, y: -16 }, ownerId: 'deep-grid-nested-parent' },
1524
+ { id: 'label-deep-grid-leaf-right', content: 'leaf resize/reorder', position: { x: 6, y: -16 }, ownerId: 'deep-grid-leaf-right' },
1525
+ { id: 'label-deep-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'deep-grid-a' },
1526
+ { id: 'label-deep-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'deep-grid-b' },
1527
+ { id: 'label-deep-grid-c', content: 'grid-c', position: { x: 6, y: -14 }, ownerId: 'deep-grid-c' },
1528
+ { id: 'label-deep-grid-d', content: 'grid-d', position: { x: 6, y: -14 }, ownerId: 'deep-grid-d' },
1529
+ {
1530
+ id: 'label-layout-lock-compare',
1531
+ content: 'Child drag lock comparison',
1532
+ position: { x: 8, y: 6 },
1533
+ ownerId: 'layout-lock-compare',
1534
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1535
+ },
1536
+ {
1537
+ id: 'label-deep-lock-parent',
1538
+ content: lockComparisonChildren ? 'parent lock: on' : 'parent lock: off',
1539
+ position: { x: 6, y: -16 },
1540
+ ownerId: 'deep-lock-parent',
1541
+ },
1542
+ {
1543
+ id: 'label-deep-lock-child-a',
1544
+ content: lockComparisonChildren ? 'drag target (locked)' : 'drag target (unlocked)',
1545
+ position: { x: 4, y: -14 },
1546
+ ownerId: 'deep-lock-child-a',
1547
+ },
1548
+ { id: 'label-deep-lock-child-b', content: 'api move still works', position: { x: 4, y: -14 }, ownerId: 'deep-lock-child-b' },
1549
+ { id: 'label-deep-free-parent', content: 'movable reference', position: { x: 6, y: -16 }, ownerId: 'deep-free-parent' },
1550
+ { id: 'label-deep-free-child-a', content: 'drag target', position: { x: 4, y: -14 }, ownerId: 'deep-free-child-a' },
1551
+ { id: 'label-deep-free-child-b', content: 'free sibling', position: { x: 4, y: -14 }, ownerId: 'deep-free-child-b' },
1552
+ { id: 'label-layout-manual', content: 'Manual (no layout)', position: { x: 6, y: -18 }, ownerId: 'layout-manual' },
1553
+ { id: 'label-manual-a', content: 'manual-a', position: { x: 6, y: -14 }, ownerId: 'manual-a' },
1554
+ { id: 'label-manual-b', content: 'manual-b', position: { x: 6, y: -14 }, ownerId: 'manual-b' },
1555
+ ],
1556
+ });
1557
+ };
1385
1558
  var autoLayoutDemoConfig = ({
1386
1559
  id: 'auto-layout',
1387
1560
  title: 'Element Auto-Layout + Label Lane',
@@ -4213,6 +4386,7 @@ var ElementModel = /** @class */ (function () {
4213
4386
  this.moveMode = data.moveMode;
4214
4387
  this.anchorCenter = data.anchorCenter;
4215
4388
  this.layout = data.layout;
4389
+ this.childElementInteraction = data.childElementInteraction;
4216
4390
  this.portMovement = data.portMovement;
4217
4391
  }
4218
4392
  ElementModel.prototype.setPosition = function (position) {
@@ -4250,6 +4424,7 @@ var ElementModel = /** @class */ (function () {
4250
4424
  moveMode: this.moveMode,
4251
4425
  anchorCenter: this.anchorCenter,
4252
4426
  layout: this.layout,
4427
+ childElementInteraction: this.childElementInteraction,
4253
4428
  portMovement: this.portMovement,
4254
4429
  };
4255
4430
  };
@@ -8082,9 +8257,7 @@ var DiagramEngine = /** @class */ (function () {
8082
8257
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8083
8258
  if (!parentId)
8084
8259
  return false;
8085
- if (this.model.getChildren(element.id).length > 0)
8086
- return false;
8087
- if (element.layout && element.layout.mode !== 'manual')
8260
+ if (!this.isLeafGridChildResizeCandidate(element))
8088
8261
  return false;
8089
8262
  var parent = this.model.getElement(parentId);
8090
8263
  if (((_b = parent === null || parent === void 0 ? void 0 : parent.layout) === null || _b === void 0 ? void 0 : _b.mode) !== 'grid')
@@ -8092,16 +8265,7 @@ var DiagramEngine = /** @class */ (function () {
8092
8265
  return !Boolean(parent.layout.gridChildWidthResizeEnabled);
8093
8266
  };
8094
8267
  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);
8268
+ return this.isEnabledGridChildWidthResizeCandidate(element);
8105
8269
  };
8106
8270
  DiagramEngine.prototype.shouldRestrictAutoLayoutChildRightGrowth = function (element, handle, requestedWidth) {
8107
8271
  return false;
@@ -8111,41 +8275,55 @@ var DiagramEngine = /** @class */ (function () {
8111
8275
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8112
8276
  if (!parentId)
8113
8277
  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)
8278
+ if (!this.isEnabledGridChildWidthResizeCandidate(element))
8120
8279
  return requestedWidth;
8121
8280
  return this.autoLayoutService.snapGridChildRequestedWidth(parentId, element.id, requestedWidth);
8122
8281
  };
8123
8282
  DiagramEngine.prototype.resolveGridChildWidthResizeTopologyChange = function (element, requestedWidth) {
8124
- var _a, _b, _c;
8283
+ var _a, _b;
8125
8284
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8126
8285
  if (!parentId)
8127
8286
  return null;
8128
- if (this.model.getChildren(element.id).length > 0)
8129
- return null;
8130
- if (element.layout && element.layout.mode !== 'manual')
8287
+ if (!this.isEnabledGridChildWidthResizeCandidate(element))
8131
8288
  return null;
8132
8289
  var parent = this.model.getElement(parentId);
8133
- if (!parent || ((_b = parent.layout) === null || _b === void 0 ? void 0 : _b.mode) !== 'grid' || !parent.layout.gridChildWidthResizeEnabled)
8290
+ if (!parent)
8134
8291
  return null;
8135
8292
  var topologyChange = this.autoLayoutService.resolveGridChildResizeTopologyChange(parentId, element.id, requestedWidth);
8136
8293
  if (!topologyChange)
8137
8294
  return null;
8295
+ var parentLayout = parent.layout;
8296
+ if (!parentLayout)
8297
+ return null;
8138
8298
  return {
8139
8299
  parentId: topologyChange.parentId,
8140
8300
  triggerChildId: topologyChange.triggerChildId,
8141
8301
  reason: topologyChange.reason,
8142
8302
  beforeRows: topologyChange.beforeRows,
8143
8303
  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),
8304
+ beforeGridTemplate: parentLayout.gridTemplate ? __spreadArray([], parentLayout.gridTemplate, true) : undefined,
8305
+ afterGridTemplate: __spreadArray([], ((_b = topologyChange.nextLayout.gridTemplate) !== null && _b !== void 0 ? _b : []), true),
8146
8306
  afterLayout: topologyChange.nextLayout,
8147
8307
  };
8148
8308
  };
8309
+ DiagramEngine.prototype.isLeafGridChildResizeCandidate = function (element) {
8310
+ if (this.model.getChildren(element.id).length > 0)
8311
+ return false;
8312
+ if (element.layout && element.layout.mode !== 'manual')
8313
+ return false;
8314
+ return true;
8315
+ };
8316
+ DiagramEngine.prototype.isEnabledGridChildWidthResizeCandidate = function (element) {
8317
+ var _a;
8318
+ var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8319
+ if (!parentId)
8320
+ return false;
8321
+ var parent = this.model.getElement(parentId);
8322
+ var layout = parent === null || parent === void 0 ? void 0 : parent.layout;
8323
+ if (!layout || layout.mode !== 'grid')
8324
+ return false;
8325
+ return Boolean(layout.gridChildWidthResizeEnabled);
8326
+ };
8149
8327
  DiagramEngine.prototype.getPortWorldPosition = function (id) {
8150
8328
  return this.model.getPortWorldPosition(id);
8151
8329
  };
@@ -10006,7 +10184,7 @@ var ellipseMidPointToIndex = function (value) {
10006
10184
  var KonvaInteraction = /** @class */ (function () {
10007
10185
  function KonvaInteraction(engine, config) {
10008
10186
  if (config === void 0) { config = {}; }
10009
- var _a, _b;
10187
+ var _a;
10010
10188
  this.linkDragContext = null;
10011
10189
  this.programmaticLinkSession = null;
10012
10190
  this.bound = false;
@@ -10030,7 +10208,6 @@ var KonvaInteraction = /** @class */ (function () {
10030
10208
  this.stage = config.stage;
10031
10209
  this.hitTester = (_a = config.hitTester) !== null && _a !== void 0 ? _a : new KonvaHitTester();
10032
10210
  this.renderer = config.renderer;
10033
- this.panKey = (_b = config.panKey) !== null && _b !== void 0 ? _b : 'Control';
10034
10211
  this.shapeRegistry = config.shapeRegistry;
10035
10212
  this.shapeHoverControls = this.normalizeShapeHoverControls(config.shapeHoverControls);
10036
10213
  this.onShapeHoverControlInteracted = config.onShapeHoverControlInteracted;
@@ -10198,7 +10375,10 @@ var KonvaInteraction = /** @class */ (function () {
10198
10375
  var hit = _this.resolveHit(point);
10199
10376
  var nativeEvent = event === null || event === void 0 ? void 0 : event.evt;
10200
10377
  var isMulti = Boolean(nativeEvent && (nativeEvent.ctrlKey || nativeEvent.metaKey || nativeEvent.shiftKey));
10201
- var isPanGesture = Boolean(nativeEvent && _this.isPanKeyPressed(nativeEvent) && nativeEvent.button === 0);
10378
+ var isPrimaryButton = !nativeEvent || nativeEvent.button === 0;
10379
+ var isEmptyPaper = !hit || hit.type === 'none';
10380
+ var isMarqueeGesture = Boolean(isPrimaryButton && isEmptyPaper && (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey));
10381
+ var isPanGesture = Boolean(isPrimaryButton && isEmptyPaper && !(nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey));
10202
10382
  var pointerInfo = _this.buildPointerInfo(point, nativeEvent);
10203
10383
  if ((hit === null || hit === void 0 ? void 0 : hit.type) === 'shape-hover-control') {
10204
10384
  var resolvedControl = _this.resolveShapeHoverControlFromHit(hit.id, point);
@@ -10256,11 +10436,14 @@ var KonvaInteraction = /** @class */ (function () {
10256
10436
  }
10257
10437
  return;
10258
10438
  }
10259
- if (!hit || hit.type === 'none') {
10439
+ if (isMarqueeGesture) {
10260
10440
  _this.dragState = { mode: 'marquee', start: point, isMulti: isMulti, hasMoved: false };
10261
10441
  (_d = _this.renderer) === null || _d === void 0 ? void 0 : _d.renderMarquee({ x: point.x, y: point.y, width: 0, height: 0 });
10262
10442
  return;
10263
10443
  }
10444
+ if (isEmptyPaper) {
10445
+ return;
10446
+ }
10264
10447
  if (hit.type === 'port') {
10265
10448
  var elementId = _this.engine.getPortElementId(hit.id);
10266
10449
  if (!elementId)
@@ -10325,6 +10508,7 @@ var KonvaInteraction = /** @class */ (function () {
10325
10508
  var element = _this.getElementById(hit.id);
10326
10509
  if (!element)
10327
10510
  return;
10511
+ var movable = _this.isElementMovable(hit.id);
10328
10512
  var anchor = element.anchorCenter ? 'center' : 'top-left';
10329
10513
  var base = element.anchorCenter
10330
10514
  ? {
@@ -10339,12 +10523,13 @@ var KonvaInteraction = /** @class */ (function () {
10339
10523
  offset: { x: point.x - base.x, y: point.y - base.y },
10340
10524
  start: __assign({}, base),
10341
10525
  anchor: anchor,
10526
+ movable: movable,
10342
10527
  startParentId: (_e = element.parentId) !== null && _e !== void 0 ? _e : null,
10343
10528
  selectionIds: _this.engine.getSelection(),
10344
10529
  isMulti: isMulti,
10345
10530
  hasMoved: false,
10346
10531
  };
10347
- _this.setCursor('grabbing');
10532
+ _this.setCursor(movable ? 'grabbing' : 'pointer');
10348
10533
  }
10349
10534
  }
10350
10535
  };
@@ -10402,6 +10587,9 @@ var KonvaInteraction = /** @class */ (function () {
10402
10587
  var dy = target.y - _this.dragState.start.y;
10403
10588
  var moved = Math.hypot(dx, dy) >= _this.dragThreshold;
10404
10589
  _this.dragState.hasMoved = _this.dragState.hasMoved || moved;
10590
+ if (!_this.dragState.movable) {
10591
+ return;
10592
+ }
10405
10593
  _this.engine.moveElementTo(_this.dragState.id, target.x, target.y);
10406
10594
  if (_this.renderer && _this.engine.getSelection().includes(_this.dragState.id)) {
10407
10595
  var element = _this.getElementById(_this.dragState.id);
@@ -10527,15 +10715,15 @@ var KonvaInteraction = /** @class */ (function () {
10527
10715
  var dx = point.x - _this.dragState.start.x;
10528
10716
  var dy = point.y - _this.dragState.start.y;
10529
10717
  _this.pan = {
10530
- x: _this.dragState.origin.x - dx * _this.panSpeed,
10531
- y: _this.dragState.origin.y - dy * _this.panSpeed,
10718
+ x: _this.dragState.origin.x + dx * _this.panSpeed,
10719
+ y: _this.dragState.origin.y + dy * _this.panSpeed,
10532
10720
  };
10533
10721
  _this.applyStageTransform();
10534
10722
  _this.engine.setViewport(_this.pan, _this.zoom);
10535
10723
  }
10536
10724
  };
10537
10725
  var pointerUp = function () {
10538
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10726
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
10539
10727
  var args = [];
10540
10728
  for (var _i = 0; _i < arguments.length; _i++) {
10541
10729
  args[_i] = arguments[_i];
@@ -10629,10 +10817,21 @@ var KonvaInteraction = /** @class */ (function () {
10629
10817
  _this.engine.emitPaperClick(pointerInfo);
10630
10818
  }
10631
10819
  }
10632
- if (((_h = _this.dragState) === null || _h === void 0 ? void 0 : _h.mode) === 'move' && _this.dragState.type === 'element') {
10820
+ if (((_h = _this.dragState) === null || _h === void 0 ? void 0 : _h.mode) === 'pan') {
10821
+ var point = pointerPoint !== null && pointerPoint !== void 0 ? pointerPoint : _this.dragState.start;
10822
+ var dx = point.x - _this.dragState.start.x;
10823
+ var dy = point.y - _this.dragState.start.y;
10824
+ var moved = Math.hypot(dx, dy) >= _this.dragThreshold;
10825
+ if (!moved) {
10826
+ _this.engine.setSelection([]);
10827
+ var pointerInfo = _this.buildPointerInfo(point, nativeEvent);
10828
+ _this.engine.emitPaperClick(pointerInfo);
10829
+ }
10830
+ }
10831
+ if (((_j = _this.dragState) === null || _j === void 0 ? void 0 : _j.mode) === 'move' && _this.dragState.type === 'element') {
10633
10832
  var element = _this.getElementById(_this.dragState.id);
10634
10833
  if (element) {
10635
- var endTopLeft = (_j = _this.engine.getElementWorldPosition(_this.dragState.id)) !== null && _j !== void 0 ? _j : element.position;
10834
+ var endTopLeft = (_k = _this.engine.getElementWorldPosition(_this.dragState.id)) !== null && _k !== void 0 ? _k : element.position;
10636
10835
  var endWorld = _this.dragState.anchor === 'center'
10637
10836
  ? {
10638
10837
  x: endTopLeft.x + element.size.width / 2,
@@ -10643,7 +10842,8 @@ var KonvaInteraction = /** @class */ (function () {
10643
10842
  x: endWorld.x - _this.dragState.start.x,
10644
10843
  y: endWorld.y - _this.dragState.start.y,
10645
10844
  };
10646
- var moved = _this.dragState.hasMoved || Math.hypot(delta.x, delta.y) > 0;
10845
+ var moved = _this.dragState.movable &&
10846
+ (_this.dragState.hasMoved || Math.hypot(delta.x, delta.y) > 0);
10647
10847
  if (moved) {
10648
10848
  _this.engine.emitElementDrop({
10649
10849
  elementId: _this.dragState.id,
@@ -10655,16 +10855,16 @@ var KonvaInteraction = /** @class */ (function () {
10655
10855
  anchor: _this.dragState.anchor,
10656
10856
  });
10657
10857
  }
10658
- else {
10858
+ else if (!_this.dragState.hasMoved) {
10659
10859
  var pointerInfo = _this.buildPointerInfo(pointerPoint !== null && pointerPoint !== void 0 ? pointerPoint : _this.dragState.start, nativeEvent);
10660
10860
  _this.engine.emitElementClick(_this.dragState.id, pointerInfo, _this.dragState.isMulti);
10661
10861
  }
10662
10862
  }
10663
10863
  }
10664
- if (((_k = _this.dragState) === null || _k === void 0 ? void 0 : _k.mode) === 'move' && _this.dragState.type === 'port') {
10864
+ if (((_l = _this.dragState) === null || _l === void 0 ? void 0 : _l.mode) === 'move' && _this.dragState.type === 'port') {
10665
10865
  var elementId = _this.engine.getPortElementId(_this.dragState.id);
10666
10866
  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);
10867
+ 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
10868
  _this.engine.emitPortMouseUp({ portId: _this.dragState.id, elementId: elementId, pointer: pointerInfo });
10669
10869
  }
10670
10870
  }
@@ -10970,6 +11170,10 @@ var KonvaInteraction = /** @class */ (function () {
10970
11170
  this.setCursor('pointer');
10971
11171
  return;
10972
11172
  }
11173
+ if (hit.type === 'element' && !this.isElementMovable(hit.id)) {
11174
+ this.setCursor('pointer');
11175
+ return;
11176
+ }
10973
11177
  this.setCursor('grab');
10974
11178
  };
10975
11179
  KonvaInteraction.prototype.normalizeShapeHoverControls = function (controls) {
@@ -12195,6 +12399,14 @@ var KonvaInteraction = /** @class */ (function () {
12195
12399
  var _a, _b;
12196
12400
  return ((_b = (_a = this.getTextById(id)) === null || _a === void 0 ? void 0 : _a.interaction) === null || _b === void 0 ? void 0 : _b.movable) !== false;
12197
12401
  };
12402
+ KonvaInteraction.prototype.isElementMovable = function (id) {
12403
+ var _a;
12404
+ var element = this.getElementById(id);
12405
+ if (!(element === null || element === void 0 ? void 0 : element.parentId))
12406
+ return true;
12407
+ var parent = this.getElementById(element.parentId);
12408
+ return ((_a = parent === null || parent === void 0 ? void 0 : parent.childElementInteraction) === null || _a === void 0 ? void 0 : _a.movable) !== false;
12409
+ };
12198
12410
  KonvaInteraction.prototype.isTextEditable = function (id) {
12199
12411
  var _a, _b;
12200
12412
  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 +12525,6 @@ var KonvaInteraction = /** @class */ (function () {
12313
12525
  var tag = target.tagName.toLowerCase();
12314
12526
  return tag === 'input' || tag === 'textarea' || tag === 'select';
12315
12527
  };
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
12528
  return KonvaInteraction;
12330
12529
  }());
12331
12530
 
@@ -13694,11 +13893,16 @@ var parentOptions = [
13694
13893
  { id: 'layout-column', label: 'Vertical layout' },
13695
13894
  { id: 'layout-grid', label: 'Grid layout' },
13696
13895
  { id: 'layout-nested', label: 'Nested layout' },
13896
+ { id: 'layout-grid-deep', label: 'Nested grid' },
13897
+ { id: 'layout-lock-compare', label: 'Child lock compare' },
13697
13898
  { id: 'layout-manual', label: 'Manual (compare)' },
13698
13899
  ];
13699
13900
  var shortLabel = 'Parent label lane demo';
13700
13901
  var longLabel = 'Parent label lane demo with longer content to increase flexible reserved space and push children downward.';
13701
13902
  var defaultGridTemplateText = '[12,4,8]';
13903
+ var lockComparisonContainerId = 'layout-lock-compare';
13904
+ var lockParentId = 'deep-lock-parent';
13905
+ var lockTargetId = 'deep-lock-child-a';
13702
13906
  var serializeGridTemplate = function (template) {
13703
13907
  return Array.isArray(template) && template.length > 0 ? JSON.stringify(template) : defaultGridTemplateText;
13704
13908
  };
@@ -13737,11 +13941,13 @@ var parseGridTemplate = function (value) {
13737
13941
  };
13738
13942
  var AutoLayoutDemo = function () {
13739
13943
  var demo = autoLayoutDemoConfig;
13740
- var _a = useDemoEditor({
13741
- createState: demo.createState,
13944
+ var _a = React.useState(true), lockComparisonChildren = _a[0], setLockComparisonChildren = _a[1];
13945
+ var createState = React.useCallback(function () { return createAutoLayoutState(lockComparisonChildren); }, [lockComparisonChildren]);
13946
+ var _b = useDemoEditor({
13947
+ createState: createState,
13742
13948
  elementShapes: demo.elementShapes,
13743
13949
  portShapes: demo.portShapes,
13744
- }), containerRef = _a.containerRef, editorRef = _a.editorRef, diagramState = _a.diagramState, selection = _a.selection, snapEnabled = _a.snapEnabled, setSnapEnabled = _a.setSnapEnabled;
13950
+ }), containerRef = _b.containerRef, editorRef = _b.editorRef, diagramState = _b.diagramState, selection = _b.selection, snapEnabled = _b.snapEnabled, setSnapEnabled = _b.setSnapEnabled;
13745
13951
  var nextOffset = useOffsetSequence();
13746
13952
  var actionHelpers = React.useMemo(function () { return ({ nextOffset: nextOffset }); }, [nextOffset]);
13747
13953
  var controls = useDemoControls({
@@ -13753,25 +13959,25 @@ var AutoLayoutDemo = function () {
13753
13959
  setSnapEnabled: setSnapEnabled,
13754
13960
  actionHelpers: actionHelpers,
13755
13961
  });
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];
13962
+ var _c = React.useState(parentOptions[0].id), targetId = _c[0], setTargetId = _c[1];
13963
+ var _d = React.useState('horizontal'), mode = _d[0], setMode = _d[1];
13964
+ var _e = React.useState('center'), align = _e[0], setAlign = _e[1];
13965
+ var _f = React.useState('grow'), autoResize = _f[0], setAutoResize = _f[1];
13966
+ var _g = React.useState(12), padding = _g[0], setPadding = _g[1];
13967
+ var _h = React.useState(12), gap = _h[0], setGap = _h[1];
13968
+ var _j = React.useState('none'), childFitMainAxis = _j[0], setChildFitMainAxis = _j[1];
13969
+ var _k = React.useState('none'), childFitCrossAxis = _k[0], setChildFitCrossAxis = _k[1];
13970
+ var _l = React.useState(''), childMinWidth = _l[0], setChildMinWidth = _l[1];
13971
+ var _m = React.useState(''), childMinHeight = _m[0], setChildMinHeight = _m[1];
13972
+ var _o = React.useState(''), childMaxWidth = _o[0], setChildMaxWidth = _o[1];
13973
+ var _p = React.useState(''), childMaxHeight = _p[0], setChildMaxHeight = _p[1];
13974
+ var _q = React.useState(defaultGridTemplateText), gridTemplateText = _q[0], setGridTemplateText = _q[1];
13975
+ var _r = React.useState(false), gridChildWidthResizeEnabled = _r[0], setGridChildWidthResizeEnabled = _r[1];
13976
+ var _s = React.useState('none'), labelReservedMode = _s[0], setLabelReservedMode = _s[1];
13977
+ var _t = React.useState(32), labelReservedFixedSize = _t[0], setLabelReservedFixedSize = _t[1];
13978
+ var _u = React.useState(''), labelReservedMinSize = _u[0], setLabelReservedMinSize = _u[1];
13979
+ var _v = React.useState(''), labelReservedMaxSize = _v[0], setLabelReservedMaxSize = _v[1];
13980
+ var _w = React.useState('None yet'), lastTrigger = _w[0], setLastTrigger = _w[1];
13775
13981
  React.useEffect(function () {
13776
13982
  var editor = editorRef.current;
13777
13983
  if (!editor)
@@ -13805,6 +14011,36 @@ var AutoLayoutDemo = function () {
13805
14011
  }
13806
14012
  }, [diagramState, targetId]);
13807
14013
  var targetElement = React.useMemo(function () { return diagramState === null || diagramState === void 0 ? void 0 : diagramState.elements.find(function (el) { return el.id === targetId; }); }, [diagramState, targetId]);
14014
+ var resolveElementWorldPosition = React.useCallback(function (elementId) {
14015
+ if (!diagramState)
14016
+ return null;
14017
+ var byId = new Map(diagramState.elements.map(function (element) { return [element.id, element]; }));
14018
+ var current = byId.get(elementId);
14019
+ if (!current)
14020
+ return null;
14021
+ var x = 0;
14022
+ var y = 0;
14023
+ while (current) {
14024
+ x += current.position.x;
14025
+ y += current.position.y;
14026
+ current = current.parentId ? byId.get(current.parentId) : undefined;
14027
+ }
14028
+ return { x: x, y: y };
14029
+ }, [diagramState]);
14030
+ var lockDemoContext = React.useMemo(function () {
14031
+ var _a;
14032
+ if (!diagramState)
14033
+ return null;
14034
+ var outer = diagramState.elements.find(function (el) { return el.id === lockComparisonContainerId; });
14035
+ var parent = diagramState.elements.find(function (el) { return el.id === lockParentId; });
14036
+ if (!outer || !parent)
14037
+ return null;
14038
+ return {
14039
+ outer: outer,
14040
+ parent: parent,
14041
+ isLocked: ((_a = parent.childElementInteraction) === null || _a === void 0 ? void 0 : _a.movable) === false,
14042
+ };
14043
+ }, [diagramState]);
13808
14044
  var targetOptions = React.useMemo(function () {
13809
14045
  var seen = new Set();
13810
14046
  var options = [];
@@ -13951,21 +14187,29 @@ var AutoLayoutDemo = function () {
13951
14187
  setLastTrigger('child removed');
13952
14188
  }
13953
14189
  };
13954
- var handleFocusResizeLockChild = function () {
14190
+ var handleFocusLockTarget = function () {
13955
14191
  var editor = editorRef.current;
13956
14192
  if (!editor)
13957
14193
  return;
13958
- setTargetId('layout-grid');
13959
- editor.setSelection(['grid-b']);
13960
- setLastTrigger('focus resize-lock child');
14194
+ setTargetId(lockParentId);
14195
+ editor.setSelection([lockTargetId]);
14196
+ setLastTrigger(lockComparisonChildren ? 'focus locked child' : 'focus unlocked comparison child');
13961
14197
  };
13962
- var handleFocusResizeLockParent = function () {
14198
+ var handleFocusLockParent = function () {
13963
14199
  var editor = editorRef.current;
13964
14200
  if (!editor)
13965
14201
  return;
13966
- setTargetId('layout-grid');
13967
- editor.setSelection(['layout-grid']);
13968
- setLastTrigger('focus resize-lock parent');
14202
+ setTargetId(lockParentId);
14203
+ editor.setSelection([lockParentId]);
14204
+ setLastTrigger('focus lock parent');
14205
+ };
14206
+ var handleMoveLockTargetViaApi = function () {
14207
+ var editor = editorRef.current;
14208
+ var parentWorld = resolveElementWorldPosition(lockParentId);
14209
+ if (!editor || !lockDemoContext || !parentWorld)
14210
+ return;
14211
+ editor.moveElementTo(lockTargetId, parentWorld.x + 56, parentWorld.y + 18);
14212
+ setLastTrigger(lockDemoContext.isLocked ? 'locked child moved by api' : 'comparison child moved by api');
13969
14213
  };
13970
14214
  var alignmentLabel = mode === 'horizontal'
13971
14215
  ? 'Vertical align (top/center/bottom)'
@@ -13976,10 +14220,17 @@ var AutoLayoutDemo = function () {
13976
14220
  React.createElement("div", { style: { marginBottom: 12 } },
13977
14221
  React.createElement("h2", { style: { marginTop: 0, marginBottom: 4 } }, demo.title),
13978
14222
  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."),
14223
+ 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
14224
  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.")),
14225
+ "The ",
14226
+ React.createElement("code", null, "layout-grid-deep"),
14227
+ " scenario now keeps the outer container focused on grid behavior with three direct grid children, including one nested grid parent that also follows the enabled 12-unit resize path. The child drag lock comparison lives beside it in ",
14228
+ React.createElement("code", null, " layout-lock-compare"),
14229
+ "; toggle the lock, try dragging",
14230
+ React.createElement("code", null, " deep-lock-child-a"),
14231
+ " versus ",
14232
+ React.createElement("code", null, " deep-free-child-a"),
14233
+ ", then use the API move shortcut to confirm the policy suppresses built-in drag without freezing geometry.")),
13983
14234
  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
14235
  React.createElement("div", { style: { display: 'grid', gap: 12, marginBottom: 12 } },
13985
14236
  React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center' } },
@@ -14032,6 +14283,14 @@ var AutoLayoutDemo = function () {
14032
14283
  React.createElement("label", { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
14033
14284
  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
14285
  "Enable 12-unit resize on child width drag"),
14286
+ React.createElement("label", { htmlFor: "lock-comparison-child-drag", style: { fontWeight: 600 } }, "Lock comparison child drag"),
14287
+ React.createElement("label", { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
14288
+ React.createElement("input", { id: "lock-comparison-child-drag", type: "checkbox", checked: lockComparisonChildren, onChange: function (event) {
14289
+ setLockComparisonChildren(event.target.checked);
14290
+ setTargetId(lockComparisonContainerId);
14291
+ setLastTrigger(event.target.checked ? 'comparison child drag locked' : 'comparison child drag unlocked');
14292
+ } }),
14293
+ "Reload parent-owned lock demo"),
14035
14294
  React.createElement("label", { htmlFor: "label-reserved-mode-select", style: { fontWeight: 600 } }, "Label lane"),
14036
14295
  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
14296
  React.createElement("option", { value: "none" }, "None"),
@@ -14062,8 +14321,9 @@ var AutoLayoutDemo = function () {
14062
14321
  React.createElement("strong", null, lastTrigger)),
14063
14322
  React.createElement("button", { type: "button", onClick: function () { return handleSetLabelContent(shortLabel); }, style: { padding: '6px 10px' }, disabled: !targetElement || mode === 'manual' }, "Label short"),
14064
14323
  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")),
14324
+ React.createElement("button", { type: "button", onClick: handleFocusLockTarget, style: { padding: '6px 10px' } }, "Focus lock target"),
14325
+ React.createElement("button", { type: "button", onClick: handleFocusLockParent, style: { padding: '6px 10px' } }, "Focus lock parent"),
14326
+ React.createElement("button", { type: "button", onClick: handleMoveLockTargetViaApi, style: { padding: '6px 10px' } }, "Move lock target via API")),
14067
14327
  React.createElement("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
14068
14328
  React.createElement("div", null,
14069
14329
  React.createElement("div", { style: { fontWeight: 600, marginBottom: 6 } }, "Child order (axis or grid row-major)"),
@@ -14084,6 +14344,10 @@ var AutoLayoutDemo = function () {
14084
14344
  React.createElement("div", null,
14085
14345
  React.createElement("div", { style: { fontWeight: 600, marginBottom: 6 } }, "Scenario tips"),
14086
14346
  React.createElement("ul", { style: { marginTop: 0, paddingLeft: 18, fontSize: 13 } },
14347
+ 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."),
14348
+ 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."),
14349
+ 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."),
14350
+ 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
14351
  React.createElement("li", null, "Resize lock: with grid child width resize off, select grid-b and drag diagonally; width should stay fixed."),
14088
14352
  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
14353
  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."),