@panphora/hyper-cms 0.12.0 → 0.13.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
@@ -105,9 +105,9 @@ A page declares which editor it opens in, on its rules tag:
105
105
  ```
106
106
 
107
107
  `inline` edits text where it sits on the page and opens small popovers for everything else.
108
- `sidebar` (also what you get with no attribute) opens the form in a side panel. The floating
109
- toggle opens and closes whichever view the page declares; it does not switch between them.
110
- `cms.open({ view: 'inline' })` still overrides the declaration for one session.
108
+ `sidebar` (also what you get with no attribute) opens the form in a side panel. `cms.open()`
109
+ opens whichever view the page declares, and `cms.open({ view: 'inline' })` overrides the
110
+ declaration for one session.
111
111
 
112
112
  ## Field controls
113
113
 
@@ -458,40 +458,13 @@ Common errors thrown by the engine:
458
458
 
459
459
  In hyperclayjs apps, drag works out of the box (hypercms's object-array templates carry the `[sortable]` custom-attribute, which hyperclayjs upgrades). For standalone use, install `sortablejs` and either upgrade the `[sortable]` attribute yourself or replace the template with your own reorder UX. Add/remove still work without sortable.
460
460
 
461
- ## The floating toggle
461
+ ## Opening the CMS
462
462
 
463
- On a page that has a cms rules tag, hypercms injects a floating "Edit content"
464
- button in the bottom-right corner: in edit mode, and on a ClayJS page whenever
465
- ClayJS lets the visitor edit (in view too), where pressing it switches to edit
466
- and then opens the CMS. It is runtime-only chrome: it
467
- carries `no-save`, `snapshot-remove` and `save-ignore`, so it never reaches the
468
- saved file and never marks the page dirty.
463
+ Hypercms adds no button of its own. Call `cms.open()` from a control on your page:
469
464
 
470
- It takes the page's font, ink and letterforms by inheritance. The pill's surface
471
- is opaque and neutral, picked between two values by whichever reads better
472
- against the page's own ink, because the button floats over a backdrop it cannot
473
- see and a translucent surface is unreadable on a dark hero or footer.
465
+ <button onclick="hypercms.cms.open()">Edit</button>
474
466
 
475
- Restyle it with plain CSS. Our cosmetic rules are selected by
476
- `[data-hcms-toggle-host]`, so any `#hcms-toggle { ... }` rule of yours outranks
477
- them:
478
-
479
- #hcms-toggle .hcms-toggle__main { border-radius: 6px; box-shadow: none; }
480
-
481
- Five properties are not reachable that way. `position`, `right`, `bottom`,
482
- `z-index` and `background` are pinned inline with `!important`, so that a host
483
- page's `* { ... !important }` reset cannot leave the button unpositioned or
484
- transparent. `position` is always `fixed`. The other four read a custom
485
- property first, and that is how you change them:
486
-
487
- | property | default | what it does |
488
- |---|---|---|
489
- | `--hcms-toggle-color` | the page's ink | label and focus ring; a plain `#hcms-toggle` rule reaches these too |
490
- | `--hcms-toggle-bg` | the picked surface | the pill's surface; setting it turns off the automatic pick |
491
- | `--hcms-toggle-offset` | `16px` | distance from the corner; it adds to the sidebar shift rather than replacing it |
492
- | `--hcms-toggle-z` | `2147482900` | raise it if a chat widget or cookie banner covers the button |
493
-
494
- :root { --hcms-toggle-offset: 76px; } /* clear a chat widget */
467
+ On a ClayJS page, `?plugins=cms` brings ClayJS's menu, which offers "Open the CMS" to anyone who can edit, when `cms.hasRules()` says the page declares rules. Add `exclude=menu` and open it yourself if you do not want the menu.
495
468
 
496
469
  ## Build, develop, test
497
470