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.
@@ -858,23 +858,44 @@ var linkPortCreationDemoConfig = ({
858
858
  var createNestedState = function () { return ({
859
859
  elements: [
860
860
  {
861
- id: 'parent-1',
862
- position: { x: 140, y: 140 },
863
- size: { width: 320, height: 240 },
861
+ id: 'parent-locked',
862
+ position: { x: 110, y: 140 },
863
+ size: { width: 300, height: 240 },
864
+ shapeId: 'panel',
865
+ childElementInteraction: { movable: false },
866
+ },
867
+ {
868
+ id: 'child-locked',
869
+ position: { x: 40, y: 60 },
870
+ size: { width: 160, height: 100 },
871
+ shapeId: 'default',
872
+ parentId: 'parent-locked',
873
+ },
874
+ {
875
+ id: 'parent-free',
876
+ position: { x: 470, y: 140 },
877
+ size: { width: 300, height: 240 },
864
878
  shapeId: 'panel',
865
879
  },
866
880
  {
867
- id: 'child-1',
881
+ id: 'child-free',
868
882
  position: { x: 40, y: 60 },
869
883
  size: { width: 160, height: 100 },
870
884
  shapeId: 'default',
871
- parentId: 'parent-1',
885
+ parentId: 'parent-free',
872
886
  },
873
887
  ],
874
888
  ports: [
875
889
  {
876
- id: 'child-port',
877
- elementId: 'child-1',
890
+ id: 'child-port-locked',
891
+ elementId: 'child-locked',
892
+ position: { x: 20, y: 20 },
893
+ shapeId: 'port-circle',
894
+ anchorCenter: true,
895
+ },
896
+ {
897
+ id: 'child-port-free',
898
+ elementId: 'child-free',
878
899
  position: { x: 20, y: 20 },
879
900
  shapeId: 'port-circle',
880
901
  anchorCenter: true,
@@ -883,28 +904,61 @@ var createNestedState = function () { return ({
883
904
  links: [],
884
905
  texts: [
885
906
  {
886
- id: 'child-label',
887
- content: 'Child',
888
- position: { x: 6, y: -16 },
889
- ownerId: 'child-1',
907
+ id: 'parent-locked-label',
908
+ content: 'Locked child drag',
909
+ position: { x: 12, y: 12 },
910
+ ownerId: 'parent-locked',
911
+ interaction: { movable: false, editable: false },
912
+ },
913
+ {
914
+ id: 'child-locked-label',
915
+ content: 'Drag disabled',
916
+ position: { x: 10, y: 10 },
917
+ ownerId: 'child-locked',
918
+ interaction: { movable: false, editable: false },
919
+ },
920
+ {
921
+ id: 'parent-free-label',
922
+ content: 'Movable child drag',
923
+ position: { x: 12, y: 12 },
924
+ ownerId: 'parent-free',
925
+ interaction: { movable: false, editable: false },
926
+ },
927
+ {
928
+ id: 'child-free-label',
929
+ content: 'Drag enabled',
930
+ position: { x: 10, y: 10 },
931
+ ownerId: 'child-free',
932
+ interaction: { movable: false, editable: false },
890
933
  },
891
934
  ],
892
935
  }); };
893
936
  var nestedDemoConfig = ({
894
937
  id: 'nested',
895
938
  title: 'Nested Elements',
896
- description: 'Parent/child elements with world positioning.',
939
+ description: 'Compare locked and movable child drag; locked children still move through API actions.',
897
940
  createState: createNestedState,
898
941
  elementShapes: baseElementShapes,
899
942
  portShapes: basePortShapes,
900
943
  defaultElementShapeId: 'default',
901
944
  defaultPortShapeId: 'port-circle',
902
945
  actions: [
946
+ {
947
+ id: 'move-locked-child-api',
948
+ label: 'Move locked child (API)',
949
+ run: function (editor, state) {
950
+ var child = state.elements.find(function (element) { return element.id === 'child-locked'; });
951
+ var parent = state.elements.find(function (element) { return element.id === 'parent-locked'; });
952
+ if (!child || !parent)
953
+ return;
954
+ editor.moveElementTo(child.id, parent.position.x + child.position.x + 30, parent.position.y + child.position.y + 10);
955
+ },
956
+ },
903
957
  {
904
958
  id: 'move-parent',
905
- label: 'Move parent',
959
+ label: 'Move locked parent',
906
960
  run: function (editor, state) {
907
- var parent = state.elements.find(function (element) { return element.id === 'parent-1'; });
961
+ var parent = state.elements.find(function (element) { return element.id === 'parent-locked'; });
908
962
  if (!parent)
909
963
  return;
910
964
  editor.moveElementTo(parent.id, parent.position.x + 40, parent.position.y + 20);
@@ -912,15 +966,15 @@ var nestedDemoConfig = ({
912
966
  },
913
967
  {
914
968
  id: 'add-child',
915
- label: 'Add child',
969
+ label: 'Add movable child',
916
970
  run: function (editor, state, demo, helpers) {
917
971
  var _a;
918
- var parent = state.elements.find(function (element) { return element.id === 'parent-1'; });
972
+ var parent = state.elements.find(function (element) { return element.id === 'parent-free'; });
919
973
  if (!parent)
920
974
  return;
921
975
  var offset = helpers.nextOffset();
922
976
  editor.addElement({
923
- id: "child-".concat(createId()),
977
+ id: "child-free-".concat(createId()),
924
978
  position: { x: 30 + offset, y: 50 + offset },
925
979
  size: { width: 140, height: 90 },
926
980
  shapeId: (_a = demo.defaultElementShapeId) !== null && _a !== void 0 ? _a : 'default',
@@ -1239,147 +1293,266 @@ var linkCancelDemoConfig = ({
1239
1293
  actions: [],
1240
1294
  });
1241
1295
 
1242
- var createAutoLayoutState = function () { return ({
1243
- elements: [
1244
- {
1245
- id: 'layout-row',
1246
- position: { x: 60, y: 80 },
1247
- size: { width: 180, height: 96 },
1248
- shapeId: 'panel',
1249
- layout: { mode: 'horizontal', padding: { x: 14, y: 12 }, gap: 14, align: 'center' },
1250
- },
1251
- { id: 'row-a', position: { x: 0, y: 0 }, size: { width: 62, height: 44 }, shapeId: 'default', parentId: 'layout-row' },
1252
- { id: 'row-b', position: { x: 0, y: 0 }, size: { width: 96, height: 32 }, shapeId: 'default', parentId: 'layout-row' },
1253
- { id: 'row-c', position: { x: 0, y: 0 }, size: { width: 54, height: 56 }, shapeId: 'default', parentId: 'layout-row' },
1254
- {
1255
- id: 'row-nested-owner',
1256
- position: { x: 0, y: 0 },
1257
- size: { width: 82, height: 82 },
1258
- shapeId: 'default',
1259
- parentId: 'layout-row',
1260
- layout: { mode: 'vertical', padding: { x: 8, y: 6 }, gap: 6, align: 'start' },
1261
- },
1262
- { id: 'row-nested-child-a', position: { x: 0, y: 0 }, size: { width: 60, height: 20 }, shapeId: 'default', parentId: 'row-nested-owner' },
1263
- { id: 'row-nested-child-b', position: { x: 0, y: 0 }, size: { width: 76, height: 22 }, shapeId: 'default', parentId: 'row-nested-owner' },
1264
- {
1265
- id: 'layout-column',
1266
- position: { x: 400, y: 70 },
1267
- size: { width: 120, height: 140 },
1268
- shapeId: 'panel',
1269
- layout: { mode: 'vertical', padding: { x: 12, y: 10 }, gap: 16, align: 'end' },
1270
- },
1271
- { id: 'col-a', position: { x: 0, y: 0 }, size: { width: 44, height: 28 }, shapeId: 'default', parentId: 'layout-column' },
1272
- { id: 'col-b', position: { x: 0, y: 0 }, size: { width: 70, height: 36 }, shapeId: 'default', parentId: 'layout-column' },
1273
- { id: 'col-c', position: { x: 0, y: 0 }, size: { width: 92, height: 44 }, shapeId: 'default', parentId: 'layout-column' },
1274
- {
1275
- id: 'layout-grid',
1276
- position: { x: 620, y: 70 },
1277
- size: { width: 160, height: 110 },
1278
- shapeId: 'panel',
1279
- layout: {
1280
- mode: 'grid',
1281
- padding: { x: 10, y: 10 },
1282
- gap: 10,
1283
- align: 'center',
1284
- autoResize: 'grow-shrink',
1285
- gridTemplate: [12, 4, 8],
1286
- gridChildWidthResizeEnabled: false,
1287
- childMinWidth: 24,
1288
- childMinHeight: 18,
1296
+ var createAutoLayoutState = function (lockComparisonChildren) {
1297
+ if (lockComparisonChildren === void 0) { lockComparisonChildren = true; }
1298
+ return ({
1299
+ elements: [
1300
+ {
1301
+ id: 'layout-row',
1302
+ position: { x: 60, y: 80 },
1303
+ size: { width: 180, height: 96 },
1304
+ shapeId: 'panel',
1305
+ layout: { mode: 'horizontal', padding: { x: 14, y: 12 }, gap: 14, align: 'center' },
1289
1306
  },
1290
- },
1291
- { id: 'grid-a', position: { x: 0, y: 0 }, size: { width: 36, height: 26 }, shapeId: 'default', parentId: 'layout-grid' },
1292
- { id: 'grid-b', position: { x: 0, y: 0 }, size: { width: 44, height: 24 }, shapeId: 'default', parentId: 'layout-grid' },
1293
- { id: 'grid-c', position: { x: 0, y: 0 }, size: { width: 50, height: 20 }, shapeId: 'default', parentId: 'layout-grid' },
1294
- { id: 'grid-d', position: { x: 0, y: 0 }, size: { width: 28, height: 30 }, shapeId: 'default', parentId: 'layout-grid' },
1295
- { id: 'grid-e', position: { x: 0, y: 0 }, size: { width: 52, height: 28 }, shapeId: 'default', parentId: 'layout-grid' },
1296
- {
1297
- id: 'layout-nested',
1298
- position: { x: 120, y: 260 },
1299
- size: { width: 190, height: 130 },
1300
- shapeId: 'panel',
1301
- layout: { mode: 'horizontal', padding: { x: 12, y: 12 }, gap: 12, align: 'start' },
1302
- },
1303
- {
1304
- id: 'nested-stack',
1305
- position: { x: 0, y: 0 },
1306
- size: { width: 90, height: 92 },
1307
- shapeId: 'default',
1308
- parentId: 'layout-nested',
1309
- layout: { mode: 'vertical', padding: { x: 8, y: 8 }, gap: 8, align: 'center' },
1310
- },
1311
- { id: 'stack-a', position: { x: 0, y: 0 }, size: { width: 60, height: 24 }, shapeId: 'default', parentId: 'nested-stack' },
1312
- { id: 'stack-b', position: { x: 0, y: 0 }, size: { width: 90, height: 30 }, shapeId: 'default', parentId: 'nested-stack' },
1313
- {
1314
- id: 'stack-overflow',
1315
- position: { x: 0, y: 0 },
1316
- size: { width: 110, height: 26 },
1317
- shapeId: 'default',
1318
- parentId: 'nested-stack',
1319
- },
1320
- { id: 'nested-peer', position: { x: 0, y: 0 }, size: { width: 50, height: 90 }, shapeId: 'default', parentId: 'layout-nested' },
1321
- {
1322
- id: 'layout-manual',
1323
- position: { x: 420, y: 260 },
1324
- size: { width: 190, height: 120 },
1325
- shapeId: 'panel',
1326
- },
1327
- { id: 'manual-a', position: { x: 12, y: 18 }, size: { width: 60, height: 30 }, shapeId: 'default', parentId: 'layout-manual' },
1328
- { id: 'manual-b', position: { x: 90, y: 60 }, size: { width: 68, height: 32 }, shapeId: 'default', parentId: 'layout-manual' },
1329
- ],
1330
- ports: [],
1331
- links: [],
1332
- texts: [
1333
- {
1334
- id: 'label-layout-row',
1335
- content: 'Row parent label lane',
1336
- position: { x: 8, y: 6 },
1337
- ownerId: 'layout-row',
1338
- layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1339
- },
1340
- { id: 'label-row-a', content: 'row-a', position: { x: 6, y: -14 }, ownerId: 'row-a' },
1341
- { id: 'label-row-b', content: 'row-b', position: { x: 6, y: -14 }, ownerId: 'row-b' },
1342
- { id: 'label-row-c', content: 'row-c', position: { x: 6, y: -14 }, ownerId: 'row-c' },
1343
- { id: 'label-row-nested-owner', content: 'owns children', position: { x: 6, y: -16 }, ownerId: 'row-nested-owner' },
1344
- {
1345
- id: 'label-layout-column',
1346
- content: 'Column parent label lane',
1347
- position: { x: 8, y: 6 },
1348
- ownerId: 'layout-column',
1349
- layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1350
- },
1351
- { id: 'label-col-a', content: 'col-a', position: { x: 6, y: -14 }, ownerId: 'col-a' },
1352
- { id: 'label-col-b', content: 'col-b', position: { x: 6, y: -14 }, ownerId: 'col-b' },
1353
- { id: 'label-col-c', content: 'col-c', position: { x: 6, y: -14 }, ownerId: 'col-c' },
1354
- {
1355
- id: 'label-layout-grid',
1356
- content: 'Grid template [12,4,8]',
1357
- position: { x: 8, y: 6 },
1358
- ownerId: 'layout-grid',
1359
- layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1360
- },
1361
- { id: 'label-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'grid-a' },
1362
- { id: 'label-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'grid-b' },
1363
- { id: 'label-grid-c', content: 'grid-c', position: { x: 6, y: -14 }, ownerId: 'grid-c' },
1364
- { id: 'label-grid-d', content: 'grid-d', position: { x: 6, y: -14 }, ownerId: 'grid-d' },
1365
- { id: 'label-grid-e', content: 'grid-e', position: { x: 6, y: -14 }, ownerId: 'grid-e' },
1366
- {
1367
- id: 'label-layout-nested',
1368
- content: 'Row + nested column lane',
1369
- position: { x: 6, y: 6 },
1370
- ownerId: 'layout-nested',
1371
- layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1372
- },
1373
- { id: 'label-nested-stack', content: 'nested stack', position: { x: 6, y: -16 }, ownerId: 'nested-stack' },
1374
- { id: 'label-stack-a', content: 'stack-a', position: { x: 6, y: -14 }, ownerId: 'stack-a' },
1375
- { id: 'label-stack-b', content: 'stack-b', position: { x: 6, y: -14 }, ownerId: 'stack-b' },
1376
- { id: 'label-stack-overflow', content: 'stack-overflow', position: { x: 6, y: -14 }, ownerId: 'stack-overflow' },
1377
- { id: 'label-nested-peer', content: 'nested-peer', position: { x: 6, y: -14 }, ownerId: 'nested-peer' },
1378
- { id: 'label-layout-manual', content: 'Manual (no layout)', position: { x: 6, y: -18 }, ownerId: 'layout-manual' },
1379
- { id: 'label-manual-a', content: 'manual-a', position: { x: 6, y: -14 }, ownerId: 'manual-a' },
1380
- { id: 'label-manual-b', content: 'manual-b', position: { x: 6, y: -14 }, ownerId: 'manual-b' },
1381
- ],
1382
- }); };
1307
+ { id: 'row-a', position: { x: 0, y: 0 }, size: { width: 62, height: 44 }, shapeId: 'default', parentId: 'layout-row' },
1308
+ { id: 'row-b', position: { x: 0, y: 0 }, size: { width: 96, height: 32 }, shapeId: 'default', parentId: 'layout-row' },
1309
+ { id: 'row-c', position: { x: 0, y: 0 }, size: { width: 54, height: 56 }, shapeId: 'default', parentId: 'layout-row' },
1310
+ {
1311
+ id: 'row-nested-owner',
1312
+ position: { x: 0, y: 0 },
1313
+ size: { width: 82, height: 82 },
1314
+ shapeId: 'default',
1315
+ parentId: 'layout-row',
1316
+ layout: { mode: 'vertical', padding: { x: 8, y: 6 }, gap: 6, align: 'start' },
1317
+ },
1318
+ { id: 'row-nested-child-a', position: { x: 0, y: 0 }, size: { width: 60, height: 20 }, shapeId: 'default', parentId: 'row-nested-owner' },
1319
+ { id: 'row-nested-child-b', position: { x: 0, y: 0 }, size: { width: 76, height: 22 }, shapeId: 'default', parentId: 'row-nested-owner' },
1320
+ {
1321
+ id: 'layout-column',
1322
+ position: { x: 400, y: 70 },
1323
+ size: { width: 120, height: 140 },
1324
+ shapeId: 'panel',
1325
+ layout: { mode: 'vertical', padding: { x: 12, y: 10 }, gap: 16, align: 'end' },
1326
+ },
1327
+ { id: 'col-a', position: { x: 0, y: 0 }, size: { width: 44, height: 28 }, shapeId: 'default', parentId: 'layout-column' },
1328
+ { id: 'col-b', position: { x: 0, y: 0 }, size: { width: 70, height: 36 }, shapeId: 'default', parentId: 'layout-column' },
1329
+ { id: 'col-c', position: { x: 0, y: 0 }, size: { width: 92, height: 44 }, shapeId: 'default', parentId: 'layout-column' },
1330
+ {
1331
+ id: 'layout-grid',
1332
+ position: { x: 620, y: 70 },
1333
+ size: { width: 160, height: 110 },
1334
+ shapeId: 'panel',
1335
+ layout: {
1336
+ mode: 'grid',
1337
+ padding: { x: 10, y: 10 },
1338
+ gap: 10,
1339
+ align: 'center',
1340
+ autoResize: 'grow-shrink',
1341
+ gridTemplate: [12, 4, 8],
1342
+ gridChildWidthResizeEnabled: true,
1343
+ childMinWidth: 24,
1344
+ childMinHeight: 18,
1345
+ },
1346
+ },
1347
+ { id: 'grid-a', position: { x: 0, y: 0 }, size: { width: 36, height: 26 }, shapeId: 'default', parentId: 'layout-grid' },
1348
+ { id: 'grid-b', position: { x: 0, y: 0 }, size: { width: 44, height: 24 }, shapeId: 'default', parentId: 'layout-grid' },
1349
+ { id: 'grid-c', position: { x: 0, y: 0 }, size: { width: 50, height: 20 }, shapeId: 'default', parentId: 'layout-grid' },
1350
+ { id: 'grid-d', position: { x: 0, y: 0 }, size: { width: 28, height: 30 }, shapeId: 'default', parentId: 'layout-grid' },
1351
+ { id: 'grid-e', position: { x: 0, y: 0 }, size: { width: 52, height: 28 }, shapeId: 'default', parentId: 'layout-grid' },
1352
+ {
1353
+ id: 'layout-nested',
1354
+ position: { x: 120, y: 260 },
1355
+ size: { width: 190, height: 130 },
1356
+ shapeId: 'panel',
1357
+ layout: { mode: 'horizontal', padding: { x: 12, y: 12 }, gap: 12, align: 'start' },
1358
+ },
1359
+ {
1360
+ id: 'nested-stack',
1361
+ position: { x: 0, y: 0 },
1362
+ size: { width: 90, height: 92 },
1363
+ shapeId: 'default',
1364
+ parentId: 'layout-nested',
1365
+ layout: { mode: 'vertical', padding: { x: 8, y: 8 }, gap: 8, align: 'center' },
1366
+ },
1367
+ { id: 'stack-a', position: { x: 0, y: 0 }, size: { width: 60, height: 24 }, shapeId: 'default', parentId: 'nested-stack' },
1368
+ { id: 'stack-b', position: { x: 0, y: 0 }, size: { width: 90, height: 30 }, shapeId: 'default', parentId: 'nested-stack' },
1369
+ {
1370
+ id: 'stack-overflow',
1371
+ position: { x: 0, y: 0 },
1372
+ size: { width: 110, height: 26 },
1373
+ shapeId: 'default',
1374
+ parentId: 'nested-stack',
1375
+ },
1376
+ { id: 'nested-peer', position: { x: 0, y: 0 }, size: { width: 50, height: 90 }, shapeId: 'default', parentId: 'layout-nested' },
1377
+ {
1378
+ id: 'layout-grid-deep',
1379
+ position: { x: 640, y: 250 },
1380
+ size: { width: 250, height: 180 },
1381
+ shapeId: 'panel',
1382
+ layout: {
1383
+ mode: 'grid',
1384
+ padding: { x: 12, y: 12 },
1385
+ gap: 12,
1386
+ align: 'center',
1387
+ autoResize: 'grow-shrink',
1388
+ gridTemplate: [4, 4, 4],
1389
+ gridChildWidthResizeEnabled: true,
1390
+ childMinWidth: 48,
1391
+ childMinHeight: 60,
1392
+ },
1393
+ },
1394
+ {
1395
+ id: 'deep-grid-leaf-left',
1396
+ position: { x: 0, y: 0 },
1397
+ size: { width: 58, height: 72 },
1398
+ shapeId: 'default',
1399
+ parentId: 'layout-grid-deep',
1400
+ },
1401
+ {
1402
+ id: 'deep-grid-nested-parent',
1403
+ position: { x: 0, y: 0 },
1404
+ size: { width: 108, height: 90 },
1405
+ shapeId: 'default',
1406
+ parentId: 'layout-grid-deep',
1407
+ layout: {
1408
+ mode: 'grid',
1409
+ padding: { x: 8, y: 8 },
1410
+ gap: 8,
1411
+ align: 'center',
1412
+ autoResize: 'grow-shrink',
1413
+ gridTemplate: [6, 6],
1414
+ gridChildWidthResizeEnabled: true,
1415
+ childMinWidth: 18,
1416
+ childMinHeight: 18,
1417
+ },
1418
+ },
1419
+ {
1420
+ id: 'deep-grid-leaf-right',
1421
+ position: { x: 0, y: 0 },
1422
+ size: { width: 52, height: 78 },
1423
+ shapeId: 'default',
1424
+ parentId: 'layout-grid-deep',
1425
+ },
1426
+ { id: 'deep-grid-a', position: { x: 0, y: 0 }, size: { width: 34, height: 24 }, shapeId: 'default', parentId: 'deep-grid-nested-parent' },
1427
+ { id: 'deep-grid-b', position: { x: 0, y: 0 }, size: { width: 40, height: 28 }, shapeId: 'default', parentId: 'deep-grid-nested-parent' },
1428
+ { id: 'deep-grid-c', position: { x: 0, y: 0 }, size: { width: 52, height: 24 }, shapeId: 'default', parentId: 'deep-grid-nested-parent' },
1429
+ { id: 'deep-grid-d', position: { x: 0, y: 0 }, size: { width: 28, height: 30 }, shapeId: 'default', parentId: 'deep-grid-nested-parent' },
1430
+ {
1431
+ id: 'layout-lock-compare',
1432
+ position: { x: 420, y: 410 },
1433
+ size: { width: 240, height: 160 },
1434
+ shapeId: 'panel',
1435
+ layout: { mode: 'horizontal', padding: { x: 12, y: 12 }, gap: 12, align: 'start' },
1436
+ },
1437
+ {
1438
+ id: 'deep-lock-parent',
1439
+ position: { x: 0, y: 0 },
1440
+ size: { width: 110, height: 92 },
1441
+ shapeId: 'default',
1442
+ parentId: 'layout-lock-compare',
1443
+ childElementInteraction: lockComparisonChildren ? { movable: false } : undefined,
1444
+ },
1445
+ { id: 'deep-lock-child-a', position: { x: 12, y: 24 }, size: { width: 38, height: 24 }, shapeId: 'default', parentId: 'deep-lock-parent' },
1446
+ { id: 'deep-lock-child-b', position: { x: 56, y: 54 }, size: { width: 42, height: 24 }, shapeId: 'default', parentId: 'deep-lock-parent' },
1447
+ {
1448
+ id: 'deep-free-parent',
1449
+ position: { x: 0, y: 0 },
1450
+ size: { width: 110, height: 92 },
1451
+ shapeId: 'default',
1452
+ parentId: 'layout-lock-compare',
1453
+ },
1454
+ { id: 'deep-free-child-a', position: { x: 12, y: 24 }, size: { width: 38, height: 24 }, shapeId: 'default', parentId: 'deep-free-parent' },
1455
+ { id: 'deep-free-child-b', position: { x: 56, y: 54 }, size: { width: 42, height: 24 }, shapeId: 'default', parentId: 'deep-free-parent' },
1456
+ {
1457
+ id: 'layout-manual',
1458
+ position: { x: 420, y: 260 },
1459
+ size: { width: 190, height: 120 },
1460
+ shapeId: 'panel',
1461
+ },
1462
+ { id: 'manual-a', position: { x: 12, y: 18 }, size: { width: 60, height: 30 }, shapeId: 'default', parentId: 'layout-manual' },
1463
+ { id: 'manual-b', position: { x: 90, y: 60 }, size: { width: 68, height: 32 }, shapeId: 'default', parentId: 'layout-manual' },
1464
+ ],
1465
+ ports: [],
1466
+ links: [],
1467
+ texts: [
1468
+ {
1469
+ id: 'label-layout-row',
1470
+ content: 'Row parent label lane',
1471
+ position: { x: 8, y: 6 },
1472
+ ownerId: 'layout-row',
1473
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1474
+ },
1475
+ { id: 'label-row-a', content: 'row-a', position: { x: 6, y: -14 }, ownerId: 'row-a' },
1476
+ { id: 'label-row-b', content: 'row-b', position: { x: 6, y: -14 }, ownerId: 'row-b' },
1477
+ { id: 'label-row-c', content: 'row-c', position: { x: 6, y: -14 }, ownerId: 'row-c' },
1478
+ { id: 'label-row-nested-owner', content: 'owns children', position: { x: 6, y: -16 }, ownerId: 'row-nested-owner' },
1479
+ {
1480
+ id: 'label-layout-column',
1481
+ content: 'Column parent label lane',
1482
+ position: { x: 8, y: 6 },
1483
+ ownerId: 'layout-column',
1484
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1485
+ },
1486
+ { id: 'label-col-a', content: 'col-a', position: { x: 6, y: -14 }, ownerId: 'col-a' },
1487
+ { id: 'label-col-b', content: 'col-b', position: { x: 6, y: -14 }, ownerId: 'col-b' },
1488
+ { id: 'label-col-c', content: 'col-c', position: { x: 6, y: -14 }, ownerId: 'col-c' },
1489
+ {
1490
+ id: 'label-layout-grid',
1491
+ content: 'Grid template [12,4,8]',
1492
+ position: { x: 8, y: 6 },
1493
+ ownerId: 'layout-grid',
1494
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1495
+ },
1496
+ { id: 'label-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'grid-a' },
1497
+ { id: 'label-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'grid-b' },
1498
+ { id: 'label-grid-c', content: 'grid-c', position: { x: 6, y: -14 }, ownerId: 'grid-c' },
1499
+ { id: 'label-grid-d', content: 'grid-d', position: { x: 6, y: -14 }, ownerId: 'grid-d' },
1500
+ { id: 'label-grid-e', content: 'grid-e', position: { x: 6, y: -14 }, ownerId: 'grid-e' },
1501
+ {
1502
+ id: 'label-layout-nested',
1503
+ content: 'Row + nested column lane',
1504
+ position: { x: 6, y: 6 },
1505
+ ownerId: 'layout-nested',
1506
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1507
+ },
1508
+ { id: 'label-nested-stack', content: 'nested stack', position: { x: 6, y: -16 }, ownerId: 'nested-stack' },
1509
+ { id: 'label-stack-a', content: 'stack-a', position: { x: 6, y: -14 }, ownerId: 'stack-a' },
1510
+ { id: 'label-stack-b', content: 'stack-b', position: { x: 6, y: -14 }, ownerId: 'stack-b' },
1511
+ { id: 'label-stack-overflow', content: 'stack-overflow', position: { x: 6, y: -14 }, ownerId: 'stack-overflow' },
1512
+ { id: 'label-nested-peer', content: 'nested-peer', position: { x: 6, y: -14 }, ownerId: 'nested-peer' },
1513
+ {
1514
+ id: 'label-layout-grid-deep',
1515
+ content: 'Outer grid: all direct children snap',
1516
+ position: { x: 8, y: 6 },
1517
+ ownerId: 'layout-grid-deep',
1518
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1519
+ },
1520
+ { id: 'label-deep-grid-leaf-left', content: 'leaf resize/reorder', position: { x: 6, y: -16 }, ownerId: 'deep-grid-leaf-left' },
1521
+ { id: 'label-deep-grid-nested-parent', content: 'nested grid 12-unit child', position: { x: 6, y: -16 }, ownerId: 'deep-grid-nested-parent' },
1522
+ { id: 'label-deep-grid-leaf-right', content: 'leaf resize/reorder', position: { x: 6, y: -16 }, ownerId: 'deep-grid-leaf-right' },
1523
+ { id: 'label-deep-grid-a', content: 'grid-a', position: { x: 6, y: -14 }, ownerId: 'deep-grid-a' },
1524
+ { id: 'label-deep-grid-b', content: 'grid-b', position: { x: 6, y: -14 }, ownerId: 'deep-grid-b' },
1525
+ { id: 'label-deep-grid-c', content: 'grid-c', position: { x: 6, y: -14 }, ownerId: 'deep-grid-c' },
1526
+ { id: 'label-deep-grid-d', content: 'grid-d', position: { x: 6, y: -14 }, ownerId: 'deep-grid-d' },
1527
+ {
1528
+ id: 'label-layout-lock-compare',
1529
+ content: 'Child drag lock comparison',
1530
+ position: { x: 8, y: 6 },
1531
+ ownerId: 'layout-lock-compare',
1532
+ layout: { boundsMode: 'owner-width', wrap: 'word', overflow: 'clip', padding: 0 },
1533
+ },
1534
+ {
1535
+ id: 'label-deep-lock-parent',
1536
+ content: lockComparisonChildren ? 'parent lock: on' : 'parent lock: off',
1537
+ position: { x: 6, y: -16 },
1538
+ ownerId: 'deep-lock-parent',
1539
+ },
1540
+ {
1541
+ id: 'label-deep-lock-child-a',
1542
+ content: lockComparisonChildren ? 'drag target (locked)' : 'drag target (unlocked)',
1543
+ position: { x: 4, y: -14 },
1544
+ ownerId: 'deep-lock-child-a',
1545
+ },
1546
+ { id: 'label-deep-lock-child-b', content: 'api move still works', position: { x: 4, y: -14 }, ownerId: 'deep-lock-child-b' },
1547
+ { id: 'label-deep-free-parent', content: 'movable reference', position: { x: 6, y: -16 }, ownerId: 'deep-free-parent' },
1548
+ { id: 'label-deep-free-child-a', content: 'drag target', position: { x: 4, y: -14 }, ownerId: 'deep-free-child-a' },
1549
+ { id: 'label-deep-free-child-b', content: 'free sibling', position: { x: 4, y: -14 }, ownerId: 'deep-free-child-b' },
1550
+ { id: 'label-layout-manual', content: 'Manual (no layout)', position: { x: 6, y: -18 }, ownerId: 'layout-manual' },
1551
+ { id: 'label-manual-a', content: 'manual-a', position: { x: 6, y: -14 }, ownerId: 'manual-a' },
1552
+ { id: 'label-manual-b', content: 'manual-b', position: { x: 6, y: -14 }, ownerId: 'manual-b' },
1553
+ ],
1554
+ });
1555
+ };
1383
1556
  var autoLayoutDemoConfig = ({
1384
1557
  id: 'auto-layout',
1385
1558
  title: 'Element Auto-Layout + Label Lane',
@@ -4211,6 +4384,7 @@ var ElementModel = /** @class */ (function () {
4211
4384
  this.moveMode = data.moveMode;
4212
4385
  this.anchorCenter = data.anchorCenter;
4213
4386
  this.layout = data.layout;
4387
+ this.childElementInteraction = data.childElementInteraction;
4214
4388
  this.portMovement = data.portMovement;
4215
4389
  }
4216
4390
  ElementModel.prototype.setPosition = function (position) {
@@ -4248,6 +4422,7 @@ var ElementModel = /** @class */ (function () {
4248
4422
  moveMode: this.moveMode,
4249
4423
  anchorCenter: this.anchorCenter,
4250
4424
  layout: this.layout,
4425
+ childElementInteraction: this.childElementInteraction,
4251
4426
  portMovement: this.portMovement,
4252
4427
  };
4253
4428
  };
@@ -8080,9 +8255,7 @@ var DiagramEngine = /** @class */ (function () {
8080
8255
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8081
8256
  if (!parentId)
8082
8257
  return false;
8083
- if (this.model.getChildren(element.id).length > 0)
8084
- return false;
8085
- if (element.layout && element.layout.mode !== 'manual')
8258
+ if (!this.isLeafGridChildResizeCandidate(element))
8086
8259
  return false;
8087
8260
  var parent = this.model.getElement(parentId);
8088
8261
  if (((_b = parent === null || parent === void 0 ? void 0 : parent.layout) === null || _b === void 0 ? void 0 : _b.mode) !== 'grid')
@@ -8090,16 +8263,7 @@ var DiagramEngine = /** @class */ (function () {
8090
8263
  return !Boolean(parent.layout.gridChildWidthResizeEnabled);
8091
8264
  };
8092
8265
  DiagramEngine.prototype.shouldAnchorAutoLayoutGridChildWidthToLeft = function (element) {
8093
- var _a, _b;
8094
- var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8095
- if (!parentId)
8096
- return false;
8097
- if (this.model.getChildren(element.id).length > 0)
8098
- return false;
8099
- if (element.layout && element.layout.mode !== 'manual')
8100
- return false;
8101
- var parent = this.model.getElement(parentId);
8102
- return Boolean(((_b = parent === null || parent === void 0 ? void 0 : parent.layout) === null || _b === void 0 ? void 0 : _b.mode) === 'grid' && parent.layout.gridChildWidthResizeEnabled);
8266
+ return this.isEnabledGridChildWidthResizeCandidate(element);
8103
8267
  };
8104
8268
  DiagramEngine.prototype.shouldRestrictAutoLayoutChildRightGrowth = function (element, handle, requestedWidth) {
8105
8269
  return false;
@@ -8109,41 +8273,55 @@ var DiagramEngine = /** @class */ (function () {
8109
8273
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8110
8274
  if (!parentId)
8111
8275
  return requestedWidth;
8112
- if (this.model.getChildren(element.id).length > 0)
8113
- return requestedWidth;
8114
- if (element.layout && element.layout.mode !== 'manual')
8115
- return requestedWidth;
8116
- var parent = this.model.getElement(parentId);
8117
- if (!(parent === null || parent === void 0 ? void 0 : parent.layout) || parent.layout.mode !== 'grid' || !parent.layout.gridChildWidthResizeEnabled)
8276
+ if (!this.isEnabledGridChildWidthResizeCandidate(element))
8118
8277
  return requestedWidth;
8119
8278
  return this.autoLayoutService.snapGridChildRequestedWidth(parentId, element.id, requestedWidth);
8120
8279
  };
8121
8280
  DiagramEngine.prototype.resolveGridChildWidthResizeTopologyChange = function (element, requestedWidth) {
8122
- var _a, _b, _c;
8281
+ var _a, _b;
8123
8282
  var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8124
8283
  if (!parentId)
8125
8284
  return null;
8126
- if (this.model.getChildren(element.id).length > 0)
8127
- return null;
8128
- if (element.layout && element.layout.mode !== 'manual')
8285
+ if (!this.isEnabledGridChildWidthResizeCandidate(element))
8129
8286
  return null;
8130
8287
  var parent = this.model.getElement(parentId);
8131
- if (!parent || ((_b = parent.layout) === null || _b === void 0 ? void 0 : _b.mode) !== 'grid' || !parent.layout.gridChildWidthResizeEnabled)
8288
+ if (!parent)
8132
8289
  return null;
8133
8290
  var topologyChange = this.autoLayoutService.resolveGridChildResizeTopologyChange(parentId, element.id, requestedWidth);
8134
8291
  if (!topologyChange)
8135
8292
  return null;
8293
+ var parentLayout = parent.layout;
8294
+ if (!parentLayout)
8295
+ return null;
8136
8296
  return {
8137
8297
  parentId: topologyChange.parentId,
8138
8298
  triggerChildId: topologyChange.triggerChildId,
8139
8299
  reason: topologyChange.reason,
8140
8300
  beforeRows: topologyChange.beforeRows,
8141
8301
  afterRows: topologyChange.afterRows,
8142
- beforeGridTemplate: parent.layout.gridTemplate ? __spreadArray([], parent.layout.gridTemplate, true) : undefined,
8143
- afterGridTemplate: __spreadArray([], ((_c = topologyChange.nextLayout.gridTemplate) !== null && _c !== void 0 ? _c : []), true),
8302
+ beforeGridTemplate: parentLayout.gridTemplate ? __spreadArray([], parentLayout.gridTemplate, true) : undefined,
8303
+ afterGridTemplate: __spreadArray([], ((_b = topologyChange.nextLayout.gridTemplate) !== null && _b !== void 0 ? _b : []), true),
8144
8304
  afterLayout: topologyChange.nextLayout,
8145
8305
  };
8146
8306
  };
8307
+ DiagramEngine.prototype.isLeafGridChildResizeCandidate = function (element) {
8308
+ if (this.model.getChildren(element.id).length > 0)
8309
+ return false;
8310
+ if (element.layout && element.layout.mode !== 'manual')
8311
+ return false;
8312
+ return true;
8313
+ };
8314
+ DiagramEngine.prototype.isEnabledGridChildWidthResizeCandidate = function (element) {
8315
+ var _a;
8316
+ var parentId = (_a = element.parentId) !== null && _a !== void 0 ? _a : null;
8317
+ if (!parentId)
8318
+ return false;
8319
+ var parent = this.model.getElement(parentId);
8320
+ var layout = parent === null || parent === void 0 ? void 0 : parent.layout;
8321
+ if (!layout || layout.mode !== 'grid')
8322
+ return false;
8323
+ return Boolean(layout.gridChildWidthResizeEnabled);
8324
+ };
8147
8325
  DiagramEngine.prototype.getPortWorldPosition = function (id) {
8148
8326
  return this.model.getPortWorldPosition(id);
8149
8327
  };
@@ -10004,7 +10182,7 @@ var ellipseMidPointToIndex = function (value) {
10004
10182
  var KonvaInteraction = /** @class */ (function () {
10005
10183
  function KonvaInteraction(engine, config) {
10006
10184
  if (config === void 0) { config = {}; }
10007
- var _a, _b;
10185
+ var _a;
10008
10186
  this.linkDragContext = null;
10009
10187
  this.programmaticLinkSession = null;
10010
10188
  this.bound = false;
@@ -10028,7 +10206,6 @@ var KonvaInteraction = /** @class */ (function () {
10028
10206
  this.stage = config.stage;
10029
10207
  this.hitTester = (_a = config.hitTester) !== null && _a !== void 0 ? _a : new KonvaHitTester();
10030
10208
  this.renderer = config.renderer;
10031
- this.panKey = (_b = config.panKey) !== null && _b !== void 0 ? _b : 'Control';
10032
10209
  this.shapeRegistry = config.shapeRegistry;
10033
10210
  this.shapeHoverControls = this.normalizeShapeHoverControls(config.shapeHoverControls);
10034
10211
  this.onShapeHoverControlInteracted = config.onShapeHoverControlInteracted;
@@ -10196,7 +10373,10 @@ var KonvaInteraction = /** @class */ (function () {
10196
10373
  var hit = _this.resolveHit(point);
10197
10374
  var nativeEvent = event === null || event === void 0 ? void 0 : event.evt;
10198
10375
  var isMulti = Boolean(nativeEvent && (nativeEvent.ctrlKey || nativeEvent.metaKey || nativeEvent.shiftKey));
10199
- var isPanGesture = Boolean(nativeEvent && _this.isPanKeyPressed(nativeEvent) && nativeEvent.button === 0);
10376
+ var isPrimaryButton = !nativeEvent || nativeEvent.button === 0;
10377
+ var isEmptyPaper = !hit || hit.type === 'none';
10378
+ var isMarqueeGesture = Boolean(isPrimaryButton && isEmptyPaper && (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey));
10379
+ var isPanGesture = Boolean(isPrimaryButton && isEmptyPaper && !(nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey));
10200
10380
  var pointerInfo = _this.buildPointerInfo(point, nativeEvent);
10201
10381
  if ((hit === null || hit === void 0 ? void 0 : hit.type) === 'shape-hover-control') {
10202
10382
  var resolvedControl = _this.resolveShapeHoverControlFromHit(hit.id, point);
@@ -10254,11 +10434,14 @@ var KonvaInteraction = /** @class */ (function () {
10254
10434
  }
10255
10435
  return;
10256
10436
  }
10257
- if (!hit || hit.type === 'none') {
10437
+ if (isMarqueeGesture) {
10258
10438
  _this.dragState = { mode: 'marquee', start: point, isMulti: isMulti, hasMoved: false };
10259
10439
  (_d = _this.renderer) === null || _d === void 0 ? void 0 : _d.renderMarquee({ x: point.x, y: point.y, width: 0, height: 0 });
10260
10440
  return;
10261
10441
  }
10442
+ if (isEmptyPaper) {
10443
+ return;
10444
+ }
10262
10445
  if (hit.type === 'port') {
10263
10446
  var elementId = _this.engine.getPortElementId(hit.id);
10264
10447
  if (!elementId)
@@ -10323,6 +10506,7 @@ var KonvaInteraction = /** @class */ (function () {
10323
10506
  var element = _this.getElementById(hit.id);
10324
10507
  if (!element)
10325
10508
  return;
10509
+ var movable = _this.isElementMovable(hit.id);
10326
10510
  var anchor = element.anchorCenter ? 'center' : 'top-left';
10327
10511
  var base = element.anchorCenter
10328
10512
  ? {
@@ -10337,12 +10521,13 @@ var KonvaInteraction = /** @class */ (function () {
10337
10521
  offset: { x: point.x - base.x, y: point.y - base.y },
10338
10522
  start: __assign({}, base),
10339
10523
  anchor: anchor,
10524
+ movable: movable,
10340
10525
  startParentId: (_e = element.parentId) !== null && _e !== void 0 ? _e : null,
10341
10526
  selectionIds: _this.engine.getSelection(),
10342
10527
  isMulti: isMulti,
10343
10528
  hasMoved: false,
10344
10529
  };
10345
- _this.setCursor('grabbing');
10530
+ _this.setCursor(movable ? 'grabbing' : 'pointer');
10346
10531
  }
10347
10532
  }
10348
10533
  };
@@ -10400,6 +10585,9 @@ var KonvaInteraction = /** @class */ (function () {
10400
10585
  var dy = target.y - _this.dragState.start.y;
10401
10586
  var moved = Math.hypot(dx, dy) >= _this.dragThreshold;
10402
10587
  _this.dragState.hasMoved = _this.dragState.hasMoved || moved;
10588
+ if (!_this.dragState.movable) {
10589
+ return;
10590
+ }
10403
10591
  _this.engine.moveElementTo(_this.dragState.id, target.x, target.y);
10404
10592
  if (_this.renderer && _this.engine.getSelection().includes(_this.dragState.id)) {
10405
10593
  var element = _this.getElementById(_this.dragState.id);
@@ -10525,15 +10713,15 @@ var KonvaInteraction = /** @class */ (function () {
10525
10713
  var dx = point.x - _this.dragState.start.x;
10526
10714
  var dy = point.y - _this.dragState.start.y;
10527
10715
  _this.pan = {
10528
- x: _this.dragState.origin.x - dx * _this.panSpeed,
10529
- y: _this.dragState.origin.y - dy * _this.panSpeed,
10716
+ x: _this.dragState.origin.x + dx * _this.panSpeed,
10717
+ y: _this.dragState.origin.y + dy * _this.panSpeed,
10530
10718
  };
10531
10719
  _this.applyStageTransform();
10532
10720
  _this.engine.setViewport(_this.pan, _this.zoom);
10533
10721
  }
10534
10722
  };
10535
10723
  var pointerUp = function () {
10536
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10724
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
10537
10725
  var args = [];
10538
10726
  for (var _i = 0; _i < arguments.length; _i++) {
10539
10727
  args[_i] = arguments[_i];
@@ -10627,10 +10815,21 @@ var KonvaInteraction = /** @class */ (function () {
10627
10815
  _this.engine.emitPaperClick(pointerInfo);
10628
10816
  }
10629
10817
  }
10630
- if (((_h = _this.dragState) === null || _h === void 0 ? void 0 : _h.mode) === 'move' && _this.dragState.type === 'element') {
10818
+ if (((_h = _this.dragState) === null || _h === void 0 ? void 0 : _h.mode) === 'pan') {
10819
+ var point = pointerPoint !== null && pointerPoint !== void 0 ? pointerPoint : _this.dragState.start;
10820
+ var dx = point.x - _this.dragState.start.x;
10821
+ var dy = point.y - _this.dragState.start.y;
10822
+ var moved = Math.hypot(dx, dy) >= _this.dragThreshold;
10823
+ if (!moved) {
10824
+ _this.engine.setSelection([]);
10825
+ var pointerInfo = _this.buildPointerInfo(point, nativeEvent);
10826
+ _this.engine.emitPaperClick(pointerInfo);
10827
+ }
10828
+ }
10829
+ if (((_j = _this.dragState) === null || _j === void 0 ? void 0 : _j.mode) === 'move' && _this.dragState.type === 'element') {
10631
10830
  var element = _this.getElementById(_this.dragState.id);
10632
10831
  if (element) {
10633
- var endTopLeft = (_j = _this.engine.getElementWorldPosition(_this.dragState.id)) !== null && _j !== void 0 ? _j : element.position;
10832
+ var endTopLeft = (_k = _this.engine.getElementWorldPosition(_this.dragState.id)) !== null && _k !== void 0 ? _k : element.position;
10634
10833
  var endWorld = _this.dragState.anchor === 'center'
10635
10834
  ? {
10636
10835
  x: endTopLeft.x + element.size.width / 2,
@@ -10641,7 +10840,8 @@ var KonvaInteraction = /** @class */ (function () {
10641
10840
  x: endWorld.x - _this.dragState.start.x,
10642
10841
  y: endWorld.y - _this.dragState.start.y,
10643
10842
  };
10644
- var moved = _this.dragState.hasMoved || Math.hypot(delta.x, delta.y) > 0;
10843
+ var moved = _this.dragState.movable &&
10844
+ (_this.dragState.hasMoved || Math.hypot(delta.x, delta.y) > 0);
10645
10845
  if (moved) {
10646
10846
  _this.engine.emitElementDrop({
10647
10847
  elementId: _this.dragState.id,
@@ -10653,16 +10853,16 @@ var KonvaInteraction = /** @class */ (function () {
10653
10853
  anchor: _this.dragState.anchor,
10654
10854
  });
10655
10855
  }
10656
- else {
10856
+ else if (!_this.dragState.hasMoved) {
10657
10857
  var pointerInfo = _this.buildPointerInfo(pointerPoint !== null && pointerPoint !== void 0 ? pointerPoint : _this.dragState.start, nativeEvent);
10658
10858
  _this.engine.emitElementClick(_this.dragState.id, pointerInfo, _this.dragState.isMulti);
10659
10859
  }
10660
10860
  }
10661
10861
  }
10662
- if (((_k = _this.dragState) === null || _k === void 0 ? void 0 : _k.mode) === 'move' && _this.dragState.type === 'port') {
10862
+ if (((_l = _this.dragState) === null || _l === void 0 ? void 0 : _l.mode) === 'move' && _this.dragState.type === 'port') {
10663
10863
  var elementId = _this.engine.getPortElementId(_this.dragState.id);
10664
10864
  if (elementId) {
10665
- 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);
10865
+ 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);
10666
10866
  _this.engine.emitPortMouseUp({ portId: _this.dragState.id, elementId: elementId, pointer: pointerInfo });
10667
10867
  }
10668
10868
  }
@@ -10968,6 +11168,10 @@ var KonvaInteraction = /** @class */ (function () {
10968
11168
  this.setCursor('pointer');
10969
11169
  return;
10970
11170
  }
11171
+ if (hit.type === 'element' && !this.isElementMovable(hit.id)) {
11172
+ this.setCursor('pointer');
11173
+ return;
11174
+ }
10971
11175
  this.setCursor('grab');
10972
11176
  };
10973
11177
  KonvaInteraction.prototype.normalizeShapeHoverControls = function (controls) {
@@ -12193,6 +12397,14 @@ var KonvaInteraction = /** @class */ (function () {
12193
12397
  var _a, _b;
12194
12398
  return ((_b = (_a = this.getTextById(id)) === null || _a === void 0 ? void 0 : _a.interaction) === null || _b === void 0 ? void 0 : _b.movable) !== false;
12195
12399
  };
12400
+ KonvaInteraction.prototype.isElementMovable = function (id) {
12401
+ var _a;
12402
+ var element = this.getElementById(id);
12403
+ if (!(element === null || element === void 0 ? void 0 : element.parentId))
12404
+ return true;
12405
+ var parent = this.getElementById(element.parentId);
12406
+ return ((_a = parent === null || parent === void 0 ? void 0 : parent.childElementInteraction) === null || _a === void 0 ? void 0 : _a.movable) !== false;
12407
+ };
12196
12408
  KonvaInteraction.prototype.isTextEditable = function (id) {
12197
12409
  var _a, _b;
12198
12410
  return ((_b = (_a = this.getTextById(id)) === null || _a === void 0 ? void 0 : _a.interaction) === null || _b === void 0 ? void 0 : _b.editable) !== false;
@@ -12311,19 +12523,6 @@ var KonvaInteraction = /** @class */ (function () {
12311
12523
  var tag = target.tagName.toLowerCase();
12312
12524
  return tag === 'input' || tag === 'textarea' || tag === 'select';
12313
12525
  };
12314
- KonvaInteraction.prototype.isPanKeyPressed = function (event) {
12315
- switch (this.panKey) {
12316
- case 'Shift':
12317
- return event.shiftKey;
12318
- case 'Alt':
12319
- return event.altKey;
12320
- case 'Meta':
12321
- return event.metaKey;
12322
- case 'Control':
12323
- default:
12324
- return event.ctrlKey;
12325
- }
12326
- };
12327
12526
  return KonvaInteraction;
12328
12527
  }());
12329
12528
 
@@ -13692,11 +13891,16 @@ var parentOptions = [
13692
13891
  { id: 'layout-column', label: 'Vertical layout' },
13693
13892
  { id: 'layout-grid', label: 'Grid layout' },
13694
13893
  { id: 'layout-nested', label: 'Nested layout' },
13894
+ { id: 'layout-grid-deep', label: 'Nested grid' },
13895
+ { id: 'layout-lock-compare', label: 'Child lock compare' },
13695
13896
  { id: 'layout-manual', label: 'Manual (compare)' },
13696
13897
  ];
13697
13898
  var shortLabel = 'Parent label lane demo';
13698
13899
  var longLabel = 'Parent label lane demo with longer content to increase flexible reserved space and push children downward.';
13699
13900
  var defaultGridTemplateText = '[12,4,8]';
13901
+ var lockComparisonContainerId = 'layout-lock-compare';
13902
+ var lockParentId = 'deep-lock-parent';
13903
+ var lockTargetId = 'deep-lock-child-a';
13700
13904
  var serializeGridTemplate = function (template) {
13701
13905
  return Array.isArray(template) && template.length > 0 ? JSON.stringify(template) : defaultGridTemplateText;
13702
13906
  };
@@ -13735,11 +13939,13 @@ var parseGridTemplate = function (value) {
13735
13939
  };
13736
13940
  var AutoLayoutDemo = function () {
13737
13941
  var demo = autoLayoutDemoConfig;
13738
- var _a = useDemoEditor({
13739
- createState: demo.createState,
13942
+ var _a = useState(true), lockComparisonChildren = _a[0], setLockComparisonChildren = _a[1];
13943
+ var createState = useCallback(function () { return createAutoLayoutState(lockComparisonChildren); }, [lockComparisonChildren]);
13944
+ var _b = useDemoEditor({
13945
+ createState: createState,
13740
13946
  elementShapes: demo.elementShapes,
13741
13947
  portShapes: demo.portShapes,
13742
- }), containerRef = _a.containerRef, editorRef = _a.editorRef, diagramState = _a.diagramState, selection = _a.selection, snapEnabled = _a.snapEnabled, setSnapEnabled = _a.setSnapEnabled;
13948
+ }), containerRef = _b.containerRef, editorRef = _b.editorRef, diagramState = _b.diagramState, selection = _b.selection, snapEnabled = _b.snapEnabled, setSnapEnabled = _b.setSnapEnabled;
13743
13949
  var nextOffset = useOffsetSequence();
13744
13950
  var actionHelpers = useMemo(function () { return ({ nextOffset: nextOffset }); }, [nextOffset]);
13745
13951
  var controls = useDemoControls({
@@ -13751,25 +13957,25 @@ var AutoLayoutDemo = function () {
13751
13957
  setSnapEnabled: setSnapEnabled,
13752
13958
  actionHelpers: actionHelpers,
13753
13959
  });
13754
- var _b = useState(parentOptions[0].id), targetId = _b[0], setTargetId = _b[1];
13755
- var _c = useState('horizontal'), mode = _c[0], setMode = _c[1];
13756
- var _d = useState('center'), align = _d[0], setAlign = _d[1];
13757
- var _e = useState('grow'), autoResize = _e[0], setAutoResize = _e[1];
13758
- var _f = useState(12), padding = _f[0], setPadding = _f[1];
13759
- var _g = useState(12), gap = _g[0], setGap = _g[1];
13760
- var _h = useState('none'), childFitMainAxis = _h[0], setChildFitMainAxis = _h[1];
13761
- var _j = useState('none'), childFitCrossAxis = _j[0], setChildFitCrossAxis = _j[1];
13762
- var _k = useState(''), childMinWidth = _k[0], setChildMinWidth = _k[1];
13763
- var _l = useState(''), childMinHeight = _l[0], setChildMinHeight = _l[1];
13764
- var _m = useState(''), childMaxWidth = _m[0], setChildMaxWidth = _m[1];
13765
- var _o = useState(''), childMaxHeight = _o[0], setChildMaxHeight = _o[1];
13766
- var _p = useState(defaultGridTemplateText), gridTemplateText = _p[0], setGridTemplateText = _p[1];
13767
- var _q = useState(false), gridChildWidthResizeEnabled = _q[0], setGridChildWidthResizeEnabled = _q[1];
13768
- var _r = useState('none'), labelReservedMode = _r[0], setLabelReservedMode = _r[1];
13769
- var _s = useState(32), labelReservedFixedSize = _s[0], setLabelReservedFixedSize = _s[1];
13770
- var _t = useState(''), labelReservedMinSize = _t[0], setLabelReservedMinSize = _t[1];
13771
- var _u = useState(''), labelReservedMaxSize = _u[0], setLabelReservedMaxSize = _u[1];
13772
- var _v = useState('None yet'), lastTrigger = _v[0], setLastTrigger = _v[1];
13960
+ var _c = useState(parentOptions[0].id), targetId = _c[0], setTargetId = _c[1];
13961
+ var _d = useState('horizontal'), mode = _d[0], setMode = _d[1];
13962
+ var _e = useState('center'), align = _e[0], setAlign = _e[1];
13963
+ var _f = useState('grow'), autoResize = _f[0], setAutoResize = _f[1];
13964
+ var _g = useState(12), padding = _g[0], setPadding = _g[1];
13965
+ var _h = useState(12), gap = _h[0], setGap = _h[1];
13966
+ var _j = useState('none'), childFitMainAxis = _j[0], setChildFitMainAxis = _j[1];
13967
+ var _k = useState('none'), childFitCrossAxis = _k[0], setChildFitCrossAxis = _k[1];
13968
+ var _l = useState(''), childMinWidth = _l[0], setChildMinWidth = _l[1];
13969
+ var _m = useState(''), childMinHeight = _m[0], setChildMinHeight = _m[1];
13970
+ var _o = useState(''), childMaxWidth = _o[0], setChildMaxWidth = _o[1];
13971
+ var _p = useState(''), childMaxHeight = _p[0], setChildMaxHeight = _p[1];
13972
+ var _q = useState(defaultGridTemplateText), gridTemplateText = _q[0], setGridTemplateText = _q[1];
13973
+ var _r = useState(false), gridChildWidthResizeEnabled = _r[0], setGridChildWidthResizeEnabled = _r[1];
13974
+ var _s = useState('none'), labelReservedMode = _s[0], setLabelReservedMode = _s[1];
13975
+ var _t = useState(32), labelReservedFixedSize = _t[0], setLabelReservedFixedSize = _t[1];
13976
+ var _u = useState(''), labelReservedMinSize = _u[0], setLabelReservedMinSize = _u[1];
13977
+ var _v = useState(''), labelReservedMaxSize = _v[0], setLabelReservedMaxSize = _v[1];
13978
+ var _w = useState('None yet'), lastTrigger = _w[0], setLastTrigger = _w[1];
13773
13979
  useEffect(function () {
13774
13980
  var editor = editorRef.current;
13775
13981
  if (!editor)
@@ -13803,6 +14009,36 @@ var AutoLayoutDemo = function () {
13803
14009
  }
13804
14010
  }, [diagramState, targetId]);
13805
14011
  var targetElement = useMemo(function () { return diagramState === null || diagramState === void 0 ? void 0 : diagramState.elements.find(function (el) { return el.id === targetId; }); }, [diagramState, targetId]);
14012
+ var resolveElementWorldPosition = useCallback(function (elementId) {
14013
+ if (!diagramState)
14014
+ return null;
14015
+ var byId = new Map(diagramState.elements.map(function (element) { return [element.id, element]; }));
14016
+ var current = byId.get(elementId);
14017
+ if (!current)
14018
+ return null;
14019
+ var x = 0;
14020
+ var y = 0;
14021
+ while (current) {
14022
+ x += current.position.x;
14023
+ y += current.position.y;
14024
+ current = current.parentId ? byId.get(current.parentId) : undefined;
14025
+ }
14026
+ return { x: x, y: y };
14027
+ }, [diagramState]);
14028
+ var lockDemoContext = useMemo(function () {
14029
+ var _a;
14030
+ if (!diagramState)
14031
+ return null;
14032
+ var outer = diagramState.elements.find(function (el) { return el.id === lockComparisonContainerId; });
14033
+ var parent = diagramState.elements.find(function (el) { return el.id === lockParentId; });
14034
+ if (!outer || !parent)
14035
+ return null;
14036
+ return {
14037
+ outer: outer,
14038
+ parent: parent,
14039
+ isLocked: ((_a = parent.childElementInteraction) === null || _a === void 0 ? void 0 : _a.movable) === false,
14040
+ };
14041
+ }, [diagramState]);
13806
14042
  var targetOptions = useMemo(function () {
13807
14043
  var seen = new Set();
13808
14044
  var options = [];
@@ -13949,21 +14185,29 @@ var AutoLayoutDemo = function () {
13949
14185
  setLastTrigger('child removed');
13950
14186
  }
13951
14187
  };
13952
- var handleFocusResizeLockChild = function () {
14188
+ var handleFocusLockTarget = function () {
13953
14189
  var editor = editorRef.current;
13954
14190
  if (!editor)
13955
14191
  return;
13956
- setTargetId('layout-grid');
13957
- editor.setSelection(['grid-b']);
13958
- setLastTrigger('focus resize-lock child');
14192
+ setTargetId(lockParentId);
14193
+ editor.setSelection([lockTargetId]);
14194
+ setLastTrigger(lockComparisonChildren ? 'focus locked child' : 'focus unlocked comparison child');
13959
14195
  };
13960
- var handleFocusResizeLockParent = function () {
14196
+ var handleFocusLockParent = function () {
13961
14197
  var editor = editorRef.current;
13962
14198
  if (!editor)
13963
14199
  return;
13964
- setTargetId('layout-grid');
13965
- editor.setSelection(['layout-grid']);
13966
- setLastTrigger('focus resize-lock parent');
14200
+ setTargetId(lockParentId);
14201
+ editor.setSelection([lockParentId]);
14202
+ setLastTrigger('focus lock parent');
14203
+ };
14204
+ var handleMoveLockTargetViaApi = function () {
14205
+ var editor = editorRef.current;
14206
+ var parentWorld = resolveElementWorldPosition(lockParentId);
14207
+ if (!editor || !lockDemoContext || !parentWorld)
14208
+ return;
14209
+ editor.moveElementTo(lockTargetId, parentWorld.x + 56, parentWorld.y + 18);
14210
+ setLastTrigger(lockDemoContext.isLocked ? 'locked child moved by api' : 'comparison child moved by api');
13967
14211
  };
13968
14212
  var alignmentLabel = mode === 'horizontal'
13969
14213
  ? 'Vertical align (top/center/bottom)'
@@ -13974,10 +14218,17 @@ var AutoLayoutDemo = function () {
13974
14218
  React.createElement("div", { style: { marginBottom: 12 } },
13975
14219
  React.createElement("h2", { style: { marginTop: 0, marginBottom: 4 } }, demo.title),
13976
14220
  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."),
14221
+ 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."),
13977
14222
  React.createElement("p", { style: { marginTop: 0, marginBottom: 0, fontSize: 13, color: '#333' } },
13978
- "Grid child width resize is disabled by default. With the capability off, select ",
13979
- React.createElement("code", null, "grid-b"),
13980
- " 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.")),
14223
+ "The ",
14224
+ React.createElement("code", null, "layout-grid-deep"),
14225
+ " 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 ",
14226
+ React.createElement("code", null, " layout-lock-compare"),
14227
+ "; toggle the lock, try dragging",
14228
+ React.createElement("code", null, " deep-lock-child-a"),
14229
+ " versus ",
14230
+ React.createElement("code", null, " deep-free-child-a"),
14231
+ ", then use the API move shortcut to confirm the policy suppresses built-in drag without freezing geometry.")),
13981
14232
  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 }),
13982
14233
  React.createElement("div", { style: { display: 'grid', gap: 12, marginBottom: 12 } },
13983
14234
  React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center' } },
@@ -14030,6 +14281,14 @@ var AutoLayoutDemo = function () {
14030
14281
  React.createElement("label", { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
14031
14282
  React.createElement("input", { id: "grid-child-width-resize-enabled", type: "checkbox", checked: gridChildWidthResizeEnabled, onChange: function (event) { return setGridChildWidthResizeEnabled(event.target.checked); }, disabled: mode !== 'grid' }),
14032
14283
  "Enable 12-unit resize on child width drag"),
14284
+ React.createElement("label", { htmlFor: "lock-comparison-child-drag", style: { fontWeight: 600 } }, "Lock comparison child drag"),
14285
+ React.createElement("label", { style: { display: 'inline-flex', alignItems: 'center', gap: 6 } },
14286
+ React.createElement("input", { id: "lock-comparison-child-drag", type: "checkbox", checked: lockComparisonChildren, onChange: function (event) {
14287
+ setLockComparisonChildren(event.target.checked);
14288
+ setTargetId(lockComparisonContainerId);
14289
+ setLastTrigger(event.target.checked ? 'comparison child drag locked' : 'comparison child drag unlocked');
14290
+ } }),
14291
+ "Reload parent-owned lock demo"),
14033
14292
  React.createElement("label", { htmlFor: "label-reserved-mode-select", style: { fontWeight: 600 } }, "Label lane"),
14034
14293
  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' },
14035
14294
  React.createElement("option", { value: "none" }, "None"),
@@ -14060,8 +14319,9 @@ var AutoLayoutDemo = function () {
14060
14319
  React.createElement("strong", null, lastTrigger)),
14061
14320
  React.createElement("button", { type: "button", onClick: function () { return handleSetLabelContent(shortLabel); }, style: { padding: '6px 10px' }, disabled: !targetElement || mode === 'manual' }, "Label short"),
14062
14321
  React.createElement("button", { type: "button", onClick: function () { return handleSetLabelContent(longLabel); }, style: { padding: '6px 10px' }, disabled: !targetElement || mode === 'manual' }, "Label long"),
14063
- React.createElement("button", { type: "button", onClick: handleFocusResizeLockChild, style: { padding: '6px 10px' } }, "Focus lock child"),
14064
- React.createElement("button", { type: "button", onClick: handleFocusResizeLockParent, style: { padding: '6px 10px' } }, "Focus lock parent")),
14322
+ React.createElement("button", { type: "button", onClick: handleFocusLockTarget, style: { padding: '6px 10px' } }, "Focus lock target"),
14323
+ React.createElement("button", { type: "button", onClick: handleFocusLockParent, style: { padding: '6px 10px' } }, "Focus lock parent"),
14324
+ React.createElement("button", { type: "button", onClick: handleMoveLockTargetViaApi, style: { padding: '6px 10px' } }, "Move lock target via API")),
14065
14325
  React.createElement("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 } },
14066
14326
  React.createElement("div", null,
14067
14327
  React.createElement("div", { style: { fontWeight: 600, marginBottom: 6 } }, "Child order (axis or grid row-major)"),
@@ -14082,6 +14342,10 @@ var AutoLayoutDemo = function () {
14082
14342
  React.createElement("div", null,
14083
14343
  React.createElement("div", { style: { fontWeight: 600, marginBottom: 6 } }, "Scenario tips"),
14084
14344
  React.createElement("ul", { style: { marginTop: 0, paddingLeft: 18, fontSize: 13 } },
14345
+ 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."),
14346
+ 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."),
14347
+ 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."),
14348
+ 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."),
14085
14349
  React.createElement("li", null, "Resize lock: with grid child width resize off, select grid-b and drag diagonally; width should stay fixed."),
14086
14350
  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."),
14087
14351
  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."),