@sealcode/jdd-editor 0.1.19 → 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.
Files changed (96) hide show
  1. package/.nyc_output/cfebf13d-f940-426b-a4d3-af28d17bb6b8.json +1 -0
  2. package/.nyc_output/processinfo/2ad4e34c-cebb-4299-9698-08eccbbe71f7.json +1 -0
  3. package/.nyc_output/processinfo/71f2685b-e2c9-4db2-9f31-0dbdcacfcea1.json +1 -0
  4. package/.nyc_output/processinfo/cfebf13d-f940-426b-a4d3-af28d17bb6b8.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/.xunit +1 -1
  7. package/@types/test.test.d.ts +0 -0
  8. package/coverage/clover.xml +279 -259
  9. package/dist/src/components.sreact.js +1 -1
  10. package/dist/src/components.sreact.js.map +2 -2
  11. package/dist/src/controllers/autogrow-textarea.stimulus.js.map +2 -2
  12. package/dist/src/controllers/markdown-textarea.stimulus.js +1 -1
  13. package/dist/src/controllers/markdown-textarea.stimulus.js.map +2 -2
  14. package/dist/src/controllers/refresh-styles.stimulus.js +1 -1
  15. package/dist/src/controllers/refresh-styles.stimulus.js.map +2 -2
  16. package/dist/src/inputs/component-input-single-reference.js +1 -1
  17. package/dist/src/inputs/component-input-single-reference.js.map +2 -2
  18. package/dist/src/inputs/component-input-structured.js +1 -1
  19. package/dist/src/inputs/component-input-structured.js.map +2 -2
  20. package/dist/src/inputs/component-input.js +30 -7
  21. package/dist/src/inputs/component-input.js.map +2 -2
  22. package/dist/src/jdd-page.js +1 -1
  23. package/dist/src/jdd-page.js.map +2 -2
  24. package/{lib → dist}/src/test.test.js +1 -1
  25. package/dist/src/test.test.js.map +7 -0
  26. package/package.json +7 -6
  27. package/src/components.sreact.ts +1 -1
  28. package/src/controllers/autogrow-textarea.stimulus.ts +2 -1
  29. package/src/controllers/markdown-textarea.stimulus.ts +1 -1
  30. package/src/controllers/refresh-styles.stimulus.ts +3 -1
  31. package/src/inputs/component-input-single-reference.ts +1 -1
  32. package/src/inputs/component-input-structured.ts +1 -1
  33. package/src/inputs/component-input.ts +31 -9
  34. package/src/jdd-page.ts +1 -1
  35. package/src/test.test.ts +3 -0
  36. package/test.cjs +53 -0
  37. package/.mocharc.js +0 -6
  38. package/.nyc_output/9bfa248d-4f8e-4d29-9c47-d1a3961c5254.json +0 -1
  39. package/.nyc_output/processinfo/29e7bb87-9f10-462e-84d8-ec620cfa9e6b.json +0 -1
  40. package/.nyc_output/processinfo/7d7104e8-f179-427b-b4bd-30f78397e4f1.json +0 -1
  41. package/.nyc_output/processinfo/9bfa248d-4f8e-4d29-9c47-d1a3961c5254.json +0 -1
  42. package/esbuild.js +0 -23
  43. package/lib/src/component-preview-actions.js +0 -377
  44. package/lib/src/component-preview-actions.js.map +0 -7
  45. package/lib/src/components.sreact.js +0 -93
  46. package/lib/src/components.sreact.js.map +0 -7
  47. package/lib/src/controllers/autogrow-textarea.stimulus.js +0 -13
  48. package/lib/src/controllers/autogrow-textarea.stimulus.js.map +0 -7
  49. package/lib/src/controllers/component-debugger.stimulus.js +0 -193
  50. package/lib/src/controllers/component-debugger.stimulus.js.map +0 -7
  51. package/lib/src/controllers/exportable-textarea.stimulus.js +0 -71
  52. package/lib/src/controllers/exportable-textarea.stimulus.js.map +0 -7
  53. package/lib/src/controllers/input-image-preview.stimulus.js +0 -30
  54. package/lib/src/controllers/input-image-preview.stimulus.js.map +0 -7
  55. package/lib/src/controllers/jdd-table-paste.stimulus.js +0 -78
  56. package/lib/src/controllers/jdd-table-paste.stimulus.js.map +0 -7
  57. package/lib/src/controllers/json-editor.stimulus.js +0 -114
  58. package/lib/src/controllers/json-editor.stimulus.js.map +0 -7
  59. package/lib/src/controllers/markdown-textarea.stimulus.js +0 -174
  60. package/lib/src/controllers/markdown-textarea.stimulus.js.map +0 -7
  61. package/lib/src/controllers/refresh-on-ts-changes.stimulus.js +0 -90
  62. package/lib/src/controllers/refresh-on-ts-changes.stimulus.js.map +0 -7
  63. package/lib/src/controllers/refresh-styles.stimulus.js +0 -67
  64. package/lib/src/controllers/refresh-styles.stimulus.js.map +0 -7
  65. package/lib/src/controllers/submit-on-input.stimulus.js +0 -55
  66. package/lib/src/controllers/submit-on-input.stimulus.js.map +0 -7
  67. package/lib/src/controllers/toast.stimulus.js +0 -19
  68. package/lib/src/controllers/toast.stimulus.js.map +0 -7
  69. package/lib/src/edit-jdd-field.js +0 -94
  70. package/lib/src/edit-jdd-field.js.map +0 -7
  71. package/lib/src/index.js +0 -3
  72. package/lib/src/index.js.map +0 -7
  73. package/lib/src/inputs/component-input-enum.js +0 -30
  74. package/lib/src/inputs/component-input-enum.js.map +0 -7
  75. package/lib/src/inputs/component-input-image.js +0 -63
  76. package/lib/src/inputs/component-input-image.js.map +0 -7
  77. package/lib/src/inputs/component-input-list.js +0 -74
  78. package/lib/src/inputs/component-input-list.js.map +0 -7
  79. package/lib/src/inputs/component-input-single-reference.js +0 -31
  80. package/lib/src/inputs/component-input-single-reference.js.map +0 -7
  81. package/lib/src/inputs/component-input-structured.js +0 -36
  82. package/lib/src/inputs/component-input-structured.js.map +0 -7
  83. package/lib/src/inputs/component-input-table.js +0 -228
  84. package/lib/src/inputs/component-input-table.js.map +0 -7
  85. package/lib/src/inputs/component-input.js +0 -164
  86. package/lib/src/inputs/component-input.js.map +0 -7
  87. package/lib/src/inputs/print-arg-path.js +0 -7
  88. package/lib/src/inputs/print-arg-path.js.map +0 -7
  89. package/lib/src/jdd-creator.js +0 -131
  90. package/lib/src/jdd-creator.js.map +0 -7
  91. package/lib/src/jdd-page.js +0 -339
  92. package/lib/src/jdd-page.js.map +0 -7
  93. package/lib/src/test.test.js.map +0 -7
  94. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
  95. /package/.nyc_output/{29e7bb87-9f10-462e-84d8-ec620cfa9e6b.json → 2ad4e34c-cebb-4299-9698-08eccbbe71f7.json} +0 -0
  96. /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
- : /* HTML */ `<input
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(jdd_context)],
103
+ css_clumps: ["jdd-page", ...jdd.getAllCSSClumps()],
104
104
  htmlOptions: {
105
105
  morphing: true,
106
106
  preserveScroll: true,
@@ -0,0 +1,3 @@
1
+ describe("tests", () => {
2
+ it.skip("does not yet have a test", () => {});
3
+ });
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
+ });
package/.mocharc.js DELETED
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- require: ["ts-node/register", "source-map-support/register"],
3
- recursive: true,
4
- timeout: "10000",
5
- spec: ["src/*.test.ts", "src/**/*.test.ts"],
6
- };