@uipath/apollo-react 7.30.0 → 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 (139) 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/ColumnPopover.cjs +1 -3
  4. package/dist/decision-table/ColumnPopover.d.ts +2 -2
  5. package/dist/decision-table/ColumnPopover.d.ts.map +1 -1
  6. package/dist/decision-table/ColumnPopover.js +1 -3
  7. package/dist/decision-table/DecisionGraphCard.cjs +112 -9
  8. package/dist/decision-table/DecisionGraphCard.d.ts +21 -0
  9. package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
  10. package/dist/decision-table/DecisionGraphCard.js +115 -12
  11. package/dist/decision-table/DecisionGraphDialogs.cjs +223 -0
  12. package/dist/decision-table/DecisionGraphDialogs.d.ts +30 -0
  13. package/dist/decision-table/DecisionGraphDialogs.d.ts.map +1 -0
  14. package/dist/decision-table/DecisionGraphDialogs.js +183 -0
  15. package/dist/decision-table/DecisionGraphText.cjs +6 -338
  16. package/dist/decision-table/DecisionGraphText.d.ts +4 -15
  17. package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
  18. package/dist/decision-table/DecisionGraphText.js +7 -339
  19. package/dist/decision-table/DecisionGraphView.cjs +409 -0
  20. package/dist/decision-table/DecisionGraphView.d.ts +20 -0
  21. package/dist/decision-table/DecisionGraphView.d.ts.map +1 -0
  22. package/dist/decision-table/DecisionGraphView.js +375 -0
  23. package/dist/decision-table/DecisionTable.cjs +3 -1
  24. package/dist/decision-table/DecisionTable.d.ts.map +1 -1
  25. package/dist/decision-table/DecisionTable.js +3 -1
  26. package/dist/decision-table/DecisionText.cjs +2 -4
  27. package/dist/decision-table/DecisionText.d.ts.map +1 -1
  28. package/dist/decision-table/DecisionText.js +2 -4
  29. package/dist/decision-table/EditableDecisionGraphText.cjs +40 -0
  30. package/dist/decision-table/EditableDecisionGraphText.d.ts +5 -0
  31. package/dist/decision-table/EditableDecisionGraphText.d.ts.map +1 -0
  32. package/dist/decision-table/EditableDecisionGraphText.js +6 -0
  33. package/dist/decision-table/GridMenu.cjs +36 -2
  34. package/dist/decision-table/GridMenu.d.ts +8 -0
  35. package/dist/decision-table/GridMenu.d.ts.map +1 -1
  36. package/dist/decision-table/GridMenu.js +33 -2
  37. package/dist/decision-table/__fixtures__/graphActionsHost.d.ts +21 -0
  38. package/dist/decision-table/__fixtures__/graphActionsHost.d.ts.map +1 -0
  39. package/dist/decision-table/columnTypes.cjs +2 -8
  40. package/dist/decision-table/columnTypes.d.ts +4 -2
  41. package/dist/decision-table/columnTypes.d.ts.map +1 -1
  42. package/dist/decision-table/columnTypes.js +2 -8
  43. package/dist/decision-table/constants.cjs +7 -0
  44. package/dist/decision-table/constants.d.ts +1 -0
  45. package/dist/decision-table/constants.d.ts.map +1 -1
  46. package/dist/decision-table/constants.js +5 -1
  47. package/dist/decision-table/decisionGraphActionTypes.d.ts +88 -0
  48. package/dist/decision-table/decisionGraphActionTypes.d.ts.map +1 -0
  49. package/dist/decision-table/decisionGraphMenuEntries.cjs +247 -0
  50. package/dist/decision-table/decisionGraphMenuEntries.d.ts +46 -0
  51. package/dist/decision-table/decisionGraphMenuEntries.d.ts.map +1 -0
  52. package/dist/decision-table/decisionGraphMenuEntries.js +186 -0
  53. package/dist/decision-table/decisionGraphPositions.cjs +136 -0
  54. package/dist/decision-table/decisionGraphPositions.d.ts +26 -0
  55. package/dist/decision-table/decisionGraphPositions.d.ts.map +1 -0
  56. package/dist/decision-table/decisionGraphPositions.js +69 -0
  57. package/dist/decision-table/decisionGraphStyles.cjs +24 -16
  58. package/dist/decision-table/decisionGraphStyles.d.ts +3 -1
  59. package/dist/decision-table/decisionGraphStyles.d.ts.map +1 -1
  60. package/dist/decision-table/decisionGraphStyles.js +4 -2
  61. package/dist/decision-table/decisionTextTypes.d.ts +3 -1
  62. package/dist/decision-table/decisionTextTypes.d.ts.map +1 -1
  63. package/dist/decision-table/hitPolicyMenu.cjs +4 -10
  64. package/dist/decision-table/hitPolicyMenu.d.ts +5 -3
  65. package/dist/decision-table/hitPolicyMenu.d.ts.map +1 -1
  66. package/dist/decision-table/hitPolicyMenu.js +4 -10
  67. package/dist/decision-table/index.cjs +62 -54
  68. package/dist/decision-table/index.d.ts +2 -0
  69. package/dist/decision-table/index.d.ts.map +1 -1
  70. package/dist/decision-table/index.js +2 -1
  71. package/dist/decision-table/locales/de.cjs +1 -1
  72. package/dist/decision-table/locales/de.d.ts.map +1 -1
  73. package/dist/decision-table/locales/de.js +1 -1
  74. package/dist/decision-table/locales/en.cjs +1 -1
  75. package/dist/decision-table/locales/en.d.ts.map +1 -1
  76. package/dist/decision-table/locales/en.js +1 -1
  77. package/dist/decision-table/locales/es-MX.cjs +1 -1
  78. package/dist/decision-table/locales/es-MX.d.ts.map +1 -1
  79. package/dist/decision-table/locales/es-MX.js +1 -1
  80. package/dist/decision-table/locales/es.cjs +1 -1
  81. package/dist/decision-table/locales/es.d.ts.map +1 -1
  82. package/dist/decision-table/locales/es.js +1 -1
  83. package/dist/decision-table/locales/fr.cjs +1 -1
  84. package/dist/decision-table/locales/fr.d.ts.map +1 -1
  85. package/dist/decision-table/locales/fr.js +1 -1
  86. package/dist/decision-table/locales/ja.cjs +1 -1
  87. package/dist/decision-table/locales/ja.d.ts.map +1 -1
  88. package/dist/decision-table/locales/ja.js +1 -1
  89. package/dist/decision-table/locales/ko.cjs +1 -1
  90. package/dist/decision-table/locales/ko.d.ts.map +1 -1
  91. package/dist/decision-table/locales/ko.js +1 -1
  92. package/dist/decision-table/locales/pt-BR.cjs +1 -1
  93. package/dist/decision-table/locales/pt-BR.d.ts.map +1 -1
  94. package/dist/decision-table/locales/pt-BR.js +1 -1
  95. package/dist/decision-table/locales/pt.cjs +1 -1
  96. package/dist/decision-table/locales/pt.d.ts.map +1 -1
  97. package/dist/decision-table/locales/pt.js +1 -1
  98. package/dist/decision-table/locales/ro.cjs +1 -1
  99. package/dist/decision-table/locales/ro.d.ts.map +1 -1
  100. package/dist/decision-table/locales/ro.js +1 -1
  101. package/dist/decision-table/locales/ru.cjs +1 -1
  102. package/dist/decision-table/locales/ru.d.ts.map +1 -1
  103. package/dist/decision-table/locales/ru.js +1 -1
  104. package/dist/decision-table/locales/tr.cjs +1 -1
  105. package/dist/decision-table/locales/tr.d.ts.map +1 -1
  106. package/dist/decision-table/locales/tr.js +1 -1
  107. package/dist/decision-table/locales/zh-CN.cjs +1 -1
  108. package/dist/decision-table/locales/zh-CN.d.ts.map +1 -1
  109. package/dist/decision-table/locales/zh-CN.js +1 -1
  110. package/dist/decision-table/locales/zh-TW.cjs +1 -1
  111. package/dist/decision-table/locales/zh-TW.d.ts.map +1 -1
  112. package/dist/decision-table/locales/zh-TW.js +1 -1
  113. package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
  114. package/dist/decision-table/useDecisionGraphActions.cjs +385 -0
  115. package/dist/decision-table/useDecisionGraphActions.d.ts +24 -0
  116. package/dist/decision-table/useDecisionGraphActions.d.ts.map +1 -0
  117. package/dist/decision-table/useDecisionGraphActions.js +351 -0
  118. package/dist/decision-table/useDecisionGraphStrings.cjs +138 -0
  119. package/dist/decision-table/useDecisionGraphStrings.d.ts +2 -1
  120. package/dist/decision-table/useDecisionGraphStrings.d.ts.map +1 -1
  121. package/dist/decision-table/useDecisionGraphStrings.js +138 -0
  122. package/dist/decision-table/useDecisionTextStrings.cjs +22 -0
  123. package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -1
  124. package/dist/decision-table/useDecisionTextStrings.js +22 -0
  125. package/dist/decision-table/useDragReorder.cjs +3 -2
  126. package/dist/decision-table/useDragReorder.d.ts.map +1 -1
  127. package/dist/decision-table/useDragReorder.js +3 -2
  128. package/dist/decision-table/useRuleWindow.cjs +3 -7
  129. package/dist/decision-table/useRuleWindow.d.ts.map +1 -1
  130. package/dist/decision-table/useRuleWindow.js +1 -5
  131. package/dist/decision-table/useTextAnnouncements.cjs +2 -9
  132. package/dist/decision-table/useTextAnnouncements.d.ts +4 -2
  133. package/dist/decision-table/useTextAnnouncements.d.ts.map +1 -1
  134. package/dist/decision-table/useTextAnnouncements.js +2 -9
  135. package/package.json +2 -2
  136. package/dist/decision-table/translate.d.ts +0 -3
  137. package/dist/decision-table/translate.d.ts.map +0 -1
  138. /package/dist/decision-table/{translate.cjs → decisionGraphActionTypes.cjs} +0 -0
  139. /package/dist/decision-table/{translate.js → decisionGraphActionTypes.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, cn } from "@uipath/apollo-wind";
