@storyblok/react 3.0.15 → 4.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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -105
  3. package/dist/client.js +2 -1
  4. package/dist/client.mjs +1 -0
  5. package/dist/common/client.d.ts +3 -0
  6. package/dist/common/client.d.ts.map +1 -0
  7. package/dist/{types/common → common}/index.d.ts +2 -1
  8. package/dist/common/index.d.ts.map +1 -0
  9. package/dist/common/storyblok-component.d.ts +7 -0
  10. package/dist/common/storyblok-component.d.ts.map +1 -0
  11. package/dist/common.js +1 -0
  12. package/dist/common.mjs +35 -0
  13. package/dist/{types/index.d.ts → index.d.ts} +2 -1
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +1 -1
  16. package/dist/index.mjs +4 -4
  17. package/dist/jsx-runtime.js +2 -0
  18. package/dist/jsx-runtime.mjs +9 -0
  19. package/dist/jsx-runtime2.js +1 -0
  20. package/dist/jsx-runtime2.mjs +4 -0
  21. package/dist/live-edit-update-action.js +2 -0
  22. package/dist/live-edit-update-action.mjs +15 -0
  23. package/dist/live-editing.js +2 -0
  24. package/dist/live-editing.mjs +19 -0
  25. package/dist/react-jsx-runtime.development.js +23 -0
  26. package/dist/react-jsx-runtime.development.mjs +609 -0
  27. package/dist/react-jsx-runtime.development2.js +1 -0
  28. package/dist/react-jsx-runtime.development2.mjs +4 -0
  29. package/dist/react-jsx-runtime.production.min.js +10 -0
  30. package/dist/react-jsx-runtime.production.min.mjs +29 -0
  31. package/dist/react-jsx-runtime.production.min2.js +1 -0
  32. package/dist/react-jsx-runtime.production.min2.mjs +4 -0
  33. package/dist/rsc/common.d.ts +12 -0
  34. package/dist/rsc/common.d.ts.map +1 -0
  35. package/dist/rsc/index.d.ts +3 -0
  36. package/dist/rsc/index.d.ts.map +1 -0
  37. package/dist/rsc/live-edit-update-action.d.ts +5 -0
  38. package/dist/rsc/live-edit-update-action.d.ts.map +1 -0
  39. package/dist/rsc/live-editing.d.ts +6 -0
  40. package/dist/rsc/live-editing.d.ts.map +1 -0
  41. package/dist/rsc/server-component.d.ts +7 -0
  42. package/dist/rsc/server-component.d.ts.map +1 -0
  43. package/dist/rsc/story.d.ts +8 -0
  44. package/dist/rsc/story.d.ts.map +1 -0
  45. package/dist/rsc.js +1 -1
  46. package/dist/rsc.mjs +21 -24
  47. package/dist/server-component.js +1 -0
  48. package/dist/server-component.mjs +29 -0
  49. package/dist/story.js +1 -2
  50. package/dist/story.mjs +26 -7
  51. package/dist/storyblok-component.js +1 -1
  52. package/dist/storyblok-component.mjs +20 -14
  53. package/dist/storyblok-js.js +24 -24
  54. package/dist/storyblok-js.mjs +373 -354
  55. package/dist/{types/types.d.ts → types.d.ts} +2 -1
  56. package/dist/types.d.ts.map +1 -0
  57. package/package.json +52 -44
  58. package/dist/bridge-loader.js +0 -2
  59. package/dist/bridge-loader.mjs +0 -11
  60. package/dist/types/bridge-loader.d.ts +0 -8
  61. package/dist/types/common/client.d.ts +0 -2
  62. package/dist/types/common/storyblok-component.d.ts +0 -8
  63. package/dist/types/rsc/index.d.ts +0 -4
  64. package/dist/types/story.d.ts +0 -9
@@ -9,4 +9,5 @@ export interface SbReactSDKOptions extends SbSDKOptions {
9
9
  customFallbackComponent?: React.ElementType;
10
10
  }
11
11
  export type TUseStoryblokState = <T = void>(initialStory: ISbStoryData<T> | null, bridgeOptions?: StoryblokBridgeConfigV2) => ISbStoryData<T> | null;
