@wix/agent-skills 1.18.0 → 1.18.2
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 +4 -4
- package/skills/wix-app/references/APP_VALIDATION.md +7 -33
- package/skills/wix-app/references/DASHBOARD_PAGE.md +18 -14
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +75 -92
- 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-app/references/editor-react-component/CSS-GUIDELINES.md +29 -14
- 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-headless/references/inline-recipes/setup-forms.md +57 -10
- package/skills/wix-manage/SKILL.md +106 -92
- package/skills/wix-manage/references/dashboard-navigation/routes.json +12 -52
- package/skills/wix-manage/references/ecommerce/shipping/ecom-shipping-api.md +0 -2
- package/skills/wix-manage/references/forms/create-form.md +272 -184
- package/skills/wix-manage/references/forms/forms-dashboard-navigation.md +13 -10
- package/skills/wix-manage/references/forms/update-form.md +122 -0
- package/skills/wix-manage/references/media/generate-image-with-ai.md +86 -0
- 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 +16 -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 +118 -0
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +55 -62
- package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +31 -29
- package/skills/wix-vibe-headless/platforms/base44.md +12 -5
- 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 +24 -7
- package/skills/wix-vibe-headless/references/forms/seed/SEED.md +91 -17
- 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 +359 -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 +46 -10
- package/skills/wix-vibe-headless/references/storefront/seed/{seed-store.js → seed-store.cjs} +163 -25
- package/skills/wix-vibe-headless/references/storefront/app/pages/Shop.jsx +0 -75
|
@@ -34,9 +34,9 @@ Everything below is a real name in the installed `@wix/patterns`. Confirm the pr
|
|
|
34
34
|
| A fixed in-memory option list for a filter | `useStaticListFilterCollection` |
|
|
35
35
|
| Sorting | `Sortable Columns`, `MultiLevelSorting` |
|
|
36
36
|
|
|
37
|
-
**
|
|
37
|
+
**Read the index once, then go straight to files.** `dist/dts-bundle/index.json` answers every name in this table in a single read — resolve it once per session and keep it, rather than re-reading it per lookup. Each entry names the exact file to open next.
|
|
38
38
|
|
|
39
|
-
**A factory or hook's doc is often empty where its signature should be** — `
|
|
39
|
+
**A factory or hook's doc is often empty where its signature should be** — the props table is generated for components, so `idNameArrayFilter`'s doc shows an `## API` heading with nothing under it. Its bundle has the signature: `<T extends { id: string; name: string }>(params?) => ArrayFilterState<T>`. That holds for every `use…` hook and every `…Filter` factory in the table above, and it is the difference between knowing a name and being able to call it — so for these, read the bundle the index names, not the doc.
|
|
40
40
|
|
|
41
41
|
**A filter must narrow the result.** Declare it in the collection hook's `filters` map and read it inside `fetchData`, so the value reaches the query. Filter UI that renders but never changes the rows is a defect that looks like a feature — and it is the failure mode these components exist to prevent.
|
|
42
42
|
|
|
@@ -49,7 +49,7 @@ Everything below is a real name in the installed `@wix/patterns`. Confirm the pr
|
|
|
49
49
|
| **Expanded row** | A couple of extra fields, no separate workspace needed. | The collection's own row expansion |
|
|
50
50
|
| **Picker / bulk confirm** | Choosing records, or confirming an action on many. | `PickerModal` + `usePickerModal`, `bulkActionModal` |
|
|
51
51
|
|
|
52
|
-
A dialog that creates, updates or displays one listed record is **not** a dashboard modal — a create / "add new" form included, since it writes the record. See [DASHBOARD_MODAL.md](../DASHBOARD_MODAL.md). A row the user cannot open is the second most common failure after the missing aggregate.
|
|
52
|
+
A dialog that creates, updates or displays one listed record is **not** a dashboard modal — a create / "add new" form included, since it writes the record. See [DASHBOARD_MODAL.md](../DASHBOARD_MODAL.md); for the create route itself — registering it, and the four params that differ from the edit call — [ENTITY_PAGE_TOOLKIT.md § Create route](ENTITY_PAGE_TOOLKIT.md#create-route). A row the user cannot open is the second most common failure after the missing aggregate.
|
|
53
53
|
|
|
54
54
|
**Form state on an entity page** comes from `@wix/patterns/form` — `useForm` for the form, `useController` for a single field. That subpath re-exports `@wix/bex-core/form`, which wraps `react-hook-form`, so its API is react-hook-form's and only a handful of its names appear in the patterns docs: `FieldValues`, `ControllerProps` and most of the rest are documented by react-hook-form, not here. `Read <pkgRoot>/dist/dts-bundle/exports/form.d.ts` to see what the subpath actually gives you.
|
|
55
55
|
|
|
@@ -57,10 +57,11 @@ A dialog that creates, updates or displays one listed record is **not** a dashbo
|
|
|
57
57
|
|
|
58
58
|
| Need | Component |
|
|
59
59
|
| --- | --- |
|
|
60
|
-
|
|
|
61
|
-
|
|
|
60
|
+
| Page header actions | `PrimaryActions`, `SecondaryActions`, `More Actions` — passed to the page header's `primaryAction`, `secondaryActions` and `moreActions` slots |
|
|
61
|
+
| Table toolbar button | `PrimaryActionButton` — the table's own `primaryActionButton` prop |
|
|
62
|
+
| Row actions | `deleteSecondaryAction`, in the row's `actionCell` |
|
|
62
63
|
| Acting on a multi-row selection | `MultiBulkActionToolbar`, `bulkActionModal` |
|
|
63
|
-
| Immediate feedback, then reconcile | `useOptimisticActions
|
|
64
|
+
| Immediate feedback, then reconcile | `useOptimisticActions(state.collection)` ✅ — not `useOptimisticActions(state)` ❌: `useTableCollection()` returns `TableState<T, F>`, and the hook takes the `CollectionState<T, F>` that state exposes as `state.collection`. Returns `CollectionOptimisticActions` |
|
|
64
65
|
| A banner above the table | `TableTopNotification` |
|
|
65
66
|
|
|
66
67
|
## The states that are not the happy path
|
|
@@ -26,10 +26,29 @@ const state = useEntityPage<Shift, ShiftFormFields>({
|
|
|
26
26
|
.updateShift(shiftId, { ...form.getValues(), ...widgetsFormData })
|
|
27
27
|
.then((updatedEntity) => ({ updatedEntity })),
|
|
28
28
|
form,
|
|
29
|
-
parentPath: '/
|
|
29
|
+
parentPath: '/',
|
|
30
30
|
});
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
**`parentPath` is relative to the router's own mount point — the dashboard page's
|
|
34
|
+
own root, not the page's `route` value.** A dashboard page scaffolded with
|
|
35
|
+
`{"route": "shifts"}` is served at `/dashboard/shifts`, but `PatternsReactRouter`
|
|
36
|
+
still sees its own location start fresh at `/` inside that page — so `parentPath`,
|
|
37
|
+
every `PatternsReactRoute`'s `path`, and the `path` passed to
|
|
38
|
+
`navigateToEntityPage()` / `navigateToCollectionPage()` must never repeat the
|
|
39
|
+
page's own `route`/name. `parentPath: '/shifts'` on a page whose `route` is
|
|
40
|
+
`"shifts"` is the single most common way this gets copied wrong — it looks like a
|
|
41
|
+
reasonable guess (name the parent after the page) and compiles, but the
|
|
42
|
+
collection route it points back to is registered at `path="/"`, not
|
|
43
|
+
`path="/shifts"`, so `parentPath` must match that: `'/'`. See [Create
|
|
44
|
+
route](#create-route) below for the full route registration.
|
|
45
|
+
|
|
46
|
+
From **1.465.0** the library's own docs state this rule — `PatternsReactRouter.md`,
|
|
47
|
+
`usePatternsNavigate.md` and `useEntityPage.md`'s **Create route**. On an older
|
|
48
|
+
install they don't, and their examples *demonstrate* the mistake
|
|
49
|
+
(`navigateToEntityPage({ path: '/shifts/new' })`, `navigateToCollectionPage({ path:
|
|
50
|
+
'/entities' })`); prefer this rule over what those examples show.
|
|
51
|
+
|
|
33
52
|
`EntityPage` and `useEntityPage` are **root** exports. `@wix/patterns/page` holds `CollectionPage` and `WidgetsFormProvider` only, so importing the entity page from there is `TS2305: has no exported member` — the collection page and the entity page do not live in the same place. `Read <pkgRoot>/dist/dts-bundle/exports/page.d.ts` to see what that subpath actually gives you.
|
|
34
53
|
|
|
35
54
|
## Name both generics
|
|
@@ -54,9 +73,22 @@ Reaching for a `values`-shaped key on the `onSave` argument is the usual first g
|
|
|
54
73
|
|
|
55
74
|
## The params are a `Pick`
|
|
56
75
|
|
|
57
|
-
`UseEntityPageParams` picks a fixed set off `EntityPageStateParams` — `fetch`, `onSave`, `saveSuccessToast`, `saveErrorToast`, `deleteAction`, `transformEntityToCollectionItem`, `isNewEntity
|
|
76
|
+
`UseEntityPageParams` picks a fixed set off `EntityPageStateParams` — `fetch`, `onSave`, `saveSuccessToast`, `saveErrorToast`, `deleteAction`, `transformEntityToCollectionItem`, `isNewEntity` (create vs edit — [Create route](#create-route)), `form`, `parentPageId`, `parentPath`, `parentReferrer`, `schemaSource`. Anything outside that list is an excess-property error on the object literal. `container` is the common guess and is not one of them: the hook calls `useWixPatternsContainer()` itself.
|
|
77
|
+
|
|
78
|
+
Confirm the shape rather than guessing — the hook's doc ends by pointing at the bundle rather than tabulating props, because props tables only exist for components. `Read <pkgRoot>/dist/dts-bundle/index.json`, then `Read` the bundled `.d.ts` for each of `useEntityPage`, `UseEntityPageParams`, and `OnSaveParams` at exactly the `file` path the index gives.
|
|
79
|
+
|
|
80
|
+
## Create route
|
|
81
|
+
|
|
82
|
+
The example above is edit-only. "Add new" is an `EntityPage` too, and it is not the same call with the id left out. Four things differ, and three of them fail silently if you guess:
|
|
83
|
+
|
|
84
|
+
- The route is its own `PatternsReactRoute type="createEntity"`. One component can serve both entity routes; the route is what tells them apart.
|
|
85
|
+
- `navigateToEntityPage({ path })` — omit `entity`. It exists so the header can render a title before the fetch resolves, and a create route has no record to give it. A placeholder is worse than nothing: until `fetch` resolves it *is* `state.entity`.
|
|
86
|
+
- `fetch` is required on the create route too, and `{ entity: undefined }` is the create case built into its return type — not a loading state, and there is no `fetch`-less variant.
|
|
87
|
+
- `isNewEntity` is the only param that tells the page which route it is on. Omitted, a create page that seeds defaults through `fetch` is announced to the collection as an *update*: the collection changes a row it does not have, the new record never appears in the list, and the only trace is a `Fetched page info for updated entity not found` console error.
|
|
58
88
|
|
|
59
|
-
|
|
89
|
+
`Read <pkgRoot>/dist/docs/useEntityPage.md` before writing one — its **Create route** section carries the worked component that serves both routes off one `useParams` answer, and the `boolean | (() => boolean)` getter form for `isNewEntity`.
|
|
90
|
+
|
|
91
|
+
**If that file has no `Create route` heading, the installed `@wix/patterns` predates 1.464.0.** Upgrade and re-read rather than working around it: on those versions `navigateToEntityPage` types `entity` as required, so omitting it does not compile, and passing the placeholder that satisfies it is the failure the bullet above describes.
|
|
60
92
|
|
|
61
93
|
## Around the call
|
|
62
94
|
|
|
@@ -64,10 +96,45 @@ Confirm the shape rather than guessing — the hook's doc has an empty API secti
|
|
|
64
96
|
| --- | --- |
|
|
65
97
|
| Getting here from the collection page | `usePatternsNavigate()` → `navigateToEntityPage({ path, entity })` |
|
|
66
98
|
| Registering the route | `PatternsReactRoute` inside `PatternsReactRouter` |
|
|
67
|
-
| Form state and field binding | `useForm` / `useController` from `@wix/patterns/form` |
|
|
99
|
+
| Form state and field binding | `useForm` / `useController` from `@wix/patterns/form` — `useController`, never `register` |
|
|
68
100
|
| Body layout | `EntityPage.Header`, `.MainContent`, `.AdditionalContent`, `.Card` |
|
|
69
101
|
| The fields inside those cards | `@wix/design-system` (`FormField`, `Input`, `Text`) |
|
|
70
102
|
|
|
103
|
+
Every `path` in that first row — the route's own `path`, `parentPath`, and the `path` argument to `navigateToEntityPage`/`navigateToCollectionPage` — is relative to the page's own root, never to its `route`/name. See the `parentPath` note under [The call](#the-call) above; it is the same rule everywhere a path appears in this table.
|
|
104
|
+
|
|
71
105
|
`@wix/patterns/form` re-exports `@wix/bex-core/form`, which wraps `react-hook-form` — so `form.getValues()`, `form.reset()` and the rest are react-hook-form's API, documented there rather than in the patterns docs.
|
|
72
106
|
|
|
107
|
+
## Binding a field: `useController`, never `register`
|
|
108
|
+
|
|
109
|
+
`register` returns props for a plain `<input>`, and WDS components are not one. Two ways it fails:
|
|
110
|
+
|
|
111
|
+
`<Input {...register('qty')} />` does not compile — `register` always returns `min`/`max` as `string | number`, whatever options you passed, and WDS types them `number | undefined`. The error names `InputProps`, which reads like a WDS bug and isn't.
|
|
112
|
+
|
|
113
|
+
`<Input ref={register('qty').ref} />` **does** compile and is wrong. `Input`'s `ref` is its imperative handle (`Ref<InputImperativeActions>`); `register`'s ref is `(instance: any) => void`, so it accepts that and binds the handle rather than the `<input>`. The field never registers, validation never sees it, and nothing reports it.
|
|
114
|
+
|
|
115
|
+
Bind through value/onChange instead:
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
import { useController, useForm } from '@wix/patterns/form';
|
|
119
|
+
import { FormField, Input } from '@wix/design-system';
|
|
120
|
+
|
|
121
|
+
type ProductForm = { name: string; qty: number };
|
|
122
|
+
|
|
123
|
+
function NameField({ form }: { form: ReturnType<typeof useForm<ProductForm>> }) {
|
|
124
|
+
const { field, fieldState } = useController({
|
|
125
|
+
name: 'name',
|
|
126
|
+
control: form.control,
|
|
127
|
+
rules: { required: 'Name is required' },
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<FormField label="Name" required status={fieldState.error ? 'error' : undefined} statusMessage={fieldState.error?.message}>
|
|
132
|
+
<Input value={field.value} onChange={field.onChange} onBlur={field.onBlur} />
|
|
133
|
+
</FormField>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Rules live in `rules`, not on the WDS component. If you need `register` for a DOM concern such as input masking, `Input` takes `inputRef?: React.Ref<HTMLInputElement>` — pass the ref there, never to `ref`.
|
|
139
|
+
|
|
73
140
|
A dialog that creates, updates or displays one listed record is **not** a dashboard modal — a create / "add new" form included, since it writes the record. See [DASHBOARD_MODAL.md](../DASHBOARD_MODAL.md).
|
|
@@ -1,14 +1,54 @@
|
|
|
1
1
|
# Reading `@wix/patterns` Bundles and Docs
|
|
2
2
|
|
|
3
|
-
> **
|
|
4
|
-
>
|
|
5
|
-
>
|
|
3
|
+
> **Precondition: an index entry.** Every path below is the `file` (or `bundle`) field of an entry
|
|
4
|
+
> in `<pkgRoot>/dist/dts-bundle/index.json` or `<pkgRoot>/dist/docs/index.json`. If you haven't
|
|
5
|
+
> read that index this session, you have no path to open — read it before anything else here.
|
|
6
|
+
> Getting to it — resolving the package root, the version floor, the docs lookup, and the rule
|
|
6
7
|
> against browsing `node_modules` by hand — is in
|
|
7
8
|
> [WIX_PATTERNS_DOCS.md](../WIX_PATTERNS_DOCS.md). Nothing here replaces those steps.
|
|
8
9
|
|
|
10
|
+
## Read the index once, then open its files in one call
|
|
11
|
+
|
|
12
|
+
One index read covers the whole page. So name every symbol you plan to write — components, hooks,
|
|
13
|
+
state types, prop types — look them all up in the index you now hold, and open what it named in a
|
|
14
|
+
single call with one `Read` per file:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
call 1 Read <pkgRoot>/dist/docs/index.json
|
|
18
|
+
Read <pkgRoot>/dist/dts-bundle/index.json
|
|
19
|
+
|
|
20
|
+
call 2 Read <pkgRoot>/dist/docs/Table.md <- docs entry's `file`
|
|
21
|
+
Read <pkgRoot>/dist/docs/useTableCollection.md
|
|
22
|
+
Read <pkgRoot>/dist/dts-bundle/components/Table.d.ts <- its `bundle`
|
|
23
|
+
Read <pkgRoot>/dist/dts-bundle/hooks/useTableCollection.d.ts
|
|
24
|
+
Read <pkgRoot>/dist/dts-bundle/types/TableState.d.ts <- bundle entry's `file`
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Two calls, not twenty-two — and nothing is lost by batching, because there is nothing to learn
|
|
28
|
+
between the files: every path came out of the same index and `bytes` already told you each size.
|
|
29
|
+
The same files opened one per call re-send the whole conversation once per file, which is where a
|
|
30
|
+
lookup session's token cost actually goes. Batch the follow-ups the same way: when a doc names an
|
|
31
|
+
example file, or a stub names another bundle (below), collect them and read them together.
|
|
32
|
+
|
|
33
|
+
## Where props live
|
|
34
|
+
|
|
35
|
+
From `@wix/patterns` **1.460.0** onward a doc does not repeat props that the bundle already
|
|
36
|
+
describes. Which one holds them is stated in the doc's own index entry:
|
|
37
|
+
|
|
38
|
+
| `dist/docs/index.json` entry | where the props are |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| has a `bundle` field | that bundle — the doc's `### Props` is a pointer to it, on purpose |
|
|
41
|
+
| no `bundle` field | the doc's own `### Props` table, as before |
|
|
42
|
+
|
|
43
|
+
Roughly 74 of 167 docs point at a bundle and 62 still carry a table, so expect both. When a doc
|
|
44
|
+
says `Read \`dist/dts-bundle/...\``, that **is** the props answer — read the named file rather
|
|
45
|
+
than treating the doc as incomplete. The bundle is the better source anyway: it keeps the
|
|
46
|
+
`extends` clause with its exclusions, so `Omit<PopoverMenuItemProps, 'text' | 'prefixIcon' | 'onClick'>` tells
|
|
47
|
+
you what you do *not* inherit, which the old doc link did not.
|
|
48
|
+
|
|
9
49
|
## Types the docs don't cover
|
|
10
50
|
|
|
11
|
-
The
|
|
51
|
+
The same bundles also hold the types those props use — `Filter<T>`, `RangeItem<T>`, `CursorQuery`, a `...Props` interface. `Read <pkgRoot>/dist/dts-bundle/index.json`, look up the type name, then `Read <pkgRoot>/dist/dts-bundle/<entry.file>` using exactly the `file` path the index gives — **never reconstruct the path from the name**; bundles are nested one directory per kind (`components/Table.d.ts`, `hooks/useForm.d.ts`, `types/RangeItem.d.ts`, …), so guessing `<Name>.d.ts` at the top level is wrong by construction.
|
|
12
52
|
|
|
13
53
|
Several of these types (`RangeItem`, `Filter`, `CursorQuery`, the filter factory functions) actually live in `@wix/bex-core` — the bundle already resolves and inlines the real declaration, so you get the full shape with no deep, undeclared `@wix/bex-core/dist/types/...` path to chase. Still always import it from `@wix/patterns`, per the index's `importPath` field, never from wherever the bundle says it's really declared.
|
|
14
54
|
|
|
@@ -32,9 +72,24 @@ An empty body with a **"Produced by"** note means: call that hook or factory to
|
|
|
32
72
|
|
|
33
73
|
A stub saying **"cut here because it has its own bundle"** means the same thing for a shape you *do* write: it wasn't copied in twice, so look the name up and read its own file.
|
|
34
74
|
|
|
35
|
-
Every bundle fits in a single read; the index's `bytes` field says how big before you open it. So a bundle is never partially shown — if something looks missing, it was cut on purpose
|
|
75
|
+
Every bundle fits in a single read; the index's `bytes` field says how big before you open it. So a bundle is never partially shown — if something looks missing, it was cut on purpose. Both stubs above name where to find it.
|
|
76
|
+
|
|
77
|
+
### The one that doesn't: a bare `import`
|
|
78
|
+
|
|
79
|
+
A plain `import { X } from '<module>'` at the top of a bundle, with no note attached, is the third shape you will meet — and unlike the two above it does **not** tell you where to look. What to do depends on the path, not the name:
|
|
80
|
+
|
|
81
|
+
**A normal entry point** — `react`, `react-hook-form`, `history`, `@wix/design-system`. Resolve it the ordinary way. For `@wix/design-system` names use the `wix-design-system` skill; don't read WDS files directly.
|
|
82
|
+
|
|
83
|
+
**A deep internal path** — `@wix/design-system/dist/types/DropdownLayout`, `@wix/bex-utils/@wix/bi-logger-os-data/v2/types`. This is an upstream defect: the bundle recorded where the type is *declared* instead of where it is exported. Two things follow, and the second is the one that saves you time:
|
|
84
|
+
|
|
85
|
+
- Never import that path in your own code, and don't go read the file it points at. It is not a public entry point, and the name is often not re-exported from the package root either — `DropdownLayoutOption` is not exported from `@wix/design-system`, so there is no shorter import to substitute.
|
|
86
|
+
- You usually don't need the declaration at all. Where the type is a **prop you fill in** — WDS option shapes like `SingleSelectFilter`'s and `AutoCompleteFilter`'s `items` — look the *component* up in the `wix-design-system` skill and use the shape its docs show. Where it is a **pass-through you never construct** — the BI logger params behind optional fields like `biAdditionalInfo` — pass what the patterns doc shows, or omit it; it is optional.
|
|
87
|
+
|
|
88
|
+
If a name you genuinely need stays unresolved after that, stop and say so, and name the bundle and the exact import path that dead-ended. Do not guess a shape and do not go spelunking in `node_modules` — a wrong guess compiles here and breaks at runtime, which is worse than the missing type.
|
|
89
|
+
|
|
90
|
+
A handful of names carry `"status": "unreachable"` — plus `"unexported": true` from **1.465.0** — with a message saying not to import them (the `...BaseProps` interfaces a component's props `extends`). Read those for the props they contribute; don't write an import for them.
|
|
36
91
|
|
|
37
|
-
|
|
92
|
+
`status` also carries `"deprecated"`, and there the `statusMessage` names the replacement — `PrimaryPageButton` says *"Use `PrimaryActions` component instead."* Check it before you commit to a name — nothing else in the lookup path will stop you, since a deprecated component still compiles and still renders. If the index calls a name deprecated, use what its message names instead.
|
|
38
93
|
|
|
39
94
|
## Subpath entry points
|
|
40
95
|
|
|
@@ -49,4 +104,9 @@ Links to `https://www.docs.wixdesignsystem.com/` are external (Wix Design System
|
|
|
49
104
|
## Tips
|
|
50
105
|
|
|
51
106
|
- **Compound components** have separate docs per sub-part: `CollectionPage.md`, `CollectionPage.Header.md`, `CollectionPage.Content.md`.
|
|
52
|
-
- **Hook docs** list configuration options as props in the API table
|
|
107
|
+
- **Hook docs** list configuration options as props — in the API table when the doc has no
|
|
108
|
+
`bundle` field, otherwise in the bundle it points at.
|
|
109
|
+
- **Heavy examples live beside the doc.** A variation whose code was long is written out
|
|
110
|
+
separately, and the doc keeps the heading, the description and an exact path:
|
|
111
|
+
`Example code: read \`dist/docs/ToolbarFilters/apply-changes.tsx\``. Read that path only if you
|
|
112
|
+
need that particular variation — the heading and description are usually enough to choose.
|
|
@@ -25,7 +25,7 @@ import type { A11y, Direction } from '@wix/editor-react-types';
|
|
|
25
25
|
import { convertA11yKeysToHtmlFormat } from '@wix/react-component-utils';
|
|
26
26
|
|
|
27
27
|
export type TabsProps = {
|
|
28
|
-
id
|
|
28
|
+
id: string;
|
|
29
29
|
className?: string;
|
|
30
30
|
direction?: Direction;
|
|
31
31
|
a11y?: A11y;
|
|
@@ -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.
|