3
- import { useEffect, useRef } from "react";
3
+ import { useEffect, useRef, useState } from "react";
4
4
  const isDivider = (entry)=>true === entry.divider;
5
5
  const DESTRUCTIVE_ITEM_CLASS = 'text-destructive focus:bg-destructive/10 focus:text-destructive';
6
6
  const useGridMenuItems = (entries, open, dataTestId)=>{
@@ -98,4 +98,35 @@ const GridContextMenu = ({ label, dataTestId, state, entries, onClose, className
98
98
  ]
99
99
  });
100
100
  };
101
- export { GridContextMenu };
101
+ const GridMenuButton = ({ label, dataTestId, entries, className, children })=>{
102
+ const [open, setOpen] = useState(false);
103
+ const { items, onCloseAutoFocus } = useGridMenuItems(open ? entries() : [], open, dataTestId);
104
+ return /*#__PURE__*/ jsxs(DropdownMenu, {
105
+ open: open,
106
+ modal: false,
107
+ onOpenChange: setOpen,
108
+ children: [
109
+ /*#__PURE__*/ jsx(DropdownMenuTrigger, {
110
+ asChild: true,
111
+ children: /*#__PURE__*/ jsx("button", {
112
+ type: "button",
113
+ "aria-label": label,
114
+ className: className,
115
+ "data-testid": dataTestId,
116
+ children: children
117
+ })
118
+ }),
119
+ /*#__PURE__*/ jsx(DropdownMenuContent, {
120
+ align: "end",
121
+ side: "bottom",
122
+ "aria-label": label,
123
+ className: "min-w-52",
124
+ "data-testid": `${dataTestId}-menu`,
125
+ onCloseAutoFocus: onCloseAutoFocus,
126
+ onDoubleClick: (event)=>event.stopPropagation(),
127
+ children: items
128
+ })
129
+ ]
130
+ });
131
+ };
132
+ export { GridContextMenu, GridMenuButton };
@@ -0,0 +1,21 @@
1
+ import type { DecisionGraphAction, DecisionGraphMove } from '../decisionGraphActionTypes';
2
+ import type { DecisionGraphDecisionNode, DecisionGraphNode } from '../decisionGraphTypes';
3
+ export type FixtureLogic = 'table' | 'literal';
4
+ export type FixtureRefusal = 'duplicateName' | 'loop';
5
+ interface FixtureDecision {
6
+ node: Pick<DecisionGraphDecisionNode, 'label' | 'logic' | 'mark'>;
7
+ inputs: readonly string[];
8
+ notes: readonly string[];
9
+ }
10
+ export interface FixtureGraph {
11
+ decisions: ReadonlyMap<string, FixtureDecision>;
12
+ top: readonly string[];
13
+ added: number;
14
+ }
15
+ export declare const graphOf: (nodes: readonly DecisionGraphNode[]) => FixtureGraph;
16
+ export declare const nodesOf: (graph: FixtureGraph) => DecisionGraphNode[];
17
+ export declare const moved: (graph: FixtureGraph, move: DecisionGraphMove) => FixtureGraph | FixtureRefusal;
18
+ export declare const fixtureActions: (graph: FixtureGraph, update: (next: FixtureGraph) => void) => DecisionGraphAction<FixtureRefusal, FixtureLogic>[];
19
+ export declare const wordFixtureRefusal: (refusal: FixtureRefusal) => string;
20
+ export {};
21
+ //# sourceMappingURL=graphActionsHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphActionsHost.d.ts","sourceRoot":"","sources":["../../../src/decision-table/__fixtures__/graphActionsHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1F,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,MAAM,CAAC;AAEtD,UAAU,eAAe;IACvB,IAAI,EAAE,IAAI,CAAC,yBAAyB,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;IAClE,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAGD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAChD,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,iBAAiB,EAAE,KAAG,YAc7D,CAAC;AAGF,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,KAAG,iBAAiB,EAmB9D,CAAC;AAwDF,eAAO,MAAM,KAAK,GAChB,OAAO,YAAY,EACnB,MAAM,iBAAiB,KACtB,YAAY,GAAG,cAOjB,CAAC;AAGF,eAAO,MAAM,cAAc,GACzB,OAAO,YAAY,EACnB,QAAQ,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,KACnC,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,EA8HnD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,SAAS,cAAc,KAAG,MAGhB,CAAC"}
@@ -30,17 +30,11 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  });
31
31
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
32
32
  const external_lucide_react_namespaceObject = require("lucide-react");
