@elliemae/ds-decision-graph 3.55.0-next.6 → 3.55.0-next.8
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/dist/cjs/config/useDecisionGraph.js.map +2 -2
- package/dist/cjs/config/useValidateProps.js +1 -1
- package/dist/cjs/config/useValidateProps.js.map +2 -2
- package/dist/cjs/parts/mermaid/MermaidDecisionChart.js +1 -1
- package/dist/cjs/parts/mermaid/MermaidDecisionChart.js.map +2 -2
- package/dist/cjs/parts/mermaid/decisionTreeToMermaidMD.js +2 -0
- package/dist/cjs/parts/mermaid/decisionTreeToMermaidMD.js.map +2 -2
- package/dist/esm/config/useDecisionGraph.js.map +2 -2
- package/dist/esm/config/useValidateProps.js +1 -1
- package/dist/esm/config/useValidateProps.js.map +2 -2
- package/dist/esm/parts/mermaid/MermaidDecisionChart.js +1 -1
- package/dist/esm/parts/mermaid/MermaidDecisionChart.js.map +2 -2
- package/dist/esm/parts/mermaid/decisionTreeToMermaidMD.js +2 -0
- package/dist/esm/parts/mermaid/decisionTreeToMermaidMD.js.map +2 -2
- package/dist/types/config/useDecisionGraph.d.ts +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useDecisionGraph.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { type DSDecisionGraphT, DSDecisionGraphPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAAyF;AACzF,iBAAoB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { type DSDecisionGraphT, DSDecisionGraphPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface DecisionGraphCTX {\n propsWithDefault: DSDecisionGraphT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useDecisionGraph = (propsFromUser: DSDecisionGraphT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSDecisionGraphT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSDecisionGraphPropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = useGetGlobalAttributes<DSDecisionGraphT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefault,\n );\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const { id } = propsWithDefault;\n const instanceUid = React.useMemo(() => id || uid(5), [id]);\n\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n // const eventHandlers = useEventHandlers({ propsWithDefault, instanceUid }); // <-- complex logic should be made atomics this way\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n }),\n [propsWithDefault, globalProps, xstyledProps, instanceUid],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAAyF;AACzF,iBAAoB;AAEpB,mCAA8E;AAC9E,8BAAiC;AAS1B,MAAM,mBAAmB,CAAC,kBAA0C;AAIzE,QAAM,uBAAmB,sDAA6D,eAAe,yCAAY;AACjH,gDAAiB,kBAAkB,qDAAwB;AAI3D,QAAM,kBAAc;AAAA,IAClB;AAAA,EACF;AACA,QAAM,mBAAe,4CAAmB,gBAAgB;AAKxD,QAAM,EAAE,GAAG,IAAI;AACf,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,UAAM,gBAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAO1D,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,cAAc,WAAW;AAAA,EAC3D;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -34,8 +34,8 @@ module.exports = __toCommonJS(useValidateProps_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
|
-
var import_constants = require("../constants/index.js");
|
|
38
37
|
var import_ajv = __toESM(require("ajv"));
|
|
38
|
+
var import_constants = require("../constants/index.js");
|
|
39
39
|
const useValidateProps = (props, propTypes) => {
|
|
40
40
|
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, import_constants.DSDecisionGraphName);
|
|
41
41
|
import_react.default.useEffect(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useValidateProps.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { type DSDecisionGraphT } from '../react-desc-prop-types.js';\nimport { DSDecisionGraphName, JSON_SCHEMA } from '../constants/index.js';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAElB,8BAA+C;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport Ajv from 'ajv';\nimport { type DSDecisionGraphT } from '../react-desc-prop-types.js';\nimport { DSDecisionGraphName, JSON_SCHEMA } from '../constants/index.js';\n\nexport const useValidateProps = (\n props: DSDecisionGraphT.InternalProps,\n propTypes: WeakValidationMap<unknown>,\n): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSDecisionGraphName);\n React.useEffect(() => {\n const ajv = new Ajv();\n const validate = ajv.compile(JSON_SCHEMA);\n const valid = validate(props.chartJson);\n if (!valid) {\n throw new Error(`Invalid JSON: ${JSON.stringify(validate.errors)}`);\n }\n }, [props.chartJson]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAElB,8BAA+C;AAC/C,iBAAgB;AAEhB,uBAAiD;AAE1C,MAAM,mBAAmB,CAC9B,OACA,cACS;AAET,8DAA+B,OAAO,WAAW,oCAAmB;AACpE,eAAAA,QAAM,UAAU,MAAM;AACpB,UAAM,MAAM,IAAI,WAAAC,QAAI;AACpB,UAAM,WAAW,IAAI,QAAQ,4BAAW;AACxC,UAAM,QAAQ,SAAS,MAAM,SAAS;AACtC,QAAI,CAAC,OAAO;AACV,YAAM,IAAI,MAAM,iBAAiB,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE;AAAA,IACpE;AAAA,EACF,GAAG,CAAC,MAAM,SAAS,CAAC;AACtB;",
|
|
6
6
|
"names": ["React", "Ajv"]
|
|
7
7
|
}
|
|
@@ -34,8 +34,8 @@ module.exports = __toCommonJS(MermaidDecisionChart_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_decisionTreeToMermaidMD = require("./decisionTreeToMermaidMD.js");
|
|
38
37
|
var import_mermaid = __toESM(require("mermaid"));
|
|
38
|
+
var import_decisionTreeToMermaidMD = require("./decisionTreeToMermaidMD.js");
|
|
39
39
|
const MermaidDecisionChart = (props) => {
|
|
40
40
|
const { chartJson, uid, direction } = props;
|
|
41
41
|
const mermaidRef = import_react.default.useRef(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/mermaid/MermaidDecisionChart.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport type { DSDecisionGraphT } from '../../react-desc-prop-types.js';\nimport { decisionTreeToMermaidMD } from './decisionTreeToMermaidMD.js';\n// https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/mermaid.ts#L367\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport mermaid from 'mermaid';\nimport type { DSDecisionGraphT } from '../../react-desc-prop-types.js';\nimport { decisionTreeToMermaidMD } from './decisionTreeToMermaidMD.js';\n// https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/mermaid.ts#L367\n\ntype MermaidProps = {\n chartJson: DSDecisionGraphT.Props['chartJson'];\n uid: string;\n direction: DSDecisionGraphT.Directions;\n};\n\nexport const MermaidDecisionChart = (props: MermaidProps) => {\n const { chartJson, uid, direction } = props;\n const mermaidRef = React.useRef<HTMLPreElement>(null);\n // this operation should be O(1), but depending on the size of the decision tree,\n // it is still potentially beneficial to memoize it...\n const mermaidMD = React.useMemo(() => decisionTreeToMermaidMD(chartJson, direction), [chartJson, direction]);\n\n // on mount initialize mermaid\n React.useEffect(() => {\n mermaid.initialize({\n startOnLoad: false,\n });\n }, []);\n\n React.useEffect(() => {\n setTimeout(() => {\n const renderAsync = async () => {\n const { svg } = await mermaid.render(`mermaid-svg-${uid}`, mermaidMD);\n if (mermaidRef.current) {\n mermaidRef.current.innerHTML = svg;\n }\n };\n // eslint-disable-next-line no-void\n void renderAsync();\n }, 0);\n }, [mermaidMD, uid]);\n\n return <pre ref={mermaidRef} />;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADuCd;AAvCT,mBAAkB;AAClB,qBAAoB;AAEpB,qCAAwC;AASjC,MAAM,uBAAuB,CAAC,UAAwB;AAC3D,QAAM,EAAE,WAAW,KAAK,UAAU,IAAI;AACtC,QAAM,aAAa,aAAAA,QAAM,OAAuB,IAAI;AAGpD,QAAM,YAAY,aAAAA,QAAM,QAAQ,UAAM,wDAAwB,WAAW,SAAS,GAAG,CAAC,WAAW,SAAS,CAAC;AAG3G,eAAAA,QAAM,UAAU,MAAM;AACpB,mBAAAC,QAAQ,WAAW;AAAA,MACjB,aAAa;AAAA,IACf,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,eAAAD,QAAM,UAAU,MAAM;AACpB,eAAW,MAAM;AACf,YAAM,cAAc,YAAY;AAC9B,cAAM,EAAE,IAAI,IAAI,MAAM,eAAAC,QAAQ,OAAO,eAAe,GAAG,IAAI,SAAS;AACpE,YAAI,WAAW,SAAS;AACtB,qBAAW,QAAQ,YAAY;AAAA,QACjC;AAAA,MACF;AAEA,WAAK,YAAY;AAAA,IACnB,GAAG,CAAC;AAAA,EACN,GAAG,CAAC,WAAW,GAAG,CAAC;AAEnB,SAAO,4CAAC,SAAI,KAAK,YAAY;AAC/B;",
|
|
6
6
|
"names": ["React", "mermaid"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/mermaid/decisionTreeToMermaidMD.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type { DSDecisionGraphT } from '../../react-desc-prop-types.js';\n\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADWvB,SAAS,uBAAuB,UAAoE;AAClG,MAAI,eAA8C;AAClD,UAAQ,SAAS,OAAO,SAAS,SAAS,CAAC,GAAG;AAAA,IAC5C,KAAK;AACH,qBAAe;AACf;AAAA,IACF,KAAK;AACH,qBAAe;AACf;AAAA,IACF,KAAK;AACH,qBAAe;AACf;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,eAAe,MAA4E;AAClG,UAAQ,KAAK,mBAAmB,KAAK,oBAAoB,eAAe;AAC1E;AAEA,SAAS,gBACP,MACA,UAC+B;AAC/B,MAAI;AAEJ,MAAI,eAAe,IAAI,GAAG;AACxB,mBAAe,GAAG,MAAM,cAAc,QAAQ,MAAM,KAAK,QAAQ;AAAA,EACnE,OAAO;AACL,mBAAe,GAAG,MAAM,cAAc,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAClE;AAEA,SAAO;AACT;AAQA,MAAM,UAAU,CACd,MACA,eACA,WAAsC,QACnC;AACH,QAAM,eAAiC;AAAA,IACrC,UAAU,KAAK;AAAA,IACf,MAAM;AAAA,IACN,cAAc,gBAAgB,MAAM,QAAQ;AAAA,EAC9C;AACA,gBAAc,IAAI,UAAU,YAAY;AACxC,MAAI,KAAK,UAAU;AACjB,YAAQ,KAAK,UAAU,eAAe,GAAG,QAAQ,GAAG;AAAA,EACtD;AACA,MAAI,KAAK,WAAW;AAClB,YAAQ,KAAK,WAAW,eAAe,GAAG,QAAQ,GAAG;AAAA,EACvD;AACA,MAAI,KAAK,mBAAmB;AAC1B,YAAQ,KAAK,mBAAmB,eAAe,GAAG,QAAQ,GAAG;AAAA,EAC/D;AACF;AAOA,MAAM,sBAAsB,CAAC,aAA0F;AACrH,QAAM,gBAAkE,oBAAI,IAAI;AAChF,QAAM,gBAA+C,SAAS;AAE9D,UAAQ,eAAe,aAAa;AACpC,SAAO;AACT;AAQO,MAAM,0BAA0B,CACrC,UACA,YAAyC,SACtC;AACH,QAAM,QAAQ;AAAA,SAAe,SAAS,UAAU;AAAA;AAAA;AAChD,MAAI,YAAY,GAAG,KAAK,aAAa,SAAS;AAAA;AAE9C,QAAM,gBAAgB,oBAAoB,QAAQ;AAClD,gBAAc,QAAQ,CAAC,MAAM,aAAa;AACxC,QAAI,aAAa,IAAK;AACtB,UAAM,eAAe,SAAS,MAAM,GAAG,EAAE;AACzC,UAAM,aAAa,cAAc,IAAI,YAAY;AACjD,QAAI,YAAY;AACd,YAAM,eAAe,uBAAuB,QAAQ;AACpD,mBAAa,IAAK,WAAW,YAAY,GAAG,YAAY,GAAG,KAAK,YAAY;AAAA;AAAA,IAC9E;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
4
|
+
"sourcesContent": ["import type { DSDecisionGraphT } from '../../react-desc-prop-types.js';\n\n/** ************************************************************\n ***************** Mermaid Markdown Generator *****************\n ************************************************************ */\n\ntype FlatDecisionNode = {\n nodeText: string;\n path: DSDecisionGraphT.NodePath;\n nodeMarkdown?: DSDecisionGraphT.NodeMarkdown;\n};\nfunction nodePathToLinkMarkdown(nodePath: DSDecisionGraphT.NodePath): DSDecisionGraphT.LinkMarkdown {\n let linkMarkdown: DSDecisionGraphT.LinkMarkdown = '';\n switch (nodePath.charAt(nodePath.length - 1)) {\n case 't':\n linkMarkdown = `-->|true|`;\n break;\n case 'f':\n linkMarkdown = `-->|false|`;\n break;\n case 'o':\n linkMarkdown = `-->|N/A|`;\n break;\n default:\n break;\n }\n return linkMarkdown;\n}\nfunction isQuestionText(node: DSDecisionGraphT.DecisionNode): node is DSDecisionGraphT.QuestionNode {\n return (node.semanticMeaning && node.semanticMeaning === 'question') ?? false;\n}\n\nfunction nodeToMermaidMD(\n node: DSDecisionGraphT.DecisionNode,\n nodePath: DSDecisionGraphT.NodePath,\n): DSDecisionGraphT.NodeMarkdown {\n let nodeMarkdown: DSDecisionGraphT.NodeMarkdown;\n\n if (isQuestionText(node)) {\n nodeMarkdown = `${node?.repeatedId ?? nodePath}{{\"${node.nodeText}\"}}`;\n } else {\n nodeMarkdown = `${node?.repeatedId ?? nodePath}(\"${node.nodeText}\")`;\n }\n\n return nodeMarkdown;\n}\n\n/**\n * Recursively flattens a decision tree node and its children.\n * @param {DSDecisionGraphT.DecisionNode} node - The decision tree node to flatten.\n * @param { Map<DSDecisionGraphT.NodePath, FlatDecisionNode>} decisionNodes - the map to track the flattened nodes.\n * @param {DSDecisionGraphT.NodePath} nodePath - The path of the current node in the decision tree.\n */\nconst flatten = (\n node: DSDecisionGraphT.DecisionNode,\n decisionNodes: Map<DSDecisionGraphT.NodePath, FlatDecisionNode>,\n nodePath: DSDecisionGraphT.NodePath = 's' as DSDecisionGraphT.NodePath,\n) => {\n const decisionNode: FlatDecisionNode = {\n nodeText: node.nodeText,\n path: nodePath,\n nodeMarkdown: nodeToMermaidMD(node, nodePath),\n };\n decisionNodes.set(nodePath, decisionNode);\n if (node.truePath) {\n flatten(node.truePath, decisionNodes, `${nodePath}t`);\n }\n if (node.falsePath) {\n flatten(node.falsePath, decisionNodes, `${nodePath}f`);\n }\n if (node.notApplicablePath) {\n flatten(node.notApplicablePath, decisionNodes, `${nodePath}o`);\n }\n};\n\n/**\n * Flattens a decision tree into a map of flat decision nodes.\n * @param {DSDecisionGraphT.RootNode} rootNode - The root node of the decision tree to flatten.\n * @returns {Map<DSDecisionGraphT.NodePath, FlatDecisionNode>} A map of flat decision nodes, where each node is identified by its node ID.\n */\nconst flattenDecisionTree = (rootNode: DSDecisionGraphT.RootNode): Map<DSDecisionGraphT.NodePath, FlatDecisionNode> => {\n const decisionNodes: Map<DSDecisionGraphT.NodePath, FlatDecisionNode> = new Map();\n const treeToFlatten: DSDecisionGraphT.DecisionNode = rootNode.subtree;\n\n flatten(treeToFlatten, decisionNodes);\n return decisionNodes;\n};\n\n/**\n * Flattens a decision tree into a map of flat decision nodes.\n * @param {DSDecisionGraphT.RootNode} rootNode - The root node of the decision tree to flatten.\n * @param {DSDecisionGraphT.Directions} direction - direction of the flowchart, default is LR (left to right)\n * @returns {string} A map of flat decision nodes, where each node is identified by its node ID.\n */\nexport const decisionTreeToMermaidMD = (\n rootNode: DSDecisionGraphT.RootNode,\n direction: DSDecisionGraphT.Directions = 'LR',\n) => {\n const title = `---\\ntitle: ${rootNode.chartTitle}\\n---\\n`;\n let mermaidMD = `${title}flowchart ${direction};\\n`;\n // let mermaidMD = `flowchart LR;\\n subgraph ${rootNode.chartTitle};\\n`; // this add an highlight to the chart and the title\n const decisionNodes = flattenDecisionTree(rootNode);\n decisionNodes.forEach((node, nodePath) => {\n if (nodePath === 's') return;\n const parentNodeId = nodePath.slice(0, -1) as DSDecisionGraphT.NodePath;\n const parentNode = decisionNodes.get(parentNodeId);\n if (parentNode) {\n const linkMarkdown = nodePathToLinkMarkdown(nodePath);\n mermaidMD += `\\t${parentNode.nodeMarkdown}${linkMarkdown}${node.nodeMarkdown}\\n`;\n }\n });\n // mermaidMD += 'end;\\n';\n return mermaidMD;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADWvB,SAAS,uBAAuB,UAAoE;AAClG,MAAI,eAA8C;AAClD,UAAQ,SAAS,OAAO,SAAS,SAAS,CAAC,GAAG;AAAA,IAC5C,KAAK;AACH,qBAAe;AACf;AAAA,IACF,KAAK;AACH,qBAAe;AACf;AAAA,IACF,KAAK;AACH,qBAAe;AACf;AAAA,IACF;AACE;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,eAAe,MAA4E;AAClG,UAAQ,KAAK,mBAAmB,KAAK,oBAAoB,eAAe;AAC1E;AAEA,SAAS,gBACP,MACA,UAC+B;AAC/B,MAAI;AAEJ,MAAI,eAAe,IAAI,GAAG;AACxB,mBAAe,GAAG,MAAM,cAAc,QAAQ,MAAM,KAAK,QAAQ;AAAA,EACnE,OAAO;AACL,mBAAe,GAAG,MAAM,cAAc,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAClE;AAEA,SAAO;AACT;AAQA,MAAM,UAAU,CACd,MACA,eACA,WAAsC,QACnC;AACH,QAAM,eAAiC;AAAA,IACrC,UAAU,KAAK;AAAA,IACf,MAAM;AAAA,IACN,cAAc,gBAAgB,MAAM,QAAQ;AAAA,EAC9C;AACA,gBAAc,IAAI,UAAU,YAAY;AACxC,MAAI,KAAK,UAAU;AACjB,YAAQ,KAAK,UAAU,eAAe,GAAG,QAAQ,GAAG;AAAA,EACtD;AACA,MAAI,KAAK,WAAW;AAClB,YAAQ,KAAK,WAAW,eAAe,GAAG,QAAQ,GAAG;AAAA,EACvD;AACA,MAAI,KAAK,mBAAmB;AAC1B,YAAQ,KAAK,mBAAmB,eAAe,GAAG,QAAQ,GAAG;AAAA,EAC/D;AACF;AAOA,MAAM,sBAAsB,CAAC,aAA0F;AACrH,QAAM,gBAAkE,oBAAI,IAAI;AAChF,QAAM,gBAA+C,SAAS;AAE9D,UAAQ,eAAe,aAAa;AACpC,SAAO;AACT;AAQO,MAAM,0BAA0B,CACrC,UACA,YAAyC,SACtC;AACH,QAAM,QAAQ;AAAA,SAAe,SAAS,UAAU;AAAA;AAAA;AAChD,MAAI,YAAY,GAAG,KAAK,aAAa,SAAS;AAAA;AAE9C,QAAM,gBAAgB,oBAAoB,QAAQ;AAClD,gBAAc,QAAQ,CAAC,MAAM,aAAa;AACxC,QAAI,aAAa,IAAK;AACtB,UAAM,eAAe,SAAS,MAAM,GAAG,EAAE;AACzC,UAAM,aAAa,cAAc,IAAI,YAAY;AACjD,QAAI,YAAY;AACd,YAAM,eAAe,uBAAuB,QAAQ;AACpD,mBAAa,IAAK,WAAW,YAAY,GAAG,YAAY,GAAG,KAAK,YAAY;AAAA;AAAA,IAC9E;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useDecisionGraph.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { type DSDecisionGraphT, DSDecisionGraphPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { type DSDecisionGraphT, DSDecisionGraphPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface DecisionGraphCTX {\n propsWithDefault: DSDecisionGraphT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useDecisionGraph = (propsFromUser: DSDecisionGraphT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSDecisionGraphT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSDecisionGraphPropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = useGetGlobalAttributes<DSDecisionGraphT.InternalProps, HTMLDivElement, DSGridT.Props>(\n propsWithDefault,\n );\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // custom code goes here, this is an example\n const { id } = propsWithDefault;\n const instanceUid = React.useMemo(() => id || uid(5), [id]);\n\n // =============================================================================\n // HELPERS HOOKS CONFIGS\n // =============================================================================\n // const eventHandlers = useEventHandlers({ propsWithDefault, instanceUid }); // <-- complex logic should be made atomics this way\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n instanceUid,\n }),\n [propsWithDefault, globalProps, xstyledProps, instanceUid],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,WAAW;AAEpB,SAAgC,0BAA0B,oBAAoB;AAC9E,SAAS,wBAAwB;AAS1B,MAAM,mBAAmB,CAAC,kBAA0C;AAIzE,QAAM,mBAAmB,6BAA6D,eAAe,YAAY;AACjH,mBAAiB,kBAAkB,wBAAwB;AAI3D,QAAM,cAAc;AAAA,IAClB;AAAA,EACF;AACA,QAAM,eAAe,mBAAmB,gBAAgB;AAKxD,QAAM,EAAE,GAAG,IAAI;AACf,QAAM,cAAcA,OAAM,QAAQ,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAO1D,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,cAAc,WAAW;AAAA,EAC3D;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import React2 from "react";
|
|
3
3
|
import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
|
|
4
|
-
import { DSDecisionGraphName, JSON_SCHEMA } from "../constants/index.js";
|
|
5
4
|
import Ajv from "ajv";
|
|
5
|
+
import { DSDecisionGraphName, JSON_SCHEMA } from "../constants/index.js";
|
|
6
6
|
const useValidateProps = (props, propTypes) => {
|
|
7
7
|
useValidateTypescriptPropTypes(props, propTypes, DSDecisionGraphName);
|
|
8
8
|
React2.useEffect(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { type DSDecisionGraphT } from '../react-desc-prop-types.js';\nimport { DSDecisionGraphName, JSON_SCHEMA } from '../constants/index.js';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAElB,SAAS,sCAAsC;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport Ajv from 'ajv';\nimport { type DSDecisionGraphT } from '../react-desc-prop-types.js';\nimport { DSDecisionGraphName, JSON_SCHEMA } from '../constants/index.js';\n\nexport const useValidateProps = (\n props: DSDecisionGraphT.InternalProps,\n propTypes: WeakValidationMap<unknown>,\n): void => {\n // we validate the \"required if\" via 'isRequiredIf from our custom PropTypes\n useValidateTypescriptPropTypes(props, propTypes, DSDecisionGraphName);\n React.useEffect(() => {\n const ajv = new Ajv();\n const validate = ajv.compile(JSON_SCHEMA);\n const valid = validate(props.chartJson);\n if (!valid) {\n throw new Error(`Invalid JSON: ${JSON.stringify(validate.errors)}`);\n }\n }, [props.chartJson]);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAElB,SAAS,sCAAsC;AAC/C,OAAO,SAAS;AAEhB,SAAS,qBAAqB,mBAAmB;AAE1C,MAAM,mBAAmB,CAC9B,OACA,cACS;AAET,iCAA+B,OAAO,WAAW,mBAAmB;AACpE,EAAAA,OAAM,UAAU,MAAM;AACpB,UAAM,MAAM,IAAI,IAAI;AACpB,UAAM,WAAW,IAAI,QAAQ,WAAW;AACxC,UAAM,QAAQ,SAAS,MAAM,SAAS;AACtC,QAAI,CAAC,OAAO;AACV,YAAM,IAAI,MAAM,iBAAiB,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE;AAAA,IACpE;AAAA,EACF,GAAG,CAAC,MAAM,SAAS,CAAC;AACtB;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import React2 from "react";
|
|
4
|
-
import { decisionTreeToMermaidMD } from "./decisionTreeToMermaidMD.js";
|
|
5
4
|
import mermaid from "mermaid";
|
|
5
|
+
import { decisionTreeToMermaidMD } from "./decisionTreeToMermaidMD.js";
|
|
6
6
|
const MermaidDecisionChart = (props) => {
|
|
7
7
|
const { chartJson, uid, direction } = props;
|
|
8
8
|
const mermaidRef = React2.useRef(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/mermaid/MermaidDecisionChart.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { DSDecisionGraphT } from '../../react-desc-prop-types.js';\nimport { decisionTreeToMermaidMD } from './decisionTreeToMermaidMD.js';\n// https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/mermaid.ts#L367\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport mermaid from 'mermaid';\nimport type { DSDecisionGraphT } from '../../react-desc-prop-types.js';\nimport { decisionTreeToMermaidMD } from './decisionTreeToMermaidMD.js';\n// https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/mermaid.ts#L367\n\ntype MermaidProps = {\n chartJson: DSDecisionGraphT.Props['chartJson'];\n uid: string;\n direction: DSDecisionGraphT.Directions;\n};\n\nexport const MermaidDecisionChart = (props: MermaidProps) => {\n const { chartJson, uid, direction } = props;\n const mermaidRef = React.useRef<HTMLPreElement>(null);\n // this operation should be O(1), but depending on the size of the decision tree,\n // it is still potentially beneficial to memoize it...\n const mermaidMD = React.useMemo(() => decisionTreeToMermaidMD(chartJson, direction), [chartJson, direction]);\n\n // on mount initialize mermaid\n React.useEffect(() => {\n mermaid.initialize({\n startOnLoad: false,\n });\n }, []);\n\n React.useEffect(() => {\n setTimeout(() => {\n const renderAsync = async () => {\n const { svg } = await mermaid.render(`mermaid-svg-${uid}`, mermaidMD);\n if (mermaidRef.current) {\n mermaidRef.current.innerHTML = svg;\n }\n };\n // eslint-disable-next-line no-void\n void renderAsync();\n }, 0);\n }, [mermaidMD, uid]);\n\n return <pre ref={mermaidRef} />;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACuCd;AAvCT,OAAOA,YAAW;AAClB,OAAO,aAAa;AAEpB,SAAS,+BAA+B;AASjC,MAAM,uBAAuB,CAAC,UAAwB;AAC3D,QAAM,EAAE,WAAW,KAAK,UAAU,IAAI;AACtC,QAAM,aAAaA,OAAM,OAAuB,IAAI;AAGpD,QAAM,YAAYA,OAAM,QAAQ,MAAM,wBAAwB,WAAW,SAAS,GAAG,CAAC,WAAW,SAAS,CAAC;AAG3G,EAAAA,OAAM,UAAU,MAAM;AACpB,YAAQ,WAAW;AAAA,MACjB,aAAa;AAAA,IACf,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,EAAAA,OAAM,UAAU,MAAM;AACpB,eAAW,MAAM;AACf,YAAM,cAAc,YAAY;AAC9B,cAAM,EAAE,IAAI,IAAI,MAAM,QAAQ,OAAO,eAAe,GAAG,IAAI,SAAS;AACpE,YAAI,WAAW,SAAS;AACtB,qBAAW,QAAQ,YAAY;AAAA,QACjC;AAAA,MACF;AAEA,WAAK,YAAY;AAAA,IACnB,GAAG,CAAC;AAAA,EACN,GAAG,CAAC,WAAW,GAAG,CAAC;AAEnB,SAAO,oBAAC,SAAI,KAAK,YAAY;AAC/B;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/mermaid/decisionTreeToMermaidMD.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSDecisionGraphT } from '../../react-desc-prop-types.js';\n\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACWvB,SAAS,uBAAuB,UAAoE;AAClG,MAAI,eAA8C;AAClD,UAAQ,SAAS,OAAO,SAAS,SAAS,CAAC,GAAG;AAAA,IAC5C,KAAK;AACH,qBAAe;AACf;AAAA,IACF,KAAK;AACH,qBAAe;AACf;AAAA,IACF,KAAK;AACH,qBAAe;AACf;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,eAAe,MAA4E;AAClG,UAAQ,KAAK,mBAAmB,KAAK,oBAAoB,eAAe;AAC1E;AAEA,SAAS,gBACP,MACA,UAC+B;AAC/B,MAAI;AAEJ,MAAI,eAAe,IAAI,GAAG;AACxB,mBAAe,GAAG,MAAM,cAAc,QAAQ,MAAM,KAAK,QAAQ;AAAA,EACnE,OAAO;AACL,mBAAe,GAAG,MAAM,cAAc,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAClE;AAEA,SAAO;AACT;AAQA,MAAM,UAAU,CACd,MACA,eACA,WAAsC,QACnC;AACH,QAAM,eAAiC;AAAA,IACrC,UAAU,KAAK;AAAA,IACf,MAAM;AAAA,IACN,cAAc,gBAAgB,MAAM,QAAQ;AAAA,EAC9C;AACA,gBAAc,IAAI,UAAU,YAAY;AACxC,MAAI,KAAK,UAAU;AACjB,YAAQ,KAAK,UAAU,eAAe,GAAG,QAAQ,GAAG;AAAA,EACtD;AACA,MAAI,KAAK,WAAW;AAClB,YAAQ,KAAK,WAAW,eAAe,GAAG,QAAQ,GAAG;AAAA,EACvD;AACA,MAAI,KAAK,mBAAmB;AAC1B,YAAQ,KAAK,mBAAmB,eAAe,GAAG,QAAQ,GAAG;AAAA,EAC/D;AACF;AAOA,MAAM,sBAAsB,CAAC,aAA0F;AACrH,QAAM,gBAAkE,oBAAI,IAAI;AAChF,QAAM,gBAA+C,SAAS;AAE9D,UAAQ,eAAe,aAAa;AACpC,SAAO;AACT;AAQO,MAAM,0BAA0B,CACrC,UACA,YAAyC,SACtC;AACH,QAAM,QAAQ;AAAA,SAAe,SAAS,UAAU;AAAA;AAAA;AAChD,MAAI,YAAY,GAAG,KAAK,aAAa,SAAS;AAAA;AAE9C,QAAM,gBAAgB,oBAAoB,QAAQ;AAClD,gBAAc,QAAQ,CAAC,MAAM,aAAa;AACxC,QAAI,aAAa,IAAK;AACtB,UAAM,eAAe,SAAS,MAAM,GAAG,EAAE;AACzC,UAAM,aAAa,cAAc,IAAI,YAAY;AACjD,QAAI,YAAY;AACd,YAAM,eAAe,uBAAuB,QAAQ;AACpD,mBAAa,IAAK,WAAW,YAAY,GAAG,YAAY,GAAG,KAAK,YAAY;AAAA;AAAA,IAC9E;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSDecisionGraphT } from '../../react-desc-prop-types.js';\n\n/** ************************************************************\n ***************** Mermaid Markdown Generator *****************\n ************************************************************ */\n\ntype FlatDecisionNode = {\n nodeText: string;\n path: DSDecisionGraphT.NodePath;\n nodeMarkdown?: DSDecisionGraphT.NodeMarkdown;\n};\nfunction nodePathToLinkMarkdown(nodePath: DSDecisionGraphT.NodePath): DSDecisionGraphT.LinkMarkdown {\n let linkMarkdown: DSDecisionGraphT.LinkMarkdown = '';\n switch (nodePath.charAt(nodePath.length - 1)) {\n case 't':\n linkMarkdown = `-->|true|`;\n break;\n case 'f':\n linkMarkdown = `-->|false|`;\n break;\n case 'o':\n linkMarkdown = `-->|N/A|`;\n break;\n default:\n break;\n }\n return linkMarkdown;\n}\nfunction isQuestionText(node: DSDecisionGraphT.DecisionNode): node is DSDecisionGraphT.QuestionNode {\n return (node.semanticMeaning && node.semanticMeaning === 'question') ?? false;\n}\n\nfunction nodeToMermaidMD(\n node: DSDecisionGraphT.DecisionNode,\n nodePath: DSDecisionGraphT.NodePath,\n): DSDecisionGraphT.NodeMarkdown {\n let nodeMarkdown: DSDecisionGraphT.NodeMarkdown;\n\n if (isQuestionText(node)) {\n nodeMarkdown = `${node?.repeatedId ?? nodePath}{{\"${node.nodeText}\"}}`;\n } else {\n nodeMarkdown = `${node?.repeatedId ?? nodePath}(\"${node.nodeText}\")`;\n }\n\n return nodeMarkdown;\n}\n\n/**\n * Recursively flattens a decision tree node and its children.\n * @param {DSDecisionGraphT.DecisionNode} node - The decision tree node to flatten.\n * @param { Map<DSDecisionGraphT.NodePath, FlatDecisionNode>} decisionNodes - the map to track the flattened nodes.\n * @param {DSDecisionGraphT.NodePath} nodePath - The path of the current node in the decision tree.\n */\nconst flatten = (\n node: DSDecisionGraphT.DecisionNode,\n decisionNodes: Map<DSDecisionGraphT.NodePath, FlatDecisionNode>,\n nodePath: DSDecisionGraphT.NodePath = 's' as DSDecisionGraphT.NodePath,\n) => {\n const decisionNode: FlatDecisionNode = {\n nodeText: node.nodeText,\n path: nodePath,\n nodeMarkdown: nodeToMermaidMD(node, nodePath),\n };\n decisionNodes.set(nodePath, decisionNode);\n if (node.truePath) {\n flatten(node.truePath, decisionNodes, `${nodePath}t`);\n }\n if (node.falsePath) {\n flatten(node.falsePath, decisionNodes, `${nodePath}f`);\n }\n if (node.notApplicablePath) {\n flatten(node.notApplicablePath, decisionNodes, `${nodePath}o`);\n }\n};\n\n/**\n * Flattens a decision tree into a map of flat decision nodes.\n * @param {DSDecisionGraphT.RootNode} rootNode - The root node of the decision tree to flatten.\n * @returns {Map<DSDecisionGraphT.NodePath, FlatDecisionNode>} A map of flat decision nodes, where each node is identified by its node ID.\n */\nconst flattenDecisionTree = (rootNode: DSDecisionGraphT.RootNode): Map<DSDecisionGraphT.NodePath, FlatDecisionNode> => {\n const decisionNodes: Map<DSDecisionGraphT.NodePath, FlatDecisionNode> = new Map();\n const treeToFlatten: DSDecisionGraphT.DecisionNode = rootNode.subtree;\n\n flatten(treeToFlatten, decisionNodes);\n return decisionNodes;\n};\n\n/**\n * Flattens a decision tree into a map of flat decision nodes.\n * @param {DSDecisionGraphT.RootNode} rootNode - The root node of the decision tree to flatten.\n * @param {DSDecisionGraphT.Directions} direction - direction of the flowchart, default is LR (left to right)\n * @returns {string} A map of flat decision nodes, where each node is identified by its node ID.\n */\nexport const decisionTreeToMermaidMD = (\n rootNode: DSDecisionGraphT.RootNode,\n direction: DSDecisionGraphT.Directions = 'LR',\n) => {\n const title = `---\\ntitle: ${rootNode.chartTitle}\\n---\\n`;\n let mermaidMD = `${title}flowchart ${direction};\\n`;\n // let mermaidMD = `flowchart LR;\\n subgraph ${rootNode.chartTitle};\\n`; // this add an highlight to the chart and the title\n const decisionNodes = flattenDecisionTree(rootNode);\n decisionNodes.forEach((node, nodePath) => {\n if (nodePath === 's') return;\n const parentNodeId = nodePath.slice(0, -1) as DSDecisionGraphT.NodePath;\n const parentNode = decisionNodes.get(parentNodeId);\n if (parentNode) {\n const linkMarkdown = nodePathToLinkMarkdown(nodePath);\n mermaidMD += `\\t${parentNode.nodeMarkdown}${linkMarkdown}${node.nodeMarkdown}\\n`;\n }\n });\n // mermaidMD += 'end;\\n';\n return mermaidMD;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACWvB,SAAS,uBAAuB,UAAoE;AAClG,MAAI,eAA8C;AAClD,UAAQ,SAAS,OAAO,SAAS,SAAS,CAAC,GAAG;AAAA,IAC5C,KAAK;AACH,qBAAe;AACf;AAAA,IACF,KAAK;AACH,qBAAe;AACf;AAAA,IACF,KAAK;AACH,qBAAe;AACf;AAAA,IACF;AACE;AAAA,EACJ;AACA,SAAO;AACT;AACA,SAAS,eAAe,MAA4E;AAClG,UAAQ,KAAK,mBAAmB,KAAK,oBAAoB,eAAe;AAC1E;AAEA,SAAS,gBACP,MACA,UAC+B;AAC/B,MAAI;AAEJ,MAAI,eAAe,IAAI,GAAG;AACxB,mBAAe,GAAG,MAAM,cAAc,QAAQ,MAAM,KAAK,QAAQ;AAAA,EACnE,OAAO;AACL,mBAAe,GAAG,MAAM,cAAc,QAAQ,KAAK,KAAK,QAAQ;AAAA,EAClE;AAEA,SAAO;AACT;AAQA,MAAM,UAAU,CACd,MACA,eACA,WAAsC,QACnC;AACH,QAAM,eAAiC;AAAA,IACrC,UAAU,KAAK;AAAA,IACf,MAAM;AAAA,IACN,cAAc,gBAAgB,MAAM,QAAQ;AAAA,EAC9C;AACA,gBAAc,IAAI,UAAU,YAAY;AACxC,MAAI,KAAK,UAAU;AACjB,YAAQ,KAAK,UAAU,eAAe,GAAG,QAAQ,GAAG;AAAA,EACtD;AACA,MAAI,KAAK,WAAW;AAClB,YAAQ,KAAK,WAAW,eAAe,GAAG,QAAQ,GAAG;AAAA,EACvD;AACA,MAAI,KAAK,mBAAmB;AAC1B,YAAQ,KAAK,mBAAmB,eAAe,GAAG,QAAQ,GAAG;AAAA,EAC/D;AACF;AAOA,MAAM,sBAAsB,CAAC,aAA0F;AACrH,QAAM,gBAAkE,oBAAI,IAAI;AAChF,QAAM,gBAA+C,SAAS;AAE9D,UAAQ,eAAe,aAAa;AACpC,SAAO;AACT;AAQO,MAAM,0BAA0B,CACrC,UACA,YAAyC,SACtC;AACH,QAAM,QAAQ;AAAA,SAAe,SAAS,UAAU;AAAA;AAAA;AAChD,MAAI,YAAY,GAAG,KAAK,aAAa,SAAS;AAAA;AAE9C,QAAM,gBAAgB,oBAAoB,QAAQ;AAClD,gBAAc,QAAQ,CAAC,MAAM,aAAa;AACxC,QAAI,aAAa,IAAK;AACtB,UAAM,eAAe,SAAS,MAAM,GAAG,EAAE;AACzC,UAAM,aAAa,cAAc,IAAI,YAAY;AACjD,QAAI,YAAY;AACd,YAAM,eAAe,uBAAuB,QAAQ;AACpD,mBAAa,IAAK,WAAW,YAAY,GAAG,YAAY,GAAG,KAAK,YAAY;AAAA;AAAA,IAC9E;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';
|
|
3
|
-
import { type DSDecisionGraphT } from '../react-desc-prop-types.js';
|
|
4
3
|
import type { DSGridT } from '@elliemae/ds-grid';
|
|
4
|
+
import { type DSDecisionGraphT } from '../react-desc-prop-types.js';
|
|
5
5
|
export interface DecisionGraphCTX {
|
|
6
6
|
propsWithDefault: DSDecisionGraphT.InternalProps;
|
|
7
7
|
globalProps: ReturnType<typeof useGetGlobalAttributes>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-decision-graph",
|
|
3
|
-
"version": "3.55.0-next.
|
|
3
|
+
"version": "3.55.0-next.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Decision Graph",
|
|
6
6
|
"files": [
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"ajv": "^8.17.1",
|
|
41
41
|
"mermaid": "^11.6.0",
|
|
42
42
|
"uid": "~2.0.2",
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-
|
|
45
|
-
"@elliemae/ds-props-helpers": "3.55.0-next.
|
|
46
|
-
"@elliemae/ds-
|
|
43
|
+
"@elliemae/ds-button": "3.55.0-next.8",
|
|
44
|
+
"@elliemae/ds-grid": "3.55.0-next.8",
|
|
45
|
+
"@elliemae/ds-props-helpers": "3.55.0-next.8",
|
|
46
|
+
"@elliemae/ds-system": "3.55.0-next.8"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"jest": "~29.7.0",
|
|
52
52
|
"lodash-es": "^4.17.21",
|
|
53
53
|
"styled-components": "~5.3.9",
|
|
54
|
-
"@elliemae/ds-monorepo-devops": "3.55.0-next.
|
|
54
|
+
"@elliemae/ds-monorepo-devops": "3.55.0-next.8"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"lodash-es": "^4.17.21",
|