@puzzmo/sdk 1.0.33 → 1.0.35
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 +3 -3
- package/dist/{createSimulator-Bo6J_KC_.js → createSimulator-BuPYG4eZ.js} +364 -201
- package/dist/createSimulator-BuPYG4eZ.js.map +1 -0
- package/dist/{createSimulator-EBKHk3L6.cjs → createSimulator-DDHvAKZy.cjs} +114 -34
- package/dist/createSimulator-DDHvAKZy.cjs.map +1 -0
- package/dist/fonts.cjs +2 -2
- package/dist/fonts.cjs.map +1 -1
- package/dist/fonts.d.ts +2 -0
- package/dist/fonts.d.ts.map +1 -1
- package/dist/fonts.js +8 -6
- package/dist/fonts.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/simulator/index.cjs +1 -1
- package/dist/simulator/index.js +1 -1
- package/dist/simulator/normalizeThumbnail.d.ts +11 -0
- package/dist/simulator/normalizeThumbnail.d.ts.map +1 -0
- package/dist/simulator/standalone.cjs +1 -1
- package/dist/simulator/standalone.js +1 -1
- package/dist/simulator/state.d.ts +2 -1
- package/dist/simulator/state.d.ts.map +1 -1
- package/dist/simulator/styles.d.ts +1 -1
- package/dist/simulator/styles.d.ts.map +1 -1
- package/dist/simulator/types.d.ts +7 -0
- package/dist/simulator/types.d.ts.map +1 -1
- package/dist/simulator/views/DataView.d.ts.map +1 -1
- package/dist/simulator/views/ThumbView.d.ts.map +1 -1
- package/dist/types.d.ts +8 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.ts +3 -2
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +4 -3
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
- package/dist/createSimulator-Bo6J_KC_.js.map +0 -1
- package/dist/createSimulator-EBKHk3L6.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -202,7 +202,7 @@ import { h, render } from "@puzzmo/sdk/svgJSX"
|
|
|
202
202
|
// Needed for fragments
|
|
203
203
|
const React = { Fragment: "g" }
|
|
204
204
|
|
|
205
|
-
export function renderThumbnail(puzzleStr: string, inputStr?: string, config?: ThumbnailConfig):
|
|
205
|
+
export function renderThumbnail(puzzleStr: string, inputStr?: string, config?: ThumbnailConfig): ThumbnailResult {
|
|
206
206
|
const puzzle = JSON.parse(puzzleStr)
|
|
207
207
|
const size = 200
|
|
208
208
|
|
|
@@ -216,11 +216,11 @@ export function renderThumbnail(puzzleStr: string, inputStr?: string, config?: T
|
|
|
216
216
|
)
|
|
217
217
|
|
|
218
218
|
const el = render(svg)
|
|
219
|
-
return el instanceof Element ? el.outerHTML : ""
|
|
219
|
+
return { svg: el instanceof Element ? el.outerHTML : "", width: size, height: size }
|
|
220
220
|
}
|
|
221
221
|
```
|
|
222
222
|
|
|
223
|
-
The `h` function is a JSX factory that creates virtual DOM nodes, and `render` converts them into real DOM elements. Since thumbnails can run server-side or in a DOM-shimmed environment, the
|
|
223
|
+
The `h` function is a JSX factory that creates virtual DOM nodes, and `render` converts them into real DOM elements. Since thumbnails can run server-side or in a DOM-shimmed environment, the SVG is serialized via `outerHTML` and returned alongside its `width`/`height` so the host can size the thumbnail without parsing it.
|
|
224
224
|
|
|
225
225
|
## Editor Integration
|
|
226
226
|
|