@markgrafhq/markgraf-react 0.0.28 → 0.0.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @markgrafhq/markgraf-react
2
2
 
3
- React hook + component for embedding [markgraf](https://github.com/i-am-the-slime/markgraf) animations. Drives play/pause/seek imperatively and exposes `time`, `currentKeyframe`, and `playing` as reactive state.
3
+ React hook + component for embedding [markgraf](https://github.com/i-am-the-slime/markgraf) animations. Drives play/pause/seek imperatively and exposes `time`, `keyframe`, and `playing` as reactive state.
4
4
 
5
5
  ## Install
6
6
 
@@ -9,30 +9,31 @@ bun add @markgrafhq/markgraf-react
9
9
  # or: npm install @markgrafhq/markgraf-react
10
10
  ```
11
11
 
12
- Also pull in the embed CSS for canvas styling:
12
+ Import the package CSS for player styling:
13
13
 
14
14
  ```js
15
- import "@markgrafhq/markgraf-embed/css";
15
+ import "@markgrafhq/markgraf-react/css";
16
16
  ```
17
17
 
18
18
  ## `<MarkgrafPlayer src=... />`
19
19
 
20
- Headless component renders a `<canvas>` (default) or `<svg>` with the scene drawn directly into it. Bring your own controls.
20
+ Headless component that draws the scene directly into the selected Canvas2D, SVG, or WebGL surface. Bring your own controls.
21
21
 
22
22
  ```jsx
23
23
  import { MarkgrafPlayer } from "@markgrafhq/markgraf-react";
24
24
 
25
25
  const src = `seed 1
26
- keyframe v1 {
27
- +node client "Client"
28
- +node api "API"
29
- +edge client api
30
- client -> api "GET"
26
+ scene v1 {
27
+ + client: Client
28
+ + api: API
29
+ + client -> api
30
+ client ~> api: GET
31
31
  }`;
32
32
 
33
33
  export default function App() {
34
34
  return <MarkgrafPlayer src={src} />;
35
35
  // Or: <MarkgrafPlayer src={src} renderer="svg" />
36
+ // Or: <MarkgrafPlayer src={src} renderer="sdf" />
36
37
  }
37
38
  ```
38
39
 
@@ -84,6 +85,7 @@ export function Player({ src }) {
84
85
 
85
86
  - **`canvas`** (default) — Canvas2D with DPR-aware scaling and label springs. Fastest, best for many tokens.
86
87
  - **`svg`** — Inline SVG. Easier to inspect/style, scales crisply at any zoom, no DPR concerns. No spring labels.
88
+ - **`sdf`** (alias **`webgl`**) — WebGL raymarched 3D rendering; available through `MarkgrafPlayer` only.
87
89
 
88
90
  ## License
89
91
 
@@ -27533,7 +27533,7 @@ const wn = /* @__PURE__ */ Vs(GR), f$ = (t) => (n) => (e) => () => ks((r, o) =>
27533
27533
  onCueEnter: (n) => gf(t.onCueEnter(_f(n))()),
27534
27534
  onStepEnter: (n, e) => gf(t.onStepEnter(n)(_f(e))()),
27535
27535
  onComplete: (n) => gf(t.onComplete(_f(n))())
27536
- }), H6 = (t, n) => B6(p$(t)(n ?? {})), Q6 = F6;
27536
+ }), H6 = (t, n) => B6(p$(t)(n ?? {})()), Q6 = F6;
27537
27537
  export {
27538
27538
  Q6 as MarkgrafPlayer,
27539
27539
  H6 as useMarkgraf
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markgrafhq/markgraf-react",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "React hook + component for embedding markgraf animations. Drives play/pause/seek and exposes time + keyframe as reactive state.",
5
5
  "type": "module",
6
6
  "main": "./dist/markgraf-react.js",
@@ -23,7 +23,22 @@
23
23
  "README.md",
24
24
  "LICENSE"
25
25
  ],
26
- "sideEffects": false,
26
+ "sideEffects": [
27
+ "./dist/markgraf-react.css"
28
+ ],
29
+ "scripts": {
30
+ "storybook": "storybook dev -p 6006",
31
+ "build-storybook": "storybook build"
32
+ },
33
+ "devDependencies": {
34
+ "@storybook/addon-essentials": "^8.6.14",
35
+ "@storybook/react": "^8.6.14",
36
+ "@storybook/react-vite": "^8.6.14",
37
+ "react": "^18.3.1",
38
+ "react-dom": "^18.3.1",
39
+ "storybook": "^8.6.14",
40
+ "vite": "^5.4.11"
41
+ },
27
42
  "peerDependencies": {
28
43
  "react": ">=18",
29
44
  "react-dom": ">=18"