12
- export type { ArrayFn, AsyncFn, ISbAlternateObject, ISbCache, ISbConfig, ISbContentMangmntAPI, ISbDimensions, ISbError, ISbManagmentApiResult, ISbNode, ISbResponse, ISbResult, ISbRichtext, ISbSchema, ISbStories, ISbStoriesParams, ISbStory, ISbStoryData, ISbStoryParams, SbBlokData, SbBlokKeyDataTypes, SbRichTextOptions, SbSDKOptions, StoryblokBridgeConfigV2, StoryblokBridgeV2, StoryblokClient, StoryblokComponentType, ThrottleFn, useStoryblokBridge, } from '@storyblok/js';
12
+ export type { ArrayFn, AsyncFn, ISbAlternateObject, ISbCache, ISbConfig, ISbContentMangmntAPI, ISbDimensions, ISbError, ISbManagmentApiResult, ISbNode, ISbResponse, ISbResult, ISbRichtext, ISbSchema, ISbStories, ISbStoriesParams, ISbStory, ISbStoryData, ISbStoryParams, ISbThrottle, SbBlokData, SbBlokKeyDataTypes, SbRichTextOptions, SbSDKOptions, StoryblokBridgeConfigV2, StoryblokBridgeV2, StoryblokClient, StoryblokComponentType, useStoryblokBridge, } from '@storyblok/js';
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,MAAM,WAAW,oBAAoB;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC;CAClC;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,uBAAuB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;CAC7C;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,GAAG,IAAI,EACxC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,EACpC,aAAa,CAAC,EAAE,uBAAuB,KACpC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAE5B,YAAY,EACV,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,OAAO,EACP,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@storyblok/react",
3
- "version": "3.0.15",
3
+ "type": "module",
4
+ "version": "4.2.0",
5
+ "private": false,
6
+ "packageManager": "pnpm@9.13.2",
4
7
  "description": "SDK to integrate Storyblok into your project using React.",
5
8
  "author": "Storyblok",
6
- "homepage": "https://github.com/storyblok/storyblok-react",
9
+ "license": "MIT",
7
10
  "repository": {
8
11
  "type": "git",
9
12
  "url": "https://github.com/storyblok/storyblok-react"
@@ -13,70 +16,75 @@
13
16
  },
14
17
  "exports": {
15
18
  ".": {
16
- "types": "./dist/types/index.d.ts",
19
+ "types": "./dist/index.d.ts",
17
20
  "import": "./dist/index.mjs",
18
21
  "require": "./dist/index.js"
19
22
  },
20
23
  "./rsc": {
21
- "types": "./dist/types/rsc/index.d.ts",
24
+ "types": "./dist/rsc/index.d.ts",
22
25
  "import": "./dist/rsc.mjs",
23
26
  "require": "./dist/rsc.js"
24
- },
25
- "./bridge-loader": {
26
- "types": "./dist/types/bridge-loader.d.ts",
27
- "import": "./dist/bridge-loader.mjs",
28
- "require": "./dist/bridge-loader.js"
29
- },
30
- "./story": {
31
- "types": "./dist/types/story.d.ts",
32
- "import": "./dist/story.mjs",
33
- "require": "./dist/story.js"
34
27
  }
35
28
  },
36
29
  "main": "./dist/index.js",
37
30
  "module": "./dist/index.mjs",
38
- "types": "./dist/types/index.d.ts",
31
+ "types": "./dist/index.d.ts",
39
32
  "files": [
40
33
  "dist"
41
34
  ],
42
35
  "scripts": {
43
36
  "dev": "vite build --watch",
44
37
  "build": "vite build && tsc --project tsconfig.json",
45
- "test": "npm run test:unit && npm run test:e2e && npm run test:comp",
46
- "test:unit": "jest __tests__",
47
- "test:e2e": "start-server-and-test cy:playground http://localhost:3000/ cy:run",
48
- "test:e2e-watch": "start-server-and-test cy:playground http-get://localhost:3000/ cy:open",
49
- "cy:playground": "npm run demo --prefix ../playground-next13-live-editing",
38
+ "test": "pnpm run test:unit:ci && pnpm run test:e2e",
39
+ "test:unit": "vitest",
40
+ "test:unit:ci": "vitest run",
41
+ "test:unit:ui": "vitest --ui",
42
+ "test:e2e": "start-server-and-test playground:next13-app-router http://localhost:3000/ cy:run",
43
+ "test:e2e-watch": "start-server-and-test playground:next13-app-router http-get://localhost:3000/ cy:open",
50
44
  "cy:run": "cypress run",
51
45
  "cy:open": "cypress open",
52
46
  "test:comp": "cypress run-ct",
53
- "prepublishOnly": "npm run build && cp ../README.md ./"
47
+ "playground": "pnpm run --filter ./playground/react dev",
48
+ "playground:next": "pnpm run --filter ./playground/next15 dev",
49
+ "playground:next13": "pnpm run --filter ./playground/next13 dev",
50
+ "playground:next13-app-router": "pnpm run --filter ./playground/next13-app-router dev",
51
+ "lint": "eslint .",
52
+ "lint:fix": "eslint . --fix",
53
+ "prepublishOnly": "pnpm build"
54
54
  },
55
55
  "peerDependencies": {
56
- "react": "^17.0.0 || ^18.0.0",
57
- "react-dom": "^17.0.0 || ^18.0.0"
56
+ "next": "^13 || ^14 || ^15",
57
+ "react": "^17 || ^18 || ^19",
58
+ "react-dom": "^17 || ^18 || ^19"
58
59
  },
59
60
  "dependencies": {
60
- "@storyblok/js": "^3.1.1"
61
+ "@storyblok/js": "3.1.9"
61
62
  },
