@sealcode/jdd 0.8.6 → 0.8.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/@types/component-arguments/nested-component.d.ts +63 -11
- package/@types/component.d.ts +2 -1
- package/lib/component-arguments/nested-component.js +153 -136
- package/lib/component-arguments/nested-component.js.map +1 -1
- package/lib/component.js +10 -1
- package/lib/component.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,29 +1,81 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import { ComponentArgument } from "./component-argument.js";
|
|
3
|
-
import { ContainerArgument } from "./container-argument.js";
|
|
4
3
|
import { Registry } from "../registry.js";
|
|
5
4
|
import { Enum } from "./enum.js";
|
|
6
5
|
import { JDDContext } from "../jdd-context.js";
|
|
7
6
|
import { Structured } from "./structured.js";
|
|
8
|
-
|
|
7
|
+
import { FlatTemplatable } from "tempstream";
|
|
8
|
+
export declare abstract class NestedComponentValue {
|
|
9
|
+
abstract render(jdd_context: JDDContext, params?: {
|
|
10
|
+
arg_overrides?: Record<string, unknown>;
|
|
11
|
+
classes?: string[];
|
|
12
|
+
index?: number;
|
|
13
|
+
}): FlatTemplatable | Promise<FlatTemplatable>;
|
|
14
|
+
abstract toStorage(jdd_context: JDDContext): Record<string, unknown>;
|
|
15
|
+
abstract countWords(jdd_context: JDDContext): number;
|
|
16
|
+
abstract getComponentName(): string;
|
|
17
|
+
abstract getArgumentValues(): Record<string, unknown>;
|
|
18
|
+
abstract getCSSClumps(jdd_context: JDDContext): string[];
|
|
19
|
+
abstract isEmpty(): boolean;
|
|
20
|
+
static fromReceived(jdd_context: JDDContext, data: Record<string, unknown>): Promise<NestedComponentValueEmpty | NestedComponentValueFull>;
|
|
21
|
+
static fromStorage(jdd_context: JDDContext, data: Record<string, unknown>): Promise<NestedComponentValueEmpty | NestedComponentValueFull>;
|
|
22
|
+
}
|
|
23
|
+
export declare class NestedComponentValueEmpty extends NestedComponentValue {
|
|
24
|
+
constructor();
|
|
25
|
+
isEmpty(): boolean;
|
|
26
|
+
getCSSClumps(): string[];
|
|
27
|
+
getComponentName(): string;
|
|
28
|
+
getArgumentValues(): Record<string, unknown>;
|
|
29
|
+
render(): string;
|
|
30
|
+
toStorage(): {
|
|
31
|
+
component_name: string;
|
|
32
|
+
};
|
|
33
|
+
countWords(): number;
|
|
34
|
+
}
|
|
35
|
+
export declare class NestedComponentValueFull extends NestedComponentValue {
|
|
36
|
+
component_name: string;
|
|
37
|
+
parsed_arguments: Record<string, unknown>;
|
|
38
|
+
constructor(component_name: string, parsed_arguments: Record<string, unknown>);
|
|
39
|
+
isEmpty(): boolean;
|
|
40
|
+
getComponentName(): string;
|
|
41
|
+
getArgumentValues(): Record<string, unknown>;
|
|
42
|
+
render(jdd_context: JDDContext, { classes, arg_overrides, index, }?: {
|
|
43
|
+
arg_overrides?: Record<string, unknown>;
|
|
44
|
+
classes?: string[];
|
|
45
|
+
index?: number;
|
|
46
|
+
}): Promise<(string | number | import("stream").Readable | null) | (string | number | import("stream").Readable | null)[] | Promise<string | number | import("stream").Readable | null>[]>;
|
|
47
|
+
getComponent(jdd_context: JDDContext): import("../component.js").Component<Record<string, ComponentArgument<unknown, unknown, unknown>>>;
|
|
48
|
+
toStorage(jdd_context: JDDContext): {
|
|
49
|
+
component_name: string;
|
|
50
|
+
parsed_args: Promise<import("./component-argument.js").ExtractStructuredComponentArgumentsStorage<Record<string, ComponentArgument<unknown, unknown, unknown>>>>;
|
|
51
|
+
};
|
|
52
|
+
getCSSClumps(jdd_context: JDDContext): string[];
|
|
53
|
+
countWords(jdd_context: JDDContext): number;
|
|
54
|
+
}
|
|
55
|
+
export declare class NestedComponent extends ComponentArgument<NestedComponentValue, Record<string, unknown>, Record<string, unknown>> {
|
|
56
|
+
default_component_name: string;
|
|
57
|
+
constructor(default_component_name?: string);
|
|
58
|
+
parsedToStorage(jdd_context: JDDContext, value: NestedComponentValue): Promise<Record<string, unknown>>;
|
|
59
|
+
storageToParsed(context: JDDContext, value: Record<string, unknown>): Promise<NestedComponentValue>;
|
|
9
60
|
getTypeName(): string;
|
|
10
|
-
|
|
61
|
+
makeComponentPickerArgument(registry: Registry): Enum<string>;
|
|
11
62
|
getInnerStructure(registry: Registry, component_name: string): Record<string, ComponentArgument<unknown>>;
|
|
12
63
|
getStructure(registry: Registry, component_name: string): {
|
|
13
|
-
[x: string]: Structured<Record<string, ComponentArgument<unknown, unknown, unknown>>> | Enum<string>;
|
|
14
64
|
component_name: Enum<string>;
|
|
65
|
+
parsed_arguments?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
component_name: Enum<string>;
|
|
68
|
+
parsed_arguments: Structured<Record<string, ComponentArgument<unknown, unknown, unknown>>>;
|
|
15
69
|
};
|
|
16
|
-
getSubArgument(ctx: JDDContext, [key, ...rest]: string[], value:
|
|
17
|
-
countWords(ctx: JDDContext, value:
|
|
18
|
-
getEmptyValue(ctx: JDDContext):
|
|
19
|
-
getExampleValue(context: JDDContext): Promise<
|
|
20
|
-
processAllSubarguments(context: JDDContext, input: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<Record<string, unknown> | Record<string, unknown>[]>;
|
|
70
|
+
getSubArgument(ctx: JDDContext, [key, ...rest]: string[], value: NestedComponentValue): readonly [ComponentArgument<any> | null, string[], unknown];
|
|
71
|
+
countWords(ctx: JDDContext, value: NestedComponentValue): number;
|
|
72
|
+
getEmptyValue(ctx: JDDContext): NestedComponentValue;
|
|
73
|
+
getExampleValue(context: JDDContext): Promise<NestedComponentValue>;
|
|
21
74
|
static render({ jdd_context, data, classes, index, }: {
|
|
22
75
|
jdd_context: JDDContext;
|
|
23
76
|
data: Record<string, unknown>;
|
|
24
77
|
classes?: string[];
|
|
25
78
|
index?: number;
|
|
26
79
|
}): string | number | import("stream").Readable | (string | number | import("stream").Readable | null)[] | Promise<string | number | import("stream").Readable | null>[] | Promise<import("tempstream/@types/stringify.js").Stringifiable> | null;
|
|
27
|
-
|
|
28
|
-
receivedToParsed(context: JDDContext, value: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
80
|
+
receivedToParsed(context: JDDContext, value: Record<string, unknown>): Promise<NestedComponentValue>;
|
|
29
81
|
}
|
package/@types/component.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type ComponentToHTMLArgs<T extends Record<string, ComponentArgument<unkno
|
|
|
26
26
|
};
|
|
27
27
|
export declare abstract class Component<ArgumentsT extends Record<string, ComponentArgument<unknown>> = Record<string, ComponentArgument<unknown>>> {
|
|
28
28
|
name: string;
|
|
29
|
-
constructor(name
|
|
29
|
+
constructor(name?: string);
|
|
30
30
|
abstract getArguments(): ArgumentsT;
|
|
31
31
|
abstract toHTML(params: ComponentToHTMLArgs<ArgumentsT>): FlatTemplatable | Promise<FlatTemplatable>;
|
|
32
32
|
getTitle(_context: JDDContext, _args: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): string | null;
|
|
@@ -35,6 +35,7 @@ export declare abstract class Component<ArgumentsT extends Record<string, Compon
|
|
|
35
35
|
getEarlyAssets(_args: ExtractStructuredComponentArgumentsParsed<ArgumentsT>, _context: JDDContext): Promise<EarlyAsset[]>;
|
|
36
36
|
countWords(ctx: JDDContext, args: Record<string, unknown>): number;
|
|
37
37
|
getExampleValues(context: JDDContext): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
|
|
38
|
+
getEmptyValues(context: JDDContext): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
|
|
38
39
|
convertReceivedValuesToParsed(context: JDDContext, values: ExtractStructuredComponentArgumentsReceived<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
|
|
39
40
|
convertParsedToStorage(context: JDDContext, values: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsStorage<ArgumentsT>>;
|
|
40
41
|
convertStorageToParsed(context: JDDContext, values: ExtractStructuredComponentArgumentsStorage<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
|
|
@@ -1,139 +1,186 @@
|
|
|
1
1
|
import { is, predicates } from "@sealcode/ts-predicates";
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentArgument } from "./component-argument.js";
|
|
3
3
|
import { Enum } from "./enum.js";
|
|
4
4
|
import { Structured } from "./structured.js";
|
|
5
5
|
import { componentNameToCSSClump } from "../clumps.js";
|
|
6
|
-
export class
|
|
6
|
+
export class NestedComponentValue {
|
|
7
|
+
static async fromReceived(jdd_context, data) {
|
|
8
|
+
const component_name = data.component_name;
|
|
9
|
+
if (!is(component_name, predicates.string)) {
|
|
10
|
+
throw new Error("Missing component_name");
|
|
11
|
+
}
|
|
12
|
+
if (component_name == "empty") {
|
|
13
|
+
return new NestedComponentValueEmpty();
|
|
14
|
+
}
|
|
15
|
+
const component = jdd_context.registry.get(component_name);
|
|
16
|
+
if (!component) {
|
|
17
|
+
throw new Error(`Unknown component: ${component_name}`);
|
|
18
|
+
}
|
|
19
|
+
const parsed_arguments = await component.convertReceivedValuesToParsed(jdd_context,
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
21
|
+
data.parsed_arguments || {});
|
|
22
|
+
return new NestedComponentValueFull(component_name, parsed_arguments);
|
|
23
|
+
}
|
|
24
|
+
static async fromStorage(jdd_context, data) {
|
|
25
|
+
return NestedComponentValue.fromReceived(jdd_context, data);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export class NestedComponentValueEmpty extends NestedComponentValue {
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
}
|
|
32
|
+
isEmpty() {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
getCSSClumps() {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
getComponentName() {
|
|
39
|
+
return "empty";
|
|
40
|
+
}
|
|
41
|
+
getArgumentValues() {
|
|
42
|
+
return { component_name: "empty" };
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return "";
|
|
46
|
+
}
|
|
47
|
+
toStorage() {
|
|
48
|
+
return { component_name: "empty" };
|
|
49
|
+
}
|
|
50
|
+
countWords() {
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export class NestedComponentValueFull extends NestedComponentValue {
|
|
55
|
+
constructor(component_name, parsed_arguments) {
|
|
56
|
+
super();
|
|
57
|
+
this.component_name = component_name;
|
|
58
|
+
this.parsed_arguments = parsed_arguments;
|
|
59
|
+
}
|
|
60
|
+
isEmpty() {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
getComponentName() {
|
|
64
|
+
return this.component_name;
|
|
65
|
+
}
|
|
66
|
+
// this will be used to pick the values of all subfields, including the
|
|
67
|
+
// component_name.
|
|
68
|
+
// jdd-editor uses this to display all the necessary controls
|
|
69
|
+
getArgumentValues() {
|
|
70
|
+
return {
|
|
71
|
+
component_name: this.component_name,
|
|
72
|
+
parsed_arguments: this.parsed_arguments,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async render(jdd_context, { classes, arg_overrides, index, } = {}) {
|
|
76
|
+
const component = jdd_context.registry.get(this.component_name);
|
|
77
|
+
const args = {
|
|
78
|
+
...((await component?.getEmptyValues(jdd_context)) || {}),
|
|
79
|
+
...this.parsed_arguments,
|
|
80
|
+
...(arg_overrides || {}),
|
|
81
|
+
};
|
|
82
|
+
if (!component) {
|
|
83
|
+
return "Unknown component: ${component_name}";
|
|
84
|
+
}
|
|
85
|
+
return component.toHTML({
|
|
86
|
+
args,
|
|
87
|
+
classes: classes || [],
|
|
88
|
+
jdd_context,
|
|
89
|
+
index: index || 0,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
getComponent(jdd_context) {
|
|
93
|
+
const component = jdd_context.registry.get(this.component_name);
|
|
94
|
+
if (!component) {
|
|
95
|
+
throw new Error(`Unknown component: ${this.component_name}`);
|
|
96
|
+
}
|
|
97
|
+
return component;
|
|
98
|
+
}
|
|
99
|
+
toStorage(jdd_context) {
|
|
100
|
+
const component = this.getComponent(jdd_context);
|
|
101
|
+
return {
|
|
102
|
+
component_name: this.component_name,
|
|
103
|
+
[`parsed_args`]: component.convertParsedToStorage(jdd_context, this.parsed_arguments),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
getCSSClumps(jdd_context) {
|
|
107
|
+
const component = this.getComponent(jdd_context);
|
|
108
|
+
return [
|
|
109
|
+
componentNameToCSSClump(this.component_name),
|
|
110
|
+
...component.getCSSClumps(jdd_context, this.parsed_arguments),
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
countWords(jdd_context) {
|
|
114
|
+
return this.getComponent(jdd_context).countWords(jdd_context, this.parsed_arguments);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export class NestedComponent extends ComponentArgument {
|
|
118
|
+
constructor(default_component_name = "tekst") {
|
|
119
|
+
super();
|
|
120
|
+
this.default_component_name = default_component_name;
|
|
121
|
+
}
|
|
122
|
+
async parsedToStorage(jdd_context, value) {
|
|
123
|
+
if (!value) {
|
|
124
|
+
return {};
|
|
125
|
+
}
|
|
126
|
+
return value.toStorage(jdd_context);
|
|
127
|
+
}
|
|
128
|
+
storageToParsed(context, value) {
|
|
129
|
+
return NestedComponentValue.fromStorage(context, value);
|
|
130
|
+
}
|
|
7
131
|
getTypeName() {
|
|
8
132
|
return "nested-component";
|
|
9
133
|
}
|
|
10
|
-
|
|
11
|
-
const dropdown = new Enum(Object.keys(registry.getAll()));
|
|
134
|
+
makeComponentPickerArgument(registry) {
|
|
135
|
+
const dropdown = new Enum(["empty", ...Object.keys(registry.getAll())]);
|
|
136
|
+
dropdown.setExampleValues(["empty"]);
|
|
12
137
|
dropdown.parent_argument = this;
|
|
13
138
|
return dropdown;
|
|
14
139
|
}
|
|
15
140
|
getInnerStructure(registry, component_name) {
|
|
16
141
|
return registry.get(component_name)?.getArguments() || {};
|
|
17
142
|
}
|
|
143
|
+
// this is used by JDD Editor to build the inputs
|
|
18
144
|
getStructure(registry, component_name) {
|
|
145
|
+
const picker = this.makeComponentPickerArgument(registry);
|
|
146
|
+
if (component_name == "empty") {
|
|
147
|
+
return { component_name: picker };
|
|
148
|
+
}
|
|
19
149
|
return {
|
|
20
|
-
component_name:
|
|
21
|
-
|
|
150
|
+
component_name: picker,
|
|
151
|
+
parsed_arguments: new Structured(this.getInnerStructure(registry, component_name)),
|
|
22
152
|
};
|
|
23
153
|
}
|
|
24
154
|
getSubArgument(ctx, [key, ...rest], value
|
|
25
155
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
156
|
) {
|
|
157
|
+
if (value instanceof NestedComponentValueEmpty) {
|
|
158
|
+
return [null, [], ""];
|
|
159
|
+
}
|
|
160
|
+
if (!(value instanceof NestedComponentValueFull)) {
|
|
161
|
+
throw new Error("Expected a parsed nested component value");
|
|
162
|
+
}
|
|
27
163
|
if (key == "component_name") {
|
|
28
|
-
const dropdown = this.
|
|
164
|
+
const dropdown = this.makeComponentPickerArgument(ctx.registry);
|
|
29
165
|
return [dropdown, rest, {}];
|
|
30
166
|
}
|
|
31
167
|
// the other key in the path can only be the component name + a colon:
|
|
32
|
-
if (key
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
return [
|
|
36
|
-
structured || null,
|
|
37
|
-
rest,
|
|
38
|
-
structured
|
|
39
|
-
? value[key]
|
|
40
|
-
? structured.receivedToParsed(ctx, value[key])
|
|
41
|
-
: structured.getExampleValue(ctx)
|
|
42
|
-
: {},
|
|
43
|
-
];
|
|
168
|
+
if (key == "parsed_arguments") {
|
|
169
|
+
const structured = new Structured(this.getInnerStructure(ctx.registry, value.component_name));
|
|
170
|
+
return [structured || null, rest, value.parsed_arguments];
|
|
44
171
|
}
|
|
45
172
|
// invalid argument
|
|
46
173
|
console.error("Invalid argument for component jdd arg:", key, rest, value);
|
|
47
174
|
return [null, [], {}];
|
|
48
175
|
}
|
|
49
176
|
countWords(ctx, value) {
|
|
50
|
-
|
|
51
|
-
const component_values = value[`${component_name}:values`];
|
|
52
|
-
return Object.entries(component_values).reduce((acc, [key, val]) => {
|
|
53
|
-
if (!this.getInnerStructure(ctx.registry, component_name)[key]) {
|
|
54
|
-
console.warn(`Key ${key} doesn't exist in structured argument`);
|
|
55
|
-
return acc + 0;
|
|
56
|
-
}
|
|
57
|
-
return (acc +
|
|
58
|
-
this.getInnerStructure(ctx.registry, component_name)[key].countWords(ctx, val));
|
|
59
|
-
}, 0);
|
|
60
|
-
}
|
|
61
|
-
async getEmptyValue(ctx) {
|
|
62
|
-
const component_name = Object.keys(ctx.registry.getAll())[0];
|
|
63
|
-
return {
|
|
64
|
-
component_name,
|
|
65
|
-
[`${component_name}:values`]: Object.fromEntries(await Promise.all(Object.entries(this.getInnerStructure(ctx.registry, component_name)).map(async ([name, arg]) => [
|
|
66
|
-
name,
|
|
67
|
-
await arg.getEmptyValue(ctx),
|
|
68
|
-
]))),
|
|
69
|
-
};
|
|
177
|
+
return value.countWords(ctx);
|
|
70
178
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (this.example_values.length) {
|
|
74
|
-
return super.getExampleValue(context);
|
|
75
|
-
}
|
|
76
|
-
const result = {
|
|
77
|
-
component_name,
|
|
78
|
-
[`${component_name}:values`]: Object.fromEntries(await Promise.all(Object.entries(this.getInnerStructure(context.registry, component_name)).map(async ([name, arg]) => [
|
|
79
|
-
name,
|
|
80
|
-
await arg.getExampleValue(context),
|
|
81
|
-
]))),
|
|
82
|
-
};
|
|
83
|
-
return result;
|
|
179
|
+
getEmptyValue(ctx) {
|
|
180
|
+
return new NestedComponentValueEmpty();
|
|
84
181
|
}
|
|
85
|
-
async
|
|
86
|
-
|
|
87
|
-
throw new Error(`Not an object: ${input}`);
|
|
88
|
-
}
|
|
89
|
-
const component_name = input.component_name;
|
|
90
|
-
const result = {};
|
|
91
|
-
const subinput = input[`${component_name}:values`] || {};
|
|
92
|
-
if (!is(subinput, predicates.object)) {
|
|
93
|
-
throw new Error(`Not an object: ${subinput}`);
|
|
94
|
-
}
|
|
95
|
-
await Promise.all(Object.entries(subinput).map(async ([obj_key, obj_value]) => {
|
|
96
|
-
const nested_arg_type = this.getInnerStructure(context.registry, component_name)[obj_key];
|
|
97
|
-
if (!nested_arg_type) {
|
|
98
|
-
return [obj_key, null];
|
|
99
|
-
}
|
|
100
|
-
const new_value = await processing_function(nested_arg_type, obj_value);
|
|
101
|
-
result[obj_key] = new_value;
|
|
102
|
-
}));
|
|
103
|
-
// if we're in a list and any of the values return an array, we will multiply the object
|
|
104
|
-
if (this.hasParent("list")) {
|
|
105
|
-
const keys_with_unexpected_arrays = Object.entries(result)
|
|
106
|
-
.filter(([key, value]) => {
|
|
107
|
-
const nested_arg_type = this.getInnerStructure(context.registry, component_name)[key];
|
|
108
|
-
return (nested_arg_type.getTypeName() !== "list" &&
|
|
109
|
-
Array.isArray(value));
|
|
110
|
-
})
|
|
111
|
-
.map(([key]) => key);
|
|
112
|
-
if (keys_with_unexpected_arrays.length > 1) {
|
|
113
|
-
throw new Error("Multiplying on more than one field at the same time is not implemented yet");
|
|
114
|
-
}
|
|
115
|
-
if (keys_with_unexpected_arrays.length == 1) {
|
|
116
|
-
const key = keys_with_unexpected_arrays[0];
|
|
117
|
-
const old_result = result;
|
|
118
|
-
const array = old_result[key];
|
|
119
|
-
if (!Array.isArray(array)) {
|
|
120
|
-
throw new Error("expected an array");
|
|
121
|
-
}
|
|
122
|
-
return array.map((value) => ({
|
|
123
|
-
...old_result,
|
|
124
|
-
[key]: value,
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
return {
|
|
129
|
-
component_name,
|
|
130
|
-
[`${component_name}:values`]: result,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
return { component_name, [`${component_name}:values`]: result };
|
|
136
|
-
}
|
|
182
|
+
async getExampleValue(context) {
|
|
183
|
+
return this.getEmptyValue(context);
|
|
137
184
|
}
|
|
138
185
|
static render({ jdd_context, data, classes = [], index = -1, }) {
|
|
139
186
|
const component_name = data.component_name;
|
|
@@ -141,41 +188,11 @@ export class NestedComponent extends ContainerArgument {
|
|
|
141
188
|
if (!component) {
|
|
142
189
|
return "Unknown component: ${component_name}";
|
|
143
190
|
}
|
|
144
|
-
const args = data
|
|
191
|
+
const args = data.parsed_arguments;
|
|
145
192
|
return component.toHTML({ args, classes, jdd_context, index });
|
|
146
193
|
}
|
|
147
|
-
static getCSSClumpsForNested(jdd_context, data) {
|
|
148
|
-
const component_name = data.component_name;
|
|
149
|
-
const component = jdd_context.registry.get(component_name);
|
|
150
|
-
if (!component) {
|
|
151
|
-
console.error("Unknown component: ${component_name}");
|
|
152
|
-
return [];
|
|
153
|
-
}
|
|
154
|
-
const args = data[`${component_name}:values`];
|
|
155
|
-
return [
|
|
156
|
-
componentNameToCSSClump(component_name),
|
|
157
|
-
...component.getCSSClumps(jdd_context, args),
|
|
158
|
-
];
|
|
159
|
-
}
|
|
160
194
|
async receivedToParsed(context, value) {
|
|
161
|
-
|
|
162
|
-
const component_name = result.component_name;
|
|
163
|
-
if (!is(component_name, predicates.string)) {
|
|
164
|
-
throw new Error(`Not an object: ${component_name}`);
|
|
165
|
-
}
|
|
166
|
-
if (component_name) {
|
|
167
|
-
// delete previous values after changing the component
|
|
168
|
-
for (const invalid_key of Object.keys(result).filter((e) => e.endsWith(":values") && e !== `${component_name}:values`)) {
|
|
169
|
-
delete result[invalid_key];
|
|
170
|
-
}
|
|
171
|
-
// generate new example values for the new component
|
|
172
|
-
if (Object.keys(result[`${component_name}:values`]).length == 0) {
|
|
173
|
-
result[`${component_name}:values`] = await context.registry
|
|
174
|
-
.get(component_name)
|
|
175
|
-
?.getExampleValues(context);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return result;
|
|
195
|
+
return NestedComponentValue.fromReceived(context, value);
|
|
179
196
|
}
|
|
180
197
|
}
|
|
181
198
|
//# sourceMappingURL=nested-component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nested-component.js","sourceRoot":"","sources":["../../src/component-arguments/nested-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"nested-component.js","sourceRoot":"","sources":["../../src/component-arguments/nested-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,MAAM,OAAgB,oBAAoB;IAiBzC,MAAM,CAAC,KAAK,CAAC,YAAY,CACxB,WAAuB,EACvB,IAA6B;QAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC3C,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC1C;QACD,IAAI,cAAc,IAAI,OAAO,EAAE;YAC9B,OAAO,IAAI,yBAAyB,EAAE,CAAC;SACvC;QACD,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,cAAc,EAAE,CAAC,CAAC;SACxD;QACD,MAAM,gBAAgB,GAAG,MAAM,SAAS,CAAC,6BAA6B,CACrE,WAAW;QACX,iEAAiE;QACjE,IAAI,CAAC,gBAAgB,IAAK,EAAU,CACpC,CAAC;QACF,OAAO,IA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,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,aAAa,CAAC,GAAe;QAC5B,OAAO,IAAI,yBAAyB,EAAE,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAmB;QACxC,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,EACb,WAAW,EACX,IAAI,EACJ,OAAO,GAAG,EAAE,EACZ,KAAK,GAAG,CAAC,CAAC,GAMV;QACA,MAAM,cAAc,GAAG,IAAI,CAAC,cAAwB,CAAC;QACrD,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,EAAE;YACf,OAAO,sCAAsC,CAAC;SAC9C;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,gBAA2C,CAAC;QAC9D,OAAO,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,gBAAgB,CACrB,OAAmB,EACnB,KAA8B;QAE9B,OAAO,oBAAoB,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;CACD"}
|
package/lib/component.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import slug from "slug";
|
|
2
2
|
export class Component {
|
|
3
|
-
constructor(name) {
|
|
3
|
+
constructor(name = "") {
|
|
4
4
|
this.name = name;
|
|
5
5
|
}
|
|
6
6
|
getTitle(_context, _args) {
|
|
@@ -37,10 +37,19 @@ export class Component {
|
|
|
37
37
|
await value.getExampleValue(context),
|
|
38
38
|
])));
|
|
39
39
|
}
|
|
40
|
+
async getEmptyValues(context) {
|
|
41
|
+
return Object.fromEntries(await Promise.all(Object.entries(this.getArguments()).map(async ([key, value]) => [
|
|
42
|
+
key,
|
|
43
|
+
await value.getEmptyValue(context),
|
|
44
|
+
])));
|
|
45
|
+
}
|
|
40
46
|
async convertReceivedValuesToParsed(context, values) {
|
|
41
47
|
const args = this.getArguments();
|
|
42
48
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
43
49
|
return Object.fromEntries(await Promise.all(Object.entries(values).map(async ([key, value]) => {
|
|
50
|
+
if (!args[key]) {
|
|
51
|
+
return [key, null];
|
|
52
|
+
}
|
|
44
53
|
return [
|
|
45
54
|
key,
|
|
46
55
|
await args[key].receivedToParsed(context, value),
|
package/lib/component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAQA,OAAO,IAAI,MAAM,MAAM,CAAC;AA2BxB,MAAM,OAAgB,SAAS;IAM9B,YAAmB,
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAQA,OAAO,IAAI,MAAM,MAAM,CAAC;AA2BxB,MAAM,OAAgB,SAAS;IAM9B,YAAmB,OAAe,EAAE;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAOxC,QAAQ,CACP,QAAoB,EACpB,KAA4D;QAE5D,OAAO,IAAI,CAAC;IACb,CAAC;IAED,WAAW,CACV,OAAmB,EACnB,IAA2D;QAE3D,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,KAAK,EAAE;YACV,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;SACpD;aAAM;YACN,OAAO,EAAE,CAAC;SACV;IACF,CAAC;IAED,YAAY,CACX,IAAgB,EAChB,OAA8D;QAE9D,OAAO,EAAE,CAAC;IACX,CAAC;IAED,KAAK,CAAC,c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