@wix/agent-skills 1.18.1 → 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.
Files changed (67) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/SKILL.md +4 -4
  3. package/skills/wix-app/references/APP_VALIDATION.md +7 -33
  4. package/skills/wix-app/references/DASHBOARD_PAGE.md +18 -14
  5. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +6 -3
  6. package/skills/wix-app/references/WIX_PATTERNS_DOCS.md +23 -26
  7. package/skills/wix-app/references/dashboard-page/COLLECTION_TOOLKIT.md +7 -6
  8. package/skills/wix-app/references/dashboard-page/ENTITY_PAGE_TOOLKIT.md +71 -4
  9. package/skills/wix-app/references/dashboard-page/PATTERNS_BUNDLE_READING.md +67 -7
  10. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -1
  11. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +9 -6
  12. package/skills/wix-app/references/editor-react-component/COMPONENT-CONTRACT.md +59 -89
  13. package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +23 -4
  14. package/skills/wix-base44-connector/SKILL.md +168 -48
  15. package/skills/wix-base44-connector/scripts/{utils.js → utils.cjs} +69 -48
  16. package/skills/wix-docs/SKILL.md +109 -111
  17. package/skills/wix-docs/references/API_SPEC_SEARCH.md +35 -23
  18. package/skills/wix-docs/references/CALLING.md +91 -0
  19. package/skills/wix-docs/references/EXTRACTING.md +5 -3
  20. package/skills/wix-headless/references/DOC_DISCOVERY.md +9 -3
  21. package/skills/wix-manage/SKILL.md +7 -1
  22. package/skills/wix-manage/references/seo/manage-content-plan.md +247 -0
  23. package/skills/wix-manage/references/seo/manage-seo-tags.md +59 -6
  24. package/skills/wix-manage/references/stores/change-store-currency.md +10 -0
  25. package/skills/wix-manage/references/stores/update-product-with-options.md +9 -0
  26. package/skills/wix-vibe-headless/SKILL.md +17 -18
  27. package/skills/wix-vibe-headless/install/pin-agents-md.cjs +1 -1
  28. package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed-with-install.md +118 -0
  29. package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +55 -62
  30. package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +31 -29
  31. package/skills/wix-vibe-headless/platforms/base44.md +8 -5
  32. package/skills/wix-vibe-headless/platforms/generic.md +13 -12
  33. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +4 -13
  34. package/skills/wix-vibe-headless/references/blog/seed/SEED.md +4 -8
  35. package/skills/wix-vibe-headless/references/blog/seed/{seed-blog.js → seed-blog.cjs} +2 -3
  36. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +5 -14
  37. package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +5 -9
  38. package/skills/wix-vibe-headless/references/bookings/seed/{seed-bookings.js → seed-bookings.cjs} +2 -2
  39. package/skills/wix-vibe-headless/references/bookings/seed/{seed-rentals.js → seed-rentals.cjs} +3 -3
  40. package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +1 -1
  41. package/skills/wix-vibe-headless/references/cms/seed/SEED.md +2 -2
  42. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +4 -13
  43. package/skills/wix-vibe-headless/references/events/seed/SEED.md +3 -7
  44. package/skills/wix-vibe-headless/references/events/seed/{seed-events.js → seed-events.cjs} +2 -2
  45. package/skills/wix-vibe-headless/references/forms/INSTRUCTIONS.md +2 -1
  46. package/skills/wix-vibe-headless/references/forms/seed/SEED.md +1 -1
  47. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +4 -13
  48. package/skills/wix-vibe-headless/references/members/seed/SEED.md +2 -3
  49. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +4 -13
  50. package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectMedia.jsx +1 -1
  51. package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +3 -7
  52. package/skills/wix-vibe-headless/references/portfolio/seed/{seed-portfolio.js → seed-portfolio.cjs} +2 -2
  53. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +5 -14
  54. package/skills/wix-vibe-headless/references/pricing-plans/app/components/OrderCard.jsx +1 -1
  55. package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +3 -7
  56. package/skills/wix-vibe-headless/references/pricing-plans/seed/{seed-pricing-plans.js → seed-pricing-plans.cjs} +2 -2
  57. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +5 -15
  58. package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +3 -7
  59. package/skills/wix-vibe-headless/references/restaurants/seed/{seed-restaurants.js → seed-restaurants.cjs} +2 -2
  60. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +359 -327
  61. package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +1 -0
  62. package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +2 -2
  63. package/skills/wix-vibe-headless/references/storefront/app/hooks/useShop.js +63 -78
  64. package/skills/wix-vibe-headless/references/storefront/app/rest/wix-store-catalog.js +59 -43
  65. package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +46 -10
  66. package/skills/wix-vibe-headless/references/storefront/seed/{seed-store.js → seed-store.cjs} +163 -25
  67. package/skills/wix-vibe-headless/references/storefront/app/pages/Shop.jsx +0 -75
