react-bricks 4.7.0-beta.0 → 4.7.0-beta.2
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/astro/DynamicComponent.astro +27 -22
- package/astro/PageViewer.astro +4 -10
- package/astro/index.js +1 -1
- package/astro/package.json +1 -1
- package/astro/react-bricks-astro.d.ts +1216 -0
- package/astro/react-bricks-astro.esm.js +1 -1
- package/astro/server/package.json +1 -1
- package/astro/server/react-bricks-astro-server.d.ts +1023 -0
- package/frontend/package.json +1 -1
- package/package.json +30 -16
- package/rsc/client/package.json +1 -1
- package/rsc/package.json +1 -1
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { types } from 'react-bricks/astro'
|
|
3
3
|
import { reactBricksAstroStore, AstroBrick } from 'react-bricks/astro'
|
|
4
|
-
import PageViewer from '
|
|
5
|
-
|
|
6
|
-
// import type { types } from '@/shared/types'
|
|
7
|
-
// import reactBricksAstroStore from '../../ReactBricks/reactBricksAstroStore'
|
|
8
|
-
// import AstroBrick from '../AstroBrick'
|
|
9
|
-
// import PageViewer from './PageViewer.astro'
|
|
10
|
-
|
|
4
|
+
import PageViewer from './PageViewer.astro'
|
|
5
|
+
|
|
11
6
|
interface Props {
|
|
12
7
|
block: types.IContentBlock
|
|
13
8
|
index?: number
|
|
@@ -16,9 +11,11 @@ interface Props {
|
|
|
16
11
|
[x: string]: unknown
|
|
17
12
|
}
|
|
18
13
|
|
|
14
|
+
|
|
19
15
|
let error = false
|
|
20
16
|
const { block, index, itemsCount, page, ...props } = Astro.props as Props
|
|
21
17
|
const config = reactBricksAstroStore.getConfig()
|
|
18
|
+
|
|
22
19
|
if (!config) {
|
|
23
20
|
console.warn('React Bricks Store is not initialized')
|
|
24
21
|
error = true
|
|
@@ -26,7 +23,6 @@ if (!config) {
|
|
|
26
23
|
|
|
27
24
|
reactBricksAstroStore.setBlock(block)
|
|
28
25
|
|
|
29
|
-
// console.log('DynamicComponent', import.meta.env.SSR, !!config)
|
|
30
26
|
const Brick = reactBricksAstroStore.getBrick(block)
|
|
31
27
|
|
|
32
28
|
let blockProps = { ...block.props, ...props }
|
|
@@ -37,8 +33,6 @@ if (!Brick) {
|
|
|
37
33
|
}
|
|
38
34
|
error = true
|
|
39
35
|
} else {
|
|
40
|
-
// Apply mapExternalDataToProps if it is defined
|
|
41
|
-
// and externalData is supplied
|
|
42
36
|
if (
|
|
43
37
|
Brick.schema.mapExternalDataToProps &&
|
|
44
38
|
typeof Brick.schema.mapExternalDataToProps === 'function' &&
|
|
@@ -60,6 +54,8 @@ const pathname =
|
|
|
60
54
|
Astro.url.pathname === '/'
|
|
61
55
|
? Astro.url.pathname
|
|
62
56
|
: trimEndChar(Astro.url.pathname || '', '/')
|
|
57
|
+
|
|
58
|
+
const isDev = import.meta.env.DEV
|
|
63
59
|
---
|
|
64
60
|
|
|
65
61
|
{
|
|
@@ -79,8 +75,18 @@ const pathname =
|
|
|
79
75
|
block={block}
|
|
80
76
|
pathname={pathname}
|
|
81
77
|
/>
|
|
78
|
+
) : Brick.schema.astroInteractivity && isDev ? (
|
|
79
|
+
<AstroBrick
|
|
80
|
+
client:only
|
|
81
|
+
blockProps={blockProps}
|
|
82
|
+
index={index}
|
|
83
|
+
itemsCount={itemsCount}
|
|
84
|
+
page={page}
|
|
85
|
+
block={block}
|
|
86
|
+
pathname={pathname}
|
|
87
|
+
/>
|
|
82
88
|
) : Brick.schema.astroInteractivity === 'load' ||
|
|
83
|
-
|
|
89
|
+
Brick.schema.astroInteractivity.load === true ? (
|
|
84
90
|
<AstroBrick
|
|
85
91
|
client:load
|
|
86
92
|
blockProps={blockProps}
|
|
@@ -91,7 +97,7 @@ const pathname =
|
|
|
91
97
|
pathname={pathname}
|
|
92
98
|
/>
|
|
93
99
|
) : Brick.schema.astroInteractivity === 'idle' ||
|
|
94
|
-
|
|
100
|
+
Brick.schema.astroInteractivity.idle === true ? (
|
|
95
101
|
<AstroBrick
|
|
96
102
|
client:idle
|
|
97
103
|
blockProps={blockProps}
|
|
@@ -101,10 +107,10 @@ const pathname =
|
|
|
101
107
|
block={block}
|
|
102
108
|
pathname={pathname}
|
|
103
109
|
/>
|
|
104
|
-
) : !!
|
|
110
|
+
) : !!Brick.schema.astroInteractivity.idle?.timeout ? (
|
|
105
111
|
<AstroBrick
|
|
106
112
|
client:idle={{
|
|
107
|
-
timeout:
|
|
113
|
+
timeout: Brick.schema.astroInteractivity.idle?.timeout,
|
|
108
114
|
}}
|
|
109
115
|
blockProps={blockProps}
|
|
110
116
|
index={index}
|
|
@@ -114,7 +120,7 @@ const pathname =
|
|
|
114
120
|
pathname={pathname}
|
|
115
121
|
/>
|
|
116
122
|
) : Brick.schema.astroInteractivity === 'visible' ||
|
|
117
|
-
|
|
123
|
+
Brick.schema.astroInteractivity.visible === true ? (
|
|
118
124
|
<AstroBrick
|
|
119
125
|
client:visible
|
|
120
126
|
blockProps={blockProps}
|
|
@@ -124,11 +130,10 @@ const pathname =
|
|
|
124
130
|
block={block}
|
|
125
131
|
pathname={pathname}
|
|
126
132
|
/>
|
|
127
|
-
) : !!
|
|
133
|
+
) : !!Brick.schema.astroInteractivity.visible?.rootMargin ? (
|
|
128
134
|
<AstroBrick
|
|
129
135
|
client:visible={{
|
|
130
|
-
rootMargin:
|
|
131
|
-
?.rootMargin,
|
|
136
|
+
rootMargin: Brick.schema.astroInteractivity.visible?.rootMargin,
|
|
132
137
|
}}
|
|
133
138
|
blockProps={blockProps}
|
|
134
139
|
index={index}
|
|
@@ -137,9 +142,9 @@ const pathname =
|
|
|
137
142
|
block={block}
|
|
138
143
|
pathname={pathname}
|
|
139
144
|
/>
|
|
140
|
-
) : !!
|
|
145
|
+
) : !!Brick.schema.astroInteractivity.media ? (
|
|
141
146
|
<AstroBrick
|
|
142
|
-
client:media={
|
|
147
|
+
client:media={Brick.schema.astroInteractivity.media}
|
|
143
148
|
blockProps={blockProps}
|
|
144
149
|
index={index}
|
|
145
150
|
itemsCount={itemsCount}
|
|
@@ -147,9 +152,9 @@ const pathname =
|
|
|
147
152
|
block={block}
|
|
148
153
|
pathname={pathname}
|
|
149
154
|
/>
|
|
150
|
-
) : !!
|
|
155
|
+
) : !!Brick.schema.astroInteractivity.only ? (
|
|
151
156
|
<AstroBrick
|
|
152
|
-
client:only={
|
|
157
|
+
client:only={Brick.schema.astroInteractivity.only}
|
|
153
158
|
blockProps={blockProps}
|
|
154
159
|
index={index}
|
|
155
160
|
itemsCount={itemsCount}
|
package/astro/PageViewer.astro
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { types } from 'react-bricks/astro'
|
|
3
|
-
import {
|
|
4
|
-
import DynamicComponent from '
|
|
5
|
-
|
|
6
|
-
// import type { types } from '@/shared/types'
|
|
7
|
-
// import reactBricksAstroStore from '../../ReactBricks/reactBricksAstroStore'
|
|
8
|
-
// import ClickToEdit from '../ClickToEdit'
|
|
9
|
-
// import DynamicComponent from './DynamicComponent.astro'
|
|
3
|
+
import { ClickToEdit, reactBricksAstroStore } from 'react-bricks/astro'
|
|
4
|
+
import DynamicComponent from './DynamicComponent.astro'
|
|
10
5
|
|
|
11
6
|
interface Props {
|
|
12
7
|
page: types.Page
|
|
13
8
|
main?: boolean
|
|
14
9
|
}
|
|
15
10
|
|
|
11
|
+
|
|
16
12
|
let error = false
|
|
17
13
|
const { page, main } = Astro.props as Props
|
|
18
14
|
|
|
@@ -30,13 +26,11 @@ if (!pageType) {
|
|
|
30
26
|
error = true
|
|
31
27
|
}
|
|
32
28
|
|
|
33
|
-
// console.log('is main?', !!main, page.name)
|
|
34
29
|
---
|
|
35
|
-
|
|
36
30
|
{
|
|
37
31
|
error
|
|
38
32
|
? ''
|
|
39
|
-
: (page?.content?.map((block, index) => (
|
|
33
|
+
: (page?.content?.map((block: any, index: any) => (
|
|
40
34
|
<DynamicComponent
|
|
41
35
|
page={page}
|
|
42
36
|
key={`${block.id}-${index}`}
|
package/astro/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("intersection-observer");var e=require("../react-bricks-DBsyFafC.js"),t=require("
|
|
1
|
+
"use strict";require("intersection-observer");var e=require("../react-bricks-DBsyFafC.js"),t=require("react"),r=require("../react-bricks-1Be065Jm.js"),n=require("react-icons/fi"),o=require("../react-bricks-BFoJ4_oR.js");require("../react-bricks-Btf-citH.js"),require("classnames"),require("../react-bricks-BNm3bMhQ.js"),require("ts-md5");var i,s="c"+(i=5,e.__spreadArray([],e.__read(Array(i)),!1).map((function(){return(~~(36*Math.random())).toString(36)})).join("")),a=function(){return t.createElement(t.Fragment,null,t.createElement("style",null,"\n.".concat(s," {\n display:block;\n position: fixed;\n box-sizing: border-box;\n z-index: 999;\n bottom: 20px;\n left: 20px;\n padding: 5px 12px;\n background-color: #ffffffdd;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #1e293b;\n font-size: 11px;\n font-weight: 600;\n border: 1px solid #e2e8f0cc;\n border-radius: 20px;\n text-transform: uppercase;\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);\n filter: none;\n transition: all 300ms ease;\n}\n.").concat(s,":hover {\n background-color: #ffffff;\n filter: drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08));\n}\n.").concat(s," .l {\n transition: color 300ms ease;\n}\n.").concat(s,":hover .l {\n color: #f65a8e;\n}\n ")),t.createElement("a",{href:"https://reactbricks.com?utm_campaign=site-badge",target:"_blank",className:s},t.createElement("img",{src:"https://reactbricks.com/_next/static/media/reactbricks_icon.c57a7be4.svg",style:{width:18,height:18,marginRight:6}}),t.createElement("span",null,"Made in ",t.createElement("span",{className:"l"},"React Bricks"))))},c=r.reactBricksAstroStore.getBricks,l=r.reactBricksAstroStore.getPageValues,d=r.reactBricksAstroStore.getBlockValue,p=r.reactBricksAstroStore.isAdmin;r.reactBricksAstroStore.register,Object.defineProperty(exports,"types",{enumerable:!0,get:function(){return e.types}}),exports.File=r.File,exports.Image=r.Image,exports.Link=r.Link,exports.Repeater=r.Repeater,exports.RichText=r.CompatibleRichText,exports.RichTextExt=r.RichText,exports.Text=r.Text,exports.reactBricksAstroStore=r.reactBricksAstroStore,exports.useAdminContext=r.useAdminContext,exports.usePageValues=r.usePageValues,exports.useReactBricksContext=r.useReactBricksContext,exports.useVisualEdit=r.useVisualEdit,exports.Plain=o.Plain,exports.AstroBrick=function(n){var o=n.index,i=n.itemsCount,s=n.blockProps,a=n.page,c=n.block,l=n.pathname,d=void 0===l?"":l,p=e.__read(t.useState(r.reactBricksAstroStore.isRegistered()),2),u=p[0],f=p[1];if(t.useEffect((function(){return r.reactBricksAstroStore.__subscribeConfig((function(){f(!0)}))}),[]),"undefined"!=typeof window&&!u)return null;var x=r.reactBricksAstroStore.getBrick(c);return x?(r.reactBricksAstroStore.setPathname(d),t.createElement(x,e.__assign({},s,{key:s.key,index:o,itemsCount:i,__page:a,__block:c}))):("development"===process.env.NODE_ENV&&console.warn('Missing component for block type "'.concat(c.type,'"')),null)},exports.ClickToEdit=function(i){var s,c,l=i.page,d=e.__read(t.useState(!1),2),p=d[0],u=d[1],f=r.useReactBricksContext();if(t.useEffect((function(){u(!0)}),[]),!p)return null;if(!f)return null;var x,m=(null===(s=null==l?void 0:l.customValues)||void 0===s?void 0:s.___t)&&!o.isPaidPlan(null===(c=l.customValues)||void 0===c?void 0:c.___t),g=localStorage.getItem(e.AUTH_TOKEN_LS_KEY);if(g&&g.length>10&&g.startsWith("ey")){if((null==f?void 0:f.clickToEditSide)===e.types.ClickToEditSide.None)return null;var k=f||{navigate:function(){}},b=k.navigate,h=k.editorPath,E=k.clickToEditSide,_={};return E===e.types.ClickToEditSide.BottomRight&&(_.bottom=50,_.right=0,_.borderTopLeftRadius=999,_.borderBottomLeftRadius=999,_.transform="translate(8px,0)"),E===e.types.ClickToEditSide.BottomLeft&&(_.bottom=50,_.left=0,_.borderTopRightRadius=999,_.borderBottomRightRadius=999,_.transform="translate(-8px,0)"),E===e.types.ClickToEditSide.TopRight&&(_.top=50,_.right=0,_.borderTopLeftRadius=999,_.borderBottomLeftRadius=999,_.transform="translate(8px,0)"),E===e.types.ClickToEditSide.TopLeft&&(_.top=50,_.left=0,_.borderTopRightRadius=999,_.borderBottomRightRadius=999,_.transform="translate(-8px,0)"),t.createElement(t.Fragment,null,t.createElement("style",null,"\n.rb-click-to-edit {\n position: fixed;\n z-index: 10;\n width: 61px;\n height: 38px;\n background-color: #f65a8e;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n transition: all 150ms ease;\n border: 2px solid #fff;\n}\n.rb-click-to-edit-left:hover {\n transform: translate(-2px,0)!important;\n}\n.rb-click-to-edit-right:hover {\n transform: translate(2px,0)!important;\n}\n "),t.createElement("div",{className:"rb-click-to-edit ".concat((x=E,x===e.types.ClickToEditSide.TopLeft||x===e.types.ClickToEditSide.BottomLeft?"rb-click-to-edit-left":"rb-click-to-edit-right")),style:_,onClick:function(){return b("".concat(h,"?p=").concat(encodeURIComponent(l.id),"&l=").concat(l.language))}},t.createElement(n.FiEdit,null)),m&&t.createElement(a,null))}return m&&t.createElement(a,null)},exports.getBlockValue=d,exports.getBricks=c,exports.getPageValues=l,exports.isAdmin=p;
|