@wix/agent-skills 1.0.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/LICENSE +21 -0
- package/README.md +111 -0
- package/package.json +29 -0
- package/skills/wix-app/SKILL.md +344 -0
- package/skills/wix-app/references/APP_IDENTIFIERS.md +35 -0
- package/skills/wix-app/references/APP_MARKET_REVIEW.md +311 -0
- package/skills/wix-app/references/APP_VALIDATION.md +171 -0
- package/skills/wix-app/references/BACKEND_API.md +233 -0
- package/skills/wix-app/references/BACKEND_EVENT.md +116 -0
- package/skills/wix-app/references/CODE_QUALITY.md +33 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +587 -0
- package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +157 -0
- package/skills/wix-app/references/DASHBOARD_MODAL.md +283 -0
- package/skills/wix-app/references/DASHBOARD_PAGE.md +403 -0
- package/skills/wix-app/references/DASHBOARD_PLUGIN.md +205 -0
- package/skills/wix-app/references/DATA_COLLECTION.md +451 -0
- package/skills/wix-app/references/DOCUMENTATION.md +42 -0
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +65 -0
- package/skills/wix-app/references/EMBEDDED_SCRIPT.md +468 -0
- package/skills/wix-app/references/EXTENSION_REGISTRATION.md +96 -0
- package/skills/wix-app/references/SERVICE_PLUGIN.md +235 -0
- package/skills/wix-app/references/SITE_PLUGIN.md +436 -0
- package/skills/wix-app/references/STORES_VERSIONING.md +334 -0
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +84 -0
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +345 -0
- package/skills/wix-app/references/dashboard-menu-plugin/blog-slots.md +71 -0
- package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +58 -0
- package/skills/wix-app/references/dashboard-menu-plugin/crm-slots.md +8 -0
- package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +17 -0
- package/skills/wix-app/references/dashboard-menu-plugin/events-slots.md +29 -0
- package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +27 -0
- package/skills/wix-app/references/dashboard-menu-plugin/stores-slots.md +35 -0
- package/skills/wix-app/references/dashboard-page/API_SPEC.md +138 -0
- package/skills/wix-app/references/dashboard-page/DASHBOARD_API.md +573 -0
- package/skills/wix-app/references/dashboard-page/DYNAMIC_PARAMETERS.md +269 -0
- package/skills/wix-app/references/dashboard-page/ECOM_NAVIGATION.md +164 -0
- package/skills/wix-app/references/dashboard-plugin/SLOTS.md +294 -0
- package/skills/wix-app/references/data-collection/WIX_DATA.md +270 -0
- package/skills/wix-app/references/data-collection/extension-template.ts +107 -0
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +138 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +454 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +165 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +576 -0
- package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +170 -0
- package/skills/wix-app/references/editor-react-component/EDIT-FLOW.md +6 -0
- package/skills/wix-app/references/editor-react-component/PARTS.md +25 -0
- package/skills/wix-app/references/editor-react-component/PROPS-VS-CSS.md +203 -0
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +167 -0
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +137 -0
- package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +112 -0
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +118 -0
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +87 -0
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +86 -0
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +135 -0
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +79 -0
- package/skills/wix-app/references/service-plugin/VALIDATIONS.md +68 -0
- package/skills/wix-app/references/site-plugin/EXAMPLES.md +311 -0
- package/skills/wix-app/references/site-plugin/SLOTS.md +263 -0
- package/skills/wix-design-system/SKILL.md +129 -0
- package/skills/wix-design-system/references/file-structure.md +56 -0
- package/skills/wix-design-system/scripts/wds.cjs +531 -0
- package/skills/wix-headless/SKILL.md +418 -0
- package/skills/wix-headless/references/DISCOVERY.md +332 -0
- package/skills/wix-headless/references/ORCHESTRATION.md +269 -0
- package/skills/wix-headless/references/SETUP.md +154 -0
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +152 -0
- package/skills/wix-headless/references/blog/BLOG_PAGES.md +299 -0
- package/skills/wix-headless/references/blog/BLOG_SETUP.md +218 -0
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +32 -0
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +373 -0
- package/skills/wix-headless/references/cms/FAQ_KNOWLEDGE_BASE.md +229 -0
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +40 -0
- package/skills/wix-headless/references/cms/PORTFOLIO.md +454 -0
- package/skills/wix-headless/references/cms/RESOURCE_LIBRARY.md +356 -0
- package/skills/wix-headless/references/cms/TEAM_DIRECTORY.md +299 -0
- package/skills/wix-headless/references/commands/install-app.md +42 -0
- package/skills/wix-headless/references/commands/known-apps.json +5 -0
- package/skills/wix-headless/references/commands/mcp-bootstrap.md +28 -0
- package/skills/wix-headless/references/designer/INSTRUCTIONS.md +828 -0
- package/skills/wix-headless/references/ecom/CART_PAGES.md +120 -0
- package/skills/wix-headless/references/ecom/CART_WIRING.md +103 -0
- package/skills/wix-headless/references/ecom/COMPONENTS_CSS.md +132 -0
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +59 -0
- package/skills/wix-headless/references/forms/CONTACT_FORM.md +477 -0
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +43 -0
- package/skills/wix-headless/references/gift-cards/COMPONENTS.md +119 -0
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +51 -0
- package/skills/wix-headless/references/gift-cards/PAGES.md +129 -0
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +359 -0
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +8 -0
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +185 -0
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +155 -0
- package/skills/wix-headless/references/shared/MCP_PREFIX.md +105 -0
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +97 -0
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +423 -0
- package/skills/wix-headless/references/shared/STYLING.md +117 -0
- package/skills/wix-headless/references/stores/BACK_IN_STOCK.md +178 -0
- package/skills/wix-headless/references/stores/CATEGORY_PAGES.md +86 -0
- package/skills/wix-headless/references/stores/COMPONENTS_CSS.md +129 -0
- package/skills/wix-headless/references/stores/HOME_AND_NAV.md +227 -0
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +96 -0
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +249 -0
- package/skills/wix-headless/references/stores/PRODUCT_PAGES.md +213 -0
- package/skills/wix-headless/references/stores/SHARED_WIRING.md +164 -0
- package/skills/wix-headless/references/verticals/_schema.json +160 -0
- package/skills/wix-headless/references/verticals/_schema.md +185 -0
- package/skills/wix-headless/references/verticals/blog.md +125 -0
- package/skills/wix-headless/references/verticals/cms.md +121 -0
- package/skills/wix-headless/references/verticals/ecom.md +96 -0
- package/skills/wix-headless/references/verticals/forms.md +106 -0
- package/skills/wix-headless/references/verticals/gift-cards.md +121 -0
- package/skills/wix-headless/references/verticals/stores.md +167 -0
- package/skills/wix-headless/scripts/check-manifest.mjs +198 -0
- package/skills/wix-headless/scripts/copy-utility-templates.mjs +153 -0
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +77 -0
- package/skills/wix-headless/scripts/finalize-run-json.mjs +141 -0
- package/skills/wix-headless/scripts/init-site-json.mjs +63 -0
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +124 -0
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +190 -0
- package/skills/wix-headless/scripts/preview.sh +45 -0
- package/skills/wix-headless/scripts/release.sh +73 -0
- package/skills/wix-headless/scripts/scaffold.sh +53 -0
- package/skills/wix-headless/scripts/seed-utilities.sh +55 -0
- package/skills/wix-headless/shared-utilities/analytics.ts +40 -0
- package/skills/wix-headless/shared-utilities/ricos.ts +179 -0
- package/skills/wix-headless/shared-utilities/wix-image.ts +72 -0
- package/skills/wix-headless/templates/ecom/CartBadge.tsx +84 -0
- package/skills/wix-headless/templates/ecom/CartView.tsx +543 -0
- package/skills/wix-headless/templates/ecom/cart.astro +13 -0
- package/skills/wix-headless/templates/ecom/components-ecom.css +215 -0
- package/skills/wix-headless/templates/ecom/discounts.ts +71 -0
- package/skills/wix-headless/templates/ecom/thank-you.astro +24 -0
- package/skills/wix-headless/templates/gift-cards/GiftCardPurchase.tsx +172 -0
- package/skills/wix-headless/templates/gift-cards/_home-teaser-snippet.astro +42 -0
- package/skills/wix-headless/templates/gift-cards/_nav-snippet.astro +11 -0
- package/skills/wix-headless/templates/gift-cards/components-gift-cards.css +219 -0
- package/skills/wix-headless/templates/gift-cards/gift-cards.astro +51 -0
- package/skills/wix-headless/templates/gift-cards/gift-cards.ts +75 -0
- package/skills/wix-headless/templates/stores/AddToCartButton.tsx +77 -0
- package/skills/wix-headless/templates/stores/BackInStockForm.tsx +176 -0
- package/skills/wix-headless/templates/stores/CategoryRail.astro +69 -0
- package/skills/wix-headless/templates/stores/ProductCard.astro +79 -0
- package/skills/wix-headless/templates/stores/ProductPurchase.tsx +397 -0
- package/skills/wix-headless/templates/stores/SeoTags.astro +21 -0
- package/skills/wix-headless/templates/stores/back-in-stock.ts +67 -0
- package/skills/wix-headless/templates/stores/categories.ts +155 -0
- package/skills/wix-headless/templates/stores/category/[slug].astro +130 -0
- package/skills/wix-headless/templates/stores/components-stores.css +295 -0
- package/skills/wix-headless/templates/stores/products/[slug].astro +128 -0
- package/skills/wix-headless/templates/stores/products/index.astro +101 -0
- package/skills/wix-manage/SKILL.md +280 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +155 -0
- package/skills/wix-manage/references/app-installation/list-installed-apps.md +124 -0
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +226 -0
- package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +95 -0
- package/skills/wix-manage/references/bookings/booking-system-integration-gaps.md +416 -0
- package/skills/wix-manage/references/bookings/bookings-staff-setup.md +255 -0
- package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +462 -0
- package/skills/wix-manage/references/bookings/end-to-end-booking-flow.md +278 -0
- package/skills/wix-manage/references/bookings/external-calendar-integration.md +258 -0
- package/skills/wix-manage/references/bookings/multi-resource-service-creation.md +231 -0
- package/skills/wix-manage/references/calendar/configure-default-business-hours.md +226 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +422 -0
- package/skills/wix-manage/references/cms/cms-data-operations-extended.md +263 -0
- package/skills/wix-manage/references/cms/cms-ecommerce-catalog-integration.md +136 -0
- package/skills/wix-manage/references/cms/cms-references-and-relationships.md +160 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +143 -0
- package/skills/wix-manage/references/contacts/bulk-delete-contacts.md +73 -0
- package/skills/wix-manage/references/contacts/bulk-label-and-unlabel-contacts.md +67 -0
- package/skills/wix-manage/references/domains/domain-search-and-purchase.md +434 -0
- package/skills/wix-manage/references/ecommerce/api-recommendation-tracking.md +420 -0
- package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +267 -0
- package/skills/wix-manage/references/ecommerce/flow-bundle-and-save.md +290 -0
- package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +300 -0
- package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +364 -0
- package/skills/wix-manage/references/ecommerce/flow-seasonal-promotion.md +315 -0
- package/skills/wix-manage/references/ecommerce/flow-stock-mover.md +308 -0
- package/skills/wix-manage/references/ecommerce/flow-upsell-boost.md +271 -0
- package/skills/wix-manage/references/ecommerce/goal-clear-inventory.md +118 -0
- package/skills/wix-manage/references/ecommerce/goal-drive-cross-sells.md +122 -0
- package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +132 -0
- package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +148 -0
- package/skills/wix-manage/references/ecommerce/goal-seasonal-revenue.md +146 -0
- package/skills/wix-manage/references/ecommerce/guardrail-discount-conflicts.md +118 -0
- package/skills/wix-manage/references/ecommerce/guardrail-margin-protection.md +88 -0
- package/skills/wix-manage/references/ecommerce/guardrail-rate-pricing-sanity.md +108 -0
- package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +124 -0
- package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +299 -0
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +582 -0
- package/skills/wix-manage/references/ecommerce/setup-coupons.md +338 -0
- package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +444 -0
- package/skills/wix-manage/references/ecommerce/setup-shipping-rates.md +86 -0
- package/skills/wix-manage/references/ecommerce/setup-shipping-regions.md +56 -0
- package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +209 -0
- package/skills/wix-manage/references/ecommerce/skill-graph.md +139 -0
- package/skills/wix-manage/references/ecommerce/troubleshoot-checkout-delivery-dropoff.md +124 -0
- package/skills/wix-manage/references/ecommerce/troubleshoot-discount-not-applying.md +95 -0
- package/skills/wix-manage/references/events/list-events.md +203 -0
- package/skills/wix-manage/references/forms/create-form.md +260 -0
- package/skills/wix-manage/references/get-paid/create-payment-links.md +212 -0
- package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +57 -0
- package/skills/wix-manage/references/get-paid/payment-links-for-bookings.md +101 -0
- package/skills/wix-manage/references/media/upload-media-to-wix.md +216 -0
- package/skills/wix-manage/references/pricing-plans/create-and-update-pricing-plans.md +77 -0
- package/skills/wix-manage/references/pricing-plans/pricing-plans-bookings-integration.md +166 -0
- package/skills/wix-manage/references/restaurants/wix-restaurants-setup.md +336 -0
- package/skills/wix-manage/references/rich-content/ricos-converter-service.md +295 -0
- package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +59 -0
- package/skills/wix-manage/references/sites/create-site-from-template.md +183 -0
- package/skills/wix-manage/references/sites/query-sites.md +125 -0
- package/skills/wix-manage/references/stores/add-store-pages-to-site.md +57 -0
- package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +1041 -0
- package/skills/wix-manage/references/stores/create-product-catalog-v1.md +125 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +824 -0
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +566 -0
- package/skills/wix-manage/references/stores/find-products-query-and-search-catalog-v3.md +194 -0
- package/skills/wix-manage/references/stores/query-products-catalog-v1.md +80 -0
- package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +99 -0
- package/skills/wix-manage/references/stores/update-product-pre-order.md +213 -0
- package/skills/wix-manage/references/stores/update-product-with-options.md +318 -0
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
|
|
2
|
+
# Wix Custom Element Widget Builder
|
|
3
|
+
|
|
4
|
+
Creates custom element widget extensions for Wix CLI applications. Custom element widgets are React components converted to web components that appear in the Wix Editor, allowing site owners to add interactive, configurable widgets to their pages with a built-in settings panel.
|
|
5
|
+
|
|
6
|
+
## Quick Start Checklist
|
|
7
|
+
|
|
8
|
+
Follow these steps in order when creating a custom element widget:
|
|
9
|
+
|
|
10
|
+
1. [ ] Create widget folder: `src/extensions/site/widgets/custom-elements/<widget-name>/`
|
|
11
|
+
2. [ ] Create `widget.tsx` with React component and `reactToWebComponent` conversion
|
|
12
|
+
3. [ ] Create `panel.tsx` with WDS components and `widget.getProp/setProp`
|
|
13
|
+
4. [ ] Create `extensions.ts` with `extensions.customElement()` and unique UUID
|
|
14
|
+
5. [ ] Update `src/extensions.ts` to import and use the new extension
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
Custom element widgets consist of **two required files**:
|
|
19
|
+
|
|
20
|
+
### 1. Widget Component (`widget.tsx`)
|
|
21
|
+
|
|
22
|
+
React component converted to a web component using `react-to-webcomponent`:
|
|
23
|
+
|
|
24
|
+
- Define Props interface with configurable properties (camelCase)
|
|
25
|
+
- Create a React functional component that renders the widget UI
|
|
26
|
+
- Convert to web component with props mapping
|
|
27
|
+
- Use inline styles (no CSS imports)
|
|
28
|
+
- Handle Wix Editor environment when using Wix Data API
|
|
29
|
+
|
|
30
|
+
### 2. Settings Panel (`panel.tsx`)
|
|
31
|
+
|
|
32
|
+
Settings panel shown in the Wix Editor sidebar:
|
|
33
|
+
|
|
34
|
+
- Uses Wix Design System components (see [SETTINGS_PANEL.md](custom-element-widget/SETTINGS_PANEL.md))
|
|
35
|
+
- Manages widget properties via `@wix/editor` widget API
|
|
36
|
+
- Loads initial values with `widget.getProp('kebab-case-name')`
|
|
37
|
+
- Updates properties with `widget.setProp('kebab-case-name', value)`
|
|
38
|
+
- Wrapped in `WixDesignSystemProvider > SidePanel > SidePanel.Content`
|
|
39
|
+
- For color pickers, use `inputs.selectColor()` from `@wix/editor` with `FillPreview` — NOT `<Input type="color">`
|
|
40
|
+
- For font pickers, use `inputs.selectFont()` from `@wix/editor` with a `Button` — NOT a text Input
|
|
41
|
+
|
|
42
|
+
## Widget Component Pattern
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import React, { type FC, useState, useEffect } from 'react';
|
|
46
|
+
import ReactDOM from 'react-dom';
|
|
47
|
+
import reactToWebComponent from 'react-to-webcomponent';
|
|
48
|
+
|
|
49
|
+
interface WidgetProps {
|
|
50
|
+
title?: string;
|
|
51
|
+
targetDate?: string;
|
|
52
|
+
targetTime?: string;
|
|
53
|
+
bgColor?: string;
|
|
54
|
+
textColor?: string;
|
|
55
|
+
font?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const CustomElement: FC<WidgetProps> = ({
|
|
59
|
+
title = 'Countdown',
|
|
60
|
+
targetDate = '',
|
|
61
|
+
targetTime = '00:00',
|
|
62
|
+
bgColor = '#ffffff',
|
|
63
|
+
textColor = '#333333',
|
|
64
|
+
font = "{}",
|
|
65
|
+
}) => {
|
|
66
|
+
const { font: textFont, textDecoration } = JSON.parse(font);
|
|
67
|
+
const [time, setTime] = useState({ days: 0, hours: 0, minutes: 0, seconds: 0, isExpired: false });
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!targetDate) return;
|
|
71
|
+
|
|
72
|
+
const update = () => {
|
|
73
|
+
const target = new Date(`${targetDate}T${targetTime}`);
|
|
74
|
+
const diff = target.getTime() - Date.now();
|
|
75
|
+
if (diff <= 0) {
|
|
76
|
+
setTime({ days: 0, hours: 0, minutes: 0, seconds: 0, isExpired: true });
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
setTime({
|
|
80
|
+
days: Math.floor(diff / (1000 * 60 * 60 * 24)),
|
|
81
|
+
hours: Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)),
|
|
82
|
+
minutes: Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)),
|
|
83
|
+
seconds: Math.floor((diff % (1000 * 60)) / 1000),
|
|
84
|
+
isExpired: false,
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
update();
|
|
89
|
+
const interval = setInterval(update, 1000);
|
|
90
|
+
return () => clearInterval(interval);
|
|
91
|
+
}, [targetDate, targetTime]);
|
|
92
|
+
|
|
93
|
+
const styles = {
|
|
94
|
+
wrapper: {
|
|
95
|
+
backgroundColor: bgColor,
|
|
96
|
+
padding: '24px 32px',
|
|
97
|
+
textAlign: 'center' as const,
|
|
98
|
+
display: 'inline-block',
|
|
99
|
+
},
|
|
100
|
+
title: {
|
|
101
|
+
font: textFont || '600 24px sans-serif',
|
|
102
|
+
color: textColor,
|
|
103
|
+
textDecoration,
|
|
104
|
+
marginBottom: '16px',
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div style={styles.wrapper}>
|
|
110
|
+
{title && <div style={styles.title}>{title}</div>}
|
|
111
|
+
{/* Widget content */}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const customElement = reactToWebComponent(CustomElement, React, ReactDOM, {
|
|
117
|
+
props: {
|
|
118
|
+
title: 'string',
|
|
119
|
+
targetDate: 'string',
|
|
120
|
+
targetTime: 'string',
|
|
121
|
+
bgColor: 'string',
|
|
122
|
+
textColor: 'string',
|
|
123
|
+
font: 'string',
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export default customElement;
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Key Points:**
|
|
131
|
+
|
|
132
|
+
- Props interface uses **camelCase** (e.g., `targetDate`, `bgColor`)
|
|
133
|
+
- `reactToWebComponent` config uses camelCase keys with `'string'` type
|
|
134
|
+
- All props are passed as strings from the web component
|
|
135
|
+
- Use inline styles, not CSS imports. Do NOT put functions in styles objects (causes TS2560/TS2349). For conditional styles, use ternary expressions directly in the `style` prop: `style={{ ...styles.itemBase, color: item.done ? '#999' : '#000' }}`
|
|
136
|
+
- Parse complex props (like `font`) from JSON strings: `const { font: textFont, textDecoration } = JSON.parse(font)`
|
|
137
|
+
- Apply font via `font` CSS shorthand and `textDecoration` property
|
|
138
|
+
- Extract helper components, utility functions, and styles into separate files for clean code organization
|
|
139
|
+
|
|
140
|
+
## Settings Panel Pattern
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import React, { type FC, useState, useEffect, useCallback } from "react";
|
|
144
|
+
import { widget } from "@wix/editor";
|
|
145
|
+
import {
|
|
146
|
+
SidePanel,
|
|
147
|
+
WixDesignSystemProvider,
|
|
148
|
+
Input,
|
|
149
|
+
FormField,
|
|
150
|
+
TimeInput,
|
|
151
|
+
Box,
|
|
152
|
+
} from "@wix/design-system";
|
|
153
|
+
import "@wix/design-system/styles.global.css";
|
|
154
|
+
import { ColorPickerField } from "./components/ColorPickerField";
|
|
155
|
+
import { FontPickerField } from "./components/FontPickerField";
|
|
156
|
+
import { parseTimeValue } from "./utils";
|
|
157
|
+
|
|
158
|
+
const DEFAULT_BG_COLOR = "#0a0e27";
|
|
159
|
+
const DEFAULT_TEXT_COLOR = "#00ff88";
|
|
160
|
+
const DEFAULT_TEXT_FONT = "";
|
|
161
|
+
const DEFAULT_TEXT_DECORATION = "";
|
|
162
|
+
|
|
163
|
+
const Panel: FC = () => {
|
|
164
|
+
const [title, setTitle] = useState<string>("Countdown");
|
|
165
|
+
const [targetDate, setTargetDate] = useState<string>("");
|
|
166
|
+
const [targetTime, setTargetTime] = useState<string>("00:00");
|
|
167
|
+
const [bgColor, setBgColor] = useState<string>(DEFAULT_BG_COLOR);
|
|
168
|
+
const [textColor, setTextColor] = useState<string>(DEFAULT_TEXT_COLOR);
|
|
169
|
+
const [font, setFont] = useState({ font: DEFAULT_TEXT_FONT, textDecoration: DEFAULT_TEXT_DECORATION });
|
|
170
|
+
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
Promise.all([
|
|
173
|
+
widget.getProp("title"),
|
|
174
|
+
widget.getProp("target-date"),
|
|
175
|
+
widget.getProp("target-time"),
|
|
176
|
+
widget.getProp("bg-color"),
|
|
177
|
+
widget.getProp("text-color"),
|
|
178
|
+
widget.getProp("font"),
|
|
179
|
+
])
|
|
180
|
+
.then(([titleVal, dateVal, timeVal, bgColorVal, textColorVal, fontString]) => {
|
|
181
|
+
setTitle(titleVal || "Countdown");
|
|
182
|
+
setTargetDate(dateVal || "");
|
|
183
|
+
setTargetTime(timeVal || "00:00");
|
|
184
|
+
setBgColor(bgColorVal || DEFAULT_BG_COLOR);
|
|
185
|
+
setTextColor(textColorVal || DEFAULT_TEXT_COLOR);
|
|
186
|
+
setFont(JSON.parse(fontString || "{}"));
|
|
187
|
+
})
|
|
188
|
+
.catch((error) => console.error("Failed to fetch widget properties:", error));
|
|
189
|
+
}, []);
|
|
190
|
+
|
|
191
|
+
const handleTitleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
|
|
192
|
+
const newTitle = event.target.value;
|
|
193
|
+
setTitle(newTitle);
|
|
194
|
+
widget.setProp("title", newTitle);
|
|
195
|
+
}, []);
|
|
196
|
+
|
|
197
|
+
const handleDateChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
|
|
198
|
+
const newDate = event.target.value;
|
|
199
|
+
setTargetDate(newDate);
|
|
200
|
+
widget.setProp("target-date", newDate);
|
|
201
|
+
}, []);
|
|
202
|
+
|
|
203
|
+
const handleTimeChange = useCallback(({ date }: { date: Date }) => {
|
|
204
|
+
if (date) {
|
|
205
|
+
const hours = String(date.getHours()).padStart(2, '0');
|
|
206
|
+
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
207
|
+
const newTime = `${hours}:${minutes}`;
|
|
208
|
+
setTargetTime(newTime);
|
|
209
|
+
widget.setProp("target-time", newTime);
|
|
210
|
+
}
|
|
211
|
+
}, []);
|
|
212
|
+
|
|
213
|
+
const handleBgColorChange = (value: string) => {
|
|
214
|
+
setBgColor(value);
|
|
215
|
+
widget.setProp("bg-color", value);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const handleTextColorChange = (value: string) => {
|
|
219
|
+
setTextColor(value);
|
|
220
|
+
widget.setProp("text-color", value);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const handleFontChange = (value: { font: string; textDecoration: string }) => {
|
|
224
|
+
setFont(value);
|
|
225
|
+
widget.setProp("font", JSON.stringify(value));
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<WixDesignSystemProvider>
|
|
230
|
+
<SidePanel width="300" height="100vh">
|
|
231
|
+
<SidePanel.Header title="Countdown Settings" />
|
|
232
|
+
<SidePanel.Content noPadding stretchVertically>
|
|
233
|
+
<Box direction="vertical" gap="24px">
|
|
234
|
+
<SidePanel.Field>
|
|
235
|
+
<FormField label="Title" required>
|
|
236
|
+
<Input
|
|
237
|
+
type="text"
|
|
238
|
+
value={title}
|
|
239
|
+
onChange={handleTitleChange}
|
|
240
|
+
placeholder="Enter countdown title"
|
|
241
|
+
/>
|
|
242
|
+
</FormField>
|
|
243
|
+
</SidePanel.Field>
|
|
244
|
+
|
|
245
|
+
<SidePanel.Field>
|
|
246
|
+
<FormField label="Target Date" required>
|
|
247
|
+
<Input
|
|
248
|
+
type="date"
|
|
249
|
+
value={targetDate}
|
|
250
|
+
onChange={handleDateChange}
|
|
251
|
+
/>
|
|
252
|
+
</FormField>
|
|
253
|
+
</SidePanel.Field>
|
|
254
|
+
|
|
255
|
+
<SidePanel.Field>
|
|
256
|
+
<FormField label="Target Time" required>
|
|
257
|
+
<TimeInput
|
|
258
|
+
value={parseTimeValue(targetTime)}
|
|
259
|
+
onChange={handleTimeChange}
|
|
260
|
+
/>
|
|
261
|
+
</FormField>
|
|
262
|
+
</SidePanel.Field>
|
|
263
|
+
|
|
264
|
+
<ColorPickerField
|
|
265
|
+
label="Background Color"
|
|
266
|
+
value={bgColor}
|
|
267
|
+
onChange={handleBgColorChange}
|
|
268
|
+
/>
|
|
269
|
+
|
|
270
|
+
<ColorPickerField
|
|
271
|
+
label="Text Color"
|
|
272
|
+
value={textColor}
|
|
273
|
+
onChange={handleTextColorChange}
|
|
274
|
+
/>
|
|
275
|
+
|
|
276
|
+
<FontPickerField
|
|
277
|
+
label="Text Font"
|
|
278
|
+
value={font}
|
|
279
|
+
onChange={handleFontChange}
|
|
280
|
+
/>
|
|
281
|
+
</Box>
|
|
282
|
+
</SidePanel.Content>
|
|
283
|
+
</SidePanel>
|
|
284
|
+
</WixDesignSystemProvider>
|
|
285
|
+
);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export default Panel;
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Key Points:**
|
|
292
|
+
|
|
293
|
+
- Prop names in `widget.getProp()` and `widget.setProp()` use **kebab-case** (e.g., `"target-date"`, `"bg-color"`)
|
|
294
|
+
- Always update both local state AND widget prop in onChange handlers
|
|
295
|
+
- Wrap content in `WixDesignSystemProvider > SidePanel > SidePanel.Content`
|
|
296
|
+
- Use WDS components from `@wix/design-system` (see [SETTINGS_PANEL.md](custom-element-widget/SETTINGS_PANEL.md))
|
|
297
|
+
- Import `@wix/design-system/styles.global.css` for styles
|
|
298
|
+
- For colors, use `ColorPickerField` with `inputs.selectColor()` from `@wix/editor` — NOT `<Input type="color">`
|
|
299
|
+
- For fonts, use `FontPickerField` with `inputs.selectFont()` from `@wix/editor` — NOT a text Input
|
|
300
|
+
- Font values are stored as JSON strings via `JSON.stringify()` / `JSON.parse()`
|
|
301
|
+
|
|
302
|
+
## Props Naming Convention
|
|
303
|
+
|
|
304
|
+
**Critical:** Props use different naming conventions in each file:
|
|
305
|
+
|
|
306
|
+
| File | Convention | Example |
|
|
307
|
+
| ------------------------------ | ---------- | --------------------------------------------- |
|
|
308
|
+
| `widget.tsx` (Props interface) | camelCase | `targetDate`, `bgColor`, `textColor` |
|
|
309
|
+
| `panel.tsx` (widget API) | kebab-case | `"target-date"`, `"bg-color"`, `"text-color"` |
|
|
310
|
+
| `reactToWebComponent` config | camelCase | `targetDate: 'string'` |
|
|
311
|
+
|
|
312
|
+
The web component automatically converts between camelCase (React props) and kebab-case (HTML attributes).
|
|
313
|
+
|
|
314
|
+
## Wix Data API Integration
|
|
315
|
+
|
|
316
|
+
When using Wix Data API in widgets, you **must** handle the Wix Editor environment gracefully:
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
import { items } from "@wix/data";
|
|
320
|
+
import { window as wixWindow } from "@wix/site-window";
|
|
321
|
+
|
|
322
|
+
const CustomElement: FC<WidgetProps> = ({ collectionId }) => {
|
|
323
|
+
const [data, setData] = useState(null);
|
|
324
|
+
const [isEditor, setIsEditor] = useState(false);
|
|
325
|
+
|
|
326
|
+
useEffect(() => {
|
|
327
|
+
const loadData = async () => {
|
|
328
|
+
const currentViewMode = await wixWindow.viewMode();
|
|
329
|
+
|
|
330
|
+
if (currentViewMode === "Editor") {
|
|
331
|
+
// Don't fetch data in editor - show placeholder
|
|
332
|
+
setIsEditor(true);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Fetch real data only on live site
|
|
337
|
+
try {
|
|
338
|
+
const results = await items.query(collectionId).limit(10).find();
|
|
339
|
+
setData(results.items);
|
|
340
|
+
} catch (error) {
|
|
341
|
+
console.error("Failed to load data:", error);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
loadData();
|
|
346
|
+
}, [collectionId]);
|
|
347
|
+
|
|
348
|
+
if (isEditor) {
|
|
349
|
+
return (
|
|
350
|
+
<div style={{ padding: "20px", border: "2px dashed #ccc" }}>
|
|
351
|
+
<p>Widget will display data on the live site</p>
|
|
352
|
+
<p>Collection: {collectionId}</p>
|
|
353
|
+
</div>
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Render widget with real data
|
|
358
|
+
return (
|
|
359
|
+
<div>
|
|
360
|
+
{data?.map((item) => (
|
|
361
|
+
<div key={item._id}>{item.title}</div>
|
|
362
|
+
))}
|
|
363
|
+
</div>
|
|
364
|
+
);
|
|
365
|
+
};
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**Requirements:**
|
|
369
|
+
|
|
370
|
+
- Import `{ window as wixWindow }` from `"@wix/site-window"`
|
|
371
|
+
- Check `await wixWindow.viewMode()` before fetching data
|
|
372
|
+
- If `viewMode === 'Editor'`, show a placeholder UI instead
|
|
373
|
+
- Only fetch and render real data when NOT in editor mode
|
|
374
|
+
|
|
375
|
+
## Color Selection
|
|
376
|
+
|
|
377
|
+
For color selection in settings panels, use `ColorPickerField` component with `inputs.selectColor()` from `@wix/editor`. Do NOT use `<Input type="color">`.
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
// components/ColorPickerField.tsx
|
|
381
|
+
import React, { type FC } from 'react';
|
|
382
|
+
import { inputs } from '@wix/editor';
|
|
383
|
+
import { FormField, Box, FillPreview, SidePanel } from '@wix/design-system';
|
|
384
|
+
|
|
385
|
+
interface ColorPickerFieldProps {
|
|
386
|
+
label: string;
|
|
387
|
+
value: string;
|
|
388
|
+
onChange: (value: string) => void;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export const ColorPickerField: FC<ColorPickerFieldProps> = ({
|
|
392
|
+
label,
|
|
393
|
+
value,
|
|
394
|
+
onChange,
|
|
395
|
+
}) => (
|
|
396
|
+
<SidePanel.Field>
|
|
397
|
+
<FormField label={label}>
|
|
398
|
+
<Box width="30px" height="30px">
|
|
399
|
+
<FillPreview
|
|
400
|
+
fill={value}
|
|
401
|
+
onClick={() => inputs.selectColor(value, { onChange: (val) => { if (val) onChange(val); } })}
|
|
402
|
+
/>
|
|
403
|
+
</Box>
|
|
404
|
+
</FormField>
|
|
405
|
+
</SidePanel.Field>
|
|
406
|
+
);
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Usage in panel:
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
const handleBgColorChange = (value: string) => {
|
|
413
|
+
setBgColor(value);
|
|
414
|
+
widget.setProp("bg-color", value);
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
<ColorPickerField label="Background Color" value={bgColor} onChange={handleBgColorChange} />
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**Important:** Use `inputs.selectColor(value, { onChange })` from `@wix/editor` with `FillPreview` from WDS. This opens the native Wix color picker with theme colors, gradients, and more. Never use `<Input type="color">`.
|
|
421
|
+
|
|
422
|
+
## Font Selection
|
|
423
|
+
|
|
424
|
+
For font selection in settings panels, use `FontPickerField` component with `inputs.selectFont()` from `@wix/editor`. Do NOT use a text Input.
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
// components/FontPickerField.tsx
|
|
428
|
+
import React, { type FC } from 'react';
|
|
429
|
+
import { inputs } from '@wix/editor';
|
|
430
|
+
import { FormField, Button, Text, SidePanel } from '@wix/design-system';
|
|
431
|
+
|
|
432
|
+
interface FontValue {
|
|
433
|
+
font: string;
|
|
434
|
+
textDecoration: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
interface FontPickerFieldProps {
|
|
438
|
+
label: string;
|
|
439
|
+
value: FontValue;
|
|
440
|
+
onChange: (value: FontValue) => void;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export const FontPickerField: FC<FontPickerFieldProps> = ({
|
|
444
|
+
label,
|
|
445
|
+
value,
|
|
446
|
+
onChange,
|
|
447
|
+
}) => (
|
|
448
|
+
<SidePanel.Field>
|
|
449
|
+
<FormField label={label}>
|
|
450
|
+
<Button
|
|
451
|
+
size="small"
|
|
452
|
+
priority="secondary"
|
|
453
|
+
onClick={() => inputs.selectFont(value, { onChange: (val) => onChange({ font: val.font, textDecoration: val.textDecoration || "" }) })}
|
|
454
|
+
fullWidth
|
|
455
|
+
>
|
|
456
|
+
<Text size="small" ellipsis>Change Font</Text>
|
|
457
|
+
</Button>
|
|
458
|
+
</FormField>
|
|
459
|
+
</SidePanel.Field>
|
|
460
|
+
);
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Usage in panel:
|
|
464
|
+
|
|
465
|
+
```typescript
|
|
466
|
+
const [font, setFont] = useState<FontValue>({ font: "", textDecoration: "" });
|
|
467
|
+
|
|
468
|
+
const handleFontChange = (value: FontValue) => {
|
|
469
|
+
setFont(value);
|
|
470
|
+
widget.setProp("font", JSON.stringify(value));
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
<FontPickerField label="Text Font" value={font} onChange={handleFontChange} />
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
**Important:** Use `inputs.selectFont(value, { onChange })` from `@wix/editor` with the callback pattern. This provides a rich font picker dialog with bold, italic, size, and typography features. Font values are stored as JSON strings.
|
|
477
|
+
|
|
478
|
+
## Output Structure
|
|
479
|
+
|
|
480
|
+
```
|
|
481
|
+
src/extensions/site/widgets/custom-elements/
|
|
482
|
+
└── {widget-name}/
|
|
483
|
+
├── widget.tsx # Main widget component
|
|
484
|
+
├── panel.tsx # Settings panel component
|
|
485
|
+
├── extensions.ts # Extension registration
|
|
486
|
+
├── components/ # Optional sub-components
|
|
487
|
+
│ ├── ColorPickerField.tsx
|
|
488
|
+
│ └── FontPickerField.tsx
|
|
489
|
+
└── utils/ # Optional helper functions
|
|
490
|
+
└── formatters.ts
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
## Examples
|
|
494
|
+
|
|
495
|
+
### Countdown Timer Widget
|
|
496
|
+
|
|
497
|
+
**Request:** "Create a countdown timer widget"
|
|
498
|
+
|
|
499
|
+
**Output:**
|
|
500
|
+
|
|
501
|
+
- Widget with configurable title, target date/time, colors, and font
|
|
502
|
+
- Settings panel with date picker, time input, color pickers, font picker
|
|
503
|
+
- Real-time countdown display with days, hours, minutes, seconds
|
|
504
|
+
|
|
505
|
+
### Product Showcase Widget
|
|
506
|
+
|
|
507
|
+
**Request:** "Create a widget that displays products from a collection"
|
|
508
|
+
|
|
509
|
+
**Output:**
|
|
510
|
+
|
|
511
|
+
- Widget that queries Wix Data collection
|
|
512
|
+
- Editor environment handling (shows placeholder in editor)
|
|
513
|
+
- Settings panel for collection selection, display options, styling
|
|
514
|
+
- Responsive grid layout with product cards
|
|
515
|
+
|
|
516
|
+
### Interactive Calculator Widget
|
|
517
|
+
|
|
518
|
+
**Request:** "Create a calculator widget with customizable colors"
|
|
519
|
+
|
|
520
|
+
**Output:**
|
|
521
|
+
|
|
522
|
+
- Functional calculator component
|
|
523
|
+
- Settings panel for color customization (background, buttons, text)
|
|
524
|
+
- Inline styles for all styling
|
|
525
|
+
- No external dependencies
|
|
526
|
+
|
|
527
|
+
## Frontend Aesthetics
|
|
528
|
+
|
|
529
|
+
Avoid generic aesthetics. Create distinctive designs with unique fonts (avoid Inter, Roboto, Arial), cohesive color palettes, CSS animations for micro-interactions, and context-specific choices. Don't use clichéd color schemes or predictable layouts.
|
|
530
|
+
|
|
531
|
+
## Extension Registration
|
|
532
|
+
|
|
533
|
+
**Extension registration is MANDATORY and has TWO required steps.**
|
|
534
|
+
|
|
535
|
+
### Step 1: Create Widget-Specific Extension File
|
|
536
|
+
|
|
537
|
+
Each custom element widget requires an `extensions.ts` file in its folder:
|
|
538
|
+
|
|
539
|
+
```typescript
|
|
540
|
+
import { extensions } from "@wix/astro/builders";
|
|
541
|
+
|
|
542
|
+
export const customelementwidgetMyWidget = extensions.customElement({
|
|
543
|
+
id: "{{GENERATE_UUID}}",
|
|
544
|
+
name: "My Widget",
|
|
545
|
+
tagName: "my-widget",
|
|
546
|
+
element: "./extensions/site/widgets/custom-elements/my-widget/widget.tsx",
|
|
547
|
+
settings: "./extensions/site/widgets/custom-elements/my-widget/panel.tsx",
|
|
548
|
+
installation: {
|
|
549
|
+
autoAdd: true,
|
|
550
|
+
},
|
|
551
|
+
width: {
|
|
552
|
+
defaultWidth: 500,
|
|
553
|
+
allowStretch: true,
|
|
554
|
+
},
|
|
555
|
+
height: {
|
|
556
|
+
defaultHeight: 500,
|
|
557
|
+
},
|
|
558
|
+
});
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
**CRITICAL: UUID Generation**
|
|
562
|
+
|
|
563
|
+
The `id` must be a unique, static UUID v4 string. Generate a fresh UUID for each extension - do NOT use `randomUUID()` or copy UUIDs from examples. Replace `{{GENERATE_UUID}}` with a freshly generated UUID like `"a1b2c3d4-e5f6-7890-abcd-ef1234567890"`.
|
|
564
|
+
|
|
565
|
+
| Property | Type | Description |
|
|
566
|
+
| -------------- | ------ | -------------------------------------- |
|
|
567
|
+
| `id` | string | Unique static UUID v4 (generate fresh) |
|
|
568
|
+
| `name` | string | Display name in editor |
|
|
569
|
+
| `tagName` | string | HTML custom element tag (kebab-case) |
|
|
570
|
+
| `element` | string | Path to widget React component |
|
|
571
|
+
| `settings` | string | Path to settings panel component |
|
|
572
|
+
| `installation` | object | Auto-add behavior |
|
|
573
|
+
| `width` | object | Default width and stretch settings |
|
|
574
|
+
| `height` | object | Default height settings |
|
|
575
|
+
|
|
576
|
+
### Step 2: Register in Main Extensions File
|
|
577
|
+
|
|
578
|
+
**CRITICAL:** After creating the widget-specific extension file, you MUST read [Extension Registration reference](EXTENSION_REGISTRATION.md) and follow the "App Registration" section to update `src/extensions.ts`.
|
|
579
|
+
|
|
580
|
+
**Without completing Step 2, the custom element widget will not be available in the Wix Editor.**
|
|
581
|
+
|
|
582
|
+
## Custom-element-specific Conventions
|
|
583
|
+
|
|
584
|
+
- Functional React components with hooks.
|
|
585
|
+
- Inline styles only (no CSS imports).
|
|
586
|
+
- Handle Wix Editor environment when using Wix Data API.
|
|
587
|
+
- Consistent prop naming (camelCase in widget, kebab-case in panel).
|