Skip to content

Native Plugins window + <wpd-card>#137

Merged
AllTerrainDeveloper merged 3 commits into
trunkfrom
fixes-plugin-activations
May 10, 2026
Merged

Native Plugins window + <wpd-card>#137
AllTerrainDeveloper merged 3 commits into
trunkfrom
fixes-plugin-activations

Conversation

@AllTerrainDeveloper
Copy link
Copy Markdown
Collaborator

@AllTerrainDeveloper AllTerrainDeveloper commented May 10, 2026

Adds a first-class Plugins native window to replace the chromeless plugins.php + plugin-install.php iframes, plus a reusable <wpd-card> component for the gallery.

Highlights

  • Two-tab native window (desktop-mode-plugins, opt-out via nativePluginsEnabled):
    • Installed<wpd-table> with name + status badge, version + update pill, author, disk size, per-row Activate / Deactivate / Delete + bulk actions. Live dock repaint after every mutation via wp.desktop.refreshMenu().
    • Browse — search + segmented filter (Featured / Popular / Recommended / Favorites / New / Beta) + Upload button. Infinite-scroll gallery of <wpd-card> tiles with hover lift, lazy icons, and shimmer skeletons during pagination.
  • Detail flyout (<wpd-flyout>) with sticky hero, banner-clipped corners, glass-blur close button, and tabs for Overview / Screenshots / Reviews / Changelog / FAQ. Reviews are scraped from wp.org with a histogram-only fallback when parsing fails.
  • Install paths:
    • by .org slug → calls Core's existing wp_ajax_install_plugin (zero reimplementation, uses Core's 'updates' nonce).
    • by .zip → wp_ajax_desktop_mode_plugins_upload accepts a multipart upload or drag-drop a .zip onto the window.
  • Drag a card to the dock → pins via wp.desktop.registerSystemTile(). Payload type 'wporg-plugin' is hookable so plugin authors can register their own drop targets.
  • First-open intro dialog showcasing the new window (matches the Posts/Pages/Users pattern, persists via the seen-intros REST endpoint).

New surfaces

  • PHP: desktop_mode_plugins_window_user_can_register|use|caps, *_args|template_html|browse_args|browse_response|info_response|review_parser|icon_url, action desktop_mode_plugins_window_installed. REST-field decorators on /wp/v2/plugins: desktop_mode_update_available, desktop_mode_can_manage, desktop_mode_icon_url, desktop_mode_size_kb. AJAX actions: wp_ajax_desktop_mode_plugins_{browse,info,reviews,upload}.
  • JS: wp.desktop.createSharedStore('desktop-mode/plugins-window/tab-target') for initial-tab routing; OsSettingsState.nativePluginsEnabled + Features toggle.
  • Component: <wpd-card>interactive, selected, compact, disabled, wpd-card-click event, [data-noclick]-aware, slot rhythms for <header> / <footer>.

Notable fixes (during this branch)

  • <wpd-table> cell content now uses inline styles (cells live in shadow DOM; document CSS doesn't reach them — same posture posts-window uses).
  • Fixed phantom horizontal scroll caused by <wpd-flyout>'s off-screen translate — root container is now position: relative + overflow-x: hidden.
  • Plugin path encoding (encodePluginPath) keeps slashes literal for Apache's default AllowEncodedSlashes Off.
  • Segmented event listener corrected (wpd-pick, not wpd-segmented-change).
  • Removed pre-emptive "you can't drag this" cues (cursor: not-allowed, bump animation, tooltip, aria-disabled) on pinned tiles like My WordPress — silent until the user actually attempts a drag.

Plugin Check posture

Plugin_Upgrader, WP_Filesystem, plugins_api() all touched only from wp_ajax_* callbacks (the same idiom Core's wp_ajax_install_plugin uses) — no require_once ABSPATH . 'wp-admin/…' in REST runtime paths.

Tests

  • Vitest: plugins-window-rest.test.ts (11), wpd-card.test.ts (8), updated desktop-files-drag.test.ts. 1064/1064 passing.
  • PHPUnit: pluginsWindowRegistration.php covers cap gates, opt-in round-trip, REST-field decorators, icon-URL filter.

Docs

  • Full Plugins-window section in docs/hooks-reference.md + docs/javascript-reference.md.
  • New recipe docs/examples/plugins-window-extras.md (curated browse filter, icon override, reviews-parser swap, install action, deep-link to Browse, accept-card drop target).

Verification

npm run lint && ./node_modules/.bin/tsc --noEmit && npm run test:js && npm run build

Plus manual QA in the dev environment: install a plugin from Browse, deactivate from Installed, drop a .zip on the window, drag a card to the dock, switch tabs, open detail flyout, hard-refresh — all live, no F5 between steps.

Open WordPress Playground Preview
- Implemented `<wpd-card>` component with interactive, selected, compact, and disabled states.
- Added styles for the card component, including hover effects and responsive design.
- Created unit tests for the card component to verify behavior for interactive and non-interactive states, click events, and keyboard interactions.
- Developed PHP unit tests for the Plugins window registration, ensuring proper capability checks for different user roles.
- Added REST and admin-ajax tests for the Plugins window, covering configuration, plugin activation, deactivation, deletion, and browsing functionality.
@AllTerrainDeveloper
Copy link
Copy Markdown
Collaborator Author

@epeicher hey it would be nice, given your expertise in plugins directory, your valuable test and opinion on this new "marketplace" rework :)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 10, 2026

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@AllTerrainDeveloper
Copy link
Copy Markdown
Collaborator Author

Actually, I'm going to merge. We can test it before the release.

@AllTerrainDeveloper AllTerrainDeveloper merged commit 47cded9 into trunk May 10, 2026
5 checks passed
@AllTerrainDeveloper AllTerrainDeveloper deleted the fixes-plugin-activations branch May 10, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant