@uipath/apollo-react 7.30.1 → 7.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  2. package/dist/chat/styles/tailwind.chat.css +1 -1
  3. package/dist/decision-table/DecisionGraphCard.cjs +112 -9
  4. package/dist/decision-table/DecisionGraphCard.d.ts +21 -0
  5. package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
  6. package/dist/decision-table/DecisionGraphCard.js +115 -12
  7. package/dist/decision-table/DecisionGraphDialogs.cjs +223 -0
  8. package/dist/decision-table/DecisionGraphDialogs.d.ts +30 -0
  9. package/dist/decision-table/DecisionGraphDialogs.d.ts.map +1 -0
  10. package/dist/decision-table/DecisionGraphDialogs.js +183 -0
  11. package/dist/decision-table/DecisionGraphText.cjs +6 -338
  12. package/dist/decision-table/DecisionGraphText.d.ts +4 -15
  13. package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
  14. package/dist/decision-table/DecisionGraphText.js +7 -339
  15. package/dist/decision-table/DecisionGraphView.cjs +409 -0
  16. package/dist/decision-table/DecisionGraphView.d.ts +20 -0
  17. package/dist/decision-table/DecisionGraphView.d.ts.map +1 -0
  18. package/dist/decision-table/DecisionGraphView.js +375 -0
  19. package/dist/decision-table/DecisionTable.cjs +3 -1
  20. package/dist/decision-table/DecisionTable.d.ts.map +1 -1
  21. package/dist/decision-table/DecisionTable.js +3 -1
  22. package/dist/decision-table/EditableDecisionGraphText.cjs +40 -0
  23. package/dist/decision-table/EditableDecisionGraphText.d.ts +5 -0
  24. package/dist/decision-table/EditableDecisionGraphText.d.ts.map +1 -0
  25. package/dist/decision-table/EditableDecisionGraphText.js +6 -0
  26. package/dist/decision-table/GridMenu.cjs +36 -2
  27. package/dist/decision-table/GridMenu.d.ts +8 -0
  28. package/dist/decision-table/GridMenu.d.ts.map +1 -1
  29. package/dist/decision-table/GridMenu.js +33 -2
  30. package/dist/decision-table/__fixtures__/graphActionsHost.d.ts +21 -0
  31. package/dist/decision-table/__fixtures__/graphActionsHost.d.ts.map +1 -0
  32. package/dist/decision-table/constants.cjs +7 -0
  33. package/dist/decision-table/constants.d.ts +1 -0
  34. package/dist/decision-table/constants.d.ts.map +1 -1
  35. package/dist/decision-table/constants.js +5 -1
  36. package/dist/decision-table/decisionGraphActionTypes.cjs +18 -0
  37. package/dist/decision-table/decisionGraphActionTypes.d.ts +88 -0
  38. package/dist/decision-table/decisionGraphActionTypes.d.ts.map +1 -0
  39. package/dist/decision-table/decisionGraphActionTypes.js +0 -0
  40. package/dist/decision-table/decisionGraphMenuEntries.cjs +247 -0
  41. package/dist/decision-table/decisionGraphMenuEntries.d.ts +46 -0
  42. package/dist/decision-table/decisionGraphMenuEntries.d.ts.map +1 -0
  43. package/dist/decision-table/decisionGraphMenuEntries.js +186 -0
  44. package/dist/decision-table/decisionGraphPositions.cjs +136 -0
  45. package/dist/decision-table/decisionGraphPositions.d.ts +26 -0
  46. package/dist/decision-table/decisionGraphPositions.d.ts.map +1 -0
  47. package/dist/decision-table/decisionGraphPositions.js +69 -0
  48. package/dist/decision-table/decisionGraphStyles.cjs +24 -16
  49. package/dist/decision-table/decisionGraphStyles.d.ts +3 -1
  50. package/dist/decision-table/decisionGraphStyles.d.ts.map +1 -1
  51. package/dist/decision-table/decisionGraphStyles.js +4 -2
  52. package/dist/decision-table/index.cjs +62 -54
  53. package/dist/decision-table/index.d.ts +2 -0
  54. package/dist/decision-table/index.d.ts.map +1 -1
  55. package/dist/decision-table/index.js +2 -1
  56. package/dist/decision-table/locales/de.cjs +1 -1
  57. package/dist/decision-table/locales/de.d.ts.map +1 -1
  58. package/dist/decision-table/locales/de.js +1 -1
  59. package/dist/decision-table/locales/en.cjs +1 -1
  60. package/dist/decision-table/locales/en.d.ts.map +1 -1
  61. package/dist/decision-table/locales/en.js +1 -1
  62. package/dist/decision-table/locales/es-MX.cjs +1 -1
  63. package/dist/decision-table/locales/es-MX.d.ts.map +1 -1
  64. package/dist/decision-table/locales/es-MX.js +1 -1
  65. package/dist/decision-table/locales/es.cjs +1 -1
  66. package/dist/decision-table/locales/es.d.ts.map +1 -1
  67. package/dist/decision-table/locales/es.js +1 -1
  68. package/dist/decision-table/locales/fr.cjs +1 -1
  69. package/dist/decision-table/locales/fr.d.ts.map +1 -1
  70. package/dist/decision-table/locales/fr.js +1 -1
  71. package/dist/decision-table/locales/ja.cjs +1 -1
  72. package/dist/decision-table/locales/ja.d.ts.map +1 -1
  73. package/dist/decision-table/locales/ja.js +1 -1
  74. package/dist/decision-table/locales/ko.cjs +1 -1
  75. package/dist/decision-table/locales/ko.d.ts.map +1 -1
  76. package/dist/decision-table/locales/ko.js +1 -1
  77. package/dist/decision-table/locales/pt-BR.cjs +1 -1
  78. package/dist/decision-table/locales/pt-BR.d.ts.map +1 -1
  79. package/dist/decision-table/locales/pt-BR.js +1 -1
  80. package/dist/decision-table/locales/pt.cjs +1 -1
  81. package/dist/decision-table/locales/pt.d.ts.map +1 -1
  82. package/dist/decision-table/locales/pt.js +1 -1
  83. package/dist/decision-table/locales/ro.cjs +1 -1
  84. package/dist/decision-table/locales/ro.d.ts.map +1 -1
  85. package/dist/decision-table/locales/ro.js +1 -1
  86. package/dist/decision-table/locales/ru.cjs +1 -1
  87. package/dist/decision-table/locales/ru.d.ts.map +1 -1
  88. package/dist/decision-table/locales/ru.js +1 -1
  89. package/dist/decision-table/locales/tr.cjs +1 -1
  90. package/dist/decision-table/locales/tr.d.ts.map +1 -1
  91. package/dist/decision-table/locales/tr.js +1 -1
  92. package/dist/decision-table/locales/zh-CN.cjs +1 -1
  93. package/dist/decision-table/locales/zh-CN.d.ts.map +1 -1
  94. package/dist/decision-table/locales/zh-CN.js +1 -1
  95. package/dist/decision-table/locales/zh-TW.cjs +1 -1
  96. package/dist/decision-table/locales/zh-TW.d.ts.map +1 -1
  97. package/dist/decision-table/locales/zh-TW.js +1 -1
  98. package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
  99. package/dist/decision-table/useDecisionGraphActions.cjs +385 -0
  100. package/dist/decision-table/useDecisionGraphActions.d.ts +24 -0
  101. package/dist/decision-table/useDecisionGraphActions.d.ts.map +1 -0
  102. package/dist/decision-table/useDecisionGraphActions.js +351 -0
  103. package/dist/decision-table/useDecisionGraphStrings.cjs +138 -0
  104. package/dist/decision-table/useDecisionGraphStrings.d.ts +2 -1
  105. package/dist/decision-table/useDecisionGraphStrings.d.ts.map +1 -1
  106. package/dist/decision-table/useDecisionGraphStrings.js +138 -0
  107. package/dist/decision-table/useDragReorder.cjs +3 -2
  108. package/dist/decision-table/useDragReorder.d.ts.map +1 -1
  109. package/dist/decision-table/useDragReorder.js +3 -2
  110. package/dist/decision-table/useRuleWindow.cjs +3 -7
  111. package/dist/decision-table/useRuleWindow.d.ts.map +1 -1
  112. package/dist/decision-table/useRuleWindow.js +1 -5
  113. package/package.json +3 -3