33
- const columnTypeChoicesOf = (types, _)=>types.map(({ label, icon, example }, index)=>({
33
+ const columnTypeChoicesOf = (types, labels)=>types.map(({ label, icon, example }, index)=>({
34
34
  id: String(index),
35
35
  label,
36
36
  icon,
37
- allowedValuesPlaceholder: _({
38
- id: 'decision-text.allowed_values_example',
39
- message: 'e.g. {example}',
40
- values: {
41
- example
42
- }
43
- })
37
+ allowedValuesPlaceholder: labels.allowedValuesExample(example)
44
38
  }));
45
39
  const columnTypeIndexOf = (types, type)=>types.findIndex((option)=>option.type === type);
46
40
  const glyphOf = (types, type)=>types.find((option)=>option.type === type)?.icon ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Braces, {});
@@ -1,16 +1,18 @@
1
1
  import type React from 'react';
2
2
  import type { PopoverSelectOption } from './PopoverSelect';
3
- import type { Translate } from './translate';
4
3
  export interface ColumnTypeOption<Type> {
5
4
  type: Type;
6
5
  label: string;
7
6
  icon: React.ReactNode;
8
7
  example: string;
9
8
  }
9
+ export interface ColumnTypeLabels {
10
+ allowedValuesExample: (example: string) => string;
11
+ }
10
12
  export interface ColumnTypeChoice extends PopoverSelectOption {
11
13
  allowedValuesPlaceholder: string;
12
14
  }
13
- export declare const columnTypeChoicesOf: <Type>(types: readonly ColumnTypeOption<Type>[], _: Translate) => ColumnTypeChoice[];
15
+ export declare const columnTypeChoicesOf: <Type>(types: readonly ColumnTypeOption<Type>[], labels: ColumnTypeLabels) => ColumnTypeChoice[];
14
16
  export declare const columnTypeIndexOf: <Type>(types: readonly ColumnTypeOption<Type>[], type: Type) => number;
15
17
  export declare const glyphOf: <Type>(types: readonly ColumnTypeOption<Type>[], type: Type) => React.ReactNode;
16
18
  //# sourceMappingURL=columnTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"columnTypes.d.ts","sourceRoot":"","sources":["../../src/decision-table/columnTypes.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,WAAW,gBAAgB,CAAC,IAAI;IACpC,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IA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AO,MAAM,iBAAiB,GAAI,IAAI,EACpC,OAAO,SAAS,gBAAgB,CAAC,IAAI,CAAC,EAAE,EACxC,MAAM,IAAI,KACT,MAA2D,CAAC;AAG/D,eAAO,MAAM,OAAO,GAAI,IAAI,EAC1B,OAAO,SAAS,gBAAgB,CAAC,IAAI,CAAC,EAAE,EACxC,MAAM,IAAI,KACT,KAAK,CAAC,SAA6E,CAAC"}
@@ -1,16 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Braces } from "lucide-react";
3
- const columnTypeChoicesOf = (types, _)=>types.map(({ label, icon, example }, index)=>({
3
+ const columnTypeChoicesOf = (types, labels)=>types.map(({ label, icon, example }, index)=>({
4
4
  id: String(index),
5
5
  label,
6
6
  icon,
7
- allowedValuesPlaceholder: _({
8
- id: 'decision-text.allowed_values_example',
9
- message: 'e.g. {example}',
10
- values: {
11
- example
12
- }
13
- })
7
+ allowedValuesPlaceholder: labels.allowedValuesExample(example)
14
8
  }));
15
9
  const columnTypeIndexOf = (types, type)=>types.findIndex((option)=>option.type === type);
16
10
  const glyphOf = (types, type)=>types.find((option)=>option.type === type)?.icon ?? /*#__PURE__*/ jsx(Braces, {});
@@ -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,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;IAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAA;CAAE,GAClF;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE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B,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,uBAAuB,EAC3E,SAAS,SAAS,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EACvD,MAAM,IAAI,KACT,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,GAAG,SAI/D,CAAC;AAGJ,MAAM,MAAM,kBAAkB,GAC1B;I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