{"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a custom Gutenberg block that renders taxonomy terms comprehensively, featuring a dropdown interface, hierarchical organization, and extensible display settings."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/categories/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/categories\",\n\t\"title\": \"Terms List\",\n\t\"category\": \"widgets\",\n\t\"description\": \"Display a list of all terms of a given taxonomy.\",\n\t\"keywords\": [ \"categories\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"taxonomy\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"category\"\n\t\t},\n\t\t\"displayAsDropdown\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showHierarchy\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showPostCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showOnlyTopLevel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showEmpty\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"showLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"enhancedPagination\" ],\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-categories-editor\",\n\t\"style\": \"wp-block-categories\"\n}\n\n\n// File: packages/block-library/src/categories/index.js\n/**\n * WordPress dependencies\n */\nimport { category as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a theme block enabling users to easily adjust and customize text alignment settings within the block."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/term-description/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/term-description\",\n\t\"title\": \"Term Description\",\n\t\"category\": \"theme\",\n\t\"description\": \"Display the description of categories, tags and custom taxonomies when viewing an archive.\",\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"termId\", \"taxonomy\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/term-description/index.js\n/**\n * WordPress dependencies\n */\nimport { termDescription as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a block that Display an input field customers can use to select the number of products to add to their cart. "}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/quantity-selector/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-quantity-selector\",\n\t\"title\": \"Product Quantity (Beta)\",\n\t\"description\": \"Display an input field customers can use to select the number of products to add to their cart. \",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"usesContext\": [ \"postId\" ],\n\t\"ancestor\": [ \"woocommerce/add-to-cart-with-options\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"supports\": {\n\t\t\"interactivity\": true\n\t},\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"style\": \"file:../woocommerce/add-to-cart-with-options-quantity-selector-style.css\",\n\t\"viewScriptModule\": \"woocommerce/add-to-cart-with-options-quantity-selector\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/quantity-selector/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { Disabled } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport QuantityStepper from '../components/quantity-stepper';\n\nconst AddToCartWithOptionsQuantitySelectorEdit = () => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-add-to-cart-with-options__quantity-selector',\n\t} );\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
\n\t);\n};\n\nexport default AddToCartWithOptionsQuantitySelectorEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a customizable WordPress block enabling merchants to present order summaries with adjustable lock mechanisms for enhanced user management."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Order Summary\",\n\t\"description\": \"Show customers a summary of their order.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { TotalsFooterItem } from '@woocommerce/base-components/cart-checkout';\nimport { getCurrencyFromPriceResponse } from '@woocommerce/price-format';\nimport { useStoreCart } from '@woocommerce/base-context/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { useId, useState } from '@wordpress/element';\nimport { Icon } from '@wordpress/components';\nimport { chevronDown, chevronUp } from '@wordpress/icons';\nimport clsx from 'clsx';\nimport { FormattedMonetaryAmount } from '@woocommerce/blocks-components';\nimport { useContainerWidthContext } from '@woocommerce/base-context';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseForcedLayout,\n\tgetAllowedBlocks,\n} from '../../../cart-checkout-shared';\nimport { OrderMetaSlotFill } from './slotfills';\n\nexport const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {\n\tconst blockProps = useBlockProps();\n\tconst { cartTotals } = useStoreCart();\n\tconst totalsCurrency = getCurrencyFromPriceResponse( cartTotals );\n\tconst totalPrice = parseInt( cartTotals.total_price, 10 );\n\tconst allowedBlocks = getAllowedBlocks(\n\t\tinnerBlockAreas.CHECKOUT_ORDER_SUMMARY\n\t);\n\tconst { isLarge } = useContainerWidthContext();\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst ariaControlsId = useId();\n\n\tconst orderSummaryProps = ! isLarge\n\t\t? {\n\t\t\t\trole: 'button',\n\t\t\t\tonClick: () => setIsOpen( ! isOpen ),\n\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t'aria-controls': ariaControlsId,\n\t\t\t\ttabIndex: 0,\n\t\t\t\tonKeyDown: ( event: React.KeyboardEvent ) => {\n\t\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\t\tsetIsOpen( ! isOpen );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t }\n\t\t: {};\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/checkout-order-summary-cart-items-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-coupon-form-block', {}, [] ],\n\t\t[ 'woocommerce/checkout-order-summary-totals-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: allowedBlocks,\n\t\tdefaultTemplate,\n\t} );\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Order summary', 'woocommerce' ) }\n\t\t\t\t

\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
\n\t\t\t\n\t\t
\n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a design block with customizable tabs id, orientation, active tab index, and 12 more options"}, {"role": "assistant", "content": "// File: packages/block-library/src/tabs/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"__experimental\": true,\n\t\"apiVersion\": 3,\n\t\"name\": \"core/tabs\",\n\t\"title\": \"Tabs\",\n\t\"description\": \"Display content in a tabbed interface to help users navigate detailed content with ease.\",\n\t\"version\": \"1.0.0\",\n\t\"category\": \"design\",\n\t\"textdomain\": \"default\",\n\t\"allowedBlocks\": [ \"core/tab\" ],\n\t\"attributes\": {\n\t\t\"tabsId\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"orientation\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"horizontal\",\n\t\t\t\"enum\": [ \"horizontal\", \"vertical\" ]\n\t\t},\n\t\t\"activeTabIndex\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"tabInactiveColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customTabInactiveColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"tabHoverColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customTabHoverColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"tabActiveColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customTabActiveColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"tabTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customTabTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"tabActiveTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customTabActiveTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"tabHoverTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customTabHoverTextColor\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{\n\t\t\t\"name\": \"tab\",\n\t\t\t\"label\": \"Tabs\",\n\t\t\t\"isDefault\": true\n\t\t},\n\t\t{\n\t\t\t\"name\": \"links\",\n\t\t\t\"label\": \"Links\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"button\",\n\t\t\t\"label\": \"Button\"\n\t\t}\n\t],\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"color\": {\n\t\t\t\"text\": false,\n\t\t\t\"background\": false\n\t\t},\n\t\t\"html\": false,\n\t\t\"interactivity\": true,\n\t\t\"spacing\": {\n\t\t\t\"blockGap\": [ \"horizontal\", \"vertical\" ],\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": false\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"__experimentalFontFamily\": true\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"className\": \"is-example\"\n\t\t},\n\t\t\"innerBlocks\": [\n\t\t\t{\n\t\t\t\t\"name\": \"core/tab\",\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"label\": \"Tab 1\"\n\t\t\t\t},\n\t\t\t\t\"innerBlocks\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"core/paragraph\",\n\t\t\t\t\t\t\"attributes\": {\n\t\t\t\t\t\t\t\"content\": \"Pariatur commodo sint mollit. Veniam Lorem labore voluptate fugiat. Ad nulla est labore cillum cillum qui nostrud do incididunt eiusmod. Aliqua aliqua sunt consequat consequat in duis deserunt.\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"core/paragraph\",\n\t\t\t\t\t\t\"attributes\": {\n\t\t\t\t\t\t\t\"content\": \"Adipisicing ullamco nisi in eu laborum adipisicing aliquip aliqua. Fugiat labore officia consequat nisi veniam velit commodo cillum enim duis quis ad.\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"name\": \"core/tab\",\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"label\": \"Tab 2\"\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"name\": \"core/tab\",\n\t\t\t\t\"attributes\": {\n\t\t\t\t\t\"label\": \"Tab 3\"\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t},\n\t\"providesContext\": {\n\t\t\"core/tabs-id\": \"tabsId\"\n\t},\n\t\"editorScript\": \"file:./index.js\",\n\t\"editorStyle\": \"file:./index.css\",\n\t\"style\": \"file:./style-index.css\",\n\t\"viewScriptModule\": \"@wordpress/block-library/tabs/view\"\n}\n\n\n// File: packages/block-library/src/tabs/index.js\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport save from './save';\nimport icon from './icon';\n\nimport metadata from './block.json';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/tabs/save.js\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function Save( { attributes } ) {\n\t// eslint-disable-next-line react-compiler/react-compiler\n\tconst blockProps = useBlockProps.save();\n\n\t// eslint-disable-next-line react-compiler/react-compiler\n\tconst innerBlocksProps = useInnerBlocksProps.save( {} );\n\n\tconst title = attributes?.metadata?.name || 'Tab Contents';\n\n\treturn (\n\t\t
\n\t\t\t

{ title }

