@antone-io/render-picker 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/antone-io/render-picker/master/.github/logo.svg" alt="render-picker" width="96" height="96">
3
+ </p>
4
+
1
5
  # render-picker
2
6
 
3
7
  Dev-only toolkit for **Next.js + React 19** — and **PrestaShop / Smarty (`.tpl`)**: click any element
@@ -85,6 +89,7 @@ export function DevRenderPicker() {
85
89
  | `Esc` | Cancel |
86
90
  | `Alt`+click (picker off) | Open the element's source in your editor (see **Editor** below) |
87
91
  | `Ctrl`+click (picker **armed**) | Jump to the usage site |
92
+ | Drag a grip (six dots) | Move a floating surface: the aim button, the bottom bar, the search box. A dashed outline shows the original spot: drop the surface on it to send it back. The inspection panel moves freely by its header (no dashed outline, no snap back). Each position is saved in `localStorage` (`renderPicker.pos.<id>`) and kept inside the window |
88
93
 
89
94
  ### Right-click menu — "Copier le rendu" (self-contained HTML)
90
95
 
@@ -164,19 +169,36 @@ keyboard keys **Confirm** (default `Enter`) and **Cancel** (default `Esc`), plus
164
169
  the dropdown; it stays configurable in `render-picker.config.json`. Search opens an element finder: type a tag (`div`), a class (`.card`), a
165
170
  CSS selector or a React component name (`Button`, only where the npm annotator runs); partial
166
171
  typing autocompletes (`div.` lists the divs, `div.car` matches classes starting with `car`) and
167
- `Ctrl+Z`/`Ctrl+Y` walk the query history. Results
168
- group into suggestions (selector + occurrence count); hovering a suggestion (mouse) shows ONLY
169
- its occurrences as net rects, while keyboard selection keeps every match visible with the
170
- current occurrence highlighted — the ‹ › arrows (or ↑/↓) cycle WITHIN the active suggestion's
171
- elements on the page (scroll at each step), the suggestion line itself only changes by mouse
172
- hover — live rects (follows scroll/resize); the
173
- inspector's own hover rect is paused while searching. Hovering a search rect then shows the element
174
- tooltip (component, metrics, dimensions), clicking one copies the enriched snippet (pick),
175
- right-clicking one opens the context menu; the ‹ › arrow buttons (or ↑/↓, or hovering a row) switch the
176
- active element, clicking a row refines the query (tag + classes back into the input), `Enter`
177
- scrolls to it. The
178
- SettingsBar also hosts a magnifier icon next to the gear (npm package and Chrome extension).
179
- `Esc` always disarms as a safety net.
172
+ `Ctrl+Z`/`Ctrl+Y` walk the query history. Search is one compact box: the input row holds the
173
+ counter (`3/12`, `0` when nothing matches) and the ‹ › arrows; below it, results group into
174
+ suggestions (selector + occurrence count), shown only when the query matches. `↑`/`↓` move
175
+ from one suggestion to the next (the list scrolls to keep it visible); the counter shows the
176
+ current element of the active suggestion (`1/2` = first of its 2 elements). The ‹ › arrows cycle
177
+ through those elements; `Enter` scrolls to the current one, and each further `Enter` goes to the
178
+ next one (`Shift+Enter`: previous). Only the active suggestion's occurrences are highlighted
179
+ (hovered row with the mouse, otherwise the keyboard selection), the current one net (live
180
+ rects, follows scroll/resize). The inspector's hover rect stays live while searching: it glides to
181
+ the deepest element under the pointer, through the search rects, with its tooltip (component,
182
+ metrics, dimensions). Every click targets that same element. Right-clicking a search rect opens
183
+ the context menu. While search is open, a plain left click on a page element (or on a search
184
+ rect) puts its classes in the query as a selector (`.card.b`, Tailwind tokens escaped; the tag
185
+ name when it has no class): the link or button does not fire, search stays open and `Ctrl+Z`
186
+ restores the previous query. A right click or a click with a modifier outside the search box
187
+ closes it; `Ctrl`/`Alt`+click on a rect still opens the editor. Clicking a suggestion row
188
+ scrolls the page to its element without touching the query; each further click goes to the
189
+ next element of that suggestion. Each row has a `⋯` button on the right (shown on the hovered
190
+ or active row, reachable with `Tab`); it opens an actions menu, and so does a right click on
191
+ the row (at the cursor). The menu targets the current element of that suggestion (its first
192
+ one if the row was not active), makes the row active and highlights the element without
193
+ scrolling: *Copy context* (same block as a pick: route, XPath, CSS, text, source, React
194
+ component), *Copy context of all (N)* (only when the suggestion has several elements, multi
195
+ selection format), *Copy text*, *Copy selector* (the suggestion selector, e.g. `div.card.b`),
196
+ *Copy HTML*, *Copy render*, *Copy classes*, *Copy XPath*, and *Open in editor* (only when the
197
+ element has a source and the npm click-to-source is active; not in the extension). Labels are in
198
+ French in the UI. A copy shows the toast, closes the menu and keeps search open. `Esc` closes
199
+ the menu first, a second `Esc` closes search. The
200
+ SettingsBar also hosts a magnifier icon next to the gear (npm package and browser extension, Chrome and Firefox).
201
+ `Esc` always disarms as a safety net (after closing an open context menu).
180
202
 
181
203
  Choices are saved to `localStorage` by default. To persist them to a committable
182
204
  **`render-picker.config.json`** at the project root, add a dev API route (one line) — changes then
@@ -264,7 +286,9 @@ That's it — open any front-office page, arm the picker (double-tap **Shift**),
264
286
  **Ctrl+click** opens its `.tpl` at the right line in your editor. The module auto-injects the script,
265
287
  the project root and `RenderPicker.init()`; it is fully inert when `_PS_MODE_DEV_` is off.
266
288
 
267
- Settings menu also has a **"Rectangles modules PrestaShop"** toggle: permanent rectangles over each
289
+ On a PrestaShop page only (detected from the theme's `window.prestashop` object, the module's
290
+ `window.renderPickerAdminDir` or its `rp-module` / `rp@` markers), the settings menu also has a
291
+ **"Rectangles modules PrestaShop"** toggle: permanent rectangles over each
268
292
  root module (name + render duration), right-click → **Modules** submenu to copy its name, relative/
269
293
  absolute folder path, back-office config URL, or the whole page's module tree as Markdown. Details
270
294
  (incl. the extra `PS_ADMIN_DIRNAME` env var for the config-URL link) in
@@ -6,7 +6,7 @@ import {
6
6
  initSettingsRefresh,
7
7
  initTplAnnotator,
8
8
  startCapture
9
- } from "./chunk-2N6FOIM5.js";
9
+ } from "./chunk-XUPSSH7J.js";
10
10
 
11
11
  // src/core/dev/console-hush.ts
12
12
  var DEFAULT_HUSH_RULES = [
@@ -102,4 +102,4 @@ export {
102
102
  hushConsoleNoise,
103
103
  initRenderPicker
104
104
  };
105
- //# sourceMappingURL=chunk-WUA7VWEU.js.map
105
+ //# sourceMappingURL=chunk-FM3HLV7V.js.map