@wix/agent-skills 1.35.0 → 1.36.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/references/CODE_QUALITY.md +1 -1
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +27 -29
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +5 -3
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +1 -1
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONTRACT.md +26 -25
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +12 -42
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +9 -20
- package/skills/wix-app/references/editor-react-component/MANIFEST-ERRORS.md +5 -4
- package/skills/wix-app/references/editor-react-component/PARTS.md +1 -1
- package/skills/wix-app/references/editor-react-component/PROPS-VS-CSS.md +1 -1
- package/skills/wix-app/references/editor-react-component/VECTOR-ART.md +95 -0
- package/skills/wix-app/references/editor-react-component/VISUAL-QUALITY.md +39 -0
- package/skills/wix-docs/references/CALLING.md +1 -1
- package/skills/wix-headless-kit/guides/api-run.md +1 -1
- package/skills/wix-headless-kit/install/pins.json +1 -1
- package/skills/wix-headless-templates/blog/seed/seed-blog.mjs +1 -1
- package/skills/wix-headless-templates/donations/app/wix/donations/campaigns.ts +0 -1
- package/skills/wix-headless-templates/donations/app/wix/donations/donate.ts +1 -1
- package/skills/wix-headless-templates/donations/project/src/wix/donations/campaigns.ts +0 -1
- package/skills/wix-headless-templates/donations/project/src/wix/donations/donate.ts +1 -1
- package/skills/wix-headless-templates/donations/rest/campaigns.ts +0 -1
- package/skills/wix-headless-templates/donations/rest/donate.ts +1 -1
- package/skills/wix-headless-templates/events/seed/seed-events.mjs +1 -1
- package/skills/wix-headless-templates/faq/INSTRUCTIONS.md +1 -1
- package/skills/wix-headless-templates/faq/app/wix/faq/faq.ts +2 -2
- package/skills/wix-headless-templates/faq/project/src/wix/faq/faq.ts +2 -2
- package/skills/wix-headless-templates/faq/rest/faq.ts +2 -2
- package/skills/wix-headless-templates/faq/seed/SEED.md +1 -1
- package/skills/wix-headless-templates/faq/seed/read-site.mjs +1 -1
- package/skills/wix-headless-templates/faq/seed/seed-faq.mjs +5 -5
- package/skills/wix-headless-templates/forms/app/wix/forms/forms.ts +2 -2
- package/skills/wix-headless-templates/forms/app/wix/forms/submissions.ts +2 -2
- package/skills/wix-headless-templates/forms/project/src/wix/forms/forms.ts +2 -2
- package/skills/wix-headless-templates/forms/project/src/wix/forms/submissions.ts +2 -2
- package/skills/wix-headless-templates/members/seed/read-site.mjs +1 -1
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/plan-access.ts +1 -1
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/plan-access.ts +1 -1
- package/skills/wix-headless-templates/pricing-plans/rest/plan-access.ts +1 -1
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/menu.ts +0 -1
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/menu.ts +0 -1
- package/skills/wix-headless-templates/restaurants/rest/menu.ts +0 -1
- package/skills/wix-headless-templates/shared/rest/client.ts +1 -1
- package/skills/wix-headless-templates/shared/seed/site.mjs +2 -1
- package/skills/wix-manage/references/google-ads/get-campaign-suggestions.md +0 -1
- package/skills/wix-manage/references/google-ads/install-and-create-account.md +0 -1
- package/skills/wix-manage/references/rich-content/ricos-converter-service.md +1 -1
- package/skills/wix-manage/references/sites/upload-static-site.md +8 -6
- package/skills/wix-replatform/resources/rp-mapper/wix-business-solutions-taxonomy.md +5 -5
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/docs-survey.json +0 -9
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +1 -1
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ Applies to all generated code across every Wix CLI app extension type. Each per-
|
|
|
8
8
|
- Prefer type-narrowing and exhaustive logic over assertions; avoid non-null assertions (`!`) and unsafe casts (`as any`).
|
|
9
9
|
- Treat optional values, refs, and array indexing results as possibly undefined and handle them explicitly.
|
|
10
10
|
- Use exhaustive checks for unions (e.g., `switch` with a `never` check) and return total values (no implicit `undefined`).
|
|
11
|
-
- Do NOT use `// @ts-ignore` or `// @ts-expect-error`; fix the types or add guards instead.
|
|
11
|
+
- Do NOT use `// @ts-ignore` or `// @ts-expect-error`; fix the types or add guards instead. The one exception is a `// @ts-ignore` directly above an import of a context provider's hook by its `moduleSpecifier`: TypeScript cannot resolve that specifier, because the site's import map supplies it only at runtime.
|
|
12
12
|
|
|
13
13
|
## Core Principles
|
|
14
14
|
|
|
@@ -21,18 +21,17 @@ Supplementary files are allowed; keep scaffold roles intact.
|
|
|
21
21
|
|
|
22
22
|
## Required Reading (blocking)
|
|
23
23
|
|
|
24
|
-
Before writing code,
|
|
25
|
-
|
|
26
|
-
grep instead.
|
|
24
|
+
Before writing code, read every reference in the matched row in full.
|
|
25
|
+
Unopened references fail the run—open paths directly; no skim or grep.
|
|
27
26
|
|
|
28
27
|
| Scope | Required references |
|
|
29
28
|
| --- | --- |
|
|
30
|
-
| Creating a component | [`REACT-GUIDELINES.md`](editor-react-component/REACT-GUIDELINES.md), [`COMPONENT-CONTRACT.md`](editor-react-component/COMPONENT-CONTRACT.md), [`PARTS.md`](editor-react-component/PARTS.md), [`PROPS-VS-CSS.md`](editor-react-component/PROPS-VS-CSS.md), [`CSS-GUIDELINES.md`](editor-react-component/CSS-GUIDELINES.md), [`DIRECTIONALITY.md`](editor-react-component/DIRECTIONALITY.md), [`ACCESSIBILITY.md`](editor-react-component/ACCESSIBILITY.md), [`COMPONENT-PREVIEW.md`](editor-react-component/COMPONENT-PREVIEW.md), [`EDITOR-EXTENSION-CONFIGURATION.md`](editor-react-component/EDITOR-EXTENSION-CONFIGURATION.md), [`OVERFLOW.md`](editor-react-component/OVERFLOW.md) |
|
|
29
|
+
| Creating a component | [`REACT-GUIDELINES.md`](editor-react-component/REACT-GUIDELINES.md), [`COMPONENT-CONTRACT.md`](editor-react-component/COMPONENT-CONTRACT.md), [`PARTS.md`](editor-react-component/PARTS.md), [`PROPS-VS-CSS.md`](editor-react-component/PROPS-VS-CSS.md), [`CSS-GUIDELINES.md`](editor-react-component/CSS-GUIDELINES.md), [`VISUAL-QUALITY.md`](editor-react-component/VISUAL-QUALITY.md), [`DIRECTIONALITY.md`](editor-react-component/DIRECTIONALITY.md), [`ACCESSIBILITY.md`](editor-react-component/ACCESSIBILITY.md), [`COMPONENT-PREVIEW.md`](editor-react-component/COMPONENT-PREVIEW.md), [`EDITOR-EXTENSION-CONFIGURATION.md`](editor-react-component/EDITOR-EXTENSION-CONFIGURATION.md), [`OVERFLOW.md`](editor-react-component/OVERFLOW.md) |
|
|
31
30
|
| Editing React or JSX | [`REACT-GUIDELINES.md`](editor-react-component/REACT-GUIDELINES.md), [`ACCESSIBILITY.md`](editor-react-component/ACCESSIBILITY.md) |
|
|
32
31
|
| Changing public contract, semantic root, or named parts | [`COMPONENT-CONTRACT.md`](editor-react-component/COMPONENT-CONTRACT.md), [`PARTS.md`](editor-react-component/PARTS.md), [`PROPS-VS-CSS.md`](editor-react-component/PROPS-VS-CSS.md) |
|
|
33
32
|
| Changing public data props or elected root global class | [`COMPONENT-PREVIEW.md`](editor-react-component/COMPONENT-PREVIEW.md) |
|
|
34
33
|
| Item array where only one body is visible | [`COMPONENT-CONTRACT.md`](editor-react-component/COMPONENT-CONTRACT.md), [`PROPS-VS-CSS.md`](editor-react-component/PROPS-VS-CSS.md), [`ACCESSIBILITY.md`](editor-react-component/ACCESSIBILITY.md), [`DESIGN-STATES.md`](editor-react-component/DESIGN-STATES.md) |
|
|
35
|
-
| Creating or changing CSS | [`CSS-GUIDELINES.md`](editor-react-component/CSS-GUIDELINES.md) |
|
|
34
|
+
| Creating or changing CSS | [`CSS-GUIDELINES.md`](editor-react-component/CSS-GUIDELINES.md), [`VISUAL-QUALITY.md`](editor-react-component/VISUAL-QUALITY.md) |
|
|
36
35
|
| Creating or changing layout/content | [`OVERFLOW.md`](editor-react-component/OVERFLOW.md) |
|
|
37
36
|
| Root direction contract, direction-sensitive behavior, or `ReactNode` slot | [`DIRECTIONALITY.md`](editor-react-component/DIRECTIONALITY.md) |
|
|
38
37
|
| Sizing, installation, or manifest overrides | [`EDITOR-EXTENSION-CONFIGURATION.md`](editor-react-component/EDITOR-EXTENSION-CONFIGURATION.md) |
|
|
@@ -47,14 +46,13 @@ grep instead.
|
|
|
47
46
|
```
|
|
48
47
|
|
|
49
48
|
Never rerun the scaffold for an existing component.
|
|
50
|
-
Write a meaningful `description`
|
|
51
|
-
|
|
52
|
-
Don't repeat the name or add implementation details.
|
|
49
|
+
Write a meaningful `description` (max 300 chars, 1-2 sentences): what users see,
|
|
50
|
+
when to use it, and capability tradeoffs—no name repeat or implementation detail.
|
|
53
51
|
|
|
54
52
|
2. **Run the dependency preflight.**
|
|
55
53
|
|
|
56
54
|
```bash
|
|
57
|
-
deps=(@wix/react-component-schema @wix/react-component-utils @wix/editor-react-types)
|
|
55
|
+
deps=(@wix/react-component-schema @wix/react-component-utils @wix/editor-react-types clsx deepmerge-ts)
|
|
58
56
|
dev=(@babel/parser @babel/traverse @babel/types eslint eslint-plugin-jsx-a11y @typescript-eslint/parser 'typescript@<7' @types/eslint-plugin-jsx-a11y jsdom axe-core)
|
|
59
57
|
|
|
60
58
|
node - "${deps[@]}" "${dev[@]}" <<'JS' || {
|
|
@@ -63,7 +61,7 @@ grep instead.
|
|
|
63
61
|
.map(p => p.replace(/@<7$/, ''))
|
|
64
62
|
.filter(p => !require.resolve.paths(p)?.some(d => fs.existsSync(path.join(d, p, 'package.json'))));
|
|
65
63
|
if (missing.length) {
|
|
66
|
-
console.error(`Missing
|
|
64
|
+
console.error(`Missing: ${missing.join(', ')}`);
|
|
67
65
|
process.exit(1);
|
|
68
66
|
}
|
|
69
67
|
JS
|
|
@@ -74,27 +72,26 @@ grep instead.
|
|
|
74
72
|
}
|
|
75
73
|
```
|
|
76
74
|
|
|
77
|
-
3. **Plan.** Identify props, root, parts, and states; open
|
|
78
|
-
Use them and the scaffold before
|
|
79
|
-
|
|
80
|
-
govern API shapes; retain editor rules.
|
|
75
|
+
3. **Plan.** Identify props, root, parts, and states; open required references first.
|
|
76
|
+
Use them and the scaffold before package declarations—only for undocumented APIs
|
|
77
|
+
or typecheck failures. Declarations govern API shapes; keep editor rules.
|
|
81
78
|
|
|
82
79
|
4. **Implement.** Keep props, logic, and styles in their scaffolded editable
|
|
83
80
|
files. Format edited source files with the app's formatter. Never edit or format `*.generated.ts`.
|
|
84
81
|
|
|
85
|
-
5. **Run the
|
|
86
|
-
same folder (`<SKILL_ROOT>`
|
|
82
|
+
5. **Run the a11y review (mandatory).** After JSX, run from the
|
|
83
|
+
same folder (`<SKILL_ROOT>` contains the active `SKILL.md`):
|
|
87
84
|
|
|
88
85
|
```bash
|
|
89
86
|
node <SKILL_ROOT>/scripts/scan-a11y-review.cjs src/extensions/site/components/<component-name>
|
|
90
87
|
```
|
|
91
88
|
|
|
92
|
-
Follow [`
|
|
89
|
+
Follow [`ACCESSIBILITY.md`](editor-react-component/ACCESSIBILITY.md); fix and
|
|
93
90
|
rerun at most twice, then report remaining findings.
|
|
94
91
|
|
|
95
92
|
6. **Configure the editor extension.** For creation or a requested sizing,
|
|
96
93
|
installation, or manifest change, apply
|
|
97
|
-
[`
|
|
94
|
+
[`EDITOR-EXTENSION-CONFIGURATION.md`](editor-react-component/EDITOR-EXTENSION-CONFIGURATION.md)
|
|
98
95
|
to the extension; otherwise leave it unchanged. Synchronize preview
|
|
99
96
|
`requiredDataFields` and `rootClassName`.
|
|
100
97
|
|
|
@@ -105,15 +102,15 @@ grep instead.
|
|
|
105
102
|
npx wix build && npx wix generate manifest
|
|
106
103
|
```
|
|
107
104
|
|
|
108
|
-
Run `npx tsc --noEmit`, relevant tests/lint, and the
|
|
105
|
+
Run `npx tsc --noEmit`, relevant tests/lint, and the a11y review.
|
|
109
106
|
If later edits affect a check, rerun that check. Inspect the manifest when generated; never hand-repair it.
|
|
110
107
|
Diagnose failures with
|
|
111
|
-
[`
|
|
108
|
+
[`MANIFEST-ERRORS.md`](editor-react-component/MANIFEST-ERRORS.md).
|
|
112
109
|
|
|
113
|
-
For creation/layout changes,
|
|
110
|
+
For creation/layout changes, run the overflow resize review.
|
|
114
111
|
|
|
115
|
-
8. **Report.** Summarize files, checks, blockers,
|
|
116
|
-
List
|
|
112
|
+
8. **Report.** Summarize files, checks, blockers, and skipped checks.
|
|
113
|
+
List references read/unread; fix unread before closing.
|
|
117
114
|
|
|
118
115
|
## Reference Policy
|
|
119
116
|
|
|
@@ -133,10 +130,11 @@ trigger. Preserve unrelated behavior. References are leaves.
|
|
|
133
130
|
| Animation, video, carousel, or other playable/looped/autoplaying content | [`ANIMATED-COMPONENTS.md`](editor-react-component/ANIMATED-COMPONENTS.md), [`COMPONENT-PREVIEW.md`](editor-react-component/COMPONENT-PREVIEW.md) |
|
|
134
131
|
| Site/runtime/editor context hooks needed | [`SITE-CONTEXT-HOOKS.md`](editor-react-component/SITE-CONTEXT-HOOKS.md) (+ [`COMPONENT-PREVIEW.md`](editor-react-component/COMPONENT-PREVIEW.md) when design-mode behavior differs) |
|
|
135
132
|
| Branded, themed, or brand-aware component requested | [`BRANDED-COMPONENTS.md`](editor-react-component/BRANDED-COMPONENTS.md) |
|
|
133
|
+
| Owner-replaceable icon/SVG (not fixed UI glyphs) | [`VECTOR-ART.md`](editor-react-component/VECTOR-ART.md) |
|
|
136
134
|
|
|
137
135
|
## Non-Negotiables
|
|
138
136
|
|
|
139
|
-
- React 18 only;
|
|
137
|
+
- React 18 only; no React 19 runtime features.
|
|
140
138
|
- Include typed `id`, `className`, `direction`, and `a11y` support.
|
|
141
139
|
- Elected root: `dir={direction}`, fallback-direction class, logical CSS for
|
|
142
140
|
direction-sensitive layout.
|
|
@@ -148,13 +146,13 @@ trigger. Preserve unrelated behavior. References are leaves.
|
|
|
148
146
|
- Named parts: global class, module class, and `elementProps` (root uses
|
|
149
147
|
top-level props).
|
|
150
148
|
- Every visible text: a text prop plus a named part; no JSX text literals.
|
|
151
|
-
- Native design states: interactive elements only
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
- Native design states: interactive elements only; pair selectors with injected
|
|
150
|
+
modifiers. Custom states need a class toggle from logic or data, or a root prop
|
|
151
|
+
trigger; styled states need matching `:global()` rules.
|
|
154
152
|
- Open/close/reveal: props-only root
|
|
155
153
|
`isOpen: ElementState<boolean>` synced to state; module classes, no `--open` class.
|
|
156
|
-
- Single-visible-body arrays: `
|
|
157
|
-
|
|
154
|
+
- Single-visible-body arrays: `ActiveItemIndex<'prop'>`, render all bodies,
|
|
155
|
+
hide inactive accessibly; item `name` only when rendered.
|
|
158
156
|
- No arrays inside array items; keep group fields flat (no object props).
|
|
159
157
|
- Autoplay/loop: play/pause control, honor reduced motion, suppress autoplay in
|
|
160
158
|
editor design mode.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Draft Template — the starting point for every dashboard page
|
|
2
2
|
|
|
3
|
-
**Start here for any Dashboard Page request, before writing a shell, provider, or router
|
|
3
|
+
**Start here for any Dashboard Page request, before writing a shell, provider, or router.** Page templates ship inside the installed `@wix/patterns`. This file covers finding and placing their files in a Wix CLI app; the package's `Page Templates.md` chooses the template and explains its wiring.
|
|
4
4
|
|
|
5
5
|
Go through [WIX_PATTERNS_DOCS.md § Prerequisites](../WIX_PATTERNS_DOCS.md#prerequisites) first for `<pkgRoot>`; every path below is relative to it.
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ One call lists every page template with its files, plus the guide that chooses b
|
|
|
12
12
|
node <pkgRoot>/bin/patterns-lookup.cjs --templates
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Add known symbols to the same call (`--templates Table useTableCollection`). Without the script, probe the Templates entries in `<pkgRoot>/dist/docs/index.json` once.
|
|
16
16
|
|
|
17
17
|
**No `Templates` entries means the install predates them — upgrade `@wix/patterns`.** Do not rebuild a page from memory or from an older copy of this skill instead: the templates exist so the shell, provider nesting and router wiring come from the package.
|
|
18
18
|
|
|
@@ -53,6 +53,8 @@ Then copy **every** file `--templates` lists for it into the generated folder (`
|
|
|
53
53
|
|
|
54
54
|
- **Theme the entry file.** In it, replace the template's `WixDesignSystemProvider` and its `@wix/design-system/styles.global.css` import with the app's `BusinessManagerTheme` — written once per app ([BUSINESS_MANAGER_THEME.md § 2](../BUSINESS_MANAGER_THEME.md#2-the-wrapper--write-this-file-once-per-app)), kept in the entry file so it sits above `WixPatternsProvider`. **Business Manager passes none of the redesign through the extension's iframe**, so the bare provider renders the pre-redesign look while `tsc`, `wix build` and `wix preview` all pass.
|
|
55
55
|
|
|
56
|
+
**If the page needs tabs:** Start from a Patterns template. When tabs navigate between different sections, use WDS `Tabs`, reuse the template’s provider and router, and keep Patterns components for managing each section’s entities. Adapt the routes and navigation together so opening an entity and returning selects the correct section. When tabs only filter the same entity list, pass Patterns `TabsFilter` to the Table’s `tabs` prop.
|
|
57
|
+
|
|
56
58
|
## 4. Replace the data file
|
|
57
59
|
|
|
58
60
|
Each template's data file (`items-api.ts`, `settings-api.ts`) is an in-memory stand-in with the signatures the pages call. Replace the bodies, keep the signatures:
|
|
@@ -79,7 +81,7 @@ npm dedupe
|
|
|
79
81
|
find node_modules -path '*@wix/patterns/package.json' -not -path '*/dist/*'
|
|
80
82
|
```
|
|
81
83
|
|
|
82
|
-
More than one
|
|
84
|
+
More than one copy breaks shared context despite passing `tsc` and build. Align the versions with the second install command above, then check again.
|
|
83
85
|
|
|
84
86
|
### Turning `query.search` into a query
|
|
85
87
|
|
|
@@ -197,7 +197,7 @@ Wire the named part completely:
|
|
|
197
197
|
<button
|
|
198
198
|
type="button"
|
|
199
199
|
{...elementProps?.myAnimationPlayButton}
|
|
200
|
-
className={
|
|
200
|
+
className={clsx(
|
|
201
201
|
'my-animation-play-button',
|
|
202
202
|
styles.playButton,
|
|
203
203
|
elementProps?.myAnimationPlayButton?.className,
|
|
@@ -43,12 +43,12 @@ Rules:
|
|
|
43
43
|
when requested. Keep implementation handlers internal.
|
|
44
44
|
- Use `Array<T>`, not `T[]`, for exported arrays.
|
|
45
45
|
- Use a native link for a CTA with a real `href`, or a native button for an
|
|
46
|
-
action. Never
|
|
46
|
+
action. Never use `href="#"`: it has no destination.
|
|
47
47
|
|
|
48
48
|
## Numeric Range Constraints
|
|
49
49
|
|
|
50
|
-
Use inline `@min
|
|
51
|
-
generation reads
|
|
50
|
+
Use inline `@min`, `@max` JSDoc tags for fixed-domain numeric props. Manifest
|
|
51
|
+
generation reads them automatically.
|
|
52
52
|
|
|
53
53
|
```ts
|
|
54
54
|
export type RatingProps = {
|
|
@@ -57,12 +57,12 @@ export type RatingProps = {
|
|
|
57
57
|
};
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
Use
|
|
61
|
-
|
|
60
|
+
Use for ratings, percentages, columns; omit for open-ended values or indices
|
|
61
|
+
tied to a dynamic collection.
|
|
62
62
|
|
|
63
63
|
## Named Parts and `elementProps`
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
An independently editable inner element is a named part:
|
|
66
66
|
|
|
67
67
|
- Root receives top-level `id`, `className`, `direction`, `a11y` — no
|
|
68
68
|
`elementProps` entry.
|
|
@@ -75,7 +75,7 @@ On a raw HTML element, spread the entry and explicitly merge its injected
|
|
|
75
75
|
```tsx
|
|
76
76
|
<a
|
|
77
77
|
{...elementProps?.planCardCta}
|
|
78
|
-
className={
|
|
78
|
+
className={clsx(
|
|
79
79
|
'plan-card-cta',
|
|
80
80
|
styles.cta,
|
|
81
81
|
elementProps?.planCardCta?.className,
|
|
@@ -118,12 +118,12 @@ does not inherit the component's direction.
|
|
|
118
118
|
|
|
119
119
|
### Array Props
|
|
120
120
|
|
|
121
|
-
Array elements must be objects with named keys for semantics and extensibility.
|
|
121
|
+
Array elements must be objects with named keys for semantics and extensibility. Always declare array-item fields optional.
|
|
122
122
|
|
|
123
123
|
```ts
|
|
124
124
|
type GalleryProps = {
|
|
125
|
-
images: Array<{ image
|
|
126
|
-
tags: Array<{ label
|
|
125
|
+
images: Array<{ image?: Image; caption?: string }>;
|
|
126
|
+
tags: Array<{ label?: string }>;
|
|
127
127
|
};
|
|
128
128
|
```
|
|
129
129
|
|
|
@@ -131,22 +131,25 @@ Do not export `Array<string>`, `Array<Image>`, `Array<Array<T>>`, or nested
|
|
|
131
131
|
arrays inside items.
|
|
132
132
|
|
|
133
133
|
The parent owns the array. Item sub-components receive one item, not the
|
|
134
|
-
collection. Do not add an `id` field for React keys—use
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
collection. Do not add an `id` field for React keys—use semantic named fields.
|
|
135
|
+
Prefer: (1) a stable unique field (`value`, `uri`, `label`, …), (2) else slug a
|
|
136
|
+
user-facing string (`name`, `label`), (3) else the index.
|
|
137
137
|
|
|
138
138
|
## Active-Item Components
|
|
139
139
|
|
|
140
|
-
Apply
|
|
141
|
-
|
|
140
|
+
Apply when an array-driven UI shows one item body at a time (tabs, slides,
|
|
141
|
+
steps). Skip for always-visible lists, multi-select, or multi-expand.
|
|
142
142
|
|
|
143
|
-
-
|
|
143
|
+
- Declare `name` only when a part renders it; the hat shows `name`, else
|
|
144
|
+
"Item N". A visible per-item trigger label (tabs, steps) is the `name` field.
|
|
145
|
+
Slides, cards, carousels with no per-item label: no `name`. Never declare an
|
|
146
|
+
item field no part renders.
|
|
144
147
|
- **Import and use `ActiveItemIndex<'arrayPropName'>`** from
|
|
145
148
|
`@wix/react-component-utils`. The type argument must match the array prop name
|
|
146
149
|
exactly, and `defaultProps` must set the index to `0`.
|
|
147
|
-
- Render all bodies with `.map()`. Active body gets
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
+
- Render all bodies with `.map()`. Active body gets `--active`; inactive bodies get CSS visibility, `aria-hidden`, and `inert`.
|
|
151
|
+
- React 18 types: spread `...(!isActive ? { inert: 'true' } : {})` onto an inactive body; it emits the boolean attribute without a type error. Typecheck with the app, not a scratch project.
|
|
152
|
+
- Keyboard navigation and the matching ARIA pattern.
|
|
150
153
|
|
|
151
154
|
```ts
|
|
152
155
|
import type { A11y, Direction } from '@wix/editor-react-types';
|
|
@@ -180,7 +183,7 @@ one representation of it.
|
|
|
180
183
|
Common fields in the installed types: `Image` has required `url: string` and
|
|
181
184
|
optional `uri`, `alt`, `width`, `height`; `Link` has optional `href`, `target`
|
|
182
185
|
(`'_self' | '_blank'`), and `rel`. Use `image.url` for `<img src>`,
|
|
183
|
-
`image.alt` for
|
|
186
|
+
`image.alt` for alt text, and `link.href` for `<a href>`.
|
|
184
187
|
|
|
185
188
|
Do not represent media as a URL/source string or split its metadata across
|
|
186
189
|
primitive props. Preserve the media object through the public contract so the
|
|
@@ -216,7 +219,7 @@ export const defaultProps = {
|
|
|
216
219
|
```
|
|
217
220
|
|
|
218
221
|
Use distinct Wix-hosted defaults per image slot; keep all fallback data in
|
|
219
|
-
`defaultProps` so
|
|
222
|
+
`defaultProps` so JSX never hardcodes a second fallback.
|
|
220
223
|
|
|
221
224
|
Use this pool in order, cycling only when more than five defaults are needed:
|
|
222
225
|
|
|
@@ -228,8 +231,6 @@ Use this pool in order, cycling only when more than five defaults are needed:
|
|
|
228
231
|
| 4 | `11062b_45e67783d39c4963ab9e4fc418173233~mv2.jpg` | Abstract pink waves |
|
|
229
232
|
| 5 | `11062b_4c11f014b0d04948b2e6f554076bc40a~mv2.jpg` | Coastal village aerial |
|
|
230
233
|
|
|
231
|
-
For one image use entry 1; for multiple slots use a different entry each.
|
|
232
|
-
|
|
233
234
|
## Internal File Splitting
|
|
234
235
|
|
|
235
236
|
Split independently understandable units when it makes the main component easier
|
|
@@ -248,7 +249,7 @@ component-name/
|
|
|
248
249
|
└── component-name.module.css
|
|
249
250
|
```
|
|
250
251
|
|
|
251
|
-
Do not extract tiny fragments
|
|
252
|
+
Do not extract tiny fragments just to pass a line-count threshold.
|
|
252
253
|
|
|
253
254
|
## Checklist
|
|
254
255
|
|
|
@@ -256,7 +257,7 @@ Do not extract tiny fragments merely to satisfy a line-count threshold.
|
|
|
256
257
|
- [ ] Props hold authored data/behavior; derived values stay internal.
|
|
257
258
|
- [ ] Fixed-domain numeric props use `@min`/`@max` JSDoc tags.
|
|
258
259
|
- [ ] Named inner parts have `elementProps` wiring; leaf components avoid exported `children`.
|
|
259
|
-
- [ ] One-body-visible arrays use the active-item contract and render all bodies.
|
|
260
|
+
- [ ] One-body-visible arrays use the active-item contract and render all bodies; `name` only when a part renders it.
|
|
260
261
|
- [ ] 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`.
|
|
261
262
|
- [ ] Authored media uses the corresponding Wix media type, not URL/source strings or flattened metadata.
|
|
262
263
|
- [ ] Defaults live only in the props file (no JSX fallbacks).
|
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
Use these rules for the scaffolded `<component-name>.module.css` file and any
|
|
4
4
|
colocated CSS Modules owned by internal sub-components.
|
|
5
5
|
|
|
6
|
-
**Visual intent.** When the request specifies how the component should look —
|
|
7
|
-
mood, palette, layout style, or a reference — follow that direction. Default to a modern, refined look — intentional layout, pleasing proportions, polished and deliberate styling.
|
|
8
|
-
|
|
9
6
|
## Contents
|
|
10
7
|
|
|
11
8
|
- [Classes and Named Parts](#classes-and-named-parts)
|
|
@@ -15,12 +12,11 @@ mood, palette, layout style, or a reference — follow that direction. Default t
|
|
|
15
12
|
- [Responsiveness and Direction](#responsiveness-and-direction)
|
|
16
13
|
- [Editable Values](#editable-values)
|
|
17
14
|
- [Interaction and Motion](#interaction-and-motion)
|
|
18
|
-
- [Default Visual Quality](#default-visual-quality)
|
|
19
15
|
- [Checklist](#checklist)
|
|
20
16
|
|
|
21
17
|
## Classes and Named Parts
|
|
22
18
|
|
|
23
|
-
Apply classes with `
|
|
19
|
+
Apply classes with `clsx` (`import clsx from 'clsx'`):
|
|
24
20
|
|
|
25
21
|
| Element | Classes |
|
|
26
22
|
| --- | --- |
|
|
@@ -37,7 +33,7 @@ spread its `elementProps` entry and merge the injected class.
|
|
|
37
33
|
```tsx
|
|
38
34
|
<h2
|
|
39
35
|
{...elementProps?.profileCardHeading}
|
|
40
|
-
className={
|
|
36
|
+
className={clsx(
|
|
41
37
|
'profile-card-heading',
|
|
42
38
|
styles.heading,
|
|
43
39
|
elementProps?.profileCardHeading?.className,
|
|
@@ -71,11 +67,11 @@ Do not use compound selectors, tag selectors, child/sibling combinators, or CSS
|
|
|
71
67
|
nesting for editable styling. They make an element's editor surface depend on
|
|
72
68
|
DOM context.
|
|
73
69
|
|
|
74
|
-
Narrow
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
single-class rules.
|
|
70
|
+
Narrow exceptions, neither defining editable appearance: a relationship
|
|
71
|
+
selector for behavior-only visibility that needs ancestor state (a
|
|
72
|
+
hover-revealed play/pause control), and an icon part's layout-only `svg` rule
|
|
73
|
+
(`VECTOR-ART.md`). Keep each control's size, color, border, typography, and state
|
|
74
|
+
styling on its own single-class rules.
|
|
79
75
|
|
|
80
76
|
## Root Layout
|
|
81
77
|
|
|
@@ -218,11 +214,14 @@ per icon (`--start-icon-size`), applied via `inline-size`/`block-size` and
|
|
|
218
214
|
}
|
|
219
215
|
```
|
|
220
216
|
|
|
217
|
+
- **Replaceable**: follow `VECTOR-ART.md`.
|
|
218
|
+
|
|
221
219
|
## Interaction and Motion
|
|
222
220
|
|
|
223
221
|
- Set `pointer-events: auto` on the root and each interactive element.
|
|
224
|
-
- Pair native
|
|
225
|
-
|
|
222
|
+
- Pair native design states (`hover`, `focus`, `disabled`, `invalid`) with
|
|
223
|
+
the matching editor-injected global modifier. Custom modifiers need a class
|
|
224
|
+
toggle from component logic/data or a root prop trigger (`DESIGN-STATES.md` §5).
|
|
226
225
|
- Do not add decorative transitions or animations.
|
|
227
226
|
- When motion is functionally required, list the exact transition properties;
|
|
228
227
|
never use `transition: all` or an implicit `all` shorthand.
|
|
@@ -233,32 +232,6 @@ per icon (`--start-icon-size`), applied via `inline-size`/`block-size` and
|
|
|
233
232
|
}
|
|
234
233
|
```
|
|
235
234
|
|
|
236
|
-
## Default Visual Quality
|
|
237
|
-
|
|
238
|
-
Create a clear hierarchy with at least two techniques that fit the component:
|
|
239
|
-
a defined surface, border or soft shadow, type scale or weight, spacing, an
|
|
240
|
-
accent, or visible interaction states. Use these neutral defaults unless the
|
|
241
|
-
request or existing design provides better values:
|
|
242
|
-
|
|
243
|
-
- 16px or larger body text, 14px or larger labels, and 600–700 weight for titles
|
|
244
|
-
- 8–16px spacing inside controls and 16–32px spacing inside containers
|
|
245
|
-
- 8–12px corner radii for cards and controls; `50%` for circular media
|
|
246
|
-
- a subtle border or soft shadow when a card, panel, or control needs separation
|
|
247
|
-
- touch targets at least 44 by 44px and visible keyboard focus states
|
|
248
|
-
|
|
249
|
-
### Foreground and Background Ownership
|
|
250
|
-
|
|
251
|
-
If the component is a self-contained block (card, panel, banner, accordion item), give the root a background. An inline control meant to blend in (link, ghost button, icon button) may leave it transparent.
|
|
252
|
-
|
|
253
|
-
- On a transparent root, don't hardcode text or icon colors; inherit them from the parent.
|
|
254
|
-
- Set the background and main text/icon color together on the same element. Any secondary text (captions, hints, icons) must still be readable against that same background.
|
|
255
|
-
- If an interactive state changes the background, set the foreground color in that state too. Don't assume a color inherited from a parent or from a previous state will still look right on the new background.
|
|
256
|
-
- In every default and interactive state, meet WCAG AA contrast: 4.5:1 for body text and 3:1 for large text and UI controls.
|
|
257
|
-
|
|
258
|
-
A neutral owned surface may use a light background with dark primary and
|
|
259
|
-
secondary foregrounds, plus one accessible accent. The exact colors are not a
|
|
260
|
-
contract; the contrast relationship is.
|
|
261
|
-
|
|
262
235
|
## Checklist
|
|
263
236
|
|
|
264
237
|
- [ ] The scaffolded component and each extracted internal sub-component own
|
|
@@ -273,8 +246,5 @@ contract; the contrast relationship is.
|
|
|
273
246
|
- [ ] Every part that sets `font-size` also sets `font-family`, on the part that
|
|
274
247
|
should own the typography control.
|
|
275
248
|
- [ ] Interactive elements expose pointer events and accessible design states.
|
|
276
|
-
- [ ] Visual containers have deliberate hierarchy rather than bare scaffolding.
|
|
277
|
-
- [ ] Every explicit foreground has a known contrasting background; transparent
|
|
278
|
-
components inherit foregrounds from their host.
|
|
279
249
|
- [ ] No unexposed descendant paints an opaque surface; promote it to a named
|
|
280
250
|
part instead.
|
|
@@ -6,16 +6,6 @@ eligible interaction (`hover`, `focus`, `disabled`, `invalid`) or per a
|
|
|
6
6
|
selectable value in its data (`selected`, `active`, `checked`, …). Author states
|
|
7
7
|
in the component's `.tsx` and `.module.css`.
|
|
8
8
|
|
|
9
|
-
## Contents
|
|
10
|
-
|
|
11
|
-
- [Choose Supported States](#1-choose-supported-states)
|
|
12
|
-
- [Name the State Class](#2-name-the-state-class)
|
|
13
|
-
- [Author CSS](#3-author-css)
|
|
14
|
-
- [Wire React](#4-wire-react)
|
|
15
|
-
- [Use Prop-Triggered States on the Root Only](#5-use-prop-triggered-states-on-the-root-only)
|
|
16
|
-
- [Expose Open/Collapsed Toggles](#6-expose-opencollapsed-toggles)
|
|
17
|
-
- [Checklist](#checklist)
|
|
18
|
-
|
|
19
9
|
## 1. Choose Supported States
|
|
20
10
|
|
|
21
11
|
| Element | Author these states |
|
|
@@ -48,7 +38,7 @@ Flat: the element's own global class + `--<state>`. Because inner-part
|
|
|
48
38
|
global classes are prefixed with the component name, the state class is prefixed too —
|
|
49
39
|
e.g. `pricing-card-cta--hover`, `pricing-card-plan-row--selected`. Never bare
|
|
50
40
|
(`cta--hover` collides with other components) and never
|
|
51
|
-
nested (`card__row--selected`).
|
|
41
|
+
nested (`card__row--selected`). Add it only to an element that has its base class.
|
|
52
42
|
|
|
53
43
|
## 3. Author CSS
|
|
54
44
|
|
|
@@ -58,7 +48,7 @@ state selector. When both set the same property, write the state selector
|
|
|
58
48
|
value as the part's resting `defaultValue`, even though runtime CSS renders
|
|
59
49
|
correctly.
|
|
60
50
|
|
|
61
|
-
- **Native
|
|
51
|
+
- **Native (`hover`, `focus`, `disabled`, `invalid`)** — pair the pseudo-class with the `:global` modifier.
|
|
62
52
|
Every exposed native state needs both selectors in the same rule; do not
|
|
63
53
|
split the pair across states. A standalone `:focus-visible` accessibility
|
|
64
54
|
rule on a non-input control is not an editor design state and has no global
|
|
@@ -101,10 +91,9 @@ The local static accessibility scan cannot measure rendered color contrast.
|
|
|
101
91
|
- **Native** — render the correct interactive element (`<button>`, an
|
|
102
92
|
interactive `role`, or a handler). No custom state class is needed, but the
|
|
103
93
|
element must still satisfy the accessibility contract for its semantics.
|
|
104
|
-
- **Custom** —
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
drops the state.
|
|
94
|
+
- **Custom** — each `:global()` state rule must have a matching class toggle
|
|
95
|
+
driven by component logic or data, or a root prop trigger (§5). Open/collapsed
|
|
96
|
+
content uses §6.
|
|
108
97
|
- **Inner elements** — every named inner element gets an `elementProps` entry;
|
|
109
98
|
spread it so editor-driven states reach it. On a raw HTML element also merge
|
|
110
99
|
`elementProps?.<key>.className` inline; on a skill-built sub-component the
|
|
@@ -115,14 +104,14 @@ The local static accessibility scan cannot measure rendered color contrast.
|
|
|
115
104
|
<button
|
|
116
105
|
type="button"
|
|
117
106
|
{...elementProps?.pricingCardCta}
|
|
118
|
-
className={
|
|
107
|
+
className={clsx('pricing-card-cta', styles.cta, elementProps?.pricingCardCta?.className)}
|
|
119
108
|
>
|
|
120
109
|
{label}
|
|
121
110
|
</button>
|
|
122
111
|
|
|
123
112
|
<li
|
|
124
113
|
{...elementProps?.pricingCardPlanRow}
|
|
125
|
-
className={
|
|
114
|
+
className={clsx(
|
|
126
115
|
'pricing-card-plan-row',
|
|
127
116
|
styles.planRow,
|
|
128
117
|
row.selected && 'pricing-card-plan-row--selected',
|
|
@@ -205,7 +194,7 @@ React.useEffect(() => setOpen(Boolean(isOpen)), [isOpen]);
|
|
|
205
194
|
{...elementProps?.infoPanelContent}
|
|
206
195
|
aria-hidden={!open}
|
|
207
196
|
{...(!open && { inert: '' })}
|
|
208
|
-
className={
|
|
197
|
+
className={clsx(
|
|
209
198
|
'info-panel-content',
|
|
210
199
|
styles.content,
|
|
211
200
|
open && styles.contentOpen,
|
|
@@ -229,7 +218,7 @@ React.useEffect(() => setOpen(Boolean(isOpen)), [isOpen]);
|
|
|
229
218
|
- [ ] Non-input controls retain a standalone `:focus-visible` keyboard indicator.
|
|
230
219
|
- [ ] Custom state classes are flat, global, and prefixed by component and part.
|
|
231
220
|
- [ ] Named inner parts spread and merge their `elementProps` entry.
|
|
232
|
-
- [ ]
|
|
221
|
+
- [ ] Custom CSS state rules and their class toggles or root prop triggers match.
|
|
233
222
|
- [ ] `ElementState<boolean>` is used only for a component-level root state.
|
|
234
223
|
- [ ] An open/collapsed component exposes a props-only `isOpen` root state,
|
|
235
224
|
syncs internal state from it, always renders its content, and adds no
|
|
@@ -23,12 +23,13 @@ After each fix, re-run `npx wix build && npx wix generate manifest` to confirm.
|
|
|
23
23
|
## Warnings
|
|
24
24
|
|
|
25
25
|
The build can also print non-fatal warnings such as
|
|
26
|
-
|
|
26
|
+
`.item is missing from initial render (<file>)`.
|
|
27
27
|
Read every warning and fix it; this is mandatory, with one exception below.
|
|
28
28
|
|
|
29
|
-
- **A part's own class** (`.errorMessage`,
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
- **A `.tsx` file in parentheses**, or **a part's own class** (`.errorMessage`,
|
|
30
|
+
`.item`) in a `.css` file, means the part is not mounted in the extraction
|
|
31
|
+
render. Keep it mounted and hide it with `hidden` or CSS per `PARTS.md`,
|
|
32
|
+
then re-run build and manifest generation.
|
|
32
33
|
- **A class applied only by state** (`.contentOpen` from `open && styles.contentOpen`)
|
|
33
34
|
is expected: the part is mounted and only the state look is absent. Leave the
|
|
34
35
|
markup and CSS unchanged; do not force the state on or remove the styling.
|
|
@@ -71,7 +71,7 @@ const item = current ?? placeholderItem; // placeholder shows only while hidden
|
|
|
71
71
|
<div hidden={phase !== 'question'}>
|
|
72
72
|
<h3
|
|
73
73
|
{...elementProps?.quizQuestion}
|
|
74
|
-
className={
|
|
74
|
+
className={clsx('quiz-question', styles.question, elementProps?.quizQuestion?.className)}
|
|
75
75
|
>
|
|
76
76
|
{item.question}
|
|
77
77
|
</h3>
|