\n\t\t\t
    \n\t\t\t{ innerBlocksProps.children }\n\t\t
    \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Display a list of filter options. with these attributes: option element border, custom option element border, option element selected, and 5 more options"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/checkbox-list/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"name\": \"woocommerce/product-filter-checkbox-list\",\n\t\"title\": \"List\",\n\t\"description\": \"Display a list of filter options.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"ancestor\": [\n\t\t\"woocommerce/product-filter-attribute\",\n\t\t\"woocommerce/product-filter-status\",\n\t\t\"woocommerce/product-filter-taxonomy\",\n\t\t\"woocommerce/product-filter-rating\"\n\t],\n\t\"supports\": {\n\t\t\"interactivity\": true\n\t},\n\t\"usesContext\": [ \"filterData\" ],\n\t\"attributes\": {\n\t\t\"optionElementBorder\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"customOptionElementBorder\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"optionElementSelected\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"customOptionElementSelected\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"optionElement\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"customOptionElement\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"labelElement\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"customLabelElement\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t}\n\t},\n\t\"viewScriptModule\": \"woocommerce/product-filter-checkbox-list\",\n\t\"style\": \"file:../woocommerce/product-filter-checkbox-list-style.css\",\n\t\"editorStyle\": \"file:../woocommerce/product-filter-checkbox-list-editor.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/checkbox-list/edit.tsx\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, Disabled } from '@wordpress/components';\nimport { checkMark } from '@woocommerce/icons';\nimport { useMemo } from '@wordpress/element';\nimport { decodeHtmlEntities } from '@woocommerce/utils';\nimport {\n\tuseBlockProps,\n\twithColors,\n\tInspectorControls,\n\t// @ts-expect-error - no types.\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t// @ts-expect-error - no types.\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\nimport './editor.scss';\nimport { EditProps } from './types';\nimport { getColorClasses, getColorVars } from './utils';\n\nconst CheckboxListEdit = ( props: EditProps ): JSX.Element => {\n\tconst {\n\t\tclientId,\n\t\tcontext,\n\t\tattributes,\n\t\tsetAttributes,\n\t\toptionElementBorder,\n\t\tsetOptionElementBorder,\n\t\toptionElementSelected,\n\t\tsetOptionElementSelected,\n\t\toptionElement,\n\t\tsetOptionElement,\n\t\tlabelElement,\n\t\tsetLabelElement,\n\t} = props;\n\n\tconst {\n\t\tcustomOptionElementBorder,\n\t\tcustomOptionElementSelected,\n\t\tcustomOptionElement,\n\t\tcustomLabelElement,\n\t} = attributes;\n\tconst { filterData } = context;\n\tconst { isLoading, items, showCounts } = filterData;\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-product-filter-checkbox-list', {\n\t\t\t'is-loading': isLoading,\n\t\t\t...getColorClasses( attributes ),\n\t\t} ),\n\t\tstyle: getColorVars( attributes ),\n\t} );\n\n\tconst loadingState = useMemo( () => {\n\t\treturn [ ...Array( 5 ) ].map( ( x, i ) => (\n\t\t\t\n\t\t\t\t \n\t\t\t\n\t\t) );\n\t}, [] );\n\n\tif ( ! items ) {\n\t\treturn <>;\n\t}\n\n\tconst threshold = 15;\n\tconst isLongList = items.length > threshold;\n\n\treturn (\n\t\t<>\n\t\t\t
    \n\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t\t\t{ isLoading && loadingState }\n\t\t\t\t\t\t{ ! isLoading &&\n\t\t\t\t\t\t\t( isLongList\n\t\t\t\t\t\t\t\t? items.slice( 0, threshold )\n\t\t\t\t\t\t\t\t: items\n\t\t\t\t\t\t\t).map( ( item, index ) => (\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t{ typeof item.label === 'string'\n\t\t\t\t\t\t\t\t\t\t\t\t\t? decodeHtmlEntities(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titem.label\n\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t: item.label }\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t{ showCounts && (\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ ` (${ item.count })` }\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t
    \n\t\t\t\t\t{ ! isLoading && isLongList && (\n\t\t\t\t\t\t\n\t\t\t\t\t) }\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\tsetLabelElement( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomLabelElement: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetLabelElement( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomLabelElement: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __(\n\t\t\t\t\t\t\t\t\t'Option Element Border',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\toptionElementBorder.color ||\n\t\t\t\t\t\t\t\t\tcustomOptionElementBorder,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetOptionElementBorder( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomOptionElementBorder: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetOptionElementBorder( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomOptionElementBorder: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __(\n\t\t\t\t\t\t\t\t\t'Option Element (Selected)',\n\t\t\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\toptionElementSelected.color ||\n\t\t\t\t\t\t\t\t\tcustomOptionElementSelected,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetOptionElementSelected( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomOptionElementSelected: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetOptionElementSelected( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomOptionElementSelected: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Option Element', 'woocommerce' ),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\toptionElement.color || customOptionElement,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetOptionElement( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomOptionElement: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetOptionElement( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomOptionElement: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\n\t\t\n\t);\n};\n\nexport default withColors( {\n\toptionElementBorder: 'option-element-border',\n\toptionElementSelected: 'option-element-border',\n\toptionElement: 'option-element',\n\tlabelElement: 'label-element',\n} )( CheckboxListEdit );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/checkbox-list/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { BlockAttributes } from './types';\nimport { getColorClasses, getColorVars } from './utils';\n\nconst Save = ( { attributes }: { attributes: BlockAttributes } ) => {\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: clsx(\n\t\t\t'wc-block-product-filter-checkbox-list',\n\t\t\tattributes.className,\n\t\t\tgetColorClasses( attributes )\n\t\t),\n\t\tstyle: {\n\t\t\t...getColorVars( attributes ),\n\t\t},\n\t} );\n\n\treturn
    ;\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a block that Format the name of an attribute associated with a variable product."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/attribute-name/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-variation-selector-attribute-name\",\n\t\"title\": \"Variation Selector: Attribute Name (Beta)\",\n\t\"description\": \"Format the name of an attribute associated with a variable product.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"ancestor\": [\n\t\t\"woocommerce/add-to-cart-with-options-variation-selector-attribute\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"supports\": {\n\t\t\"inserter\": false,\n\t\t\"interactivity\": true,\n\t\t\"align\": false,\n\t\t\"alignWide\": false,\n\t\t\"color\": {\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"gradients\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"__experimentalSkipSerialization\": [\n\t\t\t\t\"fontSize\",\n\t\t\t\t\"lineHeight\",\n\t\t\t\t\"fontFamily\",\n\t\t\t\t\"fontWeight\",\n\t\t\t\t\"fontStyle\",\n\t\t\t\t\"textTransform\",\n\t\t\t\t\"textDecoration\",\n\t\t\t\t\"letterSpacing\"\n\t\t\t],\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalWritingMode\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"__experimentalSkipSerialization\": true,\n\t\t\t\"padding\": [ \"horizontal\", \"vertical\" ],\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"usesContext\": [\n\t\t\"woocommerce/attributeId\",\n\t\t\"woocommerce/attributeName\",\n\t\t\"woocommerce/attributeTerms\"\n\t],\n\t\"style\": \"file:../woocommerce/add-to-cart-with-options-variation-selector-attribute-name-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/attribute-name/edit.tsx\n/**\n * External dependencies\n */\nimport { type BlockEditProps } from '@wordpress/blocks';\nimport {\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { useCustomDataContext } from '@woocommerce/shared-context';\nimport type { ProductResponseAttributeItem } from '@woocommerce/types';\nimport clsx from 'clsx';\n\ninterface Attributes {\n\tclassName?: string;\n}\n\nexport default function AttributeNameEdit(\n\tprops: BlockEditProps< Attributes >\n) {\n\tconst { attributes } = props;\n\tconst { className } = attributes;\n\n\tconst colorProps = useColorProps( attributes );\n\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\n\tconst spacingProps = useSpacingProps( attributes );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx(\n\t\t\tclassName,\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tspacingProps.className\n\t\t),\n\t\tstyle: {\n\t\t\t...colorProps.stye,\n\t\t\t...typographyProps.style,\n\t\t\t...spacingProps.style,\n\t\t},\n\t} );\n\n\tconst { data: attribute } =\n\t\tuseCustomDataContext< ProductResponseAttributeItem >( 'attribute' );\n\n\tif ( ! attribute ) return;\n\n\treturn (\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for A single accordion that displays a header and expandable content. that allows users to configure: open by default"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/inner-blocks/accordion-item/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"woocommerce/accordion-item\",\n\t\"title\": \"Accordion\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"description\": \"A single accordion that displays a header and expandable content.\",\n\t\"example\": {},\n\t\"__experimental\": true,\n\t\"parent\": [ \"woocommerce/accordion-group\" ],\n\t\"allowedBlocks\": [\n\t\t\"woocommerce/accordion-header\",\n\t\t\"woocommerce/accordion-panel\"\n\t],\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"gradient\": true\n\t\t},\n\t\t\"interactivity\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"blockGap\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"shadow\": true,\n\t\t\"layout\": true\n\t},\n\t\"attributes\": {\n\t\t\"openByDefault\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/inner-blocks/accordion-item/index.js\n/**\n * External dependencies\n */\nimport { SVG, Path } from '@wordpress/components';\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport save from './save';\nimport metadata from './block.json';\n\nconst icon = (\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n);\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tapiVersion: 3,\n\ticon,\n\texample: {},\n\tedit,\n\tsave,\n};\n\nregisterBlockType( metadata, settings );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/accordion/inner-blocks/accordion-item/save.js\n/**\n * External dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\nexport default function save( { attributes } ) {\n\tconst { openByDefault } = attributes;\n\tconst blockProps = useBlockProps.save();\n\tconst className = clsx(\n\t\t{\n\t\t\t'is-open': openByDefault,\n\t\t},\n\t\tblockProps.className\n\t);\n\tconst innerBlocksProps = useInnerBlocksProps.save( {\n\t\t...blockProps,\n\t\tclassName,\n\t} );\n\n\treturn
    ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Embed a Pinterest pin, board, or user. that allows users to configure: url"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/pinterest/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/pinterest\",\n\t\"title\": \"Pinterest\",\n\t\"description\": \"Embed a Pinterest pin, board, or user.\",\n\t\"keywords\": [ \"social\", \"pinboard\", \"pins\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"embed\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": false,\n\t\t\"inserter\": false\n\t},\n\t\"attributes\": {\n\t\t\"url\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"example\": {\n\t\t\"attributes\": {\n\t\t\t\"url\": \"https://pinterest.com/anapinskywalker/\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/pinterest/edit.js\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { SandBox, withNotices } from '@wordpress/components';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport EditUrlForm from './components/edit-url-form';\nimport ErrorNotice from './components/error-notice';\nimport LoadingContainer from './components/loading-container';\nimport useTestPinterestEmbedUrl from './hooks/use-test-pinterest-embed-url';\nimport { pinType } from './utils';\n\nexport function PinterestEdit( {\n\tattributes,\n\tisSelected,\n\tnoticeOperations,\n\tnoticeUI,\n\tsetAttributes,\n\tonReplace,\n} ) {\n\tconst { url } = attributes;\n\n\tconst blockProps = useBlockProps();\n\tconst { isFetching, pinterestUrl, testUrl, hasTestUrlError } = useTestPinterestEmbedUrl();\n\tconst [ isInteractive, setIsInteractive ] = useState( false );\n\tconst [ editedUrl, setEditedUrl ] = useState( '' );\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\n\t/**\n\t * Sets an error notice using noticeOperations.\n\t */\n\tconst getErrorNotice = useCallback( () => {\n\t\treturn ;\n\t\t// Disabling for onReplace and editedUrl as they are not requirements for creating a new function.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ hasTestUrlError ] );\n\n\t/**\n\t * Submit handler for the url editing form.\n\t */\n\tconst onSubmitForm = () => {\n\t\tif ( isFetching ) {\n\t\t\treturn;\n\t\t}\n\t\ttestUrl( editedUrl );\n\t\tsetIsEditing( false );\n\t};\n\n\t/**\n\t * This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop\n\t * changing, because that happens on mouse down, and the overlay immediately disappears,\n\t * and the mouse event can end up in the preview content. We can't use onClick on\n\t * the overlay to hide it either, because then the editor misses the mouseup event, and\n\t * thinks we're multi-selecting blocks.\n\t */\n\tconst hideOverlay = () => {\n\t\tsetIsInteractive( true );\n\t};\n\n\t/*\n\t\tSet the URL when the component mounts.\n\t\tWe disable missing dependencies warning in the linter\n\t\tbecause we want this to run once on mount.\n\t */\n\tuseEffect( () => {\n\t\tif ( url ) {\n\t\t\ttestUrl( url );\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\t/*\n\t\tWe only want to change `isInteractive` when the block is not selected, because changing it when\n\t\tthe block becomes selected makes the overlap disappear too early. Hiding the overlay\n\t\thappens on mouseup when the overlay is clicked.\n\t*/\n\tuseEffect( () => {\n\t\tif ( ! isSelected && isInteractive ) {\n\t\t\tsetIsInteractive( false );\n\t\t}\n\t}, [ isSelected, isInteractive ] );\n\n\t// Listen out for changes to after we've tested the url via `testUrl()`.\n\tuseEffect( () => {\n\t\tsetAttributes( { url: pinterestUrl } );\n\t\tnoticeOperations.removeAllNotices();\n\t\t// Set the input value of the edited URL.\n\t\tif ( pinterestUrl ) {\n\t\t\tsetEditedUrl( pinterestUrl );\n\t\t}\n\t\tif ( hasTestUrlError ) {\n\t\t\tnoticeOperations.createErrorNotice( getErrorNotice() );\n\t\t}\n\t\t// Disabling for noticeOperations as it is a prop and not a requirement for re-rendering.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ pinterestUrl, hasTestUrlError, setAttributes, getErrorNotice ] );\n\n\tif ( isFetching ) {\n\t\treturn ;\n\t}\n\n\tconst pinterestEmbedType = pinType( url );\n\n\tlet content;\n\n\tif ( isEditing || ! url || ( url && ! pinterestEmbedType ) ) {\n\t\tcontent = (\n\t\t\t\n\t\t);\n\t} else {\n\t\tconst sandBoxHTML = ``;\n\t\t/*\n\t\tDisabled because the overlay div doesn't actually have a role or functionality\n\t\tas far as the user is concerned. We're just catching the first click so that\n\t\tthe block can be selected without interacting with the embed preview that the overlay covers.\n\t */\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\tcontent = (\n\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t{ ! isInteractive && (\n\t\t\t\t\t\t
    \n\t\t\t\t\t) }\n\t\t\t\t
    \n\t\t\t
    \n\t\t);\n\t}\n\n\treturn
    { content }
    ;\n}\n\nexport default withNotices( PinterestEdit );\n\n\n// File: projects/plugins/jetpack/extensions/blocks/pinterest/save.js\nimport { useBlockProps } from '@wordpress/block-editor';\n\nexport default function Save( { attributes } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst { url } = attributes;\n\n\treturn (\n\t\t\n\t\t\t{ url }\n\t\t\n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Contains the products table and other custom blocks of filled mini-cart. with these attributes: lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/block.json\n{\n\t\"name\": \"woocommerce/mini-cart-items-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Mini-Cart Items\",\n\t\"description\": \"Contains the products table and other custom blocks of filled mini-cart.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [ \"woocommerce/filled-mini-cart-contents-block\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nimport type { TemplateArray } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getMiniCartAllowedBlocks } from '../allowed-blocks';\n\nexport const Edit = (): JSX.Element => {\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'wc-block-mini-cart__items',\n\t} );\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/mini-cart-products-table-block', {} ],\n\t].filter( Boolean ) as unknown as TemplateArray;\n\n\treturn (\n\t\t
    \n\t\t\t\n\t\t
    \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
    \n\t\t\t\n\t\t
    \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a theme block with customizable format, is link"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comment-date/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comment-date\",\n\t\"title\": \"Comment Date\",\n\t\"category\": \"theme\",\n\t\"ancestor\": [ \"core/comment-template\" ],\n\t\"description\": \"Displays the date on which the comment was posted.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"format\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"commentId\" ],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-comment-date\"\n}\n\n\n// File: packages/block-library/src/comment-date/index.js\n/**\n * WordPress dependencies\n */\nimport { postDate as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n\texample: {},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a WordPress block that enables users to input a custom label and configurable statistics, with flexible display options for presenting data."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blog-stats/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/blog-stats\",\n\t\"title\": \"Blog Stats\",\n\t\"description\": \"Show a stats counter for your blog.\",\n\t\"keywords\": [ \"views\", \"hits\", \"analytics\", \"counter\", \"visitors\" ],\n\t\"version\": \"1.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"grow\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"alignWide\": true,\n\t\t\"html\": false,\n\t\t\"multiple\": true,\n\t\t\"reusable\": true,\n\t\t\"color\": {\n\t\t\t\"gradients\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"fontSize\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"label\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"statsData\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"views\"\n\t\t},\n\t\t\"statsOption\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"site\"\n\t\t}\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/blog-stats/edit.js\nimport { useModuleStatus } from '@automattic/jetpack-shared-extension-utils';\nimport { formatNumber } from '@automattic/number-formatters';\nimport apiFetch from '@wordpress/api-fetch';\nimport { InspectorControls, RichText, useBlockProps } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __, _n } from '@wordpress/i18n';\nimport { BlogStatsInspectorControls } from './controls';\nimport { InactiveStatsPlaceholder } from './inactive-placeholder';\n\nfunction BlogStatsEdit( { attributes, className, setAttributes } ) {\n\tconst { isLoadingModules, isChangingStatus, isModuleActive, changeStatus } =\n\t\tuseModuleStatus( 'stats' );\n\tconst { label, statsData, statsOption } = attributes;\n\tconst [ blogViews, setBlogViews ] = useState( null );\n\tconst [ blogVisitors, setBlogVisitors ] = useState();\n\tconst [ postViews, setPostViews ] = useState();\n\tconst blockProps = useBlockProps();\n\n\tconst blogStats = statsData === 'views' ? blogViews : blogVisitors;\n\tconst stats = statsOption === 'post' ? postViews : blogStats;\n\n\tconst postId = useSelect( select => select( 'core/editor' ).getCurrentPostId(), [] );\n\n\tuseEffect( () => {\n\t\tif ( isModuleActive ) {\n\t\t\tapiFetch( {\n\t\t\t\tpath: Number.isInteger( postId )\n\t\t\t\t\t? `/wpcom/v2/blog-stats?post_id=${ postId }`\n\t\t\t\t\t: '/wpcom/v2/blog-stats',\n\t\t\t} ).then( response => {\n\t\t\t\tsetBlogViews( response[ 'blog-views' ] );\n\t\t\t\tsetBlogVisitors( response[ 'blog-visitors' ] );\n\n\t\t\t\t// Display \"12,345\" as an obvious placeholder when we have no Post ID.\n\t\t\t\t// Applies to widgets, FSE templates etc.\n\t\t\t\tsetPostViews( Number.isInteger( postId ) ? response[ 'post-views' ] : '12345' );\n\t\t\t} );\n\t\t}\n\t}, [ postId, isModuleActive ] );\n\n\t// We don't collect visitor data for individual posts.\n\tuseEffect( () => {\n\t\tif ( statsData === 'visitors' ) {\n\t\t\tsetAttributes( { statsOption: 'site' } );\n\t\t}\n\t}, [ statsData, setAttributes ] );\n\n\tif ( ! isModuleActive && ! isLoadingModules ) {\n\t\treturn (\n\t\t\t\n\t\t);\n\t}\n\n\tconst visitorsPlaceholder =\n\t\t/* Translators: Number of visitors */\n\t\t_n( 'visitor', 'visitors', parseInt( stats ), 'jetpack', 0 );\n\n\tconst viewsPlaceholder =\n\t\t/* Translators: Number of views */\n\t\t_n( 'hit', 'hits', parseInt( stats ), 'jetpack', 0 );\n\n\treturn (\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t
    \n\t\t\t\t{ isLoadingModules || blogViews === null ? (\n\t\t\t\t\t

    { __( 'Loading stats…', 'jetpack' ) }

    \n\t\t\t\t) : (\n\t\t\t\t\t

    \n\t\t\t\t\t\t{ formatNumber( stats ) } \n\t\t\t\t\t\t setAttributes( { label: newLabel } ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t

    \n\t\t\t\t) }\n\t\t\t
    \n\t\t
    \n\t);\n}\n\nexport default BlogStatsEdit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display removable active filters as chips. that allows users to configure: chip text, custom chip text, chip background, and 3 more options"}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/removable-chips/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"name\": \"woocommerce/product-filter-removable-chips\",\n\t\"title\": \"Chips\",\n\t\"description\": \"Display removable active filters as chips.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"ancestor\": [ \"woocommerce/product-filter-active\" ],\n\t\"supports\": {\n\t\t\"layout\": {\n\t\t\t\"allowSwitching\": false,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"allowVerticalAlignment\": false,\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\"\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": true\n\t},\n\t\"usesContext\": [ \"queryId\", \"filterData\" ],\n\t\"attributes\": {\n\t\t\"chipText\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customChipText\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"chipBackground\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customChipBackground\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"chipBorder\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"customChipBorder\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t},\n\t\"style\": \"file:../woocommerce/product-filter-removable-chips-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/removable-chips/edit.tsx\n/**\n * External dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { Icon, closeSmall, arrowRight, arrowDown } from '@wordpress/icons';\nimport { Label } from '@woocommerce/blocks-components';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\twithColors,\n\t// @ts-expect-error - no types.\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t// @ts-expect-error - no types.\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { EditProps } from './types';\nimport { getColorClasses, getColorVars } from './utils';\n\nconst Edit = ( props: EditProps ): JSX.Element => {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst {\n\t\tname,\n\t\tcontext,\n\t\tclientId,\n\t\tattributes,\n\t\tsetAttributes,\n\t\tchipText,\n\t\tsetChipText,\n\t\tchipBackground,\n\t\tsetChipBackground,\n\t\tchipBorder,\n\t\tsetChipBorder,\n\t} = props;\n\tconst { customChipText, customChipBackground, customChipBorder, layout } =\n\t\tattributes;\n\tconst { filterData } = context;\n\tconst { items } = filterData;\n\n\t// Extract attributes from block layout\n\tconst layoutBlockSupport = getBlockSupport( name, 'layout' );\n\tconst defaultBlockLayout = layoutBlockSupport?.default;\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( 'wc-block-product-filter-removable-chips', {\n\t\t\t...getColorClasses( attributes ),\n\t\t} ),\n\t\tstyle: getColorVars( attributes ),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {} );\n\tconst removeText = ( label: string ): string => {\n\t\treturn sprintf(\n\t\t\t/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */\n\t\t\t__( 'Remove %s filter', 'woocommerce' ),\n\t\t\tlabel\n\t\t);\n\t};\n\n\treturn (\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t...usedLayout,\n\t\t\t\t\t\t\t\t\torientation: 'horizontal',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisPressed={\n\t\t\t\t\t\t\tusedLayout.orientation === 'horizontal' ||\n\t\t\t\t\t\t\t! usedLayout.orientation\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t...usedLayout,\n\t\t\t\t\t\t\t\t\torientation: 'vertical',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisPressed={ usedLayout.orientation === 'vertical' }\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\t\t\t
      \n\t\t\t\t{ items?.map( ( item, index ) => (\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{ item.type + ': ' + item.label }\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t) ) }\n\t\t\t
    \n\t\t\t\n\t\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\tsetChipText( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipText: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetChipText( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipText: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Chip Border', 'woocommerce' ),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\tchipBorder.color || customChipBorder,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetChipBorder( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipBorder: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetChipBorder( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipBorder: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Chip Background', 'woocommerce' ),\n\t\t\t\t\t\t\t\tcolorValue:\n\t\t\t\t\t\t\t\t\tchipBackground.color ||\n\t\t\t\t\t\t\t\t\tcustomChipBackground,\n\t\t\t\t\t\t\t\tonColorChange: ( colorValue: string ) => {\n\t\t\t\t\t\t\t\t\tsetChipBackground( colorValue );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipBackground: colorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tresetAllFilter: () => {\n\t\t\t\t\t\t\t\t\tsetChipBackground( '' );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tcustomChipBackground: '',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\n\t\t
    \n\t);\n};\n\nexport default withColors( {\n\tchipText: 'chip-text',\n\tchipBorder: 'chip-border',\n\tchipBackground: 'chip-background',\n} )( Edit );\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/product-filters/inner-blocks/removable-chips/save.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { BlockAttributes } from './types';\nimport { getColorClasses, getColorVars } from './utils';\n\nconst Save = ( {\n\tattributes,\n\tstyle,\n}: {\n\tattributes: BlockAttributes;\n\tstyle: Record< string, string >;\n} ) => {\n\tconst blockProps = useBlockProps.save( {\n\t\tclassName: clsx(\n\t\t\t'wc-block-product-filter-removable-chips',\n\t\t\tattributes.className,\n\t\t\tgetColorClasses( attributes )\n\t\t),\n\t\tstyle: {\n\t\t\t...style,\n\t\t\t...getColorVars( attributes ),\n\t\t},\n\t} );\n\n\treturn
    ;\n};\n\nexport default Save;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block enabling dynamic comment display with customizable tag and legacy settings for enhanced visual presentation."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/comments/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/comments\",\n\t\"title\": \"Comments\",\n\t\"category\": \"theme\",\n\t\"description\": \"An advanced block that allows displaying post comments using different visual configurations.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"tagName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"div\"\n\t\t},\n\t\t\"legacy\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-comments-editor\",\n\t\"usesContext\": [ \"postId\", \"postType\" ]\n}\n\n\n// File: packages/block-library/src/comments/index.js\n/**\n * WordPress dependencies\n */\nimport { postComments as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/comments/save.js\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { tagName: Tag, legacy } } ) {\n\tconst blockProps = useBlockProps.save();\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\n\t// The legacy version is dynamic (i.e. PHP rendered) and doesn't allow inner\n\t// blocks, so nothing is saved in that case.\n\treturn legacy ? null : ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Develop a block for Display content in multiple columns, with blocks added to each column. that allows users to configure: vertical alignment, is stacked on mobile, template lock"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/columns/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/columns\",\n\t\"title\": \"Columns\",\n\t\"category\": \"design\",\n\t\"allowedBlocks\": [ \"core/column\" ],\n\t\"description\": \"Display content in multiple columns, with blocks added to each column.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"verticalAlignment\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isStackedOnMobile\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"templateLock\": {\n\t\t\t\"type\": [ \"string\", \"boolean\" ],\n\t\t\t\"enum\": [ \"all\", \"insert\", \"contentOnly\", false ]\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"button\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"blockGap\": {\n\t\t\t\t\"__experimentalDefault\": \"2em\",\n\t\t\t\t\"sides\": [ \"horizontal\", \"vertical\" ]\n\t\t\t},\n\t\t\t\"margin\": [ \"top\", \"bottom\" ],\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"padding\": true,\n\t\t\t\t\"blockGap\": true\n\t\t\t}\n\t\t},\n\t\t\"layout\": {\n\t\t\t\"allowSwitching\": false,\n\t\t\t\"allowInheriting\": false,\n\t\t\t\"allowEditing\": false,\n\t\t\t\"default\": {\n\t\t\t\t\"type\": \"flex\",\n\t\t\t\t\"flexWrap\": \"nowrap\"\n\t\t\t}\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"shadow\": true\n\t},\n\t\"editorStyle\": \"wp-block-columns-editor\",\n\t\"style\": \"wp-block-columns\"\n}\n\n\n// File: packages/block-library/src/columns/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { columns as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tvariations,\n\texample: {\n\t\tviewportWidth: 782, // Columns collapse \"@media (max-width: 781px)\".\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/column',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/image',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\turl: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Suspendisse commodo neque lacus, a dictum orci interdum et.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/column',\n\t\t\t\tinnerBlocks: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'core/paragraph',\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t/* translators: example text. */\n\t\t\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t\t\t'Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\tdeprecated,\n\tedit,\n\tsave,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/columns/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { isStackedOnMobile, verticalAlignment } = attributes;\n\n\tconst className = clsx( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps.save( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps.save( blockProps );\n\n\treturn
    ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable is preview, lock, width"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/block.json\n{\n\t\"name\": \"woocommerce/mini-cart-contents\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Mini-Cart Contents\",\n\t\"description\": \"Display a Mini-Cart widget.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"color\": {\n\t\t\t\"text\": true,\n\t\t\t\"background\": true,\n\t\t\t\"link\": true\n\t\t},\n\t\t\"lock\": false,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"width\": true\n\t\t}\n\t},\n\t\"attributes\": {\n\t\t\"isPreview\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t},\n\t\t\"width\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"480px\"\n\t\t}\n\t},\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/mini-cart-contents/edit.tsx\n/* eslint-disable jsdoc/check-alignment */\n/**\n * External dependencies\n */\nimport {\n\tuseBlockProps,\n\tInnerBlocks,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { EditorProvider } from '@woocommerce/base-context';\nimport type { TemplateArray } from '@wordpress/blocks';\nimport type { FocusEvent, ReactElement } from 'react';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\t// eslint-disable-next-line @wordpress/no-unsafe-wp-apis\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useForcedLayout } from '../../cart-checkout-shared';\nimport { MiniCartInnerBlocksStyle } from './inner-blocks-style';\nimport './editor.scss';\nimport { attributes as defaultAttributes } from './attributes';\nimport { useThemeColors } from '../../../shared/hooks/use-theme-colors';\n\n// Array of allowed block names.\nconst ALLOWED_BLOCKS = [\n\t'woocommerce/filled-mini-cart-contents-block',\n\t'woocommerce/empty-mini-cart-contents-block',\n];\nconst MIN_WIDTH = 300;\n\ninterface Props {\n\tclientId: string;\n\tattributes: Record< string, unknown >;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n}\n\nconst Edit = ( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n}: Props ): ReactElement => {\n\tconst { currentView, width } = attributes;\n\n\tconst blockProps = useBlockProps();\n\n\tconst defaultTemplate = [\n\t\t[ 'woocommerce/filled-mini-cart-contents-block', {}, [] ],\n\t\t[ 'woocommerce/empty-mini-cart-contents-block', {}, [] ],\n\t] as TemplateArray;\n\n\tuseForcedLayout( {\n\t\tclientId,\n\t\tregisteredBlocks: ALLOWED_BLOCKS,\n\t\tdefaultTemplate,\n\t} );\n\n\t// Apply the Mini-Cart Contents block base styles based on Site Editor's background and text colors.\n\t// We need to set `div` in the selector so it has more specificity than the CSS.\n\tuseThemeColors(\n\t\t'mini-cart-contents',\n\t\t( { editorBackgroundColor, editorColor } ) => `\n\t\t\t\tdiv:where(.wp-block-woocommerce-mini-cart-contents) {\n\t\t\t\t\tbackground-color: ${ editorBackgroundColor };\n\t\t\t\t\tcolor: ${ editorColor };\n\t\t\t\t}\n\t\t\t`\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tsetAttributes( { width: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonBlur={ ( e: FocusEvent< HTMLInputElement > ) => {\n\t\t\t\t\t\t\tif ( e.target.value === '' ) {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth: defaultAttributes.width.default,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else if ( Number( e.target.value ) < MIN_WIDTH ) {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth: MIN_WIDTH + 'px',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ width }\n\t\t\t\t\t\tunits={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'px',\n\t\t\t\t\t\t\t\tlabel: 'px',\n\t\t\t\t\t\t\t\tdefault: defaultAttributes.width.default,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t\n\t\t\t\n\n\t\t\t
    \n\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t\n\t);\n};\n\nexport default Edit;\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
    \n\t\t\t\n\t\t
    \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a configurable block for displaying taxonomy term names, offering users control over text positioning, heading hierarchy, and link integration."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/term-name/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/term-name\",\n\t\"title\": \"Term Name\",\n\t\"category\": \"theme\",\n\t\"description\": \"Displays the name of a taxonomy term.\",\n\t\"keywords\": [ \"term title\" ],\n\t\"textdomain\": \"default\",\n\t\"usesContext\": [ \"termId\", \"taxonomy\" ],\n\t\"attributes\": {\n\t\t\"textAlign\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"level\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 0\n\t\t},\n\t\t\"isLink\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"levelOptions\": {\n\t\t\t\"type\": \"array\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"style\": \"wp-block-term-name\"\n}\n\n\n// File: packages/block-library/src/term-name/index.js\n/**\n * WordPress dependencies\n */\nimport { termName as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Craft a Gutenberg block to showcase taxonomy terms, incorporating a dropdown view, hierarchical display, and additional configurable options for comprehensive term representation."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/categories/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/categories\",\n\t\"title\": \"Terms List\",\n\t\"category\": \"widgets\",\n\t\"description\": \"Display a list of all terms of a given taxonomy.\",\n\t\"keywords\": [ \"categories\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"taxonomy\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"category\"\n\t\t},\n\t\t\"displayAsDropdown\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showHierarchy\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showPostCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showOnlyTopLevel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"showEmpty\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"label\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"showLabel\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t}\n\t},\n\t\"usesContext\": [ \"enhancedPagination\" ],\n\t\"supports\": {\n\t\t\"align\": true,\n\t\t\"html\": false,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true,\n\t\t\t\t\"link\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-categories-editor\",\n\t\"style\": \"wp-block-categories\"\n}\n\n\n// File: packages/block-library/src/categories/index.js\n/**\n * WordPress dependencies\n */\nimport { category as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Build a Gutenberg block that Your site doesn’t include support for this block. with these attributes: original name, original undelimited content, original content"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/missing/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/missing\",\n\t\"title\": \"Unsupported\",\n\t\"category\": \"text\",\n\t\"description\": \"Your site doesn’t include support for this block.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"originalName\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"originalUndelimitedContent\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"originalContent\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"raw\"\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"className\": false,\n\t\t\"customClassName\": false,\n\t\t\"inserter\": false,\n\t\t\"html\": false,\n\t\t\"lock\": false,\n\t\t\"reusable\": false,\n\t\t\"renaming\": false,\n\t\t\"visibility\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t}\n}\n\n\n// File: packages/block-library/src/missing/index.js\n/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tname,\n\t__experimentalLabel( attributes, { context } ) {\n\t\tif ( context === 'accessibility' ) {\n\t\t\tconst { originalName } = attributes;\n\n\t\t\tconst originalBlockType = originalName\n\t\t\t\t? getBlockType( originalName )\n\t\t\t\t: undefined;\n\n\t\t\tif ( originalBlockType ) {\n\t\t\t\treturn originalBlockType.settings.title || originalName;\n\t\t\t}\n\n\t\t\treturn '';\n\t\t}\n\t},\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/missing/save.js\n/**\n * WordPress dependencies\n */\nimport { RawHTML } from '@wordpress/element';\n\nexport default function save( { attributes } ) {\n\t// Preserve the missing block's content.\n\treturn { attributes.originalContent };\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a custom Gutenberg block enabling users to choose between shipping and local pickup, incorporating a locking mechanism for the selection process."}, {"role": "assistant", "content": "// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.json\n{\n\t\"name\": \"woocommerce/checkout-shipping-method-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Delivery\",\n\t\"description\": \"Select between shipping or local pickup.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"inserter\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-fields-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/edit.tsx\n/* eslint-disable @wordpress/no-unsafe-wp-apis */\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { Icon, store, shipping } from '@wordpress/icons';\nimport { ADMIN_URL, getSetting } from '@woocommerce/settings';\nimport { LOCAL_PICKUP_ENABLED } from '@woocommerce/block-settings';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { Button } from '@ariakit/react';\nimport { useShippingData } from '@woocommerce/base-context/hooks';\nimport { innerBlockAreas } from '@woocommerce/blocks-checkout';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { checkoutStore as checkoutStoreDescriptor } from '@woocommerce/block-data';\nimport ExternalLinkCard from '@woocommerce/editor-components/external-link-card';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tFormStepBlock,\n\tAdditionalFields,\n\tAdditionalFieldsContent,\n} from '../../form-step';\nimport { RatePrice, getLocalPickupPrices, getShippingPrices } from './shared';\nimport type { minMaxPrices } from './shared';\nimport './style.scss';\nimport { defaultShippingText, defaultLocalPickupText } from './constants';\n\nconst LocalPickupSelector = ( {\n\tchecked,\n\trate,\n\tshowPrice,\n\tshowIcon,\n\ttoggleText,\n\tsetAttributes,\n\tonClick,\n}: {\n\tchecked: string;\n\trate: minMaxPrices;\n\tshowPrice: boolean;\n\tshowIcon: boolean;\n\ttoggleText: string;\n\tonClick: () => void;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ) => {\n\treturn (\n\t\t }\n\t\t\tclassName={ clsx( 'wc-block-checkout__shipping-method-option', {\n\t\t\t\t'wc-block-checkout__shipping-method-option--selected':\n\t\t\t\t\tchecked === 'pickup',\n\t\t\t} ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ showIcon === true && (\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t\t\t\tsetAttributes( { localPickupText: value } )\n\t\t\t\t}\n\t\t\t\t__unstableDisableFormats\n\t\t\t\tpreserveWhiteSpace\n\t\t\t/>\n\t\t\t{ showPrice === true && (\n\t\t\t\t\n\t\t\t) }\n\t\t\n\t);\n};\n\nconst ShippingSelector = ( {\n\tchecked,\n\trate,\n\tshowPrice,\n\tshowIcon,\n\ttoggleText,\n\tsetAttributes,\n\tonClick,\n}: {\n\tchecked: string;\n\trate: minMaxPrices;\n\tshowPrice: boolean;\n\tshowIcon: boolean;\n\ttoggleText: string;\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n\tonClick: () => void;\n} ) => {\n\tconst Price =\n\t\trate.min === undefined ? (\n\t\t\t\n\t\t\t\t{ __( 'calculated with an address', 'woocommerce' ) }\n\t\t\t\n\t\t) : (\n\t\t\t\n\t\t);\n\n\treturn (\n\t\t }\n\t\t\tclassName={ clsx( 'wc-block-checkout__shipping-method-option', {\n\t\t\t\t'wc-block-checkout__shipping-method-option--selected':\n\t\t\t\t\tchecked === 'shipping',\n\t\t\t} ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ showIcon === true && (\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t\t\t\tsetAttributes( { shippingText: value } )\n\t\t\t\t}\n\t\t\t\t__unstableDisableFormats\n\t\t\t\tpreserveWhiteSpace\n\t\t\t/>\n\t\t\t{ showPrice === true && Price }\n\t\t\n\t);\n};\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: {\n\tattributes: {\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tshowStepNumber: boolean;\n\t\tallowCreateAccount: boolean;\n\t\tlocalPickupText: string;\n\t\tshippingText: string;\n\t\tshowPrice: boolean;\n\t\tshowIcon: boolean;\n\t\tclassName: string;\n\t};\n\tsetAttributes: ( attributes: Record< string, unknown > ) => void;\n} ): JSX.Element | null => {\n\tuseEffect( () => {\n\t\tconst localPickupTitle = getSetting< string >(\n\t\t\t'localPickupText',\n\t\t\tattributes.localPickupText\n\t\t);\n\t\tsetAttributes( { localPickupText: localPickupTitle } );\n\t\t// Disable the exhaustive deps rule because we only want to run this on first mount to set the attribute, not\n\t\t// each time the attribute changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ setAttributes ] );\n\tconst { setPrefersCollection } = useDispatch( checkoutStoreDescriptor );\n\tconst { prefersCollection } = useSelect( ( select ) => {\n\t\tconst checkoutStore = select( checkoutStoreDescriptor );\n\t\treturn {\n\t\t\tprefersCollection: checkoutStore.prefersCollection(),\n\t\t};\n\t} );\n\tconst { showPrice, showIcon, className, localPickupText, shippingText } =\n\t\tattributes;\n\tconst {\n\t\tshippingRates,\n\t\tneedsShipping,\n\t\thasCalculatedShipping,\n\t\tisCollectable,\n\t} = useShippingData();\n\n\tif (\n\t\t! needsShipping ||\n\t\t! hasCalculatedShipping ||\n\t\t! shippingRates ||\n\t\t! isCollectable ||\n\t\t! LOCAL_PICKUP_ENABLED\n\t) {\n\t\treturn null;\n\t}\n\n\tconst changeView = ( method: string ) => {\n\t\tif ( method === 'pickup' ) {\n\t\t\tsetPrefersCollection( true );\n\t\t} else {\n\t\t\tsetPrefersCollection( false );\n\t\t}\n\t};\n\n\treturn (\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t

    \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Choose how this block is displayed to your customers.',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

    \n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowIcon: ! showIcon,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowPrice: ! showPrice,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t
    \n\t\t\t\t\n\t\t\t\t\t

    \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Methods can be made managed in your store settings.',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

    \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t\t\n\t\t\t\t {\n\t\t\t\t\t\tchangeView( 'shipping' );\n\t\t\t\t\t} }\n\t\t\t\t\tshowPrice={ showPrice }\n\t\t\t\t\tshowIcon={ showIcon }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\ttoggleText={ shippingText }\n\t\t\t\t/>\n\t\t\t\t {\n\t\t\t\t\t\tchangeView( 'pickup' );\n\t\t\t\t\t} }\n\t\t\t\t\tshowIcon={ showIcon }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\ttoggleText={ localPickupText }\n\t\t\t\t/>\n\t\t\t
    \n\t\t\t\n\t\t\n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
    \n\t\t\t\n\t\t
    \n\t);\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a tailored Gutenberg block to enable seamless e-commerce and fundraising functionality directly within your WordPress site."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: projects/plugins/jetpack/extensions/blocks/payments-intro/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"jetpack/payments-intro\",\n\t\"title\": \"Payments\",\n\t\"description\": \"Sell products and services or receive donations on your website.\",\n\t\"keywords\": [ \"earn\", \"monetize\", \"paid\", \"pay\", \"money\", \"checkout\" ],\n\t\"version\": \"12.5.0\",\n\t\"textdomain\": \"jetpack\",\n\t\"category\": \"monetize\",\n\t\"icon\": \"\",\n\t\"supports\": {\n\t\t\"alignWide\": false,\n\t\t\"className\": true,\n\t\t\"customClassName\": false,\n\t\t\"html\": false,\n\t\t\"reusable\": false\n\t}\n}\n\n\n// File: projects/plugins/jetpack/extensions/blocks/payments-intro/edit.js\nimport { InnerBlocks, store as blockEditorStore, useBlockProps } from '@wordpress/block-editor';\nimport { cloneBlock, createBlock, getBlockType, registerBlockVariation } from '@wordpress/blocks';\nimport { Placeholder } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport ConnectBanner from '../../shared/components/connect-banner';\nimport useIsUserConnected from '../../shared/use-is-user-connected';\nimport PaymentsIntroBlockPicker from './block-picker';\nimport PaymentsIntroPatternPicker from './pattern-picker';\nimport defaultVariations from './variations';\n\nexport default function JetpackPaymentsIntroEdit( { name, clientId } ) {\n\tconst patternFilter = pattern => pattern.categories?.includes( 'shop' );\n\n\tconst blockProps = useBlockProps();\n\tconst { blockType, hasInnerBlocks, hasPatterns, settings } = useSelect( select => {\n\t\tconst { getBlocks, __experimentalGetAllowedPatterns, getSettings } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t\tblockType: getBlockType( name ),\n\t\t\thasInnerBlocks: getBlocks( clientId )?.length > 0,\n\t\t\thasPatterns: __experimentalGetAllowedPatterns?.().filter( patternFilter ).length > 0,\n\t\t};\n\t} );\n\n\tconst isUserConnected = useIsUserConnected();\n\n\tconst { replaceBlock, selectBlock, updateSettings } = useDispatch( blockEditorStore );\n\n\tconst maybeMakeBlockVisible = useCallback(\n\t\tblockName => {\n\t\t\tconst isBlockAllowed =\n\t\t\t\tsettings?.allowedBlockTypes === true || settings?.allowedBlockTypes?.includes( blockName );\n\t\t\tif ( ! isBlockAllowed ) {\n\t\t\t\t// Add the block to the allowed block list before rendering\n\t\t\t\tupdateSettings( {\n\t\t\t\t\t...settings,\n\t\t\t\t\tallowedBlockTypes: [ ...settings.allowedBlockTypes, blockName ],\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ settings, updateSettings ]\n\t);\n\n\tconst setVariation = variation => {\n\t\tconst blockName = variation.name;\n\n\t\tmaybeMakeBlockVisible( blockName );\n\t\treplaceBlock( clientId, createBlock( blockName ) );\n\t\tselectBlock( clientId );\n\t};\n\n\tconst usableVariations = defaultVariations.filter( variation => getBlockType( variation.name ) );\n\n\tuseEffect( () => {\n\t\t// Populate default variation on older versions of WP or GB that don't support variations.\n\t\tif ( ! hasInnerBlocks && ! registerBlockVariation ) {\n\t\t\tsetVariation( usableVariations[ 0 ] );\n\t\t}\n\t} );\n\n\tconst displayVariations = usableVariations.length && registerBlockVariation;\n\n\tlet instructions = __( \"Please select which kind of payment you'd like to add.\", 'jetpack' );\n\tif ( hasPatterns ) {\n\t\tinstructions = __( 'Start by choosing one of our suggested layout patterns.', 'jetpack' );\n\t}\n\n\tlet content;\n\n\tif ( ! isUserConnected ) {\n\t\tcontent = (\n\t\t\t\n\t\t);\n\t} else if ( ! hasInnerBlocks && displayVariations ) {\n\t\tcontent = (\n\t\t\t\n\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t replaceBlock( clientId, blocks.map( cloneBlock ) ) }\n\t\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t

    { __( 'Or use one of our blocks to create your own.', 'jetpack' ) }

    \n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\t {\n\t\t\t\t\t\tsetVariation( nextVariation );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\n\t\t);\n\t} else {\n\t\tcontent = ;\n\t}\n\n\treturn
    { content }
    ;\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a widgets block with customizable id, label, title, and 2 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/page-list-item/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/page-list-item\",\n\t\"title\": \"Page List Item\",\n\t\"category\": \"widgets\",\n\t\"parent\": [ \"core/page-list\" ],\n\t\"description\": \"Displays a page inside a list of all pages.\",\n\t\"keywords\": [ \"page\", \"menu\", \"navigation\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"id\": {\n\t\t\t\"type\": \"number\"\n\t\t},\n\t\t\"label\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"title\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"link\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"hasChildren\": {\n\t\t\t\"type\": \"boolean\"\n\t\t}\n\t},\n\t\"usesContext\": [\n\t\t\"textColor\",\n\t\t\"customTextColor\",\n\t\t\"backgroundColor\",\n\t\t\"customBackgroundColor\",\n\t\t\"overlayTextColor\",\n\t\t\"customOverlayTextColor\",\n\t\t\"overlayBackgroundColor\",\n\t\t\"customOverlayBackgroundColor\",\n\t\t\"fontSize\",\n\t\t\"customFontSize\",\n\t\t\"showSubmenuIcon\",\n\t\t\"style\",\n\t\t\"openSubmenusOnClick\"\n\t],\n\t\"supports\": {\n\t\t\"reusable\": false,\n\t\t\"html\": false,\n\t\t\"lock\": false,\n\t\t\"inserter\": false,\n\t\t\"__experimentalToolbar\": false,\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-page-list-editor\",\n\t\"style\": \"wp-block-page-list\"\n}\n\n\n// File: packages/block-library/src/page-list-item/index.js\n/**\n * WordPress dependencies\n */\nimport { page as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit.js';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\t__experimentalLabel: ( { label } ) => label,\n\ticon,\n\texample: {},\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a WooCommerce block for product components featuring intuitive, adaptable styling settings to enhance visual presentation and user interaction."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/attribute-options/block.json\n{\n\t\"name\": \"woocommerce/add-to-cart-with-options-variation-selector-attribute-options\",\n\t\"title\": \"Variation Selector: Attribute Options (Beta)\",\n\t\"description\": \"Display the attribute options associated with a variable product.\",\n\t\"category\": \"woocommerce-product-elements\",\n\t\"keywords\": [ \"WooCommerce\" ],\n\t\"ancestor\": [\n\t\t\"woocommerce/add-to-cart-with-options-variation-selector-attribute\"\n\t],\n\t\"attributes\": {\n\t\t\"optionStyle\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"enum\": [ \"pills\", \"dropdown\" ]\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"supports\": {\n\t\t\"inserter\": false,\n\t\t\"interactivity\": true\n\t},\n\t\"usesContext\": [\n\t\t\"woocommerce/attributeId\",\n\t\t\"woocommerce/attributeName\",\n\t\t\"woocommerce/attributeTerms\"\n\t],\n\t\"style\": \"file:../woocommerce/add-to-cart-with-options-variation-selector-attribute-options-style.css\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/attribute-options/edit.tsx\n/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { type BlockEditProps } from '@wordpress/blocks';\nimport {\n\tDisabled,\n\tPanelBody,\n\tSelectControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useCustomDataContext } from '@woocommerce/shared-context';\nimport type { ProductResponseAttributeItem } from '@woocommerce/types';\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { useThemeColors } from '../../../../shared/hooks/use-theme-colors';\n\ninterface Attributes {\n\tclassName?: string;\n\toptionStyle?: 'pills' | 'dropdown';\n}\n\nfunction Pills( {\n\tid,\n\toptions,\n}: {\n\tid: string;\n\toptions: SelectControl.Option[];\n} ) {\n\treturn (\n\t\t\n\t\t\t{ options.map( ( option, index ) => (\n\t\t\t\t\n\t\t\t\t\t{ option.label }\n\t\t\t\t\n\t\t\t) ) }\n\t\t\n\t);\n}\n\nexport default function AttributeOptionsEdit(\n\tprops: BlockEditProps< Attributes >\n) {\n\tconst { attributes, setAttributes } = props;\n\tconst { className, optionStyle } = attributes;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName,\n\t} );\n\n\t// Apply selected variation pill styles based on Site Editor's background and text colors.\n\tuseThemeColors(\n\t\t'add-to-cart-with-options-variation-selector-attribute-options',\n\t\t( { editorBackgroundColor, editorColor } ) => `\n\t\t\t:where(.wc-block-add-to-cart-with-options-variation-selector-attribute-options__pill--selected) {\n\t\t\t\t--pill-color: ${ editorBackgroundColor };\n\t\t\t\t--pill-background-color: ${ editorColor };\n\t\t\t}\n\t\t`\n\t);\n\n\tconst { data: attribute } =\n\t\tuseCustomDataContext< ProductResponseAttributeItem >( 'attribute' );\n\n\tif ( ! attribute ) return null;\n\n\tconst options = attribute.terms.map( ( term, index ) => ( {\n\t\tvalue: term.slug,\n\t\tlabel: term.name,\n\t\tdisabled: index > 1 && index === attribute.terms.length - 1,\n\t} ) );\n\n\treturn (\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tnewOptionStyle === 'pills' ||\n\t\t\t\t\t\t\t\tnewOptionStyle === 'dropdown'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\toptionStyle: newOptionStyle,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t{ optionStyle === 'dropdown' ? (\n\t\t\t\t\t\n\t\t\t\t\t\t{ options.map( ( option ) => (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\n\t\t\t\t) : (\n\t\t\t\t\t\n\t\t\t\t) }\n\t\t\t\n\t\t
    \n\t);\n}\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Design a dynamic tag visualization block that enables users to modify the keyword cloud's display, including tag count, taxonomy type, visibility settings, and two supplementary configuration choices."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/tag-cloud/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/tag-cloud\",\n\t\"title\": \"Tag Cloud\",\n\t\"category\": \"widgets\",\n\t\"description\": \"A cloud of popular keywords, each sized by how often it appears.\",\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"numberOfTags\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 45,\n\t\t\t\"minimum\": 1,\n\t\t\t\"maximum\": 100\n\t\t},\n\t\t\"taxonomy\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"post_tag\"\n\t\t},\n\t\t\"showTagCounts\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"smallestFontSize\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"8pt\"\n\t\t},\n\t\t\"largestFontSize\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"22pt\"\n\t\t}\n\t},\n\t\"styles\": [\n\t\t{ \"name\": \"default\", \"label\": \"Default\", \"isDefault\": true },\n\t\t{ \"name\": \"outline\", \"label\": \"Outline\" }\n\t],\n\t\"supports\": {\n\t\t\"html\": false,\n\t\t\"align\": true,\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalLetterSpacing\": true\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"__experimentalBorder\": {\n\t\t\t\"radius\": true,\n\t\t\t\"color\": true,\n\t\t\t\"width\": true,\n\t\t\t\"style\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"color\": true,\n\t\t\t\t\"width\": true,\n\t\t\t\t\"style\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"editorStyle\": \"wp-block-tag-cloud-editor\"\n}\n\n\n// File: packages/block-library/src/tag-cloud/index.js\n/**\n * WordPress dependencies\n */\nimport { tag as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport transforms from './transforms';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\tedit,\n\ttransforms,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a WordPress block specifically designed to display the cart shipping row, enabling users to implement customizable locking functionality."}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/block.json\n{\n\t\"name\": \"woocommerce/checkout-order-summary-shipping-block\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Shipping\",\n\t\"description\": \"Shows the cart shipping row.\",\n\t\"category\": \"woocommerce\",\n\t\"supports\": {\n\t\t\"align\": false,\n\t\t\"html\": false,\n\t\t\"multiple\": false,\n\t\t\"reusable\": false,\n\t\t\"lock\": false\n\t},\n\t\"attributes\": {\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true,\n\t\t\t\t\"move\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"parent\": [\n\t\t\"woocommerce/checkout-order-summary-totals-block\"\n\t],\n\t\"textdomain\": \"woocommerce\",\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3\n}\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/edit.tsx\n/**\n * External dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport Noninteractive from '@woocommerce/base-components/noninteractive';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\n\nexport const Edit = ( {\n\tattributes,\n}: {\n\tattributes: {\n\t\tclassName: string;\n\t};\n} ): JSX.Element => {\n\tconst { className } = attributes;\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
    \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn
    ;\n};\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a woocommerce block with customizable customer email, nonce token, align, and 3 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/create-account/block.json\n{\n\t\"name\": \"woocommerce/order-confirmation-create-account\",\n\t\"version\": \"1.0.0\",\n\t\"title\": \"Account Creation\",\n\t\"description\": \"Allow customers to create an account after their purchase.\",\n\t\"category\": \"woocommerce\",\n\t\"keywords\": [\n\t\t\"WooCommerce\"\n\t],\n\t\"attributes\": {\n\t\t\"customerEmail\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"nonceToken\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"wide\"\n\t\t},\n\t\t\"className\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"\"\n\t\t},\n\t\t\"hasDarkControls\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t},\n\t\t\"lock\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"default\": {\n\t\t\t\t\"remove\": true\n\t\t\t}\n\t\t}\n\t},\n\t\"supports\": {\n\t\t\"multiple\": false,\n\t\t\"inserter\": false,\n\t\t\"html\": false,\n\t\t\"lock\": false,\n\t\t\"align\": [\n\t\t\t\"wide\",\n\t\t\t\"full\"\n\t\t],\n\t\t\"color\": {\n\t\t\t\"background\": true,\n\t\t\t\"text\": true,\n\t\t\t\"button\": true\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"padding\": true,\n\t\t\t\"margin\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"margin\": false,\n\t\t\t\t\"padding\": false\n\t\t\t}\n\t\t}\n\t},\n\t\"textdomain\": \"woocommerce\",\n\t\"apiVersion\": 3,\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\"\n}\n\n\n// File: plugins/woocommerce/client/blocks/assets/js/blocks/order-confirmation/create-account/edit.tsx\n/**\n * External dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport type { TemplateArray, BlockAttributes } from '@wordpress/blocks';\nimport {\n\tDisabled,\n\tPanelBody,\n\tToggleControl,\n\tExternalLink,\n} from '@wordpress/components';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { getSetting, ADMIN_URL } from '@woocommerce/settings';\n\n/**\n * Internal dependencies\n */\nimport './style.scss';\nimport { SITE_TITLE } from '../../../settings/shared/default-constants';\nimport Form from './form';\n\nconst defaultTemplate = [\n\t[\n\t\t'core/heading',\n\t\t{\n\t\t\tlevel: 3,\n\t\t\tcontent: sprintf(\n\t\t\t\t/* translators: %s: site name */\n\t\t\t\t__( 'Create an account with %s', 'woocommerce' ),\n\t\t\t\tSITE_TITLE\n\t\t\t),\n\t\t},\n\t],\n\t[\n\t\t'core/list',\n\t\t{\n\t\t\tclassName: 'is-style-checkmark-list',\n\t\t},\n\t\t[\n\t\t\t[\n\t\t\t\t'core/list-item',\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Faster future purchases', 'woocommerce' ),\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/list-item',\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Securely save payment info', 'woocommerce' ),\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/list-item',\n\t\t\t\t{\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'Track orders & view shopping history',\n\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t],\n\t],\n] as TemplateArray;\n\ntype EditProps = {\n\tattributes: {\n\t\thasDarkControls: boolean;\n\t};\n\tsetAttributes: ( attrs: BlockAttributes ) => void;\n};\n\nexport const Edit = ( {\n\tattributes,\n\tsetAttributes,\n}: EditProps ): JSX.Element | null => {\n\tconst className = clsx( 'wc-block-order-confirmation-create-account', {\n\t\t'has-dark-controls': attributes.hasDarkControls,\n\t} );\n\tconst blockProps = useBlockProps( {\n\t\tclassName,\n\t} );\n\tconst isEnabled = getSetting( 'delayedAccountCreationEnabled', true );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst generatePassword = getSetting( 'registrationGeneratePassword', true );\n\n\treturn (\n\t\t
    \n\t\t\t\n\t\t\t\n\t\t\t\t
    \n\t\t\t\n\t\t\t{ ! generatePassword && (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\thasDarkControls:\n\t\t\t\t\t\t\t\t\t\t! attributes.hasDarkControls,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t) }\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t

    \n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Configure this feature in your store settings.',\n\t\t\t\t\t\t\t'woocommerce'\n\t\t\t\t\t\t) }\n\t\t\t\t\t

    \n\t\t\t\t\t\n\t\t\t\t\t\t{ __( 'Manage account settings', 'woocommerce' ) }\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t);\n};\n\nexport const Save = (): JSX.Element => {\n\treturn (\n\t\t
    \n\t\t\t\n\t\t
    \n\t);\n};\n\nexport default Edit;\n"}]} {"messages": [{"role": "system", "content": "You are an expert WordPress developer specializing in creating high-quality plugins and Gutenberg blocks.\nYou write clean, well-documented code following WordPress coding standards and best practices.\nYour code is secure, performant, and maintainable.\n"}, {"role": "user", "content": "Create a media block with customizable align, media alt, media position, and 16 more options"}, {"role": "assistant", "content": "<|thinking|>\nTo create this {type}, I need to:\n- Create the block.json configuration file\n- Register the block type\n- Define block attributes and their types\n- Implement the Edit component for the editor\n- Implement the Save component for frontend rendering\n- Add necessary controls in the inspector panel\n- Style the block for both editor and frontend\n<|im_end|>\n\n\n// File: packages/block-library/src/media-text/block.json\n{\n\t\"$schema\": \"https://schemas.wp.org/trunk/block.json\",\n\t\"apiVersion\": 3,\n\t\"name\": \"core/media-text\",\n\t\"title\": \"Media & Text\",\n\t\"category\": \"media\",\n\t\"description\": \"Set media and words side-by-side for a richer layout.\",\n\t\"keywords\": [ \"image\", \"video\" ],\n\t\"textdomain\": \"default\",\n\t\"attributes\": {\n\t\t\"align\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"none\"\n\t\t},\n\t\t\"mediaAlt\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure img\",\n\t\t\t\"attribute\": \"alt\",\n\t\t\t\"default\": \"\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"mediaPosition\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"default\": \"left\"\n\t\t},\n\t\t\"mediaId\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"mediaUrl\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure video,figure img\",\n\t\t\t\"attribute\": \"src\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"mediaLink\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"linkDestination\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"linkTarget\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure a\",\n\t\t\t\"attribute\": \"target\"\n\t\t},\n\t\t\"href\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure a\",\n\t\t\t\"attribute\": \"href\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"rel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure a\",\n\t\t\t\"attribute\": \"rel\"\n\t\t},\n\t\t\"linkClass\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"source\": \"attribute\",\n\t\t\t\"selector\": \"figure a\",\n\t\t\t\"attribute\": \"class\"\n\t\t},\n\t\t\"mediaType\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"role\": \"content\"\n\t\t},\n\t\t\"mediaWidth\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"default\": 50\n\t\t},\n\t\t\"mediaSizeSlug\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"isStackedOnMobile\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": true\n\t\t},\n\t\t\"verticalAlignment\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"imageFill\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"focalPoint\": {\n\t\t\t\"type\": \"object\"\n\t\t},\n\t\t\"useFeaturedImage\": {\n\t\t\t\"type\": \"boolean\",\n\t\t\t\"default\": false\n\t\t}\n\t},\n\t\"usesContext\": [ \"postId\", \"postType\" ],\n\t\"supports\": {\n\t\t\"anchor\": true,\n\t\t\"align\": [ \"wide\", \"full\" ],\n\t\t\"html\": false,\n\t\t\"__experimentalBorder\": {\n\t\t\t\"color\": true,\n\t\t\t\"radius\": true,\n\t\t\t\"style\": true,\n\t\t\t\"width\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"color\": true,\n\t\t\t\t\"radius\": true,\n\t\t\t\t\"style\": true,\n\t\t\t\t\"width\": true\n\t\t\t}\n\t\t},\n\t\t\"color\": {\n\t\t\t\"gradients\": true,\n\t\t\t\"heading\": true,\n\t\t\t\"link\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"background\": true,\n\t\t\t\t\"text\": true\n\t\t\t}\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"margin\": true,\n\t\t\t\"padding\": true\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontSize\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"__experimentalFontFamily\": true,\n\t\t\t\"__experimentalFontWeight\": true,\n\t\t\t\"__experimentalFontStyle\": true,\n\t\t\t\"__experimentalTextTransform\": true,\n\t\t\t\"__experimentalTextDecoration\": true,\n\t\t\t\"__experimentalLetterSpacing\": true,\n\t\t\t\"__experimentalDefaultControls\": {\n\t\t\t\t\"fontSize\": true\n\t\t\t}\n\t\t},\n\t\t\"interactivity\": {\n\t\t\t\"clientNavigation\": true\n\t\t},\n\t\t\"allowedBlocks\": true\n\t},\n\t\"editorStyle\": \"wp-block-media-text-editor\",\n\t\"style\": \"wp-block-media-text\"\n}\n\n\n// File: packages/block-library/src/media-text/index.js\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { mediaAndText as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tviewportWidth: 601, // Columns collapse \"@media (max-width: 600px)\".\n\t\tattributes: {\n\t\t\tmediaType: 'image',\n\t\t\tmediaUrl:\n\t\t\t\t'https://s.w.org/images/core/5.3/Biologia_Centrali-Americana_-_Cantorchilus_semibadius_1902.jpg',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'The wren
    Earns his living
    Noiselessly.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( '— Kobayashi Issa (一茶)' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'media',\n\t\t\tlabel: __( 'Media' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'mediaId',\n\t\t\t\ttype: 'mediaType',\n\t\t\t\turl: 'mediaUrl',\n\t\t\t\tlink: 'mediaLink',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [ 'image', 'video' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\turl: 'href',\n\t\t\t\trel: 'rel',\n\t\t\t\tlinkTarget: 'linkTarget',\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'media' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n\n\n// File: packages/block-library/src/media-text/save.js\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { imageFillStyles } from './image-fill';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from './constants';\n\nconst DEFAULT_MEDIA_WIDTH = 50;\nconst noop = () => {};\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\tisStackedOnMobile,\n\t\tmediaAlt,\n\t\tmediaPosition,\n\t\tmediaType,\n\t\tmediaUrl,\n\t\tmediaWidth,\n\t\tmediaId,\n\t\tverticalAlignment,\n\t\timageFill,\n\t\tfocalPoint,\n\t\tlinkClass,\n\t\thref,\n\t\tlinkTarget,\n\t\trel,\n\t} = attributes;\n\tconst mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;\n\tconst newRel = ! rel ? undefined : rel;\n\n\tconst imageClasses = clsx( {\n\t\t[ `wp-image-${ mediaId }` ]: mediaId && mediaType === 'image',\n\t\t[ `size-${ mediaSizeSlug }` ]: mediaId && mediaType === 'image',\n\t} );\n\n\tconst positionStyles = imageFill\n\t\t? imageFillStyles( mediaUrl, focalPoint )\n\t\t: {};\n\n\tlet image = mediaUrl ? (\n\t\t\n\t) : null;\n\n\tif ( href ) {\n\t\timage = (\n\t\t\t\n\t\t\t\t{ image }\n\t\t\t\n\t\t);\n\t}\n\n\tconst mediaTypeRenders = {\n\t\timage: () => image,\n\t\tvideo: () =>