@@ -36,6 +36,7 @@ __webpack_require__.d(__webpack_exports__, {
36
36
  FALLBACK_ROW_VIEWPORT_PX: ()=>FALLBACK_ROW_VIEWPORT_PX,
37
37
  GROUP_SEPARATOR_WIDTH_PX: ()=>GROUP_SEPARATOR_WIDTH_PX,
38
38
  MIN_COLUMN_WIDTH: ()=>MIN_COLUMN_WIDTH,
39
+ NEAREST: ()=>NEAREST,
39
40
  ROW_NUMBER_WIDTH: ()=>ROW_NUMBER_WIDTH
40
41
  });
41
42
  const EMPTY_VALUE_DASH = '—';
@@ -49,6 +50,10 @@ const DEFAULT_ROW_OVERSCAN = 30;
49
50
  const DEFAULT_COLUMN_OVERSCAN = 8;
50
51
  const FALLBACK_ROW_VIEWPORT_PX = 800;
51
52
  const FALLBACK_COLUMN_VIEWPORT_PX = 1600;
53
+ const NEAREST = {
54
+ block: 'nearest',
55
+ inline: 'nearest'
56
+ };
52
57
  const AUTOSCROLL_EDGE_PX = 32;
53
58
  const AUTOSCROLL_STEP_PX = 14;
54
59
  exports.AUTOSCROLL_EDGE_PX = __webpack_exports__.AUTOSCROLL_EDGE_PX;
@@ -63,6 +68,7 @@ exports.FALLBACK_COLUMN_VIEWPORT_PX = __webpack_exports__.FALLBACK_COLUMN_VIEWPO
63
68
  exports.FALLBACK_ROW_VIEWPORT_PX = __webpack_exports__.FALLBACK_ROW_VIEWPORT_PX;
64
69
  exports.GROUP_SEPARATOR_WIDTH_PX = __webpack_exports__.GROUP_SEPARATOR_WIDTH_PX;
65
70
  exports.MIN_COLUMN_WIDTH = __webpack_exports__.MIN_COLUMN_WIDTH;
71
+ exports.NEAREST = __webpack_exports__.NEAREST;
66
72
  exports.ROW_NUMBER_WIDTH = __webpack_exports__.ROW_NUMBER_WIDTH;
