@developer_tribe/react-builder 1.2.24 → 1.2.25
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/attributes-editor/SpecialCategorySection.d.ts +2 -1
- package/dist/attributes-editor/attributesEditorModelTypes.d.ts +2 -0
- package/dist/build-components/BIcon/BIconProps.generated.d.ts +0 -2
- package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +0 -2
- package/dist/build-components/Button/ButtonProps.generated.d.ts +0 -2
- package/dist/build-components/Carousel/CarouselProps.generated.d.ts +0 -2
- package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +0 -2
- package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +0 -2
- package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +0 -2
- package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +0 -2
- package/dist/build-components/CountDown/CountDownProps.generated.d.ts +0 -2
- package/dist/build-components/Counter/CounterProps.generated.d.ts +0 -2
- package/dist/build-components/Image/ImageProps.generated.d.ts +0 -2
- package/dist/build-components/Main/MainProps.generated.d.ts +0 -2
- package/dist/build-components/NavigationBarColor/NavigationBarColorProps.generated.d.ts +0 -2
- package/dist/build-components/Onboard/OnboardProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallCounter/PaywallCounterProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +0 -2
- package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +0 -2
- package/dist/build-components/Separator/SeparatorProps.generated.d.ts +0 -2
- package/dist/build-components/StatusBarColor/StatusBarColorProps.generated.d.ts +0 -2
- package/dist/build-components/Text/TextProps.generated.d.ts +0 -2
- package/dist/build-components/patterns.generated.d.ts +76 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.web.cjs.js +4 -4
- package/dist/index.web.cjs.js.map +1 -1
- package/dist/index.web.esm.js +2 -2
- package/dist/index.web.esm.js.map +1 -1
- package/dist/pages/ProjectPage.d.ts +2 -2
- package/dist/pages/projectPageUtils.d.ts +7 -1
- package/dist/types/Project.d.ts +6 -0
- package/dist/utils/patterns.d.ts +2 -0
- package/package.json +1 -1
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +11 -2
- package/src/AttributesEditor.tsx +15 -4
- package/src/assets/meta.json +1 -1
- package/src/assets/samples/paywall-app-delete-offer.json +0 -1
- package/src/assets/samples/paywall-app-open-offer.json +0 -1
- package/src/assets/samples/paywall-back-offer.json +0 -1
- package/src/assets/samples/paywall-notification-offer.json +0 -1
- package/src/assets/samples/simple-2.json +0 -1
- package/src/attributes-editor/AttributesEditorView.tsx +43 -36
- package/src/attributes-editor/SpecialCategorySection.tsx +5 -3
- package/src/attributes-editor/attributesEditorModelTypes.ts +2 -0
- package/src/attributes-editor/useAttributesEditorModel.ts +6 -0
- package/src/build-components/BIcon/BIconProps.generated.ts +0 -2
- package/src/build-components/BIcon/pattern.json +5 -3
- package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +0 -2
- package/src/build-components/BackgroundImage/pattern.json +12 -4
- package/src/build-components/Button/ButtonProps.generated.ts +0 -2
- package/src/build-components/Button/pattern.json +5 -3
- package/src/build-components/Carousel/CarouselProps.generated.ts +0 -2
- package/src/build-components/Carousel/pattern.json +11 -5
- package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +0 -2
- package/src/build-components/CarouselButtons/pattern.json +11 -4
- package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +0 -2
- package/src/build-components/CarouselDots/pattern.json +5 -3
- package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +0 -2
- package/src/build-components/CarouselItem/pattern.json +6 -6
- package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +0 -2
- package/src/build-components/CarouselProvider/pattern.json +6 -5
- package/src/build-components/CountDown/CountDownProps.generated.ts +0 -2
- package/src/build-components/CountDown/pattern.json +6 -3
- package/src/build-components/Counter/CounterProps.generated.ts +0 -2
- package/src/build-components/Counter/pattern.json +5 -1
- package/src/build-components/Image/ImageProps.generated.ts +0 -2
- package/src/build-components/Image/pattern.json +5 -3
- package/src/build-components/Main/MainProps.generated.ts +0 -2
- package/src/build-components/Main/pattern.json +5 -3
- package/src/build-components/NavigationBarColor/NavigationBarColorProps.generated.ts +0 -2
- package/src/build-components/NavigationBarColor/pattern.json +5 -3
- package/src/build-components/Onboard/OnboardProps.generated.ts +0 -2
- package/src/build-components/Onboard/pattern.json +9 -7
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +0 -2
- package/src/build-components/OnboardButton/pattern.json +16 -5
- package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +0 -2
- package/src/build-components/OnboardButtons/pattern.json +17 -6
- package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +0 -2
- package/src/build-components/OnboardDot/pattern.json +5 -3
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +0 -2
- package/src/build-components/OnboardFooter/pattern.json +5 -3
- package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +0 -2
- package/src/build-components/OnboardImage/pattern.json +7 -3
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +0 -2
- package/src/build-components/OnboardItem/pattern.json +13 -5
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +0 -2
- package/src/build-components/OnboardProvider/pattern.json +10 -4
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +0 -2
- package/src/build-components/OnboardSubtitle/pattern.json +7 -6
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +0 -2
- package/src/build-components/OnboardTitle/pattern.json +7 -6
- package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +0 -2
- package/src/build-components/PaywallBackground/pattern.json +5 -5
- package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +0 -2
- package/src/build-components/PaywallCloseButton/pattern.json +6 -6
- package/src/build-components/PaywallCounter/PaywallCounterProps.generated.ts +0 -2
- package/src/build-components/PaywallCounter/pattern.json +6 -3
- package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +0 -2
- package/src/build-components/PaywallOptions/pattern.json +6 -6
- package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +0 -2
- package/src/build-components/PaywallProvider/pattern.json +5 -3
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +0 -2
- package/src/build-components/PaywallSubscribeButton/pattern.json +6 -6
- package/src/build-components/RadioButton/RadioButtonProps.generated.ts +0 -2
- package/src/build-components/RadioButton/pattern.json +5 -3
- package/src/build-components/Separator/SeparatorProps.generated.ts +0 -2
- package/src/build-components/Separator/pattern.json +5 -3
- package/src/build-components/StatusBarColor/StatusBarColorProps.generated.ts +0 -2
- package/src/build-components/StatusBarColor/pattern.json +5 -3
- package/src/build-components/Text/TextProps.generated.ts +0 -2
- package/src/build-components/Text/pattern.json +11 -5
- package/src/build-components/View/pattern.json +18 -4
- package/src/build-components/patterns.generated.ts +72 -70
- package/src/components/AttributesEditorPanel.tsx +48 -32
- package/src/components/Builder.tsx +4 -1
- package/src/index.ts +1 -1
- package/src/pages/ProjectPage.tsx +45 -22
- package/src/pages/projectPageUtils.ts +15 -1
- package/src/types/Project.ts +7 -0
- package/src/utils/patterns.ts +2 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Project, ProjectColors } from '../types/Project';
|
|
1
|
+
import type { Project, ProjectColors, ProjectMeta } from '../types/Project';
|
|
2
2
|
import { AppConfig } from '../types/PreviewConfig';
|
|
3
3
|
import type { LogLevel } from '../types/Project';
|
|
4
4
|
import type { Fonts } from '../types/Fonts';
|
|
5
5
|
export type ProjectPageProps = {
|
|
6
6
|
project: Project;
|
|
7
|
-
onSaveProject: (project:
|
|
7
|
+
onSaveProject: (project: ProjectMeta) => void;
|
|
8
8
|
appConfig?: AppConfig;
|
|
9
9
|
logLevel?: LogLevel;
|
|
10
10
|
projectColors?: ProjectColors;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { Project } from '../types/Project';
|
|
1
|
+
import type { Project, ProjectMeta } from '../types/Project';
|
|
2
2
|
import type { Node } from '../types/Node';
|
|
3
3
|
export declare function resolveProjectForSave(args: {
|
|
4
4
|
project: Project;
|
|
5
5
|
overrideProject?: Project | null;
|
|
6
6
|
data: Node;
|
|
7
7
|
}): Project;
|
|
8
|
+
/**
|
|
9
|
+
* Strips a full Project down to its essential persistence fields.
|
|
10
|
+
* Use before handing the project to onSaveProject so consumers only
|
|
11
|
+
* receive the canonical metadata (name, version, type, data).
|
|
12
|
+
*/
|
|
13
|
+
export declare function toProjectMeta(project: Project): ProjectMeta;
|
package/dist/types/Project.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ export interface ProjectBase<T> {
|
|
|
24
24
|
}
|
|
25
25
|
export interface Project extends ProjectBase<Node> {
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Lightweight subset of Project containing only the essential metadata
|
|
29
|
+
* needed for persistence (name, version, type, data).
|
|
30
|
+
* Excludes runtime/editor-only fields like appConfig and projectColors.
|
|
31
|
+
*/
|
|
32
|
+
export type ProjectMeta = Pick<Project, 'name' | 'version' | 'type' | 'data'>;
|
|
27
33
|
export type LogLevel = 'NONE' | 'ERROR' | 'WARN' | 'INFO' | 'VERBOSE';
|
|
28
34
|
export type LogSource = string;
|
|
29
35
|
export interface LogEntry {
|
package/dist/utils/patterns.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -120,11 +120,20 @@ async function validatePatternJson(componentDir, componentName) {
|
|
|
120
120
|
`[${componentName}] pattern.json -> 'pattern.children' must be one of: node | string | never`
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
// pattern.attributes is optional – components that only declare title/description
|
|
124
|
+
// (now at pattern level) may have no extra attributes at all.
|
|
125
|
+
if (
|
|
126
|
+
Object.prototype.hasOwnProperty.call(pattern, 'attributes') &&
|
|
127
|
+
(typeof pattern.attributes !== 'object' || pattern.attributes == null)
|
|
128
|
+
) {
|
|
124
129
|
return fail(
|
|
125
|
-
`[${componentName}] pattern.json -> 'pattern.attributes' must be an object`
|
|
130
|
+
`[${componentName}] pattern.json -> 'pattern.attributes' must be an object (or omitted)`
|
|
126
131
|
);
|
|
127
132
|
}
|
|
133
|
+
// Normalise missing attributes to empty object for the rest of the validation
|
|
134
|
+
if (!pattern.attributes) {
|
|
135
|
+
pattern.attributes = {};
|
|
136
|
+
}
|
|
128
137
|
|
|
129
138
|
// Helpers for validating custom types
|
|
130
139
|
const isPrimitive = t =>
|
package/src/AttributesEditor.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
2
|
import type { AttributesEditorProps } from './attributes-editor/attributesEditorModelTypes';
|
|
3
3
|
import { useLogRender } from './utils/useLogRender';
|
|
4
4
|
import { AttributesEditorView } from './attributes-editor/AttributesEditorView';
|
|
@@ -8,11 +8,22 @@ export function AttributesEditor(props: AttributesEditorProps) {
|
|
|
8
8
|
useLogRender('AttributesEditor');
|
|
9
9
|
const model = useAttributesEditorModel(props);
|
|
10
10
|
const titleValue = model.attributes?.title;
|
|
11
|
+
const hasTitleField = model.hasTitleField;
|
|
12
|
+
|
|
13
|
+
// Keep a stable ref so the effect doesn't re-run when the callback
|
|
14
|
+
// reference changes (which happens every render due to unstable onChange prop).
|
|
15
|
+
const handleAttributeChangeRef = useRef(model.handleAttributeChange);
|
|
16
|
+
handleAttributeChangeRef.current = model.handleAttributeChange;
|
|
17
|
+
|
|
11
18
|
useEffect(() => {
|
|
12
|
-
if (
|
|
13
|
-
|
|
19
|
+
if (
|
|
20
|
+
hasTitleField &&
|
|
21
|
+
typeof titleValue === 'string' &&
|
|
22
|
+
titleValue.length > 20
|
|
23
|
+
) {
|
|
24
|
+
handleAttributeChangeRef.current('title', titleValue.slice(0, 20));
|
|
14
25
|
}
|
|
15
|
-
}, [
|
|
26
|
+
}, [hasTitleField, titleValue]);
|
|
16
27
|
return <AttributesEditorView {...model} />;
|
|
17
28
|
}
|
|
18
29
|
|
package/src/assets/meta.json
CHANGED
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"type": "PaywallBackground",
|
|
69
69
|
"attributes": {
|
|
70
70
|
"src": "https://images.unsplash.com/photo-1496307042754-b4aa456c4a2d?auto=format&fit=crop&w=1200&q=80",
|
|
71
|
-
"resizeMode": "cover",
|
|
72
71
|
"description": "Paywall background.",
|
|
73
72
|
"title": "Paywall Background"
|
|
74
73
|
},
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"type": "PaywallBackground",
|
|
69
69
|
"attributes": {
|
|
70
70
|
"src": "https://images.unsplash.com/photo-1501785888041-af3ef285b470?auto=format&fit=crop&w=1200&q=80",
|
|
71
|
-
"resizeMode": "cover",
|
|
72
71
|
"description": "Paywall background.",
|
|
73
72
|
"title": "Paywall Background"
|
|
74
73
|
},
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"type": "PaywallBackground",
|
|
69
69
|
"attributes": {
|
|
70
70
|
"src": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?auto=format&fit=crop&w=1200&q=80",
|
|
71
|
-
"resizeMode": "cover",
|
|
72
71
|
"description": "Paywall background.",
|
|
73
72
|
"title": "Paywall Background"
|
|
74
73
|
},
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"type": "PaywallBackground",
|
|
69
69
|
"attributes": {
|
|
70
70
|
"src": "https://images.unsplash.com/photo-1469474968028-56623f02e42e?auto=format&fit=crop&w=1200&q=80",
|
|
71
|
-
"resizeMode": "cover",
|
|
72
71
|
"description": "Paywall background.",
|
|
73
72
|
"title": "Paywall Background"
|
|
74
73
|
},
|
|
@@ -63,6 +63,8 @@ export function AttributesEditorView(props: AttributesEditorViewProps) {
|
|
|
63
63
|
firstAvailableTab,
|
|
64
64
|
activeEntries,
|
|
65
65
|
activeSpecialSections,
|
|
66
|
+
hasTitleField,
|
|
67
|
+
hasDescriptionField,
|
|
66
68
|
hasStringChildren,
|
|
67
69
|
childrenValue,
|
|
68
70
|
handleChildrenChange,
|
|
@@ -94,37 +96,46 @@ export function AttributesEditorView(props: AttributesEditorViewProps) {
|
|
|
94
96
|
|
|
95
97
|
const titleValue = getAttributeValue('title');
|
|
96
98
|
const descriptionValue = getAttributeValue('description');
|
|
97
|
-
const
|
|
99
|
+
const showTopFields =
|
|
100
|
+
!isInvalidNode && (hasTitleField || hasDescriptionField);
|
|
101
|
+
const topFieldsSection = showTopFields ? (
|
|
98
102
|
<section className="attributes-editor__top-fields">
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
103
|
+
{hasTitleField ? (
|
|
104
|
+
<div className="attributes-editor__field-wrapper">
|
|
105
|
+
<label className="attributes-editor__field-label" htmlFor="title">
|
|
106
|
+
Title (max 20 characters for display purposes)
|
|
107
|
+
</label>
|
|
108
|
+
<input
|
|
109
|
+
id="title"
|
|
110
|
+
className="input"
|
|
111
|
+
type="text"
|
|
112
|
+
maxLength={20}
|
|
113
|
+
value={typeof titleValue === 'string' ? titleValue : ''}
|
|
114
|
+
onChange={(event) =>
|
|
115
|
+
handleAttributeChange('title', event.target.value)
|
|
116
|
+
}
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
) : null}
|
|
120
|
+
{hasDescriptionField ? (
|
|
121
|
+
<div className="attributes-editor__field-wrapper">
|
|
122
|
+
<label
|
|
123
|
+
className="attributes-editor__field-label"
|
|
124
|
+
htmlFor="description"
|
|
125
|
+
>
|
|
126
|
+
Description (for display purposes)
|
|
127
|
+
</label>
|
|
128
|
+
<input
|
|
129
|
+
id="description"
|
|
130
|
+
className="input"
|
|
131
|
+
type="text"
|
|
132
|
+
value={typeof descriptionValue === 'string' ? descriptionValue : ''}
|
|
133
|
+
onChange={(event) =>
|
|
134
|
+
handleAttributeChange('description', event.target.value)
|
|
135
|
+
}
|
|
136
|
+
/>
|
|
137
|
+
</div>
|
|
138
|
+
) : null}
|
|
128
139
|
</section>
|
|
129
140
|
) : null;
|
|
130
141
|
|
|
@@ -346,18 +357,14 @@ export function AttributesEditorView(props: AttributesEditorViewProps) {
|
|
|
346
357
|
);
|
|
347
358
|
}
|
|
348
359
|
|
|
349
|
-
const sectionAttributes =
|
|
350
|
-
section.meta?.category === 'style'
|
|
351
|
-
? ((styleBag ?? {}) as unknown as NodeDefaultAttribute)
|
|
352
|
-
: attributes;
|
|
353
|
-
|
|
354
360
|
return (
|
|
355
361
|
<SpecialCategorySection
|
|
356
362
|
key={section.key}
|
|
357
363
|
category={section.key}
|
|
358
364
|
entries={section.entries}
|
|
359
365
|
attributeMeta={attributeMeta}
|
|
360
|
-
attributes={
|
|
366
|
+
attributes={attributes}
|
|
367
|
+
getAttributeValue={getAttributeValue}
|
|
361
368
|
onAttributeChange={handleAttributeChange}
|
|
362
369
|
componentType={data?.type}
|
|
363
370
|
projectColors={projectColorsForPicker}
|
|
@@ -16,6 +16,7 @@ type SpecialCategorySectionProps = {
|
|
|
16
16
|
entries: SchemaEntry[];
|
|
17
17
|
attributeMeta?: AttributeMetaMap;
|
|
18
18
|
attributes: NodeDefaultAttribute;
|
|
19
|
+
getAttributeValue: (name: string) => unknown;
|
|
19
20
|
onAttributeChange: (name: string, value: unknown) => void;
|
|
20
21
|
componentType?: string;
|
|
21
22
|
projectColors?: ProjectColors;
|
|
@@ -41,6 +42,7 @@ export function SpecialCategorySection({
|
|
|
41
42
|
entries,
|
|
42
43
|
attributeMeta,
|
|
43
44
|
attributes,
|
|
45
|
+
getAttributeValue,
|
|
44
46
|
onAttributeChange,
|
|
45
47
|
componentType,
|
|
46
48
|
projectColors,
|
|
@@ -96,7 +98,7 @@ export function SpecialCategorySection({
|
|
|
96
98
|
const preferredScale = toPreferredScale(
|
|
97
99
|
attributeMeta?.[name]?.preferedScale,
|
|
98
100
|
);
|
|
99
|
-
const currentValue = (
|
|
101
|
+
const currentValue = getAttributeValue(name);
|
|
100
102
|
const isBoolean = isBooleanFieldType(type);
|
|
101
103
|
const fieldSlot = detectFieldSlot(name);
|
|
102
104
|
const wrapperClassNames = [
|
|
@@ -175,7 +177,7 @@ export function SpecialCategorySection({
|
|
|
175
177
|
const preferredScale = toPreferredScale(
|
|
176
178
|
attributeMeta?.[name]?.preferedScale,
|
|
177
179
|
);
|
|
178
|
-
const currentValue = (
|
|
180
|
+
const currentValue = getAttributeValue(name);
|
|
179
181
|
const isBoolean = isBooleanFieldType(type);
|
|
180
182
|
const fieldSlot = detectFieldSlot(name);
|
|
181
183
|
const wrapperClassNames = [
|
|
@@ -220,7 +222,7 @@ export function SpecialCategorySection({
|
|
|
220
222
|
const preferredScale = toPreferredScale(
|
|
221
223
|
attributeMeta?.[name]?.preferedScale,
|
|
222
224
|
);
|
|
223
|
-
const currentValue = (
|
|
225
|
+
const currentValue = getAttributeValue(name);
|
|
224
226
|
const isBoolean = isBooleanFieldType(type);
|
|
225
227
|
const wrapperClassNames = [
|
|
226
228
|
'attributes-editor__field-wrapper',
|
|
@@ -81,6 +81,8 @@ export type AttributesEditorModel = {
|
|
|
81
81
|
mockableFeatureKeys: string[];
|
|
82
82
|
activeMockableFeature: string | null;
|
|
83
83
|
setActiveMockableFeature: (next: string | null) => void;
|
|
84
|
+
hasTitleField: boolean;
|
|
85
|
+
hasDescriptionField: boolean;
|
|
84
86
|
hasStringChildren: boolean;
|
|
85
87
|
childrenValue: string;
|
|
86
88
|
};
|
|
@@ -217,6 +217,10 @@ export function useAttributesEditorModel({
|
|
|
217
217
|
const componentTitle = componentMeta?.label ?? data?.type ?? 'Component';
|
|
218
218
|
const componentDescription = componentMeta?.description;
|
|
219
219
|
|
|
220
|
+
const hasTitleField = patternForType?.pattern?.title === 'title';
|
|
221
|
+
const hasDescriptionField =
|
|
222
|
+
patternForType?.pattern?.description === 'description';
|
|
223
|
+
|
|
220
224
|
const entries = useMemo(() => {
|
|
221
225
|
return buildAttributesEditorEntries(schema, attributeMeta).filter(
|
|
222
226
|
({ type }) => (typeof type === 'string' ? type !== 'never' : true),
|
|
@@ -477,6 +481,8 @@ export function useAttributesEditorModel({
|
|
|
477
481
|
mockableFeatureKeys,
|
|
478
482
|
activeMockableFeature,
|
|
479
483
|
setActiveMockableFeature,
|
|
484
|
+
hasTitleField,
|
|
485
|
+
hasDescriptionField,
|
|
480
486
|
hasStringChildren,
|
|
481
487
|
childrenValue,
|
|
482
488
|
};
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "BIcon",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "Text",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"iconType": "iconType",
|
|
11
11
|
"size": "number",
|
|
12
12
|
"strokeWidth": "number"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"meta": {
|
|
16
|
-
"desiredParent": [
|
|
16
|
+
"desiredParent": [
|
|
17
|
+
"all"
|
|
18
|
+
],
|
|
17
19
|
"label": "BIcon",
|
|
18
20
|
"description": "Renders an icon from the icon set.",
|
|
19
21
|
"styles": {},
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "BackgroundImage",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"src": "string",
|
|
11
|
-
"resizeMode": [
|
|
11
|
+
"resizeMode": [
|
|
12
|
+
"cover",
|
|
13
|
+
"contain",
|
|
14
|
+
"stretch",
|
|
15
|
+
"center"
|
|
16
|
+
]
|
|
12
17
|
},
|
|
13
18
|
"defaults": {
|
|
14
19
|
"resizeMode": "cover",
|
|
@@ -24,7 +29,10 @@
|
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"meta": {
|
|
27
|
-
"desiredParent": [
|
|
32
|
+
"desiredParent": [
|
|
33
|
+
"all",
|
|
34
|
+
"background"
|
|
35
|
+
],
|
|
28
36
|
"label": "Background Image",
|
|
29
37
|
"description": "Background image.",
|
|
30
38
|
"styles": {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "Button",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "string",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"style": {
|
|
11
11
|
"color": "color",
|
|
12
12
|
"fontSize": "size",
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"meta": {
|
|
30
|
-
"desiredParent": [
|
|
30
|
+
"desiredParent": [
|
|
31
|
+
"all"
|
|
32
|
+
],
|
|
31
33
|
"label": "Button",
|
|
32
34
|
"description": "Simple action button.",
|
|
33
35
|
"styles": {
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
|
-
"extends": "View",
|
|
5
4
|
"type": "Carousel",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
7
|
+
"extends": "View",
|
|
6
8
|
"children": "node",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"loop": "boolean",
|
|
11
11
|
"dragFree": "boolean",
|
|
12
|
-
"align": [
|
|
12
|
+
"align": [
|
|
13
|
+
"start",
|
|
14
|
+
"center",
|
|
15
|
+
"end"
|
|
16
|
+
]
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"meta": {
|
|
16
|
-
"desiredParent": [
|
|
20
|
+
"desiredParent": [
|
|
21
|
+
"=CarouselProvider"
|
|
22
|
+
],
|
|
17
23
|
"label": "Carousel",
|
|
18
24
|
"description": "Container for carousel items.",
|
|
19
25
|
"styles": {}
|
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "CarouselButtons",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
"buttonType": [
|
|
11
|
+
"previous_button",
|
|
12
|
+
"next_button",
|
|
13
|
+
"skip_button"
|
|
14
|
+
],
|
|
11
15
|
"skipNumber": "number"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"meta": {
|
|
15
|
-
"desiredParent": [
|
|
19
|
+
"desiredParent": [
|
|
20
|
+
">OnboardProvider",
|
|
21
|
+
">CarouselProvider"
|
|
22
|
+
],
|
|
16
23
|
"label": "Carousel Buttons",
|
|
17
24
|
"description": "Renders built-in carousel buttons.",
|
|
18
25
|
"styles": {},
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "CarouselDots",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"dotType": [
|
|
11
11
|
"expanding_dot",
|
|
12
12
|
"normal_dot",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"meta": {
|
|
21
|
-
"desiredParent": [
|
|
21
|
+
"desiredParent": [
|
|
22
|
+
">CarouselProvider"
|
|
23
|
+
],
|
|
22
24
|
"label": "Carousel Dots",
|
|
23
25
|
"description": "Renders page indicator dots.",
|
|
24
26
|
"styles": {
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "CarouselItem",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "node",
|
|
6
|
-
"extends": "View"
|
|
7
|
-
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description"
|
|
10
|
-
}
|
|
8
|
+
"extends": "View"
|
|
11
9
|
},
|
|
12
10
|
"meta": {
|
|
13
|
-
"desiredParent": [
|
|
11
|
+
"desiredParent": [
|
|
12
|
+
"=Carousel"
|
|
13
|
+
],
|
|
14
14
|
"label": "Carousel Item",
|
|
15
15
|
"description": "Single slide inside a carousel.",
|
|
16
16
|
"styles": {}
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
"allowUnknownAttributes": false,
|
|
4
4
|
"pattern": {
|
|
5
5
|
"type": "CarouselProvider",
|
|
6
|
+
"title": "title",
|
|
7
|
+
"description": "description",
|
|
6
8
|
"children": "node",
|
|
7
9
|
"extends": "View",
|
|
8
|
-
"attributes": {
|
|
9
|
-
"title": "title",
|
|
10
|
-
"description": "description"
|
|
11
|
-
},
|
|
12
10
|
"defaults": {
|
|
13
11
|
"style": {
|
|
14
12
|
"width": "100%",
|
|
@@ -17,7 +15,10 @@
|
|
|
17
15
|
}
|
|
18
16
|
},
|
|
19
17
|
"meta": {
|
|
20
|
-
"desiredParent": [
|
|
18
|
+
"desiredParent": [
|
|
19
|
+
"root",
|
|
20
|
+
">View"
|
|
21
|
+
],
|
|
21
22
|
"label": "Carousel Provider",
|
|
22
23
|
"description": "Provides carousel context to its children.",
|
|
23
24
|
"attributes": {}
|