@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.
- package/.arcconfig +12 -0
- package/.arclint +18 -0
- package/.eslintrc.js +37 -0
- package/.mocharc.js +6 -0
- package/.nycrc +6 -0
- package/.prettierrc +14 -0
- package/@types/component-preview-actions.d.ts +43 -0
- package/@types/components.sreact.d.ts +48 -0
- package/@types/controllers/autogrow-textarea.stimulus.d.ts +5 -0
- package/@types/controllers/component-debugger.stimulus.d.ts +28 -0
- package/@types/controllers/exportable-textarea.stimulus.d.ts +7 -0
- package/@types/controllers/input-image-preview.stimulus.d.ts +5 -0
- package/@types/controllers/jdd-table-paste.stimulus.d.ts +8 -0
- package/@types/controllers/json-editor.stimulus.d.ts +9 -0
- package/@types/controllers/markdown-textarea.stimulus.d.ts +20 -0
- package/@types/controllers/refresh-on-ts-changes.stimulus.d.ts +6 -0
- package/@types/controllers/refresh-styles.stimulus.d.ts +6 -0
- package/@types/controllers/submit-on-input.stimulus.d.ts +7 -0
- package/@types/controllers/toast.stimulus.d.ts +4 -0
- package/@types/edit-jdd-field.d.ts +22 -0
- package/@types/index.d.ts +2 -0
- package/@types/inputs/component-input-enum.d.ts +8 -0
- package/@types/inputs/component-input-image.d.ts +15 -0
- package/@types/inputs/component-input-list.d.ts +15 -0
- package/@types/inputs/component-input-single-reference.d.ts +11 -0
- package/@types/inputs/component-input-structured.d.ts +15 -0
- package/@types/inputs/component-input-table.d.ts +15 -0
- package/@types/inputs/component-input.d.ts +16 -0
- package/@types/inputs/print-arg-path.d.ts +1 -0
- package/@types/jdd-creator.d.ts +49 -0
- package/@types/jdd-page.d.ts +85 -0
- package/assets/icons/table-add-column-right.svg +1 -0
- package/assets/icons/table-add-row-below.svg +1 -0
- package/assets/icons/table-add-row-header-below.svg +1 -0
- package/assets/icons/table-delete-column.svg +1 -0
- package/assets/icons/table-delete-row.svg +1 -0
- package/assets/icons/table-move-column-right.svg +1 -0
- package/assets/icons/table-move-row-down.svg +1 -0
- package/assets/icons/table-move-row-up.svg +1 -0
- package/assets/styles/component-admin-table.jdd-page.css +11 -0
- package/assets/styles/component-debugger.jdd-page.css +71 -0
- package/assets/styles/components.jdd-page.css +286 -0
- package/assets/styles/grow-wrap.css +33 -0
- package/assets/styles/markdown-editor.css +42 -0
- package/dist/src/autogrow-textarea.stimulus.js +13 -0
- package/dist/src/autogrow-textarea.stimulus.js.map +7 -0
- package/dist/src/component-debugger.stimulus.js +190 -0
- package/dist/src/component-debugger.stimulus.js.map +7 -0
- package/dist/src/component-preview-actions.js +439 -0
- package/dist/src/component-preview-actions.js.map +7 -0
- package/dist/src/components.sreact.js +93 -0
- package/dist/src/components.sreact.js.map +7 -0
- package/dist/src/controllers/autogrow-textarea.stimulus.js +13 -0
- package/dist/src/controllers/autogrow-textarea.stimulus.js.map +7 -0
- package/dist/src/controllers/component-debugger.stimulus.js +193 -0
- package/dist/src/controllers/component-debugger.stimulus.js.map +7 -0
- package/dist/src/controllers/exportable-textarea.stimulus.js +71 -0
- package/dist/src/controllers/exportable-textarea.stimulus.js.map +7 -0
- package/dist/src/controllers/input-image-preview.stimulus.js +30 -0
- package/dist/src/controllers/input-image-preview.stimulus.js.map +7 -0
- package/dist/src/controllers/jdd-table-paste.stimulus.js +78 -0
- package/dist/src/controllers/jdd-table-paste.stimulus.js.map +7 -0
- package/dist/src/controllers/json-editor.stimulus.js +114 -0
- package/dist/src/controllers/json-editor.stimulus.js.map +7 -0
- package/dist/src/controllers/markdown-textarea.stimulus.js +174 -0
- package/dist/src/controllers/markdown-textarea.stimulus.js.map +7 -0
- package/dist/src/controllers/refresh-on-ts-changes.stimulus.js +90 -0
- package/dist/src/controllers/refresh-on-ts-changes.stimulus.js.map +7 -0
- package/dist/src/controllers/refresh-styles.stimulus.js +67 -0
- package/dist/src/controllers/refresh-styles.stimulus.js.map +7 -0
- package/dist/src/controllers/submit-on-input.stimulus.js +55 -0
- package/dist/src/controllers/submit-on-input.stimulus.js.map +7 -0
- package/dist/src/controllers/toast.stimulus.js +19 -0
- package/dist/src/controllers/toast.stimulus.js.map +7 -0
- package/dist/src/edit-jdd-field.js +94 -0
- package/dist/src/edit-jdd-field.js.map +7 -0
- package/dist/src/exportable-textarea.stimulus.js +71 -0
- package/dist/src/exportable-textarea.stimulus.js.map +7 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +7 -0
- package/dist/src/input-image-preview.stimulus.js +30 -0
- package/dist/src/input-image-preview.stimulus.js.map +7 -0
- package/dist/src/inputs/component-input-enum.js +30 -0
- package/dist/src/inputs/component-input-enum.js.map +7 -0
- package/dist/src/inputs/component-input-image.js +58 -0
- package/dist/src/inputs/component-input-image.js.map +7 -0
- package/dist/src/inputs/component-input-list.js +74 -0
- package/dist/src/inputs/component-input-list.js.map +7 -0
- package/dist/src/inputs/component-input-single-reference.js +31 -0
- package/dist/src/inputs/component-input-single-reference.js.map +7 -0
- package/dist/src/inputs/component-input-structured.js +36 -0
- package/dist/src/inputs/component-input-structured.js.map +7 -0
- package/dist/src/inputs/component-input-table.js +228 -0
- package/dist/src/inputs/component-input-table.js.map +7 -0
- package/dist/src/inputs/component-input.js +129 -0
- package/dist/src/inputs/component-input.js.map +7 -0
- package/dist/src/inputs/print-arg-path.js +7 -0
- package/dist/src/inputs/print-arg-path.js.map +7 -0
- package/dist/src/jdd-creator.js +131 -0
- package/dist/src/jdd-creator.js.map +7 -0
- package/dist/src/jdd-page.js +339 -0
- package/dist/src/jdd-page.js.map +7 -0
- package/dist/src/jdd-table-paste.stimulus.js +78 -0
- package/dist/src/jdd-table-paste.stimulus.js.map +7 -0
- package/dist/src/json-editor.stimulus.js +114 -0
- package/dist/src/json-editor.stimulus.js.map +7 -0
- package/dist/src/markdown-textarea.stimulus.js +174 -0
- package/dist/src/markdown-textarea.stimulus.js.map +7 -0
- package/dist/src/submit-on-input.stimulus.js +55 -0
- package/dist/src/submit-on-input.stimulus.js.map +7 -0
- package/dist/src/toast.stimulus.js +19 -0
- package/dist/src/toast.stimulus.js.map +7 -0
- package/esbuild.cjs +20 -0
- package/esbuild.js +23 -0
- package/jenkins.sanity.sh +3 -0
- package/lib/component-preview-actions.js +286 -0
- package/lib/component-preview-actions.js.map +1 -0
- package/lib/components.sreact.js +102 -0
- package/lib/components.sreact.js.map +1 -0
- package/lib/controllers/autogrow-textarea.stimulus.js +15 -0
- package/lib/controllers/autogrow-textarea.stimulus.js.map +1 -0
- package/lib/controllers/component-debugger.stimulus.js +188 -0
- package/lib/controllers/component-debugger.stimulus.js.map +1 -0
- package/lib/controllers/exportable-textarea.stimulus.js +79 -0
- package/lib/controllers/exportable-textarea.stimulus.js.map +1 -0
- package/lib/controllers/input-image-preview.stimulus.js +28 -0
- package/lib/controllers/input-image-preview.stimulus.js.map +1 -0
- package/lib/controllers/jdd-table-paste.stimulus.js +84 -0
- package/lib/controllers/jdd-table-paste.stimulus.js.map +1 -0
- package/lib/controllers/json-editor.stimulus.js +134 -0
- package/lib/controllers/json-editor.stimulus.js.map +1 -0
- package/lib/controllers/markdown-textarea.stimulus.js +186 -0
- package/lib/controllers/markdown-textarea.stimulus.js.map +1 -0
- package/lib/controllers/refresh-on-ts-changes.stimulus.js +123 -0
- package/lib/controllers/refresh-on-ts-changes.stimulus.js.map +1 -0
- package/lib/controllers/refresh-styles.stimulus.js +66 -0
- package/lib/controllers/refresh-styles.stimulus.js.map +1 -0
- package/lib/controllers/submit-on-input.stimulus.js +48 -0
- package/lib/controllers/submit-on-input.stimulus.js.map +1 -0
- package/lib/controllers/toast.stimulus.js +16 -0
- package/lib/controllers/toast.stimulus.js.map +1 -0
- package/lib/edit-jdd-field.js +102 -0
- package/lib/edit-jdd-field.js.map +1 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/inputs/component-input-enum.js +25 -0
- package/lib/inputs/component-input-enum.js.map +1 -0
- package/lib/inputs/component-input-image.js +47 -0
- package/lib/inputs/component-input-image.js.map +1 -0
- package/lib/inputs/component-input-list.js +61 -0
- package/lib/inputs/component-input-list.js.map +1 -0
- package/lib/inputs/component-input-single-reference.js +36 -0
- package/lib/inputs/component-input-single-reference.js.map +1 -0
- package/lib/inputs/component-input-structured.js +42 -0
- package/lib/inputs/component-input-structured.js.map +1 -0
- package/lib/inputs/component-input-table.js +184 -0
- package/lib/inputs/component-input-table.js.map +1 -0
- package/lib/inputs/component-input.js +133 -0
- package/lib/inputs/component-input.js.map +1 -0
- package/lib/inputs/print-arg-path.js +7 -0
- package/lib/inputs/print-arg-path.js.map +1 -0
- package/lib/jdd-creator.js +113 -0
- package/lib/jdd-creator.js.map +1 -0
- package/lib/jdd-page.js +310 -0
- package/lib/jdd-page.js.map +1 -0
- package/package.json +61 -0
- package/src/component-preview-actions.ts +520 -0
- package/src/components.sreact.ts +100 -0
- package/src/controllers/autogrow-textarea.stimulus.ts +13 -0
- package/src/controllers/component-debugger.stimulus.ts +247 -0
- package/src/controllers/exportable-textarea.stimulus.ts +77 -0
- package/src/controllers/input-image-preview.stimulus.ts +29 -0
- package/src/controllers/jdd-table-paste.stimulus.ts +89 -0
- package/src/controllers/json-editor.stimulus.ts +127 -0
- package/src/controllers/markdown-textarea.stimulus.ts +198 -0
- package/src/controllers/refresh-on-ts-changes.stimulus.ts +112 -0
- package/src/controllers/refresh-styles.stimulus.ts +70 -0
- package/src/controllers/submit-on-input.stimulus.ts +66 -0
- package/src/controllers/toast.stimulus.ts +15 -0
- package/src/edit-jdd-field.ts +127 -0
- package/src/index.ts +2 -0
- package/src/inputs/component-input-enum.ts +36 -0
- package/src/inputs/component-input-image.ts +70 -0
- package/src/inputs/component-input-list.ts +91 -0
- package/src/inputs/component-input-single-reference.ts +45 -0
- package/src/inputs/component-input-structured.ts +51 -0
- package/src/inputs/component-input-table.ts +262 -0
- package/src/inputs/component-input.ts +158 -0
- package/src/inputs/print-arg-path.ts +3 -0
- package/src/jdd-creator.ts +151 -0
- package/src/jdd-page.ts +439 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" aria-hidden="true" viewBox="0 0 14 14"><path d="M.525.002C.235.002 0 .171 0 .381v13.242c0 .21.235.379.525.379h4.791c.29 0 .524-.169.524-.379V.381c0-.21-.234-.379-.524-.379zm.684 1.059h3.42v3.214h-3.42zm0 4.283h3.42v3.215h-3.42zm0 4.283h3.42v3.217h-3.42z"/><path fill="green" d="M9.97 11.034q-.265 0-.466-.192l-.388-.388q-.197-.197-.197-.471 0-.28.197-.466l1.516-1.521H6.989q-.27 0-.437-.194-.168-.195-.168-.469v-.662q0-.275.168-.469t.437-.194h3.643L9.116 4.487q-.197-.187-.197-.466 0-.28.197-.466l.388-.388q.196-.197.465-.197.274 0 .471.197l3.368 3.369q.192.181.192.466 0 .28-.192.47l-3.368 3.37q-.202.192-.47.192" style="fill:#0086be;fill-opacity:1"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" aria-hidden="true" viewBox="0 0 14 14"><path d="M0 .525C0 .235.169 0 .379 0H13.62c.21 0 .379.235.379.525v4.791c0 .29-.169.524-.379.524H.38C.169 5.84 0 5.606 0 5.316Zm1.059.684v3.42h3.214v-3.42Zm4.283 0v3.42h3.215v-3.42Zm4.283 0v3.42h3.217v-3.42Z"/><path fill="green" d="M11.032 9.97q0-.265-.192-.466l-.388-.388q-.197-.197-.471-.197-.28 0-.466.197l-1.521 1.516V6.989q0-.27-.194-.437-.195-.168-.469-.168H6.67q-.275 0-.469.168t-.194.437v3.643L4.485 9.116q-.187-.197-.466-.197-.28 0-.466.197l-.388.388q-.197.196-.197.465 0 .274.197.471l3.369 3.368Q6.715 14 7 14q.28 0 .47-.192l3.37-3.368q.192-.202.192-.47" style="fill:#0086be;fill-opacity:1"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" aria-hidden="true" viewBox="0 0 14 14"><path d="M14 13.475c0 .29-.169.525-.379.525H.38C.169 14 0 13.765 0 13.475V8.684c0-.29.169-.524.379-.524H13.62c.21 0 .379.234.379.524zm-1.059-.684v-3.42H9.727v3.42zm-4.283 0v-3.42H5.443v3.42zm-4.283 0v-3.42H1.158v3.42z"/><path fill="green" d="M2.968 4.03q0 .265.192.466l.388.388q.197.197.471.197.28 0 .466-.197l1.521-1.516v3.643q0 .27.194.437.195.168.469.168h.662q.275 0 .469-.168t.194-.437V3.368l1.521 1.516q.187.197.466.197.28 0 .466-.197l.388-.388q.197-.196.197-.465 0-.274-.197-.471L7.466.192Q7.285 0 7 0q-.28 0-.47.192L3.16 3.56q-.192.202-.192.47" style="fill:#0086be;fill-opacity:1"/></svg>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.component-debugger {
|
|
2
|
+
.component-debugger__json {
|
|
3
|
+
margin-top: 16px;
|
|
4
|
+
display: block;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
font-size: 13px;
|
|
7
|
+
color: #a8a8a8;
|
|
8
|
+
|
|
9
|
+
summary {
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&[open] summary {
|
|
14
|
+
color: black;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.CodeMirror {
|
|
18
|
+
max-height: calc(100vh - 80px);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.cm-m-javascript.cm-string {
|
|
22
|
+
color: green;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.cm-m-javascript.cm-string.cm-property {
|
|
26
|
+
color: purple;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@media (scripting: enabled) {
|
|
30
|
+
& > textarea {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.jdd-component {
|
|
37
|
+
& {
|
|
38
|
+
transition: all 50ms;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&:after {
|
|
42
|
+
transition: all 200ms;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.highlighted {
|
|
46
|
+
outline: 2px solid blue;
|
|
47
|
+
&:after {
|
|
48
|
+
display: block;
|
|
49
|
+
height: 100%;
|
|
50
|
+
content: " ";
|
|
51
|
+
background-color: transparent;
|
|
52
|
+
top: 0;
|
|
53
|
+
position: absolute;
|
|
54
|
+
width: 100%;
|
|
55
|
+
z-index: 10;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
background-color: #00f6;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.jdd-editor__component-block__title {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-flow: column;
|
|
65
|
+
|
|
66
|
+
.jdd-editor__component-block__title__secondary {
|
|
67
|
+
font-style: italic;
|
|
68
|
+
font-size: 10px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
body.jdd-editor {
|
|
2
|
+
max-width: none;
|
|
3
|
+
|
|
4
|
+
.two-column {
|
|
5
|
+
display: grid;
|
|
6
|
+
grid-template-columns: 1fr 10px min-content;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.resize-gutter {
|
|
10
|
+
background-color: #d9d9d9;
|
|
11
|
+
cursor: ew-resize;
|
|
12
|
+
height: 100%;
|
|
13
|
+
transition: background-color 200ms;
|
|
14
|
+
|
|
15
|
+
&:hover {
|
|
16
|
+
background-color: gray;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.resizable {
|
|
21
|
+
overflow-x: auto;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
transition: transform 200ms, opacity 200ms;
|
|
25
|
+
&.restarting {
|
|
26
|
+
transform: scale(0.99);
|
|
27
|
+
opacity: 0.6;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#component-debugger {
|
|
31
|
+
height: 100vh;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.component-preview {
|
|
35
|
+
width: var(--resizable-column-width);
|
|
36
|
+
|
|
37
|
+
min-width: 0; /* default is min-content and that causes overflow*/
|
|
38
|
+
overflow-x: auto;
|
|
39
|
+
max-height: 100dvh;
|
|
40
|
+
scroll-behavior: smooth;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.component-arguments {
|
|
44
|
+
max-height: 100dvh;
|
|
45
|
+
overflow-y: auto;
|
|
46
|
+
scroll-behavior: smooth;
|
|
47
|
+
padding: 0px;
|
|
48
|
+
padding-top: 0;
|
|
49
|
+
& > *:first-child {
|
|
50
|
+
margin-top: 8px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
& > * {
|
|
54
|
+
margin-left: 8px;
|
|
55
|
+
margin-left: 8px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
background-color: #ededed;
|
|
59
|
+
position: relative;
|
|
60
|
+
|
|
61
|
+
box-shadow: inset -5px 0px 27px 0px #0000002b;
|
|
62
|
+
|
|
63
|
+
input {
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
& > .jdd-editor__component-block + .jdd-editor__component-block {
|
|
68
|
+
margin-top: 1rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.jdd-editor__toolbar {
|
|
72
|
+
position: sticky;
|
|
73
|
+
top: -1px;
|
|
74
|
+
left: 0;
|
|
75
|
+
padding: 8px 0;
|
|
76
|
+
-webkit-backdrop-filter: blur(13px);
|
|
77
|
+
backdrop-filter: blur(13px);
|
|
78
|
+
z-index: 3;
|
|
79
|
+
border-bottom: 1px solid #cacaca;
|
|
80
|
+
background-color: #ededed96;
|
|
81
|
+
box-shadow: 0px 10px 12px -16px black;
|
|
82
|
+
min-height: 40px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.jdd-editor__messages {
|
|
86
|
+
position: fixed;
|
|
87
|
+
top: 60px;
|
|
88
|
+
left: 0;
|
|
89
|
+
width: 100%;
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-flow: column;
|
|
92
|
+
align-items: center;
|
|
93
|
+
z-index: 5;
|
|
94
|
+
padding-left: 0;
|
|
95
|
+
|
|
96
|
+
.jdd-editor__message {
|
|
97
|
+
--color: green;
|
|
98
|
+
list-style: none;
|
|
99
|
+
border: 1px solid color-mix(in srgb, var(--color) 90%, black);
|
|
100
|
+
border-radius: 5px;
|
|
101
|
+
padding: 10px;
|
|
102
|
+
background-color: color-mix(in srgb, var(--color) 10%, white);
|
|
103
|
+
color: color-mix(in srgb, var(--color) 31%, black);
|
|
104
|
+
animation: notification-pop 400ms, fade-out 800ms;
|
|
105
|
+
animation-timing-function: cubic-bezier(0.68, -0.55, 0.27, 1.55), linear;
|
|
106
|
+
animation-delay: 0ms, 2000ms;
|
|
107
|
+
animation-fill-mode: forwards, both;
|
|
108
|
+
box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px,
|
|
109
|
+
rgba(0, 0, 0, 0.23) 0px 3px 6px;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.jdd-editor__component-block {
|
|
114
|
+
background-color: white;
|
|
115
|
+
border: 1px solid #5c5c5c;
|
|
116
|
+
border-radius: 4px;
|
|
117
|
+
|
|
118
|
+
.jdd-editor__component-block__inner {
|
|
119
|
+
display: none;
|
|
120
|
+
padding: 8px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&:has(.component-collapse-toggle:checked) {
|
|
124
|
+
.jdd-editor__component-block__inner {
|
|
125
|
+
display: block;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.jdd-editor__component-block__chevron {
|
|
129
|
+
transform: rotate(90deg);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.jdd-editor__component-block__top_bar {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
gap: 8px;
|
|
137
|
+
padding: 8px;
|
|
138
|
+
|
|
139
|
+
label {
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
/* https://stripesgenerator.com/ */
|
|
142
|
+
--stripe-color: #fafafa;
|
|
143
|
+
background-image: linear-gradient(
|
|
144
|
+
128deg,
|
|
145
|
+
#ffffff 25%,
|
|
146
|
+
var(--stripe-color) 25%,
|
|
147
|
+
var(--stripe-color) 50%,
|
|
148
|
+
#ffffff 50%,
|
|
149
|
+
#ffffff 75%,
|
|
150
|
+
var(--stripe-color) 75%,
|
|
151
|
+
var(--stripe-color) 100%
|
|
152
|
+
);
|
|
153
|
+
background-size: 30.46px 38.98px;
|
|
154
|
+
|
|
155
|
+
&:hover {
|
|
156
|
+
--stripe-color: #eee;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
button {
|
|
161
|
+
height: 24px;
|
|
162
|
+
width: 24px;
|
|
163
|
+
opacity: 50%;
|
|
164
|
+
|
|
165
|
+
&:has(img) {
|
|
166
|
+
padding: 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
img {
|
|
170
|
+
height: 20px;
|
|
171
|
+
width: 20px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&:hover {
|
|
175
|
+
opacity: 100%;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&:hover {
|
|
180
|
+
button {
|
|
181
|
+
opacity: 80%;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.jdd-editor__component-block__chevron {
|
|
187
|
+
font-size: 20px;
|
|
188
|
+
transition: transform 200ms;
|
|
189
|
+
user-select: none;
|
|
190
|
+
display: inline-block;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.component-preview-parameters {
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-flow: column;
|
|
199
|
+
gap: 16px;
|
|
200
|
+
|
|
201
|
+
label {
|
|
202
|
+
display: flex;
|
|
203
|
+
flex-flow: row wrap;
|
|
204
|
+
gap: 8px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
fieldset {
|
|
208
|
+
background-color: #80808024;
|
|
209
|
+
min-inline-size: 0;
|
|
210
|
+
width: calc(100% - 10px);
|
|
211
|
+
|
|
212
|
+
& > div {
|
|
213
|
+
overflow-x: auto;
|
|
214
|
+
overflow-y: hidden;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
table {
|
|
218
|
+
td,
|
|
219
|
+
th {
|
|
220
|
+
outline: 0.5px solid #0000006b;
|
|
221
|
+
|
|
222
|
+
&.subdued > * {
|
|
223
|
+
opacity: 50%;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&.subdued:hover > * {
|
|
227
|
+
opacity: 100%;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&.sticky {
|
|
231
|
+
position: sticky;
|
|
232
|
+
background-color: #ececec;
|
|
233
|
+
z-index: 2;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
&.sticky--left {
|
|
237
|
+
left: 0;
|
|
238
|
+
box-shadow: 5px 0px 10px -4px #00000047;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&.sticky--top {
|
|
242
|
+
top: 0;
|
|
243
|
+
box-shadow: 0px 5px 10px -4px #00000047;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
textarea {
|
|
250
|
+
display: block;
|
|
251
|
+
width: 100%;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.component-preview {
|
|
256
|
+
container-type: inline-size;
|
|
257
|
+
|
|
258
|
+
* {
|
|
259
|
+
transition: all 150ms, outline 0ms;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
fieldset {
|
|
263
|
+
min-width: 0px;
|
|
264
|
+
}
|
|
265
|
+
container-type: inline-size;
|
|
266
|
+
|
|
267
|
+
.component-preview__header {
|
|
268
|
+
display: flex;
|
|
269
|
+
justify-content: center;
|
|
270
|
+
padding: 8px;
|
|
271
|
+
margin-bottom: 8px;
|
|
272
|
+
color: gray;
|
|
273
|
+
border-bottom: 1px solid #cacaca;
|
|
274
|
+
background-color: #f4f4f4;
|
|
275
|
+
position: sticky;
|
|
276
|
+
top: 0;
|
|
277
|
+
z-index: 100;
|
|
278
|
+
gap: 8px;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
@media (scripting: none) {
|
|
283
|
+
body {
|
|
284
|
+
min-width: max-content;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* https://chriscoyier.net/2023/09/29/css-solves-auto-expanding-textareas-probably-eventually/ */
|
|
2
|
+
|
|
3
|
+
.grow-wrap {
|
|
4
|
+
/* easy way to plop the elements on top of each other and have them both sized based on the tallest one's height */
|
|
5
|
+
display: grid;
|
|
6
|
+
}
|
|
7
|
+
.grow-wrap::after {
|
|
8
|
+
/* Note the weird space! Needed to preventy jumpy behavior */
|
|
9
|
+
content: attr(data-replicated-value) " ";
|
|
10
|
+
|
|
11
|
+
/* This is how textarea text behaves */
|
|
12
|
+
white-space: pre-wrap;
|
|
13
|
+
|
|
14
|
+
/* Hidden from view, clicks, and screen readers */
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
}
|
|
17
|
+
.grow-wrap > textarea {
|
|
18
|
+
/* You could leave this, but after a user resizes, then it ruins the auto sizing */
|
|
19
|
+
resize: none;
|
|
20
|
+
|
|
21
|
+
/* Firefox shows scrollbar on growth, you can hide like this. */
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
}
|
|
24
|
+
.grow-wrap > textarea,
|
|
25
|
+
.grow-wrap::after {
|
|
26
|
+
/* Identical styling required!! */
|
|
27
|
+
border: 1px solid black;
|
|
28
|
+
padding: 0.5rem;
|
|
29
|
+
font: inherit;
|
|
30
|
+
|
|
31
|
+
/* Place on top of each other */
|
|
32
|
+
grid-area: 1 / 1 / 2 / 2;
|
|
33
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.editor-toolbar {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-flow: row wrap;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.grow-wrap {
|
|
7
|
+
display: block !important; /* the default grid display value makes it have some unwanted vertical space*/
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.CodeMirror,
|
|
12
|
+
.CodeMirror-scroll {
|
|
13
|
+
min-height: 100px !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@keyframes cm-fullscreen {
|
|
17
|
+
from {
|
|
18
|
+
transform: scale(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
to {
|
|
22
|
+
transform: (scale1);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.CodeMirror-fullscreen {
|
|
27
|
+
animation: cm-fullscreen 200ms;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes cm-toolbar-fullscreen {
|
|
31
|
+
from {
|
|
32
|
+
transform: translateY(-40px);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
to {
|
|
36
|
+
transform: translateY(0px);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.editor-toolbar.fullscreen {
|
|
41
|
+
animation: cm-toolbar-fullscreen 200ms;
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Controller } from "stimulus";
|
|
2
|
+
class AutogrowTextarea extends Controller {
|
|
3
|
+
connect() {
|
|
4
|
+
this.autogrow();
|
|
5
|
+
}
|
|
6
|
+
autogrow() {
|
|
7
|
+
this.element.parentNode.dataset.replicatedValue = this.element.value;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
AutogrowTextarea as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=autogrow-textarea.stimulus.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/autogrow-textarea.stimulus.ts"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-unsafe-assignment */\nimport { Controller } from \"stimulus\";\n\nexport default class AutogrowTextarea extends Controller<HTMLTextAreaElement> {\n\tconnect() {\n\t\tthis.autogrow();\n\t}\n\n\tautogrow() {\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n\t\t(this.element.parentNode as any).dataset.replicatedValue = this.element.value;\n\t}\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,kBAAkB;AAE3B,MAAO,yBAAuC,WAAgC;AAAA,EAC7E,UAAU;AACT,SAAK,SAAS;AAAA,EACf;AAAA,EAEA,WAAW;AAEV,IAAC,KAAK,QAAQ,WAAmB,QAAQ,kBAAkB,KAAK,QAAQ;AAAA,EACzE;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Controller } from "stimulus";
|
|
2
|
+
class ComponentDebugger extends Controller {
|
|
3
|
+
connect() {
|
|
4
|
+
var _a;
|
|
5
|
+
const main_form = (_a = document.querySelector("#component-debugger")) == null ? void 0 : _a.closest("form");
|
|
6
|
+
if (!main_form) {
|
|
7
|
+
throw new Error("No main form");
|
|
8
|
+
}
|
|
9
|
+
document.documentElement.addEventListener("ts-rebuilt", () => {
|
|
10
|
+
this.main_form.requestSubmit();
|
|
11
|
+
});
|
|
12
|
+
this.main_form.addEventListener("turbo:submit-end", () => {
|
|
13
|
+
this.main_form.querySelectorAll("input[type=file]").forEach((input) => input.value = "");
|
|
14
|
+
});
|
|
15
|
+
window.addEventListener("load", () => {
|
|
16
|
+
this.update_width_display();
|
|
17
|
+
});
|
|
18
|
+
document.addEventListener("turbo:render", () => {
|
|
19
|
+
});
|
|
20
|
+
const gutter = this.gutterTarget;
|
|
21
|
+
gutter.addEventListener("mousedown", (e) => {
|
|
22
|
+
this.origin_x = e.clientX;
|
|
23
|
+
const resizable = this.targets.find("preview");
|
|
24
|
+
this.origin_width = resizable.getBoundingClientRect().width;
|
|
25
|
+
const handler = (e2) => this.resizeHandler(e2);
|
|
26
|
+
document.addEventListener("mousemove", handler);
|
|
27
|
+
const remove_move_listener = () => {
|
|
28
|
+
document.removeEventListener("mousemove", handler);
|
|
29
|
+
document.removeEventListener("mouseup", remove_move_listener);
|
|
30
|
+
document.dispatchEvent(
|
|
31
|
+
new Event("component-debugger--resize-done")
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
document.addEventListener("mouseup", remove_move_listener);
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
update_width_display() {
|
|
39
|
+
const preview = this.targets.find("preview");
|
|
40
|
+
const component_width = preview.offsetWidth;
|
|
41
|
+
this.sizeSelectTarget.querySelectorAll("option").forEach((e) => e.removeAttribute("selected"));
|
|
42
|
+
let option = this.sizeSelectTarget.querySelector("option.dynamic");
|
|
43
|
+
if (!option) {
|
|
44
|
+
option = document.createElement("option");
|
|
45
|
+
option.classList.add("dynamic");
|
|
46
|
+
option.setAttribute("selected", "");
|
|
47
|
+
this.sizeSelectTarget.insertBefore(
|
|
48
|
+
option,
|
|
49
|
+
this.sizeSelectTarget.childNodes[0]
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
option.setAttribute("selected", "");
|
|
53
|
+
option.innerHTML = `${component_width} px`;
|
|
54
|
+
option.value = String(component_width);
|
|
55
|
+
}
|
|
56
|
+
resizeHandler(e) {
|
|
57
|
+
const width_offset = this.origin_x - e.clientX;
|
|
58
|
+
const new_width = Math.max(this.origin_width + width_offset, 1);
|
|
59
|
+
this.setPreviewWidth(new_width);
|
|
60
|
+
this.update_width_display();
|
|
61
|
+
document.dispatchEvent(new Event("component-debugger--resize"));
|
|
62
|
+
}
|
|
63
|
+
setPreviewWidth(width) {
|
|
64
|
+
var _a;
|
|
65
|
+
(_a = document.getElementById("component-debugger")) == null ? void 0 : _a.style.setProperty(
|
|
66
|
+
"--resizable-column-width",
|
|
67
|
+
width.toString() + "px"
|
|
68
|
+
);
|
|
69
|
+
this.update_width_display();
|
|
70
|
+
}
|
|
71
|
+
handleWidthDropdown() {
|
|
72
|
+
const value = this.sizeSelectTarget.value;
|
|
73
|
+
this.setPreviewWidth(parseInt(value));
|
|
74
|
+
}
|
|
75
|
+
handleBlockHover(e) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const index = parseInt(
|
|
78
|
+
((_a = e.target.closest(".jdd-editor__component-block")) == null ? void 0 : _a.getAttribute("data-component-index")) || "0"
|
|
79
|
+
);
|
|
80
|
+
(_b = this.element.querySelector(`.component-number-${index}`)) == null ? void 0 : _b.classList.add("highlighted");
|
|
81
|
+
}
|
|
82
|
+
handleBlockUnhover(e) {
|
|
83
|
+
var _a;
|
|
84
|
+
const index = parseInt(
|
|
85
|
+
((_a = e.target.closest(".jdd-editor__component-block")) == null ? void 0 : _a.getAttribute("data-component-index")) || ""
|
|
86
|
+
);
|
|
87
|
+
this.element.querySelectorAll(`.component-number-${index}.highlighted`).forEach((e2) => e2.classList.remove("highlighted"));
|
|
88
|
+
}
|
|
89
|
+
componentBlockTargetConnected(block_element) {
|
|
90
|
+
const index = parseInt(
|
|
91
|
+
block_element.getAttribute("data-component-index") || "0"
|
|
92
|
+
);
|
|
93
|
+
block_element.addEventListener("focusin", () => {
|
|
94
|
+
this.scrollToComponentPreview(index);
|
|
95
|
+
});
|
|
96
|
+
const summary = block_element.querySelector("summary");
|
|
97
|
+
if (summary) {
|
|
98
|
+
summary.addEventListener(
|
|
99
|
+
"mouseenter",
|
|
100
|
+
this.handleBlockHover.bind(this)
|
|
101
|
+
);
|
|
102
|
+
summary.addEventListener(
|
|
103
|
+
"mouseleave",
|
|
104
|
+
this.handleBlockUnhover.bind(this)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
previewTargetConnected(preview_element) {
|
|
109
|
+
preview_element.addEventListener("click", ({ target }) => {
|
|
110
|
+
var _a;
|
|
111
|
+
if (!(target instanceof HTMLElement)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const closest = target.closest(".jdd-component");
|
|
115
|
+
if (!closest) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const index = parseInt(
|
|
119
|
+
String(
|
|
120
|
+
(_a = Array.from(closest.classList).find((c) => c.startsWith("component-number-"))) == null ? void 0 : _a.replace("component-number-", "")
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
if (isNaN(index)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this.focusComponentBlock(index);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
focusComponentBlock(index) {
|
|
130
|
+
var _a;
|
|
131
|
+
const block = this.componentBlockTargets[index];
|
|
132
|
+
if (!block) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this.checkboxTargets[index].checked = true;
|
|
136
|
+
this.checkboxTargets[index].dispatchEvent(new Event("change"));
|
|
137
|
+
block.scrollIntoView({ behavior: "smooth" });
|
|
138
|
+
(_a = block.querySelector(
|
|
139
|
+
".component-preview-parameters input"
|
|
140
|
+
)) == null ? void 0 : _a.focus();
|
|
141
|
+
}
|
|
142
|
+
getIndex(block_element) {
|
|
143
|
+
const index = parseInt(
|
|
144
|
+
String(block_element.getAttribute("data-component-index"))
|
|
145
|
+
);
|
|
146
|
+
return index;
|
|
147
|
+
}
|
|
148
|
+
labelClicked(element) {
|
|
149
|
+
var _a, _b;
|
|
150
|
+
const block_element = element.target.closest(
|
|
151
|
+
`[data-component-debugger-target="componentBlock"]`
|
|
152
|
+
);
|
|
153
|
+
const index = this.getIndex(block_element);
|
|
154
|
+
if (!((_b = (_a = this.checkboxTargets) == null ? void 0 : _a[index]) == null ? void 0 : _b.checked)) {
|
|
155
|
+
this.scrollToComponentPreview(index);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
getPreviewElementForComponentIndex(index) {
|
|
159
|
+
const element = this.element.querySelector(
|
|
160
|
+
`.component-number-${index}`
|
|
161
|
+
);
|
|
162
|
+
return element;
|
|
163
|
+
}
|
|
164
|
+
scrollToComponentPreview(index) {
|
|
165
|
+
const element = this.getPreviewElementForComponentIndex(index);
|
|
166
|
+
if (!element) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const preview_element = this.element.querySelector(".component-preview");
|
|
170
|
+
if (!preview_element) {
|
|
171
|
+
throw new Error("Missing preview element!");
|
|
172
|
+
}
|
|
173
|
+
if (element.clientHeight > preview_element.clientHeight) {
|
|
174
|
+
preview_element.scrollTop = element.offsetTop - 44;
|
|
175
|
+
} else {
|
|
176
|
+
preview_element.scrollTop = element.offsetTop - (preview_element.clientHeight - element.clientHeight) / 2 - 44;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
ComponentDebugger.targets = [
|
|
181
|
+
"gutter",
|
|
182
|
+
"componentBlock",
|
|
183
|
+
"checkbox",
|
|
184
|
+
"preview",
|
|
185
|
+
"sizeSelect"
|
|
186
|
+
];
|
|
187
|
+
export {
|
|
188
|
+
ComponentDebugger as default
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=component-debugger.stimulus.js.map
|