@wix/agent-skills 1.18.1 → 1.19.0
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/package.json +1 -1
- package/skills/wix-app/SKILL.md +13 -13
- package/skills/wix-app/references/APP_VALIDATION.md +7 -33
- package/skills/wix-app/references/BACKEND_API.md +151 -152
- package/skills/wix-app/references/DASHBOARD_PAGE.md +18 -14
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +6 -3
- package/skills/wix-app/references/EXTENSION_REGISTRATION.md +12 -8
- package/skills/wix-app/references/WIX_PATTERNS_DOCS.md +23 -26
- package/skills/wix-app/references/dashboard-page/COLLECTION_TOOLKIT.md +7 -6
- package/skills/wix-app/references/dashboard-page/ENTITY_PAGE_TOOLKIT.md +71 -4
- package/skills/wix-app/references/dashboard-page/PATTERNS_BUNDLE_READING.md +67 -7
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -1
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +9 -6
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONTRACT.md +59 -89
- package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +23 -4
- package/skills/wix-base44-connector/SKILL.md +168 -48
- package/skills/wix-base44-connector/scripts/{utils.js → utils.cjs} +69 -48
- package/skills/wix-docs/SKILL.md +109 -111
- package/skills/wix-docs/references/API_SPEC_SEARCH.md +35 -23
- package/skills/wix-docs/references/CALLING.md +91 -0
- package/skills/wix-docs/references/EXTRACTING.md +5 -3
- package/skills/wix-headless/references/DOC_DISCOVERY.md +9 -3
- package/skills/wix-manage/SKILL.md +8 -2
- package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +59 -33
- package/skills/wix-manage/references/bookings/bookings-staff-setup.md +45 -22
- package/skills/wix-manage/references/bookings/multi-resource-service-creation.md +70 -12
- package/skills/wix-manage/references/calendar/configure-default-business-hours.md +53 -17
- package/skills/wix-manage/references/seo/manage-content-plan.md +247 -0
- package/skills/wix-manage/references/seo/manage-seo-tags.md +59 -6
- package/skills/wix-manage/references/stores/change-store-currency.md +10 -0
- package/skills/wix-manage/references/stores/create-product-catalog-v3.md +17 -1
- package/skills/wix-manage/references/stores/update-product-with-options.md +9 -0
- package/skills/wix-vibe-headless/SKILL.md +17 -18
- package/skills/wix-vibe-headless/install/pin-agents-md.cjs +1 -1
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed-with-install.md +119 -0
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +61 -67
- package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +31 -29
- package/skills/wix-vibe-headless/platforms/base44.md +18 -7
- package/skills/wix-vibe-headless/platforms/generic.md +13 -12
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +4 -13
- package/skills/wix-vibe-headless/references/blog/seed/SEED.md +4 -8
- package/skills/wix-vibe-headless/references/blog/seed/{seed-blog.js → seed-blog.cjs} +2 -3
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +5 -14
- package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +5 -9
- package/skills/wix-vibe-headless/references/bookings/seed/{seed-bookings.js → seed-bookings.cjs} +2 -2
- package/skills/wix-vibe-headless/references/bookings/seed/{seed-rentals.js → seed-rentals.cjs} +3 -3
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +1 -1
- package/skills/wix-vibe-headless/references/cms/seed/SEED.md +2 -2
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +4 -13
- package/skills/wix-vibe-headless/references/events/seed/SEED.md +3 -7
- package/skills/wix-vibe-headless/references/events/seed/{seed-events.js → seed-events.cjs} +2 -2
- package/skills/wix-vibe-headless/references/forms/INSTRUCTIONS.md +2 -1
- package/skills/wix-vibe-headless/references/forms/seed/SEED.md +1 -1
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +4 -13
- package/skills/wix-vibe-headless/references/members/seed/SEED.md +2 -3
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +4 -13
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectMedia.jsx +1 -1
- package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +3 -7
- package/skills/wix-vibe-headless/references/portfolio/seed/{seed-portfolio.js → seed-portfolio.cjs} +2 -2
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +5 -14
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/OrderCard.jsx +1 -1
- package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +3 -7
- package/skills/wix-vibe-headless/references/pricing-plans/seed/{seed-pricing-plans.js → seed-pricing-plans.cjs} +2 -2
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +5 -15
- package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +3 -7
- package/skills/wix-vibe-headless/references/restaurants/seed/{seed-restaurants.js → seed-restaurants.cjs} +2 -2
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +363 -327
- package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +1 -0
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +2 -2
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useShop.js +63 -78
- package/skills/wix-vibe-headless/references/storefront/app/rest/wix-store-catalog.js +59 -43
- package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +51 -14
- package/skills/wix-vibe-headless/references/storefront/seed/{seed-store.js → seed-store.cjs} +194 -28
- package/skills/wix-vibe-headless/references/storefront/app/pages/Shop.jsx +0 -75
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Animated Components
|
|
2
2
|
|
|
3
|
-
Use this reference when the component's primary content
|
|
4
|
-
|
|
5
|
-
or a video-like surface.
|
|
3
|
+
Use this reference when the component's primary content **auto-advances or plays**
|
|
4
|
+
— a slideshow/carousel/slider; a Lottie/JSON animation; an animated GIF/SVG, a canvas/WebGL loop, a video-like surface; or similar content a visitor should be able to start or stop.
|
|
6
5
|
|
|
7
6
|
Every such component must ship an on-stage **play/pause button**.
|
|
8
7
|
|
|
@@ -22,7 +21,7 @@ Apply automatically — without being asked — whenever the component has an
|
|
|
22
21
|
`autoPlay` prop **or** its primary content is a **startable / loopable**
|
|
23
22
|
animation a visitor would reasonably want to start or stop:
|
|
24
23
|
|
|
25
|
-
-
|
|
24
|
+
- Slideshow, carousel, slider, or gallery that advances slides/cards
|
|
26
25
|
- Lottie / JSON vector animations
|
|
27
26
|
- Animated GIFs or animated SVGs
|
|
28
27
|
- Canvas / WebGL animation loops
|
|
@@ -40,6 +39,8 @@ implementation detail.
|
|
|
40
39
|
automatically, `loop` only when repeat behavior is supported, and
|
|
41
40
|
`pauseButtonVisibility` for the on-stage control. When editing, preserve
|
|
42
41
|
existing playback prop names and add only the missing safety contract.
|
|
42
|
+
Carousels, sliders, slideshows, and galleries **must** define `autoPlay`
|
|
43
|
+
(default `true`).
|
|
43
44
|
2. **Playback state** — `isPlaying` + `handlePause` / `handleResume`
|
|
44
45
|
3. **Play/pause button** — overlay `<button>` with inline SVG icon and CSS
|
|
45
46
|
positioning; it must be a named part with `elementProps` wiring, a hover
|
|
@@ -57,7 +58,7 @@ able to force the safety control visible.
|
|
|
57
58
|
import type { A11y, Direction } from '@wix/editor-react-types';
|
|
58
59
|
|
|
59
60
|
export interface MyAnimationProps {
|
|
60
|
-
id
|
|
61
|
+
id: string;
|
|
61
62
|
className?: string;
|
|
62
63
|
direction?: Direction;
|
|
63
64
|
a11y?: A11y;
|
|
@@ -215,7 +216,9 @@ Add `useIsEditMode` to the existing `@wix/react-component-utils` import. Then
|
|
|
215
216
|
edit only the body of the existing `ComponentNamePreview` function — add the
|
|
216
217
|
`isEditMode` check and gate the autoplay props. Do not touch the
|
|
217
218
|
`withFallbackPlaceholder` call, the `withDefaults` export, or any other part
|
|
218
|
-
of the file.
|
|
219
|
+
of the file. The composition must keep `withDefaults` outside
|
|
220
|
+
`withFallbackPlaceholder`, whether the calls are nested inline or assigned to
|
|
221
|
+
component variables.
|
|
219
222
|
|
|
220
223
|
```tsx
|
|
221
224
|
const ComponentNamePreview: FC<ComponentProps<typeof Component>> = (props) => {
|
|
@@ -25,7 +25,7 @@ Use this shape:
|
|
|
25
25
|
import type { A11y, Direction } from '@wix/editor-react-types';
|
|
26
26
|
|
|
27
27
|
export type PlanCardProps = {
|
|
28
|
-
id
|
|
28
|
+
id: string;
|
|
29
29
|
className?: string;
|
|
30
30
|
direction?: Direction;
|
|
31
31
|
a11y?: A11y;
|
|
@@ -53,9 +53,8 @@ Rules:
|
|
|
53
53
|
|
|
54
54
|
## Numeric Range Constraints
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
override is needed.
|
|
56
|
+
Use inline `@min` and `@max` JSDoc tags for fixed-domain numeric props. Manifest
|
|
57
|
+
generation reads the tags automatically.
|
|
59
58
|
|
|
60
59
|
```ts
|
|
61
60
|
export type RatingProps = {
|
|
@@ -64,21 +63,17 @@ export type RatingProps = {
|
|
|
64
63
|
};
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
Use fixed bounds for ratings, percentages, playback speed, columns,
|
|
68
|
-
|
|
69
|
-
whose upper bound depends on the current collection.
|
|
66
|
+
Use fixed bounds for ratings, percentages, playback speed, columns, etc. Omit
|
|
67
|
+
for open-ended values or indices tied to a dynamic collection.
|
|
70
68
|
|
|
71
69
|
## Named Parts and `elementProps`
|
|
72
70
|
|
|
73
|
-
Treat an independently editable inner element as a named part
|
|
74
|
-
consistent wiring rule:
|
|
71
|
+
Treat an independently editable inner element as a named part. Wiring rules:
|
|
75
72
|
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
- Every named inner part has an `elementProps` entry
|
|
79
|
-
|
|
80
|
-
- Structural or decorative non-parts have no `elementProps` entry and use only a
|
|
81
|
-
CSS Module class.
|
|
73
|
+
- Root receives top-level `id`, `className`, `direction`, `a11y` — no
|
|
74
|
+
`elementProps` entry.
|
|
75
|
+
- Every named inner part has an `elementProps` entry (even if only `className`
|
|
76
|
+
is needed); structural/decorative non-parts use only a CSS Module class.
|
|
82
77
|
|
|
83
78
|
On a raw HTML element, spread the entry and explicitly merge its injected
|
|
84
79
|
`className`. Keep the entry key short while prefixing the global class with the
|
|
@@ -108,79 +103,62 @@ Do not merge the same class at both the call site and the sub-component root.
|
|
|
108
103
|
|
|
109
104
|
## Content and Data
|
|
110
105
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
props or state. For example, expose `price` and `quantity`; compute `subtotal`.
|
|
115
|
-
Use numeric types when arithmetic is required.
|
|
106
|
+
Compute derived values internally when a small pure expression can derive them
|
|
107
|
+
from props or state (e.g. expose `price` and `quantity`; compute `subtotal`; use
|
|
108
|
+
numeric types when arithmetic is required).
|
|
116
109
|
|
|
117
110
|
### Data-Driven Components
|
|
118
111
|
|
|
119
|
-
Export named content props rather than `children` for leaf components
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
- links: `link`, `href`
|
|
124
|
-
- collections: `items`, `options`, `menuItems`
|
|
125
|
-
|
|
126
|
-
Internal sub-components may still use `children` for composition.
|
|
112
|
+
Export named content props rather than `children` for leaf components — text
|
|
113
|
+
(`label`, `title`, `placeholder`), media (`image`, `video`, `icon`), links
|
|
114
|
+
(`link`, `href`), collections (`items`, `options`, `menuItems`). Internal
|
|
115
|
+
sub-components may still use `children` for composition.
|
|
127
116
|
|
|
128
117
|
### Container Components
|
|
129
118
|
|
|
130
|
-
Use `React.ReactNode` only
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
direction.
|
|
119
|
+
Use `React.ReactNode` only for containers or slots accepting arbitrary nested
|
|
120
|
+
components. Put `dir="ltr"` on elements rendering `ReactNode` so nested content
|
|
121
|
+
does not inherit the component's direction.
|
|
134
122
|
|
|
135
123
|
### Array Props
|
|
136
124
|
|
|
137
|
-
Array elements must be objects with named keys
|
|
138
|
-
semantic field names, and room for non-breaking extension.
|
|
125
|
+
Array elements must be objects with named keys for semantics and extensibility.
|
|
139
126
|
|
|
140
127
|
```ts
|
|
141
128
|
type GalleryProps = {
|
|
142
|
-
images: Array<{
|
|
143
|
-
tags: Array<{
|
|
129
|
+
images: Array<{ image: Image; caption?: string }>;
|
|
130
|
+
tags: Array<{ label: string }>;
|
|
144
131
|
};
|
|
145
132
|
```
|
|
146
133
|
|
|
147
|
-
Do not export
|
|
148
|
-
|
|
149
|
-
```ts
|
|
150
|
-
// Avoid:
|
|
151
|
-
// Array<string>
|
|
152
|
-
// Array<Image>
|
|
153
|
-
// Array<Array<Item>>
|
|
154
|
-
// Array<{ items: Array<Image> }>
|
|
155
|
-
```
|
|
134
|
+
Do not export `Array<string>`, `Array<Image>`, `Array<Array<T>>`, or nested
|
|
135
|
+
arrays inside items.
|
|
156
136
|
|
|
157
|
-
The parent owns the array. Item sub-components receive one item
|
|
158
|
-
|
|
159
|
-
|
|
137
|
+
The parent owns the array. Item sub-components receive one item, not the
|
|
138
|
+
collection. Do not add an `id` field for React keys—use the item's semantic
|
|
139
|
+
named fields instead. Prefer: (1) a stable unique field (`value`, `uri`, `label`, …), (2)
|
|
140
|
+
else slug a user-facing string (`name`, `label`), (3) else the array index.
|
|
160
141
|
|
|
161
|
-
|
|
142
|
+
## Active-Item Components
|
|
162
143
|
|
|
163
|
-
Apply this contract when an array-driven UI shows one item body at a time,
|
|
164
|
-
|
|
165
|
-
and multi-expand accordions.
|
|
144
|
+
Apply this contract when an array-driven UI shows one item body at a time (tabs,
|
|
145
|
+
slides, steps). Skip for always-visible lists, multi-select, or multi-expand.
|
|
166
146
|
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
`@wix/react-component-utils`. The type argument must
|
|
170
|
-
|
|
171
|
-
- Render
|
|
172
|
-
|
|
173
|
-
and apply `aria-hidden` and `inert` to inactive content.
|
|
174
|
-
- Provide keyboard navigation between triggers and the matching ARIA pattern.
|
|
147
|
+
- Every item needs `name: string` (used for hat-selector labels).
|
|
148
|
+
- **Import and use `ActiveItemIndex<'arrayPropName'>`** from
|
|
149
|
+
`@wix/react-component-utils`. The type argument must match the array prop name
|
|
150
|
+
exactly, and `defaultProps` must set the index to `0`.
|
|
151
|
+
- Render all bodies with `.map()`. Active body gets --active; inactive bodies get functional CSS visibility, aria-hidden, and inert.
|
|
152
|
+
- Provide keyboard navigation and the matching ARIA pattern.
|
|
175
153
|
|
|
176
154
|
```ts
|
|
177
155
|
import type { A11y, Direction } from '@wix/editor-react-types';
|
|
178
156
|
import type { ActiveItemIndex } from '@wix/react-component-utils';
|
|
179
157
|
|
|
180
|
-
export type Step = {
|
|
158
|
+
export type Step = { name: string; body: string };
|
|
181
159
|
|
|
182
160
|
export type StepsProps = {
|
|
183
|
-
id
|
|
161
|
+
id: string;
|
|
184
162
|
className?: string;
|
|
185
163
|
direction?: Direction;
|
|
186
164
|
a11y?: A11y;
|
|
@@ -189,30 +167,26 @@ export type StepsProps = {
|
|
|
189
167
|
};
|
|
190
168
|
|
|
191
169
|
export const defaultProps = {
|
|
192
|
-
steps: [{
|
|
170
|
+
steps: [{ name: 'Step 1', body: 'First step' }],
|
|
193
171
|
activeItem: 0,
|
|
194
172
|
} satisfies Omit<StepsProps, 'id' | 'className'>;
|
|
195
173
|
```
|
|
196
174
|
|
|
197
175
|
### Wix Data Types
|
|
198
176
|
|
|
199
|
-
Use
|
|
200
|
-
|
|
201
|
-
`node_modules/@wix/react-component-schema/dist/editor-react-types.d.ts` when you
|
|
202
|
-
need the supported schema types.
|
|
177
|
+
Use `Image`, `Link`, `Video`, `Audio`, `VectorArt`, `RichText` from
|
|
178
|
+
`@wix/editor-react-types`. See `node_modules/@wix/react-component-schema/dist/editor-react-types.d.ts` for the full list.
|
|
203
179
|
|
|
204
180
|
## Defaults and Resources
|
|
205
181
|
|
|
206
182
|
Export `defaultProps` from `<component-name>.props.ts`. Both `component.tsx` and
|
|
207
|
-
the extension consume this object;
|
|
183
|
+
the extension consume this object; never duplicate fallbacks in JSX.
|
|
208
184
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
external host or third-party runtime dependency.
|
|
185
|
+
All rendered media must come from Wix-hosted services, local assets, or props.
|
|
186
|
+
No external hosts or third-party runtime dependencies.
|
|
212
187
|
|
|
213
|
-
For
|
|
214
|
-
|
|
215
|
-
image.
|
|
188
|
+
For `Image` defaults, populate only `uri`, `url`, and `alt`; the editor fills
|
|
189
|
+
dimensions and focal-point metadata.
|
|
216
190
|
|
|
217
191
|
```ts
|
|
218
192
|
export const defaultProps = {
|
|
@@ -224,9 +198,8 @@ export const defaultProps = {
|
|
|
224
198
|
} as const satisfies Omit<ExampleComponentProps, 'id' | 'className'>;
|
|
225
199
|
```
|
|
226
200
|
|
|
227
|
-
Use distinct Wix-hosted defaults
|
|
228
|
-
`defaultProps` so rendering
|
|
229
|
-
second fallback in JSX.
|
|
201
|
+
Use distinct Wix-hosted defaults per image slot; keep all fallback data in
|
|
202
|
+
`defaultProps` so rendering never hardcodes a second fallback in JSX.
|
|
230
203
|
|
|
231
204
|
Use this pool in order, cycling only when more than five defaults are needed:
|
|
232
205
|
|
|
@@ -238,14 +211,12 @@ Use this pool in order, cycling only when more than five defaults are needed:
|
|
|
238
211
|
| 4 | `11062b_45e67783d39c4963ab9e4fc418173233~mv2.jpg` | Abstract pink waves |
|
|
239
212
|
| 5 | `11062b_4c11f014b0d04948b2e6f554076bc40a~mv2.jpg` | Coastal village aerial |
|
|
240
213
|
|
|
241
|
-
For one image
|
|
242
|
-
slot so the defaults are visually distinct.
|
|
214
|
+
For one image use entry 1; for multiple slots use a different entry each.
|
|
243
215
|
|
|
244
216
|
## Internal File Splitting
|
|
245
217
|
|
|
246
|
-
Split
|
|
247
|
-
|
|
248
|
-
component folder and use `.module.css`, matching the package convention.
|
|
218
|
+
Split independently understandable units when it makes the main component easier
|
|
219
|
+
to read or test. Keep internal files in the component folder using `.module.css`.
|
|
249
220
|
|
|
250
221
|
```text
|
|
251
222
|
component-name/
|
|
@@ -264,12 +235,11 @@ Do not extract tiny fragments merely to satisfy a line-count threshold.
|
|
|
264
235
|
|
|
265
236
|
## Checklist
|
|
266
237
|
|
|
267
|
-
- [ ] Identity, direction, and
|
|
268
|
-
- [ ] Props
|
|
269
|
-
- [ ]
|
|
270
|
-
- [ ]
|
|
271
|
-
- [ ] Leaf components avoid exported `children`.
|
|
272
|
-
- [ ] Array elements are named objects with stable identity.
|
|
238
|
+
- [ ] Identity, direction, a11y, and SDK callbacks follow the public props shape.
|
|
239
|
+
- [ ] Props hold authored data/behavior; derived values stay internal.
|
|
240
|
+
- [ ] Fixed-domain numeric props use `@min`/`@max` JSDoc tags.
|
|
241
|
+
- [ ] Named inner parts have `elementProps` wiring; leaf components avoid exported `children`.
|
|
273
242
|
- [ ] One-body-visible arrays use the active-item contract and render all bodies.
|
|
274
|
-
- [ ]
|
|
243
|
+
- [ ] Array elements are objects with semantic named fields. No separate `id` field added to item types; React keys use item fields (stable unique → slug → index), not a typed `id`.
|
|
244
|
+
- [ ] Defaults live only in the props file (no JSX fallbacks).
|
|
275
245
|
- [ ] Resources are Wix-hosted, prop-supplied, or locally bundled.
|
|
@@ -9,14 +9,30 @@ The Wix CLI scaffold generates `component.preview.tsx` and wires its URL into
|
|
|
9
9
|
the extension's editor resource. It includes `withDefaults`,
|
|
10
10
|
`withFallbackPlaceholder`, required-data fields, and the root class name.
|
|
11
11
|
|
|
12
|
-
Keep the wrapper structure and synchronize its values
|
|
12
|
+
Keep the wrapper structure and synchronize its values. The renderer detects
|
|
13
|
+
preview defaults only when `withDefaults` wraps the result of
|
|
14
|
+
`withFallbackPlaceholder`. The calls may be nested directly:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
export default withDefaults(
|
|
18
|
+
withFallbackPlaceholder(ComponentPreview, {
|
|
19
|
+
requiredDataFields: ['animationUrl'],
|
|
20
|
+
rootClassName: 'component-root',
|
|
21
|
+
}),
|
|
22
|
+
defaultProps,
|
|
23
|
+
);
|
|
24
|
+
```
|
|
13
25
|
|
|
14
26
|
- Wrap the preview adapter when one exists; otherwise wrap `Component`.
|
|
15
27
|
- In `requiredDataFields`, normally use only the one prop crucial to meaningful
|
|
16
28
|
rendering, such as `animationUrl`. Use more only when each is essential.
|
|
17
29
|
- Set `rootClassName` to the elected root's exact global class, not `styles.root`.
|
|
18
30
|
|
|
19
|
-
Never remove `withFallbackPlaceholder
|
|
31
|
+
Never remove either wrapper, export `withFallbackPlaceholder(...)` directly, or
|
|
32
|
+
invert their order. Preserve the equivalent of
|
|
33
|
+
`withDefaults(withFallbackPlaceholder(...), defaultProps)` even when editing
|
|
34
|
+
the preview component or fallback options. Assigning either wrapped component
|
|
35
|
+
to a variable is valid as long as that outer-to-inner order stays intact.
|
|
20
36
|
|
|
21
37
|
## Detect Editor Design Mode
|
|
22
38
|
|
|
@@ -40,12 +56,15 @@ timers, or network activity while a site owner is designing.
|
|
|
40
56
|
For autoplaying components, force autoplay off in editor design mode and keep
|
|
41
57
|
the live/preview prop values unchanged.
|
|
42
58
|
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
Pass the adapter to `withFallbackPlaceholder`, then pass that wrapped component
|
|
60
|
+
to `withDefaults`. This may be written inline as shown above or through component
|
|
61
|
+
variables. Synchronize the data field and root class either way.
|
|
45
62
|
|
|
46
63
|
## Checklist
|
|
47
64
|
|
|
48
65
|
- [ ] Generated wrappers target the preview adapter when one exists.
|
|
66
|
+
- [ ] The default export resolves to `withDefaults` outside
|
|
67
|
+
`withFallbackPlaceholder`, whether inline or through component variables.
|
|
49
68
|
- [ ] Normally one crucial data field and the exact root global class are set.
|
|
50
69
|
- [ ] The extension still loads the preview URL as its editor resource.
|
|
51
70
|
- [ ] `useIsEditMode()` is called inside a component.
|