@sealcode/jdd-editor 0.1.0

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 (192) hide show
  1. package/.arcconfig +12 -0
  2. package/.arclint +18 -0
  3. package/.eslintrc.js +37 -0
  4. package/.mocharc.js +6 -0
  5. package/.nycrc +6 -0
  6. package/.prettierrc +14 -0
  7. package/@types/component-preview-actions.d.ts +43 -0
  8. package/@types/components.sreact.d.ts +48 -0
  9. package/@types/controllers/autogrow-textarea.stimulus.d.ts +5 -0
  10. package/@types/controllers/component-debugger.stimulus.d.ts +28 -0
  11. package/@types/controllers/exportable-textarea.stimulus.d.ts +7 -0
  12. package/@types/controllers/input-image-preview.stimulus.d.ts +5 -0
  13. package/@types/controllers/jdd-table-paste.stimulus.d.ts +8 -0
  14. package/@types/controllers/json-editor.stimulus.d.ts +9 -0
  15. package/@types/controllers/markdown-textarea.stimulus.d.ts +20 -0
  16. package/@types/controllers/refresh-on-ts-changes.stimulus.d.ts +6 -0
  17. package/@types/controllers/refresh-styles.stimulus.d.ts +6 -0
  18. package/@types/controllers/submit-on-input.stimulus.d.ts +7 -0
  19. package/@types/controllers/toast.stimulus.d.ts +4 -0
  20. package/@types/edit-jdd-field.d.ts +22 -0
  21. package/@types/index.d.ts +2 -0
  22. package/@types/inputs/component-input-enum.d.ts +8 -0
  23. package/@types/inputs/component-input-image.d.ts +15 -0
  24. package/@types/inputs/component-input-list.d.ts +15 -0
  25. package/@types/inputs/component-input-single-reference.d.ts +11 -0
  26. package/@types/inputs/component-input-structured.d.ts +15 -0
  27. package/@types/inputs/component-input-table.d.ts +15 -0
  28. package/@types/inputs/component-input.d.ts +16 -0
  29. package/@types/inputs/print-arg-path.d.ts +1 -0
  30. package/@types/jdd-creator.d.ts +49 -0
  31. package/@types/jdd-page.d.ts +85 -0
  32. package/assets/icons/table-add-column-right.svg +1 -0
  33. package/assets/icons/table-add-row-below.svg +1 -0
  34. package/assets/icons/table-add-row-header-below.svg +1 -0
  35. package/assets/icons/table-delete-column.svg +1 -0
  36. package/assets/icons/table-delete-row.svg +1 -0
  37. package/assets/icons/table-move-column-right.svg +1 -0
  38. package/assets/icons/table-move-row-down.svg +1 -0
  39. package/assets/icons/table-move-row-up.svg +1 -0
  40. package/assets/styles/component-admin-table.jdd-page.css +11 -0
  41. package/assets/styles/component-debugger.jdd-page.css +71 -0
  42. package/assets/styles/components.jdd-page.css +286 -0
  43. package/assets/styles/grow-wrap.css +33 -0
  44. package/assets/styles/markdown-editor.css +42 -0
  45. package/dist/src/autogrow-textarea.stimulus.js +13 -0
  46. package/dist/src/autogrow-textarea.stimulus.js.map +7 -0
  47. package/dist/src/component-debugger.stimulus.js +190 -0
  48. package/dist/src/component-debugger.stimulus.js.map +7 -0
  49. package/dist/src/component-preview-actions.js +439 -0
  50. package/dist/src/component-preview-actions.js.map +7 -0
  51. package/dist/src/components.sreact.js +93 -0
  52. package/dist/src/components.sreact.js.map +7 -0
  53. package/dist/src/controllers/autogrow-textarea.stimulus.js +13 -0
  54. package/dist/src/controllers/autogrow-textarea.stimulus.js.map +7 -0
  55. package/dist/src/controllers/component-debugger.stimulus.js +193 -0
  56. package/dist/src/controllers/component-debugger.stimulus.js.map +7 -0
  57. package/dist/src/controllers/exportable-textarea.stimulus.js +71 -0
  58. package/dist/src/controllers/exportable-textarea.stimulus.js.map +7 -0
  59. package/dist/src/controllers/input-image-preview.stimulus.js +30 -0
  60. package/dist/src/controllers/input-image-preview.stimulus.js.map +7 -0
  61. package/dist/src/controllers/jdd-table-paste.stimulus.js +78 -0
  62. package/dist/src/controllers/jdd-table-paste.stimulus.js.map +7 -0
  63. package/dist/src/controllers/json-editor.stimulus.js +114 -0
  64. package/dist/src/controllers/json-editor.stimulus.js.map +7 -0
  65. package/dist/src/controllers/markdown-textarea.stimulus.js +174 -0
  66. package/dist/src/controllers/markdown-textarea.stimulus.js.map +7 -0
  67. package/dist/src/controllers/refresh-on-ts-changes.stimulus.js +90 -0
  68. package/dist/src/controllers/refresh-on-ts-changes.stimulus.js.map +7 -0
  69. package/dist/src/controllers/refresh-styles.stimulus.js +67 -0
  70. package/dist/src/controllers/refresh-styles.stimulus.js.map +7 -0
  71. package/dist/src/controllers/submit-on-input.stimulus.js +55 -0
  72. package/dist/src/controllers/submit-on-input.stimulus.js.map +7 -0
  73. package/dist/src/controllers/toast.stimulus.js +19 -0
  74. package/dist/src/controllers/toast.stimulus.js.map +7 -0
  75. package/dist/src/edit-jdd-field.js +94 -0
  76. package/dist/src/edit-jdd-field.js.map +7 -0
  77. package/dist/src/exportable-textarea.stimulus.js +71 -0
  78. package/dist/src/exportable-textarea.stimulus.js.map +7 -0
  79. package/dist/src/index.js +3 -0
  80. package/dist/src/index.js.map +7 -0
  81. package/dist/src/input-image-preview.stimulus.js +30 -0
  82. package/dist/src/input-image-preview.stimulus.js.map +7 -0
  83. package/dist/src/inputs/component-input-enum.js +30 -0
  84. package/dist/src/inputs/component-input-enum.js.map +7 -0
  85. package/dist/src/inputs/component-input-image.js +58 -0
  86. package/dist/src/inputs/component-input-image.js.map +7 -0
  87. package/dist/src/inputs/component-input-list.js +74 -0
  88. package/dist/src/inputs/component-input-list.js.map +7 -0
  89. package/dist/src/inputs/component-input-single-reference.js +31 -0
  90. package/dist/src/inputs/component-input-single-reference.js.map +7 -0
  91. package/dist/src/inputs/component-input-structured.js +36 -0
  92. package/dist/src/inputs/component-input-structured.js.map +7 -0
  93. package/dist/src/inputs/component-input-table.js +228 -0
  94. package/dist/src/inputs/component-input-table.js.map +7 -0
  95. package/dist/src/inputs/component-input.js +129 -0
  96. package/dist/src/inputs/component-input.js.map +7 -0
  97. package/dist/src/inputs/print-arg-path.js +7 -0
  98. package/dist/src/inputs/print-arg-path.js.map +7 -0
  99. package/dist/src/jdd-creator.js +131 -0
  100. package/dist/src/jdd-creator.js.map +7 -0
  101. package/dist/src/jdd-page.js +339 -0
  102. package/dist/src/jdd-page.js.map +7 -0
  103. package/dist/src/jdd-table-paste.stimulus.js +78 -0
  104. package/dist/src/jdd-table-paste.stimulus.js.map +7 -0
  105. package/dist/src/json-editor.stimulus.js +114 -0
  106. package/dist/src/json-editor.stimulus.js.map +7 -0
  107. package/dist/src/markdown-textarea.stimulus.js +174 -0
  108. package/dist/src/markdown-textarea.stimulus.js.map +7 -0
  109. package/dist/src/submit-on-input.stimulus.js +55 -0
  110. package/dist/src/submit-on-input.stimulus.js.map +7 -0
  111. package/dist/src/toast.stimulus.js +19 -0
  112. package/dist/src/toast.stimulus.js.map +7 -0
  113. package/esbuild.cjs +20 -0
  114. package/esbuild.js +23 -0
  115. package/jenkins.sanity.sh +3 -0
  116. package/lib/component-preview-actions.js +286 -0
  117. package/lib/component-preview-actions.js.map +1 -0
  118. package/lib/components.sreact.js +102 -0
  119. package/lib/components.sreact.js.map +1 -0
  120. package/lib/controllers/autogrow-textarea.stimulus.js +15 -0
  121. package/lib/controllers/autogrow-textarea.stimulus.js.map +1 -0
  122. package/lib/controllers/component-debugger.stimulus.js +188 -0
  123. package/lib/controllers/component-debugger.stimulus.js.map +1 -0
  124. package/lib/controllers/exportable-textarea.stimulus.js +79 -0
  125. package/lib/controllers/exportable-textarea.stimulus.js.map +1 -0
  126. package/lib/controllers/input-image-preview.stimulus.js +28 -0
  127. package/lib/controllers/input-image-preview.stimulus.js.map +1 -0
  128. package/lib/controllers/jdd-table-paste.stimulus.js +84 -0
  129. package/lib/controllers/jdd-table-paste.stimulus.js.map +1 -0
  130. package/lib/controllers/json-editor.stimulus.js +134 -0
  131. package/lib/controllers/json-editor.stimulus.js.map +1 -0
  132. package/lib/controllers/markdown-textarea.stimulus.js +186 -0
  133. package/lib/controllers/markdown-textarea.stimulus.js.map +1 -0
  134. package/lib/controllers/refresh-on-ts-changes.stimulus.js +123 -0
  135. package/lib/controllers/refresh-on-ts-changes.stimulus.js.map +1 -0
  136. package/lib/controllers/refresh-styles.stimulus.js +66 -0
  137. package/lib/controllers/refresh-styles.stimulus.js.map +1 -0
  138. package/lib/controllers/submit-on-input.stimulus.js +48 -0
  139. package/lib/controllers/submit-on-input.stimulus.js.map +1 -0
  140. package/lib/controllers/toast.stimulus.js +16 -0
  141. package/lib/controllers/toast.stimulus.js.map +1 -0
  142. package/lib/edit-jdd-field.js +102 -0
  143. package/lib/edit-jdd-field.js.map +1 -0
  144. package/lib/index.js +19 -0
  145. package/lib/index.js.map +1 -0
  146. package/lib/inputs/component-input-enum.js +25 -0
  147. package/lib/inputs/component-input-enum.js.map +1 -0
  148. package/lib/inputs/component-input-image.js +47 -0
  149. package/lib/inputs/component-input-image.js.map +1 -0
  150. package/lib/inputs/component-input-list.js +61 -0
  151. package/lib/inputs/component-input-list.js.map +1 -0
  152. package/lib/inputs/component-input-single-reference.js +36 -0
  153. package/lib/inputs/component-input-single-reference.js.map +1 -0
  154. package/lib/inputs/component-input-structured.js +42 -0
  155. package/lib/inputs/component-input-structured.js.map +1 -0
  156. package/lib/inputs/component-input-table.js +184 -0
  157. package/lib/inputs/component-input-table.js.map +1 -0
  158. package/lib/inputs/component-input.js +133 -0
  159. package/lib/inputs/component-input.js.map +1 -0
  160. package/lib/inputs/print-arg-path.js +7 -0
  161. package/lib/inputs/print-arg-path.js.map +1 -0
  162. package/lib/jdd-creator.js +113 -0
  163. package/lib/jdd-creator.js.map +1 -0
  164. package/lib/jdd-page.js +310 -0
  165. package/lib/jdd-page.js.map +1 -0
  166. package/package.json +61 -0
  167. package/src/component-preview-actions.ts +520 -0
  168. package/src/components.sreact.ts +100 -0
  169. package/src/controllers/autogrow-textarea.stimulus.ts +13 -0
  170. package/src/controllers/component-debugger.stimulus.ts +247 -0
  171. package/src/controllers/exportable-textarea.stimulus.ts +77 -0
  172. package/src/controllers/input-image-preview.stimulus.ts +29 -0
  173. package/src/controllers/jdd-table-paste.stimulus.ts +89 -0
  174. package/src/controllers/json-editor.stimulus.ts +127 -0
  175. package/src/controllers/markdown-textarea.stimulus.ts +198 -0
  176. package/src/controllers/refresh-on-ts-changes.stimulus.ts +112 -0
  177. package/src/controllers/refresh-styles.stimulus.ts +70 -0
  178. package/src/controllers/submit-on-input.stimulus.ts +66 -0
  179. package/src/controllers/toast.stimulus.ts +15 -0
  180. package/src/edit-jdd-field.ts +127 -0
  181. package/src/index.ts +2 -0
  182. package/src/inputs/component-input-enum.ts +36 -0
  183. package/src/inputs/component-input-image.ts +70 -0
  184. package/src/inputs/component-input-list.ts +91 -0
  185. package/src/inputs/component-input-single-reference.ts +45 -0
  186. package/src/inputs/component-input-structured.ts +51 -0
  187. package/src/inputs/component-input-table.ts +262 -0
  188. package/src/inputs/component-input.ts +158 -0
  189. package/src/inputs/print-arg-path.ts +3 -0
  190. package/src/jdd-creator.ts +151 -0
  191. package/src/jdd-page.ts +439 -0
  192. package/tsconfig.json +24 -0
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.actionName = void 0;
13
+ exports.ComponentInput = ComponentInput;
14
+ const print_arg_path_js_1 = require("./print-arg-path.js");
15
+ const jdd_1 = require("@sealcode/jdd");
16
+ const jdd_2 = require("@sealcode/jdd");
17
+ const component_input_structured_js_1 = require("./component-input-structured.js");
18
+ const component_input_list_js_1 = require("./component-input-list.js");
19
+ const component_input_enum_js_1 = require("./component-input-enum.js");
20
+ const component_input_image_js_1 = require("./component-input-image.js");
21
+ const component_input_table_js_1 = require("./component-input-table.js");
22
+ const component_input_single_reference_js_1 = require("./component-input-single-reference.js");
23
+ const ts_predicates_1 = require("@sealcode/ts-predicates");
24
+ exports.actionName = "Components";
25
+ const absoluteUrlPattern = "http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)";
26
+ function ComponentInput(_a) {
27
+ return __awaiter(this, arguments, void 0, function* ({ ctx, state, arg_path, arg, value, page, makeJDDContext, makeAssetURL, }) {
28
+ if (value === undefined) {
29
+ value = yield arg.getEmptyValue(makeJDDContext(ctx));
30
+ }
31
+ if (arg instanceof jdd_2.List) {
32
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
33
+ return (0, component_input_list_js_1.ComponentInputList)({
34
+ ctx,
35
+ state,
36
+ arg_path,
37
+ arg,
38
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
39
+ value: value,
40
+ page,
41
+ makeJDDContext,
42
+ makeAssetURL,
43
+ });
44
+ }
45
+ const argType = arg.getTypeName();
46
+ const isUrlAbsolute = arg instanceof jdd_2.ComponentArguments.URL && arg.urlType === "absolute";
47
+ const inputType = isUrlAbsolute ? "url" : "text";
48
+ if (arg instanceof jdd_2.Structured) {
49
+ return (0, component_input_structured_js_1.ComponentInputStructured)({
50
+ ctx,
51
+ state,
52
+ arg_path,
53
+ arg,
54
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
55
+ value: value,
56
+ page,
57
+ makeJDDContext,
58
+ makeAssetURL,
59
+ });
60
+ }
61
+ if (arg instanceof jdd_1.SingleReference) {
62
+ return (0, component_input_single_reference_js_1.ComponentInputSingleReference)({
63
+ ctx,
64
+ state,
65
+ arg_path,
66
+ arg,
67
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
68
+ value: value,
69
+ onchange: page.rerender(),
70
+ makeJDDContext,
71
+ });
72
+ }
73
+ if (arg instanceof jdd_2.Enum) {
74
+ return (0, component_input_enum_js_1.ComponentInputEnum)({
75
+ state,
76
+ arg_path,
77
+ arg,
78
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
79
+ value: value,
80
+ onchange: page.rerender(),
81
+ });
82
+ }
83
+ if (arg instanceof jdd_2.Image) {
84
+ return (0, component_input_image_js_1.ComponentInputImage)({
85
+ ctx,
86
+ state,
87
+ arg_path,
88
+ arg,
89
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
90
+ value: value,
91
+ page,
92
+ makeJDDContext,
93
+ });
94
+ }
95
+ if (arg instanceof jdd_2.Table) {
96
+ return (0, component_input_table_js_1.ComponentInputTable)({
97
+ ctx,
98
+ state,
99
+ arg_path,
100
+ arg,
101
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
102
+ value: value,
103
+ page,
104
+ makeJDDContext,
105
+ makeAssetURL,
106
+ });
107
+ }
108
+ return /* HTML */ `<div>
109
+ <label>
110
+ ${arg_path.at(-1) || ""}
111
+ ${argType == "markdown"
112
+ ? /* HTML */ `<div class="grow-wrap">
113
+ <textarea
114
+ name="${`$${(0, print_arg_path_js_1.printArgPath)(arg_path)}`}"
115
+ onblur="${page.rerender()}"
116
+ cols="40"
117
+ data-controller="markdown-textarea submit-on-input"
118
+ data-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"
119
+ autocomplete="off"
120
+ >
121
+ ${(0, ts_predicates_1.is)(value, ts_predicates_1.predicates.string) ? value : ""}
122
+ </textarea
123
+ >
124
+ </div>`
125
+ : /* HTML */ `<input type="${inputType}"
126
+ name="${`$${(0, print_arg_path_js_1.printArgPath)(arg_path)}`}"
127
+ value="${(0, ts_predicates_1.is)(value, ts_predicates_1.predicates.string) ? value : ""}" size="40"
128
+ ${isUrlAbsolute ? `pattern="${absoluteUrlPattern}"` : ""}" />`}
129
+ </label>
130
+ </div>`;
131
+ });
132
+ }
133
+ //# sourceMappingURL=component-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-input.js","sourceRoot":"","sources":["../../src/inputs/component-input.ts"],"names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,0BAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;;;aAGrC;YACT,CAAC,CAAC,UAAU,CAAC,gBAAgB,SAAS;cAC5B,IAAI,IAAA,gCAAY,EAAC,QAAQ,CAAC,EAAE;eAC3B,IAAA,kBAAE,EAAC,KAAK,EAAE,0BAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAChD,aAAa,CAAC,CAAC,CAAC,YAAY,kBAAkB,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM;;QAE5D,CAAC;IACT,CAAC;CAAA"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printArgPath = printArgPath;
4
+ function printArgPath(path) {
5
+ return path.map((e) => `[${e}]`).join("");
6
+ }
7
+ //# sourceMappingURL=print-arg-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-arg-path.js","sourceRoot":"","sources":["../../src/inputs/print-arg-path.ts"],"names":[],"mappings":";;AAAA,oCAEC;AAFD,SAAgB,YAAY,CAAC,IAAc;IAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const component_preview_actions_js_1 = require("./component-preview-actions.js");
7
+ const jdd_page_js_1 = __importDefault(require("./jdd-page.js"));
8
+ const escape_goat_1 = require("escape-goat");
9
+ const tempstream_1 = require("tempstream");
10
+ class JDDCreator extends jdd_page_js_1.default {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.actions = component_preview_actions_js_1.ComponentPreviewActions;
14
+ }
15
+ /**
16
+ * This method returns list of components allowed in JDD Editor instance.
17
+ * If list is empty it will allow all of the components in registry,
18
+ * if you overide this function you can decide on what components should
19
+ * available.
20
+ */
21
+ getAllowedComponents() {
22
+ return [];
23
+ }
24
+ getRegistryComponents() {
25
+ const all_components = super.getRegistryComponents();
26
+ const allowed_components = this.getAllowedComponents();
27
+ if (allowed_components.length > 0) {
28
+ return Object.fromEntries(Object.entries(all_components).filter(([name]) => allowed_components.includes(name)));
29
+ }
30
+ return all_components;
31
+ }
32
+ renderParameterButtons(state) {
33
+ {
34
+ /*The below button has to be here in order for it to be the default behavior */
35
+ }
36
+ return `<div class="jdd-editor__toolbar">
37
+ <input type="submit" value="Preview" />
38
+ <select name="component">
39
+ ${Object.keys(this.getRegistryComponents())
40
+ .map((cmp) => `<option value="${cmp}">${cmp}</option>`)
41
+ .join("")}
42
+ </select>
43
+ ${this.makeActionButton(state, {
44
+ action: "add_component",
45
+ label: "Add component",
46
+ })}
47
+ </div>`;
48
+ }
49
+ renderComponentBlock(ctx, state, component_data, component_index) {
50
+ const component = this.getRegistryComponents()[component_data.component_name];
51
+ const checkbox_id = `component_${component_index}_open`;
52
+ return (0, tempstream_1.tempstream /* HTML */) `<div
53
+ class="jdd-editor__component-block jdd-editor__component-block--number-${component_index}"
54
+ id="${`jdd-editor__component-block--${component_data.component_name}-${component_index}`}"
55
+ data-component-debugger-target="componentBlock"
56
+ data-component-index="${component_index.toString()}"
57
+ >
58
+ <summary class="jdd-editor__component-block__top_bar">
59
+ ${this.makeActionButton(state, { action: "remove_component", label: "❌" }, component_index)}
60
+ ${this.makeActionButton(state, {
61
+ action: "move_component_up",
62
+ label: "Move this row up",
63
+ content: /* HTML */ `<img
64
+ width="20"
65
+ height="20"
66
+ src="${this.makeAssetURL("icons/table-move-row-up.svg")}"
67
+ />`,
68
+ }, component_index)}
69
+ ${this.makeActionButton(state, {
70
+ action: "move_component_down",
71
+ label: "Move this row down",
72
+ content: /* HTML */ `<img
73
+ width="20"
74
+ height="20"
75
+ src="${this.makeAssetURL("icons/table-move-row-down.svg")}"
76
+ />`,
77
+ }, component_index)}
78
+ <span class="jdd-editor__component-block__title">
79
+ <div class="jdd-editor__component-block__title__main">
80
+ ${(0, escape_goat_1.htmlEscape)((component === null || component === void 0 ? void 0 : component.getTitle(this.makeJDDContext(ctx), component_data.args)) || "")}
81
+ </div>
82
+ <div class="jdd-editor__component-block__title__secondary">
83
+ ${component_data.component_name}
84
+ </div>
85
+ </span>
86
+ <label
87
+ class="component-block__handle"
88
+ for="${checkbox_id}"
89
+ style="flex-grow: 1"
90
+ data-action="click->component-debugger#labelClicked"
91
+ >
92
+ <span class="jdd-editor__component-block__chevron">
93
+ ${" "} &gt;${" "}
94
+ </span>
95
+ </label>
96
+ </summary>
97
+ <input
98
+ type="checkbox"
99
+ class="component-collapse-toggle"
100
+ name="${`$[components][${component_index}][open]`}"
101
+ data-turbo-permanent
102
+ id="${checkbox_id}"
103
+ style="display:none"
104
+ data-component-debugger-target="checkbox"
105
+ />
106
+ <div class="jdd-editor__component-block__inner">
107
+ ${super.renderComponentBlock(ctx, state, component_data, component_index)}
108
+ </div>
109
+ </div>`;
110
+ }
111
+ }
112
+ exports.default = JDDCreator;
113
+ //# sourceMappingURL=jdd-creator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jdd-creator.js","sourceRoot":"","sources":["../src/jdd-creator.ts"],"names":[],"mappings":";;;;;AACA,iFAAyE;AAEzE,gEAAoC;AACpC,6CAAyC;AACzC,2CAAwC;AAExC,MAA8B,UAAW,SAAQ,qBAAO;IAAxD;;QACC,YAAO,GAAG,sDAAuB,CAAC;IA8InC,CAAC;IA5IA;;;;;OAKG;IACH,oBAAoB;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IAED,qBAAqB;QACpB,MAAM,cAAc,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC;QACrD,MAAM,kBAAkB,GAAG,IAAI,CAAC,oBAAoB,EAAE,CA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AAkB;YACzB,OAAO,EAAE,UAAU,CAAC;;;cAGZ,IAAI,CAAC,YAAY,CACvB,6BAA6B,CAC7B;SACC;SACH,EACD,eAAe,CACf;MACC,IAAI,CAAC,gBAAgB,CACtB,KAAK,EACL;YACC,MAAM,EAAE,qBAAqB;YAC7B,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE,UAAU,CAAC;;;cAGZ,IAAI,CAAC,YAAY,CACvB,+BAA+B,CAC/B;SACC;SACH,EACD,eAAe,CACf;;;QAGG,IAAA,wBAAU,EACX,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,CAClB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EACxB,cAAc,CAAC,IAAI,CACnB,KAAI,EAAE,CACP;;;QAGC,cAAc,CAAC,cAAc;;;;;YAKzB,WAAW;;;;;QAKf,GAAG,QAAQ,GAAG;;;;;;;YAOV,iBAAiB,eAAe,SAAS;;UAE3C,WAAW;;;;;MAKf,KAAK,CAAC,oBAAoB,CAC3B,GAAG,EACH,KAAK,EACL,cAAc,EACd,eAAe,CACf;;SAEI,CAAC;IACT,CAAC;CACD;AA/ID,6BA+IC"}
@@ -0,0 +1,310 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.actionName = void 0;
13
+ const jdd_1 = require("@sealcode/jdd");
14
+ const jdd_2 = require("@sealcode/jdd");
15
+ const sealgen_1 = require("@sealcode/sealgen");
16
+ const ts_predicates_1 = require("@sealcode/ts-predicates");
17
+ const tempstream_1 = require("tempstream");
18
+ const component_input_js_1 = require("./inputs/component-input.js");
19
+ const component_preview_actions_js_1 = require("./component-preview-actions.js");
20
+ exports.actionName = "Components";
21
+ class JDDPage extends sealgen_1.StatefulPage {
22
+ constructor(args) {
23
+ super();
24
+ this.actions = component_preview_actions_js_1.ComponentPreviewActions;
25
+ this.previewSizes = ["320", "600", "800", "1024", "1300", "1920"];
26
+ this.classes = [];
27
+ this.registry = args.registry;
28
+ this.makeJDDContext = args.makeJDDContext;
29
+ this.defaultHead = args.defaultHead;
30
+ this.html = args.html;
31
+ this.makeAssetURL =
32
+ args.makeAssetURL ||
33
+ ((str) => `/dist/jdd-page/${str.startsWith("/") ? str.slice(1) : str}`);
34
+ }
35
+ getRegistryComponents() {
36
+ return this.registry.getAll();
37
+ }
38
+ getInitialState(ctx) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const all_components = Object.entries(this.getRegistryComponents());
41
+ const first_component = all_components[0];
42
+ if (!first_component) {
43
+ throw new Error("No defined components!");
44
+ }
45
+ const [component_name, component] = first_component;
46
+ const initial_state = {
47
+ components: [
48
+ {
49
+ component_name: component_name,
50
+ args: yield component.getExampleValues(this.makeJDDContext(ctx)),
51
+ },
52
+ ],
53
+ };
54
+ return initial_state;
55
+ });
56
+ }
57
+ wrapInLayout(ctx, content, state) {
58
+ const jdd = new jdd_2.JDD(this.registry, this.makeJDDContext(ctx), (0, jdd_1.documentContainerFromParsed)(state.components));
59
+ return this.html({
60
+ ctx,
61
+ title: "Components",
62
+ body: content,
63
+ description: "",
64
+ css_clumps: ["jdd-page", ...jdd.getAllCSSClumps()],
65
+ htmlOptions: {
66
+ morphing: true,
67
+ preserveScroll: true,
68
+ autoRefreshCSS: false,
69
+ navbar: () => ``,
70
+ bodyClasses: ["jdd-editor"],
71
+ showBottomNavbar: false,
72
+ showBanner: false,
73
+ showFooter: false,
74
+ loadHamburgerMenu: false,
75
+ loadSearchModal: false,
76
+ },
77
+ makeHead: (...args) => (0, tempstream_1.tempstream /* HTML */) `${this.defaultHead(...args)}
78
+ <link
79
+ href="/dist/jdd-page.entrypoint.css"
80
+ rel="stylesheet"
81
+ type="text/css"
82
+ />
83
+ ${jdd.renderEarlyAssets()}`,
84
+ });
85
+ }
86
+ preprocessOverrides(_ctx, state, overrides) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const jdd_context = this.makeJDDContext(_ctx);
89
+ if (!(0, ts_predicates_1.hasFieldOfType)("components", overrides, ts_predicates_1.predicates.array(ts_predicates_1.predicates.shape({
90
+ args: ts_predicates_1.predicates.object,
91
+ })))) {
92
+ return {};
93
+ }
94
+ for (const [component_index, { component_name }] of Object.entries(state.components)) {
95
+ const component = this.registry.get(component_name);
96
+ if (!component) {
97
+ throw new Error(`Unknown component: ${component_name}`);
98
+ }
99
+ const overrides_for_component = overrides.components[parseInt(component_index)] || { args: {} };
100
+ const promises = Object.entries(component.getArguments()).map((_a) => __awaiter(this, [_a], void 0, function* ([arg_name, arg]) {
101
+ const value = overrides_for_component.args[arg_name];
102
+ if (value) {
103
+ const new_value = yield arg.receivedToParsed(jdd_context, value);
104
+ overrides_for_component.args[arg_name] = new_value;
105
+ }
106
+ }));
107
+ // eslint-disable-next-line no-await-in-loop
108
+ yield Promise.all(promises);
109
+ }
110
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
111
+ return overrides;
112
+ });
113
+ }
114
+ renderComponentArgs(ctx, state, component, args, index) {
115
+ const jdd_context = this.makeJDDContext(ctx);
116
+ return (0, tempstream_1.tempstream /* HTML */) `<div
117
+ class="component-preview-parameters"
118
+ id="${`component-preview-parameters--${index}`}"
119
+ >
120
+ ${Object.entries(component.getArguments()).map((_a) => __awaiter(this, [_a], void 0, function* ([arg_name, arg]) {
121
+ return (0, component_input_js_1.ComponentInput)({
122
+ state,
123
+ arg_path: [
124
+ "components",
125
+ index.toString(),
126
+ "args",
127
+ arg_name,
128
+ ],
129
+ ctx,
130
+ arg,
131
+ value: args[arg_name] === undefined
132
+ ? arg.getExampleValue(jdd_context)
133
+ : args[arg_name],
134
+ page: this,
135
+ makeJDDContext: this.makeJDDContext,
136
+ makeAssetURL: this.makeAssetURL,
137
+ });
138
+ }))}
139
+ </div>`;
140
+ }
141
+ renderComponentBlock(ctx, state, { component_name, args: component_args, }, component_index) {
142
+ const component = this.registry.get(component_name);
143
+ if (!component) {
144
+ return null;
145
+ }
146
+ return this.renderComponentArgs(ctx, state, component, component_args, component_index);
147
+ }
148
+ serializeState(ctx_1, state_1) {
149
+ return __awaiter(this, arguments, void 0, function* (ctx, state, pretty = false) {
150
+ console.time("serializing state");
151
+ const serialized_components = yield Promise.all(state.components.map((_a) => __awaiter(this, [_a], void 0, function* ({ component_name, args }) {
152
+ const component = this.registry.get(component_name);
153
+ const single_result = {
154
+ component_name,
155
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
156
+ args: component
157
+ ? yield component.convertParsedToStorage(this.makeJDDContext(ctx), args)
158
+ : {},
159
+ };
160
+ return single_result;
161
+ })));
162
+ const serialized_state = JSON.stringify({ components: serialized_components }, null, pretty ? 4 : "");
163
+ console.timeEnd("serializing state");
164
+ return serialized_state;
165
+ });
166
+ }
167
+ deserializeState(ctx, state_string) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ const jdd_context = this.makeJDDContext(ctx);
170
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
171
+ const raw = JSON.parse(state_string);
172
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
173
+ const components_storage = raw.components;
174
+ if (!Array.isArray(components_storage)) {
175
+ throw new Error("'components' key is not an array, got ${components_storage}");
176
+ }
177
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
178
+ const components_parsed = yield Promise.all(components_storage.map((entry) => __awaiter(this, void 0, void 0, function* () {
179
+ if (!(0, ts_predicates_1.hasShape)({
180
+ component_name: ts_predicates_1.predicates.string,
181
+ args: ts_predicates_1.predicates.object,
182
+ }, entry)) {
183
+ throw new Error(`Expected components[] items to be objects with 'component_name' and 'args' keys, got ${entry}`);
184
+ }
185
+ const { component_name, args } = entry;
186
+ const component = this.registry.get(component_name);
187
+ if (!component) {
188
+ throw new Error("Unknown component: ${component_name}");
189
+ }
190
+ return {
191
+ component_name,
192
+ args: yield component.convertStorageToParsed(jdd_context, args),
193
+ };
194
+ })));
195
+ const result = { components: components_parsed };
196
+ return result;
197
+ });
198
+ }
199
+ renderPreParameterButtons(
200
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
201
+ _ctx,
202
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
203
+ _state) {
204
+ return "";
205
+ }
206
+ renderMessages(_ctx, state) {
207
+ return /* HTML */ `<ul
208
+ class="jdd-editor__messages"
209
+ data-controller="toast"
210
+ >
211
+ ${(state.messages || []).map((e) => `<li class="jdd-editor__message">${e}</li>`)}
212
+ </ul>`;
213
+ }
214
+ render(ctx, state) {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ return (0, tempstream_1.tempstream /* HTML */) `<div
217
+ class="${["two-column", "component-debugger", ...this.classes].join(" ")}"
218
+ id="component-debugger"
219
+ style="${`--resizable-column-width: ${state.preview_size ? state.preview_size + "px" : "50vw"}`}"
220
+ data-controller="component-debugger"
221
+ >
222
+ <div class="component-arguments" id="component-arguments">
223
+ ${this.renderPreParameterButtons(ctx, state)}
224
+ ${this.renderParameterButtons(state)}
225
+ ${this.renderMessages(ctx, state)}
226
+ ${state.components.map((component, component_index) => this.renderComponentBlock(ctx, state, component, component_index))}
227
+ <details
228
+ class="component-debugger__json"
229
+ data-controller="exportable-textarea"
230
+ id="exportable-textarea"
231
+ open
232
+ >
233
+ <summary>Edit/Export raw JSON</summary>
234
+ <textarea
235
+ name="state_override"
236
+ rows="40"
237
+ cols="40"
238
+ data-controller="json-editor"
239
+ id="component-debugger-json-textarea"
240
+ autocomplete="off"
241
+ >
242
+ ${(yield this.serializeState(ctx, state, true)).replaceAll("<", "&lt;")}
243
+ </textarea
244
+ >
245
+ ${this.makeActionButton(state, {
246
+ action: "replace_state",
247
+ label: "Apply",
248
+ })}
249
+ <button data-action="exportable-textarea#copy">Copy</button>
250
+ <button data-action="exportable-textarea#download">
251
+ Download
252
+ </button>
253
+ <input type="file" />${" "}
254
+ <button data-action="exportable-textarea#import">
255
+ Import
256
+ </button>
257
+ </details>
258
+ </div>
259
+ <div
260
+ id="resize-gutter"
261
+ class="resize-gutter"
262
+ data-component-debugger-target="gutter"
263
+ ></div>
264
+ <div
265
+ id="component-preview"
266
+ class="component-preview"
267
+ data-component-debugger-target="preview"
268
+ >
269
+ <div
270
+ id="component-preview__header"
271
+ class="component-preview__header"
272
+ >
273
+ <span>Preview</span>
274
+ <select
275
+ name="$[preview_size]"
276
+ autocomplete="off"
277
+ class="component-preview-size-select"
278
+ data-component-debugger-target="sizeSelect"
279
+ data-action="change->component-debugger#handleWidthDropdown"
280
+ data-turbo-data-turbo-permanent
281
+ >
282
+ ${state.preview_size
283
+ ? /* HTML */ `<option
284
+ class="dynamic"
285
+ value="${state.preview_size}"
286
+ selected
287
+ >
288
+ ${state.preview_size} px
289
+ </option>`
290
+ : ""}
291
+ ${this.previewSizes.map((size) => /* HTML */ `<option value="${size}">
292
+ ${`${size} px`}
293
+ </option>`)}
294
+ </select>
295
+ <noscript>
296
+ ${this.makeActionButton(state, "change_size")}
297
+ </noscript>
298
+ </div>
299
+ <div class="jdd-outer-container">
300
+ <div class="jdd-container">
301
+ ${jdd_2.JDD.render(this.registry, (0, jdd_1.documentContainerFromParsed)(state.components), this.makeJDDContext(ctx))}
302
+ </div>
303
+ </div>
304
+ </div>
305
+ </div>`;
306
+ });
307
+ }
308
+ }
309
+ exports.default = JDDPage;
310
+ //# sourceMappingURL=jdd-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jdd-page.js","sourceRoot":"","sources":["../src/jdd-page.ts"],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AgB,CAAC,KAAK,EAAE,aAAa,CAAC;;;;;QAK3C,SAAG,CAAC,MAAM,CACX,IAAI,CAAC,QAAQ,EACb,IAAA,iCAA2B,EAAC,KAAK,CAAC,UAAU,CAAC,EAC7C,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CACxB;;;;SAIE,CAAC;QACT,CAAC;KAAA;CACD;AAjaD,0BAiaC"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@sealcode/jdd-editor",
3
+ "version": "0.1.0",
4
+ "main": "dist/src/index.js",
5
+ "scripts": {
6
+ "build": "node ./esbuild.cjs",
7
+ "watch": "npm run build -- --watch",
8
+ "prepare": "rm -rf @types && npm run typecheck && npm run build-declarations && npm run build",
9
+ "test": "mocha",
10
+ "build-declarations": "tsc --emitDeclarationOnly",
11
+ "typecheck": "tsc --noemit",
12
+ "clean-coverage": "rm -rf coverage .nyc_output .xunit",
13
+ "coverage": "npm run clean-coverage && nyc mocha",
14
+ "test-reports": "npm run clean-coverage && nyc --reporter clover mocha --reporter xunit --reporter-option output=.xunit",
15
+ "coverage-html": "npm run test-reports && nyc report --reporter lcov && xdg-open coverage/lcov-report/index.html"
16
+ },
17
+ "type": "module",
18
+ "author": "",
19
+ "license": "ISC",
20
+ "devDependencies": {
21
+ "@istanbuljs/nyc-config-typescript": "^1.0.2",
22
+ "@types/koa__router": "^12.0.4",
23
+ "@types/mocha": "^10.0.1",
24
+ "@types/simplemde": "^1.11.11",
25
+ "@types/yargs": "^17.0.33",
26
+ "@typescript-eslint/eslint-plugin": "^5.58.0",
27
+ "@typescript-eslint/parser": "^5.58.0",
28
+ "esbuild": "^0.14.10",
29
+ "eslint": "^8.38.0",
30
+ "eslint-config-prettier": "^8.8.0",
31
+ "eslint-plugin-prettier": "^4.2.1",
32
+ "eslint-plugin-with-tsc-error": "^0.0.8",
33
+ "fs": "^0.0.1-security",
34
+ "mocha": "^10.2.0",
35
+ "mri": "^1.2.0",
36
+ "nyc": "^15.1.0",
37
+ "path": "^0.12.7",
38
+ "prettier": "^2.8.7",
39
+ "source-map-support": "^0.5.21",
40
+ "tiny-glob": "^0.2.9",
41
+ "ts-node": "^10.9.1",
42
+ "typescript": "^5.6",
43
+ "yargs": "^17.7.2"
44
+ },
45
+ "types": "./@types/index.d.ts",
46
+ "dependencies": {
47
+ "@koa/router": "^13.1.0",
48
+ "@sealcode/jdd": "^0.6.5",
49
+ "@sealcode/sealcodemirror": "^5.70.0-beta5",
50
+ "@sealcode/sealgen": "^0.16.3",
51
+ "@types/object-path": "^0.11.4",
52
+ "@types/throttle-debounce": "^5.0.2",
53
+ "@types/turndown": "^5.0.5",
54
+ "object-path": "^0.11.8",
55
+ "sealious": "^0.19.36",
56
+ "stimulus": "^3.2.2",
57
+ "tempstream": "^0.4.5",
58
+ "throttle-debounce": "^5.0.2",
59
+ "turndown": "^7.2.0"
60
+ }
61
+ }