@@ -72,149 +72,134 @@ function generate_page( string $html, array $options ): string {
72
72
);
73
73
ob_start ();
74
74
?>
75
- <table
76
- id="html-api-debugger-table"
75
+ <div
77
76
data-wp-interactive="<?php echo esc_attr ( \HTML_API_Debugger \SLUG ); ?> "
78
77
data-wp-watch--a="watch"
79
78
data-wp-watch--b="watchDom"
80
79
data-wp-run="run"
80
+ class="html-api-debugger-container html-api-debugger--grid"
81
81
>
82
- <tbody>
83
- <tr>
84
- <td>
85
- <h2>Input HTML</h2>
86
- <textarea
87
- id='input_html'
88
- autocapitalize="off"
89
- autocomplete="off"
90
- spellcheck="false"
91
- wrap="off"
92
- <?php wp_on_directive ( 'input ' , 'handleInput ' ); ?>
93
- ><?php echo "\n" . esc_textarea ( str_replace ( "\0" , '' , $ html ) ); ?> </textarea>
94
- <p data-wp-bind--hidden="!state.htmlPreambleForProcessing">
95
- Note: Because HTML API operates in body at this time, this will be prepended:
96
- <br>
97
- <code data-wp-text="state.htmlPreambleForProcessing"></code>
98
- </p>
99
- </td>
100
- <td>
101
- <h2>Rendered output</h2>
102
- <iframe
103
- <?php wp_on_directive ( 'load ' , 'onRenderedIframeLoad ' ); ?>
104
- src="about:blank"
105
- id="rendered_iframe"
106
- referrerpolicy="no-referrer"
107
- sandbox="allow-forms allow-modals allow-popups allow-scripts allow-same-origin"></iframe>
108
- </td>
109
- </tr>
110
- <tr>
111
- <td colspan="2">
112
- <details>
113
- <summary>Document info</summary>
114
- <div class="col-wrapper">
115
- <div class="col">
116
- Rendering mode: <code data-wp-text="state.htmlapiResponse.result.compatMode"></code><br>
117
- Doctype name: <code data-wp-text="state.htmlApiDoctypeName"></code><br>
118
- Doctype publicId: <code data-wp-text="state.htmlApiDoctypePublicId"></code><br>
119
- Doctype systemId: <code data-wp-text="state.htmlApiDoctypeSystemId"></code>
120
- </div>
121
- <div class="col">
122
- Rendering mode: <code data-wp-text="state.DOM.renderingMode"></code><br>
123
- Doctype name: <code data-wp-text="state.DOM.doctypeName"></code><br>
124
- Doctype publicId: <code data-wp-text="state.DOM.doctypePublicId"></code><br>
125
- Doctype systemId: <code data-wp-text="state.DOM.doctypeSystemId"></code>
126
- </div>
127
- </div>
128
- </details>
129
- </td>
130
- </tr>
131
- <tr>
132
- <td><h2>Interpreted by HTML API</h2></td>
133
- <td><h2>Interpreted from DOM</h2></td>
134
- </tr>
135
- <tr>
136
- <td colspan="2">
137
- <div class="col-wrapper">
138
- <div
139
- class="col"
140
- data-wp-class--showClosers="state.showClosers"
141
- <?php wp_on_directive ( 'click ' , 'handleSpanClick ' ); ?>
142
- >
143
- <pre class="hide-on-empty error-holder" data-wp-text="state.htmlapiResponse.error"></pre>
144
- <ul id="html_api_result_holder" class="hide-on-empty" data-wp-ignore></ul>
145
- </div>
146
- <div class="col">
147
- <ul id="dom_tree" data-wp-ignore></ul>
148
- </div>
149
- </div>
150
- </td>
151
- </tr>
152
- <tr>
153
- <td><p>Click a node above to see its span details below.</p></td>
154
- </tr>
155
- <tr>
156
- <td colspan="2">
157
- <div>
158
- <label>Show closers <input type="checkbox" data-wp-bind--checked="state.showClosers" <?php wp_on_directive ( 'input ' , 'handleShowClosersClick ' ); ?> ></label>
159
- <label>Show invisible <input type="checkbox" data-wp-bind--checked="state.showInvisible" <?php wp_on_directive ( 'input ' , 'handleShowInvisibleClick ' ); ?> ></label>
160
- <span data-wp-bind--hidden="!state.htmlapiResponse.supports.is_virtual"><label>Show virtual <input type="checkbox" data-wp-bind--checked="state.showVirtual" <?php wp_on_directive ( 'input ' , 'handleShowVirtualClick ' ); ?> ></label></span>
161
- <span data-wp-bind--hidden="!state.htmlapiResponse.supports.quirks_mode"><label>Quirks mode <input type="checkbox" data-wp-bind--checked="state.quirksMode" <?php wp_on_directive ( 'input ' , 'handleQuirksModeClick ' ); ?> ></label></span>
162
- <span data-wp-bind--hidden="!state.htmlapiResponse.supports.full_parser"><label>Full parser <input type="checkbox" data-wp-bind--checked="state.fullParser" <?php wp_on_directive ( 'input ' , 'handleFullParserClick ' ); ?> ></label></span>
163
- </div>
164
- <div>
165
- <label>
166
- Hover information
167
- <select <?php wp_on_directive ( 'change ' , 'hoverInfoChange ' ); ?> >
168
- <option data-wp-bind--selected="state.hoverBreadcrumbs" value="breadcrumbs">(depth) Breadcrumbs…</option>
169
- <option data-wp-bind--selected="state.hoverInsertion" value="insertionMode">Insertion mode</option>
170
- </select>
171
- </label>
82
+ <div>
83
+ <h2>Input HTML</h2>
84
+ <textarea
85
+ id='input_html'
86
+ autocapitalize="off"
87
+ autocomplete="off"
88
+ spellcheck="false"
89
+ wrap="off"
90
+ <?php wp_on_directive ( 'input ' , 'handleInput ' ); ?>
91
+ ><?php echo "\n" . esc_textarea ( str_replace ( "\0" , '' , $ html ) ); ?> </textarea>
92
+ <p data-wp-bind--hidden="!state.htmlPreambleForProcessing">
93
+ Note: Because HTML API operates in body at this time, this will be prepended:
94
+ <br>
95
+ <code data-wp-text="state.htmlPreambleForProcessing"></code>
96
+ </p>
97
+ </div>
98
+ <div>
99
+ <h2>Rendered output</h2>
100
+ <iframe
101
+ <?php wp_on_directive ( 'load ' , 'onRenderedIframeLoad ' ); ?>
102
+ src="about:blank"
103
+ id="rendered_iframe"
104
+ referrerpolicy="no-referrer"
105
+ sandbox="allow-forms allow-modals allow-popups allow-scripts allow-same-origin"></iframe>
106
+ </div>
107
+ <details class="full-width">
108
+ <summary>Document info</summary>
109
+
110
+ <div class="html-api-debugger--grid">
111
+ <div>
112
+ Rendering mode: <code data-wp-text="state.htmlapiResponse.result.compatMode"></code><br>
113
+ Doctype name: <code data-wp-text="state.htmlApiDoctypeName"></code><br>
114
+ Doctype publicId: <code data-wp-text="state.htmlApiDoctypePublicId"></code><br>
115
+ Doctype systemId: <code data-wp-text="state.htmlApiDoctypeSystemId"></code>
116
+ </div>
117
+ <div>
118
+ Rendering mode: <code data-wp-text="state.DOM.renderingMode"></code><br>
119
+ Doctype name: <code data-wp-text="state.DOM.doctypeName"></code><br>
120
+ Doctype publicId: <code data-wp-text="state.DOM.doctypePublicId"></code><br>
121
+ Doctype systemId: <code data-wp-text="state.DOM.doctypeSystemId"></code>
122
+ </div>
123
+ </div>
124
+ </details>
125
+ <div class="full-width html-api-debugger--grid">
126
+ <div>
127
+ <h2>Interpreted by HTML API</h2>
128
+ <div <?php wp_on_directive ( 'click ' , 'handleSpanClick ' ); ?> >
129
+ <pre class="error-holder" data-wp-bind--hidden="!state.htmlapiResponse.error" data-wp-text="state.htmlapiResponse.error"></pre>
130
+ <div data-wp-bind--hidden="state.htmlapiResponse.error">
131
+ <ul id="html_api_result_holder" data-wp-ignore></ul>
172
132
</div>
173
- </td>
174
- </tr>
175
- <tr data-wp-bind--hidden="state.span">
176
- <td colspan="2">
133
+ </div>
134
+ <p>Click a node above to see its span details below.</p>
135
+ </div>
136
+ <div>
137
+ <h2>Interpreted from DOM</h2>
138
+ <ul id="dom_tree" data-wp-ignore></ul>
139
+ </div>
140
+ </div>
141
+
142
+ <div class="full-width">
143
+ <div>
144
+ <div>
145
+ <label>Show closers <input type="checkbox" data-wp-bind--checked="state.showClosers" <?php wp_on_directive ( 'input ' , 'handleShowClosersClick ' ); ?> ></label>
146
+ <label>Show invisible <input type="checkbox" data-wp-bind--checked="state.showInvisible" <?php wp_on_directive ( 'input ' , 'handleShowInvisibleClick ' ); ?> ></label>
147
+ <span data-wp-bind--hidden="!state.htmlapiResponse.supports.is_virtual"><label>Show virtual <input type="checkbox" data-wp-bind--checked="state.showVirtual" <?php wp_on_directive ( 'input ' , 'handleShowVirtualClick ' ); ?> ></label></span>
148
+ <span data-wp-bind--hidden="!state.htmlapiResponse.supports.quirks_mode"><label>Quirks mode <input type="checkbox" data-wp-bind--checked="state.quirksMode" <?php wp_on_directive ( 'input ' , 'handleQuirksModeClick ' ); ?> ></label></span>
149
+ <span data-wp-bind--hidden="!state.htmlapiResponse.supports.full_parser"><label>Full parser <input type="checkbox" data-wp-bind--checked="state.fullParser" <?php wp_on_directive ( 'input ' , 'handleFullParserClick ' ); ?> ></label></span>
150
+ </div>
151
+ <div>
152
+ <label>
153
+ Hover information
154
+ <select <?php wp_on_directive ( 'change ' , 'hoverInfoChange ' ); ?> >
155
+ <option data-wp-bind--selected="state.hoverBreadcrumbs" value="breadcrumbs">(depth) Breadcrumbs…</option>
156
+ <option data-wp-bind--selected="state.hoverInsertion" value="insertionMode">Insertion mode</option>
157
+ </select>
158
+ </label>
159
+ </div>
160
+ </div>
161
+
162
+ <div>
163
+ <div data-wp-bind--hidden="state.span">
177
164
<h2>Processed HTML</h2>
178
165
<pre class="html-text" data-wp-text="state.hoverSpan"></pre>
179
- </td>
180
- </tr>
181
- <tr data-wp-bind--hidden="!state.span">
182
- <td colspan="2">
166
+ </div>
167
+
168
+ <div data-wp-bind--hidden="!state.span">
183
169
<h2>Processed HTML selected span</h2>
184
170
<button <?php wp_on_directive ( 'click ' , 'clearSpan ' ); ?> type="button">Clear span selection 🧹</button>
185
171
<div class="htmlSpanContainer">
186
172
<pre class="html-text html-span" data-wp-text="state.hoverSpanSplit.0"></pre>
187
173
<pre class="html-text html-span html selected span" data-wp-text="state.hoverSpanSplit.1"></pre>
188
174
<pre class="html-text html-span" data-wp-text="state.hoverSpanSplit.2"></pre>
189
175
</div>
190
- </td>
191
- </tr>
192
- <tr>
193
- <td colspan="2">
194
- <p>
195
- <label>
196
- <select id="htmlapi-wp-version">
197
- <option value="latest">latest</option>
198
- <option value="beta">beta</option>
199
- <option value="nightly">nightly</option>
200
- </select>
201
- </label>
202
- <button <?php wp_on_directive ( 'click ' , 'handleCopyClick ' ); ?> type="button">Copy shareable playground link</button><br>
203
- <label>
204
- <code>wordpress/develop</code> PR number:
205
- <input type="number" min="1" <?php wp_on_directive ( 'input ' , 'handleCopyPrInput ' ); ?> >
206
- </label>
207
- <button <?php wp_on_directive ( 'click ' , 'handleCopyPrClick ' ); ?> >Copy shareable playground link to PR</button>
208
- <button <?php wp_on_directive ( 'click ' , 'handleCheckPrClick ' ); ?> data-wp-bind--disabled="state.checkingForPRPlaygroundLink">Check PR</button>
209
- </p>
210
- <details>
211
- <summary>debug response</summary>
212
- <pre data-wp-text="state.formattedHtmlapiResponse"></pre>
213
- </details>
214
- </td>
215
- </tr>
216
- </tbody>
217
- </table>
176
+ </div>
177
+ </div>
178
+
179
+ <div>
180
+ <p>
181
+ <label>
182
+ <select id="htmlapi-wp-version">
183
+ <option value="latest">latest</option>
184
+ <option value="beta">beta</option>
185
+ <option value="nightly">nightly</option>
186
+ </select>
187
+ </label>
188
+ <button <?php wp_on_directive ( 'click ' , 'handleCopyClick ' ); ?> type="button">Copy shareable playground link</button><br>
189
+ <label>
190
+ <code>wordpress/develop</code> PR number:
191
+ <input type="number" min="1" <?php wp_on_directive ( 'input ' , 'handleCopyPrInput ' ); ?> >
192
+ </label>
193
+ <button <?php wp_on_directive ( 'click ' , 'handleCopyPrClick ' ); ?> >Copy shareable playground link to PR</button>
194
+ <button <?php wp_on_directive ( 'click ' , 'handleCheckPrClick ' ); ?> data-wp-bind--disabled="state.checkingForPRPlaygroundLink">Check PR</button>
195
+ </p>
196
+ <details>
197
+ <summary>debug response</summary>
198
+ <pre data-wp-text="state.formattedHtmlapiResponse"></pre>
199
+ </details>
200
+ </div>
201
+ </div>
202
+ </div>
218
203
<?php
219
204
return wp_interactivity_process_directives ( ob_get_clean () );
220
205
}
0 commit comments