@shelf/global-renderer 2.4.0 → 3.0.1

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/README.md CHANGED
@@ -10,6 +10,7 @@ $ pnpm add @shelf/global-renderer
10
10
 
11
11
  ```sh
12
12
  $ git checkout master
13
+ $ pnpm build
13
14
  $ pnpm version
14
15
  $ pnpm publish
15
16
  $ git push origin master --tags
@@ -0,0 +1,3 @@
1
+ import type { RenderDTContentData } from './types';
2
+ declare const DecisionTreeContent: ({ title, description, tree, exportedBy, exportedAt, createdBy, fields, variables, }: RenderDTContentData) => import("react/jsx-runtime").JSX.Element;
3
+ export default DecisionTreeContent;
@@ -0,0 +1,48 @@
1
+ export declare const DTContentContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
+ export declare const DTMeta: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ export declare const DTIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ export declare const DTInternalMeta: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
+ export declare const DTTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
+ export declare const DTDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
+ export declare const DTContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
8
+ export declare const StepContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
9
+ export declare const StepNumber: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
10
+ export declare const StepTypeContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
11
+ export declare const StepHeaderBlock: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
12
+ export declare const StepHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
13
+ export declare const StepType: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
14
+ $color?: string;
15
+ }>> & string;
16
+ export declare const StepTypeTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
17
+ export declare const ContentTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
18
+ export declare const Content: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
19
+ export declare const Question: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
20
+ export declare const QuestionTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
21
+ export declare const QuestionDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
22
+ export declare const Answer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
23
+ export declare const AnswerWithAssignments: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
24
+ export declare const AnswerNumber: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
25
+ export declare const AssignmentIconBlock: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
26
+ export declare const AssignmentIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
27
+ export declare const AnswerTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
28
+ export declare const AnswerVariable: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
29
+ $isDeleted?: boolean;
30
+ }>> & string;
31
+ export declare const Condition: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
32
+ export declare const Rule: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
33
+ export declare const StepLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
34
+ export declare const StepParents: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
35
+ export declare const ParentLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
36
+ export declare const LinkUrl: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
37
+ export declare const NoLinks: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
38
+ export declare const ContentList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
39
+ export declare const ContentListItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
40
+ export declare const ContentListLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
41
+ export declare const ContentListNumber: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
42
+ export declare const ContentListIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
43
+ export declare const MetaBlock: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
44
+ export declare const MataInfo: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
45
+ export declare const CustomFields: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
46
+ export declare const CustomField: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
47
+ export declare const FieldName: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
48
+ export declare const FieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -0,0 +1,7 @@
1
+ import type { DecisionTree } from '@shelf/types-ddb';
2
+ import type { DTStep } from '../types';
3
+ declare const _default: ({ step, variables, }: {
4
+ step: DTStep;
5
+ variables: Pick<DecisionTree.ContextualVariableDefaults, "name" | "id" | "isDeleted">[];
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { DTStep } from '../types';
2
+ declare const _default: ({ tree }: {
3
+ tree: DTStep[];
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: ({ exportedAt, exportedBy, createdBy, }: {
2
+ exportedAt: string;
3
+ exportedBy: string;
4
+ createdBy: string;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { DTStep } from '../types';
2
+ declare const _default: ({ step }: {
3
+ step: DTStep;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type { DecisionTree } from '@shelf/types-ddb';
2
+ import type { DTStep } from '../types';
3
+ declare const _default: ({ step, variables, }: {
4
+ step: DTStep;
5
+ variables: Pick<DecisionTree.ContextualVariableDefaults, "name" | "id" | "isDeleted">[];
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { DTStep } from '../types';
2
+ declare const _default: ({ step }: {
3
+ step: DTStep;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { DTStep } from '../types';
2
+ declare const _default: ({ step }: {
3
+ step: DTStep;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ import type { IconProps } from '@shelf/icons';
3
+ import type { DTStep } from '../types';
4
+ declare const StepTypeIcon: FC<{
5
+ type: DTStep['type'];
6
+ } & IconProps>;
7
+ export default StepTypeIcon;
@@ -0,0 +1,44 @@
1
+ import type { DTStep, DTStepFromApi } from './types';
2
+ export declare const TYPES_TO_LINK: string[];
3
+ export declare const getTreeWithParentSteps: (tree: Omit<DTStep, "parentSteps">[]) => {
4
+ parentSteps: {
5
+ id: string;
6
+ number: number;
7
+ }[];
8
+ number: number;
9
+ id: string;
10
+ question: {
11
+ id: string;
12
+ title?: string;
13
+ description?: string;
14
+ answers: {
15
+ id: string;
16
+ title?: string;
17
+ nextStep?: {
18
+ id?: string;
19
+ number?: number;
20
+ };
21
+ assignments?: import("@shelf/types-ddb/lib/decision-tree").Assignment[];
22
+ }[];
23
+ };
24
+ type: import("@shelf/types-ddb/lib/decision-tree").StepType;
25
+ title?: string | undefined;
26
+ textS3Key?: string | undefined;
27
+ url?: string | undefined;
28
+ settings?: import("@shelf/types-ddb/lib/decision-tree").StepSettings | undefined;
29
+ defaultNextStep?: ({
30
+ id: string;
31
+ } & {
32
+ id: string;
33
+ number?: string;
34
+ }) | undefined;
35
+ conditions?: (import("@shelf/types-ddb/lib/decision-tree").Condition[] & import("./types").ConditionType[]) | undefined;
36
+ isFirstStep?: boolean | undefined;
37
+ content?: string | undefined;
38
+ linkedSteps?: {
39
+ id?: string;
40
+ number?: number;
41
+ }[] | undefined;
42
+ }[];
43
+ export declare const convertStepToRenderFormat: (tree: DTStepFromApi[]) => DTStep[];
44
+ export declare const getDateAndTime: (date: string) => string;
@@ -0,0 +1,116 @@
1
+ import type { RenderDTContentData } from './types';
2
+ export declare const dtData: RenderDTContentData;
3
+ export declare const initialTree: ({
4
+ id: string;
5
+ title: string;
6
+ type: string;
7
+ question: {
8
+ id: string;
9
+ title: string;
10
+ description: string;
11
+ answers: {
12
+ title: string;
13
+ id: string;
14
+ nextStep: {
15
+ id: string;
16
+ };
17
+ }[];
18
+ };
19
+ isFirstStep?: undefined;
20
+ url?: undefined;
21
+ } | {
22
+ id: string;
23
+ title: string;
24
+ type: string;
25
+ isFirstStep: boolean;
26
+ url: null;
27
+ question: {
28
+ id: string;
29
+ title: string;
30
+ description: string;
31
+ answers: {
32
+ title: string;
33
+ id: string;
34
+ nextStep: {
35
+ id: string;
36
+ };
37
+ }[];
38
+ };
39
+ } | {
40
+ id: string;
41
+ title: string;
42
+ type: string;
43
+ url: null;
44
+ question: null;
45
+ isFirstStep?: undefined;
46
+ } | {
47
+ id: string;
48
+ title: string;
49
+ type: string;
50
+ url: string;
51
+ question: null;
52
+ isFirstStep?: undefined;
53
+ })[];
54
+ export declare const treeWithLinkedSteps: ({
55
+ id: string;
56
+ number: number;
57
+ title: string;
58
+ type: string;
59
+ url: null;
60
+ question: {
61
+ id: string;
62
+ title: string;
63
+ description: string;
64
+ answers: {
65
+ title: string;
66
+ id: string;
67
+ nextStep: {
68
+ id: string;
69
+ number: number;
70
+ };
71
+ }[];
72
+ };
73
+ linkedSteps: {
74
+ id: string;
75
+ number: number;
76
+ }[];
77
+ } | {
78
+ id: string;
79
+ number: number;
80
+ title: string;
81
+ type: string;
82
+ question: {
83
+ id: string;
84
+ title: string;
85
+ description: string;
86
+ answers: {
87
+ title: string;
88
+ id: string;
89
+ nextStep: {
90
+ id: string;
91
+ number: number;
92
+ };
93
+ }[];
94
+ };
95
+ linkedSteps: {
96
+ id: string;
97
+ number: number;
98
+ }[];
99
+ url?: undefined;
100
+ } | {
101
+ id: string;
102
+ number: number;
103
+ title: string;
104
+ type: string;
105
+ url: null;
106
+ question: null;
107
+ linkedSteps?: undefined;
108
+ } | {
109
+ id: string;
110
+ number: number;
111
+ title: string;
112
+ type: string;
113
+ url: string;
114
+ question: null;
115
+ linkedSteps?: undefined;
116
+ })[];
@@ -0,0 +1,2 @@
1
+ import type { RenderDTContentData } from './types';
2
+ export declare const renderDTContent: (data: RenderDTContentData, containerSelector?: string) => void;
@@ -0,0 +1,61 @@
1
+ import type { DecisionTree } from '@shelf/types-ddb';
2
+ import type { L10n } from '@shelf/types';
3
+ export type DTStepFromApi = DecisionTree.Step & {
4
+ content?: string;
5
+ isFirstStep?: boolean;
6
+ };
7
+ export type RenderDTContentData = {
8
+ tree: DTStepFromApi[];
9
+ title: string;
10
+ description: string;
11
+ language: L10n.LanguageCode;
12
+ exportedAt: string;
13
+ exportedBy: string;
14
+ createdBy: string;
15
+ fields?: {
16
+ name: string;
17
+ value: string;
18
+ }[];
19
+ variables: Pick<DecisionTree.ContextualVariableDefaults, 'name' | 'id' | 'isDeleted'>[];
20
+ };
21
+ type StepPointer = {
22
+ id?: string;
23
+ number?: number;
24
+ };
25
+ export type ConditionType = {
26
+ id: string;
27
+ expression: {
28
+ joiner?: DecisionTree.Joiners;
29
+ rules: {
30
+ id: string;
31
+ variableId: string;
32
+ operator: DecisionTree.Operators;
33
+ value: string;
34
+ }[];
35
+ };
36
+ nextStep?: StepPointer;
37
+ };
38
+ export type DTStep = Omit<DecisionTree.Step, 'question'> & {
39
+ number: number;
40
+ content?: string;
41
+ isFirstStep?: boolean;
42
+ question: {
43
+ id: string;
44
+ title?: string;
45
+ description?: string;
46
+ answers: {
47
+ id: string;
48
+ title?: string;
49
+ nextStep?: StepPointer;
50
+ assignments?: DecisionTree.Assignment[];
51
+ }[];
52
+ };
53
+ conditions?: ConditionType[];
54
+ linkedSteps?: StepPointer[];
55
+ parentSteps: StepPointer[];
56
+ defaultNextStep?: {
57
+ id: string;
58
+ number?: string;
59
+ };
60
+ };
61
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { DecisionTree } from '@shelf/types-ddb';
2
+ declare const StaticTreeContainer: ({ tree, variables, }: {
3
+ tree: DecisionTree.Step[];
4
+ variables: DecisionTree.ContextualVariableDefaults[];
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default StaticTreeContainer;
@@ -0,0 +1,8 @@
1
+ import type { L10n } from '@shelf/types';
2
+ import type { DecisionTree } from '@shelf/types-ddb';
3
+ export declare const renderStaticDTDiagram: ({ language, tree, variables, containerSelector, }: {
4
+ language?: L10n.LanguageCode;
5
+ tree: DecisionTree.Step[];
6
+ variables: DecisionTree.ContextualVariableDefaults[];
7
+ containerSelector?: string;
8
+ }) => void;
@@ -0,0 +1,3 @@
1
+ declare const i18next: import("i18next").i18n;
2
+ export { i18next };
3
+ export default i18next;
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './DecisionTreeContent/types';