@surveystudio/node-registery 1.0.0 → 1.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 +4 -4
- package/dist/builder.d.mts +5 -13
- package/dist/builder.mjs +1 -60
- package/dist/logic.d.mts +2 -2
- package/dist/runner.d.mts +3 -10
- package/dist/runner.mjs +1 -60
- package/dist/{types-DJePy6HU.d.mts → types-Bsz6x6iU.d.mts} +2 -17
- package/dist/types-HCD7-TAw.d.mts +18 -0
- package/dist/ui.d.mts +1724 -0
- package/dist/ui.mjs +32 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @surveystudio/node-registery
|
|
2
2
|
|
|
3
3
|
Typed survey question node registry with separate entrypoints for pure logic, runner UI, and builder UI.
|
|
4
4
|
|
|
@@ -7,9 +7,9 @@ This package is currently in early migration. It exports the first migrated node
|
|
|
7
7
|
## Entrypoints
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import { logicRegistry } from "@
|
|
11
|
-
import { runnerRegistry } from "@
|
|
12
|
-
import { builderRegistry } from "@
|
|
10
|
+
import { logicRegistry } from "@surveystudio/node-registery/logic";
|
|
11
|
+
import { runnerRegistry } from "@surveystudio/node-registery/runner";
|
|
12
|
+
import { builderRegistry } from "@surveystudio/node-registery/builder";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Use `/logic` for Worker, export, and server runtimes. It is intentionally React-free.
|
package/dist/builder.d.mts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { J as JsonValue } from './types-Bsz6x6iU.mjs';
|
|
2
|
+
export { B as BuilderRegistry, h as CompleteBuilderRegistry, i as NodeBuilder, j as NodeBuilderProps, k as NodeCanvasProps, l as NodeManifest, P as PropertyField, m as PropertyFieldType, Q as QuestionNodeDefinition, S as SelectOption, n as defineBuilderRegistry, b as defineQuestionNode } from './types-Bsz6x6iU.mjs';
|
|
3
|
+
import { P as PlainTextData } from './types-HCD7-TAw.mjs';
|
|
4
|
+
import 'react';
|
|
5
5
|
|
|
6
|
-
declare function PlainTextBuilderPreview({ data }: NodeCanvasProps<PlainTextData>): react.DetailedReactHTMLElement<{
|
|
7
|
-
style: CSSProperties;
|
|
8
|
-
}, HTMLElement>;
|
|
9
|
-
declare function PlainTextSettings(_props: NodeBuilderProps<PlainTextData>): null;
|
|
10
6
|
declare const plainTextBuilder: {
|
|
11
7
|
type: "plainText";
|
|
12
8
|
label: string;
|
|
13
|
-
SettingsComponent: typeof PlainTextSettings;
|
|
14
|
-
CanvasComponent: typeof PlainTextBuilderPreview;
|
|
15
9
|
};
|
|
16
10
|
|
|
17
11
|
declare const plainTextManifest: {
|
|
@@ -57,9 +51,7 @@ declare const builderRegistry: {
|
|
|
57
51
|
readonly plainText: {
|
|
58
52
|
type: "plainText";
|
|
59
53
|
label: string;
|
|
60
|
-
SettingsComponent: typeof PlainTextSettings;
|
|
61
|
-
CanvasComponent: typeof PlainTextBuilderPreview;
|
|
62
54
|
};
|
|
63
55
|
};
|
|
64
56
|
|
|
65
|
-
export {
|
|
57
|
+
export { builderRegistry, plainTextBuilder, plainTextManifest };
|
package/dist/builder.mjs
CHANGED
|
@@ -7,68 +7,9 @@ function defineBuilderRegistry(registry) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// src/nodes/plainText/builder.ts
|
|
10
|
-
import { createElement } from "react";
|
|
11
|
-
var shellStyle = {
|
|
12
|
-
display: "grid",
|
|
13
|
-
gap: "12px",
|
|
14
|
-
minWidth: "220px"
|
|
15
|
-
};
|
|
16
|
-
var titleStyle = {
|
|
17
|
-
color: "#111827",
|
|
18
|
-
fontSize: "14px",
|
|
19
|
-
fontWeight: 600,
|
|
20
|
-
lineHeight: 1.3,
|
|
21
|
-
margin: 0
|
|
22
|
-
};
|
|
23
|
-
var descriptionStyle = {
|
|
24
|
-
background: "#f3f4f6",
|
|
25
|
-
borderRadius: "6px",
|
|
26
|
-
color: "#4b5563",
|
|
27
|
-
fontSize: "12px",
|
|
28
|
-
lineHeight: 1.45,
|
|
29
|
-
margin: 0,
|
|
30
|
-
maxHeight: "96px",
|
|
31
|
-
overflow: "hidden",
|
|
32
|
-
padding: "8px",
|
|
33
|
-
whiteSpace: "pre-wrap"
|
|
34
|
-
};
|
|
35
|
-
var footerStyle = {
|
|
36
|
-
display: "flex",
|
|
37
|
-
justifyContent: "flex-end"
|
|
38
|
-
};
|
|
39
|
-
var buttonStyle = {
|
|
40
|
-
background: "#111827",
|
|
41
|
-
border: 0,
|
|
42
|
-
borderRadius: "6px",
|
|
43
|
-
color: "#ffffff",
|
|
44
|
-
fontSize: "12px",
|
|
45
|
-
fontWeight: 500,
|
|
46
|
-
padding: "4px 10px"
|
|
47
|
-
};
|
|
48
|
-
function PlainTextBuilderPreview({ data }) {
|
|
49
|
-
const label = data.label || "Info Screen";
|
|
50
|
-
const description = data.description || "No content provided...";
|
|
51
|
-
const buttonLabel = data.buttonLabel || "Continue";
|
|
52
|
-
return createElement(
|
|
53
|
-
"div",
|
|
54
|
-
{ style: shellStyle },
|
|
55
|
-
createElement("p", { style: titleStyle }, label),
|
|
56
|
-
createElement("p", { style: descriptionStyle }, description),
|
|
57
|
-
createElement(
|
|
58
|
-
"div",
|
|
59
|
-
{ style: footerStyle },
|
|
60
|
-
createElement("button", { disabled: true, style: buttonStyle, type: "button" }, buttonLabel)
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
function PlainTextSettings(_props) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
10
|
var plainTextBuilder = {
|
|
68
11
|
type: "plainText",
|
|
69
|
-
label: "Info / Text"
|
|
70
|
-
SettingsComponent: PlainTextSettings,
|
|
71
|
-
CanvasComponent: PlainTextBuilderPreview
|
|
12
|
+
label: "Info / Text"
|
|
72
13
|
};
|
|
73
14
|
|
|
74
15
|
// src/nodes/plainText/manifest.ts
|
package/dist/logic.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PlainTextData, a as PlainTextValue } from './types-
|
|
2
|
-
export { C as CompleteLogicRegistry, D as DataType, E as ExtractedValue,
|
|
1
|
+
import { P as PlainTextData, a as PlainTextValue } from './types-HCD7-TAw.mjs';
|
|
2
|
+
export { C as CompleteLogicRegistry, D as DataType, E as ExtractedValue, a as ExtractionContext, L as LogicRegistry, N as NodeLogic, Q as QuestionNodeDefinition, V as ValidationResult, d as defineLogicRegistry, b as defineQuestionNode } from './types-Bsz6x6iU.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
declare const plainTextLogic: {
|
package/dist/runner.d.mts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { e as NodeRunnerProps, P as PlainTextData, a as PlainTextValue } from './types-DJePy6HU.mjs';
|
|
4
|
-
export { f as CompleteRunnerRegistry, g as NodeRunner, Q as QuestionNodeDefinition, R as RunnerRegistry, c as defineQuestionNode, h as defineRunnerRegistry } from './types-DJePy6HU.mjs';
|
|
1
|
+
export { c as CompleteRunnerRegistry, e as NodeRunner, f as NodeRunnerProps, Q as QuestionNodeDefinition, R as RunnerRegistry, b as defineQuestionNode, g as defineRunnerRegistry } from './types-Bsz6x6iU.mjs';
|
|
2
|
+
import 'react';
|
|
5
3
|
|
|
6
|
-
declare function PlainTextRunnerView({ data, onChange, onNext, isActive, }: NodeRunnerProps<PlainTextData, PlainTextValue>): react.DetailedReactHTMLElement<{
|
|
7
|
-
style: CSSProperties;
|
|
8
|
-
}, HTMLElement>;
|
|
9
4
|
declare const plainTextRunner: {
|
|
10
5
|
type: "plainText";
|
|
11
|
-
Component: typeof PlainTextRunnerView;
|
|
12
6
|
};
|
|
13
7
|
|
|
14
8
|
declare const runnerRegistry: {
|
|
15
9
|
readonly plainText: {
|
|
16
10
|
type: "plainText";
|
|
17
|
-
Component: typeof PlainTextRunnerView;
|
|
18
11
|
};
|
|
19
12
|
};
|
|
20
13
|
|
|
21
|
-
export {
|
|
14
|
+
export { plainTextRunner, runnerRegistry };
|
package/dist/runner.mjs
CHANGED
|
@@ -7,67 +7,8 @@ function defineRunnerRegistry(registry) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// src/nodes/plainText/runner.ts
|
|
10
|
-
import { createElement } from "react";
|
|
11
|
-
var shellStyle = {
|
|
12
|
-
display: "grid",
|
|
13
|
-
gap: "24px",
|
|
14
|
-
maxWidth: "576px",
|
|
15
|
-
padding: "16px 0",
|
|
16
|
-
width: "100%"
|
|
17
|
-
};
|
|
18
|
-
var descriptionStyle = {
|
|
19
|
-
color: "#334155",
|
|
20
|
-
fontSize: "18px",
|
|
21
|
-
lineHeight: 1.65,
|
|
22
|
-
margin: 0,
|
|
23
|
-
whiteSpace: "pre-wrap"
|
|
24
|
-
};
|
|
25
|
-
var buttonStyle = {
|
|
26
|
-
alignItems: "center",
|
|
27
|
-
background: "#111827",
|
|
28
|
-
border: 0,
|
|
29
|
-
borderRadius: "999px",
|
|
30
|
-
color: "#ffffff",
|
|
31
|
-
cursor: "pointer",
|
|
32
|
-
display: "inline-flex",
|
|
33
|
-
fontSize: "15px",
|
|
34
|
-
fontWeight: 600,
|
|
35
|
-
gap: "8px",
|
|
36
|
-
justifySelf: "start",
|
|
37
|
-
padding: "12px 24px"
|
|
38
|
-
};
|
|
39
|
-
function PlainTextRunnerView({
|
|
40
|
-
data,
|
|
41
|
-
onChange,
|
|
42
|
-
onNext,
|
|
43
|
-
isActive
|
|
44
|
-
}) {
|
|
45
|
-
const description = data.description || "No description provided...";
|
|
46
|
-
const buttonLabel = data.buttonLabel || "Continue";
|
|
47
|
-
const children = [createElement("p", { key: "description", style: descriptionStyle }, description)];
|
|
48
|
-
if (isActive) {
|
|
49
|
-
children.push(
|
|
50
|
-
createElement(
|
|
51
|
-
"button",
|
|
52
|
-
{
|
|
53
|
-
key: "button",
|
|
54
|
-
onClick: () => {
|
|
55
|
-
onChange({ viewed: true });
|
|
56
|
-
onNext?.();
|
|
57
|
-
},
|
|
58
|
-
style: buttonStyle,
|
|
59
|
-
type: "button"
|
|
60
|
-
},
|
|
61
|
-
buttonLabel,
|
|
62
|
-
" ->"
|
|
63
|
-
)
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
return createElement("div", { style: shellStyle }, children);
|
|
67
|
-
}
|
|
68
10
|
var plainTextRunner = {
|
|
69
|
-
type: "plainText"
|
|
70
|
-
Component: PlainTextRunnerView
|
|
11
|
+
type: "plainText"
|
|
71
12
|
};
|
|
72
13
|
|
|
73
14
|
// src/runner/index.ts
|
|
@@ -79,7 +79,7 @@ interface NodeRunnerProps<TData extends NodeData = NodeData, TValue extends Node
|
|
|
79
79
|
}
|
|
80
80
|
interface NodeRunner<TType extends SurveyNodeType = SurveyNodeType, TData extends NodeData = NodeData, TValue extends NodeValue = NodeValue> {
|
|
81
81
|
readonly type: TType;
|
|
82
|
-
readonly Component
|
|
82
|
+
readonly Component?: ComponentType<NodeRunnerProps<TData, TValue>>;
|
|
83
83
|
}
|
|
84
84
|
interface NodeBuilderProps<TData extends NodeData = NodeData> {
|
|
85
85
|
readonly data: Readonly<TData>;
|
|
@@ -122,19 +122,4 @@ declare function defineLogicRegistry<const TRegistry extends RegistryKeySet>(reg
|
|
|
122
122
|
declare function defineBuilderRegistry<const TRegistry extends RegistryKeySet>(registry: TRegistry): TRegistry;
|
|
123
123
|
declare function defineRunnerRegistry<const TRegistry extends RegistryKeySet>(registry: TRegistry): TRegistry;
|
|
124
124
|
|
|
125
|
-
type
|
|
126
|
-
label: string;
|
|
127
|
-
description: string;
|
|
128
|
-
buttonLabel: string;
|
|
129
|
-
condition: {
|
|
130
|
-
id: string;
|
|
131
|
-
type: "group";
|
|
132
|
-
logicType: "AND" | "OR";
|
|
133
|
-
children: JsonValue[];
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
type PlainTextValue = {
|
|
137
|
-
viewed: boolean;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
export { type BuilderRegistry as B, type CompleteLogicRegistry as C, type DataType as D, type ExtractedValue as E, type JsonValue as J, type LogicRegistry as L, type NodeLogic as N, type PlainTextData as P, type QuestionNodeDefinition as Q, type RunnerRegistry as R, type SelectOption as S, type ValidationResult as V, type PlainTextValue as a, type ExtractionContext as b, defineQuestionNode as c, defineLogicRegistry as d, type NodeRunnerProps as e, type CompleteRunnerRegistry as f, type NodeRunner as g, defineRunnerRegistry as h, type NodeBuilderProps as i, type NodeCanvasProps as j, type CompleteBuilderRegistry as k, type NodeBuilder as l, type NodeManifest as m, type PropertyField as n, type PropertyFieldType as o, defineBuilderRegistry as p };
|
|
125
|
+
export { type BuilderRegistry as B, type CompleteLogicRegistry as C, type DataType as D, type ExtractedValue as E, type JsonValue as J, type LogicRegistry as L, type NodeLogic as N, type PropertyField as P, type QuestionNodeDefinition as Q, type RunnerRegistry as R, type SelectOption as S, type ValidationResult as V, type ExtractionContext as a, defineQuestionNode as b, type CompleteRunnerRegistry as c, defineLogicRegistry as d, type NodeRunner as e, type NodeRunnerProps as f, defineRunnerRegistry as g, type CompleteBuilderRegistry as h, type NodeBuilder as i, type NodeBuilderProps as j, type NodeCanvasProps as k, type NodeManifest as l, type PropertyFieldType as m, defineBuilderRegistry as n, type NodeData as o };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { o as NodeData, J as JsonValue } from './types-Bsz6x6iU.mjs';
|
|
2
|
+
|
|
3
|
+
type PlainTextData = NodeData & {
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
buttonLabel: string;
|
|
7
|
+
condition: {
|
|
8
|
+
id: string;
|
|
9
|
+
type: "group";
|
|
10
|
+
logicType: "AND" | "OR";
|
|
11
|
+
children: JsonValue[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type PlainTextValue = {
|
|
15
|
+
viewed: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type { PlainTextData as P, PlainTextValue as a };
|