@blocklet/pages-kit 0.2.220 → 0.2.221

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.
@@ -56,8 +56,8 @@ const property_1 = require("../../utils/property");
56
56
  const MAXIMUM_RENDER_STACK_SIZE = 20;
57
57
  function CustomComponentRenderer(_a) {
58
58
  var _b;
59
- var props = __rest(_a, []);
60
- return ((0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { fallbackRender: E, resetKeys: [Date.now()], children: (0, jsx_runtime_1.jsx)(ComponentRenderer, Object.assign({}, props, { instanceId: (_b = props.instanceId) !== null && _b !== void 0 ? _b : props.componentId })) }));
59
+ var { defaultLocale = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.config.defaultLocale } = _a, props = __rest(_a, ["defaultLocale"]);
60
+ return ((0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { fallbackRender: E, resetKeys: [Date.now()], children: (0, jsx_runtime_1.jsx)(ComponentRenderer, Object.assign({}, props, { defaultLocale: defaultLocale, instanceId: (_b = props.instanceId) !== null && _b !== void 0 ? _b : props.componentId })) }));
61
61
  }
62
62
  exports.default = CustomComponentRenderer;
63
63
  function ComponentRenderer(_a) {
@@ -157,12 +157,12 @@ function useComponent({ mode, instanceId, componentId, components, locale, defau
157
157
  const preloadComponent = (0, react_1.useMemo)(() => getScriptComponent(componentId), [componentId, PRELOAD_COMPONENTS_STATE_KEY]);
158
158
  const preloadState = (0, react_1.useMemo)(() => {
159
159
  var _a, _b;
160
- return (_b = (_a = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.props[instanceId]) === null || _a === void 0 ? void 0 : _a.locales) === null || _b === void 0 ? void 0 : _b[locale || defaultLocale];
161
- }, [instanceId, locale, defaultLocale, PRELOAD_COMPONENTS_STATE_KEY]);
160
+ return (_b = (_a = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.props[instanceId]) === null || _a === void 0 ? void 0 : _a.locales) === null || _b === void 0 ? void 0 : _b[locale];
161
+ }, [instanceId, locale, PRELOAD_COMPONENTS_STATE_KEY]);
162
162
  const preloadDefaultState = (0, react_1.useMemo)(() => {
163
163
  var _a, _b;
164
164
  return (_b = (_a = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.props[instanceId]) === null || _a === void 0 ? void 0 : _a.locales) === null || _b === void 0 ? void 0 : _b[defaultLocale];
165
- }, [instanceId, locale, PRELOAD_COMPONENTS_STATE_KEY]);
165
+ }, [instanceId, defaultLocale, PRELOAD_COMPONENTS_STATE_KEY]);
166
166
  const previousPreload = (0, react_1.useRef)();
167
167
  const [, update] = (0, react_1.useState)(0);
168
168
  if ((props || preloadState) && preloadComponent) {
@@ -30,8 +30,8 @@ import { RenderNestedComponent, mergeComponent } from '../../utils/property';
30
30
  const MAXIMUM_RENDER_STACK_SIZE = 20;
31
31
  export default function CustomComponentRenderer(_a) {
32
32
  var _b;
33
- var props = __rest(_a, []);
34
- return (_jsx(ErrorBoundary, { fallbackRender: E, resetKeys: [Date.now()], children: _jsx(ComponentRenderer, Object.assign({}, props, { instanceId: (_b = props.instanceId) !== null && _b !== void 0 ? _b : props.componentId })) }));
33
+ var { defaultLocale = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.config.defaultLocale } = _a, props = __rest(_a, ["defaultLocale"]);
34
+ return (_jsx(ErrorBoundary, { fallbackRender: E, resetKeys: [Date.now()], children: _jsx(ComponentRenderer, Object.assign({}, props, { defaultLocale: defaultLocale, instanceId: (_b = props.instanceId) !== null && _b !== void 0 ? _b : props.componentId })) }));
35
35
  }
36
36
  function ComponentRenderer(_a) {
37
37
  var { renderCount = 0 } = _a, props = __rest(_a, ["renderCount"]);
@@ -130,12 +130,12 @@ function useComponent({ mode, instanceId, componentId, components, locale, defau
130
130
  const preloadComponent = useMemo(() => getScriptComponent(componentId), [componentId, PRELOAD_COMPONENTS_STATE_KEY]);
131
131
  const preloadState = useMemo(() => {
132
132
  var _a, _b;
133
- return (_b = (_a = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.props[instanceId]) === null || _a === void 0 ? void 0 : _a.locales) === null || _b === void 0 ? void 0 : _b[locale || defaultLocale];
134
- }, [instanceId, locale, defaultLocale, PRELOAD_COMPONENTS_STATE_KEY]);
133
+ return (_b = (_a = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.props[instanceId]) === null || _a === void 0 ? void 0 : _a.locales) === null || _b === void 0 ? void 0 : _b[locale];
134
+ }, [instanceId, locale, PRELOAD_COMPONENTS_STATE_KEY]);
135
135
  const preloadDefaultState = useMemo(() => {
136
136
  var _a, _b;
137
137
  return (_b = (_a = PRELOAD_COMPONENTS_STATE === null || PRELOAD_COMPONENTS_STATE === void 0 ? void 0 : PRELOAD_COMPONENTS_STATE.props[instanceId]) === null || _a === void 0 ? void 0 : _a.locales) === null || _b === void 0 ? void 0 : _b[defaultLocale];
138
- }, [instanceId, locale, PRELOAD_COMPONENTS_STATE_KEY]);
138
+ }, [instanceId, defaultLocale, PRELOAD_COMPONENTS_STATE_KEY]);
139
139
  const previousPreload = useRef();
140
140
  const [, update] = useState(0);
141
141
  if ((props || preloadState) && preloadComponent) {
@@ -17,5 +17,5 @@ export interface CustomComponentRendererProps {
17
17
  [key: string]: any;
18
18
  };
19
19
  }
20
- export default function CustomComponentRenderer({ ...props }: CustomComponentRendererProps): import("react/jsx-runtime").JSX.Element;
20
+ export default function CustomComponentRenderer({ defaultLocale, ...props }: CustomComponentRendererProps): import("react/jsx-runtime").JSX.Element;
21
21
  export declare function transpileAndLoadScript(script: string): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/pages-kit",
3
- "version": "0.2.220",
3
+ "version": "0.2.221",
4
4
  "description": "Pages Kit components and utils",
5
5
  "publishConfig": {
6
6
  "access": "public"