@daydreamui/has-lab 0.0.0-stage → 0.3.0

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,48 @@
1
- # Temporary Holding Version
1
+ # :has lab
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Needs plugin API 3.0.
4
+
5
+ A Daydream plugin for exploring real CSS relationships on the canvas. It uses the existing plugin API; no new kernel API, state simulation, or network services.
6
+
7
+ ## Try it
8
+
9
+ 1. Open **:has lab** and select an element in a page, or choose **Add playground page** in either mode.
10
+ 2. Under **Explore rules**, choose a rule. The panel separates the element carrying `:has()`, the condition it checks, and the element the rule targets. Only the selected relationship is drawn on the canvas.
11
+ 3. Move the pointer over the page, hold Option, and interact with the actual controls. The panel follows their state. Release Option to see the canvas labels again.
12
+ 4. Try the playground's ticket checkboxes, next-sibling hover, and email validation. For validation, enter an invalid email, then correct it. No form is submitted.
13
+ 5. Use **Select styled element** to select the recipient for further editing. **Declarations** shows the rule's source and declarations.
14
+
15
+ The match count describes the `:has()` condition on its candidate elements. It does not claim that declarations win the cascade or that enclosing stylesheet media conditions are active.
16
+
17
+ ## Create a rule
18
+
19
+ The secondary **Create a rule** tab retains the selection-driven recipe builder. Choose a condition, edit declarations, and use **Try on canvas**. This writes the real stylesheet immediately. **Revert trial** restores it; **Keep rule** commits one undoable edit. Other edits may interrupt and commit a trial; Daydream Undo remains available.
20
+
21
+ Minimizing the panel reverts a live trial and stops the lens. Playground creation and trials cannot run together.
22
+
23
+ The panel names the unconditional writable sheet being edited and warns when other pages link it. Page rewrites can reset browser input state, so interact again after starting a trial.
24
+
25
+ ## Supported relationships
26
+
27
+ - The explainer supports one `:has()` on a simple tag/class/id selector, a simple descendant/child/following-sibling condition, and an optional descendant/child recipient. It recognizes checked, hover, focus, validity, placeholder, and integer child-count conditions.
28
+ - Complex selectors and rules inside nesting or conditional groups remain visible with an explicit explanation of the limitation. This is a bounded explainer, not a general CSS parser.
29
+ - Both modes outline one carrier, up to three condition elements, and four recipients. At most 200 carriers are checked and offered in the picker; larger sets show a sampling notice and counts for that sample. Narrow the rule to inspect other elements.
30
+ - Daydream hides plugin overlays while browsing. Hover/focus may end on returning to the panel; the plugin does not pin them.
31
+ - Viewports without rendered node access show a limitation instead of an empty analysis.
32
+ - Carrier picks are stored as source selectors and expire on markup edits, so an old list position cannot silently select another element.
33
+ - Independent variant pages use the same controls as other pages. The creator adds rules rather than editing or deduplicating existing rules.
34
+
35
+ ## Build and install
36
+
37
+ From the repository root, with Node 24:
38
+
39
+ ```sh
40
+ pnpm install
41
+ pnpm typecheck
42
+ pnpm test:kernel /path/to/daydream plugins/daydream.has-lab
43
+ pnpm ship plugins/daydream.has-lab --enable
44
+ ```
45
+
46
+ Rebuild and reinstall after changes so Daydream trusts the new bundle. Permissions remain canvas reading and project-page editing.
47
+
48
+ Node unit tests cover the bounded selector grammar, candidate derivation, source preservation and rule collection. Browser tests mount the real Daydream shell and cover selector shapes, native control state, sibling hover, disclosure changes, form reset, selection and remounts, project changes, stylesheet conditions, and trial cancellation/commit/undo. The plugin uses API 3.0 and the same browser implementation on desktop and in the browser app. No native bridge or additional kernel API is required.