@fluid-app/fluid-cli-theme-dev 0.1.211 → 0.1.212

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.
@@ -8,6 +8,7 @@
8
8
  - Sections are wrapped for you
9
9
  - Correct usage
10
10
  - Findings to surface
11
+ - Detecting the editor
11
12
  - Examples from the reference theme
12
13
  - Quick audit
13
14
 
@@ -86,6 +87,21 @@ When a block's content is fully delegated to a component, the standard pattern i
86
87
  | Hardcoded editor attributes (`data-fluid-section-block-id`, `data-fluid-section="{{ section.id }}"`) instead of the helper | `blocker` | Remove them. Use `{{ block.fluid_attributes }}` for blocks; sections are wrapped automatically. Hand-rolling drops most of the set. |
87
88
  | Block-aware component (renders inside `{% for block %}`) has no `attr` parameter to receive `block.fluid_attributes` | `should` | Add an `attr` argument to the component's signature and apply it on the component's root element. |
88
89
  | Conditional render without protecting against `nil`: `<div {{ header_block.fluid_attributes }}>` where the block may be absent | `should` (rarely `blocker`) | Wrap: `{% if header_block %}{{ header_block.fluid_attributes }}{% endif %}`. Only relevant where the value can legitimately be nil. |
90
+ | Liquid or JS decides it is in the editor from `block.fluid_attributes` being blank or set, or from `[data-fluid-section-block-id]` in the page | `blocker` | Use `request.design_mode`. See [Detecting the editor](#detecting-the-editor). |
91
+
92
+ ### Detecting the editor
93
+
94
+ When a theme must behave differently in the visual editor, branch on `request.design_mode`. It is `true` in editor renders and `false` on the live site. Typical uses: keeping a locked or `inert` grid clickable so blocks can be selected, or showing an editor-only helper.
95
+
96
+ ```liquid
97
+ {%- unless request.design_mode -%}
98
+ <div class="kits__veil">Choose an enrollment pack first</div>
99
+ {%- endunless -%}
100
+ ```
101
+
102
+ For theme JavaScript, render the flag into the page, for example `<body {% if request.design_mode %}data-design-mode{% endif %}>`, and read that.
103
+
104
+ Never infer the editor from `block.fluid_attributes` being blank or set, or from editor attributes such as `[data-fluid-section-block-id]`. Those describe what the editor needs in the markup, not which render this is.
89
105
 
90
106
  ### Examples from the reference theme
91
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-app/fluid-cli-theme-dev",
3
- "version": "0.1.211",
3
+ "version": "0.1.212",
4
4
  "description": "Fluid CLI plugin for theme developer workflows — dev server, push, pull, init, crawl, compare",
5
5
  "files": [
6
6
  "dist",