=== WPBits Block Studio ===
Contributors: wpbits, kyguney
Tags: gutenberg, blocks, block-builder, generator, developer-tools
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Developer helper plugin to create Gutenberg blocks from a visual interface and generated project files. Powered by WPBits.

== Description ==

WPBits Block Studio is a powerful developer tool that helps you create custom Gutenberg blocks without writing code from scratch. Perfect for WordPress developers, agencies, and power users who want to speed up their block development workflow.

= Key Features =

== Free Features ==

* **Visual Block Builder** – Configure block metadata and attributes in WordPress
* **Schema-Based Generation** – JSON schema defines block structure
* **Static & Dynamic Blocks** – Build both static and dynamic Gutenberg blocks
* **Twig Template Engine** – Familiar templating syntax with powerful features
* **Attribute Editor** – Visual editing for block attributes
* **Conditional Visibility** – Show/hide blocks based on conditions
* **Template System** – Reusable block templates
* **Block Supports Editor** – Configure block support options
* **Location Rules** – Control where blocks appear
* **Auto-Sync** – Synchronize externally edited generated block files
* **Import/Export** – Import and export block configurations
* **Role-Based Access** – Control access by user role
* **Internationalization** – Full i18n support for translations

== Pro Features ==

* **Custom Render PHP** – Use your own PHP render logic in the separate Pro version
* **Advanced content controls** – Available in the separate Pro version
* **InnerBlocks Support** – Configure nested block areas
* **Groups Tab** – Organize attributes into collapsible sections
* **Custom Categories** – Organize blocks in the inserter
* **Custom Output Directory** – Set where block files are saved
* **Custom Icon Upload** – Upload SVG, PNG, JPG, GIF icons
* **Export as Plugin** – Package blocks as standalone WordPress plugins

= Available Control Types =

**Free Controls:**

* Text – Single-line text input
* Textarea – Multi-line text input with optional TinyMCE rich editor
* Rich Text – WordPress rich text editor
* Number – Numeric input with min/max/step
* Range – Slider control with min/max/step
* Checkbox – Boolean checkbox
* Toggle – On/off toggle switch
* Select – Dropdown select
* Multi-Select – Multiple selection dropdown
* Combobox – Searchable dropdown with free-text entry
* Radio – Radio button group
* Color – Color picker with palette support
* Image – Media library image picker
* Date – Popover-based date picker with format options
* DateTime – Combined date and time picker
* Time – Time-only picker
* Link – URL picker with search and open-in-new-tab option
* Unit – Numeric input with unit suffix (px, em, rem, %, etc.)

**Pro Controls:**

* Advanced content controls for complex content models (PRO)

= Perfect For =

* WordPress developers building custom blocks
* Agencies creating blocks for multiple clients
* Theme developers needing block patterns
* Plugin developers requiring custom blocks
* Anyone wanting to learn block development

= Generated Block Structure =

Each generated block includes:

* `block.json` – Block metadata and configuration
* `index.js` – Block registration and editor/save components
* `template.twig` – Generated Twig template used by the block runtime
* `style.css` – Frontend styles
* `editor.css` – Editor-only styles
* `README.md` – Block documentation

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/wpbits-block-studio` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Navigate to **WPBits Block Studio** in your WordPress admin menu.
4. Start creating blocks!

= Manual Installation =

1. Download the plugin ZIP file.
2. Go to WordPress admin → Plugins → Add New.
3. Click "Upload Plugin" and select the ZIP file.
4. Click "Install Now" and then "Activate Plugin".

= Requirements =

* WordPress 6.5 or higher
* PHP 8.0 or higher (PHP 8.3 recommended)
* Node.js 20.x for development builds

== Frequently Asked Questions ==

= Do I need coding knowledge to use this plugin? =

Basic understanding of WordPress blocks is helpful, but the visual interface makes it easy to create blocks without extensive coding knowledge. The plugin generates all the necessary code for you.

= Can I edit the generated blocks after creation? =

Yes. You can update block configuration in the plugin interface, regenerate files, or edit generated project files externally with your own editor, FTP, or local development workflow.

= What's the difference between static and dynamic blocks? =

Static blocks save their output directly to the post content using JavaScript's save function. Dynamic blocks render on the server side using the generated Twig template, which is better for content that changes frequently.

= Can I use Twig templates? =

Yes. WPBits Block Studio generates `template.twig` files and renders them through the plugin runtime. Edit those generated files outside wp-admin using your normal development tools.

= Can I use the generated blocks in my theme? =

Yes. The free version generates block files in the plugin-managed output directory. Pro can generate to a custom output directory.

= Does this work with block themes? =

Yes! The plugin is fully compatible with both classic and block themes.

= Can I import existing blocks? =

Yes, you can import compatible generated block files and regenerate them.

= Can I export multiple blocks at once? =

The free version supports block configuration export. The separate Pro version adds standalone plugin export.

= How does auto-sync work? =

Auto-sync monitors generated block files edited outside wp-admin and compares them with the saved block definitions. It detects new or changed generated files so you can keep the file workflow and block configuration in sync.

== Screenshots ==

1. Dashboard – Overview of all created blocks with DataViews
2. Block Form – Create and edit blocks with tabbed interface and validation
3. Attribute Editor – Visual editor with drag-and-drop reordering and conditional visibility
4. Settings Page – Configure defaults, role management, and sync options
5. Icon Picker – Choose block icons from supported WordPress icon options
6. Export Options – Export block configurations
7. Sync Status – Track externally edited generated files and sync state across all blocks

== Changelog ==

= 1.0.0 =  
Initial release of WPBits Block Studio.

== Developer Notes ==

= REST API Endpoints =

The plugin provides REST API endpoints for programmatic access:

* `GET /wp-json/wpbs/v1/blocks` – List all blocks
* `POST /wp-json/wpbs/v1/blocks` – Create a new block
* `GET /wp-json/wpbs/v1/blocks/{id}` – Get a single block
* `PUT /wp-json/wpbs/v1/blocks/{id}` – Update a block
* `DELETE /wp-json/wpbs/v1/blocks/{id}` – Delete a block
* `POST /wp-json/wpbs/v1/blocks/{id}/generate` – Generate block files
* `POST /wp-json/wpbs/v1/blocks/{id}/export` – Export block to ZIP
* `GET /wp-json/wpbs/v1/settings` – Get plugin settings
* `POST /wp-json/wpbs/v1/settings` – Update plugin settings

= Filters & Actions =

Developers can extend the plugin using WordPress hooks:

* `wpbs_block_generation_path` – Filter the output path for generated blocks
* `wpbs_template_replacements` – Filter template placeholder replacements
* `wpbs_after_block_generation` – Action fired after block generation

= Source Code & Build Tools =

The human-readable JavaScript source files for the React admin interface are included in this plugin package under the `admin/` directory.

== Privacy Policy ==

This plugin does not collect, store, or transmit any user data. All block schemas are stored locally in your WordPress database.

== Support ==

For support, feature requests, or bug reports, please visit the plugin support forum or GitHub repository.
