@sealcode/jdd-editor 0.2.0 → 0.2.4
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/.husky/pre-commit +1 -0
- package/@types/component-preview-actions.d.ts +2 -26
- package/@types/components.sreact.d.ts +2 -30
- package/@types/controllers/json-editor.stimulus.d.ts +2 -0
- package/@types/inputs/component-input-color.d.ts +15 -0
- package/@types/jdd-creator.d.ts +1 -25
- package/@types/jdd-page.d.ts +8 -32
- package/dist/src/component-preview-actions.js.map +2 -2
- package/dist/src/components.sreact.js +1 -14
- package/dist/src/components.sreact.js.map +2 -2
- package/dist/src/controllers/json-editor.stimulus.js +33 -23
- package/dist/src/controllers/json-editor.stimulus.js.map +2 -2
- package/dist/src/controllers/refresh-styles.stimulus.js +5 -5
- package/dist/src/controllers/refresh-styles.stimulus.js.map +2 -2
- package/dist/src/inputs/component-input-color.js +27 -0
- package/dist/src/inputs/component-input-color.js.map +7 -0
- package/dist/src/inputs/component-input.js +14 -1
- package/dist/src/inputs/component-input.js.map +2 -2
- package/dist/src/jdd-page.js +81 -49
- package/dist/src/jdd-page.js.map +2 -2
- package/package.json +6 -5
- package/src/component-preview-actions.ts +9 -6
- package/src/components.sreact.ts +1 -14
- package/src/controllers/json-editor.stimulus.ts +33 -20
- package/src/controllers/refresh-styles.stimulus.ts +5 -5
- package/src/inputs/component-input-color.ts +38 -0
- package/src/inputs/component-input.ts +15 -2
- package/src/jdd-page.ts +89 -55
- package/.nyc_output/2ad4e34c-cebb-4299-9698-08eccbbe71f7.json +0 -1
- package/.nyc_output/71f2685b-e2c9-4db2-9f31-0dbdcacfcea1.json +0 -1
- package/.nyc_output/cfebf13d-f940-426b-a4d3-af28d17bb6b8.json +0 -1
- package/.nyc_output/processinfo/2ad4e34c-cebb-4299-9698-08eccbbe71f7.json +0 -1
- package/.nyc_output/processinfo/71f2685b-e2c9-4db2-9f31-0dbdcacfcea1.json +0 -1
- package/.nyc_output/processinfo/cfebf13d-f940-426b-a4d3-af28d17bb6b8.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/.xunit +0 -2
- package/coverage/clover.xml +0 -866
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { printArgPath } from "./print-arg-path.js";
|
|
2
|
-
import { NestedComponent, SingleReference } from "@sealcode/jdd";
|
|
2
|
+
import { NestedComponent, Color, SingleReference } from "@sealcode/jdd";
|
|
3
3
|
import {
|
|
4
4
|
ComponentArguments,
|
|
5
5
|
Enum,
|
|
@@ -16,6 +16,7 @@ import { ComponentInputTable } from "./component-input-table.js";
|
|
|
16
16
|
import { ComponentInputSingleReference } from "./component-input-single-reference.js";
|
|
17
17
|
import { is, predicates } from "@sealcode/ts-predicates";
|
|
18
18
|
import { tempstream } from "tempstream";
|
|
19
|
+
import { ComponentInputColor } from "./component-input-color.js";
|
|
19
20
|
const actionName = "Components";
|
|
20
21
|
const absoluteUrlPattern = "http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)";
|
|
21
22
|
async function ComponentInput({
|
|
@@ -31,6 +32,18 @@ async function ComponentInput({
|
|
|
31
32
|
if (value === void 0) {
|
|
32
33
|
value = await arg.getEmptyValue(makeJDDContext(ctx));
|
|
33
34
|
}
|
|
35
|
+
if (arg instanceof Color) {
|
|
36
|
+
return ComponentInputColor({
|
|
37
|
+
ctx,
|
|
38
|
+
state,
|
|
39
|
+
arg_path,
|
|
40
|
+
arg,
|
|
41
|
+
value,
|
|
42
|
+
page,
|
|
43
|
+
onchange: page.rerender(),
|
|
44
|
+
makeJDDContext
|
|
45
|
+
});
|
|
46
|
+
}
|
|
34
47
|
if (arg instanceof List) {
|
|
35
48
|
return ComponentInputList({
|
|
36
49
|
ctx,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/inputs/component-input.ts"],
|
|
4
|
-
"sourcesContent": ["import { printArgPath } from \"./print-arg-path.js\";\nimport type { Context } from \"koa\";\nimport type { ComponentArgument, JDDContext, TableData } from \"@sealcode/jdd\";\nimport { NestedComponent, SingleReference } from \"@sealcode/jdd\";\nimport {\n\tComponentArguments,\n\tEnum,\n\tImage,\n\tList,\n\tStructured,\n\tTable,\n} from \"@sealcode/jdd\";\nimport { ComponentInputStructured } from \"./component-input-structured.js\";\nimport type { StatefulPage } from \"@sealcode/sealgen\";\nimport type { ComponentPreviewActions } from \"../component-preview-actions.js\";\nimport { ComponentInputList } from \"./component-input-list.js\";\nimport type { JDDPageState } from \"../jdd-page.js\";\nimport { ComponentInputEnum } from \"./component-input-enum.js\";\nimport { ComponentInputImage } from \"./component-input-image.js\";\nimport { ComponentInputTable } from \"./component-input-table.js\";\nimport type { FilePointer } from \"@sealcode/file-manager\";\nimport { ComponentInputSingleReference } from \"./component-input-single-reference.js\";\nimport { is, predicates } from \"@sealcode/ts-predicates\";\nimport { tempstream } from \"tempstream\";\
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAG7B,SAAS,iBAAiB,uBAAuB;
|
|
4
|
+
"sourcesContent": ["import { printArgPath } from \"./print-arg-path.js\";\nimport type { Context } from \"koa\";\nimport type { ComponentArgument, JDDContext, TableData } from \"@sealcode/jdd\";\nimport { NestedComponent, Color, SingleReference } from \"@sealcode/jdd\";\nimport {\n\tComponentArguments,\n\tEnum,\n\tImage,\n\tList,\n\tStructured,\n\tTable,\n} from \"@sealcode/jdd\";\nimport { ComponentInputStructured } from \"./component-input-structured.js\";\nimport type { StatefulPage } from \"@sealcode/sealgen\";\nimport type { ComponentPreviewActions } from \"../component-preview-actions.js\";\nimport { ComponentInputList } from \"./component-input-list.js\";\nimport type { JDDPageState } from \"../jdd-page.js\";\nimport { ComponentInputEnum } from \"./component-input-enum.js\";\nimport { ComponentInputImage } from \"./component-input-image.js\";\nimport { ComponentInputTable } from \"./component-input-table.js\";\nimport type { FilePointer } from \"@sealcode/file-manager\";\nimport { ComponentInputSingleReference } from \"./component-input-single-reference.js\";\nimport { is, predicates } from \"@sealcode/ts-predicates\";\nimport { tempstream } from \"tempstream\";\nimport { ComponentInputColor } from \"./component-input-color.js\";\nexport const actionName = \"Components\";\nconst absoluteUrlPattern = \"http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)\";\n\nexport async function ComponentInput<State extends JDDPageState, T>({\n\tctx,\n\tstate,\n\targ_path,\n\targ,\n\tvalue,\n\tpage,\n\tmakeJDDContext,\n\tmakeAssetURL,\n}: {\n\tstate: State;\n\tctx: Context;\n\targ_path: string[];\n\targ: ComponentArgument<T>;\n\tvalue: T;\n\tpage: StatefulPage<JDDPageState, typeof ComponentPreviewActions>;\n\tmakeJDDContext: (ctx: Context) => JDDContext;\n\tmakeAssetURL: (asset: string) => string;\n}): Promise<string> {\n\tif (value === undefined) {\n\t\tvalue = await arg.getEmptyValue(makeJDDContext(ctx));\n\t}\n\tif (arg instanceof Color) {\n\t\treturn ComponentInputColor({\n\t\t\tctx,\n\t\t\tstate,\n\t\t\targ_path,\n\t\t\targ,\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tvalue: value as string,\n\t\t\tpage,\n\t\t\tonchange: page.rerender(),\n\t\t\tmakeJDDContext,\n\t\t});\n\t}\n\tif (arg instanceof List) {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn ComponentInputList({\n\t\t\tctx,\n\t\t\tstate,\n\t\t\targ_path,\n\t\t\targ,\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tvalue: value as T[],\n\t\t\tpage,\n\t\t\tmakeJDDContext,\n\t\t\tmakeAssetURL,\n\t\t});\n\t}\n\n\tconst argType = arg.getTypeName();\n\tconst isUrlAbsolute =\n\t\targ instanceof ComponentArguments.URL && arg.urlType === \"absolute\";\n\tconst inputType = isUrlAbsolute ? \"url\" : \"text\";\n\n\tif (arg instanceof Structured || arg instanceof NestedComponent) {\n\t\treturn ComponentInputStructured({\n\t\t\tctx,\n\t\t\tstate,\n\t\t\targ_path,\n\t\t\targ,\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tvalue: value as Record<string, unknown>,\n\t\t\tpage,\n\t\t\tmakeJDDContext,\n\t\t\tmakeAssetURL,\n\t\t});\n\t}\n\n\tif (arg instanceof SingleReference) {\n\t\treturn ComponentInputSingleReference({\n\t\t\tctx,\n\t\t\tstate,\n\t\t\targ_path,\n\t\t\targ,\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tvalue: value as string,\n\t\t\tonchange: page.rerender(),\n\t\t\tmakeJDDContext,\n\t\t});\n\t}\n\n\tif (arg instanceof Enum) {\n\t\treturn ComponentInputEnum({\n\t\t\tstate,\n\t\t\targ_path,\n\t\t\targ,\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tvalue: value as string,\n\t\t\tonchange: page.rerender(),\n\t\t});\n\t}\n\n\tif (arg instanceof Image) {\n\t\treturn ComponentInputImage({\n\t\t\tctx,\n\t\t\tstate,\n\t\t\targ_path,\n\t\t\targ,\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tvalue: value as FilePointer,\n\t\t\tpage,\n\t\t\tmakeJDDContext,\n\t\t});\n\t}\n\n\tif (arg instanceof Table) {\n\t\treturn ComponentInputTable({\n\t\t\tctx,\n\t\t\tstate,\n\t\t\targ_path,\n\t\t\targ,\n\t\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\t\tvalue: value as TableData<unknown, unknown>,\n\t\t\tpage,\n\t\t\tmakeJDDContext,\n\t\t\tmakeAssetURL,\n\t\t});\n\t}\n\n\tconst inputElement = () => {\n\t\tif (arg instanceof ComponentArguments.Number) {\n\t\t\treturn tempstream/* HTML */ ` <input\n\t\t\t\ttype=\"number\"\n\t\t\t\tname=\"${`$${printArgPath(arg_path)}`}\"\n\t\t\t\tvalue=\"${(value || \"\").toString()}\"\n\t\t\t\tmin=\"${arg.min || \"\"}\"\n\t\t\t\tmax=\"${arg.max || \"\"}\"\n\t\t\t\tstep=\"${arg.step || \"\"}\"\n\t\t\t/>`;\n\t\t} else if (arg instanceof ComponentArguments.URL) {\n\t\t\treturn tempstream/* HTML */ ` <input\n\t\t\t\ttype=\"${isUrlAbsolute ? \"url\" : \"text\"}\"\n\t\t\t\tname=\"${`$${printArgPath(arg_path)}`}\"\n\t\t\t\tvalue=\"${(value || \"\").toString()}\"\n\t\t\t\tsize=\"40\"\n\t\t\t\t${isUrlAbsolute ? `pattern=\"${absoluteUrlPattern}\"` : \"\"}\n\t\t\t/>`;\n\t\t} else {\n\t\t\treturn tempstream/* HTML */ ` <input\n\t\t\t\ttype=\"${inputType}\"\n\t\t\t\tname=\"${`$${printArgPath(arg_path)}`}\"\n\t\t\t\tvalue=\"${is(value, predicates.string) ? value : \"\"}\"\n\t\t\t\tsize=\"40\"\n\t\t\t\t${isUrlAbsolute ? `pattern=\"${absoluteUrlPattern}\"` : \"\"}\n\t\t\t/>`;\n\t\t}\n\t};\n\n\treturn /* HTML */ `<div>\n\t\t<label>\n\t\t\t${arg_path.at(-1) || \"\"}\n\t\t\t${argType == \"markdown\"\n\t\t\t\t? /* HTML */ `<div class=\"grow-wrap\">\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\tname=\"${`$${printArgPath(arg_path)}`}\"\n\t\t\t\t\t\t\tonblur=\"${page.rerender()}\"\n\t\t\t\t\t\t\tcols=\"40\"\n\t\t\t\t\t\t\tdata-controller=\"markdown-textarea submit-on-input\"\n\t\t\t\t\t\t\tdata-action=\"autogrow-textarea#autogrow blur->autogrow-textarea#autogrow resize->autogrow-textarea#autogrow submit-on-input#sendValues focus->submit-on-input#makePermanent blur->submit-on-input#makeNotPermanent\"\n\t\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\t>\n${is(value, predicates.string) ? value : \"\"}</textarea\n\t\t\t\t\t\t>\n\t\t\t\t </div>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,gBAAgB,YAAY,wBAAwB;AAAA;AAAA,IAExD;AAAA,EACD;AAEA,SAAkB;AAAA;AAAA,KAEd,SAAS,GAAG,EAAE,KAAK;AAAA,KACnB,WAAW,aACC;AAAA;AAAA,eAEF,IAAI,aAAa,QAAQ;AAAA,iBACvB,KAAK,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM7B,GAAG,OAAO,WAAW,MAAM,IAAI,QAAQ;AAAA;AAAA,gBAGnC,MAAM,aAAa;AAAA;AAAA;AAGzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/src/jdd-page.js
CHANGED
|
@@ -5,6 +5,7 @@ import { hasFieldOfType, hasShape, predicates } from "@sealcode/ts-predicates";
|
|
|
5
5
|
import { tempstream } from "tempstream";
|
|
6
6
|
import { ComponentInput } from "./inputs/component-input.js";
|
|
7
7
|
import { ComponentPreviewActions } from "./component-preview-actions.js";
|
|
8
|
+
import { htmlEscape } from "escape-goat";
|
|
8
9
|
const actionName = "Components";
|
|
9
10
|
class JDDPage extends StatefulPage {
|
|
10
11
|
constructor(args) {
|
|
@@ -22,21 +23,8 @@ class JDDPage extends StatefulPage {
|
|
|
22
23
|
return this.registry.getAll();
|
|
23
24
|
}
|
|
24
25
|
async getInitialState(ctx) {
|
|
25
|
-
const all_components = Object.entries(this.getRegistryComponents());
|
|
26
|
-
const first_component = all_components[0];
|
|
27
|
-
if (!first_component) {
|
|
28
|
-
throw new Error("No defined components!");
|
|
29
|
-
}
|
|
30
|
-
const [component_name, component] = first_component;
|
|
31
26
|
const initial_state = {
|
|
32
|
-
components: [
|
|
33
|
-
{
|
|
34
|
-
component_name,
|
|
35
|
-
args: await component.getExampleValues(
|
|
36
|
-
this.makeJDDContext(ctx)
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
]
|
|
27
|
+
components: []
|
|
40
28
|
};
|
|
41
29
|
return initial_state;
|
|
42
30
|
}
|
|
@@ -230,9 +218,7 @@ class JDDPage extends StatefulPage {
|
|
|
230
218
|
}
|
|
231
219
|
async render(ctx, state) {
|
|
232
220
|
return tempstream`<div
|
|
233
|
-
class="${["two-column", "component-debugger", ...this.classes].join(
|
|
234
|
-
" "
|
|
235
|
-
)}"
|
|
221
|
+
class="${["two-column", "component-debugger", ...this.classes].join(" ")}"
|
|
236
222
|
id="component-debugger"
|
|
237
223
|
style="${`--resizable-column-width: ${state.preview_size ? state.preview_size + "px" : "50vw"}`}"
|
|
238
224
|
data-controller="component-debugger"
|
|
@@ -264,8 +250,8 @@ class JDDPage extends StatefulPage {
|
|
|
264
250
|
id="component-debugger-json-textarea"
|
|
265
251
|
autocomplete="off"
|
|
266
252
|
>
|
|
267
|
-
|
|
268
|
-
|
|
253
|
+
${(await this.serializeState(ctx, state, true)).replaceAll("<", "<")}
|
|
254
|
+
</textarea
|
|
269
255
|
>
|
|
270
256
|
${this.makeActionButton(state, {
|
|
271
257
|
action: "replace_state",
|
|
@@ -295,39 +281,85 @@ class JDDPage extends StatefulPage {
|
|
|
295
281
|
id="component-preview__header"
|
|
296
282
|
class="component-preview__header"
|
|
297
283
|
>
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
284
|
+
<div class="component-preview__item">
|
|
285
|
+
<span>Window size</span>
|
|
286
|
+
<select
|
|
287
|
+
name="$[preview_size]"
|
|
288
|
+
autocomplete="off"
|
|
289
|
+
class="component-preview-size-select"
|
|
290
|
+
data-component-debugger-target="sizeSelect"
|
|
291
|
+
data-action="change->component-debugger#handleWidthDropdown"
|
|
292
|
+
data-turbo-data-turbo-permanent
|
|
293
|
+
>
|
|
294
|
+
${state.preview_size ? `<option
|
|
295
|
+
class="dynamic"
|
|
296
|
+
value="${state.preview_size}"
|
|
297
|
+
selected
|
|
298
|
+
>
|
|
299
|
+
${state.preview_size} px
|
|
300
|
+
</option>` : ""}
|
|
301
|
+
${this.previewSizes.map(
|
|
315
302
|
(size) => `<option value="${size}">
|
|
316
|
-
|
|
317
|
-
|
|
303
|
+
${`${size} px`}
|
|
304
|
+
</option>`
|
|
318
305
|
)}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
306
|
+
</select>
|
|
307
|
+
<noscript>
|
|
308
|
+
${this.makeActionButton(state, "change_size")}
|
|
309
|
+
</noscript>
|
|
310
|
+
</div>
|
|
311
|
+
<style>
|
|
312
|
+
.component-preview .component-raw-view {
|
|
313
|
+
display: none;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.component-preview .jdd-outer-container {
|
|
317
|
+
display: block;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.component-preview:has(
|
|
321
|
+
.component-preview-checkbox:checked
|
|
322
|
+
)
|
|
323
|
+
.component-raw-view {
|
|
324
|
+
display: block;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.component-preview:has(
|
|
328
|
+
.component-preview-checkbox:checked
|
|
329
|
+
)
|
|
330
|
+
.jdd-outer-container {
|
|
331
|
+
display: none;
|
|
332
|
+
}
|
|
333
|
+
</style>
|
|
334
|
+
<label class="component-preview__item" for="show-html">
|
|
335
|
+
Show HTML
|
|
336
|
+
<input
|
|
337
|
+
type="checkbox"
|
|
338
|
+
id="show-html"
|
|
339
|
+
class="component-preview-checkbox"
|
|
340
|
+
/>
|
|
341
|
+
</label>
|
|
323
342
|
</div>
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
343
|
+
|
|
344
|
+
${(async () => {
|
|
345
|
+
const currentComponent = await JDD.render(
|
|
346
|
+
this.registry,
|
|
347
|
+
documentContainerFromParsed(state.components),
|
|
348
|
+
this.makeJDDContext(ctx)
|
|
349
|
+
);
|
|
350
|
+
return ` <div
|
|
351
|
+
class="jdd-outer-container"
|
|
352
|
+
>
|
|
353
|
+
<div class="jdd-container">
|
|
354
|
+
${currentComponent}
|
|
355
|
+
</div>
|
|
356
|
+
</div>
|
|
357
|
+
<div class="component-raw-view">
|
|
358
|
+
<pre><code>${htmlEscape(
|
|
359
|
+
currentComponent
|
|
360
|
+
)}</code></pre>
|
|
361
|
+
</div>`;
|
|
362
|
+
})()}
|
|
331
363
|
</div>
|
|
332
364
|
</div>
|
|
333
365
|
</div>
|
package/dist/src/jdd-page.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/jdd-page.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/restrict-template-expressions */\nimport type { Readable } from \"node:stream\";\nimport type { Component, JDDContext, RawJDDocument } from \"@sealcode/jdd\";\nimport { documentContainerFromParsed, Registry } from \"@sealcode/jdd\";\nimport { JDD } from \"@sealcode/jdd\";\nimport { StatefulPage } from \"@sealcode/sealgen\";\nimport { hasFieldOfType, hasShape, predicates } from \"@sealcode/ts-predicates\";\nimport type { Context } from \"koa\";\nimport type { FlatTemplatable, Templatable } from \"tempstream\";\nimport { tempstream } from \"tempstream\";\nimport { ComponentInput } from \"./inputs/component-input.js\";\nimport { ComponentPreviewActions } from \"./component-preview-actions.js\";\n\nexport const actionName = \"Components\";\n\nexport type JDDPageState = {\n\tcomponents: RawJDDocument;\n\tpreview_size?: string;\n\tmessages?: string[];\n};\n\nexport default abstract class JDDPage extends StatefulPage<\n\tJDDPageState,\n\ttypeof ComponentPreviewActions\n> {\n\tactions = ComponentPreviewActions;\n\n\tpreviewSizes = [\"320\", \"600\", \"800\", \"1024\", \"1300\", \"1920\"];\n\tclasses: string[] = [];\n\n\tpublic registry: Registry;\n\tpublic makeJDDContext: (ctx: Context) => JDDContext;\n\tpublic html: (\n\t\targs: unknown\n\t) => string | Promise<string> | Readable | Promise<Readable>;\n\tpublic defaultHead: (\n\t\t...args: unknown[]\n\t) => string | Promise<string> | Readable | Promise<Readable>;\n\tpublic makeAssetURL: (asset: string) => string;\n\n\tconstructor(args: {\n\t\tregistry: Registry;\n\t\tmakeJDDContext: (ctx: Context) => JDDContext;\n\t\thtml: (\n\t\t\targs: unknown\n\t\t) => string | Promise<string> | Readable | Promise<Readable>;\n\t\tdefaultHead: (\n\t\t\t...args: unknown[]\n\t\t) => string | Promise<string> | Readable | Promise<Readable>;\n\t\tmakeAssetURL?: (asset: string) => string;\n\t}) {\n\t\tsuper();\n\t\tthis.registry = args.registry;\n\t\tthis.makeJDDContext = args.makeJDDContext;\n\t\tthis.defaultHead = args.defaultHead;\n\t\tthis.html = args.html;\n\t\tthis.makeAssetURL =\n\t\t\targs.makeAssetURL ||\n\t\t\t((str) =>\n\t\t\t\t`/dist/jdd-page/${str.startsWith(\"/\") ? str.slice(1) : str}`);\n\t}\n\n\tgetRegistryComponents() {\n\t\treturn this.registry.getAll();\n\t}\n\n\tasync getInitialState(ctx: Context) {\n\t\tconst all_components = Object.entries(this.getRegistryComponents());\n\t\tconst first_component = all_components[0];\n\t\tif (!first_component) {\n\t\t\tthrow new Error(\"No defined components!\");\n\t\t}\n\t\tconst [component_name, component] = first_component;\n\t\tconst initial_state = {\n\t\t\tcomponents: [\n\t\t\t\t{\n\t\t\t\t\tcomponent_name: component_name,\n\t\t\t\t\targs: await component.getExampleValues(\n\t\t\t\t\t\tthis.makeJDDContext(ctx)\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn initial_state;\n\t}\n\n\twrapInLayout(\n\t\tctx: Context,\n\t\tcontent: Templatable,\n\t\tstate: JDDPageState\n\t): Templatable {\n\t\tconst jdd_context = this.makeJDDContext(ctx);\n\t\tconst jdd = new JDD(\n\t\t\tthis.registry,\n\t\t\tjdd_context,\n\t\t\tdocumentContainerFromParsed(state.components)\n\t\t);\n\t\treturn this.html({\n\t\t\tctx,\n\t\t\ttitle: \"Components\",\n\t\t\tbody: content,\n\t\t\tdescription: \"\",\n\t\t\tcss_clumps: [\"jdd-page\", ...jdd.getAllCSSClumps()],\n\t\t\thtmlOptions: {\n\t\t\t\tmorphing: true,\n\t\t\t\tpreserveScroll: true,\n\t\t\t\tautoRefreshCSS: false,\n\t\t\t\tnavbar: () => ``,\n\t\t\t\tbodyClasses: [\"jdd-editor\"],\n\t\t\t\tshowBottomNavbar: false,\n\t\t\t\tshowBanner: false,\n\t\t\t\tshowFooter: false,\n\t\t\t\tloadHamburgerMenu: false,\n\t\t\t\tloadSearchModal: false,\n\t\t\t},\n\t\t\tmakeHead: (...args: unknown[]) =>\n\t\t\t\ttempstream/* HTML */ `${this.defaultHead(...args)}\n\t\t\t\t\t<link\n\t\t\t\t\t\thref=\"/dist/jdd-page.entrypoint.css\"\n\t\t\t\t\t\trel=\"stylesheet\"\n\t\t\t\t\t\ttype=\"text/css\"\n\t\t\t\t\t/>\n\t\t\t\t\t${jdd.renderEarlyAssets()}`,\n\t\t});\n\t}\n\n\tasync preprocessOverrides(\n\t\t_ctx: Context,\n\t\tstate: JDDPageState,\n\t\toverrides: Record<string, unknown>\n\t) {\n\t\tconst jdd_context = this.makeJDDContext(_ctx);\n\t\tif (\n\t\t\t!hasFieldOfType(\n\t\t\t\t\"components\",\n\t\t\t\toverrides,\n\t\t\t\tpredicates.array(\n\t\t\t\t\tpredicates.shape({\n\t\t\t\t\t\targs: predicates.object,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t)\n\t\t) {\n\t\t\treturn {};\n\t\t}\n\t\tfor (const [component_index, { component_name }] of Object.entries(\n\t\t\tstate.components\n\t\t)) {\n\t\t\tconst component = this.registry.get(component_name);\n\t\t\tif (!component) {\n\t\t\t\tthrow new Error(`Unknown component: ${component_name}`);\n\t\t\t}\n\t\t\tconst overrides_for_component = overrides.components[\n\t\t\t\tparseInt(component_index)\n\t\t\t] || { args: {} };\n\t\t\tconst promises = Object.entries(component.getArguments()).map(\n\t\t\t\tasync ([arg_name, arg]) => {\n\t\t\t\t\tconst value = overrides_for_component.args[arg_name];\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tconst new_value = await arg.receivedToParsed(\n\t\t\t\t\t\t\tjdd_context,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t\toverrides_for_component.args[arg_name] = new_value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\tawait Promise.all(promises);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn overrides;\n\t}\n\n\t// eslint-disable-next-line no-unused-vars\n\tabstract renderParameterButtons(_state: JDDPageState): FlatTemplatable;\n\n\tasync renderComponentArgs<C extends Component>(\n\t\tctx: Context,\n\t\tstate: JDDPageState,\n\t\tcomponent: C,\n\t\targs: Record<string, unknown>,\n\t\tindex: number\n\t): Promise<FlatTemplatable> {\n\t\tconst jdd_context = this.makeJDDContext(ctx);\n\t\treturn tempstream/* HTML */ `<div\n\t\t\tclass=\"component-preview-parameters\"\n\t\t\tid=\"${`component-preview-parameters--${index}`}\"\n\t\t>\n\t\t\t${Object.entries(component.getArguments()).map(\n\t\t\t\tasync ([arg_name, arg]) =>\n\t\t\t\t\tComponentInput({\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\targ_path: [\n\t\t\t\t\t\t\t\"components\",\n\t\t\t\t\t\t\tindex.toString(),\n\t\t\t\t\t\t\t\"args\",\n\t\t\t\t\t\t\targ_name,\n\t\t\t\t\t\t],\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\targ,\n\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\targs[arg_name] === undefined ||\n\t\t\t\t\t\t\tcomponent\n\t\t\t\t\t\t\t\t.getArguments()\n\t\t\t\t\t\t\t\t[arg_name]?.isEmpty(args[arg_name])\n\t\t\t\t\t\t\t\t? await arg.getExampleValue(jdd_context)\n\t\t\t\t\t\t\t\t: args[arg_name],\n\t\t\t\t\t\tpage: this,\n\t\t\t\t\t\tmakeJDDContext: this.makeJDDContext,\n\t\t\t\t\t\tmakeAssetURL: this.makeAssetURL,\n\t\t\t\t\t})\n\t\t\t)}\n\t\t</div>`;\n\t}\n\n\trenderComponentBlock(\n\t\tctx: Context,\n\t\tstate: JDDPageState,\n\t\t{\n\t\t\tcomponent_name,\n\t\t\targs: component_args,\n\t\t}: {\n\t\t\tcomponent_name: string;\n\t\t\targs: Record<string, unknown>;\n\t\t},\n\t\tcomponent_index: number\n\t) {\n\t\tconst component = this.registry.get(component_name);\n\t\tif (!component) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this.renderComponentArgs(\n\t\t\tctx,\n\t\t\tstate,\n\t\t\tcomponent,\n\t\t\tcomponent_args,\n\t\t\tcomponent_index\n\t\t);\n\t}\n\n\tasync serializeState(ctx: Context, state: JDDPageState, pretty = false) {\n\t\tconst serialized_components = await Promise.all(\n\t\t\tstate.components.map(async ({ component_name, args }) => {\n\t\t\t\tconst component = this.registry.get(component_name);\n\t\t\t\tconst single_result = {\n\t\t\t\t\tcomponent_name,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-call\n\t\t\t\t\targs: component\n\t\t\t\t\t\t? await component.convertParsedToStorage(\n\t\t\t\t\t\t\t\tthis.makeJDDContext(ctx),\n\t\t\t\t\t\t\t\targs\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: {},\n\t\t\t\t};\n\t\t\t\treturn single_result;\n\t\t\t})\n\t\t);\n\t\tconst serialized_state = JSON.stringify(\n\t\t\t{ ...state, components: serialized_components },\n\t\t\tnull,\n\t\t\tpretty ? 4 : \"\"\n\t\t);\n\t\treturn serialized_state;\n\t}\n\n\tasync deserializeState(ctx: Context, state_string: string) {\n\t\tconst jdd_context = this.makeJDDContext(ctx);\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst raw = JSON.parse(state_string);\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\tconst components_storage = raw.components;\n\t\tif (!Array.isArray(components_storage)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"'components' key is not an array, got ${components_storage}\"\n\t\t\t);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst components_parsed = await Promise.all(\n\t\t\tcomponents_storage.map(async (entry) => {\n\t\t\t\tif (\n\t\t\t\t\t!hasShape(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcomponent_name: predicates.string,\n\t\t\t\t\t\t\targs: predicates.object,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tentry\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Expected components[] items to be objects with 'component_name' and 'args' keys, got ${entry}`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst { component_name, args } = entry;\n\t\t\t\tconst component = this.registry.get(component_name);\n\t\t\t\tif (!component) {\n\t\t\t\t\tthrow new Error(\"Unknown component: ${component_name}\");\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcomponent_name,\n\t\t\t\t\targs: await component.convertStorageToParsed(\n\t\t\t\t\t\tjdd_context,\n\t\t\t\t\t\targs\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t})\n\t\t);\n\t\tconst result = { ...raw, components: components_parsed };\n\t\treturn result;\n\t}\n\n\trenderPreParameterButtons(\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\t_ctx: Context,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\t_state: JDDPageState\n\t): FlatTemplatable | Promise<FlatTemplatable> {\n\t\treturn \"\";\n\t}\n\n\trenderMessages(_ctx: Context, state: JDDPageState) {\n\t\treturn /* HTML */ `<ul\n\t\t\tclass=\"jdd-editor__messages\"\n\t\t\tdata-controller=\"toast\"\n\t\t>\n\t\t\t${(state.messages || []).map(\n\t\t\t\t(e) => `<li class=\"jdd-editor__message\">${e}</li>`\n\t\t\t)}\n\t\t</ul>`;\n\t}\n\n\tasync render(ctx: Context, state: JDDPageState): Promise<string> {\n\t\treturn tempstream/* HTML */ `<div\n\t\t\tclass=\"${[\"two-column\", \"component-debugger\", ...this.classes].join(\n\t\t\t\t\" \"\n\t\t\t)}\"\n\t\t\tid=\"component-debugger\"\n\t\t\tstyle=\"${`--resizable-column-width: ${\n\t\t\t\tstate.preview_size ? state.preview_size + \"px\" : \"50vw\"\n\t\t\t}`}\"\n\t\t\tdata-controller=\"component-debugger\"\n\t\t>\n\t\t\t<div class=\"component-arguments\" id=\"component-arguments\">\n\t\t\t\t${this.renderPreParameterButtons(ctx, state)}\n\t\t\t\t${this.renderParameterButtons(state)}\n\t\t\t\t${this.renderMessages(ctx, state)}\n\t\t\t\t${state.components.map((component, component_index) =>\n\t\t\t\t\tthis.renderComponentBlock(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\tcomponent_index\n\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t\t<details\n\t\t\t\t\tclass=\"component-debugger__json\"\n\t\t\t\t\tdata-controller=\"exportable-textarea\"\n\t\t\t\t\tid=\"exportable-textarea\"\n\t\t\t\t\topen\n\t\t\t\t>\n\t\t\t\t\t<summary>Edit/Export raw JSON</summary>\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tname=\"state_override\"\n\t\t\t\t\t\trows=\"40\"\n\t\t\t\t\t\tcols=\"40\"\n\t\t\t\t\t\tdata-controller=\"json-editor\"\n\t\t\t\t\t\tid=\"component-debugger-json-textarea\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\t${(await this.serializeState(ctx, state, true)).replaceAll(\"<\", \"<\")}\n\t\t\t\t\t\t</textarea\n\t\t\t\t\t>\n\t\t\t\t\t${this.makeActionButton(state, {\n\t\t\t\t\t\taction: \"replace_state\",\n\t\t\t\t\t\tlabel: \"Apply\",\n\t\t\t\t\t})}\n\t\t\t\t\t<button data-action=\"exportable-textarea#copy\">Copy</button>\n\t\t\t\t\t<button data-action=\"exportable-textarea#download\">\n\t\t\t\t\t\tDownload\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type=\"file\" />${\" \"}\n\t\t\t\t\t<button data-action=\"exportable-textarea#import\">\n\t\t\t\t\t\tImport\n\t\t\t\t\t</button>\n\t\t\t\t</details>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tid=\"resize-gutter\"\n\t\t\t\tclass=\"resize-gutter\"\n\t\t\t\tdata-component-debugger-target=\"gutter\"\n\t\t\t></div>\n\t\t\t<div\n\t\t\t\tid=\"component-preview\"\n\t\t\t\tclass=\"component-preview\"\n\t\t\t\tdata-component-debugger-target=\"preview\"\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tid=\"component-preview__header\"\n\t\t\t\t\tclass=\"component-preview__header\"\n\t\t\t\t>\n\t\t\t\t\t<span>Preview</span>\n\t\t\t\t\t<select\n\t\t\t\t\t\tname=\"$[preview_size]\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\tclass=\"component-preview-size-select\"\n\t\t\t\t\t\tdata-component-debugger-target=\"sizeSelect\"\n\t\t\t\t\t\tdata-action=\"change->component-debugger#handleWidthDropdown\"\n\t\t\t\t\t\tdata-turbo-data-turbo-permanent\n\t\t\t\t\t>\n\t\t\t\t\t\t${state.preview_size\n\t\t\t\t\t\t\t? /* HTML */ `<option\n\t\t\t\t\t\t\t\t\tclass=\"dynamic\"\n\t\t\t\t\t\t\t\t\tvalue=\"${state.preview_size}\"\n\t\t\t\t\t\t\t\t\tselected\n\t\t\t\t\t\t\t >\n\t\t\t\t\t\t\t\t\t${state.preview_size} px\n\t\t\t\t\t\t\t </option>`\n\t\t\t\t\t\t\t: \"\"}\n\t\t\t\t\t\t${this.previewSizes.map(\n\t\t\t\t\t\t\t(size) => /* HTML */ `<option value=\"${size}\">\n\t\t\t\t\t\t\t\t${`${size} px`}\n\t\t\t\t\t\t\t</option>`\n\t\t\t\t\t\t)}\n\t\t\t\t\t</select>\n\t\t\t\t\t<noscript>\n\t\t\t\t\t\t${this.makeActionButton(state, \"change_size\")}\n\t\t\t\t\t</noscript>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"jdd-outer-container\">\n\t\t\t\t\t<div class=\"jdd-container\">\n\t\t\t\t\t\t${JDD.render(\n\t\t\t\t\t\t\tthis.registry,\n\t\t\t\t\t\t\tdocumentContainerFromParsed(state.components),\n\t\t\t\t\t\t\tthis.makeJDDContext(ctx)\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>`;\n\t}\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,mCAA6C;AACtD,SAAS,WAAW;AACpB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,UAAU,kBAAkB;AAGrD,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,+BAA+B;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/restrict-template-expressions */\nimport type { Readable } from \"node:stream\";\nimport type { Component, JDDContext, RawJDDocument } from \"@sealcode/jdd\";\nimport { documentContainerFromParsed, Registry } from \"@sealcode/jdd\";\nimport { JDD } from \"@sealcode/jdd\";\nimport { StatefulPage } from \"@sealcode/sealgen\";\nimport { hasFieldOfType, hasShape, predicates } from \"@sealcode/ts-predicates\";\nimport type { Context } from \"koa\";\nimport type { FlatTemplatable, Templatable } from \"tempstream\";\nimport { tempstream } from \"tempstream\";\nimport { ComponentInput } from \"./inputs/component-input.js\";\nimport { ComponentPreviewActions } from \"./component-preview-actions.js\";\nimport { htmlEscape } from \"escape-goat\";\n\nexport const actionName = \"Components\";\n\nexport type JDDPageState = {\n\tcomponents: RawJDDocument;\n\tpreview_size?: string;\n\tmessages?: string[];\n};\n\nexport default abstract class JDDPage extends StatefulPage<\n\tJDDPageState,\n\ttypeof ComponentPreviewActions\n> {\n\tactions = ComponentPreviewActions;\n\n\tpreviewSizes = [\"320\", \"600\", \"800\", \"1024\", \"1300\", \"1920\"];\n\tclasses: string[] = [];\n\n\tpublic registry: Registry;\n\tpublic makeJDDContext: (ctx: Context) => JDDContext;\n\tpublic html: (\n\t\targs: unknown\n\t) => string | Promise<string> | Readable | Promise<Readable>;\n\tpublic defaultHead: (\n\t\t...args: unknown[]\n\t) => string | Promise<string> | Readable | Promise<Readable>;\n\tpublic makeAssetURL: (asset: string) => string;\n\n\tconstructor(args: {\n\t\tregistry: Registry;\n\t\tmakeJDDContext: (ctx: Context) => JDDContext;\n\t\thtml: (\n\t\t\targs: unknown\n\t\t) => string | Promise<string> | Readable | Promise<Readable>;\n\t\tdefaultHead: (\n\t\t\t...args: unknown[]\n\t\t) => string | Promise<string> | Readable | Promise<Readable>;\n\t\tmakeAssetURL?: (asset: string) => string;\n\t}) {\n\t\tsuper();\n\t\tthis.registry = args.registry;\n\t\tthis.makeJDDContext = args.makeJDDContext;\n\t\tthis.defaultHead = args.defaultHead;\n\t\tthis.html = args.html;\n\t\tthis.makeAssetURL =\n\t\t\targs.makeAssetURL ||\n\t\t\t((str) =>\n\t\t\t\t`/dist/jdd-page/${str.startsWith(\"/\") ? str.slice(1) : str}`);\n\t}\n\n\tgetRegistryComponents() {\n\t\treturn this.registry.getAll();\n\t}\n\n\tasync getInitialState(ctx: Context): Promise<JDDPageState> {\n\t\tconst initial_state = {\n\t\t\tcomponents: [],\n\t\t};\n\t\treturn initial_state;\n\t}\n\n\twrapInLayout(\n\t\tctx: Context,\n\t\tcontent: Templatable,\n\t\tstate: JDDPageState\n\t): Templatable {\n\t\tconst jdd_context = this.makeJDDContext(ctx);\n\t\tconst jdd = new JDD(\n\t\t\tthis.registry,\n\t\t\tjdd_context,\n\t\t\tdocumentContainerFromParsed(state.components)\n\t\t);\n\t\treturn this.html({\n\t\t\tctx,\n\t\t\ttitle: \"Components\",\n\t\t\tbody: content,\n\t\t\tdescription: \"\",\n\t\t\tcss_clumps: [\"jdd-page\", ...jdd.getAllCSSClumps()],\n\t\t\thtmlOptions: {\n\t\t\t\tmorphing: true,\n\t\t\t\tpreserveScroll: true,\n\t\t\t\tautoRefreshCSS: false,\n\t\t\t\tnavbar: () => ``,\n\t\t\t\tbodyClasses: [\"jdd-editor\"],\n\t\t\t\tshowBottomNavbar: false,\n\t\t\t\tshowBanner: false,\n\t\t\t\tshowFooter: false,\n\t\t\t\tloadHamburgerMenu: false,\n\t\t\t\tloadSearchModal: false,\n\t\t\t},\n\t\t\tmakeHead: (...args: unknown[]) =>\n\t\t\t\ttempstream/* HTML */ `${this.defaultHead(...args)}\n\t\t\t\t\t<link\n\t\t\t\t\t\thref=\"/dist/jdd-page.entrypoint.css\"\n\t\t\t\t\t\trel=\"stylesheet\"\n\t\t\t\t\t\ttype=\"text/css\"\n\t\t\t\t\t/>\n\t\t\t\t\t${jdd.renderEarlyAssets()}`,\n\t\t});\n\t}\n\n\tasync preprocessOverrides(\n\t\t_ctx: Context,\n\t\tstate: JDDPageState,\n\t\toverrides: Record<string, unknown>\n\t) {\n\t\tconst jdd_context = this.makeJDDContext(_ctx);\n\t\tif (\n\t\t\t!hasFieldOfType(\n\t\t\t\t\"components\",\n\t\t\t\toverrides,\n\t\t\t\tpredicates.array(\n\t\t\t\t\tpredicates.shape({\n\t\t\t\t\t\targs: predicates.object,\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t)\n\t\t) {\n\t\t\treturn {};\n\t\t}\n\t\tfor (const [component_index, { component_name }] of Object.entries(\n\t\t\tstate.components\n\t\t)) {\n\t\t\tconst component = this.registry.get(component_name);\n\t\t\tif (!component) {\n\t\t\t\tthrow new Error(`Unknown component: ${component_name}`);\n\t\t\t}\n\t\t\tconst overrides_for_component = overrides.components[\n\t\t\t\tparseInt(component_index)\n\t\t\t] || { args: {} };\n\t\t\tconst promises = Object.entries(component.getArguments()).map(\n\t\t\t\tasync ([arg_name, arg]) => {\n\t\t\t\t\tconst value = overrides_for_component.args[arg_name];\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tconst new_value = await arg.receivedToParsed(\n\t\t\t\t\t\t\tjdd_context,\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t);\n\t\t\t\t\t\toverrides_for_component.args[arg_name] = new_value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\tawait Promise.all(promises);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn overrides;\n\t}\n\n\t// eslint-disable-next-line no-unused-vars\n\tabstract renderParameterButtons(_state: JDDPageState): FlatTemplatable;\n\n\tasync renderComponentArgs<C extends Component>(\n\t\tctx: Context,\n\t\tstate: JDDPageState,\n\t\tcomponent: C,\n\t\targs: Record<string, unknown>,\n\t\tindex: number\n\t): Promise<FlatTemplatable> {\n\t\tconst jdd_context = this.makeJDDContext(ctx);\n\t\treturn tempstream/* HTML */ `<div\n\t\t\tclass=\"component-preview-parameters\"\n\t\t\tid=\"${`component-preview-parameters--${index}`}\"\n\t\t>\n\t\t\t${Object.entries(component.getArguments()).map(\n\t\t\t\tasync ([arg_name, arg]) =>\n\t\t\t\t\tComponentInput({\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\targ_path: [\n\t\t\t\t\t\t\t\"components\",\n\t\t\t\t\t\t\tindex.toString(),\n\t\t\t\t\t\t\t\"args\",\n\t\t\t\t\t\t\targ_name,\n\t\t\t\t\t\t],\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\targ,\n\t\t\t\t\t\tvalue:\n\t\t\t\t\t\t\targs[arg_name] === undefined ||\n\t\t\t\t\t\t\tcomponent\n\t\t\t\t\t\t\t\t.getArguments()\n\t\t\t\t\t\t\t\t[arg_name]?.isEmpty(args[arg_name])\n\t\t\t\t\t\t\t\t? await arg.getExampleValue(jdd_context)\n\t\t\t\t\t\t\t\t: args[arg_name],\n\t\t\t\t\t\tpage: this,\n\t\t\t\t\t\tmakeJDDContext: this.makeJDDContext,\n\t\t\t\t\t\tmakeAssetURL: this.makeAssetURL,\n\t\t\t\t\t})\n\t\t\t)}\n\t\t</div>`;\n\t}\n\n\trenderComponentBlock(\n\t\tctx: Context,\n\t\tstate: JDDPageState,\n\t\t{\n\t\t\tcomponent_name,\n\t\t\targs: component_args,\n\t\t}: {\n\t\t\tcomponent_name: string;\n\t\t\targs: Record<string, unknown>;\n\t\t},\n\t\tcomponent_index: number\n\t) {\n\t\tconst component = this.registry.get(component_name);\n\t\tif (!component) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this.renderComponentArgs(\n\t\t\tctx,\n\t\t\tstate,\n\t\t\tcomponent,\n\t\t\tcomponent_args,\n\t\t\tcomponent_index\n\t\t);\n\t}\n\n\tasync serializeState(ctx: Context, state: JDDPageState, pretty = false) {\n\t\tconst serialized_components = await Promise.all(\n\t\t\tstate.components.map(async ({ component_name, args }) => {\n\t\t\t\tconst component = this.registry.get(component_name);\n\t\t\t\tconst single_result = {\n\t\t\t\t\tcomponent_name,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-call\n\t\t\t\t\targs: component\n\t\t\t\t\t\t? await component.convertParsedToStorage(\n\t\t\t\t\t\t\t\tthis.makeJDDContext(ctx),\n\t\t\t\t\t\t\t\targs\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: {},\n\t\t\t\t};\n\t\t\t\treturn single_result;\n\t\t\t})\n\t\t);\n\t\tconst serialized_state = JSON.stringify(\n\t\t\t{ ...state, components: serialized_components },\n\t\t\tnull,\n\t\t\tpretty ? 4 : \"\"\n\t\t);\n\t\treturn serialized_state;\n\t}\n\n\tasync deserializeState(ctx: Context, state_string: string) {\n\t\tconst jdd_context = this.makeJDDContext(ctx);\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst raw = JSON.parse(state_string) as Record<string, unknown>;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\tconst components_storage = raw.components;\n\t\tif (!Array.isArray(components_storage)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"'components' key is not an array, got ${components_storage}\"\n\t\t\t);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst components_parsed = await Promise.all(\n\t\t\tcomponents_storage.map(async (entry) => {\n\t\t\t\tif (\n\t\t\t\t\t!hasShape(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcomponent_name: predicates.string,\n\t\t\t\t\t\t\targs: predicates.object,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tentry\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Expected components[] items to be objects with 'component_name' and 'args' keys, got ${entry}`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst { component_name, args } = entry;\n\t\t\t\tconst component = this.registry.get(component_name);\n\t\t\t\tif (!component) {\n\t\t\t\t\tthrow new Error(\"Unknown component: ${component_name}\");\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcomponent_name,\n\t\t\t\t\targs: await component.convertStorageToParsed(\n\t\t\t\t\t\tjdd_context,\n\t\t\t\t\t\targs\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t})\n\t\t);\n\t\tconst result = { ...raw, components: components_parsed };\n\t\treturn result;\n\t}\n\n\trenderPreParameterButtons(\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\t_ctx: Context,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\t_state: JDDPageState\n\t): FlatTemplatable | Promise<FlatTemplatable> {\n\t\treturn \"\";\n\t}\n\n\trenderMessages(_ctx: Context, state: JDDPageState) {\n\t\treturn /* HTML */ `<ul\n\t\t\tclass=\"jdd-editor__messages\"\n\t\t\tdata-controller=\"toast\"\n\t\t>\n\t\t\t${(state.messages || []).map(\n\t\t\t\t(e) => `<li class=\"jdd-editor__message\">${e}</li>`\n\t\t\t)}\n\t\t</ul>`;\n\t}\n\n\tasync render(ctx: Context, state: JDDPageState): Promise<string> {\n\t\treturn tempstream/* HTML */ `<div\n\t\t\tclass=\"${[\"two-column\", \"component-debugger\", ...this.classes].join(\" \")}\"\n\t\t\tid=\"component-debugger\"\n\t\t\tstyle=\"${`--resizable-column-width: ${\n\t\t\t\tstate.preview_size ? state.preview_size + \"px\" : \"50vw\"\n\t\t\t}`}\"\n\t\t\tdata-controller=\"component-debugger\"\n\t\t>\n\t\t\t<div class=\"component-arguments\" id=\"component-arguments\">\n\t\t\t\t${this.renderPreParameterButtons(ctx, state)}\n\t\t\t\t${this.renderParameterButtons(state)}\n\t\t\t\t${this.renderMessages(ctx, state)}\n\t\t\t\t${state.components.map((component, component_index) =>\n\t\t\t\t\tthis.renderComponentBlock(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\tcomponent_index\n\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t\t<details\n\t\t\t\t\tclass=\"component-debugger__json\"\n\t\t\t\t\tdata-controller=\"exportable-textarea\"\n\t\t\t\t\tid=\"exportable-textarea\"\n\t\t\t\t\topen\n\t\t\t\t>\n\t\t\t\t\t<summary>Edit/Export raw JSON</summary>\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tname=\"state_override\"\n\t\t\t\t\t\trows=\"40\"\n\t\t\t\t\t\tcols=\"40\"\n\t\t\t\t\t\tdata-controller=\"json-editor\"\n\t\t\t\t\t\tid=\"component-debugger-json-textarea\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t>\n\t\t\t\t\t\t${(await this.serializeState(ctx, state, true)).replaceAll(\"<\", \"<\")}\n\t\t\t\t\t</textarea\n\t\t\t\t\t>\n\t\t\t\t\t${this.makeActionButton(state, {\n\t\t\t\t\t\taction: \"replace_state\",\n\t\t\t\t\t\tlabel: \"Apply\",\n\t\t\t\t\t})}\n\t\t\t\t\t<button data-action=\"exportable-textarea#copy\">Copy</button>\n\t\t\t\t\t<button data-action=\"exportable-textarea#download\">\n\t\t\t\t\t\tDownload\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type=\"file\" />${\" \"}\n\t\t\t\t\t<button data-action=\"exportable-textarea#import\">\n\t\t\t\t\t\tImport\n\t\t\t\t\t</button>\n\t\t\t\t</details>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tid=\"resize-gutter\"\n\t\t\t\tclass=\"resize-gutter\"\n\t\t\t\tdata-component-debugger-target=\"gutter\"\n\t\t\t></div>\n\t\t\t<div\n\t\t\t\tid=\"component-preview\"\n\t\t\t\tclass=\"component-preview\"\n\t\t\t\tdata-component-debugger-target=\"preview\"\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tid=\"component-preview__header\"\n\t\t\t\t\tclass=\"component-preview__header\"\n\t\t\t\t>\n\t\t\t\t\t<div class=\"component-preview__item\">\n\t\t\t\t\t\t<span>Window size</span>\n\t\t\t\t\t\t<select\n\t\t\t\t\t\t\tname=\"$[preview_size]\"\n\t\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\t\tclass=\"component-preview-size-select\"\n\t\t\t\t\t\t\tdata-component-debugger-target=\"sizeSelect\"\n\t\t\t\t\t\t\tdata-action=\"change->component-debugger#handleWidthDropdown\"\n\t\t\t\t\t\t\tdata-turbo-data-turbo-permanent\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t${\n\t\t\t\t\t\t\t\tstate.preview_size\n\t\t\t\t\t\t\t\t\t? /* HTML */ `<option\n\t\t\t\t\t\t\t\t\t\t\tclass=\"dynamic\"\n\t\t\t\t\t\t\t\t\t\t\tvalue=\"${state.preview_size}\"\n\t\t\t\t\t\t\t\t\t\t\tselected\n\t\t\t\t\t\t\t\t\t >\n\t\t\t\t\t\t\t\t\t\t\t${state.preview_size} px\n\t\t\t\t\t\t\t\t\t </option>`\n\t\t\t\t\t\t\t\t\t: \"\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t${this.previewSizes.map(\n\t\t\t\t\t\t\t\t(size) => /* HTML */ `<option value=\"${size}\">\n\t\t\t\t\t\t\t\t\t${`${size} px`}\n\t\t\t\t\t\t\t\t</option>`\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t<noscript>\n\t\t\t\t\t\t\t${this.makeActionButton(state, \"change_size\")}\n\t\t\t\t\t\t</noscript>\n\t\t\t\t\t</div>\n\t\t\t\t\t<style>\n\t\t\t\t\t\t.component-preview .component-raw-view {\n\t\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.component-preview .jdd-outer-container {\n\t\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.component-preview:has(\n\t\t\t\t\t\t\t\t.component-preview-checkbox:checked\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.component-raw-view {\n\t\t\t\t\t\t\tdisplay: block;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t.component-preview:has(\n\t\t\t\t\t\t\t\t.component-preview-checkbox:checked\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.jdd-outer-container {\n\t\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t\t}\n\t\t\t\t\t</style>\n\t\t\t\t\t<label class=\"component-preview__item\" for=\"show-html\">\n\t\t\t\t\t\tShow HTML\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\tid=\"show-html\"\n\t\t\t\t\t\t\tclass=\"component-preview-checkbox\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t\t\t${(async () => {\n\t\t\t\t\t\t\tconst currentComponent = await JDD.render(\n\t\t\t\t\t\t\t\tthis.registry,\n\t\t\t\t\t\t\t\tdocumentContainerFromParsed(state.components),\n\t\t\t\t\t\t\t\tthis.makeJDDContext(ctx)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn /* HTML */ ` <div\n\t\t\t\t\t\t\t\t\tclass=\"jdd-outer-container\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<div class=\"jdd-container\">\n\t\t\t\t\t\t\t\t\t\t${currentComponent}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"component-raw-view\">\n\t\t\t\t\t\t\t\t\t<pre><code>${htmlEscape(\n\t\t\t\t\t\t\t\t\t\tcurrentComponent\n\t\t\t\t\t\t\t\t\t)}</code></pre>\n\t\t\t\t\t\t\t\t</div>`;\n\t\t\t\t\t\t})()}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>`;\n\t}\n}\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,mCAA6C;AACtD,SAAS,WAAW;AACpB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,UAAU,kBAAkB;AAGrD,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,+BAA+B;AACxC,SAAS,kBAAkB;AAEpB,MAAM,aAAa;AAQ1B,MAAO,gBAAuC,aAG5C;AAAA,EAgBD,YAAY,MAUT;AACF,UAAM;AA1BP,mBAAU;AAEV,wBAAe,CAAC,OAAO,OAAO,OAAO,QAAQ,QAAQ,MAAM;AAC3D,mBAAoB,CAAC;AAwBpB,SAAK,WAAW,KAAK;AACrB,SAAK,iBAAiB,KAAK;AAC3B,SAAK,cAAc,KAAK;AACxB,SAAK,OAAO,KAAK;AACjB,SAAK,eACJ,KAAK,iBACJ,CAAC,QACD,kBAAkB,IAAI,WAAW,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI;AAAA,EAC1D;AAAA,EAEA,wBAA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SA+BpB,MAAM,eACQ;AAAA;AAAA,oBAEF,MAAM;AAAA;AAAA;AAAA,aAGb,MAAM;AAAA,wBAER;AAAA,SAEF,KAAK,aAAa;AAAA,MACnB,CAAC,SAAoB,kBAAkB;AAAA,WACpC,GAAG;AAAA;AAAA,IAEP;AAAA;AAAA;AAAA,SAGE,KAAK,iBAAiB,OAAO,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAoC1C,YAAY;AACd,YAAM,mBAAmB,MAAM,IAAI;AAAA,QAClC,KAAK;AAAA,QACL,4BAA4B,MAAM,UAAU;AAAA,QAC5C,KAAK,eAAe,GAAG;AAAA,MACxB;AACA,aAAkB;AAAA;AAAA;AAAA;AAAA,YAIb;AAAA;AAAA;AAAA;AAAA,sBAIU;AAAA,QACZ;AAAA,MACD;AAAA;AAAA,IAEH,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA,EAKR;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealcode/jdd-editor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rm -rf dist && node ./esbuild.cjs",
|
|
7
|
-
"prepare": "rm -rf @types && npm run typecheck && npm run build-declarations && npm run build",
|
|
8
|
-
"pretest": "npm run build",
|
|
7
|
+
"prepare": "husky && rm -rf @types && npm run typecheck && npm run build-declarations && npm run build",
|
|
8
|
+
"pretest": "npm run build && npm run typecheck",
|
|
9
9
|
"test": "node test.cjs",
|
|
10
10
|
"lint": "eslint src",
|
|
11
11
|
"build-declarations": "tsc --emitDeclarationOnly",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"eslint-plugin-prettier": "^4.2.1",
|
|
33
33
|
"eslint-plugin-with-tsc-error": "^0.0.8",
|
|
34
34
|
"fs": "^0.0.1-security",
|
|
35
|
+
"husky": "^9.1.7",
|
|
35
36
|
"mocha": "^10.2.0",
|
|
36
37
|
"mri": "^1.2.0",
|
|
37
38
|
"nyc": "^15.1.0",
|
|
@@ -46,9 +47,9 @@
|
|
|
46
47
|
"types": "./@types/index.d.ts",
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"@koa/router": "^13.1.0",
|
|
49
|
-
"@sealcode/jdd": "^0.8.
|
|
50
|
+
"@sealcode/jdd": "^0.8.1",
|
|
50
51
|
"@sealcode/sealcodemirror": "^5.70.0-beta5",
|
|
51
|
-
"@sealcode/sealgen": "^0.
|
|
52
|
+
"@sealcode/sealgen": "^0.19.6",
|
|
52
53
|
"@types/object-path": "^0.11.4",
|
|
53
54
|
"@types/throttle-debounce": "^5.0.2",
|
|
54
55
|
"@types/turndown": "^5.0.5",
|
|
@@ -4,7 +4,10 @@ import { List, makeSimpleEnglishJDDContext, Table } from "@sealcode/jdd";
|
|
|
4
4
|
import { isTableData, isTableRegularRow } from "@sealcode/jdd";
|
|
5
5
|
import objectPath from "object-path";
|
|
6
6
|
import type { JDDPageState } from "./jdd-page.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
StatefulPageAction,
|
|
9
|
+
StatefulPageActionArgument,
|
|
10
|
+
} from "@sealcode/sealgen";
|
|
8
11
|
import type JDDPage from "./jdd-page.js";
|
|
9
12
|
|
|
10
13
|
function moveElement<T>(
|
|
@@ -50,7 +53,7 @@ export function getComponentData(
|
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
export const ComponentPreviewActions = <const>{
|
|
56
|
+
export const ComponentPreviewActions = (<const>{
|
|
54
57
|
add_array_item: async ({
|
|
55
58
|
ctx,
|
|
56
59
|
state,
|
|
@@ -509,14 +512,14 @@ export const ComponentPreviewActions = <const>{
|
|
|
509
512
|
state,
|
|
510
513
|
inputs,
|
|
511
514
|
page,
|
|
512
|
-
}: StatefulPageActionArgument<JDDPageState>) => {
|
|
513
|
-
const new_state = await (page as JDDPage).deserializeState(
|
|
515
|
+
}: StatefulPageActionArgument<JDDPageState>): Promise<JDDPageState> => {
|
|
516
|
+
const new_state = (await (page as JDDPage).deserializeState(
|
|
514
517
|
ctx,
|
|
515
518
|
inputs["state_override"] || "{}"
|
|
516
|
-
);
|
|
519
|
+
)) as JDDPageState;
|
|
517
520
|
return {
|
|
518
521
|
...new_state,
|
|
519
522
|
preview_size: state.preview_size,
|
|
520
523
|
};
|
|
521
524
|
},
|
|
522
|
-
}
|
|
525
|
+
}) as Record<string, StatefulPageAction<JDDPageState>>;
|
package/src/components.sreact.ts
CHANGED
|
@@ -42,21 +42,8 @@ export class JDDDebugger extends JDDPage {
|
|
|
42
42
|
actions = ComponentPreviewActions;
|
|
43
43
|
|
|
44
44
|
async getInitialState(ctx: Context) {
|
|
45
|
-
const first_component = Object.entries(this.registry.getAll())[0];
|
|
46
|
-
if (!first_component) {
|
|
47
|
-
throw new Error("No registered components!");
|
|
48
|
-
}
|
|
49
|
-
const [component_name, component] = first_component;
|
|
50
45
|
const initial_state = {
|
|
51
|
-
components: [
|
|
52
|
-
{
|
|
53
|
-
component_name: component_name,
|
|
54
|
-
args: await component.getExampleValues(
|
|
55
|
-
this.makeJDDContext(ctx)
|
|
56
|
-
),
|
|
57
|
-
open: true,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
46
|
+
components: [],
|
|
60
47
|
};
|
|
61
48
|
return initial_state;
|
|
62
49
|
}
|
|
@@ -20,6 +20,11 @@ export default class JSONEditor extends Controller<HTMLTextAreaElement> {
|
|
|
20
20
|
cm: any;
|
|
21
21
|
saving = false;
|
|
22
22
|
|
|
23
|
+
getSessionStorageKey() {
|
|
24
|
+
const page_url = document.location.pathname;
|
|
25
|
+
return `jdd-editor-autosave__${page_url}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
addCSS() {
|
|
24
29
|
const tag = document.querySelector(`head #${CSS_ID}`);
|
|
25
30
|
if (!tag) {
|
|
@@ -32,6 +37,18 @@ export default class JSONEditor extends Controller<HTMLTextAreaElement> {
|
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
|
|
40
|
+
resetValue() {
|
|
41
|
+
sessionStorage.setItem(
|
|
42
|
+
this.getSessionStorageKey(),
|
|
43
|
+
this.element.innerHTML
|
|
44
|
+
);
|
|
45
|
+
if (!this.saving) {
|
|
46
|
+
if (this.cm.getValue() != this.element.innerHTML) {
|
|
47
|
+
this.cm.setValue(this.element.innerHTML);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
35
52
|
async addJS(js_id: string, js_path: string) {
|
|
36
53
|
return new Promise<void>((resolve, reject) => {
|
|
37
54
|
const once_loaded = (e: MouseEvent) => {
|
|
@@ -60,6 +77,20 @@ export default class JSONEditor extends Controller<HTMLTextAreaElement> {
|
|
|
60
77
|
}
|
|
61
78
|
|
|
62
79
|
async connect() {
|
|
80
|
+
const autosave = sessionStorage.getItem(this.getSessionStorageKey());
|
|
81
|
+
if (autosave) {
|
|
82
|
+
this.element.innerHTML = autosave;
|
|
83
|
+
const action = this.element.form?.getAttribute("action");
|
|
84
|
+
if (!action) return;
|
|
85
|
+
|
|
86
|
+
this.element.form?.setAttribute(
|
|
87
|
+
"action",
|
|
88
|
+
"./?action=replace_state&action_args=W10%3D"
|
|
89
|
+
);
|
|
90
|
+
this.element.form?.requestSubmit();
|
|
91
|
+
this.element.form?.setAttribute("action", action);
|
|
92
|
+
}
|
|
93
|
+
|
|
63
94
|
if (this.element.parentNode?.querySelector(".CodeMirror")) {
|
|
64
95
|
//already loaded, quit;
|
|
65
96
|
return;
|
|
@@ -84,16 +115,7 @@ export default class JSONEditor extends Controller<HTMLTextAreaElement> {
|
|
|
84
115
|
// to prevent morhping from removing the element
|
|
85
116
|
this.cm.getWrapperElement().setAttribute("data-turbo-permanent", "");
|
|
86
117
|
const observer = new MutationObserver((mutation) => {
|
|
87
|
-
|
|
88
|
-
if (!this.saving) {
|
|
89
|
-
if (this.cm.getValue() != this.element.innerHTML) {
|
|
90
|
-
console.log(
|
|
91
|
-
"SETTING CM VALUE TO",
|
|
92
|
-
this.element.innerHTML.slice(0, 100)
|
|
93
|
-
);
|
|
94
|
-
this.cm.setValue(this.element.innerHTML);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
118
|
+
this.resetValue();
|
|
97
119
|
});
|
|
98
120
|
observer.observe(this.element, {
|
|
99
121
|
characterData: true,
|
|
@@ -101,16 +123,7 @@ export default class JSONEditor extends Controller<HTMLTextAreaElement> {
|
|
|
101
123
|
});
|
|
102
124
|
|
|
103
125
|
this.element.addEventListener("change", () => {
|
|
104
|
-
|
|
105
|
-
if (!this.saving) {
|
|
106
|
-
if (this.cm.getValue() != this.element.innerHTML) {
|
|
107
|
-
console.log(
|
|
108
|
-
"SETTING CM VALUE TO",
|
|
109
|
-
this.element.innerHTML.slice(0, 100)
|
|
110
|
-
);
|
|
111
|
-
this.cm.setValue(this.element.innerHTML);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
126
|
+
this.resetValue();
|
|
114
127
|
});
|
|
115
128
|
this.element
|
|
116
129
|
.closest("details")
|
|
@@ -47,6 +47,11 @@ export default class RefreshStyles extends Controller {
|
|
|
47
47
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
48
48
|
|
|
49
49
|
this.socket = new WebSocket(`ws://localhost:${port as number}`);
|
|
50
|
+
this.socket.onmessage = async (message) => {
|
|
51
|
+
if (message.data === "css") {
|
|
52
|
+
refresh_css();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
50
55
|
} catch (e) {
|
|
51
56
|
console.error(e);
|
|
52
57
|
// eslint-disable-next-line no-console
|
|
@@ -54,11 +59,6 @@ export default class RefreshStyles extends Controller {
|
|
|
54
59
|
"Not enabling auto style refresh due to the above error"
|
|
55
60
|
);
|
|
56
61
|
}
|
|
57
|
-
this.socket.onmessage = async (message) => {
|
|
58
|
-
if (message.data === "css") {
|
|
59
|
-
refresh_css();
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
62
|
document.documentElement.addEventListener("turbo:morph", refresh_css);
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Context } from "koa";
|
|
2
|
+
import type { Color, JDDContext } from "@sealcode/jdd";
|
|
3
|
+
import type { StatefulPage } from "@sealcode/sealgen";
|
|
4
|
+
import type { ComponentPreviewActions } from "../component-preview-actions.js";
|
|
5
|
+
import type { JDDPageState } from "../jdd-page.js";
|
|
6
|
+
import { tempstream } from "tempstream";
|
|
7
|
+
import { printArgPath } from "./print-arg-path.js";
|
|
8
|
+
import { htmlEscape } from "escape-goat";
|
|
9
|
+
|
|
10
|
+
export function ComponentInputColor<State extends JDDPageState>({
|
|
11
|
+
arg_path,
|
|
12
|
+
value,
|
|
13
|
+
onchange,
|
|
14
|
+
}: {
|
|
15
|
+
state: State;
|
|
16
|
+
arg_path: string[];
|
|
17
|
+
arg: Color;
|
|
18
|
+
value: string | null;
|
|
19
|
+
page: StatefulPage<JDDPageState, typeof ComponentPreviewActions>;
|
|
20
|
+
ctx: Context;
|
|
21
|
+
onchange?: string;
|
|
22
|
+
makeJDDContext: (ctx: Context) => JDDContext;
|
|
23
|
+
}): JSX.Element {
|
|
24
|
+
return tempstream/* HTML */ `<div style="margin-bottom: 10px">
|
|
25
|
+
<div>
|
|
26
|
+
<label>
|
|
27
|
+
${arg_path.at(-1) || ""}
|
|
28
|
+
<input
|
|
29
|
+
type="color"
|
|
30
|
+
name="${`$${printArgPath(arg_path)}`}"
|
|
31
|
+
value="${htmlEscape(value || "#000000")}"
|
|
32
|
+
autocomplete="off"
|
|
33
|
+
onchange="${onchange || ""}"
|
|
34
|
+
/>
|
|
35
|
+
</label>
|
|
36
|
+
</div>
|
|
37
|
+
</div>`;
|
|
38
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { printArgPath } from "./print-arg-path.js";
|
|
2
2
|
import type { Context } from "koa";
|
|
3
3
|
import type { ComponentArgument, JDDContext, TableData } from "@sealcode/jdd";
|
|
4
|
-
import { NestedComponent, SingleReference } from "@sealcode/jdd";
|
|
4
|
+
import { NestedComponent, Color, SingleReference } from "@sealcode/jdd";
|
|
5
5
|
import {
|
|
6
6
|
ComponentArguments,
|
|
7
7
|
Enum,
|
|
@@ -22,7 +22,7 @@ import type { FilePointer } from "@sealcode/file-manager";
|
|
|
22
22
|
import { ComponentInputSingleReference } from "./component-input-single-reference.js";
|
|
23
23
|
import { is, predicates } from "@sealcode/ts-predicates";
|
|
24
24
|
import { tempstream } from "tempstream";
|
|
25
|
-
|
|
25
|
+
import { ComponentInputColor } from "./component-input-color.js";
|
|
26
26
|
export const actionName = "Components";
|
|
27
27
|
const absoluteUrlPattern = "http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)";
|
|
28
28
|
|
|
@@ -48,6 +48,19 @@ export async function ComponentInput<State extends JDDPageState, T>({
|
|
|
48
48
|
if (value === undefined) {
|
|
49
49
|
value = await arg.getEmptyValue(makeJDDContext(ctx));
|
|
50
50
|
}
|
|
51
|
+
if (arg instanceof Color) {
|
|
52
|
+
return ComponentInputColor({
|
|
53
|
+
ctx,
|
|
54
|
+
state,
|
|
55
|
+
arg_path,
|
|
56
|
+
arg,
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
58
|
+
value: value as string,
|
|
59
|
+
page,
|
|
60
|
+
onchange: page.rerender(),
|
|
61
|
+
makeJDDContext,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
51
64
|
if (arg instanceof List) {
|
|
52
65
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
53
66
|
return ComponentInputList({
|