@nyaruka/temba-components 0.139.0 → 0.140.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.
- package/.github/workflows/cla.yml +1 -1
- package/.github/workflows/copilot-setup-steps.yml +6 -1
- package/CHANGELOG.md +17 -0
- package/demo/data/flows/sample-flow.json +24 -0
- package/dist/temba-components.js +562 -296
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/display/Chat.js +10 -7
- package/out-tsc/src/display/Chat.js.map +1 -1
- package/out-tsc/src/display/Dropdown.js +3 -1
- package/out-tsc/src/display/Dropdown.js.map +1 -1
- package/out-tsc/src/display/FloatingTab.js +3 -3
- package/out-tsc/src/display/FloatingTab.js.map +1 -1
- package/out-tsc/src/display/Thumbnail.js +163 -5
- package/out-tsc/src/display/Thumbnail.js.map +1 -1
- package/out-tsc/src/flow/CanvasNode.js +64 -22
- package/out-tsc/src/flow/CanvasNode.js.map +1 -1
- package/out-tsc/src/flow/Editor.js +142 -8
- package/out-tsc/src/flow/Editor.js.map +1 -1
- package/out-tsc/src/flow/NodeEditor.js +118 -10
- package/out-tsc/src/flow/NodeEditor.js.map +1 -1
- package/out-tsc/src/flow/StickyNote.js +13 -4
- package/out-tsc/src/flow/StickyNote.js.map +1 -1
- package/out-tsc/src/flow/actions/audio-player.js +112 -0
- package/out-tsc/src/flow/actions/audio-player.js.map +1 -0
- package/out-tsc/src/flow/actions/enter_flow.js +43 -0
- package/out-tsc/src/flow/actions/enter_flow.js.map +1 -0
- package/out-tsc/src/flow/actions/play_audio.js +57 -4
- package/out-tsc/src/flow/actions/play_audio.js.map +1 -1
- package/out-tsc/src/flow/actions/say_msg.js +86 -3
- package/out-tsc/src/flow/actions/say_msg.js.map +1 -1
- package/out-tsc/src/flow/config.js +11 -3
- package/out-tsc/src/flow/config.js.map +1 -1
- package/out-tsc/src/flow/nodes/shared-rules.js +1 -1
- package/out-tsc/src/flow/nodes/shared-rules.js.map +1 -1
- package/out-tsc/src/flow/nodes/terminal.js +7 -0
- package/out-tsc/src/flow/nodes/terminal.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_audio.js +77 -0
- package/out-tsc/src/flow/nodes/wait_for_audio.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_dial.js +151 -0
- package/out-tsc/src/flow/nodes/wait_for_dial.js.map +1 -0
- package/out-tsc/src/flow/nodes/wait_for_digits.js +61 -1
- package/out-tsc/src/flow/nodes/wait_for_digits.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_menu.js +173 -2
- package/out-tsc/src/flow/nodes/wait_for_menu.js.map +1 -1
- package/out-tsc/src/flow/operators.js +21 -5
- package/out-tsc/src/flow/operators.js.map +1 -1
- package/out-tsc/src/flow/types.js.map +1 -1
- package/out-tsc/src/flow/utils.js +79 -3
- package/out-tsc/src/flow/utils.js.map +1 -1
- package/out-tsc/src/form/ArrayEditor.js +4 -2
- package/out-tsc/src/form/ArrayEditor.js.map +1 -1
- package/out-tsc/src/form/FieldRenderer.js +49 -0
- package/out-tsc/src/form/FieldRenderer.js.map +1 -1
- package/out-tsc/src/interfaces.js +1 -0
- package/out-tsc/src/interfaces.js.map +1 -1
- package/out-tsc/src/layout/Dialog.js +52 -7
- package/out-tsc/src/layout/Dialog.js.map +1 -1
- package/out-tsc/src/live/TembaChart.js.map +1 -1
- package/out-tsc/src/simulator/Simulator.js +10 -4
- package/out-tsc/src/simulator/Simulator.js.map +1 -1
- package/out-tsc/src/store/AppState.js +89 -3
- package/out-tsc/src/store/AppState.js.map +1 -1
- package/out-tsc/test/actions/play_audio.test.js +118 -0
- package/out-tsc/test/actions/play_audio.test.js.map +1 -0
- package/out-tsc/test/actions/say_msg.test.js +158 -0
- package/out-tsc/test/actions/say_msg.test.js.map +1 -0
- package/out-tsc/test/nodes/wait_for_audio.test.js +156 -0
- package/out-tsc/test/nodes/wait_for_audio.test.js.map +1 -0
- package/out-tsc/test/nodes/wait_for_dial.test.js +336 -0
- package/out-tsc/test/nodes/wait_for_dial.test.js.map +1 -0
- package/out-tsc/test/nodes/wait_for_digits.test.js +198 -84
- package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_menu.test.js +340 -0
- package/out-tsc/test/nodes/wait_for_menu.test.js.map +1 -0
- package/out-tsc/test/temba-flow-collision.test.js +261 -6
- package/out-tsc/test/temba-flow-collision.test.js.map +1 -1
- package/out-tsc/test/temba-node-type-selector.test.js +6 -6
- package/out-tsc/test/temba-node-type-selector.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/actions/play_audio/editor/expression-url.png +0 -0
- package/screenshots/truth/actions/play_audio/editor/static-url.png +0 -0
- package/screenshots/truth/actions/play_audio/render/expression-url.png +0 -0
- package/screenshots/truth/actions/play_audio/render/static-url.png +0 -0
- package/screenshots/truth/actions/say_msg/editor/multiline-text.png +0 -0
- package/screenshots/truth/actions/say_msg/editor/simple-text.png +0 -0
- package/screenshots/truth/actions/say_msg/editor/text-with-audio-url.png +0 -0
- package/screenshots/truth/actions/say_msg/render/multiline-text.png +0 -0
- package/screenshots/truth/actions/say_msg/render/simple-text.png +0 -0
- package/screenshots/truth/actions/say_msg/render/text-with-audio-url.png +0 -0
- package/screenshots/truth/editor/router.png +0 -0
- package/screenshots/truth/editor/wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_audio/editor/basic-audio-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_audio/render/basic-audio-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_dial/editor/basic-dial.png +0 -0
- package/screenshots/truth/nodes/wait_for_dial/editor/dial-with-limits.png +0 -0
- package/screenshots/truth/nodes/wait_for_dial/render/basic-dial.png +0 -0
- package/screenshots/truth/nodes/wait_for_dial/render/dial-with-limits.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/digits-with-rules.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/digits-with-rules.png +0 -0
- package/screenshots/truth/nodes/wait_for_menu/editor/menu-with-digits.png +0 -0
- package/screenshots/truth/nodes/wait_for_menu/render/menu-with-digits.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
- package/src/display/Chat.ts +13 -7
- package/src/display/Dropdown.ts +3 -1
- package/src/display/FloatingTab.ts +3 -3
- package/src/display/Thumbnail.ts +162 -2
- package/src/flow/CanvasNode.ts +69 -23
- package/src/flow/Editor.ts +156 -13
- package/src/flow/NodeEditor.ts +137 -9
- package/src/flow/StickyNote.ts +14 -4
- package/src/flow/actions/audio-player.ts +127 -0
- package/src/flow/actions/enter_flow.ts +44 -0
- package/src/flow/actions/play_audio.ts +64 -5
- package/src/flow/actions/say_msg.ts +94 -4
- package/src/flow/config.ts +11 -3
- package/src/flow/nodes/shared-rules.ts +1 -1
- package/src/flow/nodes/terminal.ts +9 -0
- package/src/flow/nodes/wait_for_audio.ts +88 -0
- package/src/flow/nodes/wait_for_dial.ts +176 -0
- package/src/flow/nodes/wait_for_digits.ts +86 -2
- package/src/flow/nodes/wait_for_menu.ts +209 -3
- package/src/flow/operators.ts +23 -5
- package/src/flow/types.ts +23 -1
- package/src/flow/utils.ts +82 -3
- package/src/form/ArrayEditor.ts +4 -2
- package/src/form/FieldRenderer.ts +64 -1
- package/src/interfaces.ts +2 -1
- package/src/layout/Dialog.ts +53 -7
- package/src/live/TembaChart.ts +1 -1
- package/src/simulator/Simulator.ts +13 -4
- package/src/store/AppState.ts +105 -1
- package/src/store/flow-definition.d.ts +2 -0
- package/test/actions/play_audio.test.ts +155 -0
- package/test/actions/say_msg.test.ts +196 -0
- package/test/nodes/wait_for_audio.test.ts +182 -0
- package/test/nodes/wait_for_dial.test.ts +382 -0
- package/test/nodes/wait_for_digits.test.ts +233 -109
- package/test/nodes/wait_for_menu.test.ts +383 -0
- package/test/temba-flow-collision.test.ts +286 -6
- package/test/temba-node-type-selector.test.ts +6 -6
- package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait_for_menu.js","sourceRoot":"","sources":["../../../../src/flow/nodes/wait_for_menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/D,MAAM,CAAC,MAAM,aAAa,GAAe;IACvC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,yBAAyB;IAC/B,KAAK,EAAE,YAAY,CAAC,IAAI;IACxB,SAAS,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC;CAC7B,CAAC","sourcesContent":["import { SPLIT_GROUPS, NodeConfig, FlowTypes } from '../types';\n\nexport const wait_for_menu: NodeConfig = {\n type: 'wait_for_menu',\n name: 'Wait for Menu Selection',\n group: SPLIT_GROUPS.wait,\n flowTypes: [FlowTypes.VOICE]\n};\n"]}
|
|
1
|
+
{"version":3,"file":"wait_for_menu.js","sourceRoot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E,KAAK;gBACX,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,CAAC;iBACT;aACF;SACF,CAAC;QAEF,IAAI,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC/D,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACnD,CAAC;QAED,OAAO;YACL,GAAG,YAAY;YACf,MAAM;YACN,KAAK;SACN,CAAC;IACJ,CAAC;IACD,WAAW,EAAE,YAAY;IACzB,sBAAsB,EAAE,gCAAgC;IACxD,wBAAwB,EAAE,gCAAgC;CAC3D,CAAC","sourcesContent":["import { SPLIT_GROUPS, FormData, NodeConfig, FlowTypes } from '../types';\nimport { Node, Category, Exit } from '../../store/flow-definition';\nimport { generateUUID } from '../../utils';\nimport {\n resultNameField,\n categoriesToLocalizationFormData,\n localizationFormDataToCategories\n} from './shared';\n\n// Menu digits in display order: 1-9 then 0\nconst MENU_DIGITS = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];\n\nfunction digitFieldKey(digit: string): string {\n return `digit_${digit}`;\n}\n\nexport const wait_for_menu: NodeConfig = {\n type: 'wait_for_menu',\n name: 'Wait for Menu',\n group: SPLIT_GROUPS.wait,\n flowTypes: [FlowTypes.VOICE],\n form: {\n ...Object.fromEntries(\n MENU_DIGITS.map((digit) => [\n digitFieldKey(digit),\n {\n type: 'text' as const,\n required: false,\n placeholder: '',\n flavor: 'xsmall' as const\n }\n ])\n ),\n result_name: resultNameField\n },\n layout: [\n {\n type: 'row' as const,\n items: ['digit_1', 'digit_2', 'digit_3'],\n gap: '2rem',\n marginBottom: '0.5rem',\n inlineLabels: { digit_1: '1', digit_2: '2', digit_3: '3' }\n },\n {\n type: 'row' as const,\n items: ['digit_4', 'digit_5', 'digit_6'],\n gap: '2rem',\n marginBottom: '0.5rem',\n inlineLabels: { digit_4: '4', digit_5: '5', digit_6: '6' }\n },\n {\n type: 'row' as const,\n items: ['digit_7', 'digit_8', 'digit_9'],\n gap: '2rem',\n marginBottom: '0.5rem',\n inlineLabels: { digit_7: '7', digit_8: '8', digit_9: '9' }\n },\n {\n type: 'row' as const,\n items: [\n { type: 'spacer' as const },\n 'digit_0',\n { type: 'spacer' as const }\n ],\n gap: '2rem',\n inlineLabels: { digit_0: '0' }\n },\n 'result_name'\n ],\n toFormData: (node: Node) => {\n const formData: FormData = {\n uuid: node.uuid,\n result_name: node.router?.result_name || ''\n };\n\n // Initialize all digit fields as empty\n for (const digit of MENU_DIGITS) {\n formData[digitFieldKey(digit)] = '';\n }\n\n // Fill in category names from cases\n if (node.router?.cases && node.router?.categories) {\n for (const case_ of node.router.cases) {\n if (case_.type === 'has_number_eq' && case_.arguments?.[0]) {\n const digit = case_.arguments[0];\n const category = node.router.categories.find(\n (cat: Category) => cat.uuid === case_.category_uuid\n );\n if (category && MENU_DIGITS.includes(digit)) {\n formData[digitFieldKey(digit)] = category.name;\n }\n }\n }\n }\n\n return formData;\n },\n fromFormData: (formData: FormData, originalNode: Node): Node => {\n const existingCategories = originalNode.router?.categories || [];\n const existingExits = originalNode.exits || [];\n const existingCases = originalNode.router?.cases || [];\n\n const categories: Category[] = [];\n const exits: Exit[] = [];\n const cases: any[] = [];\n\n // Build categories and cases for each filled digit\n for (const digit of MENU_DIGITS) {\n const categoryName = (formData[digitFieldKey(digit)] || '').trim();\n if (!categoryName) continue;\n\n // Check if a category with this name already exists in our new list\n let category = categories.find((c) => c.name === categoryName);\n\n if (!category) {\n // Try to find existing category with same name to preserve UUIDs\n const existingCat = existingCategories.find(\n (c: Category) => c.name === categoryName\n );\n\n if (existingCat) {\n category = existingCat;\n const existingExit = existingExits.find(\n (e: Exit) => e.uuid === existingCat.exit_uuid\n );\n categories.push(category);\n exits.push(\n existingExit || {\n uuid: existingCat.exit_uuid,\n destination_uuid: null\n }\n );\n } else {\n const exitUuid = generateUUID();\n category = {\n uuid: generateUUID(),\n name: categoryName,\n exit_uuid: exitUuid\n };\n categories.push(category);\n exits.push({ uuid: exitUuid, destination_uuid: null });\n }\n }\n\n // Find existing case for this digit to preserve UUID\n const existingCase = existingCases.find(\n (c: any) => c.type === 'has_number_eq' && c.arguments?.[0] === digit\n );\n\n cases.push({\n uuid: existingCase?.uuid || generateUUID(),\n type: 'has_number_eq',\n arguments: [digit],\n category_uuid: category.uuid\n });\n }\n\n // Add \"Other\" default category\n const existingOther = existingCategories.find(\n (c: Category) => c.name === 'Other'\n );\n\n let otherCategory: Category;\n if (existingOther) {\n otherCategory = existingOther;\n const existingExit = existingExits.find(\n (e: Exit) => e.uuid === existingOther.exit_uuid\n );\n exits.push(\n existingExit || {\n uuid: existingOther.exit_uuid,\n destination_uuid: null\n }\n );\n } else {\n const exitUuid = generateUUID();\n otherCategory = {\n uuid: generateUUID(),\n name: 'Other',\n exit_uuid: exitUuid\n };\n exits.push({ uuid: exitUuid, destination_uuid: null });\n }\n categories.push(otherCategory);\n\n const router: any = {\n type: 'switch',\n operand: '@input.text',\n default_category_uuid: otherCategory.uuid,\n cases,\n categories,\n wait: {\n type: 'msg',\n hint: {\n type: 'digits',\n count: 1\n }\n }\n };\n\n if (formData.result_name && formData.result_name.trim() !== '') {\n router.result_name = formData.result_name.trim();\n }\n\n return {\n ...originalNode,\n router,\n exits\n };\n },\n localizable: 'categories',\n toLocalizationFormData: categoriesToLocalizationFormData,\n fromLocalizationFormData: localizationFormDataToCategories\n};\n"]}
|
|
@@ -34,11 +34,6 @@ export const OPERATORS = [
|
|
|
34
34
|
operands: 0,
|
|
35
35
|
categoryName: 'Has Text'
|
|
36
36
|
},
|
|
37
|
-
{
|
|
38
|
-
type: 'has_pattern',
|
|
39
|
-
name: 'matches regex',
|
|
40
|
-
operands: 1
|
|
41
|
-
},
|
|
42
37
|
// Number operators
|
|
43
38
|
{
|
|
44
39
|
type: 'has_number',
|
|
@@ -165,6 +160,11 @@ export const OPERATORS = [
|
|
|
165
160
|
operands: 0,
|
|
166
161
|
categoryName: 'Not Empty',
|
|
167
162
|
visibility: 'hidden'
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'has_pattern',
|
|
166
|
+
name: 'matches regex',
|
|
167
|
+
operands: 1
|
|
168
168
|
}
|
|
169
169
|
];
|
|
170
170
|
// Get operators suitable for wait_for_response rules
|
|
@@ -172,6 +172,22 @@ export const getWaitForResponseOperators = () => {
|
|
|
172
172
|
return OPERATORS.filter((op) => op.visibility !== 'hidden' && !op.filter // For now, exclude location operators unless we support feature detection
|
|
173
173
|
);
|
|
174
174
|
};
|
|
175
|
+
// Number operator types used for digit-based routing
|
|
176
|
+
const DIGIT_OPERATOR_TYPES = new Set([
|
|
177
|
+
'has_beginning',
|
|
178
|
+
'has_number',
|
|
179
|
+
'has_number_between',
|
|
180
|
+
'has_number_lt',
|
|
181
|
+
'has_number_lte',
|
|
182
|
+
'has_number_eq',
|
|
183
|
+
'has_number_gte',
|
|
184
|
+
'has_number_gt',
|
|
185
|
+
'has_pattern'
|
|
186
|
+
]);
|
|
187
|
+
// Get operators suitable for wait_for_digits rules (number operators + regex)
|
|
188
|
+
export const getDigitOperators = () => {
|
|
189
|
+
return OPERATORS.filter((op) => DIGIT_OPERATOR_TYPES.has(op.type));
|
|
190
|
+
};
|
|
175
191
|
// Get operator configuration by type
|
|
176
192
|
export const getOperatorConfig = (type) => {
|
|
177
193
|
return OPERATORS.find((op) => op.type === type);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../../src/flow/operators.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,4EAA4E;AAW5E,2CAA2C;AAC3C,MAAM,CAAC,MAAM,SAAS,GAAqB;IACzC,iBAAiB;IACjB;QACE,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,sBAAsB;QAC5B,QAAQ,EAAE,CAAC;KACZ;IACD;QACE,IAAI,EAAE,eAAe;QACrB,IAAI,EA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CAAC;AACJ,CAAC,CAAC;AAEF,qDAAqD;AACrD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,aAAa;CACd,CAAC,CAAC;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAqB,EAAE;IACtD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF,qCAAqC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAA8B,EAAE;IAC5E,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,sCAAsC;AACtC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAA2B,EAAE,EAAE;IACtE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5B,KAAK,EAAE,EAAE,CAAC,IAAI;QACd,IAAI,EAAE,EAAE,CAAC,IAAI;KACd,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,kDAAkD;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAY,EACqB,EAAE;IACnC,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO;QACL,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;KAClC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Flow router operator configurations\n// These define the available operators for rule-based routing in flow nodes\n\nexport interface OperatorConfig {\n type: string;\n name: string;\n operands: number; // Number of operands required (0 = no input needed, 1 = single value, 2 = two values)\n categoryName?: string; // Default category name when operands is 0\n visibility?: 'hidden' | 'visible'; // Whether to show in UI\n filter?: string; // Feature filter requirement\n}\n\n// All available operators for flow routing\nexport const OPERATORS: OperatorConfig[] = [\n // Text operators\n {\n type: 'has_any_word',\n name: 'has any of the words',\n operands: 1\n },\n {\n type: 'has_all_words',\n name: 'has all of the words',\n operands: 1\n },\n {\n type: 'has_phrase',\n name: 'has the phrase',\n operands: 1\n },\n {\n type: 'has_only_phrase',\n name: 'has only the phrase',\n operands: 1\n },\n {\n type: 'has_beginning',\n name: 'starts with',\n operands: 1\n },\n {\n type: 'has_text',\n name: 'has some text',\n operands: 0,\n categoryName: 'Has Text'\n },\n\n // Number operators\n {\n type: 'has_number',\n name: 'has a number',\n operands: 0,\n categoryName: 'Has Number'\n },\n {\n type: 'has_number_between',\n name: 'has a number between',\n operands: 2\n },\n {\n type: 'has_number_lt',\n name: 'has a number below',\n operands: 1\n },\n {\n type: 'has_number_lte',\n name: 'has a number at or below',\n operands: 1\n },\n {\n type: 'has_number_eq',\n name: 'has a number equal to',\n operands: 1\n },\n {\n type: 'has_number_gte',\n name: 'has a number at or above',\n operands: 1\n },\n {\n type: 'has_number_gt',\n name: 'has a number above',\n operands: 1\n },\n\n // Date operators\n {\n type: 'has_date',\n name: 'has a date',\n operands: 0,\n categoryName: 'Has Date'\n },\n {\n type: 'has_date_lt',\n name: 'has a date before',\n operands: 1\n },\n {\n type: 'has_date_eq',\n name: 'has a date equal to',\n operands: 1\n },\n {\n type: 'has_date_gt',\n name: 'has a date after',\n operands: 1\n },\n {\n type: 'has_time',\n name: 'has a time',\n operands: 0,\n categoryName: 'Has Time'\n },\n\n // Contact data operators\n {\n type: 'has_phone',\n name: 'has a phone number',\n operands: 0,\n categoryName: 'Has Phone'\n },\n {\n type: 'has_email',\n name: 'has an email',\n operands: 0,\n categoryName: 'Has Email'\n },\n\n // Location operators (require location feature)\n {\n type: 'has_state',\n name: 'has state',\n operands: 0,\n categoryName: 'Has State',\n filter: 'HAS_LOCATIONS'\n },\n {\n type: 'has_district',\n name: 'has district',\n operands: 1,\n categoryName: 'Has District',\n filter: 'HAS_LOCATIONS'\n },\n {\n type: 'has_ward',\n name: 'has ward',\n operands: 2,\n categoryName: 'Has Ward',\n filter: 'HAS_LOCATIONS'\n },\n\n // Hidden/system operators\n {\n type: 'has_group',\n name: 'is in the group',\n operands: 1,\n visibility: 'hidden'\n },\n {\n type: 'has_category',\n name: 'has the category',\n operands: 0,\n visibility: 'hidden'\n },\n {\n type: 'has_error',\n name: 'has an error',\n operands: 0,\n categoryName: 'Has Error',\n visibility: 'hidden'\n },\n {\n type: 'has_value',\n name: 'is not empty',\n operands: 0,\n categoryName: 'Not Empty',\n visibility: 'hidden'\n },\n {\n type: 'has_pattern',\n name: 'matches regex',\n operands: 1\n }\n];\n\n// Get operators suitable for wait_for_response rules\nexport const getWaitForResponseOperators = (): OperatorConfig[] => {\n return OPERATORS.filter(\n (op) => op.visibility !== 'hidden' && !op.filter // For now, exclude location operators unless we support feature detection\n );\n};\n\n// Number operator types used for digit-based routing\nconst DIGIT_OPERATOR_TYPES = new Set([\n 'has_beginning',\n 'has_number',\n 'has_number_between',\n 'has_number_lt',\n 'has_number_lte',\n 'has_number_eq',\n 'has_number_gte',\n 'has_number_gt',\n 'has_pattern'\n]);\n\n// Get operators suitable for wait_for_digits rules (number operators + regex)\nexport const getDigitOperators = (): OperatorConfig[] => {\n return OPERATORS.filter((op) => DIGIT_OPERATOR_TYPES.has(op.type));\n};\n\n// Get operator configuration by type\nexport const getOperatorConfig = (type: string): OperatorConfig | undefined => {\n return OPERATORS.find((op) => op.type === type);\n};\n\n// Convert operators to select options\nexport const operatorsToSelectOptions = (operators: OperatorConfig[]) => {\n return operators.map((op) => ({\n value: op.type,\n name: op.name\n }));\n};\n\n// Create an operator object for select components\nexport const createOperatorOption = (\n type: string\n): { value: string; name: string } => {\n const config = getOperatorConfig(type);\n return {\n value: type,\n name: config ? config.name : type\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/flow/types.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,YAAY;CAChB,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,EAAE,EAAE,IAAI;IACR,OAAO,EAAE,SAAS;CACV,CAAC;AA+QX;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACN,CAAC;AAeX;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAuC;IACvE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;QACpB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,mDAAmD;KACjE;IACD,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,yCAAyC;KACvD;IACD,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;QACpB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,iCAAiC;KAC/C;IACD,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxB,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,iCAAiC;KAC/C;IACD,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;QACzB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,qDAAqD;KACnE;IACD,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QACvB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,qCAAqC;KACnD;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsC;IACrE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QACnB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,2CAA2C;KACzD;IACD,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QACpB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,oCAAoC;KAClD;CACF,CAAC","sourcesContent":["import { TemplateResult } from 'lit-html';\nimport { Action, Node, NodeUI } from '../store/flow-definition';\n\nexport interface ValidationResult {\n valid: boolean;\n errors: { [key: string]: string };\n}\n\n/**\n * Flow types - defines the type of flow being edited\n */\nexport const FlowTypes = {\n MESSAGE: 'message',\n VOICE: 'voice',\n BACKGROUND: 'background'\n} as const;\n\nexport type FlowType = (typeof FlowTypes)[keyof typeof FlowTypes];\n\n/**\n * Features - defines the features available in the account\n */\nexport const Features = {\n AI: 'ai',\n AIRTIME: 'airtime'\n} as const;\n\nexport type Feature = (typeof Features)[keyof typeof Features];\n\n// Component attribute interfaces - these define what's allowed for each component type\nexport interface TextInputAttributes {\n type?: 'text' | 'email' | 'number' | 'url' | 'tel';\n placeholder?: string;\n clearable?: boolean;\n maxlength?: number;\n gsm?: boolean;\n autogrow?: boolean;\n textarea?: boolean;\n submitOnEnter?: boolean;\n}\n\nexport interface CompletionAttributes {\n placeholder?: string;\n clearable?: boolean;\n maxlength?: number;\n gsm?: boolean;\n autogrow?: boolean;\n textarea?: boolean;\n expressions?: string;\n counter?: string;\n minHeight?: number;\n}\n\nexport interface SelectAttributes {\n placeholder?: string;\n multi?: boolean;\n searchable?: boolean;\n tags?: boolean;\n emails?: boolean;\n clearable?: boolean;\n endpoint?: string;\n valueKey?: string;\n nameKey?: string;\n queryParam?: string;\n maxItems?: number;\n maxItemsText?: string;\n expressions?: string;\n options?: Array<{ name: string; value: any }>;\n sorted?: boolean;\n allowCreate?: boolean;\n jsonValue?: boolean;\n spaceSelect?: boolean;\n infoText?: string;\n}\n\nexport interface CheckboxAttributes {\n label?: string;\n size?: number;\n disabled?: boolean;\n animateChange?: string;\n}\n\nexport interface SliderAttributes {\n min?: number;\n max?: number;\n range?: boolean;\n}\n\nexport interface FormData extends Record<string, any> {}\n\nexport interface FormConfig {\n form?: Record<string, FieldConfig>;\n layout?: LayoutItem[];\n gutter?: LayoutItem[];\n sanitize?: (formData: FormData) => void;\n validate?: (formData: FormData) => ValidationResult;\n}\n\nexport interface NodeConfig extends FormConfig {\n type: string;\n name?: string;\n aliases?: string[]; // alternate type names for backwards compatibility (won't show in selector)\n group?: ActionGroup | SplitGroup; // Nodes can use either when showAsAction is true\n dialogSize?: 'small' | 'medium' | 'large' | 'xlarge';\n action?: ActionConfig;\n showAsAction?: boolean; // if true, show in action dialog instead of splits (default: false - nodes show in splits)\n flowTypes?: FlowType[]; // which flow types this node is available for (defaults to all if not specified)\n features?: Feature[]; // which features are required for this node (all must be present)\n router?: {\n type: 'switch' | 'random';\n defaultCategory?: string;\n operand?: string;\n configurable?: boolean; // can the rules be configured in the UI\n rules?: {\n type:\n | 'has_number_between'\n | 'has_string'\n | 'has_value'\n | 'has_not_value'\n | 'has_text';\n arguments: string[];\n categoryName: string;\n }[];\n };\n\n toFormData?: (node: Node, nodeUI?: any) => FormData;\n fromFormData?: (formData: FormData, originalNode: Node) => Node;\n toUIConfig?: (formData: FormData) => Record<string, any>;\n render?: (node: Node, nodeUI?: any) => TemplateResult;\n renderTitle?: (node: Node, nodeUI?: NodeUI) => TemplateResult;\n\n // Localization support for router categories\n localizable?: 'categories'; // Only categories are localizable for routers\n toLocalizationFormData?: (\n node: Node,\n localization: Record<string, any>\n ) => FormData;\n fromLocalizationFormData?: (\n formData: FormData,\n node: Node\n ) => Record<string, any>;\n}\n\n// New field configuration system for generic form generation\nexport interface BaseFieldConfig {\n label?: string | ((formData: Record<string, any>) => string);\n required?: boolean;\n evaluated?: boolean;\n dependsOn?: string[];\n computeValue?: (\n values: Record<string, any>,\n currentValue: any,\n originalValues?: Record<string, any>\n ) => any;\n\n // Validation properties\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n helpText?: string;\n\n // Layout properties\n maxWidth?: string;\n width?: string;\n\n // Conditional rendering\n conditions?: {\n visible?: (formData: Record<string, any>) => boolean;\n disabled?: (formData: Record<string, any>) => boolean;\n };\n\n // Optional field with reveal link\n // When set, the field is hidden by default and a link with this text is shown\n // Clicking the link reveals the field permanently (can't be hidden again)\n optionalLink?: string;\n}\n\nexport interface TextFieldConfig extends BaseFieldConfig {\n type: 'text';\n placeholder?: string;\n flavor?: 'xsmall' | 'small' | 'large';\n}\n\nexport interface TextareaFieldConfig extends BaseFieldConfig {\n type: 'textarea';\n placeholder?: string;\n rows?: number;\n minHeight?: number;\n}\n\nexport interface SelectFieldConfig extends BaseFieldConfig {\n type: 'select';\n options?: string[] | { value: string; name: string }[];\n multi?: boolean;\n clearable?: boolean;\n searchable?: boolean;\n tags?: boolean;\n placeholder?: string;\n maxItems?: number;\n valueKey?: string;\n nameKey?: string;\n endpoint?: string;\n emails?: boolean;\n getName?: (item: any) => string;\n flavor?: 'xsmall' | 'small' | 'large';\n createArbitraryOption?: (input: string, options: any[]) => any;\n allowCreate?: boolean;\n getDynamicOptions?: () => Array<{ value: string; name: string }>;\n}\n\nexport interface KeyValueFieldConfig extends BaseFieldConfig {\n type: 'key-value';\n sortable?: boolean;\n keyPlaceholder?: string;\n valuePlaceholder?: string;\n minRows?: number;\n}\n\nexport interface ArrayFieldConfig extends BaseFieldConfig {\n type: 'array';\n itemConfig: Record<string, FieldConfig>;\n sortable?: boolean;\n minItems?: number;\n maxItems?: number;\n itemLabel?: string;\n maintainEmptyItem?: boolean;\n onItemChange?: (\n itemIndex: number,\n field: string,\n value: any,\n allItems: any[]\n ) => any[];\n isEmptyItem?: (item: any) => boolean;\n}\n\nexport interface CheckboxFieldConfig extends BaseFieldConfig {\n type: 'checkbox';\n size?: number;\n animateChange?: string;\n labelPadding?: string;\n}\n\nexport interface MessageEditorFieldConfig extends BaseFieldConfig {\n type: 'message-editor';\n placeholder?: string;\n minHeight?: number;\n maxAttachments?: number;\n accept?: string;\n endpoint?: string;\n counter?: string;\n gsm?: boolean;\n autogrow?: boolean;\n disableCompletion?: boolean;\n}\n\nexport type FieldConfig =\n | TextFieldConfig\n | TextareaFieldConfig\n | SelectFieldConfig\n | KeyValueFieldConfig\n | ArrayFieldConfig\n | CheckboxFieldConfig\n | MessageEditorFieldConfig;\n\n// Layout configurations for better form organization\n// Recursive layout system - any layout item can contain other layout items\n\nexport interface FieldItemConfig {\n type: 'field';\n field: string; // field name to render\n}\n\nexport interface RowLayoutConfig {\n type: 'row';\n items: LayoutItem[]; // can contain fields, groups, or other rows\n gap?: string; // CSS gap value, defaults to '1rem'\n label?: string; // optional label for the entire row\n helpText?: string; // optional help text for the entire row\n}\n\nexport interface GroupLayoutConfig {\n type: 'group';\n label: string;\n items: LayoutItem[]; // can contain fields, rows, or other groups\n collapsible?: boolean;\n collapsed?: boolean | ((formData: FormData) => boolean); // initial state if collapsible - can be a function\n helpText?: string;\n getGroupValueCount?: (formData: FormData) => number; // optional function to get count for bubble display\n}\n\nexport type LayoutItem =\n | FieldItemConfig\n | RowLayoutConfig\n | GroupLayoutConfig\n | string; // string is shorthand for field\n\n/**\n * Action group constants - single source of truth for action categorization\n * Use as const for compile-time type checking\n */\nexport const ACTION_GROUPS = {\n send: 'send',\n contacts: 'contacts',\n save: 'save',\n services: 'services',\n broadcast: 'broadcast',\n trigger: 'trigger'\n} as const;\n\n/**\n * Split group constants - single source of truth for split categorization\n * Use as const for compile-time type checking\n */\nexport const SPLIT_GROUPS = {\n wait: 'wait',\n split: 'split'\n} as const;\n\n// Extract types from const objects for compile-time checking\nexport type ActionGroup = (typeof ACTION_GROUPS)[keyof typeof ACTION_GROUPS];\nexport type SplitGroup = (typeof SPLIT_GROUPS)[keyof typeof SPLIT_GROUPS];\n\n/**\n * Metadata for group display\n */\nexport interface GroupMetadata {\n color: string;\n title: string;\n description: string;\n}\n\n/**\n * Action group metadata - defines display properties for each action group\n * Order in this object determines display order in action selector (top to bottom)\n */\nexport const ACTION_GROUP_METADATA: Record<ActionGroup, GroupMetadata> = {\n [ACTION_GROUPS.send]: {\n color: '#3498db',\n title: 'Send',\n description: 'Actions that send messages or content to contacts'\n },\n [ACTION_GROUPS.contacts]: {\n color: '#01c1af',\n title: 'Contact',\n description: 'Actions that update contact information'\n },\n [ACTION_GROUPS.save]: {\n color: '#1a777c',\n title: 'Save',\n description: 'Actions that save or store data'\n },\n [ACTION_GROUPS.services]: {\n color: '#f79035ff',\n title: 'Services',\n description: 'Call external services and APIs'\n },\n [ACTION_GROUPS.broadcast]: {\n color: '#8e5ea7',\n title: 'Other People',\n description: 'Actions that apply to others instead of the contact'\n },\n [ACTION_GROUPS.trigger]: {\n color: '#df419f',\n title: 'Trigger',\n description: 'Actions that trigger other behavior'\n }\n};\n\n/**\n * Split group metadata - defines display properties for each split group\n * Order in this object determines display order in split selector (top to bottom)\n */\nexport const SPLIT_GROUP_METADATA: Record<SplitGroup, GroupMetadata> = {\n [SPLIT_GROUPS.wait]: {\n color: '#4d7dad',\n title: 'Wait',\n description: 'Wait for user and split on their response'\n },\n [SPLIT_GROUPS.split]: {\n color: '#aaaaaa',\n title: 'Split',\n description: 'Split the flow based on conditions'\n }\n};\n\nexport interface ActionConfig extends FormConfig {\n name: string;\n aliases?: string[]; // alternate type names for backwards compatibility (won't show in selector)\n group: ActionGroup;\n dialogSize?: 'small' | 'medium' | 'large' | 'xlarge';\n evaluated?: string[];\n hideFromActions?: boolean; // if true, don't show in action dialog (default: false - actions show in actions)\n flowTypes?: FlowType[]; // which flow types this action is available for (defaults to all if not specified)\n features?: Feature[]; // which features are required for this action (all must be present)\n render?: (node: any, action: any) => TemplateResult;\n\n form?: Record<string, FieldConfig>;\n layout?: LayoutItem[]; // optional layout configuration - array of layout items\n gutter?: LayoutItem[]; // fields to render in the dialog gutter (left side of buttons)\n\n toFormData?: (action: Action) => FormData;\n fromFormData?: (formData: FormData) => Action;\n\n // Localization support\n localizable?: string[]; // array of field names that can be localized\n toLocalizationFormData?: (\n action: Action,\n localization: Record<string, any>\n ) => FormData;\n fromLocalizationFormData?: (\n formData: FormData,\n action: Action\n ) => Record<string, any>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/flow/types.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,YAAY;CAChB,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,EAAE,EAAE,IAAI;IACR,OAAO,EAAE,SAAS;CACV,CAAC;AAqSX;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACN,CAAC;AAeX;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAuC;IACvE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;QACpB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,mDAAmD;KACjE;IACD,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,yCAAyC;KACvD;IACD,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;QACpB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,iCAAiC;KAC/C;IACD,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxB,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,iCAAiC;KAC/C;IACD,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;QACzB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,qDAAqD;KACnE;IACD,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QACvB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,qCAAqC;KACnD;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsC;IACrE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QACnB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,MAAM;QACb,WAAW,EAAE,2CAA2C;KACzD;IACD,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QACpB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,oCAAoC;KAClD;CACF,CAAC","sourcesContent":["import { TemplateResult } from 'lit-html';\nimport { Action, Node, NodeUI } from '../store/flow-definition';\n\nexport interface ValidationResult {\n valid: boolean;\n errors: { [key: string]: string };\n}\n\n/**\n * Flow types - defines the type of flow being edited\n */\nexport const FlowTypes = {\n MESSAGE: 'message',\n VOICE: 'voice',\n BACKGROUND: 'background'\n} as const;\n\nexport type FlowType = (typeof FlowTypes)[keyof typeof FlowTypes];\n\n/**\n * Features - defines the features available in the account\n */\nexport const Features = {\n AI: 'ai',\n AIRTIME: 'airtime'\n} as const;\n\nexport type Feature = (typeof Features)[keyof typeof Features];\n\n// Component attribute interfaces - these define what's allowed for each component type\nexport interface TextInputAttributes {\n type?: 'text' | 'email' | 'number' | 'url' | 'tel';\n placeholder?: string;\n clearable?: boolean;\n maxlength?: number;\n gsm?: boolean;\n autogrow?: boolean;\n textarea?: boolean;\n submitOnEnter?: boolean;\n}\n\nexport interface CompletionAttributes {\n placeholder?: string;\n clearable?: boolean;\n maxlength?: number;\n gsm?: boolean;\n autogrow?: boolean;\n textarea?: boolean;\n expressions?: string;\n counter?: string;\n minHeight?: number;\n}\n\nexport interface SelectAttributes {\n placeholder?: string;\n multi?: boolean;\n searchable?: boolean;\n tags?: boolean;\n emails?: boolean;\n clearable?: boolean;\n endpoint?: string;\n valueKey?: string;\n nameKey?: string;\n queryParam?: string;\n maxItems?: number;\n maxItemsText?: string;\n expressions?: string;\n options?: Array<{ name: string; value: any }>;\n sorted?: boolean;\n allowCreate?: boolean;\n jsonValue?: boolean;\n spaceSelect?: boolean;\n infoText?: string;\n}\n\nexport interface CheckboxAttributes {\n label?: string;\n size?: number;\n disabled?: boolean;\n animateChange?: string;\n}\n\nexport interface SliderAttributes {\n min?: number;\n max?: number;\n range?: boolean;\n}\n\nexport interface FormData extends Record<string, any> {}\n\nexport interface FormConfig {\n form?: Record<string, FieldConfig>;\n layout?: LayoutItem[];\n gutter?: LayoutItem[];\n sanitize?: (formData: FormData) => void;\n validate?: (formData: FormData) => ValidationResult;\n}\n\nexport interface NodeConfig extends FormConfig {\n type: string;\n name?: string;\n aliases?: string[]; // alternate type names for backwards compatibility (won't show in selector)\n group?: ActionGroup | SplitGroup; // Nodes can use either when showAsAction is true\n dialogSize?: 'small' | 'medium' | 'large' | 'xlarge';\n action?: ActionConfig;\n showAsAction?: boolean; // if true, show in action dialog instead of splits (default: false - nodes show in splits)\n flowTypes?: FlowType[]; // which flow types this node is available for (defaults to all if not specified)\n features?: Feature[]; // which features are required for this node (all must be present)\n router?: {\n type: 'switch' | 'random';\n defaultCategory?: string;\n operand?: string;\n configurable?: boolean; // can the rules be configured in the UI\n rules?: {\n type:\n | 'has_number_between'\n | 'has_number_eq'\n | 'has_only_text'\n | 'has_string'\n | 'has_value'\n | 'has_not_value'\n | 'has_text';\n arguments: string[];\n categoryName: string;\n }[];\n };\n\n toFormData?: (node: Node, nodeUI?: any) => FormData;\n fromFormData?: (formData: FormData, originalNode: Node) => Node;\n toUIConfig?: (formData: FormData) => Record<string, any>;\n render?: (node: Node, nodeUI?: any) => TemplateResult;\n renderTitle?: (node: Node, nodeUI?: NodeUI) => TemplateResult;\n\n // Localization support for router categories\n localizable?: 'categories'; // Only categories are localizable for routers\n toLocalizationFormData?: (\n node: Node,\n localization: Record<string, any>\n ) => FormData;\n fromLocalizationFormData?: (\n formData: FormData,\n node: Node\n ) => Record<string, any>;\n}\n\n// New field configuration system for generic form generation\nexport interface BaseFieldConfig {\n label?: string | ((formData: Record<string, any>) => string);\n required?: boolean;\n evaluated?: boolean;\n dependsOn?: string[];\n computeValue?: (\n values: Record<string, any>,\n currentValue: any,\n originalValues?: Record<string, any>\n ) => any;\n\n // Validation properties\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n helpText?: string;\n\n // Layout properties\n maxWidth?: string;\n width?: string;\n\n // Conditional rendering\n conditions?: {\n visible?: (formData: Record<string, any>) => boolean;\n disabled?: (formData: Record<string, any>) => boolean;\n };\n\n // Optional field with reveal link\n // When set, the field is hidden by default and a link with this text is shown\n // Clicking the link reveals the field permanently (can't be hidden again)\n optionalLink?: string;\n}\n\nexport interface TextFieldConfig extends BaseFieldConfig {\n type: 'text';\n placeholder?: string;\n flavor?: 'xsmall' | 'small' | 'large';\n}\n\nexport interface TextareaFieldConfig extends BaseFieldConfig {\n type: 'textarea';\n placeholder?: string;\n rows?: number;\n minHeight?: number;\n}\n\nexport interface SelectFieldConfig extends BaseFieldConfig {\n type: 'select';\n options?: string[] | { value: string; name: string }[];\n multi?: boolean;\n clearable?: boolean;\n searchable?: boolean;\n tags?: boolean;\n placeholder?: string;\n maxItems?: number;\n valueKey?: string;\n nameKey?: string;\n endpoint?: string;\n emails?: boolean;\n getName?: (item: any) => string;\n flavor?: 'xsmall' | 'small' | 'large';\n createArbitraryOption?: (input: string, options: any[]) => any;\n allowCreate?: boolean;\n getDynamicOptions?: () => Array<{ value: string; name: string }>;\n}\n\nexport interface KeyValueFieldConfig extends BaseFieldConfig {\n type: 'key-value';\n sortable?: boolean;\n keyPlaceholder?: string;\n valuePlaceholder?: string;\n minRows?: number;\n}\n\nexport interface ArrayFieldConfig extends BaseFieldConfig {\n type: 'array';\n itemConfig: Record<string, FieldConfig>;\n sortable?: boolean;\n minItems?: number;\n maxItems?: number;\n itemLabel?: string;\n maintainEmptyItem?: boolean;\n onItemChange?: (\n itemIndex: number,\n field: string,\n value: any,\n allItems: any[]\n ) => any[];\n isEmptyItem?: (item: any) => boolean;\n}\n\nexport interface CheckboxFieldConfig extends BaseFieldConfig {\n type: 'checkbox';\n size?: number;\n animateChange?: string;\n labelPadding?: string;\n}\n\nexport interface MessageEditorFieldConfig extends BaseFieldConfig {\n type: 'message-editor';\n placeholder?: string;\n minHeight?: number;\n maxAttachments?: number;\n accept?: string;\n endpoint?: string;\n counter?: string;\n gsm?: boolean;\n autogrow?: boolean;\n disableCompletion?: boolean;\n}\n\nexport interface MediaFieldConfig extends BaseFieldConfig {\n type: 'media';\n accept?: string; // MIME filter, e.g. 'audio/*'\n endpoint?: string; // upload endpoint, defaults to DEFAULT_MEDIA_ENDPOINT\n}\n\nexport type FieldConfig =\n | TextFieldConfig\n | TextareaFieldConfig\n | SelectFieldConfig\n | KeyValueFieldConfig\n | ArrayFieldConfig\n | CheckboxFieldConfig\n | MessageEditorFieldConfig\n | MediaFieldConfig;\n\n// Layout configurations for better form organization\n// Recursive layout system - any layout item can contain other layout items\n\nexport interface FieldItemConfig {\n type: 'field';\n field: string; // field name to render\n}\n\nexport interface RowLayoutConfig {\n type: 'row';\n items: LayoutItem[]; // can contain fields, groups, or other rows\n gap?: string; // CSS gap value, defaults to '1rem'\n label?: string; // optional label for the entire row\n helpText?: string; // optional help text for the entire row\n inlineLabels?: Record<string, string>; // map of field name to inline label text\n marginBottom?: string; // CSS margin-bottom for spacing below the row\n}\n\nexport interface GroupLayoutConfig {\n type: 'group';\n label: string;\n items: LayoutItem[]; // can contain fields, rows, or other groups\n collapsible?: boolean;\n collapsed?: boolean | ((formData: FormData) => boolean); // initial state if collapsible - can be a function\n helpText?: string;\n getGroupValueCount?: (formData: FormData) => number; // optional function to get count for bubble display\n}\n\nexport interface SpacerLayoutConfig {\n type: 'spacer';\n}\n\nexport interface TextLayoutConfig {\n type: 'text';\n text: string;\n}\n\nexport type LayoutItem =\n | FieldItemConfig\n | RowLayoutConfig\n | GroupLayoutConfig\n | SpacerLayoutConfig\n | TextLayoutConfig\n | string; // string is shorthand for field\n\n/**\n * Action group constants - single source of truth for action categorization\n * Use as const for compile-time type checking\n */\nexport const ACTION_GROUPS = {\n send: 'send',\n contacts: 'contacts',\n save: 'save',\n services: 'services',\n broadcast: 'broadcast',\n trigger: 'trigger'\n} as const;\n\n/**\n * Split group constants - single source of truth for split categorization\n * Use as const for compile-time type checking\n */\nexport const SPLIT_GROUPS = {\n wait: 'wait',\n split: 'split'\n} as const;\n\n// Extract types from const objects for compile-time checking\nexport type ActionGroup = (typeof ACTION_GROUPS)[keyof typeof ACTION_GROUPS];\nexport type SplitGroup = (typeof SPLIT_GROUPS)[keyof typeof SPLIT_GROUPS];\n\n/**\n * Metadata for group display\n */\nexport interface GroupMetadata {\n color: string;\n title: string;\n description: string;\n}\n\n/**\n * Action group metadata - defines display properties for each action group\n * Order in this object determines display order in action selector (top to bottom)\n */\nexport const ACTION_GROUP_METADATA: Record<ActionGroup, GroupMetadata> = {\n [ACTION_GROUPS.send]: {\n color: '#3498db',\n title: 'Send',\n description: 'Actions that send messages or content to contacts'\n },\n [ACTION_GROUPS.contacts]: {\n color: '#01c1af',\n title: 'Contact',\n description: 'Actions that update contact information'\n },\n [ACTION_GROUPS.save]: {\n color: '#1a777c',\n title: 'Save',\n description: 'Actions that save or store data'\n },\n [ACTION_GROUPS.services]: {\n color: '#f79035ff',\n title: 'Services',\n description: 'Call external services and APIs'\n },\n [ACTION_GROUPS.broadcast]: {\n color: '#8e5ea7',\n title: 'Other People',\n description: 'Actions that apply to others instead of the contact'\n },\n [ACTION_GROUPS.trigger]: {\n color: '#df419f',\n title: 'Trigger',\n description: 'Actions that trigger other behavior'\n }\n};\n\n/**\n * Split group metadata - defines display properties for each split group\n * Order in this object determines display order in split selector (top to bottom)\n */\nexport const SPLIT_GROUP_METADATA: Record<SplitGroup, GroupMetadata> = {\n [SPLIT_GROUPS.wait]: {\n color: '#4d7dad',\n title: 'Wait',\n description: 'Wait for user and split on their response'\n },\n [SPLIT_GROUPS.split]: {\n color: '#aaaaaa',\n title: 'Split',\n description: 'Split the flow based on conditions'\n }\n};\n\nexport interface ActionConfig extends FormConfig {\n name: string;\n aliases?: string[]; // alternate type names for backwards compatibility (won't show in selector)\n group: ActionGroup;\n dialogSize?: 'small' | 'medium' | 'large' | 'xlarge';\n evaluated?: string[];\n hideFromActions?: boolean; // if true, don't show in action dialog (default: false - actions show in actions)\n flowTypes?: FlowType[]; // which flow types this action is available for (defaults to all if not specified)\n features?: Feature[]; // which features are required for this action (all must be present)\n render?: (node: any, action: any) => TemplateResult;\n\n form?: Record<string, FieldConfig>;\n layout?: LayoutItem[]; // optional layout configuration - array of layout items\n gutter?: LayoutItem[]; // fields to render in the dialog gutter (left side of buttons)\n\n toFormData?: (action: Action) => FormData;\n fromFormData?: (formData: FormData) => Action;\n\n // Localization support\n localizable?: string[]; // array of field names that can be localized\n toLocalizationFormData?: (\n action: Action,\n localization: Record<string, any>\n ) => FormData;\n fromLocalizationFormData?: (\n formData: FormData,\n action: Action\n ) => Record<string, any>;\n}\n"]}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
+
export function formatIssueMessage(issue) {
|
|
3
|
+
if (issue.dependency) {
|
|
4
|
+
const name = issue.dependency.name || issue.dependency.key;
|
|
5
|
+
return `Cannot find a ${issue.dependency.type} for ${name}`;
|
|
6
|
+
}
|
|
7
|
+
return issue.description;
|
|
8
|
+
}
|
|
2
9
|
const GRID_SIZE = 20;
|
|
3
10
|
export function snapToGrid(value) {
|
|
4
11
|
const snapped = Math.round(value / GRID_SIZE) * GRID_SIZE;
|
|
@@ -270,6 +277,25 @@ export const calculateReflowPositions = (sacredNodeUuids, allBounds) => {
|
|
|
270
277
|
for (const b of allBounds) {
|
|
271
278
|
currentBounds.set(b.uuid, { ...b });
|
|
272
279
|
}
|
|
280
|
+
// A sacred node yields to an existing node at the top of the canvas when
|
|
281
|
+
// the sacred wasn't dropped above it. The existing node keeps its top
|
|
282
|
+
// position and the sacred node moves below instead.
|
|
283
|
+
for (const sacredUuid of [...sacredSet]) {
|
|
284
|
+
const sacred = currentBounds.get(sacredUuid);
|
|
285
|
+
if (!sacred)
|
|
286
|
+
continue;
|
|
287
|
+
for (const [uuid, bounds] of currentBounds) {
|
|
288
|
+
if (uuid === sacredUuid || sacredSet.has(uuid))
|
|
289
|
+
continue;
|
|
290
|
+
if (!nodesOverlap(sacred, bounds))
|
|
291
|
+
continue;
|
|
292
|
+
if (sacred.top > bounds.top && bounds.top < MIN_NODE_SPACING) {
|
|
293
|
+
sacredSet.delete(sacredUuid);
|
|
294
|
+
sacredSet.add(uuid);
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
273
299
|
// Seed the queue with non-sacred nodes that overlap any sacred node
|
|
274
300
|
const queue = [];
|
|
275
301
|
const inQueue = new Set();
|
|
@@ -308,10 +334,47 @@ export const calculateReflowPositions = (sacredNodeUuids, allBounds) => {
|
|
|
308
334
|
}
|
|
309
335
|
if (fixedOverlaps.length === 0)
|
|
310
336
|
continue;
|
|
311
|
-
//
|
|
337
|
+
// Determine direction constraints and axis bias from sacred node overlaps
|
|
338
|
+
const sacredOverlaps = fixedOverlaps.filter((f) => sacredSet.has(f.uuid));
|
|
339
|
+
const allowedDirections = [...DIRECTIONS];
|
|
340
|
+
let axisBias = null;
|
|
341
|
+
if (sacredOverlaps.length > 0) {
|
|
342
|
+
// Rule 1: don't move a lower node above the sacred node
|
|
343
|
+
// Rule 2: don't move a right-of node to the left of the sacred node
|
|
344
|
+
for (const sacred of sacredOverlaps) {
|
|
345
|
+
if (collider.top > sacred.top) {
|
|
346
|
+
const idx = allowedDirections.indexOf('up');
|
|
347
|
+
if (idx !== -1)
|
|
348
|
+
allowedDirections.splice(idx, 1);
|
|
349
|
+
}
|
|
350
|
+
if (collider.left > sacred.left) {
|
|
351
|
+
const idx = allowedDirections.indexOf('left');
|
|
352
|
+
if (idx !== -1)
|
|
353
|
+
allowedDirections.splice(idx, 1);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
// Rule 3: bias direction based on overlap shape
|
|
357
|
+
let totalOverlapWidth = 0;
|
|
358
|
+
let totalOverlapHeight = 0;
|
|
359
|
+
for (const sacred of sacredOverlaps) {
|
|
360
|
+
totalOverlapWidth +=
|
|
361
|
+
Math.min(collider.right, sacred.right) -
|
|
362
|
+
Math.max(collider.left, sacred.left);
|
|
363
|
+
totalOverlapHeight +=
|
|
364
|
+
Math.min(collider.bottom, sacred.bottom) -
|
|
365
|
+
Math.max(collider.top, sacred.top);
|
|
366
|
+
}
|
|
367
|
+
if (totalOverlapWidth > totalOverlapHeight) {
|
|
368
|
+
axisBias = 'vertical'; // wide overlap = nodes stacked = prefer up/down
|
|
369
|
+
}
|
|
370
|
+
else if (totalOverlapHeight > totalOverlapWidth) {
|
|
371
|
+
axisBias = 'horizontal'; // tall overlap = nodes side-by-side = prefer left/right
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// Try each allowed direction, pick the one with least disruption
|
|
312
375
|
let bestPos = null;
|
|
313
376
|
let bestScore = Infinity;
|
|
314
|
-
for (const dir of
|
|
377
|
+
for (const dir of allowedDirections) {
|
|
315
378
|
const candidate = computeDirectionalClearance(collider, fixedOverlaps, dir);
|
|
316
379
|
if (!candidate)
|
|
317
380
|
continue;
|
|
@@ -334,7 +397,20 @@ export const calculateReflowPositions = (sacredNodeUuids, allBounds) => {
|
|
|
334
397
|
continue;
|
|
335
398
|
const distance = Math.abs(candidate.left - collider.left) +
|
|
336
399
|
Math.abs(candidate.top - collider.top);
|
|
337
|
-
|
|
400
|
+
// When colliding with sacred nodes, use axis bias scoring;
|
|
401
|
+
// for cascading collisions (no sacred overlap), use original scoring
|
|
402
|
+
let score;
|
|
403
|
+
if (sacredOverlaps.length > 0) {
|
|
404
|
+
const isVerticalDir = dir === 'up' || dir === 'down';
|
|
405
|
+
const axisMatch = axisBias === null ||
|
|
406
|
+
(axisBias === 'vertical' && isVerticalDir) ||
|
|
407
|
+
(axisBias === 'horizontal' && !isVerticalDir);
|
|
408
|
+
const axisPenalty = axisMatch ? 0 : 5000;
|
|
409
|
+
score = cascadeCount * 2000 + axisPenalty + distance;
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
score = cascadeCount * 10000 + distance;
|
|
413
|
+
}
|
|
338
414
|
if (score < bestScore) {
|
|
339
415
|
bestScore = score;
|
|
340
416
|
bestPos = candidate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/flow/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAC1D,OAAO,IAAI,CAAC,GAA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,KAAK,GAAG,QAAQ,CAAC;YAE9C,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;gBACtB,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO,GAAG,SAAS,CAAC;YACtB,CAAC;QACH,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACjE,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;YACpE,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACnC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAEnB,uCAAuC;YACvC,KAAK,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;gBACrD,IAAI,SAAS,KAAK,IAAI;oBAAE,SAAS;gBACjC,IAAI,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC;oBAAE,SAAS;gBAClE,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;oBAAE,SAAS;gBACrC,IAAI,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC;oBACzC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBACtB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { NamedObject, FlowPosition } from '../store/flow-definition';\n\nconst GRID_SIZE = 20;\n\nexport function snapToGrid(value: number): number {\n const snapped = Math.round(value / GRID_SIZE) * GRID_SIZE;\n return Math.max(snapped, 0);\n}\n\n/**\n * Renders a single line item with optional icon\n */\nexport const renderLineItem = (name: string, icon?: string) => {\n return html`<div style=\"display:flex;items-align:center;\">\n ${icon\n ? html`<temba-icon name=${icon} style=\"margin-right:0.5em\"></temba-icon>`\n : null}\n <div\n style=\"white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px;\"\n >\n ${name}\n </div>\n </div>`;\n};\n\n/**\n * Renders a list of named objects with optional icon, showing up to 3 items\n * with a \"+X more\" indicator if there are more items\n */\nexport const renderNamedObjects = (assets: NamedObject[], icon?: string) => {\n return renderStringList(\n assets.map((asset) => asset.name),\n icon\n );\n};\n\n/**\n * Renders a list of strings with optional icon, showing up to 3 items\n * with a \"+X more\" indicator if there are more items\n */\nexport const renderStringList = (items: string[], icon?: string) => {\n const itemElements = [];\n const maxDisplay = 3;\n\n // Show up to 3 items, or all 4 if exactly 4 items\n const displayCount =\n items.length === 4 ? 4 : Math.min(maxDisplay, items.length);\n\n for (let i = 0; i < displayCount; i++) {\n const item = items[i];\n itemElements.push(renderLineItem(item, icon));\n }\n\n // Add \"+X more\" if there are more than 3 items (and not exactly 4)\n if (items.length > maxDisplay && items.length !== 4) {\n const remainingCount = items.length - maxDisplay;\n itemElements.push(html`<div\n style=\"display:flex;items-align:center;margin-top:0.2em;\"\n >\n ${icon\n ? html`<div style=\"margin-right:0.4em; width: 1em;\"></div>` // spacing placeholder\n : null}\n <div style=\"font-size:0.8em\">+${remainingCount} more</div>\n </div>`);\n }\n return itemElements;\n};\n\nexport interface Scheme {\n scheme: string;\n name: string;\n path: string;\n excludeFromSplit?: boolean;\n}\n\nexport const SCHEMES: Scheme[] = [\n {\n scheme: 'tel',\n name: 'SMS',\n path: 'Phone Number'\n },\n {\n scheme: 'whatsapp',\n name: 'WhatsApp',\n path: 'WhatsApp Number'\n },\n {\n scheme: 'facebook',\n name: 'Facebook',\n path: 'Facebook ID'\n },\n {\n scheme: 'instagram',\n name: 'Instagram',\n path: 'Instagram ID'\n },\n {\n scheme: 'twitterid',\n name: 'Twitter',\n path: 'Twitter ID',\n excludeFromSplit: true\n },\n {\n scheme: 'telegram',\n name: 'Telegram',\n path: 'Telegram ID'\n },\n {\n scheme: 'viber',\n name: 'Viber',\n path: 'Viber ID'\n },\n {\n scheme: 'line',\n name: 'Line',\n path: 'Line ID'\n },\n {\n scheme: 'wechat',\n name: 'WeChat',\n path: 'WeChat ID'\n },\n {\n scheme: 'fcm',\n name: 'Firebase',\n path: 'Firebase ID'\n },\n {\n scheme: 'jiochat',\n name: 'JioChat',\n path: 'JioChat ID'\n },\n {\n scheme: 'freshchat',\n name: 'Freshchat',\n path: 'Freshchat ID'\n },\n {\n scheme: 'mailto',\n name: 'Email',\n path: 'Email Address',\n excludeFromSplit: true\n },\n {\n scheme: 'twitter',\n name: 'Twitter',\n path: 'Twitter Handle',\n excludeFromSplit: true\n },\n {\n scheme: 'vk',\n name: 'VK',\n path: 'VK ID'\n },\n {\n scheme: 'discord',\n name: 'Discord',\n path: 'Discord ID'\n },\n {\n scheme: 'webchat',\n name: 'Webchat',\n path: 'Webchat ID',\n excludeFromSplit: true\n },\n {\n scheme: 'rocketchat',\n name: 'RocketChat',\n path: 'RocketChat ID'\n },\n {\n scheme: 'ext',\n name: 'External',\n path: 'External ID'\n }\n];\n\n/**\n * Represents the bounding box of a node on the canvas\n */\nexport interface NodeBounds {\n uuid: string;\n left: number;\n top: number;\n right: number;\n bottom: number;\n width: number;\n height: number;\n}\n\n/**\n * Minimum vertical spacing between nodes (in pixels)\n */\nconst MIN_NODE_SPACING = 30;\n\n/**\n * Small buffer to avoid floating point precision issues in overlap detection (in pixels)\n * This prevents false positives when nodes are exactly adjacent (e.g., bottom of one node\n * at exactly the same position as top of another)\n */\nconst OVERLAP_BUFFER = 10;\n\n/**\n * Gets the bounding box for a node from the DOM\n *\n * @param nodeUuid - The UUID of the node\n * @param position - The current position of the node\n * @param element - Optional pre-fetched DOM element (recommended for performance when checking multiple nodes)\n * @returns NodeBounds object or null if element not found\n *\n * Note: When element is not provided, performs a DOM query which may impact performance\n * during bulk collision detection. Consider fetching elements beforehand when possible.\n */\nexport const getNodeBounds = (\n nodeUuid: string,\n position: FlowPosition,\n element?: HTMLElement\n): NodeBounds | null => {\n // If element is provided, use it; otherwise try to find it in DOM\n const nodeElement =\n element || (document.querySelector(`[id=\"${nodeUuid}\"]`) as HTMLElement);\n\n if (!nodeElement) {\n return null;\n }\n\n const rect = nodeElement.getBoundingClientRect();\n const width = rect.width;\n const height = rect.height;\n\n return {\n uuid: nodeUuid,\n left: position.left,\n top: position.top,\n right: position.left + width,\n bottom: position.top + height,\n width,\n height\n };\n};\n\n/**\n * Checks if two node bounding boxes overlap\n */\nexport const nodesOverlap = (\n bounds1: NodeBounds,\n bounds2: NodeBounds\n): boolean => {\n // Use a small buffer to avoid floating point precision issues\n const buffer = OVERLAP_BUFFER;\n\n return !(\n bounds1.right <= bounds2.left - buffer ||\n bounds1.left >= bounds2.right + buffer ||\n bounds1.bottom <= bounds2.top - buffer ||\n bounds1.top >= bounds2.bottom + buffer\n );\n};\n\n/**\n * Detects all collisions between a node and other nodes\n */\nexport const detectCollisions = (\n targetBounds: NodeBounds,\n allBounds: NodeBounds[]\n): NodeBounds[] => {\n return allBounds.filter(\n (bounds) =>\n bounds.uuid !== targetBounds.uuid && nodesOverlap(targetBounds, bounds)\n );\n};\n\ntype Direction = 'down' | 'up' | 'right' | 'left';\n\nconst DIRECTIONS: Direction[] = ['down', 'up', 'right', 'left'];\n\n/**\n * Creates a new NodeBounds at a different position\n */\nconst makeBoundsAt = (\n original: NodeBounds,\n left: number,\n top: number\n): NodeBounds => ({\n ...original,\n left,\n top,\n right: left + original.width,\n bottom: top + original.height\n});\n\n/**\n * Computes the minimum position needed to clear all fixed nodes in a given direction.\n * Returns null if the direction is not viable (e.g., would require negative coordinates\n * and still overlap).\n */\nconst computeDirectionalClearance = (\n collider: NodeBounds,\n fixedNodes: NodeBounds[],\n direction: Direction\n): { left: number; top: number } | null => {\n switch (direction) {\n case 'down': {\n const maxBottom = Math.max(...fixedNodes.map((f) => f.bottom));\n const newTop = snapToGrid(maxBottom + MIN_NODE_SPACING);\n return { left: collider.left, top: newTop };\n }\n case 'up': {\n const minTop = Math.min(...fixedNodes.map((f) => f.top));\n const newTop = snapToGrid(minTop - collider.height - MIN_NODE_SPACING);\n if (newTop < 0) return { left: collider.left, top: 0 };\n return { left: collider.left, top: newTop };\n }\n case 'right': {\n const maxRight = Math.max(...fixedNodes.map((f) => f.right));\n const newLeft = snapToGrid(maxRight + MIN_NODE_SPACING);\n return { left: newLeft, top: collider.top };\n }\n case 'left': {\n const minLeft = Math.min(...fixedNodes.map((f) => f.left));\n const newLeft = snapToGrid(minLeft - collider.width - MIN_NODE_SPACING);\n if (newLeft < 0) return { left: 0, top: collider.top };\n return { left: newLeft, top: collider.top };\n }\n }\n};\n\n/**\n * Calculates new positions to resolve all collisions using multi-directional reflow.\n *\n * Sacred nodes (the ones just dropped/created) keep their positions. All other\n * colliding nodes are moved in whichever direction requires the least displacement\n * and causes the fewest cascading collisions.\n */\nexport const calculateReflowPositions = (\n sacredNodeUuids: string[],\n allBounds: NodeBounds[]\n): Map<string, FlowPosition> => {\n const newPositions = new Map<string, FlowPosition>();\n const sacredSet = new Set(sacredNodeUuids);\n\n // Mutable map of current bounds, updated as collisions are resolved\n const currentBounds = new Map<string, NodeBounds>();\n for (const b of allBounds) {\n currentBounds.set(b.uuid, { ...b });\n }\n\n // Seed the queue with non-sacred nodes that overlap any sacred node\n const queue: string[] = [];\n const inQueue = new Set<string>();\n\n for (const sacredUuid of sacredSet) {\n const sacred = currentBounds.get(sacredUuid);\n if (!sacred) continue;\n for (const [uuid, bounds] of currentBounds) {\n if (sacredSet.has(uuid) || inQueue.has(uuid)) continue;\n if (nodesOverlap(sacred, bounds)) {\n queue.push(uuid);\n inQueue.add(uuid);\n }\n }\n }\n\n const resolved = new Set<string>();\n let iterations = 0;\n const maxIterations = 200;\n\n while (queue.length > 0 && iterations < maxIterations) {\n iterations++;\n const uuid = queue.shift()!;\n\n if (resolved.has(uuid)) continue;\n\n const collider = currentBounds.get(uuid)!;\n\n // Find all fixed nodes (sacred + already-resolved) that overlap this node\n const fixedOverlaps: NodeBounds[] = [];\n for (const [otherUuid, otherBounds] of currentBounds) {\n if (otherUuid === uuid) continue;\n if (sacredSet.has(otherUuid) || resolved.has(otherUuid)) {\n if (nodesOverlap(collider, otherBounds)) {\n fixedOverlaps.push(otherBounds);\n }\n }\n }\n\n if (fixedOverlaps.length === 0) continue;\n\n // Try each direction, pick the one with least disruption\n let bestPos: { left: number; top: number } | null = null;\n let bestScore = Infinity;\n\n for (const dir of DIRECTIONS) {\n const candidate = computeDirectionalClearance(\n collider,\n fixedOverlaps,\n dir\n );\n if (!candidate) continue;\n\n const candidateBounds = makeBoundsAt(\n collider,\n candidate.left,\n candidate.top\n );\n\n // Verify no overlap with any sacred or resolved node\n let stillOverlaps = false;\n let cascadeCount = 0;\n for (const [otherUuid, otherBounds] of currentBounds) {\n if (otherUuid === uuid) continue;\n if (!nodesOverlap(candidateBounds, otherBounds)) continue;\n\n if (sacredSet.has(otherUuid) || resolved.has(otherUuid)) {\n stillOverlaps = true;\n break;\n }\n cascadeCount++;\n }\n if (stillOverlaps) continue;\n\n const distance =\n Math.abs(candidate.left - collider.left) +\n Math.abs(candidate.top - collider.top);\n const score = cascadeCount * 10000 + distance;\n\n if (score < bestScore) {\n bestScore = score;\n bestPos = candidate;\n }\n }\n\n if (bestPos) {\n newPositions.set(uuid, { left: bestPos.left, top: bestPos.top });\n const newBounds = makeBoundsAt(collider, bestPos.left, bestPos.top);\n currentBounds.set(uuid, newBounds);\n resolved.add(uuid);\n\n // Enqueue any new cascading collisions\n for (const [otherUuid, otherBounds] of currentBounds) {\n if (otherUuid === uuid) continue;\n if (sacredSet.has(otherUuid) || resolved.has(otherUuid)) continue;\n if (inQueue.has(otherUuid)) continue;\n if (nodesOverlap(newBounds, otherBounds)) {\n queue.push(otherUuid);\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H,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACjE,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;YACpE,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACnC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAEnB,uCAAuC;YACvC,KAAK,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,aAAa,EAAE,CAAC;gBACrD,IAAI,SAAS,KAAK,IAAI;oBAAE,SAAS;gBACjC,IAAI,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC;oBAAE,SAAS;gBAClE,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;oBAAE,SAAS;gBACrC,IAAI,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,CAAC;oBACzC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBACtB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { NamedObject, FlowPosition } from '../store/flow-definition';\nimport { FlowIssue } from '../store/AppState';\n\nexport function formatIssueMessage(issue: FlowIssue): string {\n if (issue.dependency) {\n const name = issue.dependency.name || issue.dependency.key;\n return `Cannot find a ${issue.dependency.type} for ${name}`;\n }\n return issue.description;\n}\n\nconst GRID_SIZE = 20;\n\nexport function snapToGrid(value: number): number {\n const snapped = Math.round(value / GRID_SIZE) * GRID_SIZE;\n return Math.max(snapped, 0);\n}\n\n/**\n * Renders a single line item with optional icon\n */\nexport const renderLineItem = (name: string, icon?: string) => {\n return html`<div style=\"display:flex;items-align:center;\">\n ${icon\n ? html`<temba-icon name=${icon} style=\"margin-right:0.5em\"></temba-icon>`\n : null}\n <div\n style=\"white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px;\"\n >\n ${name}\n </div>\n </div>`;\n};\n\n/**\n * Renders a list of named objects with optional icon, showing up to 3 items\n * with a \"+X more\" indicator if there are more items\n */\nexport const renderNamedObjects = (assets: NamedObject[], icon?: string) => {\n return renderStringList(\n assets.map((asset) => asset.name),\n icon\n );\n};\n\n/**\n * Renders a list of strings with optional icon, showing up to 3 items\n * with a \"+X more\" indicator if there are more items\n */\nexport const renderStringList = (items: string[], icon?: string) => {\n const itemElements = [];\n const maxDisplay = 3;\n\n // Show up to 3 items, or all 4 if exactly 4 items\n const displayCount =\n items.length === 4 ? 4 : Math.min(maxDisplay, items.length);\n\n for (let i = 0; i < displayCount; i++) {\n const item = items[i];\n itemElements.push(renderLineItem(item, icon));\n }\n\n // Add \"+X more\" if there are more than 3 items (and not exactly 4)\n if (items.length > maxDisplay && items.length !== 4) {\n const remainingCount = items.length - maxDisplay;\n itemElements.push(html`<div\n style=\"display:flex;items-align:center;margin-top:0.2em;\"\n >\n ${icon\n ? html`<div style=\"margin-right:0.4em; width: 1em;\"></div>` // spacing placeholder\n : null}\n <div style=\"font-size:0.8em\">+${remainingCount} more</div>\n </div>`);\n }\n return itemElements;\n};\n\nexport interface Scheme {\n scheme: string;\n name: string;\n path: string;\n excludeFromSplit?: boolean;\n}\n\nexport const SCHEMES: Scheme[] = [\n {\n scheme: 'tel',\n name: 'SMS',\n path: 'Phone Number'\n },\n {\n scheme: 'whatsapp',\n name: 'WhatsApp',\n path: 'WhatsApp Number'\n },\n {\n scheme: 'facebook',\n name: 'Facebook',\n path: 'Facebook ID'\n },\n {\n scheme: 'instagram',\n name: 'Instagram',\n path: 'Instagram ID'\n },\n {\n scheme: 'twitterid',\n name: 'Twitter',\n path: 'Twitter ID',\n excludeFromSplit: true\n },\n {\n scheme: 'telegram',\n name: 'Telegram',\n path: 'Telegram ID'\n },\n {\n scheme: 'viber',\n name: 'Viber',\n path: 'Viber ID'\n },\n {\n scheme: 'line',\n name: 'Line',\n path: 'Line ID'\n },\n {\n scheme: 'wechat',\n name: 'WeChat',\n path: 'WeChat ID'\n },\n {\n scheme: 'fcm',\n name: 'Firebase',\n path: 'Firebase ID'\n },\n {\n scheme: 'jiochat',\n name: 'JioChat',\n path: 'JioChat ID'\n },\n {\n scheme: 'freshchat',\n name: 'Freshchat',\n path: 'Freshchat ID'\n },\n {\n scheme: 'mailto',\n name: 'Email',\n path: 'Email Address',\n excludeFromSplit: true\n },\n {\n scheme: 'twitter',\n name: 'Twitter',\n path: 'Twitter Handle',\n excludeFromSplit: true\n },\n {\n scheme: 'vk',\n name: 'VK',\n path: 'VK ID'\n },\n {\n scheme: 'discord',\n name: 'Discord',\n path: 'Discord ID'\n },\n {\n scheme: 'webchat',\n name: 'Webchat',\n path: 'Webchat ID',\n excludeFromSplit: true\n },\n {\n scheme: 'rocketchat',\n name: 'RocketChat',\n path: 'RocketChat ID'\n },\n {\n scheme: 'ext',\n name: 'External',\n path: 'External ID'\n }\n];\n\n/**\n * Represents the bounding box of a node on the canvas\n */\nexport interface NodeBounds {\n uuid: string;\n left: number;\n top: number;\n right: number;\n bottom: number;\n width: number;\n height: number;\n}\n\n/**\n * Minimum vertical spacing between nodes (in pixels)\n */\nconst MIN_NODE_SPACING = 30;\n\n/**\n * Small buffer to avoid floating point precision issues in overlap detection (in pixels)\n * This prevents false positives when nodes are exactly adjacent (e.g., bottom of one node\n * at exactly the same position as top of another)\n */\nconst OVERLAP_BUFFER = 10;\n\n/**\n * Gets the bounding box for a node from the DOM\n *\n * @param nodeUuid - The UUID of the node\n * @param position - The current position of the node\n * @param element - Optional pre-fetched DOM element (recommended for performance when checking multiple nodes)\n * @returns NodeBounds object or null if element not found\n *\n * Note: When element is not provided, performs a DOM query which may impact performance\n * during bulk collision detection. Consider fetching elements beforehand when possible.\n */\nexport const getNodeBounds = (\n nodeUuid: string,\n position: FlowPosition,\n element?: HTMLElement\n): NodeBounds | null => {\n // If element is provided, use it; otherwise try to find it in DOM\n const nodeElement =\n element || (document.querySelector(`[id=\"${nodeUuid}\"]`) as HTMLElement);\n\n if (!nodeElement) {\n return null;\n }\n\n const rect = nodeElement.getBoundingClientRect();\n const width = rect.width;\n const height = rect.height;\n\n return {\n uuid: nodeUuid,\n left: position.left,\n top: position.top,\n right: position.left + width,\n bottom: position.top + height,\n width,\n height\n };\n};\n\n/**\n * Checks if two node bounding boxes overlap\n */\nexport const nodesOverlap = (\n bounds1: NodeBounds,\n bounds2: NodeBounds\n): boolean => {\n // Use a small buffer to avoid floating point precision issues\n const buffer = OVERLAP_BUFFER;\n\n return !(\n bounds1.right <= bounds2.left - buffer ||\n bounds1.left >= bounds2.right + buffer ||\n bounds1.bottom <= bounds2.top - buffer ||\n bounds1.top >= bounds2.bottom + buffer\n );\n};\n\n/**\n * Detects all collisions between a node and other nodes\n */\nexport const detectCollisions = (\n targetBounds: NodeBounds,\n allBounds: NodeBounds[]\n): NodeBounds[] => {\n return allBounds.filter(\n (bounds) =>\n bounds.uuid !== targetBounds.uuid && nodesOverlap(targetBounds, bounds)\n );\n};\n\ntype Direction = 'down' | 'up' | 'right' | 'left';\n\nconst DIRECTIONS: Direction[] = ['down', 'up', 'right', 'left'];\n\n/**\n * Creates a new NodeBounds at a different position\n */\nconst makeBoundsAt = (\n original: NodeBounds,\n left: number,\n top: number\n): NodeBounds => ({\n ...original,\n left,\n top,\n right: left + original.width,\n bottom: top + original.height\n});\n\n/**\n * Computes the minimum position needed to clear all fixed nodes in a given direction.\n * Returns null if the direction is not viable (e.g., would require negative coordinates\n * and still overlap).\n */\nconst computeDirectionalClearance = (\n collider: NodeBounds,\n fixedNodes: NodeBounds[],\n direction: Direction\n): { left: number; top: number } | null => {\n switch (direction) {\n case 'down': {\n const maxBottom = Math.max(...fixedNodes.map((f) => f.bottom));\n const newTop = snapToGrid(maxBottom + MIN_NODE_SPACING);\n return { left: collider.left, top: newTop };\n }\n case 'up': {\n const minTop = Math.min(...fixedNodes.map((f) => f.top));\n const newTop = snapToGrid(minTop - collider.height - MIN_NODE_SPACING);\n if (newTop < 0) return { left: collider.left, top: 0 };\n return { left: collider.left, top: newTop };\n }\n case 'right': {\n const maxRight = Math.max(...fixedNodes.map((f) => f.right));\n const newLeft = snapToGrid(maxRight + MIN_NODE_SPACING);\n return { left: newLeft, top: collider.top };\n }\n case 'left': {\n const minLeft = Math.min(...fixedNodes.map((f) => f.left));\n const newLeft = snapToGrid(minLeft - collider.width - MIN_NODE_SPACING);\n if (newLeft < 0) return { left: 0, top: collider.top };\n return { left: newLeft, top: collider.top };\n }\n }\n};\n\n/**\n * Calculates new positions to resolve all collisions using multi-directional reflow.\n *\n * Sacred nodes (the ones just dropped/created) keep their positions. All other\n * colliding nodes are moved in whichever direction requires the least displacement\n * and causes the fewest cascading collisions.\n */\nexport const calculateReflowPositions = (\n sacredNodeUuids: string[],\n allBounds: NodeBounds[]\n): Map<string, FlowPosition> => {\n const newPositions = new Map<string, FlowPosition>();\n const sacredSet = new Set(sacredNodeUuids);\n\n // Mutable map of current bounds, updated as collisions are resolved\n const currentBounds = new Map<string, NodeBounds>();\n for (const b of allBounds) {\n currentBounds.set(b.uuid, { ...b });\n }\n\n // A sacred node yields to an existing node at the top of the canvas when\n // the sacred wasn't dropped above it. The existing node keeps its top\n // position and the sacred node moves below instead.\n for (const sacredUuid of [...sacredSet]) {\n const sacred = currentBounds.get(sacredUuid);\n if (!sacred) continue;\n\n for (const [uuid, bounds] of currentBounds) {\n if (uuid === sacredUuid || sacredSet.has(uuid)) continue;\n if (!nodesOverlap(sacred, bounds)) continue;\n\n if (sacred.top > bounds.top && bounds.top < MIN_NODE_SPACING) {\n sacredSet.delete(sacredUuid);\n sacredSet.add(uuid);\n break;\n }\n }\n }\n\n // Seed the queue with non-sacred nodes that overlap any sacred node\n const queue: string[] = [];\n const inQueue = new Set<string>();\n\n for (const sacredUuid of sacredSet) {\n const sacred = currentBounds.get(sacredUuid);\n if (!sacred) continue;\n for (const [uuid, bounds] of currentBounds) {\n if (sacredSet.has(uuid) || inQueue.has(uuid)) continue;\n if (nodesOverlap(sacred, bounds)) {\n queue.push(uuid);\n inQueue.add(uuid);\n }\n }\n }\n\n const resolved = new Set<string>();\n let iterations = 0;\n const maxIterations = 200;\n\n while (queue.length > 0 && iterations < maxIterations) {\n iterations++;\n const uuid = queue.shift()!;\n\n if (resolved.has(uuid)) continue;\n\n const collider = currentBounds.get(uuid)!;\n\n // Find all fixed nodes (sacred + already-resolved) that overlap this node\n const fixedOverlaps: NodeBounds[] = [];\n for (const [otherUuid, otherBounds] of currentBounds) {\n if (otherUuid === uuid) continue;\n if (sacredSet.has(otherUuid) || resolved.has(otherUuid)) {\n if (nodesOverlap(collider, otherBounds)) {\n fixedOverlaps.push(otherBounds);\n }\n }\n }\n\n if (fixedOverlaps.length === 0) continue;\n\n // Determine direction constraints and axis bias from sacred node overlaps\n const sacredOverlaps = fixedOverlaps.filter((f) => sacredSet.has(f.uuid));\n const allowedDirections: Direction[] = [...DIRECTIONS];\n let axisBias: 'vertical' | 'horizontal' | null = null;\n\n if (sacredOverlaps.length > 0) {\n // Rule 1: don't move a lower node above the sacred node\n // Rule 2: don't move a right-of node to the left of the sacred node\n for (const sacred of sacredOverlaps) {\n if (collider.top > sacred.top) {\n const idx = allowedDirections.indexOf('up');\n if (idx !== -1) allowedDirections.splice(idx, 1);\n }\n if (collider.left > sacred.left) {\n const idx = allowedDirections.indexOf('left');\n if (idx !== -1) allowedDirections.splice(idx, 1);\n }\n }\n\n // Rule 3: bias direction based on overlap shape\n let totalOverlapWidth = 0;\n let totalOverlapHeight = 0;\n for (const sacred of sacredOverlaps) {\n totalOverlapWidth +=\n Math.min(collider.right, sacred.right) -\n Math.max(collider.left, sacred.left);\n totalOverlapHeight +=\n Math.min(collider.bottom, sacred.bottom) -\n Math.max(collider.top, sacred.top);\n }\n if (totalOverlapWidth > totalOverlapHeight) {\n axisBias = 'vertical'; // wide overlap = nodes stacked = prefer up/down\n } else if (totalOverlapHeight > totalOverlapWidth) {\n axisBias = 'horizontal'; // tall overlap = nodes side-by-side = prefer left/right\n }\n }\n\n // Try each allowed direction, pick the one with least disruption\n let bestPos: { left: number; top: number } | null = null;\n let bestScore = Infinity;\n\n for (const dir of allowedDirections) {\n const candidate = computeDirectionalClearance(\n collider,\n fixedOverlaps,\n dir\n );\n if (!candidate) continue;\n\n const candidateBounds = makeBoundsAt(\n collider,\n candidate.left,\n candidate.top\n );\n\n // Verify no overlap with any sacred or resolved node\n let stillOverlaps = false;\n let cascadeCount = 0;\n for (const [otherUuid, otherBounds] of currentBounds) {\n if (otherUuid === uuid) continue;\n if (!nodesOverlap(candidateBounds, otherBounds)) continue;\n\n if (sacredSet.has(otherUuid) || resolved.has(otherUuid)) {\n stillOverlaps = true;\n break;\n }\n cascadeCount++;\n }\n if (stillOverlaps) continue;\n\n const distance =\n Math.abs(candidate.left - collider.left) +\n Math.abs(candidate.top - collider.top);\n\n // When colliding with sacred nodes, use axis bias scoring;\n // for cascading collisions (no sacred overlap), use original scoring\n let score: number;\n if (sacredOverlaps.length > 0) {\n const isVerticalDir = dir === 'up' || dir === 'down';\n const axisMatch =\n axisBias === null ||\n (axisBias === 'vertical' && isVerticalDir) ||\n (axisBias === 'horizontal' && !isVerticalDir);\n const axisPenalty = axisMatch ? 0 : 5000;\n score = cascadeCount * 2000 + axisPenalty + distance;\n } else {\n score = cascadeCount * 10000 + distance;\n }\n\n if (score < bestScore) {\n bestScore = score;\n bestPos = candidate;\n }\n }\n\n if (bestPos) {\n newPositions.set(uuid, { left: bestPos.left, top: bestPos.top });\n const newBounds = makeBoundsAt(collider, bestPos.left, bestPos.top);\n currentBounds.set(uuid, newBounds);\n resolved.add(uuid);\n\n // Enqueue any new cascading collisions\n for (const [otherUuid, otherBounds] of currentBounds) {\n if (otherUuid === uuid) continue;\n if (sacredSet.has(otherUuid) || resolved.has(otherUuid)) continue;\n if (inQueue.has(otherUuid)) continue;\n if (nodesOverlap(newBounds, otherBounds)) {\n queue.push(otherUuid);\n inQueue.add(otherUuid);\n }\n }\n }\n }\n\n return newPositions;\n};\n"]}
|
|
@@ -494,13 +494,15 @@ let TembaArrayEditor = class TembaArrayEditor extends BaseListEditor {
|
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
.removable .remove-btn {
|
|
497
|
-
|
|
497
|
+
opacity: 0.3;
|
|
498
498
|
cursor: default;
|
|
499
|
+
pointer-events: none;
|
|
499
500
|
}
|
|
500
501
|
|
|
501
502
|
.removable .drag-handle {
|
|
502
|
-
|
|
503
|
+
opacity: 0.3;
|
|
503
504
|
cursor: default;
|
|
505
|
+
pointer-events: none;
|
|
504
506
|
}
|
|
505
507
|
|
|
506
508
|
.drag-handle {
|