@appmockup/core 0.2.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 +38 -0
- package/dist/index.cjs +1138 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1160 -0
- package/dist/index.d.ts +1160 -0
- package/dist/index.js +1079 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @appmockup/core
|
|
2
|
+
|
|
3
|
+
Environment-agnostic core of [AppMockup](https://github.com/yakupbulbul/AppMockup): the
|
|
4
|
+
config schema (zod) and the Canvas 2D rendering engine. Pure TypeScript, no Node- or
|
|
5
|
+
DOM-only dependencies — it runs identically in the browser and in Node (via
|
|
6
|
+
`@napi-rs/canvas`), so the web preview and CLI/MCP exports produce the same pixels.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm i @appmockup/core
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## What's inside
|
|
13
|
+
|
|
14
|
+
- `mockupConfigSchema` / `parseConfig` — the config schema and parser.
|
|
15
|
+
- `validateHeadlines(config)` — cross-field check: every language has a headline.
|
|
16
|
+
- `renderMockup(ctx, scene)` + `resolveScene(...)` — the layered renderer
|
|
17
|
+
(background → device frame → text).
|
|
18
|
+
- `deviceFrameRect(canvasW, canvasH, deviceFrame)` — pure device geometry, shared by the
|
|
19
|
+
renderer and the studio's interactive overlay.
|
|
20
|
+
- `createStarterConfig`, `STANDARD_OUTPUT_SIZES`, `TEMPLATES`, `parseHexColor`.
|
|
21
|
+
- `THEMES` / `applyTheme(config, theme)` — accent color palettes that recolor a config
|
|
22
|
+
(background, decorations, text, bezel) without touching layout.
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { parseConfig, resolveScene, renderMockup } from "@appmockup/core";
|
|
28
|
+
|
|
29
|
+
const config = parseConfig(json);
|
|
30
|
+
const scene = resolveScene(config, config.screenshots[0], "en", config.outputSizes[0], image);
|
|
31
|
+
renderMockup(ctx, scene); // ctx: a Canvas 2D context (browser or @napi-rs/canvas)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
See [docs/config-schema.md](../../docs/config-schema.md) for the field reference.
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
MIT © Yakup Bülbül
|