mosaic-headless 1.33.3 → 1.34.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.ja.md +2 -2
- package/README.ko.md +2 -2
- package/README.md +2 -2
- package/README.zh-TW.md +2 -2
- package/SKILL.md +61 -26
- package/assets/templates/platforms/claude-ai.json +2 -2
- package/assets/templates/platforms/claude-code.json +2 -2
- package/assets/templates/platforms/codex-cli.json +2 -2
- package/assets/templates/platforms/continue.json +1 -1
- package/assets/templates/platforms/copilot.json +2 -2
- package/assets/templates/platforms/cursor.json +1 -1
- package/assets/templates/platforms/gemini-cli.json +2 -2
- package/data/node-property-verification.csv +1 -1
- package/data/node-type-notes.csv +2 -2
- package/data/style-properties.csv +3 -0
- package/data/style-states.csv +3 -0
- package/data/style-verification.csv +3 -0
- package/package.json +1 -1
- package/references/data-model.md +8 -1
- package/references/design-system.md +51 -9
- package/references/dialog-and-triggers.md +4 -3
- package/references/dynamic-content.md +17 -0
- package/references/interactions.md +34 -6
- package/references/placement.md +64 -3
- package/references/responsive.md +26 -10
- package/references/slider.md +17 -3
- package/references/styling.md +55 -5
- package/references/templates-and-conditions.md +51 -2
- package/references/upgrading.md +25 -1
- package/references/vs-elementor-gutenberg.md +7 -5
- package/references/write-protocol.md +11 -0
- package/scripts/check-release.mjs +1 -1
- package/tools/build_page.py +1 -1
- package/tools/extract_style_properties.py +18 -3
- package/tools/mo.py +2 -2
|
@@ -103,6 +103,16 @@ rather than a message in a log.
|
|
|
103
103
|
The name separator is `/` (`TemplatingContextVariable::VARIABLE_SEPARATOR`), and the
|
|
104
104
|
namespace is everything before the first one.
|
|
105
105
|
|
|
106
|
+
**A container can bring its own post into scope.** `div` (and its Grid / Rows /
|
|
107
|
+
Columns / Container variants) carries `dynamicSources`, the editor's "Dynamic
|
|
108
|
+
sources": it resolves a post or term and gives that context to the children, so a
|
|
109
|
+
previous/next-post card is a div whose source is a Post variable filtered on the
|
|
110
|
+
current post's date. Those filters compare raw `wp_posts` values - "published date
|
|
111
|
+
GMT" against `@date('Y-m-d H:i:s', @VAR('post/publish_timestamp'))`, not a formatted
|
|
112
|
+
date. Read from source and the official docs, not measured here; read a row the
|
|
113
|
+
editor wrote before hand-building one. Custom metadata keys starting with `_` are not
|
|
114
|
+
offered as variables.
|
|
115
|
+
|
|
106
116
|
## The functions
|
|
107
117
|
|
|
108
118
|
`data/evaluator-functions.csv` — 19 of them with their arity:
|
|
@@ -118,6 +128,13 @@ attachment(2) find_image(2) find_link(2) find_video(2) media
|
|
|
118
128
|
|
|
119
129
|
`sum`, `avg`, `concat` and `fallback` are variadic.
|
|
120
130
|
|
|
131
|
+
**Write the ids with their underscores.** The official docs spell them `@FINDIMAGE(…)`
|
|
132
|
+
and `@REMOVEHTML(…)`; the evaluator only lowercases the name, so those look up
|
|
133
|
+
`findimage` / `removehtml`, which do not exist, and an unknown function evaluates to
|
|
134
|
+
`''` with no error (`EvaluatorFunctions.php`, `Evaluator.php`). `@find_image(…)`,
|
|
135
|
+
`@remove_html(…)`, `@find_link(…)` work. `VAR`, `VAR_RAW` and `LOOP` themselves are
|
|
136
|
+
matched case-sensitively.
|
|
137
|
+
|
|
121
138
|
**`@concat` drops any argument that evaluates to `'0'`** (and `''`). Each argument is
|
|
122
139
|
`strval()`-ed and appended only `if ($item)` (`EvaluatorFunctionConcat.php`), and
|
|
123
140
|
`'0'` is the one non-empty string PHP calls false. So a number that can be zero must
|
|
@@ -178,15 +178,37 @@ All eight shapes above were committed and read back from the delivered page;
|
|
|
178
178
|
|
|
179
179
|
## The surface, extracted
|
|
180
180
|
|
|
181
|
-
`data/interaction-types.csv` —
|
|
181
|
+
`data/interaction-types.csv` — 16 trigger types in two families:
|
|
182
182
|
|
|
183
183
|
| family | how it runs | types |
|
|
184
184
|
|---|---|---|
|
|
185
|
-
| `timed` | its own clock, fired by an event | `pageLoad`, `click`, `hover`, `formSubmit`, `tabChange`, `slideChange`, `dropdownChange`, `accordionItemChange`, `elementScrollIntoView`, `scrollDirectionChange` |
|
|
185
|
+
| `timed` | its own clock, fired by an event | `pageLoad`, `click`, `hover`, `formSubmit`, `tabChange`, `slideChange`, `dropdownChange`, `accordionItemChange`, `elementScrollIntoView`, `scrollDirectionChange`, `exitIntent`, `scrollDepth`, `modal`, `popover` |
|
|
186
186
|
| `progress` | driven by a scalar, scrubbable both ways | `scrollIntoView`, `pointerMove` |
|
|
187
187
|
|
|
188
|
+
**The editor's names are swapped against the ids.** The editor's "Scroll into view"
|
|
189
|
+
(fire once when the element enters) is `elementScrollIntoView`; its "While scrolling"
|
|
190
|
+
(scrub with scroll position) is `scrollIntoView`. In `elementScrollIntoView`,
|
|
191
|
+
`scrollIntoView` and `pointerMove`, the trigger must not be the target or inside it.
|
|
192
|
+
|
|
193
|
+
Trigger settings the official docs describe, with their keys
|
|
194
|
+
(`InteractionTypeData`, `TimedInteractionTypeOptionsDataSub`):
|
|
195
|
+
|
|
196
|
+
- `triggerOnce` `"0"|"1"` with `completedAfter` - only on types that support it;
|
|
197
|
+
`pageLoad` has none. `exitIntent` fires once and stops listening by itself.
|
|
198
|
+
- `outOfView` `"0"` keep running / `"1"` suspend / `"2"` reset, with
|
|
199
|
+
`outOfViewOffset` in vh.
|
|
200
|
+
- Timed types only: `isLoop` `"0"|"1"`, `startDelay` and `iterations` (integers ≥ 0).
|
|
201
|
+
- Slots: `click` has click / `odd` / `even`; `scrollDirectionChange` has `down` /
|
|
202
|
+
`up` (offsets in px); `elementScrollIntoView` has `in` / `out`; `modal` and
|
|
203
|
+
`popover` have show / `beforeClose` / `afterClose`, and a close waits for
|
|
204
|
+
`beforeClose` to finish. `scrollDepth`'s % is of the full scrollable height, and
|
|
205
|
+
`returned` only follows a `reached`.
|
|
206
|
+
- Targeting a component instance animates its children, not the instance itself.
|
|
207
|
+
- Tweens: the "initial value" applies only to the first tween; later ones are a
|
|
208
|
+
from → to pair, and one tween cannot hold the same property twice.
|
|
209
|
+
|
|
188
210
|
`data/animatable-properties.csv` — the 22 properties a keyframe can drive. **This is
|
|
189
|
-
not the same set as the
|
|
211
|
+
not the same set as the 101 style properties**, and ten of them animate through a CSS
|
|
190
212
|
custom property rather than the property itself:
|
|
191
213
|
|
|
192
214
|
```
|
|
@@ -199,6 +221,12 @@ Animating through `--mosaic-translate-y` rather than `translate` is why a Mosaic
|
|
|
199
221
|
interaction can move an element that already has a CSS `translate` set: the two
|
|
200
222
|
compose instead of one clobbering the other.
|
|
201
223
|
|
|
202
|
-
`data/pluggables.csv` lists the
|
|
203
|
-
`link`, `script`, `setCookie`, `player*`, `interaction*`
|
|
204
|
-
|
|
224
|
+
`data/pluggables.csv` lists the non-animation action types an interaction can run —
|
|
225
|
+
`link`, `script`, `setCookie`, `player*`, `interaction*` (suspend / resume / reset by
|
|
226
|
+
interaction ID), `remember` / `forget`, `modalOpen` / `modalClose`, `popoverOpen` /
|
|
227
|
+
`popoverClose` / `popoverToggle`, and `scrollTo` (Pro) - for triggering behaviour
|
|
228
|
+
rather than motion. A modal has no toggle. `modalClose` / `popoverClose` placed
|
|
229
|
+
inside the dialog they close need no target - the action resolves its own dialog.
|
|
230
|
+
`setCookie` writes a session cookie, gone when the browser closes. With a class as the
|
|
231
|
+
trigger and an empty target, the action hits the element that fired; a class used as
|
|
232
|
+
the TARGET hits every element carrying it on the page.
|
package/references/placement.md
CHANGED
|
@@ -174,11 +174,15 @@ navbar animation (none|fade|fadeDown|fadeUp|scaleDown|flipDown)
|
|
|
174
174
|
Measured: above `buttonBreakpoint` the links are shown and the toggle is hidden;
|
|
175
175
|
below it the host gains `dropdown-mode`, the links disappear, and clicking the
|
|
176
176
|
toggle adds `dropdown--opened` and reveals them. The breakpoint is named with the
|
|
177
|
-
same ids the style system uses (`_t`, `_m`).
|
|
177
|
+
same ids the style system uses (`_t`, `_m`). Unset, `buttonBreakpoint` is `_m` and
|
|
178
|
+
`animation` is `fade` (`NavbarElementMResource`). A navbar cannot sit inside a navbar.
|
|
178
179
|
|
|
179
180
|
**`icon` takes RAW SVG** in its `svg` property — not a URL, not an icon-library
|
|
180
|
-
name. `autoScale`
|
|
181
|
-
SVG
|
|
181
|
+
name. `autoScale` strips the SVG's own `width`/`height` attributes so it follows the
|
|
182
|
+
element's box - an SVG without them shows no difference. `currentColor` inside the
|
|
183
|
+
SVG picks up the node's `color`, but an SVG with no `fill`, `stroke` or colour
|
|
184
|
+
attribute anywhere gets `fill="black"` injected (`IconElementMResource`), so write
|
|
185
|
+
`fill="currentColor"` on a bare path yourself.
|
|
182
186
|
|
|
183
187
|
**`image.image` takes the attachment protocol**:
|
|
184
188
|
`wp-attachment://image/<id>/full/<uploads-relative path>`. The last segment is
|
|
@@ -191,3 +195,60 @@ WooCommerce's own markup, not a reimplementation — and **`wpContent.content`**
|
|
|
191
195
|
dropped and the block renders empty. Its default is `@VAR('post/content')`, which
|
|
192
196
|
is why the node usually sits inside a loop and needs nothing written at all, and
|
|
193
197
|
the property is gated on the `unfiltered_html` capability.
|
|
198
|
+
|
|
199
|
+
`code.content` is gated on `unfiltered_html` exactly like `wpContent`, and so is
|
|
200
|
+
`wpShortcode.shortcode` - a REST writer without the capability has the value dropped
|
|
201
|
+
without an error. An unset `code.content` renders "Hello World, Hello Mosaic".
|
|
202
|
+
|
|
203
|
+
## Per-element facts the official docs add (1.0.11)
|
|
204
|
+
|
|
205
|
+
Read from the Mosaic docs and confirmed in source unless marked; none of these is in
|
|
206
|
+
the sweep tables.
|
|
207
|
+
|
|
208
|
+
- **Default children the editor inserts** (headless builds get none of them unless
|
|
209
|
+
heal adds them): `accordion` - two `accordion-item`s, each a title (an H6 `text`
|
|
210
|
+
plus Plus and Minus `icon`s shown and hidden by `___accordion-item--opened`) and a
|
|
211
|
+
content paragraph; `menu` - two `menu-link`s; `tabs` - a `tabs-menu` with two tabs
|
|
212
|
+
("Tab 1", "Tab 2") and a `tabs-content` with two panes, and heal re-pairs a
|
|
213
|
+
missing tab or pane; `navbar` - `navbar-toggle` plus `navigation`; `slider` - one
|
|
214
|
+
slide. A `section` inserted in the editor arrives with a Container `div` inside;
|
|
215
|
+
`section` itself does not need one.
|
|
216
|
+
- **accordion**: `openMode` `single` (default) | `multiple` | `alwaysOpen` - the last
|
|
217
|
+
renders a bare `<dl>` with no `<mosaic-accordion>` and no script. `animation`
|
|
218
|
+
`none` (default when absent; the editor inserts `slide`) | `slide`, and Firefox
|
|
219
|
+
shows `slide` as none. `firstOpened:"1"` opens the first item, `requireOneOpen`
|
|
220
|
+
keeps one open.
|
|
221
|
+
- **form**: `submitType` is `action` (default) or `native`; the options sit in
|
|
222
|
+
`actionOptions {actions[], formName, entryName}` or `nativeOptions {url, target,
|
|
223
|
+
method get|post, encoding}`, and switching type deletes the other group. A native
|
|
224
|
+
submit skips server validation, the honeypot and CAPTCHA. The success screen
|
|
225
|
+
shows only for `action` with no redirect. With no error-message element, errors
|
|
226
|
+
appear in the browser's own bubble. Every label and legend is required; hide one
|
|
227
|
+
with the `screen-reader-only` class.
|
|
228
|
+
- **googlemaps**: prints NOTHING until Mosaic → Settings has a `googleMapsApiKey`, or
|
|
229
|
+
when `query` is empty. Properties are `query`, `zoom` (0-21, default 15),
|
|
230
|
+
`maptype`, `lazyLoad` (default on) - the docs' Language and Region settings are
|
|
231
|
+
not in 1.0.11. `query` and `zoom` take `{"v": …}`.
|
|
232
|
+
- **openstreetmap**: `lazyLoad` defaults on; one marker only; the
|
|
233
|
+
"© OpenStreetMap contributors" credit must stay visible.
|
|
234
|
+
- **list**: `<ol>` only with the Ordered variant, `<ul>` otherwise, and
|
|
235
|
+
`listType` / `listStart` are emitted only for Ordered. An empty list prints nothing.
|
|
236
|
+
- **loop**: records per page is `maxItems`, offset is `offset`; an empty
|
|
237
|
+
`paginationKey` defaults to the loop's own id. `loop-item` / `list-item` /
|
|
238
|
+
`accordion-item` `mode`: `item` (normal), `beforeMatch` / `afterMatch` (a static
|
|
239
|
+
item inserted before / after a matching one), `separator` (a fixed divider between
|
|
240
|
+
items). Pagination does not show when there is only one page.
|
|
241
|
+
- **modal**: `closedby` defaults to `everything`. There is no toggle action. Opening
|
|
242
|
+
a dialog nested in a closed modal or popover opens the outer one first. Focus is
|
|
243
|
+
trapped in the window, starts on its first field and returns to where it was on
|
|
244
|
+
close; the page behind becomes usable the moment closing starts. Several windows in
|
|
245
|
+
one modal overlap.
|
|
246
|
+
- **popover**: one that opens by itself (page load, exit intent, scroll depth) with
|
|
247
|
+
no anchor appears centred - give it an explicit anchor. Clicks on its opener, or
|
|
248
|
+
inside a popover opened from it, do not count as "outside".
|
|
249
|
+
- **video / vimeo / youtube**: `threshold` is the "into view offset" - the share
|
|
250
|
+
that must be visible; scrolled out, a playing video pauses and resumes on return.
|
|
251
|
+
Vimeo unlisted videos need the full link with its privacy hash; `startTime` is
|
|
252
|
+
mm:ss.
|
|
253
|
+
- **button**: Badge defaults to `inactive`; `attributes` with `on*`, `srcdoc` or
|
|
254
|
+
`formaction` names are refused for a writer without `unfiltered_html`.
|
package/references/responsive.md
CHANGED
|
@@ -4,13 +4,13 @@ Responsive in Mosaic is the **second axis of the style object**, not a separate
|
|
|
4
4
|
structure and not a naming convention:
|
|
5
5
|
|
|
6
6
|
```jsonc
|
|
7
|
-
"style": {
|
|
7
|
+
"style": {"states": {
|
|
8
8
|
"&": { // state
|
|
9
9
|
"_": {"paddingLeft": "48px"}, // base breakpoint
|
|
10
10
|
"_t": {"paddingLeft": "32px"}, // <=1079px
|
|
11
11
|
"_m": {"paddingLeft": "20px"} // <=767px
|
|
12
12
|
}
|
|
13
|
-
}
|
|
13
|
+
}}
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
`state → breakpoint → property`. Get the two middle levels the wrong way round and
|
|
@@ -32,6 +32,14 @@ Both are `direction: down`, so both match on a phone, and **`_m` is ordered afte
|
|
|
32
32
|
losing to it. Custom breakpoints get UUIDs instead of `_t`/`_m`; do not hardcode the
|
|
33
33
|
pair, read the table.
|
|
34
34
|
|
|
35
|
+
A row is not always `down`. `BreakpointMResourceData` declares `type` (`simple` |
|
|
36
|
+
`custom`, default simple), `width` (integer ≥ 1), `direction` (`up` | `down`,
|
|
37
|
+
default down), `query` (a custom row's media query, written without `@media`) and
|
|
38
|
+
`previewWidth` / `previewHeight`. An `up` row is a min-width breakpoint, so the
|
|
39
|
+
"later row overrides" reasoning above only holds among `down` rows - read
|
|
40
|
+
`direction` before assuming the cascade. Only the two healed `down` rows have been
|
|
41
|
+
measured here.
|
|
42
|
+
|
|
35
43
|
## What it compiles to
|
|
36
44
|
|
|
37
45
|
One inline stylesheet per breakpoint, in the head, each wrapped in its own query:
|
|
@@ -73,16 +81,24 @@ Measured twice on the same page: a 3×2 hairline list that kept a column rule an
|
|
|
73
81
|
cell opened a row while still carrying the four-up rule. `tools/verify_rwd.py`
|
|
74
82
|
reports every one of these as `RESET-RISK`.
|
|
75
83
|
|
|
76
|
-
##
|
|
84
|
+
## Place a grid child with `gridChildPosition`, never its legs
|
|
85
|
+
|
|
86
|
+
`gridColumnStart`, `gridColumnEnd`, `gridRowStart` and `gridRowEnd` are in
|
|
87
|
+
`data/style-properties.csv` as members of the `gridChildPosition` group. Written as
|
|
88
|
+
loose keys they compile to nothing - 16 `gridColumnStart` declarations in a committed
|
|
89
|
+
spec, **zero** `grid-column` in the delivered CSS, no exception anywhere.
|
|
90
|
+
|
|
91
|
+
Written as the group they work. Measured on 1.0.11:
|
|
77
92
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
```jsonc
|
|
94
|
+
"gridChildPosition": {"gridColumnStart": "2", "gridColumnEnd": "4",
|
|
95
|
+
"gridRowStart": "1", "gridRowEnd": "3"}
|
|
96
|
+
// -> grid-column-start:2; grid-column-end:4; grid-row-start:1; grid-row-end:3
|
|
97
|
+
```
|
|
81
98
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
template — do not try to place the child.
|
|
99
|
+
All four keys are required non-empty strings (`ValidatorStyleGridChildPosition`) -
|
|
100
|
+
`"auto"` and `"span 2"` are strings too. This is the editor's Grid child →
|
|
101
|
+
Position → Manual.
|
|
86
102
|
|
|
87
103
|
## A row with more children than columns fills the gutter, not the width
|
|
88
104
|
|
package/references/slider.md
CHANGED
|
@@ -27,6 +27,10 @@ the way its factories require, every piece commits and renders.
|
|
|
27
27
|
{"type": "slider-arrow-right"}]}
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
`duration` is the TRANSITION in ms (default 1000, emitted as `data-duration` and
|
|
31
|
+
handed to the slide animation); `autoplayDelay` is how long a slide stays (default
|
|
32
|
+
2000). The official docs describe `duration` as the dwell time - it is not.
|
|
33
|
+
|
|
30
34
|
`animation` is `slide` | `crossFade` | `fadeOut` | `fadeOver`. `autoplayLimit` is how
|
|
31
35
|
many rounds autoplay runs before it stops, `0` meaning no limit.
|
|
32
36
|
|
|
@@ -78,6 +82,14 @@ A slide's own `attrID` lands on the inner `.m-slide-content`, not on the
|
|
|
78
82
|
| track | `<mosaic-slider-slides>` with `aria-live` — `off` while autoplaying, `polite` when it is not |
|
|
79
83
|
| reduced motion | **it holds still on its own.** Mosaic stops the autoplay; the author does not have to |
|
|
80
84
|
|
|
85
|
+
**Deep links work.** Give a slide - or anything inside one - an id and link to
|
|
86
|
+
`#that-id`: `Slider.js` listens to `hashchange`, jumps there without a transition,
|
|
87
|
+
scrolls it into view and lets autoplay continue from it. Tabs do the same
|
|
88
|
+
(`Tabs.js`), nested tabs open every level, and a slider in a tab or a tab in a slide
|
|
89
|
+
both resolve. A slider holds one slide at a time - several cards side by side live
|
|
90
|
+
inside one slide and stack rather than spread on a phone - so a responsive
|
|
91
|
+
multi-card carousel or a centred "showcase" slider is not buildable with it.
|
|
92
|
+
|
|
81
93
|
The carousel (`crossFade`, `isCarousel: "1"`, autoplay off) stayed on slide 0 for
|
|
82
94
|
2.6s unaided, which is the other half of the same claim: autoplay is the only thing
|
|
83
95
|
that moves a slider by itself.
|
|
@@ -97,9 +109,11 @@ both agree on.
|
|
|
97
109
|
|
|
98
110
|
## Two things the component does not draw for you
|
|
99
111
|
|
|
100
|
-
**An arrow has no glyph.** `<mosaic-slider-arrow-left>`
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
**An arrow has no glyph unless you give it one.** `<mosaic-slider-arrow-left>`
|
|
113
|
+
written with no children renders with empty `innerHTML` - its default children are
|
|
114
|
+
`[]`. It does take children (`canBeParentFor` returns `true`; placement `any` since
|
|
115
|
+
v1.33), so an `icon` node with an arrow SVG inside it is what the editor itself
|
|
116
|
+
inserts. Without one, the appearance is the author's CSS on the element. The
|
|
103
117
|
two-border chevron works and needs nothing else: a ~9px box showing only
|
|
104
118
|
`border-top` and `border-right`, turned with a `rotateZ` transform entry (`45deg`
|
|
105
119
|
for next, `-135deg` for prev).
|
package/references/styling.md
CHANGED
|
@@ -16,8 +16,9 @@ The commit is accepted, the row is stored, and the stylesheet simply has no such
|
|
|
16
16
|
declaration. Meanwhile every one of the 58 testable ungrouped properties compiled.
|
|
17
17
|
|
|
18
18
|
Use the grouped shape — `border` takes `{"width": "3px", "style": "dashed", "color":
|
|
19
|
-
"rgb(...)"}` and does compile
|
|
20
|
-
|
|
19
|
+
"rgb(...)"}` and does compile, and so does `gridChildPosition` with all four of its
|
|
20
|
+
keys (measured on 1.0.11; see `references/responsive.md`) — or drop to
|
|
21
|
+
`customDeclarations`.
|
|
21
22
|
|
|
22
23
|
`data/style-verification.csv` is per-property, with the group beside the result.
|
|
23
24
|
|
|
@@ -52,7 +53,9 @@ A node's `data.style` is addressed by three axes — **state, breakpoint, proper
|
|
|
52
53
|
`type` is `variant` | `variantSubClass` | `universalClass` | `universalSubClass` |
|
|
53
54
|
`local`; before 1.0.8 these keys were `elementClass`, `utilityClasses`,
|
|
54
55
|
`defaultClass` with type `custom`, and the upgrade rewrites stored rows) and
|
|
55
|
-
`localStates` alongside `states
|
|
56
|
+
`localStates` alongside `states`. The first three are the class layer; `localStates`
|
|
57
|
+
is the node's own custom states (SCSS selector with `&` for the element) - see
|
|
58
|
+
`references/design-system.md` → "Which class wins".
|
|
56
59
|
|
|
57
60
|
## What comes out
|
|
58
61
|
|
|
@@ -102,6 +105,40 @@ Also note `body{opacity:0}` in the base block — the theme reveals itself from
|
|
|
102
105
|
JavaScript. A page fetched without running scripts is fully styled but invisible;
|
|
103
106
|
screenshot tooling must let the JS run before capturing.
|
|
104
107
|
|
|
108
|
+
The reveal is an inline script in `Builder/Header.php`: on `DOMContentLoaded`, one
|
|
109
|
+
`requestAnimationFrame` later, `body.style.opacity = "1"`. `DOMContentLoaded` waits for
|
|
110
|
+
every `defer` script, so deferring jQuery or Mosaic's own frontend - the usual
|
|
111
|
+
render-blocking fix - keeps the whole page blank until they have run. On a slow phone
|
|
112
|
+
that is the FCP and LCP. Overriding it is safe: the stylesheet is in the document
|
|
113
|
+
before the body, so nothing paints unstyled.
|
|
114
|
+
|
|
115
|
+
```css
|
|
116
|
+
html body { opacity: 1 !important; }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Measured on a migrated clinic site, Lighthouse 13.5 mobile, median of 3, same day:
|
|
120
|
+
performance 72 → 86, LCP 4.8 s → 3.2 s, CLS still 0, and a frame-by-frame check found
|
|
121
|
+
no unstyled frame. TBT rose (42 → 154 ms) only because the scripts now run inside the
|
|
122
|
+
measured window.
|
|
123
|
+
|
|
124
|
+
**Mosaic shields that reveal script from optimizers it can detect.** `Html::script`
|
|
125
|
+
marks the reveal script, and enqueued handles flagged `mosaicCritical`, with an
|
|
126
|
+
opt-out attribute chosen by which optimizer's constant is defined
|
|
127
|
+
(`Helpers/Html.php`):
|
|
128
|
+
|
|
129
|
+
| constant defined | attribute added |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `LSCWP_V`, `WP_ROCKET_VERSION`, `FLYING_PRESS_VERSION`, `PERFMATTERS_VERSION` | `data-no-defer="1"` |
|
|
132
|
+
| `AUTOPTIMIZE_VERSION` | `data-no-optimize="1"` |
|
|
133
|
+
| `NITROPACK_VERSION` | `data-nitro-exclude="1"` |
|
|
134
|
+
| `MOSAIC_CLOUDFLARE_ROCKET_LOADER` (set it yourself in `wp-config.php`) | `data-cfasync="false"` |
|
|
135
|
+
|
|
136
|
+
Cloudflare Rocket Loader cannot be detected, so without that constant it delays the
|
|
137
|
+
reveal too. The official troubleshooting page also lists `data-no-delay`,
|
|
138
|
+
`data-no-async` and WP Rocket's `rocket_exclude_js` filter; none of them is in the
|
|
139
|
+
1.0.11 source. None of this helps a hand-added `defer` on other scripts, which still
|
|
140
|
+
holds `DOMContentLoaded` back - the override above is the fix for that.
|
|
141
|
+
|
|
105
142
|
## Setting values
|
|
106
143
|
|
|
107
144
|
The `factory` column in `data/style-properties.csv` tells you the value shape:
|
|
@@ -175,6 +212,17 @@ other type-switched groups too.
|
|
|
175
212
|
`ScaleTransformTypeFactory`, which takes separate axes. Use `scaleX`/`scaleY` instead,
|
|
176
213
|
which are `SingleTransformTypeFactory` and do take `{"value": …}`.
|
|
177
214
|
|
|
215
|
+
The standalone `scale` PROPERTY is a different thing and does compile:
|
|
216
|
+
`"scale": {"type": "scale", "scaleOptions": {"value": "1.37"}}` →
|
|
217
|
+
`--mosaic-scale:1.37; scale:1.37` (a `scale3D` type also exists, not measured). `perspective` takes a
|
|
218
|
+
plain length (`"731px"` → `perspective:731px`). Both measured on 1.0.11. The
|
|
219
|
+
`transform` list and the individual `translate` / `scale` / `rotate` properties
|
|
220
|
+
STACK - CSS applies both - in static styles as well as in interactions.
|
|
221
|
+
|
|
222
|
+
Two layout rules the official docs state: `position: sticky` does nothing without a
|
|
223
|
+
`top`, and a transform on the element or any ancestor breaks
|
|
224
|
+
`background-attachment: fixed`.
|
|
225
|
+
|
|
178
226
|
**The escape hatch.** `customDeclarations` (`customStyles` before 1.0.8; the upgrade
|
|
179
227
|
rewrites stored rows, and `build_page.py` still accepts the old spelling in a spec)
|
|
180
228
|
accepts raw CSS text and emits it verbatim into the rule:
|
|
@@ -189,8 +237,10 @@ down — at the cost of bypassing the collection-variable layer entirely.
|
|
|
189
237
|
|
|
190
238
|
## Properties that exist in CSS but not in Mosaic
|
|
191
239
|
|
|
192
|
-
`data/style-properties.csv` is the whole registry
|
|
193
|
-
|
|
240
|
+
`data/style-properties.csv` is the whole registry (101 rows since v1.34 - the
|
|
241
|
+
extractor used to miss single-quoted registrations, which hid `scale`, `perspective`
|
|
242
|
+
and `collectionModesData`), and the fastest way to lose an hour is to assume a
|
|
243
|
+
property is in it because CSS has it. Two that catch people,
|
|
194
244
|
both found by writing a page rather than by reading the table:
|
|
195
245
|
|
|
196
246
|
**`flexGrow` and `flexShrink` do not exist.** Mosaic models both as one
|
|
@@ -62,8 +62,26 @@ prune.
|
|
|
62
62
|
only resource type any template path registers is `post`
|
|
63
63
|
(`setResourceType('post')` in PathPostTypePage, PathPostTypePost and PathPostTypes).
|
|
64
64
|
`path/single-page.php` and `path/index.php` were both tried against the live
|
|
65
|
-
endpoint and both returned HTTP 500.
|
|
66
|
-
|
|
65
|
+
endpoint and both returned HTTP 500. So this endpoint has no catch-all; the catch-all
|
|
66
|
+
is the `assign:"auto"`, `path:"index.php"` row above (the editor's **Fallback → Empty**
|
|
67
|
+
template). Without one, a URL with no template of its own gets `status_header(406)`
|
|
68
|
+
and an empty body.
|
|
69
|
+
|
|
70
|
+
**Which auto template wins.** Candidates are ordered first by how specific the path
|
|
71
|
+
is, then by the row's `ordering` string (`ORDER BY FIELD(path, …) ASC, BINARY
|
|
72
|
+
ordering ASC`, `TemplatesRevisionModel`), and the first one whose conditions match is
|
|
73
|
+
used (`LocatedTemplateRenderMResourceManager`). Two auto templates on the same path -
|
|
74
|
+
say a conditioned single-post layout and the plain one - need the conditioned one to
|
|
75
|
+
carry the LOWER `ordering`, or the unconditioned one always wins. This is the
|
|
76
|
+
editor's drag-to-reorder. The editor's fallback types map to paths as Single →
|
|
77
|
+
`single.php`, Archive → `archive.php`, Homepage → `front-page.php`, Empty →
|
|
78
|
+
`index.php`. Masters order the same way: the first master by `ordering` is the one
|
|
79
|
+
a new template is offered by default.
|
|
80
|
+
|
|
81
|
+
**A template_assigns row with empty `parentID` and `parentType` binds nothing.** It is
|
|
82
|
+
what the editor writes for "Auto template" (`TemplateAssign` treats it as
|
|
83
|
+
auto-assigned and `Post::getAssignedTemplateID` skips it), so do not count it as a
|
|
84
|
+
manual binding.
|
|
67
85
|
|
|
68
86
|
**Manual assignment is a REST call, not a commit.** `POST /templateAssign/createManualTemplate`
|
|
69
87
|
with `resourceQuery=post/<postID>` and `masterID=<masterID>` creates the template row
|
|
@@ -167,6 +185,37 @@ necessarily work as an interaction gate.
|
|
|
167
185
|
Most subject settings fields carry `supportDynamic: true`, meaning the value itself
|
|
168
186
|
can be an `@` expression rather than a literal — see `references/dynamic-content.md`.
|
|
169
187
|
|
|
188
|
+
## Multilingual sites
|
|
189
|
+
|
|
190
|
+
Mosaic has no front-end translation of its own, and no condition subject for the
|
|
191
|
+
current language: the taxonomy subjects list only `public` taxonomies
|
|
192
|
+
(`ServerConditionSubjectTaxonomies`), Polylang's `language` taxonomy is not public,
|
|
193
|
+
and WPML does not use a taxonomy at all. There is no WPML or Polylang code anywhere in
|
|
194
|
+
the 1.0.11 plugin. What the official docs (Translation page) describe, and what the
|
|
195
|
+
data model supports:
|
|
196
|
+
|
|
197
|
+
- **Per-language copies of manual templates.** Each translation is its own post, so
|
|
198
|
+
bind it to its own template (`createManualTemplate`) holding the translated text.
|
|
199
|
+
Header and footer live on the master, so a translated header means a translated
|
|
200
|
+
master, used by that language's templates. Text inside templates does not reach
|
|
201
|
+
WPML String Translation.
|
|
202
|
+
- **Auto templates are shared by every language** - archive, search, 404, the
|
|
203
|
+
fallbacks. Keep their text in `@VAR` output or the post content, not literals.
|
|
204
|
+
- **Post content translates for free.** `wpContent` prints the editor content of the
|
|
205
|
+
current post, which the translation plugin already swapped, so a page whose words
|
|
206
|
+
live in the WordPress editor needs one template for all languages.
|
|
207
|
+
- **Loops follow the language.** WPML filters the query, so a `loop` lists only the
|
|
208
|
+
current language's posts; untranslated posts show only with WPML's "fallback to
|
|
209
|
+
default language" per post type.
|
|
210
|
+
- **Language switcher** goes in a `wpShortcode` (`[wpml_language_switcher]`); Polylang
|
|
211
|
+
ships no shortcode.
|
|
212
|
+
- TranslatePress (which translates the rendered page) is the plugin the Mosaic team
|
|
213
|
+
recommends; it needs none of the above.
|
|
214
|
+
|
|
215
|
+
`<html lang>` comes from `get_locale()` (`Common/SiteLanguage.php`), which the
|
|
216
|
+
translation plugins filter per request - not measured here. Bidi: RTL sites are
|
|
217
|
+
supported, but Tabs' arrow keys and Slider swiping are not mirrored on the front end.
|
|
218
|
+
|
|
170
219
|
## Verification status
|
|
171
220
|
|
|
172
221
|
The routing rules and the condition grammar above are read from source and from the
|
package/references/upgrading.md
CHANGED
|
@@ -11,6 +11,27 @@ Everything below was done to the test site this skill was built on - a real
|
|
|
11
11
|
the nineteen Elementor conversions and every probe master on it - and then
|
|
12
12
|
every sweep was re-run against the result.
|
|
13
13
|
|
|
14
|
+
## What the server must have, and moving a site
|
|
15
|
+
|
|
16
|
+
`SystemRequirements.php` refuses to run without PHP ≥ 8.2, WordPress ≥ 6.9 (the
|
|
17
|
+
official docs page still says 6.5; `defines.php` says 6.9), the `zip`, `dom` and
|
|
18
|
+
`curl` extensions, `gd` built WITH WebP, and a MySQL-family database - `DB_ENGINE`
|
|
19
|
+
sqlite is refused. The docs add fileinfo, MySQL 8 / MariaDB 10.6 and a 256M
|
|
20
|
+
`memory_limit`, which the plugin does not check itself. The folder must be
|
|
21
|
+
`wp-content/plugins/mosaic/`.
|
|
22
|
+
|
|
23
|
+
Mosaic writes to `uploads/mosaic/` - `tmp/` for imports and thumbnails, falling back
|
|
24
|
+
to `get_temp_dir()/mosaic/` (so `WP_TEMP_DIR`) only when uploads is not writable, and
|
|
25
|
+
`submissions/<id>/` for form uploads - each behind a deny `.htaccess`. Copy that
|
|
26
|
+
folder when moving a site. Uninstalling drops the tables and deletes it.
|
|
27
|
+
|
|
28
|
+
Moving to a new domain with a search-and-replace: node `data` is stored with
|
|
29
|
+
`json_encode` and no `JSON_UNESCAPED_SLASHES`, so an absolute URL sits in the table as
|
|
30
|
+
`https:\/\/old.example`, and a replace for `https://old.example` misses it (read from
|
|
31
|
+
source, not measured). `wp-attachment://` image paths carry no domain and need
|
|
32
|
+
nothing. The licence is bound to the domain, and Mosaic → Settings (API keys) lives
|
|
33
|
+
in `wp_mosaic_settings`, which a theme ZIP does not carry.
|
|
34
|
+
|
|
14
35
|
## Driving the upgrade from outside wp-admin
|
|
15
36
|
|
|
16
37
|
```
|
|
@@ -300,7 +321,10 @@ analysis (`rank_math_content`), with the Content element's slot replaced by a li
|
|
|
300
321
|
marker so the text being typed is analysed in place. Rank Math's link counter
|
|
301
322
|
(`rank_math/links/content`) gets the render instead of the empty `post_content`.
|
|
302
323
|
SEOPress and Slim SEO have their own adapters. A Mosaic page no longer scores as
|
|
303
|
-
empty.
|
|
324
|
+
empty. Limits the official docs state: SEOPress needs 10.1 or later; All in One SEO
|
|
325
|
+
is not supported, and neither is Yoast's link counting; the master (header and
|
|
326
|
+
footer) is left out of what is analysed; and XML sitemaps do not list images placed
|
|
327
|
+
in Mosaic content.
|
|
304
328
|
|
|
305
329
|
**Re-verified on the live site:** `popovers` 37/37, `component-wall` 26/26,
|
|
306
330
|
`form-surface`, `content-loop` 15/15, both sliders, `tokens`, `navigation` 27/27
|
|
@@ -49,10 +49,12 @@ as a number scrambles the page; renumbering siblings the way you would an array
|
|
|
49
49
|
both unnecessary and destructive of other clients' inserts.
|
|
50
50
|
|
|
51
51
|
**"The post is the unit."** In Elementor and Gutenberg, one post = one page's data.
|
|
52
|
-
In Mosaic a post is a *target*:
|
|
53
|
-
|
|
52
|
+
In Mosaic a post is a *target*: an auto template binds by template path (a post
|
|
53
|
+
type's singles, an archive, search) and serves every post that path covers, while a
|
|
54
|
+
manual template is bound to one post through `mosaic_template_assigns`. Editing "the
|
|
54
55
|
page" usually means editing a template, and the blast radius is every post that
|
|
55
|
-
template
|
|
56
|
+
template serves. Check the template's `assign` and `path`, and
|
|
57
|
+
`mosaic_template_assigns`, before you edit.
|
|
56
58
|
|
|
57
59
|
**"Style the element."** Elementor puts controls on the widget. Mosaic puts styling
|
|
58
60
|
in a **class system** (152 built-in variants - element classes) layered over a **token system**
|
|
@@ -71,8 +73,8 @@ revision is rejected, and the rejection arrives as HTTP 200. See
|
|
|
71
73
|
|
|
72
74
|
- Post content authored as blocks, on a normal WP theme → `gutenberg-headless`.
|
|
73
75
|
- An Elementor site, page-level construction → `elementor-headless`.
|
|
74
|
-
- A Mosaic site → here. The write path and all
|
|
75
|
-
|
|
76
|
+
- A Mosaic site → here. The write path and all 129 node types are measured (5 of
|
|
77
|
+
them Pro-only on 1.0.11 - see `references/data-model.md`).
|
|
76
78
|
|
|
77
79
|
## One thing the converter has to add, not copy
|
|
78
80
|
|
|
@@ -29,6 +29,17 @@ component scripts (accordion, dropdown, navbar, form, slider, dialog — each
|
|
|
29
29
|
`*ElementMResource` asks `MosaicSettings::isScriptsInlineAllowed()`); `Frontend.js`
|
|
30
30
|
still loads as a file.
|
|
31
31
|
|
|
32
|
+
The keys it holds (`MosaicSettingsMResource`): `smallNudge`, `bigNudge`,
|
|
33
|
+
`previewTargetBlank`, `keepAddPanelOpen`, `manualAssignEnabledForPostTypes` (which
|
|
34
|
+
post types get the "assign template" control), `historyLimit`, `fontDisplay`
|
|
35
|
+
(default `block`), `saveGoogleFontsLocally`, `googleFontsCacheExpirationTime`,
|
|
36
|
+
`allowTrackingUsageData`, `scriptsInline`, `criticalPreload` (sends HTTP
|
|
37
|
+
`Link: rel=preload` for the critical scripts), `wpEmoji`, `serverSideThumbnailRender`,
|
|
38
|
+
the `turnstile*` / `recaptcha*` CAPTCHA keys, `googleMapsApiKey`,
|
|
39
|
+
`mailerliteApiToken`, `mailchimpApiKey`, `kitApiKey`. They are site-wide, not per
|
|
40
|
+
theme, and the theme ZIP does not carry them: moving a site by ZIP needs these
|
|
41
|
+
re-entered, and a `googlemaps` element prints nothing until `googleMapsApiKey` is set.
|
|
42
|
+
|
|
32
43
|
## The envelopes
|
|
33
44
|
|
|
34
45
|
Both `checkout` and `check` take one required string parameter, `syncCheckEnvelopes`
|
|
@@ -123,7 +123,7 @@ const rows = (p) => tableFiles(p)
|
|
|
123
123
|
.reduce((n, f) => n + read(f).trim().split("\n").length - 1, 0); // minus each header
|
|
124
124
|
const counts = {
|
|
125
125
|
"data/node-verification.csv": 129,
|
|
126
|
-
"data/style-verification.csv":
|
|
126
|
+
"data/style-verification.csv": 101,
|
|
127
127
|
"data/node-property-verification.csv": 191,
|
|
128
128
|
"data/rwd-verification.csv": 733,
|
|
129
129
|
"data/browser-verification": 4132,
|
package/tools/build_page.py
CHANGED
|
@@ -85,7 +85,7 @@ class Surface:
|
|
|
85
85
|
self.outcome = {r["type"]: r["outcome"] for r in load_csv("node-verification.csv")}
|
|
86
86
|
style_rows = load_csv("style-properties.csv")
|
|
87
87
|
self.style_props = {r["property"] for r in style_rows}
|
|
88
|
-
# 24 of the
|
|
88
|
+
# 24 of the 101 style properties are restricted to an enum. A value outside it
|
|
89
89
|
# is accepted by the API, stored, and silently never compiled - white-space
|
|
90
90
|
# takes pre-wrap but not pre-line, and the difference is invisible until you
|
|
91
91
|
# look at the delivered CSS. Refuse it here instead.
|
|
@@ -42,9 +42,12 @@ RE_STYLE_PROP = re.compile(
|
|
|
42
42
|
re.S)
|
|
43
43
|
RE_ACCEPTED = re.compile(r"createValidatorAcceptedValues\(\s*\[(.*?)\]", re.S)
|
|
44
44
|
|
|
45
|
+
# Either quote style: `new CSSScaleStylePropertyFactory('scale')` is single-quoted,
|
|
46
|
+
# and a double-quote-only pattern silently dropped scale, perspective and
|
|
47
|
+
# collectionModesData - all three compile (measured on 1.0.11).
|
|
45
48
|
RE_ADD = re.compile(
|
|
46
|
-
r'addCSSProperty\(\s*new\s+(\w+)\s*\(\s*"([
|
|
47
|
-
r'(?:\s*,\s*"([
|
|
49
|
+
r'addCSSProperty\(\s*new\s+(\w+)\s*\(\s*[\'"]([^\'"]+)[\'"]' # factory, first arg
|
|
50
|
+
r'(?:\s*,\s*[\'"]([^\'"]+)[\'"])?' # optional member name
|
|
48
51
|
r'(?:\s*,\s*([\w\\]+)::class)?', # optional value class
|
|
49
52
|
re.S,
|
|
50
53
|
)
|
|
@@ -55,6 +58,14 @@ RE_ADD = re.compile(
|
|
|
55
58
|
RE_STATE = re.compile(
|
|
56
59
|
r"createMeta\(\s*'([^']*)'\s*,\s*'((?:[^'\\]|\\.)*)'\s*(?:,\s*(\d+))?\s*\)", re.S
|
|
57
60
|
)
|
|
61
|
+
# createMeta('<stateID>', implode(',', array('<sel>', '<sel>', ...)) [, order]) - the
|
|
62
|
+
# accordion item and the dropdown spell their selector lists this way, and the
|
|
63
|
+
# single-string pattern above never saw ___accordion-item--opened/--opening or
|
|
64
|
+
# ___dropdown--opened.
|
|
65
|
+
RE_STATE_IMPLODE = re.compile(
|
|
66
|
+
r"createMeta\(\s*'([^']*)'\s*,\s*implode\(\s*'([^']*)'\s*,\s*(?:array\(|\[)(.*?)(?:\)|\])\s*\)\s*(?:,\s*(\d+))?\s*\)",
|
|
67
|
+
re.S,
|
|
68
|
+
)
|
|
58
69
|
|
|
59
70
|
|
|
60
71
|
def extract_states(plugin_root, out_dir):
|
|
@@ -66,7 +77,11 @@ def extract_states(plugin_root, out_dir):
|
|
|
66
77
|
path = os.path.join(dirpath, fn)
|
|
67
78
|
with open(path, encoding="utf-8", errors="replace") as fh:
|
|
68
79
|
src = fh.read()
|
|
69
|
-
|
|
80
|
+
found = list(RE_STATE.findall(src))
|
|
81
|
+
for state_id, glue, items, order in RE_STATE_IMPLODE.findall(src):
|
|
82
|
+
parts = re.findall(r"'((?:[^'\\]|\\.)*)'", items)
|
|
83
|
+
found.append((state_id, glue.join(parts), order))
|
|
84
|
+
for state_id, selector, order in found:
|
|
70
85
|
if state_id in seen:
|
|
71
86
|
continue
|
|
72
87
|
seen.add(state_id)
|
package/tools/mo.py
CHANGED
|
@@ -281,7 +281,7 @@ def cmd_params(a):
|
|
|
281
281
|
the placement rule - because the answer is not in any one of them.
|
|
282
282
|
|
|
283
283
|
Mosaic differs from a widget-based builder here in a way worth stating: the
|
|
284
|
-
STYLE surface is universal. Every element takes the same
|
|
284
|
+
STYLE surface is universal. Every element takes the same 101 style properties;
|
|
285
285
|
what varies per type is the DATA properties and which node-type-scoped states
|
|
286
286
|
apply. So the style half of this output is the same for every type, and that
|
|
287
287
|
is a fact about the platform rather than a shortcut taken here."""
|
|
@@ -777,7 +777,7 @@ def main():
|
|
|
777
777
|
"EVERYTHING settable on one type: data, style, states, placement")
|
|
778
778
|
p.add_argument("name")
|
|
779
779
|
p.add_argument("--style", action="store_true",
|
|
780
|
-
help="list all
|
|
780
|
+
help="list all 101 style properties too, not just count them")
|
|
781
781
|
|
|
782
782
|
p = add("check", cmd_check, "exit 1 if any named type is unsafe or unknown")
|
|
783
783
|
p.add_argument("names", nargs="+")
|