window-panel-authoring

Register floating window panels in matrx-admin with OverlayController and Tools grid.

2|1|Updated Aug 24, 2024
One-click install
npx skills add https://github.com/armanisadeghi/ai-matrx --skill window-panel-authoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: window-panel-authoring
Source: https://github.com/armanisadeghi/ai-matrx/tree/main/.cursor/skills/window-panel-authoring
Command: npx skills add https://github.com/armanisadeghi/ai-matrx --skill window-panel-authoring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a complete pattern to author and manage floating window panels in the matrx-admin system. It covers the full 5-step registration flow (registry → component → OverlayController → SidebarWindowToggle → optional URL hydrator), the Supabase window_sessions persistence contract, onCollectData patterns, ephemeral vs persisted windows, sidebar/footer layout rules, and the multi-window pattern. Use when creating a new window panel, editing an existing window component, adding persistence to a window, wiring a window into the Tools grid, or debugging why a window fails to restore after page reload.

Core Features & Use Cases

  • Registration workflow: register in windowRegistry.ts with slug, overlayId, label, and defaultData; create a window component file under windows/; ensure id stability and overlayId alignment.
  • Overlay wiring: mount the window via OverlayController.tsx with dynamic imports and selector hooks; ensure open state and data restoration match registry configuration.
  • Tools integration: add the window to the Tools grid via SidebarWindowToggle.tsx and provide a consistent action to open the overlay.
  • Persistence contract: rely on WindowPanel persistence to store geometry automatically and save window state via onCollectData for JSON-serializable data; support ephemeral vs persisted behavior.
  • URL hydration (optional): enable deep-linking to reopen specific windows with initial data via a hydrator.

Quick Start

Register the new window in windowRegistry.ts, implement its window component, wire it into OverlayController.tsx, add it to SidebarWindowToggle.tsx, and optionally enable URL hydration.

Modifying an Existing Window

When changing a window’s content state, update the registry defaultData, adjust onCollectData, propagate new initial props, and modify OverlayController data destructuring as needed.

Persistence Contract

WindowPanel handles automatic geometry persistence when overlayId is set; the child provides content via onCollectData, which must be JSON-serializable and align with the registry’s defaultData shape.

Ephemeral Windows

Use ephemeral: true for non-persistent/debug windows; such windows do not persist state or restore on reload.

Sidebar Layout Rules

Follow the standard root and content structure for a responsive, scrollable Tools sidebar; ensure proper flex layout and avoid overflow handling at the root level.

Common Mistakes

  • Mismatched overlayId and registry overlayId breaks save/restore behavior.
  • onCollectData returns stale data; include all keys defined in defaultData.
  • Missing dynamic import or render block prevents the window from appearing.
  • Missing registry entry disables persistence and the Save button.

Additional Resources

  • Full prop reference and all registered windows: features/window-panels/README.md
  • Registry source of truth: features/window-panels/registry/windowRegistry.ts
  • Persistence service: features/window-panels/service/windowPersistenceService.ts
  • Context provider: features/window-panels/WindowPersistenceManager.tsx

Frequently Asked Questions about window-panel-authoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create floating window panels in React that persist state across page reloads?

Floating window panels with persistent state require a registry-driven workflow with a stable ID, matching overlayId, and an onCollectData contract to save JSON-serializable data via Supabase window_sessions. This ensures geometry and content restore correctly on reload.

What steps are needed to register a new floating window in an overlay controller?

Register the window in your windowRegistry.ts with slug, overlayId, label, and defaultData; create a window component file; wire it into OverlayController.tsx using dynamic imports and selector hooks; and add a toggle to SidebarWindowToggle.tsx.

Why does my floating window fail to restore its data after a page refresh?

Window restore failures often stem from a mismatched overlayId and registry overlayId, stale onCollectData returns, or a missing registry entry. Ensure onCollectData includes all keys defined in defaultData and that the overlayId matches exactly.

Can I create temporary floating windows that do not save state or restore on reload?

Yes, you can use ephemeral windows by setting ephemeral: true in the registry configuration. Ephemeral windows bypass the persistence contract entirely, skipping state saving and restoration on page reloads for debugging or non-persistent scenarios.

Does the window panel persistence contract automatically save panel geometry?

Yes, WindowPanel handles automatic geometry persistence when overlayId is set. The child component provides content state via the onCollectData callback, which must return JSON-serializable data aligning with the registry's defaultData shape.

How do I enable deep-linking to reopen specific floating windows with initial data?

You can enable deep-linking by implementing an optional URL hydrator. This supports reopening specific windows with initial data passed through the URL, streamlining direct access to configured window panel states.