@@ -27,41 +27,49 @@ Build a "Playground" similar to CodePen.io for the JSON2HTML feature in Edge Del
2727- Auto-render checkbox functional
2828- Responsive layout tested
2929
30- ** UI Fixed Issues:**
31- - Header overlap with main content
32- - AEM wrapper divs breaking flexbox layout
33- - Panels not filling full width
34- - ` <p> ` tag injection inside custom divs
30+ ** UI Fixed Issues (Latest Session):**
31+ - Fixed 404 errors from AEM block decoration by using ` <span> ` elements instead of nested ` <div> ` s
32+ - Fixed header alignment: Title on LEFT, action buttons (Examples, Syntax Help, Share) on RIGHT
33+ - Fixed control-bar alignment: Auto-render, Render, Fullscreen buttons aligned RIGHT
34+ - Added CSS rules for ` .default-content-wrapper ` that AEM injects
35+ - 70/30 split between editors (top) and preview (bottom)
36+ - Fullscreen button moved next to Render button
3537
3638** Current State:**
37- - Mock UI is ready for demo/review
38- - Preview shows static HTML (Mustache tags visible as text)
39- - No actual Mustache.js rendering yet
40- - Examples load sample JSON but don't render
39+ - Mock UI is ready for demo/review ✅
40+ - Layout matches reference design at https://json2html-playground--helix-tools-website--adobe.aem.live/
41+ - Preview shows static HTML (Mustache tags visible as text - expected, Phase 2 fix)
42+ - No rendering via /simulator endpoint yet (Phase 2)
43+ - Examples load sample JSON but don't render (Phase 2)
4144
4245### 🔜 Next Steps (Phase 2)
4346
44- 1 . ** Integrate Mustache.js library**
45- - Add Mustache.js to the project (CDN or local)
46- - Import in ` json2html-playground.js `
47+ 1 . ** Integrate /simulator endpoint**
48+ - Call ` POST https://json2html.aem-cf-workers.workers.dev/simulator `
49+ - Send URL-encoded JSON and template
50+ - Receive rendered HTML response
4751
48- 2 . ** Implement client-side rendering**
49- - Parse JSON input
50- - Render template with Mustache.js
51- - Update iframe ` srcdoc ` with rendered HTML
52+ 2 . ** Implement server-side rendering flow**
53+ - Encode JSON input (URL encoding)
54+ - Encode template input (URL encoding)
55+ - POST to /simulator endpoint
56+ - Update iframe ` srcdoc ` with response HTML
5257
53583 . ** Add error handling**
59+ - Handle network errors (timeout, offline)
60+ - Parse error responses from /simulator
5461 - JSON parse errors with line numbers
5562 - Template syntax errors
5663 - Display errors in status bar
5764
58654 . ** Implement View Source toggle**
5966 - Show rendered HTML vs raw source
60- - Syntax highlight the source view
67+ - Syntax highlight the source view (Prism.js)
6168
62695 . ** Add debounced auto-render**
63- - 300ms debounce on input changes
64- - Visual indicator while rendering
70+ - 300-500ms debounce on input changes
71+ - Visual indicator while rendering (loading spinner)
72+ - Cancel pending requests on new input
6573
6674---
6775
@@ -78,8 +86,9 @@ Build a "Playground" similar to CodePen.io for the JSON2HTML feature in Edge Del
7886- ** V1.1:** Consider CodeMirror 6 upgrade
7987
8088### Rendering
81- - ** Client-side only** using Mustache.js (no server calls for preview)
82- - Faster, snappier experience
89+ - ** Server-side** using ` /simulator ` endpoint (ensures consistency with production behavior)
90+ - Endpoint: ` POST https://json2html.aem-cf-workers.workers.dev/simulator `
91+ - Debounced requests to avoid hammering the server
8392
8493### Features for MVP
8594- [x] JSON input with Prism.js highlighting
@@ -113,10 +122,11 @@ Build a "Playground" similar to CodePen.io for the JSON2HTML feature in Edge Del
113122- [x] No actual rendering yet (expected)
114123
115124### Phase 2: Core Functionality (NEXT)
116- - Integrate Mustache.js (client-side)
117- - Implement live preview
118- - Add error handling with line numbers
119- - JSON validation
125+ - Integrate /simulator endpoint for rendering
126+ - Implement live preview via server-side rendering
127+ - Add error handling (network + parse errors)
128+ - JSON validation before sending
129+ - Debounced auto-render with loading indicator
120130
121131### Phase 3: Polish
122132- Add 5-7 examples
@@ -129,6 +139,7 @@ Build a "Playground" similar to CodePen.io for the JSON2HTML feature in Edge Del
129139
130140## Future Enhancements (V2+)
131141
142+ - [ ] ** Client-side Mustache.js rendering** (offline mode, faster feedback)
132143- [ ] CSS injection pane (3rd editor)
133144- [ ] JSON Schema validation
134145- [ ] Diff view for template changes
@@ -144,7 +155,22 @@ Build a "Playground" similar to CodePen.io for the JSON2HTML feature in Edge Del
144155
145156---
146157
147- ## Backend Enhancement Needed
158+ ## /simulator Endpoint (Core Dependency)
159+
160+ The playground relies on the ` /simulator ` endpoint in the ` helix-json2html ` backend.
161+
162+ ### Endpoint Details
163+ - ** URL:** ` POST https://json2html.aem-cf-workers.workers.dev/simulator `
164+ - ** Request Body:**
165+ ``` json
166+ {
167+ "json" : " <URL-encoded JSON string>" ,
168+ "template" : " <URL-encoded Mustache template>"
169+ }
170+ ```
171+ - ** Response:** Rendered HTML string
172+
173+ ### Backend Enhancement Needed
148174
149175Enhance ` /simulator ` endpoint to return structured errors:
150176
@@ -202,9 +228,12 @@ npx -y @adobe/aem-cli up --no-open --forward-browser-logs
202228- [ ] Test Syntax Help button opens modal
203229- [ ] Test responsive breakpoints (600px, 900px)
204230- [ ] Select example and verify JSON loads
205- - [ ] (Phase 2) Verify preview renders correctly
231+ - [ ] (Phase 2) Verify /simulator endpoint is called on render
232+ - [ ] (Phase 2) Verify preview displays rendered HTML
206233- [ ] (Phase 2) Test error handling with invalid JSON
234+ - [ ] (Phase 2) Test error handling with network failure
207235- [ ] (Phase 2) Test View Source toggle
236+ - [ ] (Phase 2) Test debounced auto-render
208237
209238### curl Test for /simulate endpoint
210239``` bash
@@ -218,5 +247,21 @@ curl -X POST https://json2html.aem-cf-workers.workers.dev/simulator \
218247
219248---
220249
221- * Last Updated: December 19, 2024*
222- * Phase 1 Complete - Ready for Phase 2*
250+ * Last Updated: December 19, 2024 (Phase 1 UI Complete)*
251+
252+ ---
253+
254+ ## Quick Start for Next Session
255+
256+ ``` bash
257+ cd helix-tools-website
258+ npx -y @adobe/aem-cli up --no-open --forward-browser-logs &
259+ # Open http://localhost:3000/tools/json2html-playground/
260+ ```
261+
262+ ** Phase 2 Focus: Integrate /simulator endpoint**
263+ 1 . Call ` POST https://json2html.aem-cf-workers.workers.dev/simulator `
264+ 2 . URL-encode JSON and template, send in request body
265+ 3 . Display rendered HTML in iframe srcdoc
266+ 4 . Add error handling for network/parse errors
267+ 5 . Debounce auto-render (300-500ms) with loading indicator
0 commit comments