# nikodemjankiewicz/wpfse-popup-modal architecture

> Architecture diagram of the GitHub repository nikodemjankiewicz/wpfse-popup-modal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nikodemjankiewicz/wpfse-popup-modal
- Repository: https://github.com/nikodemjankiewicz/wpfse-popup-modal

## Overview

WP FSE Popup Modal is a WordPress Gutenberg/FSE block plugin. Editors configure a modal ID and content, then place an independent same-page link targeting that ID; on the frontend, the view script intercepts the link and opens the matching dialog, with accessible close and focus handling. PHP renders inner blocks server-side for dynamic content. The graph covers the principal editor, rendering, and browser workflows plus styling and WordPress registration. Relationships for styling and block metadata are documented or indexed; source excerpts do not show their runtime wiring in full.

Main entry points: [`src/index.js`](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/index.js) (Block registration), [`src/edit.js`](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/edit.js) (Modal editor), [`plugin.php`](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/plugin.php) (Server block renderer), [`src/view.js`](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/view.js) (Dialog interaction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Block editor"]
  node_edit["Modal editor<br/>[edit.js]"]
  node_block_registration["Block registration<br/>[index.js]"]
  node_block_metadata["Block metadata<br/>[block.json]"]
  node_editor_styles["Editor styling<br/>[editor.scss]"]
end

subgraph group_render["Block rendering"]
  node_save["Block save markup<br/>[save.js]"]
  node_server_render["Server block renderer<br/>[plugin.php]"]
  node_inner_blocks["Dynamic inner blocks"]
  node_page_markup["Rendered page"]
end

subgraph group_frontend["Frontend behavior"]
  node_frontend_styles["Frontend styling<br/>[style.scss]"]
  node_same_page_link["Same-page link"]
  node_view_script["Dialog interaction<br/>[view.js]"]
  node_modal_dialog["Native dialog"]
  node_media_playback["Modal media"]
end

subgraph group_plugin["WordPress plugin"]
  node_php_registration["PHP block registration<br/>[plugin.php]"]
end

node_editor_user(("Site editor user"))
node_trigger_user(("Site visitor"))

node_editor_user -->|"configures"| node_edit
node_edit -->|"registers via"| node_block_registration
node_block_registration -->|"uses metadata"| node_block_metadata
node_block_registration -->|"sets save"| node_save
node_block_registration -->|"sets editor"| node_edit
node_block_registration -->|"loads"| node_editor_styles
node_block_registration -->|"loads"| node_frontend_styles
node_edit -.->|"stores attributes"| node_save
node_save -->|"saves markup"| node_page_markup
node_php_registration -->|"registers callback"| node_server_render
node_server_render -->|"renders blocks"| node_inner_blocks
node_server_render -->|"emits dialog"| node_page_markup
node_inner_blocks -->|"returns markup"| node_server_render
node_trigger_user -->|"clicks"| node_same_page_link
node_same_page_link -->|"intercepted by"| node_view_script
node_view_script -->|"opens or closes"| node_modal_dialog
node_view_script -->|"stops playback"| node_media_playback
node_modal_dialog -->|"restores focus"| node_view_script
node_page_markup -->|"contains dialog"| node_modal_dialog

click node_edit "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/edit.js"
click node_block_registration "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/index.js"
click node_block_metadata "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/block.json"
click node_editor_styles "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/editor.scss"
click node_frontend_styles "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/style.scss"
click node_save "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/save.js"
click node_php_registration "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/plugin.php"
click node_server_render "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/plugin.php"
click node_view_script "https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/view.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_edit,node_block_registration,node_block_metadata,node_editor_styles,node_editor_user toneBlue
class node_save,node_server_render,node_inner_blocks,node_page_markup toneAmber
class node_frontend_styles,node_same_page_link,node_view_script,node_modal_dialog,node_media_playback toneMint
class node_php_registration toneRose
class node_trigger_user toneIndigo
```

## Components

### Block editor

- [Modal editor](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/edit.js): `src/edit.js`
- [Block registration](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/index.js): `src/index.js`
- [Block metadata](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/block.json): `src/block.json`
- [Editor styling](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/editor.scss): `src/editor.scss`

### Block rendering

- [Block save markup](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/save.js): `src/save.js`
- [Server block renderer](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/plugin.php): `plugin.php`
- **Dynamic inner blocks**
- **Rendered page**

### Frontend behavior

- [Frontend styling](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/style.scss): `src/style.scss`
- **Same-page link**
- [Dialog interaction](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/src/view.js): `src/view.js`
- **Native dialog**
- **Modal media**

### WordPress plugin

- [PHP block registration](https://github.com/nikodemjankiewicz/wpfse-popup-modal/blob/main/plugin.php): `plugin.php`

### Other components

- **Site editor user**
- **Site visitor**

## Connections

- Site editor user → Modal editor: configures (evidence: `README.md`)
- Modal editor → Block registration: registers via (evidence: `src/index.js`)
- Block registration → Block metadata: uses metadata (evidence: `src/index.js`)
- Block registration → Block save markup: sets save (evidence: `src/index.js`)
- Block registration → Modal editor: sets editor (evidence: `src/index.js`)
- Block registration → Editor styling: loads (evidence: `src/index.js`)
- Block registration → Frontend styling: loads (evidence: `src/index.js`)
- Modal editor → Block save markup: stores attributes
- Block save markup → Rendered page: saves markup (evidence: `src/save.js`)
- PHP block registration → Server block renderer: registers callback (evidence: `plugin.php`)
- Server block renderer → Dynamic inner blocks: renders blocks (evidence: `plugin.php`)
- Server block renderer → Rendered page: emits dialog (evidence: `plugin.php`)
- Dynamic inner blocks → Server block renderer: returns markup (evidence: `plugin.php`)
- Site visitor → Same-page link: clicks (evidence: `README.md`)
- Same-page link → Dialog interaction: intercepted by (evidence: `README.md`)
- Dialog interaction → Native dialog: opens or closes (evidence: `src/view.js`)
- Dialog interaction → Modal media: stops playback (evidence: `src/view.js`)
- Native dialog → Dialog interaction: restores focus (evidence: `src/view.js`)
- Rendered page → Native dialog: contains dialog
