@uniformdev/canvas-react 19.55.1-alpha.8 → 19.55.2-alpha.14
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/dist/PureUniformText-37defdc5.d.ts +41 -0
- package/dist/core.d.mts +12 -38
- package/dist/core.d.ts +12 -38
- package/dist/core.js +41 -5
- package/dist/core.mjs +43 -3
- package/dist/index.d.mts +22 -4
- package/dist/index.d.ts +22 -4
- package/dist/index.esm.js +140 -82
- package/dist/index.js +184 -132
- package/dist/index.mjs +140 -82
- package/package.json +6 -6
|
@@ -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 { PureUniformTextProps as P, PureUniformText as a };
|
package/dist/core.d.mts
CHANGED
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
import { ComponentInstance } from '@uniformdev/canvas';
|
|
1
|
+
import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
export { a as PureUniformText, P as PureUniformTextProps } from './PureUniformText-37defdc5.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
5
|
+
declare const PureContextualEditingComponentWrapper: ({ children, isPlaceholder, parentComponent, component, slotName, indexInSlot, slotChildrenCount, isReadOnly, }: React.PropsWithChildren<{
|
|
6
|
+
isPlaceholder: boolean | undefined;
|
|
7
|
+
parentComponent: ComponentInstance | undefined;
|
|
8
|
+
component: ComponentInstance | RootComponentInstance;
|
|
9
|
+
slotName: string | undefined;
|
|
10
|
+
indexInSlot: number | undefined;
|
|
11
|
+
slotChildrenCount: number | undefined;
|
|
12
|
+
isReadOnly: string | undefined;
|
|
13
|
+
}>) => React.JSX.Element;
|
|
40
14
|
|
|
41
|
-
export {
|
|
15
|
+
export { PureContextualEditingComponentWrapper };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
import { ComponentInstance } from '@uniformdev/canvas';
|
|
1
|
+
import { ComponentInstance, RootComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
export { a as PureUniformText, P as PureUniformTextProps } from './PureUniformText-37defdc5.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
5
|
+
declare const PureContextualEditingComponentWrapper: ({ children, isPlaceholder, parentComponent, component, slotName, indexInSlot, slotChildrenCount, isReadOnly, }: React.PropsWithChildren<{
|
|
6
|
+
isPlaceholder: boolean | undefined;
|
|
7
|
+
parentComponent: ComponentInstance | undefined;
|
|
8
|
+
component: ComponentInstance | RootComponentInstance;
|
|
9
|
+
slotName: string | undefined;
|
|
10
|
+
indexInSlot: number | undefined;
|
|
11
|
+
slotChildrenCount: number | undefined;
|
|
12
|
+
isReadOnly: string | undefined;
|
|
13
|
+
}>) => React.JSX.Element;
|
|
40
14
|
|
|
41
|
-
export {
|
|
15
|
+
export { PureContextualEditingComponentWrapper };
|
package/dist/core.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -30,18 +31,52 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
31
|
// src/core.ts
|
|
31
32
|
var core_exports = {};
|
|
32
33
|
__export(core_exports, {
|
|
34
|
+
PureContextualEditingComponentWrapper: () => PureContextualEditingComponentWrapper,
|
|
33
35
|
PureUniformText: () => PureUniformText
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(core_exports);
|
|
36
38
|
|
|
37
|
-
// src/components/
|
|
39
|
+
// src/components/PureContextualEditingComponentWrapper.tsx
|
|
40
|
+
var import_canvas = require("@uniformdev/canvas");
|
|
38
41
|
var import_react = __toESM(require("react"));
|
|
42
|
+
var PureContextualEditingComponentWrapper = ({
|
|
43
|
+
children,
|
|
44
|
+
isPlaceholder,
|
|
45
|
+
parentComponent,
|
|
46
|
+
component,
|
|
47
|
+
slotName,
|
|
48
|
+
indexInSlot,
|
|
49
|
+
slotChildrenCount,
|
|
50
|
+
isReadOnly
|
|
51
|
+
}) => {
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
54
|
+
"script",
|
|
55
|
+
{
|
|
56
|
+
"data-role": import_canvas.IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
57
|
+
"data-parent-id": parentComponent == null ? void 0 : parentComponent._id,
|
|
58
|
+
"data-parent-type": parentComponent == null ? void 0 : parentComponent.type,
|
|
59
|
+
"data-component-id": component == null ? void 0 : component._id,
|
|
60
|
+
"data-slot-name": slotName != null ? slotName : "",
|
|
61
|
+
"data-component-index": indexInSlot != null ? indexInSlot : "",
|
|
62
|
+
"data-total-components": slotChildrenCount != null ? slotChildrenCount : "",
|
|
63
|
+
"data-component-name": component == null ? void 0 : component.type,
|
|
64
|
+
"data-is-placeholder": isPlaceholder ? "true" : void 0,
|
|
65
|
+
"data-is-localized": ((_a = component == null ? void 0 : component.parameters) == null ? void 0 : _a[import_canvas.CANVAS_LOCALE_TAG_PARAM]) ? "true" : void 0,
|
|
66
|
+
"data-component-title": (_d = (_c = (_b = component == null ? void 0 : component.parameters) == null ? void 0 : _b.title) == null ? void 0 : _c.value) != null ? _d : "",
|
|
67
|
+
"data-is-readonly": isReadOnly
|
|
68
|
+
}
|
|
69
|
+
), children, /* @__PURE__ */ import_react.default.createElement("script", { "data-role": import_canvas.IN_CONTEXT_EDITOR_COMPONENT_END_ROLE }));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/components/PureUniformText.tsx
|
|
73
|
+
var import_react2 = __toESM(require("react"));
|
|
39
74
|
|
|
40
75
|
// src/helpers/getParameterAttributes.ts
|
|
41
|
-
var
|
|
76
|
+
var import_canvas2 = require("@uniformdev/canvas");
|
|
42
77
|
var getParameterAttributes = (options) => {
|
|
43
78
|
return {
|
|
44
|
-
...(0,
|
|
79
|
+
...(0, import_canvas2.getParameterAttributes)(options),
|
|
45
80
|
suppressContentEditableWarning: true
|
|
46
81
|
};
|
|
47
82
|
};
|
|
@@ -65,10 +100,10 @@ var PureUniformText = ({
|
|
|
65
100
|
return null;
|
|
66
101
|
}
|
|
67
102
|
if (!isContextualEditing) {
|
|
68
|
-
return /* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ import_react2.default.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
69
104
|
}
|
|
70
105
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
71
|
-
return /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ import_react2.default.createElement(
|
|
72
107
|
Tag,
|
|
73
108
|
{
|
|
74
109
|
...props,
|
|
@@ -86,5 +121,6 @@ var PureUniformText = ({
|
|
|
86
121
|
};
|
|
87
122
|
// Annotate the CommonJS export names for ESM import in node:
|
|
88
123
|
0 && (module.exports = {
|
|
124
|
+
PureContextualEditingComponentWrapper,
|
|
89
125
|
PureUniformText
|
|
90
126
|
});
|
package/dist/core.mjs
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/components/PureContextualEditingComponentWrapper.tsx
|
|
4
|
+
import {
|
|
5
|
+
CANVAS_LOCALE_TAG_PARAM,
|
|
6
|
+
IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
|
|
7
|
+
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE
|
|
8
|
+
} from "@uniformdev/canvas";
|
|
2
9
|
import React from "react";
|
|
10
|
+
var PureContextualEditingComponentWrapper = ({
|
|
11
|
+
children,
|
|
12
|
+
isPlaceholder,
|
|
13
|
+
parentComponent,
|
|
14
|
+
component,
|
|
15
|
+
slotName,
|
|
16
|
+
indexInSlot,
|
|
17
|
+
slotChildrenCount,
|
|
18
|
+
isReadOnly
|
|
19
|
+
}) => {
|
|
20
|
+
var _a, _b, _c, _d;
|
|
21
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
22
|
+
"script",
|
|
23
|
+
{
|
|
24
|
+
"data-role": IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
|
25
|
+
"data-parent-id": parentComponent == null ? void 0 : parentComponent._id,
|
|
26
|
+
"data-parent-type": parentComponent == null ? void 0 : parentComponent.type,
|
|
27
|
+
"data-component-id": component == null ? void 0 : component._id,
|
|
28
|
+
"data-slot-name": slotName != null ? slotName : "",
|
|
29
|
+
"data-component-index": indexInSlot != null ? indexInSlot : "",
|
|
30
|
+
"data-total-components": slotChildrenCount != null ? slotChildrenCount : "",
|
|
31
|
+
"data-component-name": component == null ? void 0 : component.type,
|
|
32
|
+
"data-is-placeholder": isPlaceholder ? "true" : void 0,
|
|
33
|
+
"data-is-localized": ((_a = component == null ? void 0 : component.parameters) == null ? void 0 : _a[CANVAS_LOCALE_TAG_PARAM]) ? "true" : void 0,
|
|
34
|
+
"data-component-title": (_d = (_c = (_b = component == null ? void 0 : component.parameters) == null ? void 0 : _b.title) == null ? void 0 : _c.value) != null ? _d : "",
|
|
35
|
+
"data-is-readonly": isReadOnly
|
|
36
|
+
}
|
|
37
|
+
), children, /* @__PURE__ */ React.createElement("script", { "data-role": IN_CONTEXT_EDITOR_COMPONENT_END_ROLE }));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/components/PureUniformText.tsx
|
|
41
|
+
import React2 from "react";
|
|
3
42
|
|
|
4
43
|
// src/helpers/getParameterAttributes.ts
|
|
5
44
|
import {
|
|
@@ -31,10 +70,10 @@ var PureUniformText = ({
|
|
|
31
70
|
return null;
|
|
32
71
|
}
|
|
33
72
|
if (!isContextualEditing) {
|
|
34
|
-
return /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ React2.createElement(Tag, { style: isMultiline ? { whiteSpace: "pre-wrap" } : {}, ...props }, render(value));
|
|
35
74
|
}
|
|
36
75
|
const computedPlaceholder = typeof placeholder === "function" ? placeholder({ id: parameterId }) : placeholder;
|
|
37
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ React2.createElement(
|
|
38
77
|
Tag,
|
|
39
78
|
{
|
|
40
79
|
...props,
|
|
@@ -51,5 +90,6 @@ var PureUniformText = ({
|
|
|
51
90
|
);
|
|
52
91
|
};
|
|
53
92
|
export {
|
|
93
|
+
PureContextualEditingComponentWrapper,
|
|
54
94
|
PureUniformText
|
|
55
95
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
|
|
2
|
-
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
3
2
|
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
|
|
4
3
|
export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
|
|
5
|
-
import { PureUniformTextProps } from './
|
|
4
|
+
import { P as PureUniformTextProps } from './PureUniformText-37defdc5.js';
|
|
6
5
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -352,6 +351,14 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
352
351
|
/** Renders a named Slot within a Composition. */
|
|
353
352
|
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, children, emptyPlaceholder, wrapperComponent, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
|
|
354
353
|
|
|
354
|
+
/**
|
|
355
|
+
* Converts a raw Canvas component instance to React component props format.
|
|
356
|
+
* This merges each parameter moved to the root object and removes the 'value' node,
|
|
357
|
+
* hugely simplifying rendering code. For example if the raw object has parameters.foo.value,
|
|
358
|
+
* then the final props have props.foo === raw.parameters.foo.value.
|
|
359
|
+
*/
|
|
360
|
+
declare function convertComponentToProps<T = unknown>(component: ComponentInstance): ComponentProps<T>;
|
|
361
|
+
|
|
355
362
|
/**
|
|
356
363
|
* Returns the attributes needed to annotate a Uniform parameter for inline editing.
|
|
357
364
|
* Supports only text parameters at the moment.
|
|
@@ -380,7 +387,18 @@ type UseUniformContextualEditingStateProps = {
|
|
|
380
387
|
*/
|
|
381
388
|
declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
|
|
382
389
|
isContextualEditing: boolean;
|
|
383
|
-
selectedComponentReference:
|
|
390
|
+
selectedComponentReference: {
|
|
391
|
+
id: string;
|
|
392
|
+
slotName?: string | undefined;
|
|
393
|
+
componentIndex?: number | undefined;
|
|
394
|
+
totalComponents?: number | undefined;
|
|
395
|
+
componentName?: string | undefined;
|
|
396
|
+
componentTitle?: string | undefined;
|
|
397
|
+
parentId?: string | undefined;
|
|
398
|
+
parentType?: string | undefined;
|
|
399
|
+
isLocalized?: boolean | undefined;
|
|
400
|
+
isReadOnly?: boolean | undefined;
|
|
401
|
+
} | undefined;
|
|
384
402
|
};
|
|
385
403
|
|
|
386
404
|
declare const componentStore: ComponentStore;
|
|
@@ -399,4 +417,4 @@ declare const createComponentStoreResolver: (options: {
|
|
|
399
417
|
defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
|
|
400
418
|
}) => RenderComponentResolver;
|
|
401
419
|
|
|
402
|
-
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, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React$1, { Key, ReactNode, PropsWithChildren } from 'react';
|
|
2
|
-
import * as _uniformdev_canvas from '@uniformdev/canvas';
|
|
3
2
|
import { ComponentInstance, RootComponentInstance, UpdateCompositionMessage, getParameterAttributes as getParameterAttributes$1, SubscribeToCompositionOptions } from '@uniformdev/canvas';
|
|
4
3
|
export { GetParameterAttributesProps, createUniformApiEnhancer } from '@uniformdev/canvas';
|
|
5
|
-
import { PureUniformTextProps } from './
|
|
4
|
+
import { P as PureUniformTextProps } from './PureUniformText-37defdc5.js';
|
|
6
5
|
import { RichTextNode } from '@uniformdev/richtext';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -352,6 +351,14 @@ type UniformSlotProps<TSlotNames extends string> = {
|
|
|
352
351
|
/** Renders a named Slot within a Composition. */
|
|
353
352
|
declare function UniformSlot<TSlotNames extends string = string>({ name, resolveRenderer, children, emptyPlaceholder, wrapperComponent, }: UniformSlotProps<TSlotNames>): JSX.Element | null;
|
|
354
353
|
|
|
354
|
+
/**
|
|
355
|
+
* Converts a raw Canvas component instance to React component props format.
|
|
356
|
+
* This merges each parameter moved to the root object and removes the 'value' node,
|
|
357
|
+
* hugely simplifying rendering code. For example if the raw object has parameters.foo.value,
|
|
358
|
+
* then the final props have props.foo === raw.parameters.foo.value.
|
|
359
|
+
*/
|
|
360
|
+
declare function convertComponentToProps<T = unknown>(component: ComponentInstance): ComponentProps<T>;
|
|
361
|
+
|
|
355
362
|
/**
|
|
356
363
|
* Returns the attributes needed to annotate a Uniform parameter for inline editing.
|
|
357
364
|
* Supports only text parameters at the moment.
|
|
@@ -380,7 +387,18 @@ type UseUniformContextualEditingStateProps = {
|
|
|
380
387
|
*/
|
|
381
388
|
declare const useUniformContextualEditingState: ({ global, }?: UseUniformContextualEditingStateProps) => {
|
|
382
389
|
isContextualEditing: boolean;
|
|
383
|
-
selectedComponentReference:
|
|
390
|
+
selectedComponentReference: {
|
|
391
|
+
id: string;
|
|
392
|
+
slotName?: string | undefined;
|
|
393
|
+
componentIndex?: number | undefined;
|
|
394
|
+
totalComponents?: number | undefined;
|
|
395
|
+
componentName?: string | undefined;
|
|
396
|
+
componentTitle?: string | undefined;
|
|
397
|
+
parentId?: string | undefined;
|
|
398
|
+
parentType?: string | undefined;
|
|
399
|
+
isLocalized?: boolean | undefined;
|
|
400
|
+
isReadOnly?: boolean | undefined;
|
|
401
|
+
} | undefined;
|
|
384
402
|
};
|
|
385
403
|
|
|
386
404
|
declare const componentStore: ComponentStore;
|
|
@@ -399,4 +417,4 @@ declare const createComponentStoreResolver: (options: {
|
|
|
399
417
|
defaultComponent?: React$1.ComponentType<ComponentProps<any>>;
|
|
400
418
|
}) => RenderComponentResolver;
|
|
401
419
|
|
|
402
|
-
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, createComponentStore, createComponentStoreResolver, getParameterAttributes, registerUniformComponent, useCompositionEventEffect, useUniformContextualEditing, useUniformContextualEditingState, useUniformCurrentComponent, useUniformCurrentComposition };
|
|
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 };
|