@storyblok/react 4.0.0 → 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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -2
  3. package/dist/client.js +1 -1
  4. package/dist/common/client.d.ts +3 -0
  5. package/dist/common/client.d.ts.map +1 -0
  6. package/dist/{types/common → common}/index.d.ts +2 -1
  7. package/dist/common/index.d.ts.map +1 -0
  8. package/dist/common/storyblok-component.d.ts +7 -0
  9. package/dist/common/storyblok-component.d.ts.map +1 -0
  10. package/dist/common.mjs +2 -2
  11. package/dist/{types/index.d.ts → index.d.ts} +2 -1
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +1 -1
  14. package/dist/index.mjs +4 -4
  15. package/dist/jsx-runtime.js +2 -0
  16. package/dist/jsx-runtime.mjs +9 -0
  17. package/dist/jsx-runtime2.js +1 -0
  18. package/dist/jsx-runtime2.mjs +4 -0
  19. package/dist/live-editing.js +1 -1
  20. package/dist/react-jsx-runtime.development.js +23 -0
  21. package/dist/react-jsx-runtime.development.mjs +609 -0
  22. package/dist/react-jsx-runtime.development2.js +1 -0
  23. package/dist/react-jsx-runtime.development2.mjs +4 -0
  24. package/dist/react-jsx-runtime.production.min.js +10 -0
  25. package/dist/react-jsx-runtime.production.min.mjs +29 -0
  26. package/dist/react-jsx-runtime.production.min2.js +1 -0
  27. package/dist/react-jsx-runtime.production.min2.mjs +4 -0
  28. package/dist/{types/rsc → rsc}/common.d.ts +2 -1
  29. package/dist/rsc/common.d.ts.map +1 -0
  30. package/dist/{types/rsc → rsc}/index.d.ts +1 -0
  31. package/dist/rsc/index.d.ts.map +1 -0
  32. package/dist/{types/rsc → rsc}/live-edit-update-action.d.ts +1 -0
  33. package/dist/rsc/live-edit-update-action.d.ts.map +1 -0
  34. package/dist/{types/rsc → rsc}/live-editing.d.ts +1 -0
  35. package/dist/rsc/live-editing.d.ts.map +1 -0
  36. package/dist/rsc/server-component.d.ts +7 -0
  37. package/dist/rsc/server-component.d.ts.map +1 -0
  38. package/dist/rsc/story.d.ts +8 -0
  39. package/dist/rsc/story.d.ts.map +1 -0
  40. package/dist/server-component.js +1 -1
  41. package/dist/server-component.mjs +21 -15
  42. package/dist/story.js +1 -1
  43. package/dist/story.mjs +17 -13
  44. package/dist/storyblok-component.js +1 -1
  45. package/dist/storyblok-component.mjs +20 -14
  46. package/dist/storyblok-js.js +24 -24
  47. package/dist/storyblok-js.mjs +373 -354
  48. package/dist/{types/types.d.ts → types.d.ts} +2 -1
  49. package/dist/types.d.ts.map +1 -0
  50. package/package.json +52 -45
  51. package/dist/types/common/client.d.ts +0 -2
  52. package/dist/types/common/storyblok-component.d.ts +0 -8
  53. package/dist/types/rsc/server-component.d.ts +0 -8
  54. package/dist/types/rsc/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": "4.0.0",
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,71 +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
- "next": "14.2.14"
61
+ "@storyblok/js": "3.1.9"
62
62
  },
63
63
  "devDependencies": {
64
- "@babel/core": "^7.25.2",
65
- "@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",
66
68
  "@cypress/react": "^8.0.2",
67
- "@cypress/vite-dev-server": "^5.2.0",
68
- "@tsconfig/recommended": "^1.0.7",
69
- "@types/react": "18.3.4",
70
- "@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",
71
75
  "babel-jest": "^29.7.0",
72
- "cypress": "^13.14.2",
73
- "eslint-plugin-cypress": "^3.5.0",
74
- "eslint-plugin-jest": "^28.8.3",
75
- "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",
76
80
  "react": "^18.3.1",
77
81
  "react-dom": "^18.3.1",
78
82
  "rollup-plugin-preserve-directives": "^0.4.0",
79
- "start-server-and-test": "^2.0.5",
80
- "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"
81
88
  },
82
89
  "babel": {
83
90
  "presets": [
@@ -91,14 +98,10 @@
91
98
  ]
92
99
  ]
93
100
  },
94
- "jest": {
95
- "moduleFileExtensions": [
96
- "js",
97
- "json"
98
- ],
99
- "transform": {
100
- "^.+\\.js$": "babel-jest"
101
- }
101
+ "commitlint": {
102
+ "extends": [
103
+ "@commitlint/config-conventional"
104
+ ]
102
105
  },
103
106
  "release": {
104
107
  "branches": [
@@ -107,5 +110,9 @@
107
110
  },
108
111
  "publishConfig": {
109
112
  "access": "public"
113
+ },
114
+ "simple-git-hooks": {
115
+ "pre-commit": "pnpm lint",
116
+ "pre-push": "pnpm commitlint --last --verbose"
110
117
  }
111
118
  }
@@ -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,8 +0,0 @@
1
- import React from 'react';
2
- import type { SbBlokData } from '../types';
3
- interface SbServerComponentProps {
4
- blok: SbBlokData;
5
- [key: string]: unknown;
6
- }
7
- declare const StoryblokServerComponent: React.ForwardRefExoticComponent<Omit<SbServerComponentProps, "ref"> & React.RefAttributes<HTMLElement>>;
8
- export default StoryblokServerComponent;
@@ -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;