@wp-operations/wp-ops 0.3.0 → 0.4.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/README.md +6 -3
- package/package.json +6 -2
- package/src/commands/platform.js +58 -2
- package/src/commands/start.js +2 -2
- package/src/main.js +19 -8
- package/wp-operations/CHANGELOG.md +14 -0
- package/wp-operations/README.md +39 -0
- package/wp-operations/agents/builder/AGENT.md +15 -0
- package/wp-operations/assets/admin.css +631 -0
- package/wp-operations/assets/admin.js +614 -0
- package/wp-operations/assets/app/app.css +1 -0
- package/wp-operations/assets/app/app.js +70 -0
- package/wp-operations/assets/app/fonts/inter-medium.woff +0 -0
- package/wp-operations/assets/app/fonts/inter-regular.woff +0 -0
- package/wp-operations/assets/app/fonts/inter-semibold.woff +0 -0
- package/wp-operations/assets/app/login.css +42 -0
- package/wp-operations/assets/brand/icon.svg +20 -0
- package/wp-operations/assets/brand/mark.svg +19 -0
- package/wp-operations/assets/editors/audiobook.css +311 -0
- package/wp-operations/assets/editors/audiofile.css +286 -0
- package/wp-operations/assets/editors/course.css +701 -0
- package/wp-operations/assets/editors/course.js +698 -0
- package/wp-operations/assets/editors/faq.css +258 -0
- package/wp-operations/assets/editors/faq.js +196 -0
- package/wp-operations/assets/editors/interactive.css +220 -0
- package/wp-operations/assets/editors/interactive.js +378 -0
- package/wp-operations/assets/editors/media-sources.css +3 -0
- package/wp-operations/assets/editors/media-sources.js +40 -0
- package/wp-operations/assets/editors/open-media.css +114 -0
- package/wp-operations/assets/editors/open-media.js +182 -0
- package/wp-operations/assets/editors/thumbnails.css +335 -0
- package/wp-operations/assets/editors/thumbnails.js +447 -0
- package/wp-operations/assets/editors/translator.css +818 -0
- package/wp-operations/functions.php +24 -0
- package/wp-operations/index.php +14 -0
- package/wp-operations/platform.json +1836 -0
- package/wp-operations/skills/ai-development-guardrails/SKILL.md +49 -0
- package/wp-operations/skills/gutenberg-reference/SKILL.md +45 -0
- package/wp-operations/skills/js-tooling-for-themes/SKILL.md +51 -0
- package/wp-operations/skills/tailwind-for-wp/SKILL.md +62 -0
- package/wp-operations/skills/wp-clean-classic-themes/SKILL.md +112 -0
- package/wp-operations/skills/wp-psr4-plugins/SKILL.md +2043 -0
- package/wp-operations/skills/wp-security/SKILL.md +90 -0
- package/wp-operations/src/Admin.php +78 -0
- package/wp-operations/src/App/Access.php +57 -0
- package/wp-operations/src/App/Admin.php +442 -0
- package/wp-operations/src/App/App.php +157 -0
- package/wp-operations/src/App/Apps.php +379 -0
- package/wp-operations/src/App/Bundle.php +111 -0
- package/wp-operations/src/App/Contents.php +676 -0
- package/wp-operations/src/App/Engine.php +554 -0
- package/wp-operations/src/App/Github.php +308 -0
- package/wp-operations/src/App/Module.php +23 -0
- package/wp-operations/src/App/Ops.php +470 -0
- package/wp-operations/src/App/Packages.php +289 -0
- package/wp-operations/src/App/Rest.php +539 -0
- package/wp-operations/src/App/Sandboxes.php +206 -0
- package/wp-operations/src/App/Store.php +104 -0
- package/wp-operations/src/App/Usage.php +268 -0
- package/wp-operations/src/Config.php +249 -0
- package/wp-operations/src/Content/Editor.php +223 -0
- package/wp-operations/src/Content/Fields.php +681 -0
- package/wp-operations/src/Content/Scoring.php +253 -0
- package/wp-operations/src/Content/Structure.php +293 -0
- package/wp-operations/src/Content/Types.php +150 -0
- package/wp-operations/src/Content/Uploads.php +50 -0
- package/wp-operations/src/Editors/AudiobookAuthor.php +61 -0
- package/wp-operations/src/Editors/AudiobookChapters.php +632 -0
- package/wp-operations/src/Editors/AudiobookCover.php +235 -0
- package/wp-operations/src/Editors/Audiofile.php +462 -0
- package/wp-operations/src/Editors/Course.php +784 -0
- package/wp-operations/src/Editors/Ebook.php +242 -0
- package/wp-operations/src/Editors/Editors.php +44 -0
- package/wp-operations/src/Editors/Faq.php +237 -0
- package/wp-operations/src/Editors/Files.php +139 -0
- package/wp-operations/src/Editors/Interactive/Builder.php +103 -0
- package/wp-operations/src/Editors/Interactive/Card.php +76 -0
- package/wp-operations/src/Editors/Interactive/Editor.php +42 -0
- package/wp-operations/src/Editors/Interactive/Field.php +272 -0
- package/wp-operations/src/Editors/Interactive/Map.php +84 -0
- package/wp-operations/src/Editors/Interactive/Models.php +227 -0
- package/wp-operations/src/Editors/Interactive/Report.php +59 -0
- package/wp-operations/src/Editors/Interactive/Save.php +323 -0
- package/wp-operations/src/Editors/Interactive/Scoring.php +244 -0
- package/wp-operations/src/Editors/Interactive/Structure.php +195 -0
- package/wp-operations/src/Editors/Legal.php +235 -0
- package/wp-operations/src/Editors/OpenMedia.php +140 -0
- package/wp-operations/src/Editors/OriginalTitle.php +112 -0
- package/wp-operations/src/Editors/Sources.php +28 -0
- package/wp-operations/src/Editors/Thumbnails/Admin.php +306 -0
- package/wp-operations/src/Editors/Thumbnails/Ajax.php +163 -0
- package/wp-operations/src/Editors/Thumbnails/Box.php +188 -0
- package/wp-operations/src/Editors/Thumbnails/Storage.php +228 -0
- package/wp-operations/src/Editors/Translator/Admin.php +913 -0
- package/wp-operations/src/Editors/Translator/Api.php +63 -0
- package/wp-operations/src/Editors/Translator/Bar.php +83 -0
- package/wp-operations/src/Editors/Translator/Fields.php +273 -0
- package/wp-operations/src/Editors/Translator/Storage.php +131 -0
- package/wp-operations/src/Editors/Translator/Thumbnail.php +215 -0
- package/wp-operations/src/Identity.php +104 -0
- package/wp-operations/src/Languages.php +45 -0
- package/wp-operations/src/Lockdown.php +85 -0
- package/wp-operations/src/Modules/Apps/Admin.php +472 -0
- package/wp-operations/src/Modules/Apps/Api.php +193 -0
- package/wp-operations/src/Modules/Apps/Apps.php +279 -0
- package/wp-operations/src/Modules/Apps/Formatters.php +478 -0
- package/wp-operations/src/Modules/Apps/Schemes.php +248 -0
- package/wp-operations/src/Modules/Apps/Table.php +101 -0
- package/wp-operations/src/Modules/Thumbnails.php +68 -0
- package/wp-operations/src/Modules/Translations.php +133 -0
- package/wp-operations/src/Platform.php +59 -0
- package/wp-operations/src/Setup.php +273 -0
- package/wp-operations/src/Status.php +99 -0
- package/wp-operations/src/Storage/Client.php +168 -0
- package/wp-operations/src/Storage/Offload.php +120 -0
- package/wp-operations/src/Storage/Settings.php +166 -0
- package/wp-operations/src/Storage/Storage.php +35 -0
- package/wp-operations/src/Updates.php +151 -0
- package/wp-operations/style.css +11 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
#faqt_panel .postbox-header { display: none; }
|
|
2
|
+
#faqt_panel .inside { padding: 0; margin: 0; }
|
|
3
|
+
|
|
4
|
+
.faq-panel {
|
|
5
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
6
|
+
font-size: 13px;
|
|
7
|
+
color: #1d2327;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.faq-tabs {
|
|
11
|
+
display: flex;
|
|
12
|
+
background: #f6f7f7;
|
|
13
|
+
border-bottom: 1px solid #dcdcde;
|
|
14
|
+
padding: 0 20px;
|
|
15
|
+
gap: 2px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.faq-tab {
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
padding: 11px 16px 12px;
|
|
23
|
+
background: transparent;
|
|
24
|
+
border: 1px solid transparent;
|
|
25
|
+
border-bottom: none;
|
|
26
|
+
border-radius: 3px 3px 0 0;
|
|
27
|
+
font-size: 13px;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
color: #50575e;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
position: relative;
|
|
32
|
+
bottom: -1px;
|
|
33
|
+
transition: color 0.15s ease;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.faq-tab:hover {
|
|
37
|
+
color: #1d2327;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.faq-tab.is-active {
|
|
41
|
+
background: #fff;
|
|
42
|
+
border-color: #dcdcde;
|
|
43
|
+
color: #1d2327;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.faq-tab-count {
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
min-width: 19px;
|
|
52
|
+
height: 17px;
|
|
53
|
+
padding: 0 5px;
|
|
54
|
+
background: #50575e;
|
|
55
|
+
color: #fff;
|
|
56
|
+
border-radius: 8px;
|
|
57
|
+
font-size: 10px;
|
|
58
|
+
font-weight: 700;
|
|
59
|
+
line-height: 1;
|
|
60
|
+
transition: background 0.15s ease;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.faq-tab.is-active .faq-tab-count {
|
|
64
|
+
background: #2271b1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.faq-pane {
|
|
68
|
+
display: none;
|
|
69
|
+
padding: 20px;
|
|
70
|
+
background: #fff;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.faq-pane.is-active {
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.faq-accordion {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
gap: 6px;
|
|
81
|
+
margin-bottom: 4px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.faq-item {
|
|
85
|
+
border: 1px solid #dcdcde;
|
|
86
|
+
border-radius: 4px;
|
|
87
|
+
background: #fff;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.faq-item.is-open {
|
|
93
|
+
border-color: #2271b1;
|
|
94
|
+
box-shadow: 0 0 0 1px #2271b1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.faq-item-head {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
background: #f6f7f7;
|
|
101
|
+
border-bottom: 1px solid transparent;
|
|
102
|
+
transition: background 0.15s ease;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.faq-item.is-open .faq-item-head {
|
|
106
|
+
background: #f0f6fc;
|
|
107
|
+
border-bottom-color: #c5d9ea;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.faq-item-toggle {
|
|
111
|
+
flex: 1;
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
gap: 10px;
|
|
115
|
+
padding: 10px 14px;
|
|
116
|
+
background: none;
|
|
117
|
+
border: none;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
text-align: left;
|
|
120
|
+
min-width: 0;
|
|
121
|
+
color: inherit;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.faq-item-num {
|
|
125
|
+
flex-shrink: 0;
|
|
126
|
+
display: inline-flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
width: 21px;
|
|
130
|
+
height: 21px;
|
|
131
|
+
background: #dcdcde;
|
|
132
|
+
color: #50575e;
|
|
133
|
+
border-radius: 50%;
|
|
134
|
+
font-size: 11px;
|
|
135
|
+
font-weight: 700;
|
|
136
|
+
transition: background 0.15s ease, color 0.15s ease;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.faq-item.is-open .faq-item-num {
|
|
140
|
+
background: #2271b1;
|
|
141
|
+
color: #fff;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.faq-item-preview {
|
|
145
|
+
flex: 1;
|
|
146
|
+
font-size: 13px;
|
|
147
|
+
font-weight: 500;
|
|
148
|
+
color: #1d2327;
|
|
149
|
+
white-space: nowrap;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
text-overflow: ellipsis;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.faq-item-preview.is-placeholder {
|
|
155
|
+
color: #a7aaad;
|
|
156
|
+
font-weight: 400;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.faq-item-chevron {
|
|
160
|
+
flex-shrink: 0;
|
|
161
|
+
color: #787c82;
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
transition: transform 0.2s ease;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.faq-item.is-open .faq-item-chevron {
|
|
168
|
+
transform: rotate(180deg);
|
|
169
|
+
color: #2271b1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.faq-item-remove {
|
|
173
|
+
flex-shrink: 0;
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
width: 36px;
|
|
178
|
+
height: 36px;
|
|
179
|
+
padding: 0;
|
|
180
|
+
background: none;
|
|
181
|
+
border: none;
|
|
182
|
+
border-left: 1px solid #dcdcde;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
color: #a7aaad;
|
|
185
|
+
transition: color 0.15s ease, background 0.15s ease;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.faq-item-remove:hover {
|
|
189
|
+
color: #b32d2e;
|
|
190
|
+
background: #fcf0f1;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.faq-item-body {
|
|
194
|
+
display: none;
|
|
195
|
+
padding: 16px 16px 20px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.faq-item.is-open .faq-item-body {
|
|
199
|
+
display: block;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.faq-field {
|
|
203
|
+
margin-bottom: 14px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.faq-field:last-child {
|
|
207
|
+
margin-bottom: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.faq-field-label {
|
|
211
|
+
display: block;
|
|
212
|
+
margin-bottom: 5px;
|
|
213
|
+
font-size: 11px;
|
|
214
|
+
font-weight: 600;
|
|
215
|
+
text-transform: uppercase;
|
|
216
|
+
letter-spacing: 0.4px;
|
|
217
|
+
color: #646970;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.faq-title-input {
|
|
221
|
+
border-radius: 3px !important;
|
|
222
|
+
border-color: #dcdcde !important;
|
|
223
|
+
font-size: 13px !important;
|
|
224
|
+
padding: 7px 10px !important;
|
|
225
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.faq-title-input:focus {
|
|
229
|
+
border-color: #2271b1 !important;
|
|
230
|
+
box-shadow: 0 0 0 1px #2271b1 !important;
|
|
231
|
+
outline: none !important;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.faq-add-row {
|
|
235
|
+
padding: 12px 0 2px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.faq-btn-add {
|
|
239
|
+
display: inline-flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
gap: 6px;
|
|
242
|
+
padding: 7px 14px;
|
|
243
|
+
background: #fff;
|
|
244
|
+
border: 1px dashed #a7aaad;
|
|
245
|
+
border-radius: 3px;
|
|
246
|
+
font-size: 12px;
|
|
247
|
+
font-weight: 500;
|
|
248
|
+
color: #50575e;
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.faq-btn-add:hover {
|
|
254
|
+
border-color: #2271b1;
|
|
255
|
+
border-style: solid;
|
|
256
|
+
color: #2271b1;
|
|
257
|
+
background: #f0f6fc;
|
|
258
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
( function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
function initTabs() {
|
|
5
|
+
var tabs = document.querySelectorAll( '.faq-tab' );
|
|
6
|
+
|
|
7
|
+
tabs.forEach( function ( tab ) {
|
|
8
|
+
tab.addEventListener( 'click', function () {
|
|
9
|
+
var key = this.getAttribute( 'data-tab' );
|
|
10
|
+
|
|
11
|
+
document.querySelectorAll( '.faq-tab' ).forEach( function ( t ) {
|
|
12
|
+
t.classList.remove( 'is-active' );
|
|
13
|
+
t.setAttribute( 'aria-selected', 'false' );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
document.querySelectorAll( '.faq-pane' ).forEach( function ( p ) {
|
|
17
|
+
p.classList.remove( 'is-active' );
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
this.classList.add( 'is-active' );
|
|
21
|
+
this.setAttribute( 'aria-selected', 'true' );
|
|
22
|
+
|
|
23
|
+
var pane = document.getElementById( 'faq-pane-' + key );
|
|
24
|
+
if ( pane ) {
|
|
25
|
+
pane.classList.add( 'is-active' );
|
|
26
|
+
}
|
|
27
|
+
} );
|
|
28
|
+
} );
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function initAccordion() {
|
|
32
|
+
document.addEventListener( 'click', function ( e ) {
|
|
33
|
+
var toggle = e.target.closest( '.faq-item-toggle' );
|
|
34
|
+
if ( ! toggle ) return;
|
|
35
|
+
|
|
36
|
+
var item = toggle.closest( '.faq-item' );
|
|
37
|
+
var isOpen = item.classList.contains( 'is-open' );
|
|
38
|
+
|
|
39
|
+
item.classList.toggle( 'is-open', ! isOpen );
|
|
40
|
+
toggle.setAttribute( 'aria-expanded', ! isOpen ? 'true' : 'false' );
|
|
41
|
+
} );
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function initPreview() {
|
|
45
|
+
document.addEventListener( 'input', function ( e ) {
|
|
46
|
+
if ( ! e.target.classList.contains( 'faq-title-input' ) ) return;
|
|
47
|
+
|
|
48
|
+
var item = e.target.closest( '.faq-item' );
|
|
49
|
+
var preview = item && item.querySelector( '.faq-item-preview' );
|
|
50
|
+
if ( ! preview ) return;
|
|
51
|
+
|
|
52
|
+
var val = e.target.value.trim();
|
|
53
|
+
|
|
54
|
+
preview.textContent = val || 'Untitled item';
|
|
55
|
+
preview.classList.toggle( 'is-placeholder', ! val );
|
|
56
|
+
} );
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function initRemove() {
|
|
60
|
+
document.addEventListener( 'click', function ( e ) {
|
|
61
|
+
var btn = e.target.closest( '.faq-item-remove' );
|
|
62
|
+
if ( ! btn ) return;
|
|
63
|
+
|
|
64
|
+
var item = btn.closest( '.faq-item' );
|
|
65
|
+
var accordion = btn.closest( '.faq-accordion' );
|
|
66
|
+
if ( ! item || ! accordion ) return;
|
|
67
|
+
|
|
68
|
+
removeEditors( item );
|
|
69
|
+
item.parentNode.removeChild( item );
|
|
70
|
+
reindex( accordion );
|
|
71
|
+
updateCount( accordion );
|
|
72
|
+
} );
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function removeEditors( container ) {
|
|
76
|
+
if ( typeof tinymce === 'undefined' ) return;
|
|
77
|
+
|
|
78
|
+
var areas = container.querySelectorAll( '.wp-editor-area' );
|
|
79
|
+
areas.forEach( function ( area ) {
|
|
80
|
+
var editor = tinymce.get( area.id );
|
|
81
|
+
if ( editor ) {
|
|
82
|
+
editor.remove();
|
|
83
|
+
}
|
|
84
|
+
} );
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function initAdd() {
|
|
88
|
+
document.addEventListener( 'click', function ( e ) {
|
|
89
|
+
var btn = e.target.closest( '.faq-btn-add' );
|
|
90
|
+
if ( ! btn ) return;
|
|
91
|
+
|
|
92
|
+
var accordion = document.getElementById( btn.getAttribute( 'data-accordion' ) );
|
|
93
|
+
if ( ! accordion ) return;
|
|
94
|
+
|
|
95
|
+
var key = btn.getAttribute( 'data-key' );
|
|
96
|
+
var index = accordion.querySelectorAll( '.faq-item' ).length;
|
|
97
|
+
var html = buildItemHTML( key, index );
|
|
98
|
+
var wrap = document.createElement( 'div' );
|
|
99
|
+
|
|
100
|
+
wrap.innerHTML = html;
|
|
101
|
+
|
|
102
|
+
var newItem = wrap.firstChild;
|
|
103
|
+
accordion.appendChild( newItem );
|
|
104
|
+
newItem.classList.add( 'is-open' );
|
|
105
|
+
|
|
106
|
+
updateCount( accordion );
|
|
107
|
+
} );
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function buildItemHTML( key, index ) {
|
|
111
|
+
var nameTitle = key + '[' + index + '][title]';
|
|
112
|
+
var nameBody = key + '[' + index + '][content]';
|
|
113
|
+
|
|
114
|
+
return '<div class="faq-item" data-index="' + index + '">'
|
|
115
|
+
+ '<div class="faq-item-head">'
|
|
116
|
+
+ '<button type="button" class="faq-item-toggle" aria-expanded="false">'
|
|
117
|
+
+ '<span class="faq-item-num">' + ( index + 1 ) + '</span>'
|
|
118
|
+
+ '<span class="faq-item-preview is-placeholder">Untitled item</span>'
|
|
119
|
+
+ '<span class="faq-item-chevron">'
|
|
120
|
+
+ '<svg width="11" height="11" viewBox="0 0 11 11" fill="none" aria-hidden="true">'
|
|
121
|
+
+ '<path d="M1.5 3.5l4 4 4-4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
122
|
+
+ '</svg>'
|
|
123
|
+
+ '</span>'
|
|
124
|
+
+ '</button>'
|
|
125
|
+
+ '<button type="button" class="faq-item-remove" title="Remove" aria-label="Remove item">'
|
|
126
|
+
+ '<svg width="11" height="11" viewBox="0 0 11 11" fill="none" aria-hidden="true">'
|
|
127
|
+
+ '<path d="M1 1l9 9M10 1L1 10" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/>'
|
|
128
|
+
+ '</svg>'
|
|
129
|
+
+ '</button>'
|
|
130
|
+
+ '</div>'
|
|
131
|
+
+ '<div class="faq-item-body">'
|
|
132
|
+
+ '<div class="faq-field">'
|
|
133
|
+
+ '<label class="faq-field-label">Title</label>'
|
|
134
|
+
+ '<input type="text" name="' + nameTitle + '" value="" class="faq-title-input widefat" placeholder="FAQ question or heading">'
|
|
135
|
+
+ '</div>'
|
|
136
|
+
+ '<div class="faq-field">'
|
|
137
|
+
+ '<label class="faq-field-label">Content</label>'
|
|
138
|
+
+ '<textarea name="' + nameBody + '" class="widefat" rows="6" placeholder="FAQ answer or content..." style="border-radius:3px;padding:7px 10px;font-size:13px;"></textarea>'
|
|
139
|
+
+ '</div>'
|
|
140
|
+
+ '</div>'
|
|
141
|
+
+ '</div>';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function reindex( accordion ) {
|
|
145
|
+
var key = accordion.getAttribute( 'data-key' );
|
|
146
|
+
var items = accordion.querySelectorAll( '.faq-item' );
|
|
147
|
+
|
|
148
|
+
items.forEach( function ( item, i ) {
|
|
149
|
+
item.setAttribute( 'data-index', i );
|
|
150
|
+
|
|
151
|
+
var num = item.querySelector( '.faq-item-num' );
|
|
152
|
+
if ( num ) num.textContent = i + 1;
|
|
153
|
+
|
|
154
|
+
item.querySelectorAll( 'input[name], textarea[name]' ).forEach( function ( el ) {
|
|
155
|
+
el.name = el.name.replace(
|
|
156
|
+
new RegExp( '^' + key + '\\[\\d+\\]' ),
|
|
157
|
+
key + '[' + i + ']'
|
|
158
|
+
);
|
|
159
|
+
} );
|
|
160
|
+
} );
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function updateCount( accordion ) {
|
|
164
|
+
var key = accordion.getAttribute( 'data-key' );
|
|
165
|
+
var counter = document.getElementById( 'faq-count-' + key );
|
|
166
|
+
if ( counter ) {
|
|
167
|
+
counter.textContent = accordion.querySelectorAll( '.faq-item' ).length;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function updateAllCounts() {
|
|
172
|
+
document.querySelectorAll( '.faq-accordion' ).forEach( updateCount );
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function initEditorSync() {
|
|
176
|
+
var form = document.getElementById( 'post' );
|
|
177
|
+
if ( ! form ) return;
|
|
178
|
+
|
|
179
|
+
form.addEventListener( 'submit', function () {
|
|
180
|
+
if ( typeof tinymce !== 'undefined' ) {
|
|
181
|
+
tinymce.triggerSave();
|
|
182
|
+
}
|
|
183
|
+
} );
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
document.addEventListener( 'DOMContentLoaded', function () {
|
|
187
|
+
initTabs();
|
|
188
|
+
initAccordion();
|
|
189
|
+
initPreview();
|
|
190
|
+
initRemove();
|
|
191
|
+
initAdd();
|
|
192
|
+
initEditorSync();
|
|
193
|
+
updateAllCounts();
|
|
194
|
+
} );
|
|
195
|
+
|
|
196
|
+
} )();
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
.interactive-panel {
|
|
2
|
+
--line: #dcdcde;
|
|
3
|
+
--muted: #646970;
|
|
4
|
+
--tint: #f6f7f7;
|
|
5
|
+
font-size: 13px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.interactive-panel .field {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 3px;
|
|
12
|
+
margin: 0 0 10px;
|
|
13
|
+
flex: 1 1 auto;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.interactive-panel .field > label {
|
|
18
|
+
color: var(--muted);
|
|
19
|
+
font-size: 11px;
|
|
20
|
+
text-transform: uppercase;
|
|
21
|
+
letter-spacing: .3px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.interactive-panel .field input[type="text"],
|
|
25
|
+
.interactive-panel .field input[type="number"],
|
|
26
|
+
.interactive-panel .field select,
|
|
27
|
+
.interactive-panel .field textarea {
|
|
28
|
+
width: 100%;
|
|
29
|
+
max-width: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.interactive-panel .field-check {
|
|
33
|
+
flex-direction: row;
|
|
34
|
+
align-items: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.interactive-panel .field-check label {
|
|
38
|
+
color: inherit;
|
|
39
|
+
font-size: 13px;
|
|
40
|
+
text-transform: none;
|
|
41
|
+
letter-spacing: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.interactive-panel .field-row {
|
|
45
|
+
display: flex;
|
|
46
|
+
gap: 10px;
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.interactive-panel .field-small {
|
|
51
|
+
flex: 0 0 90px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.interactive-panel .field-key {
|
|
55
|
+
flex: 0 0 170px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.interactive-panel .field-wide {
|
|
59
|
+
flex: 1 1 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.interactive-panel .group {
|
|
63
|
+
border-top: 1px solid var(--line);
|
|
64
|
+
margin-top: 18px;
|
|
65
|
+
padding-top: 14px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.interactive-panel .group > h4 {
|
|
69
|
+
margin: 0 0 10px;
|
|
70
|
+
font-size: 13px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.model-info {
|
|
74
|
+
background: var(--tint);
|
|
75
|
+
border-left: 3px solid #2271b1;
|
|
76
|
+
padding: 10px 14px;
|
|
77
|
+
margin: 0 0 6px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.model-info p {
|
|
81
|
+
margin: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.model-summary {
|
|
85
|
+
line-height: 1.6;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.model-examples {
|
|
89
|
+
color: #646970;
|
|
90
|
+
font-size: 12px;
|
|
91
|
+
margin-top: 6px !important;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.model-params {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-wrap: wrap;
|
|
97
|
+
gap: 0 14px;
|
|
98
|
+
margin: 14px 0 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.model-params .field {
|
|
102
|
+
flex: 0 0 calc( 33.333% - 10px );
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.rep {
|
|
106
|
+
margin: 0 0 6px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.rep-label {
|
|
110
|
+
display: block;
|
|
111
|
+
color: var(--muted);
|
|
112
|
+
font-size: 11px;
|
|
113
|
+
text-transform: uppercase;
|
|
114
|
+
letter-spacing: .3px;
|
|
115
|
+
margin: 12px 0 6px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.rep-list {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
gap: 8px;
|
|
122
|
+
margin-bottom: 8px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.rep-row {
|
|
126
|
+
position: relative;
|
|
127
|
+
border: 1px solid var(--line);
|
|
128
|
+
border-radius: 3px;
|
|
129
|
+
background: #fff;
|
|
130
|
+
padding: 12px 34px 2px 28px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.rep-row .rep-row {
|
|
134
|
+
background: var(--tint);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.rep-row.is-dragging {
|
|
138
|
+
opacity: .5;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.rep-handle {
|
|
142
|
+
position: absolute;
|
|
143
|
+
top: 10px;
|
|
144
|
+
left: 6px;
|
|
145
|
+
color: #a7aaad;
|
|
146
|
+
cursor: grab;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.rep-remove {
|
|
150
|
+
position: absolute;
|
|
151
|
+
top: 10px;
|
|
152
|
+
right: 8px;
|
|
153
|
+
color: #b32d2e !important;
|
|
154
|
+
text-decoration: none !important;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.child-list {
|
|
158
|
+
display: flex;
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
gap: 8px;
|
|
161
|
+
margin-bottom: 12px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.child {
|
|
165
|
+
border: 1px solid var(--line);
|
|
166
|
+
border-radius: 3px;
|
|
167
|
+
background: #fff;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.child.is-dragging {
|
|
171
|
+
opacity: .5;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.child-head {
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
gap: 10px;
|
|
178
|
+
padding: 10px 12px 10px 28px;
|
|
179
|
+
position: relative;
|
|
180
|
+
background: var(--tint);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.child-head .rep-handle {
|
|
184
|
+
top: 12px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.child-title {
|
|
188
|
+
flex: 1 1 auto;
|
|
189
|
+
font-weight: 600;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.child-meta {
|
|
193
|
+
color: var(--muted);
|
|
194
|
+
font-size: 12px;
|
|
195
|
+
white-space: nowrap;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.child-toggle,
|
|
199
|
+
.child-delete {
|
|
200
|
+
text-decoration: none !important;
|
|
201
|
+
color: var(--muted) !important;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.child-delete {
|
|
205
|
+
color: #b32d2e !important;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.child-body {
|
|
209
|
+
display: none;
|
|
210
|
+
padding: 14px 12px 4px;
|
|
211
|
+
border-top: 1px solid var(--line);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.child.is-open .child-body {
|
|
215
|
+
display: block;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.child.is-open .child-toggle {
|
|
219
|
+
transform: rotate( 180deg );
|
|
220
|
+
}
|