@bettercms-ai/convert 0.26.1 → 0.27.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/CHANGELOG.md +11 -0
- package/README.md +40 -0
- package/dist/cli.js +3339 -3017
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +110 -3
- package/dist/index.js +3297 -3028
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @bettercms-ai/convert
|
|
2
2
|
|
|
3
|
+
## 0.27.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a69e514: Page-field styles (C3/C9) on converted sites. Helper v15 adds `bcmsStyle(page, path)` (a style object, JSX) and `bcmsStyleText(page, path)` (a CSS string, Astro): `fieldStyleToCss` inlined, reading the page's `fieldStyles` — from the published `pages[]` row in `BCMS_CONTENT_FILE` on a server BetterCMS hosts, from the snapshot at build — and nothing (no `style` attribute) for an unstyled field. v14 is recognised, so a BetterCMS build swaps it for v15. A conversion now gives every element it stamps `data-bcms-field` on `data-bcms-style=""` and `style={bcmsStyleText(…)}` / `style={bcmsStyle(…)}` (a repeater row with its own template address), so the editor offers that element's width, spacing, Align, Size and Weight controls; an element with its own `style` or a spread is left alone and noted as `FIELD_STYLE_SKIPPED`. `--upgrade-element-styles [--dry-run]` does the same to a site converted before, with the helper upgrade, and receipts each element as upgraded, already marked or skipped with its reason.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [9ea579c]
|
|
12
|
+
- @bettercms-ai/types@1.37.0
|
|
13
|
+
|
|
3
14
|
## 0.26.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -640,6 +640,46 @@ className or existing style token changes (`--verify-styles` stays clean), and a
|
|
|
640
640
|
nothing and counts every root it marked as `alreadyMarked`. `--strict` exits 2 while any root is
|
|
641
641
|
skipped.
|
|
642
642
|
|
|
643
|
+
### Element style handles on a field (`--upgrade-element-styles`)
|
|
644
|
+
|
|
645
|
+
A page field's own width, spacing, Align, Size and Weight (C3, `pages.fieldStyles` keyed by the
|
|
646
|
+
`data-bcms-field` address) are offered only on an element that also carries `data-bcms-style` —
|
|
647
|
+
the site's promise that its inline style is `fieldStyleToCss(page.fieldStyles[path])`. Helper v15
|
|
648
|
+
reads them: `bcmsStyleText(page, path)` (a CSS string, for Astro) and `bcmsStyle(page, path)` (an
|
|
649
|
+
object, for JSX), from the published page row in `BCMS_CONTENT_FILE` on a server BetterCMS hosts and
|
|
650
|
+
from the snapshot at build. No style stored: `undefined`, so no `style` attribute at all.
|
|
651
|
+
|
|
652
|
+
A conversion from 0.27 on marks each element it stamps (text, richtext, image, the text of a
|
|
653
|
+
link) — a repeater row with its own template address:
|
|
654
|
+
|
|
655
|
+
```astro
|
|
656
|
+
<h1 class="type-hero" data-bcms-field="shell-h1-x" data-bcms-kind="text" data-bcms-style="" style={bcmsStyleText(bcmsHome, "shell-h1-x")}>…</h1>
|
|
657
|
+
<h3 data-bcms-field={`g[${index}].h3-x`} data-bcms-kind="text" data-bcms-style="" style={bcmsStyleText(bcmsHome, `g[${index}].h3-x`)}>…</h3>
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
A site converted before that takes the same marks in one run, with the helper upgraded alongside
|
|
661
|
+
(a BetterCMS build also swaps an older helper of ours for v15 in its own checkout):
|
|
662
|
+
|
|
663
|
+
```bash
|
|
664
|
+
npx @bettercms-ai/convert@latest --upgrade-element-styles --root . --dry-run # read the plan
|
|
665
|
+
npx @bettercms-ai/convert@latest --upgrade-element-styles --root . # then push and release
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
Always the helper form, never the SDK's `{...fieldAttrs(…)}` spread: the spread would hide the
|
|
669
|
+
literal `data-bcms-field` every reader of a converted file finds by its bytes, and only the helper
|
|
670
|
+
follows a publish on a hosted server. Left alone, and listed as `skipped` with a reason:
|
|
671
|
+
`OWN_STYLE`, `SPREAD`, `NOT_AN_ELEMENT` (a component other than `astro:assets`' `Image`/`Picture`
|
|
672
|
+
or `next/image`), `LAYOUT_FIELD` (the chrome is not a page's), `COMPONENT_INSTANCE` (an
|
|
673
|
+
`__overrides` address), `PATH_UNRESOLVABLE` (a computed address), `KIND` (not text, richtext or
|
|
674
|
+
image), `NO_SNAPSHOT` (no page snapshot imported, or several and the element reads none),
|
|
675
|
+
`NAME_TAKEN`, `DIALECT_UNSUPPORTED` (html, vue, svelte), `PARSE_ERROR`. A conversion lists the
|
|
676
|
+
elements it stamped and could not mark as `FIELD_STYLE_SKIPPED` notes.
|
|
677
|
+
|
|
678
|
+
The receipt (`--receipt <file>`) is `{ helpers, fields: { upgraded, alreadyMarked, skipped } }`,
|
|
679
|
+
each element as `{ file, line, tag, field, form | reason + message }` (`field` is the attribute as
|
|
680
|
+
written). `--verify-styles` stays clean — an expression style is no token — a second run writes
|
|
681
|
+
nothing, and `--strict` exits 2 while any element is skipped.
|
|
682
|
+
|
|
643
683
|
## Forms
|
|
644
684
|
|
|
645
685
|
The third mode, and the shortest. The release-time derive lane reads every `<form>` in the built
|