62
63
  "devDependencies": {
63
- "@babel/core": "^7.25.2",
64
- "@babel/preset-env": "^7.25.4",
64
+ "@babel/core": "^7.26.0",
65
+ "@babel/preset-env": "^7.26.0",
66
+ "@commitlint/cli": "^19.6.0",
67
+ "@commitlint/config-conventional": "^19.6.0",
65
68
  "@cypress/react": "^8.0.2",
66
- "@cypress/vite-dev-server": "^5.2.0",
67
- "@tsconfig/recommended": "^1.0.7",
68
- "@types/react": "18.3.4",
69
- "@vitejs/plugin-react": "^4.3.1",
69
+ "@cypress/vite-dev-server": "^5.2.1",
70
+ "@storyblok/eslint-config": "^0.3.0",
71
+ "@tsconfig/recommended": "^1.0.8",
72
+ "@types/node": "^22.10.1",
73
+ "@types/react": "18.3.12",
74
+ "@vitejs/plugin-react": "^4.3.4",
70
75
  "babel-jest": "^29.7.0",
71
- "cypress": "^13.14.2",
72
- "eslint-plugin-cypress": "^3.5.0",
73
- "eslint-plugin-jest": "^28.8.3",
74
- "jest": "^29.7.0",
76
+ "cypress": "^13.16.1",
77
+ "eslint": "^9.16.0",
78
+ "eslint-plugin-cypress": "^4.1.0",
79
+ "eslint-plugin-jest": "^28.9.0",
75
80
  "react": "^18.3.1",
76
81
  "react-dom": "^18.3.1",
77
82
  "rollup-plugin-preserve-directives": "^0.4.0",
78
- "start-server-and-test": "^2.0.5",
79
- "vite": "^5.4.3"
83
+ "simple-git-hooks": "^2.11.1",
84
+ "start-server-and-test": "^2.0.8",
85
+ "typescript": "5.6.3",
86
+ "vite": "^5.4.11",
87
+ "vitest": "^2.1.8"
80
88
  },
81
89
  "babel": {
82
90
  "presets": [
@@ -90,14 +98,10 @@
90
98
  ]
91
99
  ]
92
100
  },
93
- "jest": {
94
- "moduleFileExtensions": [
95
- "js",
96
- "json"
97
- ],
98
- "transform": {
99
- "^.+\\.js$": "babel-jest"
100
- }
101
+ "commitlint": {
102
+ "extends": [
103
+ "@commitlint/config-conventional"
104
+ ]
101
105
  },
102
106
  "release": {
103
107
  "branches": [
@@ -106,5 +110,9 @@
106
110
  },
107
111
  "publishConfig": {
108
112
  "access": "public"
113
+ },
114
+ "simple-git-hooks": {
115
+ "pre-commit": "pnpm lint",
116
+ "pre-push": "pnpm commitlint --last --verbose"
109
117
  }
110
118
  }
@@ -1,2 +0,0 @@
1
- "use client";
2
- "use strict";const o=require("react"),r=require("./storyblok-js.js"),t=async e=>{await r.loadStoryblokBridge(),new window.StoryblokBridge(e).on(["published","change"],()=>{window.location.reload()})},n=({options:e})=>(t(e),o.createElement(o.Fragment,null));module.exports=n;
@@ -1,11 +0,0 @@
1
- "use client";
2
- import o from "react";
3
- import { loadStoryblokBridge as r } from "./storyblok-js.mjs";
4
- const t = async (e) => {
5
- await r(), new window.StoryblokBridge(e).on(["published", "change"], () => {
6
- window.location.reload();
7
- });
8
- }, i = ({ options: e }) => (t(e), /* @__PURE__ */ o.createElement(o.Fragment, null));
9
- export {
10
- i as default
11
- };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { StoryblokBridgeConfigV2 } from './types';
3
- interface StoryblokBridgeLoaderProps {
4
- options: StoryblokBridgeConfigV2;
5
- [key: string]: unknown;
6
- }
7
- declare const StoryblokBridgeLoader: ({ options }: StoryblokBridgeLoaderProps) => React.JSX.Element;
8
- export default StoryblokBridgeLoader;
@@ -1,2 +0,0 @@
1
- import type { TUseStoryblokState } from '../types';
2
- export declare const useStoryblokState: TUseStoryblokState;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { SbBlokData } from '../types';
3
- interface StoryblokComponentProps {
4
- blok: SbBlokData;
5
- [key: string]: unknown;
6
- }
7
- declare const StoryblokComponent: React.ForwardRefExoticComponent<Omit<StoryblokComponentProps, "ref"> & React.RefAttributes<HTMLElement>>;
8
- export default StoryblokComponent;
@@ -1,4 +0,0 @@
1
- export { default as BridgeLoader } from '../bridge-loader';
2
- export { default as StoryblokBridgeLoader } from '../bridge-loader';
3
- export * from '../common';
4
- export { default as StoryblokStory } from '../story';
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import type { ISbStoryData, StoryblokBridgeConfigV2 } from './types';
3
- interface StoryblokStoryProps {
4
- story: ISbStoryData;
5
- bridgeOptions: StoryblokBridgeConfigV2;
6
- [key: string]: unknown;
7
- }
8
- declare const StoryblokStory: React.ForwardRefExoticComponent<Omit<StoryblokStoryProps, "ref"> & React.RefAttributes<HTMLElement>>;
9
- export default StoryblokStory;