@uniformdev/canvas-react 19.79.0 → 19.79.1-alpha.13

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.
@@ -38,4 +38,4 @@ type PureUniformTextProps = {
38
38
  */
39
39
  declare const PureUniformText: ({ as: Tag, parameterId, component, skipCustomRendering, isContextualEditing, isMultiline, placeholder, render, ...props }: PureUniformTextProps) => React.JSX.Element | null;
40
40
 
41
- export { PureUniformTextProps as P, PureUniformText as a };
41
+ export { type PureUniformTextProps as P, PureUniformText as a };
@@ -0,0 +1,41 @@
1
+ import { ComponentInstance } from '@uniformdev/canvas';
2
+ import React from 'react';
3
+
4
+ type ParameterTextValue = string | undefined;
5
+ type PureUniformTextProps = {
6
+ /**
7
+ * The name of the HTML tag to render.
8
+ * @default "span"
9
+ */
10
+ as?: React.ElementType;
11
+ /** The ID of the parameter. */
12
+ parameterId: string;
13
+ /** The component that contains the parameter. */
14
+ component: ComponentInstance;
15
+ skipCustomRendering: boolean;
16
+ isContextualEditing: boolean;
17
+ /**
18
+ * When set to true, it adds `whiteSpace: 'pre-wrap'` to the styles of the root element to allow the rendering of line breaks.
19
+ * @default false
20
+ */
21
+ isMultiline?: boolean;
22
+ /**
23
+ * Sets the value to show in Canvas editor when the parameter value is empty.
24
+ * Can be a static string, or a function to generate the placeholder out of parameter info.
25
+ * @default undefined
26
+ */
27
+ placeholder?: string | ((parameter: {
28
+ id: string;
29
+ }) => string | undefined);
30
+ /**
31
+ * A function to customize the rendering of the parameter value. Useful to format the value before rendering it.
32
+ * @default "(value) => value"
33
+ */
34
+ render?: (value: ParameterTextValue) => React.ReactNode;
35
+ } & Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'placeholder'>;
36
+ /**
37
+ * Renders text parameters. Offers inline editing capability out of the box.
38
+ */
39
+ declare const PureUniformText: ({ as: Tag, parameterId, component, skipCustomRendering, isContextualEditing, isMultiline, placeholder, render, ...props }: PureUniformTextProps) => React.JSX.Element | null;
40
+
41
+ export { type PureUniformTextProps as P, PureUniformText as a };
package/dist/core.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
2
2
  import React, { PropsWithChildren } from 'react';
3
- export { a as PureUniformText, P as PureUniformTextProps } from './PureUniformText-37defdc5.js';
3
+ export { a as PureUniformText, P as PureUniformTextProps } from './PureUniformText-METroz2Q.mjs';
4
4
 
5
5
  type PureContextualEditingComponentWrapperProps = {
6
6
  isPlaceholder: boolean | undefined;
@@ -13,4 +13,4 @@ type PureContextualEditingComponentWrapperProps = {
13
13
  };
14
14
  declare const PureContextualEditingComponentWrapper: ({ children, isPlaceholder, parentComponent, component, slotName, indexInSlot, slotChildrenCount, isReadOnly, }: PropsWithChildren<PureContextualEditingComponentWrapperProps>) => React.JSX.Element;
15
15
 
16
- export { PureContextualEditingComponentWrapper, PureContextualEditingComponentWrapperProps };
16
+ export { PureContextualEditingComponentWrapper, type PureContextualEditingComponentWrapperProps };
package/dist/core.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
2
2
  import React, { PropsWithChildren } from 'react';
3
- export { a as PureUniformText, P as PureUniformTextProps } from './PureUniformText-37defdc5.js';
3
+ export { a as PureUniformText, P as PureUniformTextProps } from './PureUniformText-METroz2Q.js';
4
4
 
5
5
  type PureContextualEditingComponentWrapperProps = {
6
6
  isPlaceholder: boolean | undefined;
@@ -13,4 +13,4 @@ type PureContextualEditingComponentWrapperProps = {
13
13
  };
14
14
  declare const PureContextualEditingComponentWrapper: ({ children, isPlaceholder, parentComponent, component, slotName, indexInSlot, slotChildrenCount, isReadOnly, }: PropsWithChildren<PureContextualEditingComponentWrapperProps>) => React.JSX.Element;
15
15
 
16
- export { PureContextualEditingComponentWrapper, PureContextualEditingComponentWrapperProps };
16
+ export { PureContextualEditingComponentWrapper, type PureContextualEditingComponentWrapperProps };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
2
  import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
3
3
  export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
4
- import { P as PureUniformTextProps } from './PureUniformText-37defdc5.js';
4
+ import { P as PureUniformTextProps } from './PureUniformText-METroz2Q.mjs';
5
5
  import { RichTextNode } from '@uniformdev/richtext';
6
6
 
7
7
  /**
@@ -31,6 +31,7 @@ type ComponentStore = {
31
31
  component: React.ComponentType<ComponentProps<any>>;
32
32
  }) => void;
33
33
  get: (type: string, variantId?: string) => React.ComponentType<ComponentProps<any>> | undefined;
34
+ getComponentsMap: () => Map<string, React.ComponentType<ComponentProps<any>>>;
34
35
  };
35
36
 
36
37
  /**
@@ -104,12 +105,15 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
104
105
  type: string;
105
106
  parameters?: {
106
107
  [key: string]: {
107
- value: unknown;
108
+ value?: unknown;
108
109
  type: string;
109
110
  connectedData?: {
110
111
  pointer: string;
111
112
  syntax: "jptr";
112
113
  } | undefined;
114
+ locales?: {
115
+ [key: string]: unknown;
116
+ } | undefined;
113
117
  };
114
118
  } | undefined;
115
119
  variant?: string | undefined;
@@ -123,12 +127,15 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
123
127
  type: string;
124
128
  parameters?: {
125
129
  [key: string]: {
126
- value: unknown;
130
+ value?: unknown;
127
131
  type: string;
128
132
  connectedData?: {
129
133
  pointer: string;
130
134
  syntax: "jptr";
131
135
  } | undefined;
136
+ locales?: {
137
+ [key: string]: unknown;
138
+ } | undefined;
132
139
  };
133
140
  } | undefined;
134
141
  variant?: string | undefined;
@@ -162,12 +169,15 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
162
169
  [key: string]: {
163
170
  parameters?: {
164
171
  [key: string]: {
165
- value: unknown;
172
+ value?: unknown;
166
173
  type: string;
167
174
  connectedData?: {
168
175
  pointer: string;
169
176
  syntax: "jptr";
170
177
  } | undefined;
178
+ locales?: {
179
+ [key: string]: unknown;
180
+ } | undefined;
171
181
  };
172
182
  } | undefined;
173
183
  variant?: string | undefined;
@@ -179,11 +189,23 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
179
189
  } | undefined;
180
190
  variants?: boolean | undefined;
181
191
  } | undefined;
192
+ _locales?: string[] | undefined;
182
193
  }[];
183
194
  } | undefined;
184
195
  _id: string;
185
196
  _slug?: string | null | undefined;
186
197
  _name: string;
198
+ _pattern?: string | undefined;
199
+ _patternDataResources?: {
200
+ [key: string]: {
201
+ type: string;
202
+ isPatternParameter?: boolean | undefined;
203
+ ignorePatternParameterDefault?: boolean | undefined;
204
+ variables?: {
205
+ [key: string]: string;
206
+ } | undefined;
207
+ };
208
+ } | undefined;
187
209
  _dataResources?: {
188
210
  [key: string]: {
189
211
  type: string;
@@ -198,12 +220,15 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
198
220
  [key: string]: {
199
221
  parameters?: {
200
222
  [key: string]: {
201
- value: unknown;
223
+ value?: unknown;
202
224
  type: string;
203
225
  connectedData?: {
204
226
  pointer: string;
205
227
  syntax: "jptr";
206
228
  } | undefined;
229
+ locales?: {
230
+ [key: string]: unknown;
231
+ } | undefined;
207
232
  };
208
233
  } | undefined;
209
234
  variant?: string | undefined;
@@ -215,6 +240,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
215
240
  } | undefined;
216
241
  variants?: boolean | undefined;
217
242
  } | undefined;
243
+ _locales?: string[] | undefined;
218
244
  } | undefined;
219
245
  isContextualEditing: boolean;
220
246
  };
@@ -417,4 +443,4 @@ declare const createComponentStoreResolver: (options: {
417
443
  defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
418
444
  }) => RenderComponentResolver;
419
445
 
420
- export { ComponentProps, ComponentStore, CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionContext, UniformCompositionProps, UniformPlayground, UniformPlaygroundDecorator, UniformPlaygroundProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformSlotWrapperComponentProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
446
+ export { type ComponentProps, type ComponentStore, type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, type RenderComponentResolver, type RenderRichTextComponentResolver, type RichTextComponentProps, type RichTextRendererComponent, type SystemRenderConfig, type SystemRenderFunction, UniformComponent, type UniformComponentContextValue, type UniformComponentProps, UniformComposition, UniformCompositionContext, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundDecorator, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, type UniformSlotWrapperComponentProps, UniformText, type UniformTextProps, type UseCompositionEventEffectOptions, type UseUniformContextualEditingProps, type UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
2
2
  import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
3
3
  export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
4
- import { P as PureUniformTextProps } from './PureUniformText-37defdc5.js';
4
+ import { P as PureUniformTextProps } from './PureUniformText-METroz2Q.js';
5
5
  import { RichTextNode } from '@uniformdev/richtext';
6
6
 
7
7
  /**
@@ -31,6 +31,7 @@ type ComponentStore = {
31
31
  component: React.ComponentType<ComponentProps<any>>;
32
32
  }) => void;
33
33
  get: (type: string, variantId?: string) => React.ComponentType<ComponentProps<any>> | undefined;
34
+ getComponentsMap: () => Map<string, React.ComponentType<ComponentProps<any>>>;
34
35
  };
35
36
 
36
37
  /**
@@ -104,12 +105,15 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
104
105
  type: string;
105
106
  parameters?: {
106
107
  [key: string]: {
107
- value: unknown;
108
+ value?: unknown;
108
109
  type: string;
109
110
  connectedData?: {
110
111
  pointer: string;
111
112
  syntax: "jptr";
112
113
  } | undefined;
114
+ locales?: {
115
+ [key: string]: unknown;
116
+ } | undefined;
113
117
  };
114
118
  } | undefined;
115
119
  variant?: string | undefined;
@@ -123,12 +127,15 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
123
127
  type: string;
124
128
  parameters?: {
125
129
  [key: string]: {
126
- value: unknown;
130
+ value?: unknown;
127
131
  type: string;
128
132
  connectedData?: {
129
133
  pointer: string;
130
134
  syntax: "jptr";
131
135
  } | undefined;
136
+ locales?: {
137
+ [key: string]: unknown;
138
+ } | undefined;
132
139
  };
133
140
  } | undefined;
134
141
  variant?: string | undefined;
@@ -162,12 +169,15 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
162
169
  [key: string]: {
163
170
  parameters?: {
164
171
  [key: string]: {
165
- value: unknown;
172
+ value?: unknown;
166
173
  type: string;
167
174
  connectedData?: {
168
175
  pointer: string;
169
176
  syntax: "jptr";
170
177
  } | undefined;
178
+ locales?: {
179
+ [key: string]: unknown;
180
+ } | undefined;
171
181
  };
172
182
  } | undefined;
173
183
  variant?: string | undefined;
@@ -179,11 +189,23 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
179
189
  } | undefined;
180
190
  variants?: boolean | undefined;
181
191
  } | undefined;
192
+ _locales?: string[] | undefined;
182
193
  }[];
183
194
  } | undefined;
184
195
  _id: string;
185
196
  _slug?: string | null | undefined;
186
197
  _name: string;
198
+ _pattern?: string | undefined;
199
+ _patternDataResources?: {
200
+ [key: string]: {
201
+ type: string;
202
+ isPatternParameter?: boolean | undefined;
203
+ ignorePatternParameterDefault?: boolean | undefined;
204
+ variables?: {
205
+ [key: string]: string;
206
+ } | undefined;
207
+ };
208
+ } | undefined;
187
209
  _dataResources?: {
188
210
  [key: string]: {
189
211
  type: string;
@@ -198,12 +220,15 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
198
220
  [key: string]: {
199
221
  parameters?: {
200
222
  [key: string]: {
201
- value: unknown;
223
+ value?: unknown;
202
224
  type: string;
203
225
  connectedData?: {
204
226
  pointer: string;
205
227
  syntax: "jptr";
206
228
  } | undefined;
229
+ locales?: {
230
+ [key: string]: unknown;
231
+ } | undefined;
207
232
  };
208
233
  } | undefined;
209
234
  variant?: string | undefined;
@@ -215,6 +240,7 @@ declare const useUniformContextualEditing: ({ initialCompositionValue, enhance,
215
240
  } | undefined;
216
241
  variants?: boolean | undefined;
217
242
  } | undefined;
243
+ _locales?: string[] | undefined;
218
244
  } | undefined;
219
245
  isContextualEditing: boolean;
220
246
  };
@@ -417,4 +443,4 @@ declare const createComponentStoreResolver: (options: {
417
443
  defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
418
444
  }) => RenderComponentResolver;
419
445
 
420
- export { ComponentProps, ComponentStore, CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, RenderComponentResolver, RenderRichTextComponentResolver, RichTextComponentProps, RichTextRendererComponent, SystemRenderConfig, SystemRenderFunction, UniformComponent, UniformComponentContextValue, UniformComponentProps, UniformComposition, UniformCompositionContext, UniformCompositionProps, UniformPlayground, UniformPlaygroundDecorator, UniformPlaygroundProps, UniformRichText, UniformRichTextNode, UniformRichTextNodeProps, UniformRichTextProps, UniformSlot, UniformSlotProps, UniformSlotWrapperComponentProps, UniformText, UniformTextProps, UseCompositionEventEffectOptions, UseUniformContextualEditingProps, UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
446
+ export { type ComponentProps, type ComponentStore, type CustomSlotChildRenderFunc, DefaultNotImplementedComponent, NOT_IMPLEMENTED_COMPONENT, type RenderComponentResolver, type RenderRichTextComponentResolver, type RichTextComponentProps, type RichTextRendererComponent, type SystemRenderConfig, type SystemRenderFunction, UniformComponent, type UniformComponentContextValue, type UniformComponentProps, UniformComposition, UniformCompositionContext, type UniformCompositionProps, UniformPlayground, type UniformPlaygroundDecorator, type UniformPlaygroundProps, UniformRichText, UniformRichTextNode, type UniformRichTextNodeProps, type UniformRichTextProps, UniformSlot, type UniformSlotProps, type UniformSlotWrapperComponentProps, UniformText, type UniformTextProps, type UseCompositionEventEffectOptions, type UseUniformContextualEditingProps, type UseUniformContextualEditingStateProps, componentStore, componentStoreResolver, convertComponentToProps, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  // src/components/DefaultNotImplementedComponent.tsx
4
- import { CANVAS_LOCALIZATION_TYPE } from "@uniformdev/canvas";
4
+ import { CANVAS_LOCALIZATION_TYPE, EMPTY_COMPOSITION } from "@uniformdev/canvas";
5
5
  import React from "react";
6
6
  var wrapperStyles = {
7
7
  display: "flex",
@@ -21,6 +21,9 @@ function DefaultNotImplementedComponent(props) {
21
21
  if (!componentType) {
22
22
  return null;
23
23
  }
24
+ if (componentType === EMPTY_COMPOSITION.type) {
25
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, `@keyframes _uniformDelayedFadeIn { 0%,75% { opacity: 0; } to { opacity: 1; } }`), /* @__PURE__ */ React.createElement("p", { style: { animation: "_uniformDelayedFadeIn 3s" } }, "This component only works inside Uniform Canvas editor.", /* @__PURE__ */ React.createElement("br", null), "If you think this is an error, try", " ", /* @__PURE__ */ React.createElement("a", { href: "", style: { fontWeight: "bolder", textDecoration: "underline" } }, "reloading the page"), "."));
26
+ }
24
27
  if (componentType === CANVAS_LOCALIZATION_TYPE) {
25
28
  return /* @__PURE__ */ React.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ React.createElement("p", null, "Seems like localization is not enabled in your application. Please read our documentation on how to", " ", /* @__PURE__ */ React.createElement(
26
29
  "a",
@@ -104,7 +107,8 @@ var createComponentStore = () => {
104
107
  },
105
108
  get: (type, variantId) => {
106
109
  return components.get(getTypeWithVariant(type, variantId));
107
- }
110
+ },
111
+ getComponentsMap: () => new Map(components)
108
112
  };
109
113
  };
110
114
  var createComponentStoreResolver = ({ store, defaultComponent = DefaultNotImplementedComponent }) => {
@@ -138,7 +142,7 @@ import {
138
142
  CANVAS_PERSONALIZE_TYPE,
139
143
  CANVAS_TEST_SLOT,
140
144
  CANVAS_TEST_TYPE,
141
- EMPTY_COMPOSITION as EMPTY_COMPOSITION2
145
+ EMPTY_COMPOSITION as EMPTY_COMPOSITION3
142
146
  } from "@uniformdev/canvas";
143
147
  import React6 from "react";
144
148
 
@@ -233,7 +237,7 @@ import React4, { createContext, useContext } from "react";
233
237
  import {
234
238
  createCanvasChannel,
235
239
  createUniformApiEnhancer,
236
- EMPTY_COMPOSITION,
240
+ EMPTY_COMPOSITION as EMPTY_COMPOSITION2,
237
241
  IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID,
238
242
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
239
243
  isAllowedReferrer,
@@ -258,7 +262,7 @@ var useUniformContextualEditing = ({
258
262
  return channel2;
259
263
  }, []);
260
264
  useEffect(() => {
261
- if ((contextualComposition == null ? void 0 : contextualComposition._id) && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== EMPTY_COMPOSITION._id && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== (contextualComposition == null ? void 0 : contextualComposition._id)) {
265
+ if ((contextualComposition == null ? void 0 : contextualComposition._id) && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== EMPTY_COMPOSITION2._id && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== (contextualComposition == null ? void 0 : contextualComposition._id)) {
262
266
  setContextualComposition(void 0);
263
267
  return;
264
268
  }
@@ -385,7 +389,6 @@ function ContextualEditingComponentWrapper({
385
389
  slotChildrenCount,
386
390
  isReadOnly
387
391
  },
388
- isContextualEditing && /* @__PURE__ */ React5.createElement(React5.Fragment, null),
389
392
  isPlaceholder && emptyPlaceholder !== void 0 ? emptyPlaceholder : children
390
393
  );
391
394
  }
@@ -405,7 +408,7 @@ function UniformSlot({
405
408
  }
406
409
  const slot = (_a = parentData.slots) == null ? void 0 : _a[name];
407
410
  if (!slot || !Array.isArray(slot)) {
408
- if (process.env.NODE_ENV === "development" && parentData.type !== EMPTY_COMPOSITION2.type) {
411
+ if (process.env.NODE_ENV === "development" && parentData.type !== EMPTY_COMPOSITION3.type) {
409
412
  console.warn(
410
413
  `[canvas-dev] slot '${name}' was rendered, but it was not defined on its component. This is expected if the slot is optional, otherwise it may indicate a typo. Component:`,
411
414
  parentData
@@ -596,7 +599,7 @@ function resolveChildren({
596
599
  }
597
600
 
598
601
  // src/components/UniformPlayground.tsx
599
- import { EMPTY_COMPOSITION as EMPTY_COMPOSITION3 } from "@uniformdev/canvas";
602
+ import { EMPTY_COMPOSITION as EMPTY_COMPOSITION4 } from "@uniformdev/canvas";
600
603
  import React8, { useMemo as useMemo2 } from "react";
601
604
  var UniformPlayground = ({
602
605
  resolveRenderer,
@@ -607,7 +610,7 @@ var UniformPlayground = ({
607
610
  children
608
611
  }) => {
609
612
  const { composition, isContextualEditing } = useUniformContextualEditing({
610
- initialCompositionValue: EMPTY_COMPOSITION3,
613
+ initialCompositionValue: EMPTY_COMPOSITION4,
611
614
  enhance: contextualEditingEnhancer
612
615
  });
613
616
  const renderedComponent = useMemo2(() => {
package/dist/index.js CHANGED
@@ -78,6 +78,9 @@ function DefaultNotImplementedComponent(props) {
78
78
  if (!componentType) {
79
79
  return null;
80
80
  }
81
+ if (componentType === import_canvas.EMPTY_COMPOSITION.type) {
82
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("style", null, `@keyframes _uniformDelayedFadeIn { 0%,75% { opacity: 0; } to { opacity: 1; } }`), /* @__PURE__ */ import_react.default.createElement("p", { style: { animation: "_uniformDelayedFadeIn 3s" } }, "This component only works inside Uniform Canvas editor.", /* @__PURE__ */ import_react.default.createElement("br", null), "If you think this is an error, try", " ", /* @__PURE__ */ import_react.default.createElement("a", { href: "", style: { fontWeight: "bolder", textDecoration: "underline" } }, "reloading the page"), "."));
83
+ }
81
84
  if (componentType === import_canvas.CANVAS_LOCALIZATION_TYPE) {
82
85
  return /* @__PURE__ */ import_react.default.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ import_react.default.createElement("p", null, "Seems like localization is not enabled in your application. Please read our documentation on how to", " ", /* @__PURE__ */ import_react.default.createElement(
83
86
  "a",
@@ -159,7 +162,8 @@ var createComponentStore = () => {
159
162
  },
160
163
  get: (type, variantId) => {
161
164
  return components.get(getTypeWithVariant(type, variantId));
162
- }
165
+ },
166
+ getComponentsMap: () => new Map(components)
163
167
  };
164
168
  };
165
169
  var createComponentStoreResolver = ({ store, defaultComponent = DefaultNotImplementedComponent }) => {
@@ -417,7 +421,6 @@ function ContextualEditingComponentWrapper({
417
421
  slotChildrenCount,
418
422
  isReadOnly
419
423
  },
420
- isContextualEditing && /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null),
421
424
  isPlaceholder && emptyPlaceholder !== void 0 ? emptyPlaceholder : children
422
425
  );
423
426
  }
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  // src/components/DefaultNotImplementedComponent.tsx
4
- import { CANVAS_LOCALIZATION_TYPE } from "@uniformdev/canvas";
4
+ import { CANVAS_LOCALIZATION_TYPE, EMPTY_COMPOSITION } from "@uniformdev/canvas";
5
5
  import React from "react";
6
6
  var wrapperStyles = {
7
7
  display: "flex",
@@ -21,6 +21,9 @@ function DefaultNotImplementedComponent(props) {
21
21
  if (!componentType) {
22
22
  return null;
23
23
  }
24
+ if (componentType === EMPTY_COMPOSITION.type) {
25
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, `@keyframes _uniformDelayedFadeIn { 0%,75% { opacity: 0; } to { opacity: 1; } }`), /* @__PURE__ */ React.createElement("p", { style: { animation: "_uniformDelayedFadeIn 3s" } }, "This component only works inside Uniform Canvas editor.", /* @__PURE__ */ React.createElement("br", null), "If you think this is an error, try", " ", /* @__PURE__ */ React.createElement("a", { href: "", style: { fontWeight: "bolder", textDecoration: "underline" } }, "reloading the page"), "."));
26
+ }
24
27
  if (componentType === CANVAS_LOCALIZATION_TYPE) {
25
28
  return /* @__PURE__ */ React.createElement("div", { style: wrapperStyles }, /* @__PURE__ */ React.createElement("p", null, "Seems like localization is not enabled in your application. Please read our documentation on how to", " ", /* @__PURE__ */ React.createElement(
26
29
  "a",
@@ -104,7 +107,8 @@ var createComponentStore = () => {
104
107
  },
105
108
  get: (type, variantId) => {
106
109
  return components.get(getTypeWithVariant(type, variantId));
107
- }
110
+ },
111
+ getComponentsMap: () => new Map(components)
108
112
  };
109
113
  };
110
114
  var createComponentStoreResolver = ({ store, defaultComponent = DefaultNotImplementedComponent }) => {
@@ -138,7 +142,7 @@ import {
138
142
  CANVAS_PERSONALIZE_TYPE,
139
143
  CANVAS_TEST_SLOT,
140
144
  CANVAS_TEST_TYPE,
141
- EMPTY_COMPOSITION as EMPTY_COMPOSITION2
145
+ EMPTY_COMPOSITION as EMPTY_COMPOSITION3
142
146
  } from "@uniformdev/canvas";
143
147
  import React6 from "react";
144
148
 
@@ -233,7 +237,7 @@ import React4, { createContext, useContext } from "react";
233
237
  import {
234
238
  createCanvasChannel,
235
239
  createUniformApiEnhancer,
236
- EMPTY_COMPOSITION,
240
+ EMPTY_COMPOSITION as EMPTY_COMPOSITION2,
237
241
  IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID,
238
242
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
239
243
  isAllowedReferrer,
@@ -258,7 +262,7 @@ var useUniformContextualEditing = ({
258
262
  return channel2;
259
263
  }, []);
260
264
  useEffect(() => {
261
- if ((contextualComposition == null ? void 0 : contextualComposition._id) && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== EMPTY_COMPOSITION._id && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== (contextualComposition == null ? void 0 : contextualComposition._id)) {
265
+ if ((contextualComposition == null ? void 0 : contextualComposition._id) && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== EMPTY_COMPOSITION2._id && (initialCompositionValue == null ? void 0 : initialCompositionValue._id) !== (contextualComposition == null ? void 0 : contextualComposition._id)) {
262
266
  setContextualComposition(void 0);
263
267
  return;
264
268
  }
@@ -385,7 +389,6 @@ function ContextualEditingComponentWrapper({
385
389
  slotChildrenCount,
386
390
  isReadOnly
387
391
  },
388
- isContextualEditing && /* @__PURE__ */ React5.createElement(React5.Fragment, null),
389
392
  isPlaceholder && emptyPlaceholder !== void 0 ? emptyPlaceholder : children
390
393
  );
391
394
  }
@@ -405,7 +408,7 @@ function UniformSlot({
405
408
  }
406
409
  const slot = (_a = parentData.slots) == null ? void 0 : _a[name];
407
410
  if (!slot || !Array.isArray(slot)) {
408
- if (process.env.NODE_ENV === "development" && parentData.type !== EMPTY_COMPOSITION2.type) {
411
+ if (process.env.NODE_ENV === "development" && parentData.type !== EMPTY_COMPOSITION3.type) {
409
412
  console.warn(
410
413
  `[canvas-dev] slot '${name}' was rendered, but it was not defined on its component. This is expected if the slot is optional, otherwise it may indicate a typo. Component:`,
411
414
  parentData
@@ -596,7 +599,7 @@ function resolveChildren({
596
599
  }
597
600
 
598
601
  // src/components/UniformPlayground.tsx
599
- import { EMPTY_COMPOSITION as EMPTY_COMPOSITION3 } from "@uniformdev/canvas";
602
+ import { EMPTY_COMPOSITION as EMPTY_COMPOSITION4 } from "@uniformdev/canvas";
600
603
  import React8, { useMemo as useMemo2 } from "react";
601
604
  var UniformPlayground = ({
602
605
  resolveRenderer,
@@ -607,7 +610,7 @@ var UniformPlayground = ({
607
610
  children
608
611
  }) => {
609
612
  const { composition, isContextualEditing } = useUniformContextualEditing({
610
- initialCompositionValue: EMPTY_COMPOSITION3,
613
+ initialCompositionValue: EMPTY_COMPOSITION4,
611
614
  enhance: contextualEditingEnhancer
612
615
  });
613
616
  const renderedComponent = useMemo2(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-react",
3
- "version": "19.79.0",
3
+ "version": "19.79.1-alpha.13+608a273da",
4
4
  "description": "React SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -45,17 +45,17 @@
45
45
  "document": "api-extractor run --local"
46
46
  },
47
47
  "dependencies": {
48
- "@uniformdev/canvas": "19.79.0",
49
- "@uniformdev/context": "19.79.0",
50
- "@uniformdev/context-react": "19.79.0",
51
- "@uniformdev/richtext": "19.79.0"
48
+ "@uniformdev/canvas": "19.79.1-alpha.13+608a273da",
49
+ "@uniformdev/context": "19.79.1-alpha.13+608a273da",
50
+ "@uniformdev/context-react": "19.79.1-alpha.13+608a273da",
51
+ "@uniformdev/richtext": "19.79.1-alpha.13+608a273da"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": ">= 16 || 17 || 18",
55
55
  "react-dom": ">=16"
56
56
  },
57
57
  "devDependencies": {
58
- "@types/react": "18.2.21",
58
+ "@types/react": "18.2.40",
59
59
  "react": "18.2.0",
60
60
  "react-dom": "18.2.0"
61
61
  },
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "78f5ededbaa1a67d58d808eac23ab64769e14e10"
68
+ "gitHead": "608a273da87aa432f17b2c8ce15d747dadab0cd1"
69
69
  }