@wix/agent-skills 1.14.0 → 1.15.1
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/README.md +12 -1
- package/package.json +1 -1
- package/skills/README.md +23 -0
- package/skills/wix-app/SKILL.md +10 -2
- package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +326 -0
- package/skills/wix-app/references/CODE_QUALITY.md +1 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +124 -115
- package/skills/wix-app/references/DASHBOARD_PAGE.md +3 -0
- package/skills/wix-app/references/DATA_COLLECTION.md +5 -3
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +25 -9
- package/skills/wix-app/references/SITE_PLUGIN.md +1 -1
- package/skills/wix-app/references/STORES_VERSIONING.md +9 -211
- package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +115 -0
- package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +264 -0
- package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +37 -0
- package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +86 -0
- package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +119 -0
- package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +103 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +76 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +82 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +89 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +124 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +91 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +71 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +70 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +73 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +98 -0
- package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +278 -0
- package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +94 -0
- package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +43 -0
- package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +66 -0
- package/skills/wix-app/references/auto-patterns-dashboard/views.md +76 -0
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +5 -0
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -14
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +151 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +54 -29
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +2 -2
- package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +57 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +23 -105
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +127 -0
- package/skills/wix-app/references/editor-react-component/PARTS.md +2 -1
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +18 -16
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +25 -53
- package/skills/wix-app/references/stores/CATEGORIES.md +22 -0
- package/skills/wix-app/references/stores/GET_PRODUCT.md +99 -0
- package/skills/wix-app/references/stores/INVENTORY.md +37 -0
- package/skills/wix-app/references/stores/QUERY.md +87 -0
- package/skills/wix-app/references/stores/WRITE.md +55 -0
- package/skills/wix-app/scripts/generate-auto-patterns.js +510 -0
- package/skills/wix-auth/SKILL.md +12 -0
- package/skills/wix-auth/references/device-flow.md +140 -0
- package/skills/wix-docs/SKILL.md +188 -0
- package/skills/wix-docs/references/API_SPEC_SEARCH.md +213 -0
- package/skills/wix-docs/references/EXTRACTING.md +120 -0
- package/skills/wix-headless/SKILL.md +89 -130
- package/skills/wix-headless/entry/bootstrap.mjs +93 -0
- package/skills/wix-headless/entry/skill.md +76 -0
- package/skills/wix-headless/references/AI_FEATURES.md +178 -0
- package/skills/wix-headless/references/CAPABILITIES.md +86 -0
- package/skills/wix-headless/references/DISCOVERY.md +34 -56
- package/skills/wix-headless/references/DOC_DISCOVERY.md +37 -0
- package/skills/wix-headless/references/FEEDBACK.md +129 -0
- package/skills/wix-headless/references/IMAGE_GENERATION.md +69 -0
- package/skills/wix-headless/references/SDK_HANDOFF.md +99 -0
- package/skills/wix-headless/references/SEED.md +45 -187
- package/skills/wix-headless/references/SETUP.md +32 -103
- package/skills/wix-headless/references/astro.md +98 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +196 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +236 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-bookings.md +279 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-cms.md +163 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-events.md +203 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +222 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +124 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +160 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +118 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-portfolio.md +132 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +124 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +188 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +213 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurants.md +161 -0
- package/skills/wix-headless/references/inline-recipes/setup-blog.md +175 -0
- package/skills/wix-headless/references/inline-recipes/setup-bookings.md +232 -0
- package/skills/wix-headless/references/inline-recipes/setup-cms.md +200 -0
- package/skills/wix-headless/references/inline-recipes/setup-events.md +196 -0
- package/skills/wix-headless/references/inline-recipes/setup-forms.md +174 -0
- package/skills/wix-headless/references/inline-recipes/setup-online-store.md +192 -0
- package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +155 -0
- package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +229 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +73 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +197 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +136 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +152 -0
- package/skills/wix-headless/references/managed/AUTHENTICATION.md +57 -0
- package/skills/wix-headless/references/managed/CONNECT.md +74 -0
- package/skills/wix-headless/references/managed/CREATE.md +130 -0
- package/skills/wix-headless/references/managed/DEPLOYMENT.md +79 -0
- package/skills/wix-headless/references/non-astro.md +59 -0
- package/skills/wix-headless/references/self-managed/AUTHENTICATION.md +22 -0
- package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +15 -0
- package/skills/wix-headless/references/stripe/AUTHENTICATION.md +55 -0
- package/skills/wix-headless/references/stripe/DEPLOYMENT.md +71 -0
- package/skills/wix-manage/SKILL.md +29 -3
- package/skills/wix-manage/references/analytics/query-site-analytics.md +298 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -0
- package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +1 -1
- package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +6 -5
- package/skills/wix-manage/references/bookings/create-course-service.md +30 -5
- package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +299 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +6 -0
- package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +30 -7
- package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +517 -0
- package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +218 -0
- package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +249 -0
- package/skills/wix-manage/references/sites/site-import.md +270 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +8 -6
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +57 -0
- package/skills/wix-vibe-headless/SKILL.md +142 -0
- package/skills/wix-vibe-headless/platforms/README.md +22 -0
- package/skills/wix-vibe-headless/platforms/base44.md +142 -0
- package/skills/wix-vibe-headless/platforms/generic.md +87 -0
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +128 -0
- package/skills/wix-vibe-headless/references/blog/wix-blog.js +217 -0
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +157 -0
- package/skills/wix-vibe-headless/references/bookings/wix-bookings-checkout.js +147 -0
- package/skills/wix-vibe-headless/references/bookings/wix-bookings-services.js +217 -0
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +154 -0
- package/skills/wix-vibe-headless/references/cms/wix-cms.js +186 -0
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +142 -0
- package/skills/wix-vibe-headless/references/events/wix-events-browse.js +136 -0
- package/skills/wix-vibe-headless/references/events/wix-events-registration.js +187 -0
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +211 -0
- package/skills/wix-vibe-headless/references/members/wix-members-auth.js +387 -0
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +111 -0
- package/skills/wix-vibe-headless/references/portfolio/wix-portfolio.js +223 -0
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +127 -0
- package/skills/wix-vibe-headless/references/pricing-plans/wix-pricing-plans.js +157 -0
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +138 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-menu.js +224 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-ordering.js +156 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-reservations.js +107 -0
- package/skills/wix-vibe-headless/references/shared/wix-client.js +186 -0
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +164 -0
- package/skills/wix-vibe-headless/references/storefront/wix-store-cart.js +147 -0
- package/skills/wix-vibe-headless/references/storefront/wix-store-catalog.js +146 -0
- package/skills/wix-headless/references/BUILD-astro.md +0 -253
- package/skills/wix-headless/references/BUILD-own-build.md +0 -167
- package/skills/wix-headless/references/BUILD.md +0 -105
- package/skills/wix-headless/references/DESIGN_SYSTEM.md +0 -165
- package/skills/wix-headless/references/DISCOVERY-connect.md +0 -55
- package/skills/wix-headless/references/DISCOVERY-create.md +0 -238
- package/skills/wix-headless/references/PLAN-connect.md +0 -19
- package/skills/wix-headless/references/PLAN-create.md +0 -17
- package/skills/wix-headless/references/PLAN.md +0 -92
- package/skills/wix-headless/references/astro/blog/BLOG_PAGES.md +0 -300
- package/skills/wix-headless/references/astro/blog/BLOG_SETUP.md +0 -218
- package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +0 -45
- package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +0 -77
- package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +0 -214
- package/skills/wix-headless/references/astro/cms/FAQ_KNOWLEDGE_BASE.md +0 -231
- package/skills/wix-headless/references/astro/cms/PORTFOLIO.md +0 -453
- package/skills/wix-headless/references/astro/cms/RESOURCE_LIBRARY.md +0 -354
- package/skills/wix-headless/references/astro/cms/TEAM_DIRECTORY.md +0 -299
- package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +0 -351
- package/skills/wix-headless/references/astro/ecom/CART_PAGES.md +0 -119
- package/skills/wix-headless/references/astro/ecom/CART_WIRING.md +0 -103
- package/skills/wix-headless/references/astro/ecom/COMPONENTS_CSS.md +0 -132
- package/skills/wix-headless/references/astro/forms/CONTACT_FORM.md +0 -463
- package/skills/wix-headless/references/astro/gift-cards/COMPONENTS.md +0 -119
- package/skills/wix-headless/references/astro/gift-cards/PAGES.md +0 -129
- package/skills/wix-headless/references/astro/stores/BACK_IN_STOCK.md +0 -178
- package/skills/wix-headless/references/astro/stores/CATEGORY_PAGES.md +0 -85
- package/skills/wix-headless/references/astro/stores/COMPONENTS_CSS.md +0 -129
- package/skills/wix-headless/references/astro/stores/HOME_AND_NAV.md +0 -229
- package/skills/wix-headless/references/astro/stores/PRODUCT_PAGES.md +0 -215
- package/skills/wix-headless/references/astro/stores/SHARED_WIRING.md +0 -165
- package/skills/wix-headless/references/astro/templates/Layout.astro +0 -132
- package/skills/wix-headless/references/astro/templates/astro.config.mjs +0 -41
- package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +0 -374
- package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +0 -136
- package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +0 -25
- package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +0 -71
- package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +0 -54
- package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +0 -49
- package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +0 -245
- package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +0 -424
- package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +0 -176
- package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +0 -181
- package/skills/wix-headless/references/astro/templates/ecom/CartBadge.tsx +0 -84
- package/skills/wix-headless/references/astro/templates/ecom/CartView.tsx +0 -543
- package/skills/wix-headless/references/astro/templates/ecom/cart.astro +0 -13
- package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +0 -302
- package/skills/wix-headless/references/astro/templates/ecom/discounts.ts +0 -71
- package/skills/wix-headless/references/astro/templates/ecom/thank-you.astro +0 -24
- package/skills/wix-headless/references/astro/templates/gift-cards/GiftCardPurchase.tsx +0 -172
- package/skills/wix-headless/references/astro/templates/gift-cards/_home-teaser-snippet.astro +0 -42
- package/skills/wix-headless/references/astro/templates/gift-cards/_nav-snippet.astro +0 -11
- package/skills/wix-headless/references/astro/templates/gift-cards/components-gift-cards.css +0 -220
- package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.astro +0 -51
- package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.ts +0 -75
- package/skills/wix-headless/references/astro/templates/global.css +0 -288
- package/skills/wix-headless/references/astro/templates/stores/AddToCartButton.tsx +0 -77
- package/skills/wix-headless/references/astro/templates/stores/BackInStockForm.tsx +0 -176
- package/skills/wix-headless/references/astro/templates/stores/CategoryRail.astro +0 -69
- package/skills/wix-headless/references/astro/templates/stores/ProductCard.astro +0 -79
- package/skills/wix-headless/references/astro/templates/stores/ProductPurchase.tsx +0 -397
- package/skills/wix-headless/references/astro/templates/stores/SeoTags.astro +0 -21
- package/skills/wix-headless/references/astro/templates/stores/back-in-stock.ts +0 -67
- package/skills/wix-headless/references/astro/templates/stores/categories.ts +0 -155
- package/skills/wix-headless/references/astro/templates/stores/category/[slug].astro +0 -130
- package/skills/wix-headless/references/astro/templates/stores/components-stores.css +0 -400
- package/skills/wix-headless/references/astro/templates/stores/products/[slug].astro +0 -128
- package/skills/wix-headless/references/astro/templates/stores/products/index.astro +0 -101
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +0 -161
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +0 -32
- package/skills/wix-headless/references/bookings/FLOW.md +0 -246
- package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +0 -95
- package/skills/wix-headless/references/bookings/SERVICES_DATA.md +0 -355
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +0 -176
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +0 -71
- package/skills/wix-headless/references/commands/known-apps.json +0 -6
- package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +0 -142
- package/skills/wix-headless/references/custom/INSTRUCTIONS.md +0 -88
- package/skills/wix-headless/references/custom/blog/WIRING.md +0 -52
- package/skills/wix-headless/references/custom/bookings/WIRING.md +0 -197
- package/skills/wix-headless/references/custom/cms/WIRING.md +0 -97
- package/skills/wix-headless/references/custom/ecom/WIRING.md +0 -67
- package/skills/wix-headless/references/custom/forms/WIRING.md +0 -101
- package/skills/wix-headless/references/custom/stores/WIRING.md +0 -80
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +0 -59
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +0 -43
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +0 -51
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +0 -357
- package/skills/wix-headless/references/seed-recipes.md +0 -49
- package/skills/wix-headless/references/shared/AGENTS_MD.md +0 -47
- package/skills/wix-headless/references/shared/AUTHENTICATION.md +0 -108
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +0 -8
- package/skills/wix-headless/references/shared/DESIGN_MD.md +0 -84
- package/skills/wix-headless/references/shared/DOCS_SEARCH.md +0 -41
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +0 -186
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +0 -206
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +0 -97
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +0 -143
- package/skills/wix-headless/references/shared/STYLING.md +0 -140
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +0 -126
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +0 -252
- package/skills/wix-headless/references/verticals/_schema.json +0 -74
- package/skills/wix-headless/references/verticals/_schema.md +0 -95
- package/skills/wix-headless/references/verticals/blog.md +0 -31
- package/skills/wix-headless/references/verticals/bookings.md +0 -41
- package/skills/wix-headless/references/verticals/cms.md +0 -30
- package/skills/wix-headless/references/verticals/ecom.md +0 -25
- package/skills/wix-headless/references/verticals/forms.md +0 -26
- package/skills/wix-headless/references/verticals/gift-cards.md +0 -24
- package/skills/wix-headless/references/verticals/stores.md +0 -33
- package/skills/wix-headless/scripts/check-manifest.mjs +0 -335
- package/skills/wix-headless/scripts/compose.mjs +0 -520
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +0 -157
- package/skills/wix-headless/scripts/flatten.sh +0 -61
- package/skills/wix-headless/scripts/generate-images.mjs +0 -242
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +0 -154
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +0 -190
- package/skills/wix-headless/scripts/scaffold.sh +0 -139
- package/skills/wix-headless/scripts/seed-utilities.sh +0 -93
- package/skills/wix-headless/scripts/write-decorative-json.mjs +0 -62
- package/skills/wix-headless/shared-utilities/analytics.ts +0 -40
- package/skills/wix-headless/shared-utilities/ricos.ts +0 -179
- package/skills/wix-headless/shared-utilities/wix-image.ts +0 -72
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Pages Configuration Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface PageConfig {
|
|
6
|
+
id: string; // Unique ID
|
|
7
|
+
type: 'collectionPage' | 'entityPage';
|
|
8
|
+
appMainPage?: boolean; // EXACTLY ONE page must have true
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CollectionPage extends PageConfig {
|
|
12
|
+
type: 'collectionPage';
|
|
13
|
+
collectionPage: {
|
|
14
|
+
route: { path: '/' };
|
|
15
|
+
components: [{
|
|
16
|
+
entityPageId: string; // REQUIRED: Links to entity page ID
|
|
17
|
+
// ... component config
|
|
18
|
+
}];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface EntityPage extends PageConfig {
|
|
23
|
+
type: 'entityPage';
|
|
24
|
+
entityPage: {
|
|
25
|
+
parentPageId: string; // REQUIRED: Links to collection page ID
|
|
26
|
+
route: {
|
|
27
|
+
path: string; // MUST be '/[segment]/:entityId'
|
|
28
|
+
params: { id: 'entityId' };
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface StickyConfig {
|
|
34
|
+
stickyColumns?: number; // Count of columns to stick from left
|
|
35
|
+
columns: Array<{
|
|
36
|
+
reorderDisabled?: boolean; // Recommended for sticky cols
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Validation Logic
|
|
42
|
+
- **IF** `pages` array length != 2 **THEN** Invalid (Must be exactly 2).
|
|
43
|
+
- **IF** `appMainPage: true` count != 1 **THEN** Invalid (Must be exactly 1).
|
|
44
|
+
- **IF** `type: 'entityPage'` **THEN** `route.path` MUST match `/[segment]/:entityId`.
|
|
45
|
+
- **IF** `route.path` is `/:entityId` **THEN** Invalid (Conflict with root).
|
|
46
|
+
- **IF** `stickyColumns` is set **THEN** value must be > 0 AND <= total columns.
|
|
47
|
+
|
|
48
|
+
## Implementation Rules
|
|
49
|
+
- **MUST** generate exactly one `collectionPage` and one `entityPage`.
|
|
50
|
+
- **MUST** link pages bidirectionally:
|
|
51
|
+
- `collectionPage` references `entityPageId` (in component).
|
|
52
|
+
- `entityPage` references `parentPageId` (in page config).
|
|
53
|
+
- **MUST** use `entityId` as the dynamic parameter name.
|
|
54
|
+
- **MUST** use position-based stickiness (first N columns).
|
|
55
|
+
- **SHOULD** set `reorderDisabled: true` for sticky columns to prevent user breakage.
|
|
56
|
+
|
|
57
|
+
## Canonical Example
|
|
58
|
+
```typescript
|
|
59
|
+
[
|
|
60
|
+
{
|
|
61
|
+
id: 'product-list',
|
|
62
|
+
type: 'collectionPage',
|
|
63
|
+
appMainPage: true,
|
|
64
|
+
collectionPage: {
|
|
65
|
+
route: { path: '/' },
|
|
66
|
+
components: [{
|
|
67
|
+
type: 'collection',
|
|
68
|
+
entityPageId: 'product-details', // Link to Entity Page
|
|
69
|
+
layout: [{
|
|
70
|
+
type: 'Table',
|
|
71
|
+
table: {
|
|
72
|
+
stickyColumns: 1,
|
|
73
|
+
columns: [
|
|
74
|
+
{ id: 'name', name: 'Name', reorderDisabled: true }, // Sticky & Locked
|
|
75
|
+
{ id: 'price', name: 'Price' }
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}]
|
|
79
|
+
}]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 'product-details',
|
|
84
|
+
type: 'entityPage',
|
|
85
|
+
entityPage: {
|
|
86
|
+
parentPageId: 'product-list', // Link to Collection Page
|
|
87
|
+
route: {
|
|
88
|
+
path: '/product/:entityId', // Correct format
|
|
89
|
+
params: { id: 'entityId' }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# ResolvedAction Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface ResolvedAction {
|
|
6
|
+
label: string; // Display text
|
|
7
|
+
icon: IconElement; // React Icon Component
|
|
8
|
+
onClick: () => void; // async handlers compile due to TS void-return bivariance
|
|
9
|
+
biName?: string; // type-optional; project convention is to ALWAYS set it (see Implementation Rules)
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
hidden?: boolean;
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
skin?: string; // recommended values: 'standard' | 'inverted' | 'premium' | 'dark' | 'destructive'
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Validation Logic
|
|
18
|
+
- **IF** `disabled` is true **THEN** `tooltip` is **RECOMMENDED**.
|
|
19
|
+
- **IF** implementing a custom action **THEN** return object MUST match `ResolvedAction`.
|
|
20
|
+
- **IF** `biName` is provided **THEN** value MUST match configuration `biName`.
|
|
21
|
+
|
|
22
|
+
## Implementation Rules
|
|
23
|
+
- **MUST** include `label`, `icon`, `onClick`, and `biName`.
|
|
24
|
+
- **MUST** use valid icon element (e.g. `<Icon />`).
|
|
25
|
+
- **MUST** handle async `onClick` operations properly (use try/catch or SDK helpers).
|
|
26
|
+
- **SHOULD** use `hidden` for permission checks.
|
|
27
|
+
- **SHOULD** use `skin="destructive"` for delete/dangerous actions.
|
|
28
|
+
|
|
29
|
+
## Canonical Example
|
|
30
|
+
```typescript
|
|
31
|
+
// Resolver Function Return Value
|
|
32
|
+
return {
|
|
33
|
+
label: 'Export',
|
|
34
|
+
icon: <Download />,
|
|
35
|
+
biName: 'export-action',
|
|
36
|
+
onClick: async () => {
|
|
37
|
+
// Action logic
|
|
38
|
+
},
|
|
39
|
+
disabled: !hasData,
|
|
40
|
+
tooltip: !hasData ? 'No data to export' : undefined,
|
|
41
|
+
skin: 'standard'
|
|
42
|
+
};
|
|
43
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# SDK Utilities Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface AutoPatternsSDK {
|
|
6
|
+
closeModal: () => void;
|
|
7
|
+
getOptimisticActions: (collectionId: string) => OptimisticActions;
|
|
8
|
+
getSchema: (collectionId: string) => SchemaConfig | undefined;
|
|
9
|
+
refreshCollection: () => void;
|
|
10
|
+
collectionId: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface OptimisticActions {
|
|
14
|
+
createOne: (item: any, params: OptimisticParams) => void;
|
|
15
|
+
createMany: (items: any[], params: OptimisticParams) => void;
|
|
16
|
+
updateOne: (item: any, params: OptimisticParams) => void;
|
|
17
|
+
updateMany: (items: any[], params: OptimisticParams) => void;
|
|
18
|
+
updateAll: (transformFn: (item: any) => Partial<any>, params: OptimisticParams) => void;
|
|
19
|
+
deleteOne: (item: any, params: DeleteParams) => void;
|
|
20
|
+
deleteMany: (items: any[], params: DeleteParams) => void;
|
|
21
|
+
deleteAll: (params: DeleteParams) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface OptimisticParams {
|
|
25
|
+
submit: (items: any[]) => Promise<any>;
|
|
26
|
+
successToast: string | ToastConfig;
|
|
27
|
+
errorToast: (error: Error, actions: { retry: () => void }) => string | ToastConfig;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type DeleteParams = OptimisticParams & { showUndoToast: true };
|
|
31
|
+
|
|
32
|
+
interface ToastConfig {
|
|
33
|
+
message: string; // Must use 'message' (not 'text')
|
|
34
|
+
action?: { text: string; onClick: () => void };
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Validation Logic
|
|
39
|
+
- **IF** using `delete*` operations **THEN** `showUndoToast: true` is **REQUIRED**.
|
|
40
|
+
- **IF** returning `ToastConfig` **THEN** use `message` property (NOT `text`).
|
|
41
|
+
- **IF** using schema in submit **THEN** check `schema` existence first (can be undefined).
|
|
42
|
+
|
|
43
|
+
## Implementation Rules
|
|
44
|
+
- **MUST** use `optimisticActions` for data mutations (create/update/delete).
|
|
45
|
+
- **MUST** handle async submit failures in `errorToast`.
|
|
46
|
+
- **MUST** use `sdk.collectionId` for current context.
|
|
47
|
+
- **NEVER** use OptimisticActions for read-only operations.
|
|
48
|
+
|
|
49
|
+
## Canonical Example
|
|
50
|
+
```typescript
|
|
51
|
+
const optimisticActions = sdk.getOptimisticActions(sdk.collectionId);
|
|
52
|
+
const schema = sdk.getSchema(sdk.collectionId);
|
|
53
|
+
|
|
54
|
+
optimisticActions.updateOne(item, {
|
|
55
|
+
submit: async (items) => {
|
|
56
|
+
// Check schema existence
|
|
57
|
+
if (!schema) return items[0];
|
|
58
|
+
return await schema.actions.update(items[0]);
|
|
59
|
+
},
|
|
60
|
+
successToast: 'Item updated successfully',
|
|
61
|
+
errorToast: (err, { retry }) => ({
|
|
62
|
+
message: 'Update failed', // Use 'message'
|
|
63
|
+
action: { text: 'Retry', onClick: retry }
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Views Configuration Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface ViewsConfig {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
presets?: ViewsPreset | CategoriesPreset;
|
|
8
|
+
saveViewModalProps?: { placeholderName?: string; learnMore?: { url?: string } };
|
|
9
|
+
viewsDropdownProps?: {
|
|
10
|
+
showTotal?: boolean;
|
|
11
|
+
hideAllItemsView?: boolean;
|
|
12
|
+
customAllItemsViewLabel?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ViewsPreset {
|
|
17
|
+
type: 'views';
|
|
18
|
+
views: PresetView[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface CategoriesPreset {
|
|
22
|
+
type: 'categories';
|
|
23
|
+
categories: {
|
|
24
|
+
id: string;
|
|
25
|
+
label: string;
|
|
26
|
+
views: PresetView[];
|
|
27
|
+
icon?: { tooltipContent: string; size?: 'small' | 'medium' };
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface PresetView {
|
|
32
|
+
id: string; // Forbidden: predefined-views, saved-views, all-items-view
|
|
33
|
+
label: string;
|
|
34
|
+
isDefaultView?: boolean;
|
|
35
|
+
columnPreferences?: { id: string; direction?: 'asc' | 'desc'; show?: boolean }[];
|
|
36
|
+
filters?: Record<string, AutoFilterValue>; // Key matches filter config ID
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Validation Logic
|
|
41
|
+
- **IF** `views.enabled` is false **THEN** all other settings ignored.
|
|
42
|
+
- **IF** controlling columns in views **THEN** `table.customColumns.enabled` MUST be true.
|
|
43
|
+
- **IF** setting `columnPreferences` **THEN** must list ALL visible columns if reordering/hiding.
|
|
44
|
+
- **IF** setting filters **THEN** keys MUST match defined filter IDs.
|
|
45
|
+
|
|
46
|
+
## Implementation Rules
|
|
47
|
+
- **MUST** set `enabled: true` to activate.
|
|
48
|
+
- **MUST** use valid filter structures (Date/Number/Boolean/Enum/Reference) matching `AppConfig`.
|
|
49
|
+
- **MUST** avoid reserved IDs (`predefined-views`, `saved-views`, `all-items-view`).
|
|
50
|
+
- **SHOULD** set `isDefaultView: true` on exactly one preset if default override needed.
|
|
51
|
+
|
|
52
|
+
## Canonical Example
|
|
53
|
+
```typescript
|
|
54
|
+
views: {
|
|
55
|
+
enabled: true,
|
|
56
|
+
presets: {
|
|
57
|
+
type: 'categories',
|
|
58
|
+
categories: [{
|
|
59
|
+
id: 'status-cat',
|
|
60
|
+
label: 'By Status',
|
|
61
|
+
views: [{
|
|
62
|
+
id: 'active-items',
|
|
63
|
+
label: 'Active Only',
|
|
64
|
+
isDefaultView: true,
|
|
65
|
+
filters: {
|
|
66
|
+
'status-filter': { filterType: 'boolean', value: [{ id: 'checked', name: 'Active' }] }
|
|
67
|
+
},
|
|
68
|
+
columnPreferences: [
|
|
69
|
+
{ id: 'name', show: true },
|
|
70
|
+
{ id: 'status', show: true, direction: 'asc' }
|
|
71
|
+
]
|
|
72
|
+
}]
|
|
73
|
+
}]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
@@ -12,10 +12,15 @@ This reference lists common event types, SDK imports, permissions, and links. Fo
|
|
|
12
12
|
|
|
13
13
|
## eCommerce Events
|
|
14
14
|
|
|
15
|
+
Order events use **`@wix/ecom`** (namespace `orders`). Order **refund** events are the exception: they live in **`@wix/payments`** (namespace `refunds`), not `@wix/ecom`.
|
|
16
|
+
|
|
15
17
|
| Event | Import | Handler Call | Permission | API Reference |
|
|
16
18
|
| --- | --- | --- | --- | --- |
|
|
17
19
|
| Order created | `import { orders } from "@wix/ecom"` | `orders.onOrderCreated(handler)` | `SCOPE.DC-STORES.READ-ORDERS` | [onOrderCreated](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/order-created?apiView=SDK) |
|
|
18
20
|
| Order approved | `import { orders } from "@wix/ecom"` | `orders.onOrderApproved(handler)` | `SCOPE.DC-STORES.READ-ORDERS` | [onOrderApproved](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/order-approved?apiView=SDK) |
|
|
21
|
+
| Order canceled | `import { orders } from "@wix/ecom"` | `orders.onOrderCanceled(handler)` | `SCOPE.DC-STORES.READ-ORDERS` | [onOrderCanceled](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/orders/order-canceled?apiView=SDK) |
|
|
22
|
+
| Refund created | `import { refunds } from "@wix/payments"` | `refunds.onRefundCreated(handler)` | `SCOPE.DC-PAYMENTS.READ-REFUNDS` | [onRefundCreated](https://dev.wix.com/docs/api-reference/business-management/payments/refunds/refund-created?apiView=SDK) |
|
|
23
|
+
| Refund updated | `import { refunds } from "@wix/payments"` | `refunds.onRefundUpdated(handler)` | `SCOPE.DC-PAYMENTS.READ-REFUNDS` | [onRefundUpdated](https://dev.wix.com/docs/api-reference/business-management/payments/refunds/refund-updated?apiView=SDK) |
|
|
19
24
|
| Cart created | `import { cart } from "@wix/ecom"` | `cart.onCartCreated(handler)` | `SCOPE.DC-STORES.READ-ORDERS` | [onCartCreated](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/purchase-flow/cart/cart/cart-created?apiView=SDK) |
|
|
20
25
|
| Cart updated | `import { cart } from "@wix/ecom"` | `cart.onCartUpdated(handler)` | `SCOPE.DC-STORES.READ-ORDERS` | [onCartUpdated](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/purchase-flow/cart/cart/cart-updated?apiView=SDK) |
|
|
21
26
|
|
|
@@ -13,20 +13,6 @@ Rules and patterns for ARIA accessibility support in Editor React components.
|
|
|
13
13
|
- The `A11y` type includes: `ariaLabel`, `ariaDescribedBy`, `ariaLabelledBy`, `role`, `ariaHidden`, `ariaLive`, and all other ARIA attributes.
|
|
14
14
|
- Users provide ARIA values through the `a11y` prop: `<Component a11y={{ ariaLabel: "..." }} />`
|
|
15
15
|
|
|
16
|
-
### Stable IDs for Element Relationships
|
|
17
|
-
|
|
18
|
-
ARIA relationships (`aria-controls`, `aria-labelledby`, `aria-describedby`) and `htmlFor` need element ids. Generate them with `useStableId` from `@wix/react-component-utils` — passing the `id` prop as the override — never `Math.random()`, a manual counter, or a bare `React.useId()` (those break SSR/hydration). See [`SSR.md`](SSR.md) for the full rule.
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
import { useStableId } from '@wix/react-component-utils';
|
|
22
|
-
|
|
23
|
-
const rootId = useStableId(id);
|
|
24
|
-
const panelId = `${rootId}-panel`;
|
|
25
|
-
|
|
26
|
-
<button aria-controls={panelId}>{label}</button>
|
|
27
|
-
<div id={panelId} role="tabpanel">{content}</div>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
16
|
### ARIA Label Rules
|
|
31
17
|
|
|
32
18
|
ARIA labels are user-facing content and must NEVER be hardcoded as string literals in JSX.
|
|
@@ -150,3 +136,4 @@ export interface TabsProps {
|
|
|
150
136
|
```
|
|
151
137
|
|
|
152
138
|
**Why:** The `A11y` type from `@wix/editor-react-types` provides a standardized way to handle ALL ARIA attributes (ariaLabel, ariaDescribedBy, ariaLabelledBy, role, ariaHidden, ariaLive, etc.). Individual ARIA props fragment the API and make it harder to use.
|
|
139
|
+
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Animated Components (Play/Pause Control)
|
|
2
|
+
|
|
3
|
+
Rules and patterns for components whose primary content is a **playable
|
|
4
|
+
animation** — a Lottie/JSON animation, an animated GIF/SVG, a canvas/WebGL
|
|
5
|
+
loop, or a video-like surface.
|
|
6
|
+
|
|
7
|
+
Every such component MUST ship an on-stage **play/pause button**.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## When this applies
|
|
12
|
+
|
|
13
|
+
Apply automatically — without being asked — whenever the component has an
|
|
14
|
+
`autoPlay` prop **or** its primary content is a **startable / loopable**
|
|
15
|
+
animation a visitor would reasonably want to start or stop:
|
|
16
|
+
|
|
17
|
+
- Any component with an `autoPlay` prop (gallery, slider, carousel, etc.)
|
|
18
|
+
- Lottie / JSON vector animations
|
|
19
|
+
- Animated GIFs or animated SVGs
|
|
20
|
+
- Canvas / WebGL animation loops
|
|
21
|
+
- Any video-like playing surface
|
|
22
|
+
|
|
23
|
+
**Key rule:** If the component accepts an `autoPlay` prop — even if the
|
|
24
|
+
underlying mechanism is a `setInterval` advancing an index rather than a media
|
|
25
|
+
player — it MUST expose a play/pause button so visitors can stop the
|
|
26
|
+
auto-advancing behavior. "Autoplay" is a behavior contract, not an
|
|
27
|
+
implementation detail.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## What to add (checklist)
|
|
32
|
+
|
|
33
|
+
1. **Props** — `autoPlay`, `loop`, `pauseButtonVisibility`
|
|
34
|
+
2. **Playback state** — `isPlaying` + `handlePause` / `handleResume`
|
|
35
|
+
3. **Play/pause button** — overlay `<button>` with inline SVG icon + CSS positioning and optional hover-only visibility
|
|
36
|
+
4. **Modify `component.preview.tsx`** — suppress autoplay in editor design mode
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 1. Props
|
|
41
|
+
|
|
42
|
+
Playback controls are **behavior** props (see [`PROPS-VS-CSS.md`](PROPS-VS-CSS.md)):
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import type { A11y, Direction } from '@wix/editor-react-types';
|
|
46
|
+
|
|
47
|
+
export interface MyAnimationProps {
|
|
48
|
+
id?: string;
|
|
49
|
+
className?: string;
|
|
50
|
+
direction?: Direction;
|
|
51
|
+
a11y?: A11y;
|
|
52
|
+
|
|
53
|
+
/** Start playing on load. Default `true`. */
|
|
54
|
+
autoPlay?: boolean;
|
|
55
|
+
|
|
56
|
+
/** Repeat when finished. Default `true`. */
|
|
57
|
+
loop?: boolean;
|
|
58
|
+
|
|
59
|
+
/** Show play/pause button. Default `'showOnHover'`. */
|
|
60
|
+
pauseButtonVisibility?: 'showAlways' | 'showOnHover';
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 2. Playback state
|
|
67
|
+
|
|
68
|
+
Track play/pause state with `useState`, initialized from the `autoPlay` prop:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
const [isPlaying, setIsPlaying] = React.useState(autoPlay ?? true);
|
|
72
|
+
|
|
73
|
+
const handlePause = () => setIsPlaying(false);
|
|
74
|
+
const handleResume = () => setIsPlaying(true);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Pass `isPlaying` to the animation renderer and toggle between `handlePause` / `handleResume` on button click.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 3. Play/pause button
|
|
82
|
+
|
|
83
|
+
Create play/pause icons that visually match the component's style. Use simple recognizable shapes — a triangle for play, two rectangles for pause — implemented as inline SVG so there is no external icon dependency. Size, stroke, and fill should feel native to the component's design.
|
|
84
|
+
|
|
85
|
+
Position the button absolutely so it overlays the content without pushing other elements out of place:
|
|
86
|
+
|
|
87
|
+
```css
|
|
88
|
+
.animationContainer {
|
|
89
|
+
position: relative;
|
|
90
|
+
block-size: 100%;
|
|
91
|
+
inline-size: 100%;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.playButton {
|
|
95
|
+
position: absolute;
|
|
96
|
+
inset-inline-end: 5px;
|
|
97
|
+
inset-block-start: 5px;
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
```css
|
|
102
|
+
/* pauseButtonVisibility variants — structural CSS, not named-part rules */
|
|
103
|
+
|
|
104
|
+
/* showOnHover (default) */
|
|
105
|
+
.root[data-pause-button-visibility="showOnHover"] .playButton {
|
|
106
|
+
opacity: 0;
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.root[data-pause-button-visibility="showOnHover"]:hover .playButton {
|
|
111
|
+
opacity: 1;
|
|
112
|
+
pointer-events: auto;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* showAlways — no extra CSS needed; button is visible by default */
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 4. Modify `component.preview.tsx` for autoplay suppression
|
|
121
|
+
|
|
122
|
+
For animated components, modify the generated `component.preview.tsx` to suppress autoplay in editor design mode. See [`COMPONENT-PREVIEW.md`](COMPONENT-PREVIEW.md) for how the preview file works.
|
|
123
|
+
|
|
124
|
+
### Target state of `component.preview.tsx`
|
|
125
|
+
|
|
126
|
+
Replace the generated passthrough with the following. Replace `MyComponent` with the real component name.
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
import React from 'react';
|
|
130
|
+
import MyComponent from './component';
|
|
131
|
+
import { useIsEditMode } from '@wix/react-component-utils';
|
|
132
|
+
|
|
133
|
+
export default function MyComponentPreview(
|
|
134
|
+
props: React.ComponentProps<typeof MyComponent>,
|
|
135
|
+
) {
|
|
136
|
+
const isEditMode = useIsEditMode();
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<MyComponent
|
|
140
|
+
{...props}
|
|
141
|
+
autoPlay={isEditMode ? false : props.autoPlay}
|
|
142
|
+
pauseButtonVisibility={isEditMode ? 'showAlways' : props.pauseButtonVisibility}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
In editor design mode (`isEditMode` is `true`) → `autoPlay` is forced to `false` and `pauseButtonVisibility` is forced to `'showAlways'` so the site owner can always see and interact with the button.
|
|
149
|
+
In preview mode (`isEditMode` is `false`) → both use the user's configured values.
|
|
150
|
+
|
|
151
|
+
---
|
|
@@ -7,23 +7,17 @@ Rules and patterns for props structure, elementProps, data types, file structure
|
|
|
7
7
|
## Should This Use elementProps or CSS?
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
|
|
11
|
-
- Configuration/data beyond styling
|
|
12
|
-
- Direction override
|
|
13
|
-
- State management
|
|
14
|
-
- Event handlers
|
|
15
|
-
|
|
10
|
+
Is this element a named part (carries a global class string)?
|
|
16
11
|
│
|
|
17
12
|
├─ YES
|
|
18
|
-
│ └─ ✅
|
|
13
|
+
│ └─ ✅ It gets an elementProps entry — spread it + merge its className.
|
|
14
|
+
│ Add config fields inside the entry only as needed
|
|
15
|
+
│ (data, direction, event handlers).
|
|
19
16
|
│
|
|
20
|
-
└─ NO →
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
│
|
|
25
|
-
└─ NO
|
|
26
|
-
└─ Re-evaluate: likely needs elementProps
|
|
17
|
+
└─ NO → purely visual/decorative non-part
|
|
18
|
+
(icons, separators, decorations, layout wrappers,
|
|
19
|
+
elements only hidden/shown via CSS)
|
|
20
|
+
└─ ❌ CSS class only — no elementProps entry
|
|
27
21
|
```
|
|
28
22
|
|
|
29
23
|
---
|
|
@@ -58,23 +52,53 @@ interface ComponentProps {
|
|
|
58
52
|
}
|
|
59
53
|
```
|
|
60
54
|
|
|
61
|
-
###
|
|
55
|
+
### Propagate `elementProps` to inner elements
|
|
56
|
+
|
|
57
|
+
`elementProps` is a map keyed by the manifest's inner-element keys; each entry
|
|
58
|
+
carries that element's `className` (the editor sets it — this is how design
|
|
59
|
+
states reach the element) plus any data.
|
|
60
|
+
|
|
61
|
+
**Every named inner element — every element that carries a global class
|
|
62
|
+
string — gets an `elementProps` entry, and you spread that entry onto the
|
|
63
|
+
element.** This is mandatory, even when the element needs no other config:
|
|
64
|
+
without it the editor cannot style that element or drive its states.
|
|
62
65
|
|
|
63
|
-
|
|
66
|
+
How `className` gets merged depends on what the element is:
|
|
67
|
+
|
|
68
|
+
- **Raw HTML element** (`<button>`, `<li>`, `<div>`): merge
|
|
69
|
+
`elementProps?.<key>.className` inline, alongside the global string and module
|
|
70
|
+
class — there's no component to do it.
|
|
71
|
+
- **Sub-component built with this skill** (`<Inner/>`): the spread alone is
|
|
72
|
+
enough. `className` rides along inside it, and the sub-component merges it onto
|
|
73
|
+
its own root (every skill component merges its incoming `className`). Don't
|
|
74
|
+
merge it again at the call site.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
interface PlanCardProps {
|
|
78
|
+
className?: string;
|
|
79
|
+
elementProps?: {
|
|
80
|
+
cta?: { className?: string; href?: string };
|
|
81
|
+
};
|
|
82
|
+
}
|
|
64
83
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
84
|
+
// Raw HTML element — spread + merge className inline.
|
|
85
|
+
// Note: the elementProps key is the short part name (`cta`), while the global
|
|
86
|
+
// class is prefixed with the component name (`plan-card-cta`). Keep them as-is.
|
|
87
|
+
<button {...elementProps?.cta} className={classNames('plan-card-cta', styles.cta, elementProps?.cta?.className)}>
|
|
88
|
+
{label}
|
|
89
|
+
</button>
|
|
69
90
|
|
|
70
|
-
|
|
91
|
+
// Sub-component built with this skill — spread is enough (it merges className itself):
|
|
92
|
+
<PlanRow {...elementProps?.planRow} />
|
|
93
|
+
```
|
|
71
94
|
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
- Elements that would only have `className` — skip them entirely
|
|
75
|
-
- Icons, decorations, separators
|
|
95
|
+
**Non-parts** (module-class-only elements: icons, decorations, separators,
|
|
96
|
+
layout wrappers — no global class) get no entry. Style them with CSS.
|
|
76
97
|
|
|
77
|
-
**
|
|
98
|
+
**Inside each entry**, add only the config the element needs (data, direction,
|
|
99
|
+
event handlers). Never add a bare `className?` as the *only* field to decide
|
|
100
|
+
whether an element qualifies — `className` always flows through; the entry
|
|
101
|
+
exists because the element is a named part.
|
|
78
102
|
|
|
79
103
|
### What Qualifies as a Part
|
|
80
104
|
|
|
@@ -178,8 +202,8 @@ editor) or imported local assets bundled with the component.
|
|
|
178
202
|
|
|
179
203
|
### Default values for `Image` props
|
|
180
204
|
|
|
181
|
-
Image defaults belong in the
|
|
182
|
-
constant (
|
|
205
|
+
Image defaults belong in the `<componentName>.props.ts` file's exported
|
|
206
|
+
`defaultProps` constant (consumed by `withDefaults(Component, defaultProps)` in
|
|
183
207
|
`component.tsx`). Use a Wix-hosted image from the Free-from-Wix public
|
|
184
208
|
media catalog and populate **only** `uri`, `url`, and `alt` — leave
|
|
185
209
|
`width`, `height`, `focalPoint`, etc. unset so the editor fills them when
|
|
@@ -426,7 +450,7 @@ elementProps?: {
|
|
|
426
450
|
// Style via CSS classes directly
|
|
427
451
|
```
|
|
428
452
|
|
|
429
|
-
**Why:**
|
|
453
|
+
**Why:** Don't declare a `className?:` field — `className` already flows through each named inner element's `elementProps` entry (see "Propagate `elementProps` to inner elements"). Conditional display is controlled via CSS, not React props.
|
|
430
454
|
|
|
431
455
|
### Using T[] array syntax
|
|
432
456
|
|
|
@@ -452,3 +476,4 @@ interface ComponentProps {
|
|
|
452
476
|
```
|
|
453
477
|
|
|
454
478
|
See also: [Array Element Types: Always Objects with Named Keys](#array-element-types-always-objects-with-named-keys) — items must be objects with named keys.
|
|
479
|
+
|
|
@@ -128,14 +128,14 @@ resizeDirection: LAYOUT.RESIZE_DIRECTION.aspectRatio,
|
|
|
128
128
|
|
|
129
129
|
## 3. Wiring defaults into the manifest
|
|
130
130
|
|
|
131
|
-
1. **
|
|
131
|
+
1. **Define and export `defaultProps` from `<componentName>.props.ts`** — this is the single source of truth used by both `component.tsx` and the extension file.
|
|
132
132
|
2. **Import `componentUrl` from `'./component.tsx?url'`** (the wrapped component), not from `'./ComponentName.tsx?url'` (the raw component).
|
|
133
133
|
3. **Wrap `editorElement` with `withEditorElementDefaults`** using the same `defaultProps`.
|
|
134
134
|
|
|
135
135
|
```ts
|
|
136
136
|
import { withEditorElementDefaults } from '@wix/react-component-utils';
|
|
137
137
|
import componentUrl from './component.tsx?url';
|
|
138
|
-
import { defaultProps } from '
|
|
138
|
+
import { defaultProps } from './<componentName>.props';
|
|
139
139
|
|
|
140
140
|
// in the extension:
|
|
141
141
|
editorElement: withEditorElementDefaults({
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Component Preview (`component.preview.tsx`)
|
|
2
|
+
|
|
3
|
+
Rules and patterns for the editor-specific entry point that every Editor React
|
|
4
|
+
component ships alongside its main `component.tsx`.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## What it is
|
|
9
|
+
|
|
10
|
+
`component.preview.tsx` is the editor-specific entry point for a component. The
|
|
11
|
+
Wix CLI loads it **instead of** `component.tsx` when rendering the component
|
|
12
|
+
inside the Harmony Editor. It is generated automatically by the scaffold as a
|
|
13
|
+
passthrough that forwards all props unchanged:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
const MyComponentPreview = (props: React.ComponentProps<typeof MyComponent>) => (
|
|
17
|
+
<MyComponent {...props} />
|
|
18
|
+
);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The extension file is also pre-wired to load it — no manual wiring is needed:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import componentPreviewUrl from './component.preview.tsx?url';
|
|
25
|
+
|
|
26
|
+
resources: {
|
|
27
|
+
client: { componentUrl },
|
|
28
|
+
editor: { componentUrl: componentPreviewUrl },
|
|
29
|
+
},
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## `useIsEditMode()`
|
|
35
|
+
|
|
36
|
+
When you need to distinguish **editor design mode** from **editor preview mode**,
|
|
37
|
+
use `useIsEditMode()` from `@wix/react-component-utils`:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { useIsEditMode } from '@wix/react-component-utils';
|
|
41
|
+
|
|
42
|
+
const isEditMode = useIsEditMode();
|
|
43
|
+
// true → editor is in design mode
|
|
44
|
+
// false → editor is in preview mode
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`@wix/react-component-utils` is already a base dependency — no additional install needed.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## When to modify it
|
|
52
|
+
|
|
53
|
+
Modify `component.preview.tsx` whenever the component needs to behave differently
|
|
54
|
+
inside the editor than it does on the live site. The most common case is
|
|
55
|
+
suppressing autoplay so animations don't run while the site owner is designing.
|
|
56
|
+
|
|
57
|
+
→ See [`ANIMATED-COMPONENTS.md`](ANIMATED-COMPONENTS.md) §4 for the autoplay suppression pattern.
|