@@ -1,14 +1,54 @@
1
1
  # Reading `@wix/patterns` Bundles and Docs
2
2
 
3
- > **Scope.** You are here because a lookup in `dist/dts-bundle/index.json` or
4
- > `dist/docs/index.json` gave you an entry and you are about to open the file it names. Getting to that index in the first
5
- > place — resolving the package root, the version floor, the docs lookup, and the rule
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 docs cover components and props, not 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.
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 and the stub names where to find it.
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
- A handful of names carry `"status": "unreachable"` 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.
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?: string;
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 is a **playable
4
- animation**—a Lottie/JSON animation, an animated GIF/SVG, a canvas/WebGL loop,
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
- - Any component with an `autoPlay` prop (gallery, slider, carousel, etc.)
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?: string;
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?: string;
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
- For a new or changed numeric prop, use inline `@min` and `@max` JSDoc tags when
57
- the value has a fixed domain. Manifest generation reads the tags; no extension
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, and similar
68
- domains. Omit them for arbitrary counts, free-form prices, or an active index
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, then apply one
74
- consistent wiring rule:
71
+ Treat an independently editable inner element as a named part. Wiring rules:
75
72
 
76
- - The elected root receives top-level `id`, `className`, `direction`, and `a11y`;
77
- it has no `elementProps` entry.
78
- - Every named inner part has an `elementProps` entry, even when `className` is
79
- the only injected field it currently needs.
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
- ### Derived Values
112
-
113
- Compute a value internally when a small pure expression can derive it from
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
- - text: `label`, `title`, `placeholder`
122
- - media: `image`, `video`, `icon`
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 when the specification defines a container or slot
131
- that accepts arbitrary nested components. Put `dir="ltr"` on the element that
132
- renders each `ReactNode` value so nested content does not inherit the component's
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. This provides stable identity,
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<{ id: string; image: Image; caption?: string }>;
143
- tags: Array<{ id: string; label: string }>;
129
+ images: Array<{ image: Image; caption?: string }>;
130
+ tags: Array<{ label: string }>;
144
131
  };
145
132
  ```
146
133
 
147
- Do not export arrays of primitives, leaf Wix data types, or nested arrays:
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 rather than
158
- redeclaring the collection. Use a stable item identifier as the React key; do
159
- not synthesize identity from the array index when stable identity is available.
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
- ### Active-Item Components
142
+ ## Active-Item Components
162
143
 
163
- Apply this contract when an array-driven UI shows one item body at a time, such
164
- as tabs, slides, or steps. Skip it for always-visible lists, multi-select UIs,
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
- - Give every item a `name: string`; Studio uses `name` for hat-selector labels.
168
- - Pair the array prop with `ActiveItemIndex<'arrayPropName'>` from
169
- `@wix/react-component-utils`. The type argument must exactly match the array
170
- prop name, and `defaultProps` must initialize the index to `0`.
171
- - Render every body with `.map()`. Mark the active body with a prefixed
172
- `--active` state class, hide inactive bodies with functional CSS visibility,
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 = { id: string; name: string; body: string };
158
+ export type Step = { name: string; body: string };
181
159
 
182
160
  export type StepsProps = {
183
- id?: string;
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: [{ id: 'first', name: 'Step 1', body: 'First step' }],
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 types such as `Image`, `Link`, `Video`, `Audio`, `VectorArt`, and `RichText`
200
- from `@wix/editor-react-types`. Inspect
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; do not duplicate fallback values in JSX.
183
+ the extension consume this object; never duplicate fallbacks in JSX.
208
184
 
209
- Rendered media and runtime data must come from Wix-hosted services, local
210
- bundled assets, or values supplied through props. Do not silently introduce an
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 an `Image` default, populate only `uri`, `url`, and `alt`. Let the editor
214
- populate dimensions and focal-point metadata after the site owner chooses an
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 for multiple image slots. Keep fallback data in
228
- `defaultProps` so rendering reads the resolved prop instead of hardcoding a
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, use entry 1. For multiple slots, use a different entry for each
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 a logical, independently understandable unit when doing so makes the main
247
- component easier to read or test. Keep internal files within the scaffolded
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 accessibility contracts are present.
268
- - [ ] Props contain authored data or stable behavior; derived values stay internal.
269
- - [ ] New or changed fixed-domain numeric props use `@min` and `@max`.
270
- - [ ] Every named inner part has `elementProps` wiring and merged classes.
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
- - [ ] Defaults have one source of truth in the props file.
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
- Export the adapter through `withFallbackPlaceholder` and synchronize its data
44
- field and root class.
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.