67
73
  for(var __rspack_i in __webpack_exports__)if (-1 === [
68
74
  "AUTOSCROLL_EDGE_PX",
@@ -77,6 +83,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
77
83
  "FALLBACK_ROW_VIEWPORT_PX",
78
84
  "GROUP_SEPARATOR_WIDTH_PX",
79
85
  "MIN_COLUMN_WIDTH",
86
+ "NEAREST",
80
87
  "ROW_NUMBER_WIDTH"
81
88
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
82
89
  Object.defineProperty(exports, '__esModule', {
@@ -9,6 +9,7 @@ export declare const DEFAULT_ROW_OVERSCAN = 30;
9
9
  export declare const DEFAULT_COLUMN_OVERSCAN = 8;
10
10
  export declare const FALLBACK_ROW_VIEWPORT_PX = 800;
11
11
  export declare const FALLBACK_COLUMN_VIEWPORT_PX = 1600;
12
+ export declare const NEAREST: ScrollIntoViewOptions;
12
13
  export declare const AUTOSCROLL_EDGE_PX = 32;
13
14
  export declare const AUTOSCROLL_STEP_PX = 14;
14
15
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/decision-table/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,WAAM,CAAC;AAEpC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAKnC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/decision-table/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,WAAM,CAAC;AAEpC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAKnC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,eAAO,MAAM,OAAO,EAAE,qBAA+D,CAAC;AAEtF,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
@@ -9,6 +9,10 @@ const DEFAULT_ROW_OVERSCAN = 30;
9
9
  const DEFAULT_COLUMN_OVERSCAN = 8;
10
10
  const FALLBACK_ROW_VIEWPORT_PX = 800;
11
11
  const FALLBACK_COLUMN_VIEWPORT_PX = 1600;
12
+ const NEAREST = {
13
+ block: 'nearest',
14
+ inline: 'nearest'
15
+ };
12
16
  const AUTOSCROLL_EDGE_PX = 32;
13
17
  const AUTOSCROLL_STEP_PX = 14;
14
- export { AUTOSCROLL_EDGE_PX, AUTOSCROLL_STEP_PX, BODY_ROW_HEIGHT_PX, COLUMN_ESTIMATE_PX, COLUMN_RESIZE_KEYBOARD_STEP, DEFAULT_COLUMN_OVERSCAN, DEFAULT_ROW_OVERSCAN, EMPTY_VALUE_DASH, FALLBACK_COLUMN_VIEWPORT_PX, FALLBACK_ROW_VIEWPORT_PX, GROUP_SEPARATOR_WIDTH_PX, MIN_COLUMN_WIDTH, ROW_NUMBER_WIDTH };
18
+ export { AUTOSCROLL_EDGE_PX, AUTOSCROLL_STEP_PX, BODY_ROW_HEIGHT_PX, COLUMN_ESTIMATE_PX, COLUMN_RESIZE_KEYBOARD_STEP, DEFAULT_COLUMN_OVERSCAN, DEFAULT_ROW_OVERSCAN, EMPTY_VALUE_DASH, FALLBACK_COLUMN_VIEWPORT_PX, FALLBACK_ROW_VIEWPORT_PX, GROUP_SEPARATOR_WIDTH_PX, MIN_COLUMN_WIDTH, NEAREST, ROW_NUMBER_WIDTH };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.r = (exports1)=>{
5
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
6
+ value: 'Module'
7
+ });
8
+ Object.defineProperty(exports1, '__esModule', {
9
+ value: true
10
+ });
11
+ };
12
+ })();
13
+ var __webpack_exports__ = {};
14
+ __webpack_require__.r(__webpack_exports__);
15
+ for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
16
+ Object.defineProperty(exports, '__esModule', {
17
+ value: true
18
+ });
@@ -0,0 +1,88 @@
1
+ export type DecisionGraphPlace = {
2
+ kind: 'top';
3
+ index: number;
4
+ } | {
5
+ kind: 'under';
6
+ parentId: string;
7
+ index: number;
8
+ };
9
+ export interface DecisionGraphMove {
10
+ decisionId: string;
11
+ from: DecisionGraphPlace;
12
+ to: DecisionGraphPlace;
13
+ }
14
+ export interface DecisionGraphLogicOption<Logic> {
15
+ logic: Logic;
16
+ label: string;
17
+ }
18
+ export type DecisionGraphAction<Refusal, Logic> = {
19
+ kind: 'rename';
20
+ onRename: (decisionId: string, name: string) => Refusal | void;
21
+ } | {
22
+ kind: 'delete';
23
+ onDelete: (decisionId: string) => Refusal | void;
24
+ } | {
25
+ kind: 'add';
26
+ onAdd: (place: DecisionGraphPlace) => Refusal | void;
27
+ } | {
28
+ kind: 'chooseInputs';
29
+ onChooseInputs: (decisionId: string, inputIds: readonly string[]) => Refusal | void;
30
+ } | {
31
+ kind: 'chooseUsers';
32
+ onChooseUsers: (decisionId: string, userIds: readonly string[]) => Refusal | void;
33
+ } | {
34
+ kind: 'stopUsing';
35
+ onStopUsing: (decisionId: string, userId: string) => Refusal | void;
36
+ } | {
37
+ kind: 'move';
38
+ onMove: (move: DecisionGraphMove) => Refusal | void;
39
+ } | {
40
+ kind: 'changeLogic';
41
+ logicOptions: (decisionId: string) => readonly DecisionGraphLogicOption<Logic>[];
42
+ onChangeLogic: (decisionId: string, logic: Logic) => Refusal | void;
43
+ } | {
44
+ kind: 'addNote';
45
+ onAddNote: (decisionId: string, text: string) => Refusal | void;
46
+ };
47
+ export type DecisionGraphActionKind = DecisionGraphAction<unknown, unknown>['kind'];
48
+ export type DecisionGraphLinkKind = Extract<DecisionGraphActionKind, 'chooseInputs' | 'chooseUsers'>;
49
+ export interface DecisionGraphEdit<Refusal, Logic> {
50
+ actions: readonly DecisionGraphAction<Refusal, Logic>[];
51
+ wordRefusal: (refusal: Refusal) => string;
52
+ }
53
+ export type DecisionGraphMode<Refusal, Logic> = {
54
+ kind: 'read';
55
+ } | {
56
+ kind: 'edit';
57
+ edit: DecisionGraphEdit<Refusal, Logic>;
58
+ };
59
+ export interface DecisionGraphActionLabels {
60
+ decisionActions: (name: string) => string;
61
+ openDecision: string;
62
+ rename: string;
63
+ nameField: (name: string) => string;
64
+ addNote: string;
65
+ changeLogicTo: (logic: string) => string;
66
+ addDecision: string;
67
+ addDecisionBefore: string;
68
+ addDecisionAfter: string;
69
+ addRequiredInput: string;
70
+ chooseInputs: string;
71
+ chooseUsers: string;
72
+ stopUsingIn: (name: string) => string;
73
+ moveUp: string;
74
+ moveDown: string;
75
+ moveUnder: (name: string) => string;
76
+ moveOutOf: (name: string) => string;
77
+ delete: string;
78
+ deleteTitle: (name: string) => string;
79
+ deleteUsedBy: string;
80
+ deleteUnused: string;
81
+ cancel: string;
82
+ save: string;
83
+ inputsTitle: (name: string) => string;
84
+ usersTitle: (name: string) => string;
85
+ noOtherDecisions: string;
86
+ noteTitle: (name: string) => string;
87
+ }
88
+ //# sourceMappingURL=decisionGraphActionTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decisionGraphActionTypes.d.ts","sourceRoot":"","sources":["../../src/decision-table/decisionGraphActionTypes.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAGvD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;IACzB,EAAE,EAAE,kBAAkB,CAAC;CACxB;AAGD,MAAM,WAAW,wBAAwB,CAAC,KAAK;IAC7C,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,MAAM,mBAAmB,CAAC,OAAO,EAAE,KAAK,IAC1C;IAAE,IAAI,EAAE,QAAQ,CAAC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jB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAEpC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IAEf,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IAEb,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,gBAAgB,EAAE,MAAM,CAAC;IAEzB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC"}
@@ -0,0 +1,247 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ hasDecisionEntries: ()=>hasDecisionEntries,
28
+ RENAME_KEY: ()=>RENAME_KEY,
29
+ decisionEntriesOf: ()=>decisionEntriesOf,
30
+ actionOf: ()=>actionOf,
31
+ referenceEntriesOf: ()=>referenceEntriesOf,
32
+ focusOf: ()=>focusOf,
33
+ DELETE_KEY: ()=>DELETE_KEY,
34
+ MOVE_KEYS: ()=>MOVE_KEYS,
35
+ hasReferenceEntries: ()=>hasReferenceEntries,
36
+ movesOf: ()=>movesOf
37
+ });
38
+ const external_decisionGraphPositions_cjs_namespaceObject = require("./decisionGraphPositions.cjs");
39
+ const actionOf = (actions, kind)=>actions.find((action)=>action.kind === kind);
40
+ const focusOf = (node)=>'decision' === node.kind ? {
41
+ kind: 'decision',
42
+ decisionId: node.id
43
+ } : {
44
+ kind: 'reference',
45
+ referenceId: node.id,
46
+ decisionId: node.targetId
47
+ };
48
+ const DIVIDER = {
49
+ divider: true
50
+ };
51
+ const joined = (groups)=>groups.filter((group)=>group.length > 0).flatMap((group, index)=>0 === index ? group : [
52
+ DIVIDER,
53
+ ...group
54
+ ]);
55
+ const MOVE_KEYS = {
56
+ up: 'Alt+Shift+ArrowUp',
57
+ down: 'Alt+Shift+ArrowDown',
58
+ under: 'Alt+Shift+ArrowRight',
59
+ out: 'Alt+Shift+ArrowLeft'
60
+ };
61
+ const MOVE_SHORTCUTS = {
62
+ up: 'Alt+Shift+↑',
63
+ down: 'Alt+Shift+↓',
64
+ under: 'Alt+Shift+→',
65
+ out: 'Alt+Shift+←'
66
+ };
67
+ const RENAME_KEY = 'F2';
68
+ const DELETE_KEY = 'Delete';
69
+ const movesOf = (node, position)=>({
70
+ up: (0, external_decisionGraphPositions_cjs_namespaceObject.moveUpOf)(node, position),
71
+ down: (0, external_decisionGraphPositions_cjs_namespaceObject.moveDownOf)(node, position),
72
+ under: (0, external_decisionGraphPositions_cjs_namespaceObject.moveUnderPreviousOf)(node, position),
73
+ out: (0, external_decisionGraphPositions_cjs_namespaceObject.moveOutOf)(node, position)
74
+ });
75
+ const moveEntriesOf = (actions, labels, node, position, handlers, nested)=>{
76
+ const action = actionOf(actions, 'move');
77
+ if (!action) return [];
78
+ const moves = movesOf(node, position);
79
+ const entry = (label, move, shortcut)=>({
80
+ label,
81
+ shortcut,
82
+ disabled: null === move,
83
+ focusesOwnSurface: true,
84
+ onClick: ()=>{
85
+ if (move) handlers.run(()=>action.onMove(move), focusOf(node));
86
+ }
87
+ });
88
+ const previous = (0, external_decisionGraphPositions_cjs_namespaceObject.previousDecisionOf)(node, position);
89
+ return [
90
+ entry(labels.moveUp, moves.up, MOVE_SHORTCUTS.up),
91
+ entry(labels.moveDown, moves.down, MOVE_SHORTCUTS.down),
92
+ ...nested && previous ? [
93
+ entry(labels.moveUnder(previous.label), moves.under, MOVE_SHORTCUTS.under)
94
+ ] : [],
95
+ ...nested && 'under' === position.kind ? [
96
+ entry(labels.moveOutOf(position.parent.label), moves.out, MOVE_SHORTCUTS.out)
97
+ ] : []
98
+ ];
99
+ };
100
+ const stopUsingEntriesOf = (actions, labels, node, position, handlers)=>{
101
+ const action = actionOf(actions, 'stopUsing');
102
+ if (!action || 'under' !== position.kind) return [];
103
+ const { parent } = position;
104
+ return [
105
+ {
106
+ label: labels.stopUsingIn(parent.label),
107
+ focusesOwnSurface: true,
108
+ onClick: ()=>handlers.run(()=>action.onStopUsing((0, external_decisionGraphPositions_cjs_namespaceObject.decisionIdOf)(node), parent.id), {
109
+ kind: 'decision',
110
+ decisionId: parent.id
111
+ })
112
+ }
113
+ ];
114
+ };
115
+ const addEntriesOf = (actions, labels, node, position, handlers)=>{
116
+ const action = actionOf(actions, 'add');
117
+ if (!action || 'decision' !== node.kind) return [];
118
+ const add = (label, place)=>({
119
+ label,
120
+ onClick: ()=>handlers.run(()=>action.onAdd(place), focusOf(node))
121
+ });
122
+ return [
123
+ add(labels.addDecisionBefore, (0, external_decisionGraphPositions_cjs_namespaceObject.placeOf)(position)),
124
+ add(labels.addDecisionAfter, (0, external_decisionGraphPositions_cjs_namespaceObject.placeOf)(position, position.index + 1)),
125
+ add(labels.addRequiredInput, {
126
+ kind: 'under',
127
+ parentId: node.id,
128
+ index: node.children.length
129
+ })
130
+ ];
131
+ };
132
+ const CARD_KINDS = [
133
+ 'rename',
134
+ 'addNote',
135
+ 'add',
136
+ 'chooseInputs',
137
+ 'chooseUsers',
138
+ 'delete'
139
+ ];
140
+ const canMove = (actions, node, position, nested)=>{
141
+ if (!actionOf(actions, 'move')) return false;
142
+ const { up, down, under, out } = movesOf(node, position);
143
+ return [
144
+ up,
145
+ down,
146
+ ...nested ? [
147
+ under,
148
+ out
149
+ ] : []
150
+ ].some((move)=>null !== move);
151
+ };
152
+ const offersStopUsing = (actions, position)=>'under' === position.kind && void 0 !== actionOf(actions, 'stopUsing');
153
+ const hasDecisionEntries = (actions, node, position, open)=>void 0 !== open || offersStopUsing(actions, position) || actions.some((action)=>CARD_KINDS.includes(action.kind)) || canMove(actions, node, position, true) || (actionOf(actions, 'changeLogic')?.logicOptions((0, external_decisionGraphPositions_cjs_namespaceObject.decisionIdOf)(node)).length ?? 0) > 0;
154
+ const hasReferenceEntries = (actions, node, position, open)=>void 0 !== open || offersStopUsing(actions, position) || canMove(actions, node, position, false);
155
+ const decisionEntriesOf = (actions, labels, node, position, handlers)=>{
156
+ const decisionId = (0, external_decisionGraphPositions_cjs_namespaceObject.decisionIdOf)(node);
157
+ const { changeLogic } = handlers;
158
+ const has = (kind)=>void 0 !== actionOf(actions, kind);
159
+ return joined([
160
+ [
161
+ ...handlers.open ? [
162
+ {
163
+ label: labels.openDecision,
164
+ onClick: handlers.open
165
+ }
166
+ ] : [],
167
+ ...has('rename') ? [
168
+ {
169
+ label: labels.rename,
170
+ shortcut: RENAME_KEY,
171
+ focusesOwnSurface: true,
172
+ onClick: handlers.startRename
173
+ }
174
+ ] : [],
175
+ ...has('addNote') ? [
176
+ {
177
+ label: labels.addNote,
178
+ onClick: handlers.writeNote
179
+ }
180
+ ] : [],
181
+ ...changeLogic ? changeLogic.logicOptions(decisionId).map((option)=>({
182
+ label: labels.changeLogicTo(option.label),
183
+ onClick: ()=>handlers.run(()=>changeLogic.onChangeLogic(decisionId, option.logic), focusOf(node))
184
+ })) : []
185
+ ],
186
+ addEntriesOf(actions, labels, node, position, handlers),
187
+ [
188
+ ...has('chooseInputs') ? [
189
+ {
190
+ label: labels.chooseInputs,
191
+ onClick: ()=>handlers.chooseLinks('chooseInputs')
192
+ }
193
+ ] : [],
194
+ ...has('chooseUsers') ? [
195
+ {
196
+ label: labels.chooseUsers,
197
+ onClick: ()=>handlers.chooseLinks('chooseUsers')
198
+ }
199
+ ] : [],
200
+ ...stopUsingEntriesOf(actions, labels, node, position, handlers)
201
+ ],
202
+ moveEntriesOf(actions, labels, node, position, handlers, true),
203
+ has('delete') ? [
204
+ {
205
+ label: labels.delete,
206
+ shortcut: DELETE_KEY,
207
+ destructive: true,
208
+ onClick: handlers.confirmDelete
209
+ }
210
+ ] : []
211
+ ]);
212
+ };
213
+ const referenceEntriesOf = (actions, labels, node, position, handlers)=>joined([
214
+ handlers.open ? [
215
+ {
216
+ label: labels.openDecision,
217
+ onClick: handlers.open
218
+ }
219
+ ] : [],
220
+ moveEntriesOf(actions, labels, node, position, handlers, false),
221
+ stopUsingEntriesOf(actions, labels, node, position, handlers)
222
+ ]);
223
+ exports.DELETE_KEY = __webpack_exports__.DELETE_KEY;
224
+ exports.MOVE_KEYS = __webpack_exports__.MOVE_KEYS;
225
+ exports.RENAME_KEY = __webpack_exports__.RENAME_KEY;
226
+ exports.actionOf = __webpack_exports__.actionOf;
227
+ exports.decisionEntriesOf = __webpack_exports__.decisionEntriesOf;
228
+ exports.focusOf = __webpack_exports__.focusOf;
229
+ exports.hasDecisionEntries = __webpack_exports__.hasDecisionEntries;
230
+ exports.hasReferenceEntries = __webpack_exports__.hasReferenceEntries;
231
+ exports.movesOf = __webpack_exports__.movesOf;
232
+ exports.referenceEntriesOf = __webpack_exports__.referenceEntriesOf;
233
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
234
+ "DELETE_KEY",
235
+ "MOVE_KEYS",
236
+ "RENAME_KEY",
237
+ "actionOf",
238
+ "decisionEntriesOf",
239
+ "focusOf",
240
+ "hasDecisionEntries",
241
+ "hasReferenceEntries",
242
+ "movesOf",
243
+ "referenceEntriesOf"
244
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
245
+ Object.defineProperty(exports, '__esModule', {
246
+ value: true
247
+ });
@@ -0,0 +1,46 @@
1
+ import type { DecisionGraphAction, DecisionGraphActionKind, DecisionGraphActionLabels, DecisionGraphLinkKind, DecisionGraphMove } from './decisionGraphActionTypes';
2
+ import { type DecisionGraphPosition } from './decisionGraphPositions';
3
+ import type { DecisionGraphNode } from './decisionGraphTypes';
4
+ import type { GridMenuEntry } from './GridMenu';
5
+ export declare const actionOf: <Refusal, Logic, Kind extends DecisionGraphActionKind>(actions: readonly DecisionGraphAction<Refusal, Logic>[], kind: Kind) => Extract<DecisionGraphAction<Refusal, Logic>, {
6
+ kind: Kind;
7
+ }> | undefined;
8
+ export type DecisionGraphFocus = {
9
+ kind: 'decision';
10
+ decisionId: string;
11
+ } | {
12
+ kind: 'reference';
13
+ referenceId: string;
14
+ decisionId: string;
15
+ };
16
+ export declare const focusOf: (node: DecisionGraphNode) => DecisionGraphFocus;
17
+ export interface DecisionGraphMenuHandlers<Refusal, Logic> {
18
+ run: (call: () => Refusal | void, focus: DecisionGraphFocus | null) => void;
19
+ open: (() => void) | undefined;
20
+ startRename: () => void;
21
+ confirmDelete: () => void;
22
+ chooseLinks: (kind: DecisionGraphLinkKind) => void;
23
+ writeNote: () => void;
24
+ changeLogic: Extract<DecisionGraphAction<Refusal, Logic>, {
25
+ kind: 'changeLogic';
26
+ }> | undefined;
27
+ }
28
+ export declare const MOVE_KEYS: {
29
+ readonly up: "Alt+Shift+ArrowUp";
30
+ readonly down: "Alt+Shift+ArrowDown";
31
+ readonly under: "Alt+Shift+ArrowRight";
32
+ readonly out: "Alt+Shift+ArrowLeft";
33
+ };
34
+ export declare const RENAME_KEY = "F2";
35
+ export declare const DELETE_KEY = "Delete";
36
+ export declare const movesOf: (node: DecisionGraphNode, position: DecisionGraphPosition) => {
37
+ up: DecisionGraphMove | null;
38
+ down: DecisionGraphMove | null;
39
+ under: DecisionGraphMove | null;
40
+ out: DecisionGraphMove | null;
41
+ };
42
+ export declare const hasDecisionEntries: <Refusal, Logic>(actions: readonly DecisionGraphAction<Refusal, Logic>[], node: DecisionGraphNode, position: DecisionGraphPosition, open: (() => void) | undefined) => boolean;
43
+ export declare const hasReferenceEntries: <Refusal, Logic>(actions: readonly DecisionGraphAction<Refusal, Logic>[], node: DecisionGraphNode, position: DecisionGraphPosition, open: (() => void) | undefined) => boolean;
44
+ export declare const decisionEntriesOf: <Refusal, Logic>(actions: readonly DecisionGraphAction<Refusal, Logic>[], labels: DecisionGraphActionLabels, node: DecisionGraphNode, position: DecisionGraphPosition, handlers: DecisionGraphMenuHandlers<Refusal, Logic>) => GridMenuEntry[];
45
+ export declare const referenceEntriesOf: <Refusal, Logic>(actions: readonly DecisionGraphAction<Refusal, Logic>[], labels: DecisionGraphActionLabels, node: DecisionGraphNode, position: DecisionGraphPosition, handlers: DecisionGraphMenuHandlers<Refusal, Logic>) => GridMenuEntry[];
46
+ //# sourceMappingURL=decisionGraphMenuEntries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decisionGraphMenuEntries.d.ts","sourceRoot":"","sources":["../../src/decision-table/decisionGraphMenuEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,qBAAqB,EAQ3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,eAAO,MAAM,QAAQ,GAAI,OAAO,EAAE,KAAK,EAAE,IAAI,SAAS,uBAA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eAAO,MAAM,kBAAkB,GAAI,OAAO,EAAE,KAAK,EAC/C,SAAS,SAAS,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EACvD,MAAM,iBAAiB,EACvB,UAAU,qBAAqB,EAC/B,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,KAC7B,OAKmF,CAAC;AAGvF,eAAO,MAAM,mBAAmB,GAAI,OAAO,EAAE,KAAK,EAChD,SAAS,SAAS,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EACvD,MAAM,iBAAiB,EACvB,UAAU,qBAAqB,EAC/B,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,KAC7B,OAGsC,CAAC;AAG1C,eAAO,MAAM,iBAAiB,GAAI,OAAO,EAAE,KAAK,EAC9C,SAAS,SAAS,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EACvD,QAAQ,yBAAyB,EACjC,MAAM,iBAAiB,EACvB,UAAU,qBAAqB,EAC/B,UAAU,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,KAClD,aAAa,EAmDf,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAAI,OAAO,EAAE,KAAK,EAC/C,SAAS,SAAS,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EACvD,QAAQ,yBAAyB,EACjC,MAAM,iBAAiB,EACvB,UAAU,qBAAqB,EAC/B,UAAU,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,KAClD,aAAa,EAKZ,CAAC"}
@@ -0,0 +1,186 @@
1
+ import { decisionIdOf, moveDownOf, moveOutOf, moveUnderPreviousOf, moveUpOf, placeOf, previousDecisionOf } from "./decisionGraphPositions.js";
2
+ const actionOf = (actions, kind)=>actions.find((action)=>action.kind === kind);
3
+ const focusOf = (node)=>'decision' === node.kind ? {
4
+ kind: 'decision',
5
+ decisionId: node.id
6
+ } : {
7
+ kind: 'reference',
8
+ referenceId: node.id,
9
+ decisionId: node.targetId
10
+ };
11
+ const DIVIDER = {
12
+ divider: true
13
+ };
14
+ const joined = (groups)=>groups.filter((group)=>group.length > 0).flatMap((group, index)=>0 === index ? group : [
15
+ DIVIDER,
16
+ ...group
17
+ ]);
18
+ const MOVE_KEYS = {
19
+ up: 'Alt+Shift+ArrowUp',
20
+ down: 'Alt+Shift+ArrowDown',
21
+ under: 'Alt+Shift+ArrowRight',
22
+ out: 'Alt+Shift+ArrowLeft'
23
+ };
24
+ const MOVE_SHORTCUTS = {
25
+ up: 'Alt+Shift+↑',
26
+ down: 'Alt+Shift+↓',
27
+ under: 'Alt+Shift+→',
28
+ out: 'Alt+Shift+←'
29
+ };
30
+ const RENAME_KEY = 'F2';
31
+ const DELETE_KEY = 'Delete';
32
+ const movesOf = (node, position)=>({
33
+ up: moveUpOf(node, position),
34
+ down: moveDownOf(node, position),
35
+ under: moveUnderPreviousOf(node, position),
36
+ out: moveOutOf(node, position)
37
+ });
38
+ const moveEntriesOf = (actions, labels, node, position, handlers, nested)=>{
39
+ const action = actionOf(actions, 'move');
40
+ if (!action) return [];
41
+ const moves = movesOf(node, position);
42
+ const entry = (label, move, shortcut)=>({
43
+ label,
44
+ shortcut,
45
+ disabled: null === move,
46
+ focusesOwnSurface: true,
47
+ onClick: ()=>{
48
+ if (move) handlers.run(()=>action.onMove(move), focusOf(node));
49
+ }
50
+ });
51
+ const previous = previousDecisionOf(node, position);
52
+ return [
53
+ entry(labels.moveUp, moves.up, MOVE_SHORTCUTS.up),
54
+ entry(labels.moveDown, moves.down, MOVE_SHORTCUTS.down),
55
+ ...nested && previous ? [
56
+ entry(labels.moveUnder(previous.label), moves.under, MOVE_SHORTCUTS.under)
57
+ ] : [],
58
+ ...nested && 'under' === position.kind ? [
59
+ entry(labels.moveOutOf(position.parent.label), moves.out, MOVE_SHORTCUTS.out)
60
+ ] : []
61
+ ];
62
+ };
63
+ const stopUsingEntriesOf = (actions, labels, node, position, handlers)=>{
64
+ const action = actionOf(actions, 'stopUsing');
65
+ if (!action || 'under' !== position.kind) return [];
66
+ const { parent } = position;
67
+ return [
68
+ {
69
+ label: labels.stopUsingIn(parent.label),
70
+ focusesOwnSurface: true,
71
+ onClick: ()=>handlers.run(()=>action.onStopUsing(decisionIdOf(node), parent.id), {
72
+ kind: 'decision',
73
+ decisionId: parent.id
74
+ })
75
+ }
76
+ ];
77
+ };
78
+ const addEntriesOf = (actions, labels, node, position, handlers)=>{
79
+ const action = actionOf(actions, 'add');
80
+ if (!action || 'decision' !== node.kind) return [];
81
+ const add = (label, place)=>({
82
+ label,
83
+ onClick: ()=>handlers.run(()=>action.onAdd(place), focusOf(node))
84
+ });
85
+ return [
86
+ add(labels.addDecisionBefore, placeOf(position)),
87
+ add(labels.addDecisionAfter, placeOf(position, position.index + 1)),
88
+ add(labels.addRequiredInput, {
89
+ kind: 'under',
90
+ parentId: node.id,
91
+ index: node.children.length
92
+ })
93
+ ];
94
+ };
95
+ const CARD_KINDS = [
96
+ 'rename',
97
+ 'addNote',
98
+ 'add',
99
+ 'chooseInputs',
100
+ 'chooseUsers',
101
+ 'delete'
102
+ ];
103
+ const canMove = (actions, node, position, nested)=>{
104
+ if (!actionOf(actions, 'move')) return false;
105
+ const { up, down, under, out } = movesOf(node, position);
106
+ return [
107
+ up,
108
+ down,
109
+ ...nested ? [
110
+ under,
111
+ out
112
+ ] : []
113
+ ].some((move)=>null !== move);
114
+ };
115
+ const offersStopUsing = (actions, position)=>'under' === position.kind && void 0 !== actionOf(actions, 'stopUsing');
116
+ const hasDecisionEntries = (actions, node, position, open)=>void 0 !== open || offersStopUsing(actions, position) || actions.some((action)=>CARD_KINDS.includes(action.kind)) || canMove(actions, node, position, true) || (actionOf(actions, 'changeLogic')?.logicOptions(decisionIdOf(node)).length ?? 0) > 0;
117
+ const hasReferenceEntries = (actions, node, position, open)=>void 0 !== open || offersStopUsing(actions, position) || canMove(actions, node, position, false);
118
+ const decisionEntriesOf = (actions, labels, node, position, handlers)=>{
119
+ const decisionId = decisionIdOf(node);
120
+ const { changeLogic } = handlers;
121
+ const has = (kind)=>void 0 !== actionOf(actions, kind);
122
+ return joined([
123
+ [
124
+ ...handlers.open ? [
125
+ {
126
+ label: labels.openDecision,
127
+ onClick: handlers.open
128
+ }
129
+ ] : [],
130
+ ...has('rename') ? [
131
+ {
132
+ label: labels.rename,
133
+ shortcut: RENAME_KEY,
134
+ focusesOwnSurface: true,
135
+ onClick: handlers.startRename
136
+ }
137
+ ] : [],
138
+ ...has('addNote') ? [
139
+ {
140
+ label: labels.addNote,
141
+ onClick: handlers.writeNote
142
+ }
143
+ ] : [],
144
+ ...changeLogic ? changeLogic.logicOptions(decisionId).map((option)=>({
145
+ label: labels.changeLogicTo(option.label),
146
+ onClick: ()=>handlers.run(()=>changeLogic.onChangeLogic(decisionId, option.logic), focusOf(node))
147
+ })) : []
148
+ ],
149
+ addEntriesOf(actions, labels, node, position, handlers),
150
+ [
151
+ ...has('chooseInputs') ? [
152
+ {
153
+ label: labels.chooseInputs,
154
+ onClick: ()=>handlers.chooseLinks('chooseInputs')
155
+ }
156
+ ] : [],
157
+ ...has('chooseUsers') ? [
158
+ {
159
+ label: labels.chooseUsers,
160
+ onClick: ()=>handlers.chooseLinks('chooseUsers')
161
+ }
162
+ ] : [],
163
+ ...stopUsingEntriesOf(actions, labels, node, position, handlers)
164
+ ],
165
+ moveEntriesOf(actions, labels, node, position, handlers, true),
166
+ has('delete') ? [
167
+ {
168
+ label: labels.delete,
169
+ shortcut: DELETE_KEY,
170
+ destructive: true,
171
+ onClick: handlers.confirmDelete
172
+ }
173
+ ] : []
174
+ ]);
175
+ };
176
+ const referenceEntriesOf = (actions, labels, node, position, handlers)=>joined([
177
+ handlers.open ? [
178
+ {
179
+ label: labels.openDecision,
180
+ onClick: handlers.open
181
+ }
182
+ ] : [],
183
+ moveEntriesOf(actions, labels, node, position, handlers, false),
184
+ stopUsingEntriesOf(actions, labels, node, position, handlers)
185
+ ]);
186
+ export { DELETE_KEY, MOVE_KEYS, RENAME_KEY, actionOf, decisionEntriesOf, focusOf, hasDecisionEntries, hasReferenceEntries, movesOf, referenceEntriesOf };