@sealcode/jdd-editor 0.1.20 → 0.1.22
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/.nyc_output/cfebf13d-f940-426b-a4d3-af28d17bb6b8.json +1 -0
- package/.nyc_output/processinfo/2ad4e34c-cebb-4299-9698-08eccbbe71f7.json +1 -0
- package/.nyc_output/processinfo/71f2685b-e2c9-4db2-9f31-0dbdcacfcea1.json +1 -0
- package/.nyc_output/processinfo/cfebf13d-f940-426b-a4d3-af28d17bb6b8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/.xunit +1 -1
- package/@types/test.test.d.ts +0 -0
- package/coverage/clover.xml +279 -259
- package/dist/src/components.sreact.js +1 -1
- package/dist/src/components.sreact.js.map +2 -2
- package/dist/src/controllers/autogrow-textarea.stimulus.js.map +2 -2
- package/dist/src/controllers/markdown-textarea.stimulus.js +1 -1
- package/dist/src/controllers/markdown-textarea.stimulus.js.map +2 -2
- package/dist/src/controllers/refresh-styles.stimulus.js +1 -1
- package/dist/src/controllers/refresh-styles.stimulus.js.map +2 -2
- package/dist/src/inputs/component-input-single-reference.js +1 -1
- package/dist/src/inputs/component-input-single-reference.js.map +2 -2
- package/dist/src/inputs/component-input-structured.js +1 -1
- package/dist/src/inputs/component-input-structured.js.map +2 -2
- package/dist/src/inputs/component-input.js +30 -7
- package/dist/src/inputs/component-input.js.map +2 -2
- package/dist/src/jdd-page.js +1 -1
- package/dist/src/jdd-page.js.map +2 -2
- package/{lib → dist}/src/test.test.js +1 -1
- package/dist/src/test.test.js.map +7 -0
- package/package.json +6 -5
- package/src/components.sreact.ts +1 -1
- package/src/controllers/autogrow-textarea.stimulus.ts +2 -1
- package/src/controllers/markdown-textarea.stimulus.ts +1 -1
- package/src/controllers/refresh-styles.stimulus.ts +3 -1
- package/src/inputs/component-input-single-reference.ts +1 -1
- package/src/inputs/component-input-structured.ts +1 -1
- package/src/inputs/component-input.ts +31 -9
- package/src/jdd-page.ts +1 -1
- package/src/test.test.ts +3 -0
- package/test.cjs +53 -0
- package/.mocharc.js +0 -6
- package/.nyc_output/9bfa248d-4f8e-4d29-9c47-d1a3961c5254.json +0 -1
- package/.nyc_output/processinfo/29e7bb87-9f10-462e-84d8-ec620cfa9e6b.json +0 -1
- package/.nyc_output/processinfo/7d7104e8-f179-427b-b4bd-30f78397e4f1.json +0 -1
- package/.nyc_output/processinfo/9bfa248d-4f8e-4d29-9c47-d1a3961c5254.json +0 -1
- package/esbuild.js +0 -23
- package/lib/src/component-preview-actions.js +0 -377
- package/lib/src/component-preview-actions.js.map +0 -7
- package/lib/src/components.sreact.js +0 -93
- package/lib/src/components.sreact.js.map +0 -7
- package/lib/src/controllers/autogrow-textarea.stimulus.js +0 -13
- package/lib/src/controllers/autogrow-textarea.stimulus.js.map +0 -7
- package/lib/src/controllers/component-debugger.stimulus.js +0 -193
- package/lib/src/controllers/component-debugger.stimulus.js.map +0 -7
- package/lib/src/controllers/exportable-textarea.stimulus.js +0 -71
- package/lib/src/controllers/exportable-textarea.stimulus.js.map +0 -7
- package/lib/src/controllers/input-image-preview.stimulus.js +0 -30
- package/lib/src/controllers/input-image-preview.stimulus.js.map +0 -7
- package/lib/src/controllers/jdd-table-paste.stimulus.js +0 -78
- package/lib/src/controllers/jdd-table-paste.stimulus.js.map +0 -7
- package/lib/src/controllers/json-editor.stimulus.js +0 -114
- package/lib/src/controllers/json-editor.stimulus.js.map +0 -7
- package/lib/src/controllers/markdown-textarea.stimulus.js +0 -174
- package/lib/src/controllers/markdown-textarea.stimulus.js.map +0 -7
- package/lib/src/controllers/refresh-on-ts-changes.stimulus.js +0 -90
- package/lib/src/controllers/refresh-on-ts-changes.stimulus.js.map +0 -7
- package/lib/src/controllers/refresh-styles.stimulus.js +0 -67
- package/lib/src/controllers/refresh-styles.stimulus.js.map +0 -7
- package/lib/src/controllers/submit-on-input.stimulus.js +0 -55
- package/lib/src/controllers/submit-on-input.stimulus.js.map +0 -7
- package/lib/src/controllers/toast.stimulus.js +0 -19
- package/lib/src/controllers/toast.stimulus.js.map +0 -7
- package/lib/src/edit-jdd-field.js +0 -94
- package/lib/src/edit-jdd-field.js.map +0 -7
- package/lib/src/index.js +0 -3
- package/lib/src/index.js.map +0 -7
- package/lib/src/inputs/component-input-enum.js +0 -30
- package/lib/src/inputs/component-input-enum.js.map +0 -7
- package/lib/src/inputs/component-input-image.js +0 -63
- package/lib/src/inputs/component-input-image.js.map +0 -7
- package/lib/src/inputs/component-input-list.js +0 -74
- package/lib/src/inputs/component-input-list.js.map +0 -7
- package/lib/src/inputs/component-input-single-reference.js +0 -31
- package/lib/src/inputs/component-input-single-reference.js.map +0 -7
- package/lib/src/inputs/component-input-structured.js +0 -36
- package/lib/src/inputs/component-input-structured.js.map +0 -7
- package/lib/src/inputs/component-input-table.js +0 -228
- package/lib/src/inputs/component-input-table.js.map +0 -7
- package/lib/src/inputs/component-input.js +0 -164
- package/lib/src/inputs/component-input.js.map +0 -7
- package/lib/src/inputs/print-arg-path.js +0 -7
- package/lib/src/inputs/print-arg-path.js.map +0 -7
- package/lib/src/jdd-creator.js +0 -131
- package/lib/src/jdd-creator.js.map +0 -7
- package/lib/src/jdd-page.js +0 -339
- package/lib/src/jdd-page.js.map +0 -7
- package/lib/src/test.test.js.map +0 -7
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/.nyc_output/{29e7bb87-9f10-462e-84d8-ec620cfa9e6b.json → 2ad4e34c-cebb-4299-9698-08eccbbe71f7.json} +0 -0
- /package/.nyc_output/{7d7104e8-f179-427b-b4bd-30f78397e4f1.json → 71f2685b-e2c9-4db2-9f31-0dbdcacfcea1.json} +0 -0
|
@@ -21,6 +21,7 @@ import { ComponentInputTable } from "./component-input-table.js";
|
|
|
21
21
|
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
|
+
import { tempstream } from "tempstream";
|
|
24
25
|
|
|
25
26
|
export const actionName = "Components";
|
|
26
27
|
const absoluteUrlPattern = "http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)";
|
|
@@ -132,6 +133,35 @@ export async function ComponentInput<State extends JDDPageState, T>({
|
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
135
|
|
|
136
|
+
const inputElement = () => {
|
|
137
|
+
if (arg instanceof ComponentArguments.Number) {
|
|
138
|
+
return tempstream/* HTML */ ` <input
|
|
139
|
+
type="number"
|
|
140
|
+
name="${`$${printArgPath(arg_path)}`}"
|
|
141
|
+
value="${(value || "").toString()}"
|
|
142
|
+
min="${arg.min || ""}"
|
|
143
|
+
max="${arg.max || ""}"
|
|
144
|
+
step="${arg.step || ""}"
|
|
145
|
+
/>`;
|
|
146
|
+
} else if (arg instanceof ComponentArguments.URL) {
|
|
147
|
+
return tempstream/* HTML */ ` <input
|
|
148
|
+
type="${isUrlAbsolute ? "url" : "text"}"
|
|
149
|
+
name="${`$${printArgPath(arg_path)}`}"
|
|
150
|
+
value="${(value || "").toString()}"
|
|
151
|
+
size="40"
|
|
152
|
+
${isUrlAbsolute ? `pattern="${absoluteUrlPattern}"` : ""}
|
|
153
|
+
/>`;
|
|
154
|
+
} else {
|
|
155
|
+
return tempstream/* HTML */ ` <input
|
|
156
|
+
type="${inputType}"
|
|
157
|
+
name="${`$${printArgPath(arg_path)}`}"
|
|
158
|
+
value="${is(value, predicates.string) ? value : ""}"
|
|
159
|
+
size="40"
|
|
160
|
+
${isUrlAbsolute ? `pattern="${absoluteUrlPattern}"` : ""}
|
|
161
|
+
/>`;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
135
165
|
return /* HTML */ `<div>
|
|
136
166
|
<label>
|
|
137
167
|
${arg_path.at(-1) || ""}
|
|
@@ -148,15 +178,7 @@ export async function ComponentInput<State extends JDDPageState, T>({
|
|
|
148
178
|
${is(value, predicates.string) ? value : ""}</textarea
|
|
149
179
|
>
|
|
150
180
|
</div>`
|
|
151
|
-
:
|
|
152
|
-
type="${inputType}"
|
|
153
|
-
name="${`$${printArgPath(arg_path)}`}"
|
|
154
|
-
value="${is(value, predicates.string) ? value : ""}"
|
|
155
|
-
size="40"
|
|
156
|
-
${isUrlAbsolute
|
|
157
|
-
? `pattern="${absoluteUrlPattern}"`
|
|
158
|
-
: ""}
|
|
159
|
-
/>`}
|
|
181
|
+
: await inputElement()}
|
|
160
182
|
</label>
|
|
161
183
|
</div>`;
|
|
162
184
|
}
|
package/src/jdd-page.ts
CHANGED
|
@@ -100,7 +100,7 @@ export default abstract class JDDPage extends StatefulPage<
|
|
|
100
100
|
title: "Components",
|
|
101
101
|
body: content,
|
|
102
102
|
description: "",
|
|
103
|
-
css_clumps: ["jdd-page", ...jdd.getAllCSSClumps(
|
|
103
|
+
css_clumps: ["jdd-page", ...jdd.getAllCSSClumps()],
|
|
104
104
|
htmlOptions: {
|
|
105
105
|
morphing: true,
|
|
106
106
|
preserveScroll: true,
|
package/src/test.test.ts
ADDED
package/test.cjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const mri = require("mri");
|
|
2
|
+
const { spawn } = require("child_process");
|
|
3
|
+
|
|
4
|
+
const argv = process.argv.slice(2);
|
|
5
|
+
const args = mri(argv);
|
|
6
|
+
|
|
7
|
+
const bin_dir = "./node_modules/.bin/";
|
|
8
|
+
|
|
9
|
+
const mocha = bin_dir + "mocha";
|
|
10
|
+
|
|
11
|
+
let mocha_options = [
|
|
12
|
+
"--recursive",
|
|
13
|
+
"--timeout=10000",
|
|
14
|
+
"--require",
|
|
15
|
+
"source-map-support/register",
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
if (args["test-report"]) {
|
|
19
|
+
mocha_options = [
|
|
20
|
+
...mocha_options,
|
|
21
|
+
// "--require",
|
|
22
|
+
// "ts-node/register",
|
|
23
|
+
// "--require",
|
|
24
|
+
// "./src/http/type-overrides.ts",
|
|
25
|
+
"--reporter",
|
|
26
|
+
"xunit",
|
|
27
|
+
"--reporter-option",
|
|
28
|
+
"output=.xunit",
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const mocha_files = ["lib/src/**/*.test.js"];
|
|
33
|
+
|
|
34
|
+
let command = [mocha, ...mocha_options, ...mocha_files];
|
|
35
|
+
|
|
36
|
+
if (args.debug) {
|
|
37
|
+
command = ["node", "inspect", ...command];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log("spawning mocha...", command.join(" "));
|
|
41
|
+
|
|
42
|
+
const proc = spawn(command[0], command.slice(1), {
|
|
43
|
+
stdio: "inherit",
|
|
44
|
+
env: process.env,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
proc.on("exit", function (code) {
|
|
48
|
+
if (args["test-report"]) {
|
|
49
|
+
process.exit(0);
|
|
50
|
+
} else {
|
|
51
|
+
process.exit(code);
|
|
52
|
+
}
|
|
53
|
+
});
|