mosaic-headless 1.41.0 → 1.43.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 +3 -3
- package/assets/templates/platforms/claude-ai.json +1 -1
- package/assets/templates/platforms/claude-code.json +1 -1
- package/assets/templates/platforms/codex-cli.json +1 -1
- package/assets/templates/platforms/copilot.json +1 -1
- package/assets/templates/platforms/gemini-cli.json +1 -1
- package/data/pending.csv +5 -0
- package/data/variants.csv +80 -75
- package/package.json +1 -1
- package/references/data-files.md +1 -1
- package/references/design-system.md +22 -1
- package/references/facts.md +115 -0
- package/references/templates-and-conditions.md +30 -0
- package/references/tools.md +1 -1
- package/tools/from_elementor.py +2 -2
- package/tools/inline_html.py +2 -1
- package/tools/sync_nodes.py +160 -13
- package/tools/test_mosaic.py +83 -0
package/README.ja.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<img src="https://img.shields.io/badge/node_properties-120-success?style=flat-square" alt="120 個の node プロパティ">
|
|
19
19
|
<img src="https://img.shields.io/badge/style_properties-101-success?style=flat-square" alt="101 個のスタイルプロパティ">
|
|
20
20
|
<img src="https://img.shields.io/badge/responsive_checks-733-blueviolet?style=flat-square" alt="733 件のレスポンシブ検査">
|
|
21
|
-
<img src="https://img.shields.io/badge/self--tests-
|
|
21
|
+
<img src="https://img.shields.io/badge/self--tests-62-blueviolet?style=flat-square" alt="62 項目のセルフテスト">
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
@@ -183,7 +183,7 @@ node type、node プロパティ、スタイルプロパティ、スタイル状
|
|
|
183
183
|
| `data/theme-zip-verification.csv` | 22 | Mosaic 自身のテーマ ZIP を往復させて比較 |
|
|
184
184
|
| `data/conversion-batch.csv` | 19 | あるサイトのすべての Elementor ページを変換・構築・検査 |
|
|
185
185
|
|
|
186
|
-
- セルフテスト:`python tools/test_mosaic.py`、オフラインの
|
|
186
|
+
- セルフテスト:`python tools/test_mosaic.py`、オフラインの 62 項目(検索、中国語の用語、構築結果の形と拒否ルール、公開されている構築インターフェース、このリポジトリの数値とプライバシー)。
|
|
187
187
|
- evals:Mosaic 1.0.10〜1.0.12 の挙動に関する 16 問。skill ありで 16/16、なしで 0/16。結果:[evals/RESULTS.md](evals/RESULTS.md)。
|
|
188
188
|
- `SKILL.md`、これらの README、バッジの数値は、`tools/check_numbers.py` がデータと照合しています。詳細:[verification-record.md](references/verification-record.md)。
|
|
189
189
|
|
package/README.ko.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<img src="https://img.shields.io/badge/node_properties-120-success?style=flat-square" alt="120개 node 속성">
|
|
19
19
|
<img src="https://img.shields.io/badge/style_properties-101-success?style=flat-square" alt="101개 스타일 속성">
|
|
20
20
|
<img src="https://img.shields.io/badge/responsive_checks-733-blueviolet?style=flat-square" alt="733개 반응형 검사">
|
|
21
|
-
<img src="https://img.shields.io/badge/self--tests-
|
|
21
|
+
<img src="https://img.shields.io/badge/self--tests-62-blueviolet?style=flat-square" alt="62개 자체 테스트">
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
@@ -183,7 +183,7 @@ node type, node 속성, 스타일 속성, 스타일 상태는 플러그인 소
|
|
|
183
183
|
| `data/theme-zip-verification.csv` | 22 | Mosaic 자체 테마 ZIP을 왕복시켜 비교 |
|
|
184
184
|
| `data/conversion-batch.csv` | 19 | 한 사이트의 모든 Elementor 페이지를 변환, 구축, 검사 |
|
|
185
185
|
|
|
186
|
-
- 자체 테스트: `python tools/test_mosaic.py`, 오프라인 테스트
|
|
186
|
+
- 자체 테스트: `python tools/test_mosaic.py`, 오프라인 테스트 62개(조회, 중국어 용어, 구축 결과의 형태와 거부 규칙, 공개된 구축 인터페이스, 이 저장소의 숫자와 개인정보).
|
|
187
187
|
- evals: Mosaic 1.0.10~1.0.12 동작에 관한 16문항. skill 사용 시 16/16, 미사용 시 0/16. 결과: [evals/RESULTS.md](evals/RESULTS.md).
|
|
188
188
|
- `SKILL.md`, 이 README들, 배지의 숫자는 `tools/check_numbers.py`가 데이터와 대조합니다. 자세한 내용: [verification-record.md](references/verification-record.md).
|
|
189
189
|
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<img src="https://img.shields.io/badge/node_properties-120-success?style=flat-square" alt="120 node properties">
|
|
19
19
|
<img src="https://img.shields.io/badge/style_properties-101-success?style=flat-square" alt="101 style properties">
|
|
20
20
|
<img src="https://img.shields.io/badge/responsive_checks-733-blueviolet?style=flat-square" alt="733 responsive checks">
|
|
21
|
-
<img src="https://img.shields.io/badge/self--tests-
|
|
21
|
+
<img src="https://img.shields.io/badge/self--tests-62-blueviolet?style=flat-square" alt="62 self-tests">
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
@@ -183,7 +183,7 @@ Node types, node properties, style properties and style states are extracted fro
|
|
|
183
183
|
| `data/theme-zip-verification.csv` | 22 | Mosaic's own theme ZIP round-tripped and compared |
|
|
184
184
|
| `data/conversion-batch.csv` | 19 | every Elementor page of a site converted, built and checked |
|
|
185
185
|
|
|
186
|
-
- Self-test: `python tools/test_mosaic.py`,
|
|
186
|
+
- Self-test: `python tools/test_mosaic.py`, 62 offline tests (lookups, Chinese terms, the build output's shape and refusals, the public build interface, this repository's numbers and privacy).
|
|
187
187
|
- Evals: 16 questions about Mosaic 1.0.10 to 1.0.12 behaviour; with the skill 16/16, without it 0/16. Results: [evals/RESULTS.md](evals/RESULTS.md).
|
|
188
188
|
- Every number in `SKILL.md`, these READMEs and their badges is checked against the data by `tools/check_numbers.py`. Detail: [verification-record.md](references/verification-record.md).
|
|
189
189
|
|
package/README.zh-TW.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<img src="https://img.shields.io/badge/node_properties-120-success?style=flat-square" alt="120 個 node 屬性">
|
|
19
19
|
<img src="https://img.shields.io/badge/style_properties-101-success?style=flat-square" alt="101 個樣式屬性">
|
|
20
20
|
<img src="https://img.shields.io/badge/responsive_checks-733-blueviolet?style=flat-square" alt="733 條 RWD 檢查">
|
|
21
|
-
<img src="https://img.shields.io/badge/self--tests-
|
|
21
|
+
<img src="https://img.shields.io/badge/self--tests-62-blueviolet?style=flat-square" alt="62 項自我測試">
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
@@ -183,7 +183,7 @@ node type、node 屬性、樣式屬性、樣式狀態從外掛原始碼抽出(
|
|
|
183
183
|
| `data/theme-zip-verification.csv` | 22 | Mosaic 自己的佈景 ZIP 匯出再匯入並比對 |
|
|
184
184
|
| `data/conversion-batch.csv` | 19 | 一個網站的每個 Elementor 頁面都轉換、建置並檢查 |
|
|
185
185
|
|
|
186
|
-
- 自我測試:`python tools/test_mosaic.py`,
|
|
186
|
+
- 自我測試:`python tools/test_mosaic.py`,62 項離線測試(查詢、中文用語、建頁產出的結構與拒收規則、對外的建頁介面、本 repo 的數字與隱私)。
|
|
187
187
|
- evals:16 題 Mosaic 1.0.10 到 1.0.12 的行為題;有 skill 16/16,沒有 skill 0/16。結果見 [evals/RESULTS.md](evals/RESULTS.md)。
|
|
188
188
|
- `SKILL.md`、這幾份 README 和徽章上的數字,都由 `tools/check_numbers.py` 對照資料核對。細節見 [verification-record.md](references/verification-record.md)。
|
|
189
189
|
|
package/SKILL.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "mosaic-headless"
|
|
3
3
|
description: |
|
|
4
|
-
Build and modify Mosaic Pro (Nextend) WordPress sites by writing the data model directly - no visual editor, no DOM. Query the real surface with `mo.py` (134 node types, 120 node properties, 101 style properties, 60 style states,
|
|
4
|
+
Build and modify Mosaic Pro (Nextend) WordPress sites by writing the data model directly - no visual editor, no DOM. Query the real surface with `mo.py` (134 node types, 120 node properties, 101 style properties, 60 style states, 162 variants, 76 dynamic variables, 16 interaction triggers, 115 REST routes) where every lookup leads with the measured verdict, not the declaration: each node type placed on a live site one at a time, each style and node property swept against compiled CSS and markup, the delivered pages re-read in Chromium at three viewports. Measured on Mosaic Pro 1.0.10: the popover (anchored or screen-placed, the flip state, afterClose-chained tours), the modal on the Popover API, OpenStreetMap, exit-intent and scroll-depth triggers, run rules and memory. Drives theme export/import and the 1.0.7 -> 1.0.10 data upgrades from outside wp-admin; re-extracted and re-verified on 1.0.11 and 1.0.12 (the buildable Select). 中文觸發:Mosaic、Nextend、不開編輯器做頁面、做一頁、整站、母版、範本、元件、變體、內距、外距、圓角、懸停、斷點、RWD、手機版、彈出視窗、浮動框、彈窗、摺疊面板、頁籤、輪播、表單、互動、動畫、深色模式、搬佈景、匯出匯入佈景、Mosaic 升級、Elementor 轉 Mosaic、自訂欄位。
|
|
5
5
|
license: "MIT"
|
|
6
6
|
user-invocable: true
|
|
7
7
|
metadata:
|
|
8
8
|
author: "moksa (https://moksaweb.com)"
|
|
9
|
-
version: "1.
|
|
9
|
+
version: "1.43.0"
|
|
10
10
|
homepage: "https://github.com/Moksa1123/mosaic-headless"
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ health, not plugin audits.
|
|
|
24
24
|
|---|---|
|
|
25
25
|
| Surface | Extracted from the Mosaic Pro plugin source, last re-extracted on **Mosaic Pro 1.0.14** (no table changed from 1.0.13) (unlicensed: the licence gates the theme library, not the node factories). `tools/check_tables.py` re-extracts every source table and diffs it against `data/`. The editor-side features of 1.0.13 and 1.0.14 are not measured yet: [upgrading.md](references/upgrading.md) |
|
|
26
26
|
| Measured on | A live WordPress 7.1 + WooCommerce 11.1 install, upgraded in place from 1.0.7 to 1.0.12. Node sweep: 133 of 134 types on 1.0.11 / 1.0.12 (`document` excluded: its probe wrecks the master). Older rows say which version they ran on. Detail: [verification-record.md](references/verification-record.md) |
|
|
27
|
-
| Size | 134 node types, 120 node property names declared in 201 rows (one row per owning data class), 191 node-property probe rows covering 118 of those names (`ariaLive` and `positioning` not yet probed), 101 style properties, 60 style states,
|
|
27
|
+
| Size | 134 node types, 120 node property names declared in 201 rows (one row per owning data class), 191 node-property probe rows covering 118 of those names (`ariaLive` and `positioning` not yet probed), 101 style properties, 60 style states, 162 variants, 76 dynamic variables, 16 interaction triggers, 115 REST routes, 23 tables. Current counts: `python tools/mo.py stats` - do not quote numbers from memory |
|
|
28
28
|
| Provenance | Each table says where it came from: **source** (read out of the plugin code), **live** (captured from the running site), **swept / probed / driven** (written to a page and asserted on the delivered HTML, CSS or browser). Per-file list: [data-files.md](references/data-files.md) |
|
|
29
29
|
| Chinese terms | `data/terms-zh.csv`: every row has `source` + `trust` |
|
|
30
30
|
| Trust levels | `measured` (swept, probed, driven) > `documented` (plugin source, Mosaic's shipped zh_TW strings, Mosaic's docs) > `inferred` / `house-style` (colloquial words, site conventions). Never present the last two as Mosaic's own |
|
package/data/pending.csv
CHANGED
|
@@ -15,3 +15,8 @@ date,question,why_not_found,asked_by,status
|
|
|
15
15
|
2026-11-21,"Should build_site.py look up a post's existing template before binding, instead of always creating a new master and template?","a design decision, not a gap: em925's deploy tool imports build_site, so its behaviour is left unchanged (its md5 is part of em925's agreement). sync_nodes.py + list_bindings.php now cover in-place updates; build_site.py's limits are documented in SKILL.md and references/tools.md","skill 總機 (batch 3 item 20, batch 4 item 32)",open
|
|
16
16
|
2026-11-24,"Does Mosaic 1.0.14 really answer 503 (Retry-After 30, no-cache) and write no root when the database connection is lost mid-render?","read from the 1.0.14 source and WordPress 7.1.5's wpdb only; measuring it needs the database to go away under a front-end render, not done on the shared demo site",skill 總機 (Mosaic 1.0.14 re-verification),open
|
|
17
17
|
2026-11-24,Mosaic's own ZIP import of a ~24k-node theme exhausts a 512M PHP memory limit in createTemplates,"measured once on the demo site (1.0.14; the import flow's PHP is unchanged since 1.0.12); how much memory a theme that size needs, or whether Mosaic splits the tick, is not known. theme_import.php handles it",skill 總機 (Mosaic 1.0.14 re-verification),open
|
|
18
|
+
2026-11-24,"Add a RELEASING.md (rewrite of gutenberg-headless's for this repo: PR, merge, push the tag, CI publishes via OIDC)","a to-do, not a gap: the repo has none, so v1.41.0 followed gutenberg-headless's; skill 總機 asked for it with the next release",skill 總機 (round-button brief 2026-11-24),"closed 2026-11-25: RELEASING.md added with v1.42.0 (PR, merge, push the tag, CI publishes via OIDC)"
|
|
19
|
+
2026-11-24,Add a references/facts.md entry: WooCommerce coming-soon mode (store pages only) + Mosaic -> store pages answer 406. Woo renders its coming-soon page and returns '' from template_include; Mosaic's themes/mosaic/functions.php forces its index.php anyway; with no archive-product/single-product Mosaic template FrontendRenderer sets status_header(406). Also: does a store page that HAS a Mosaic template print two documents (Woo's page + Mosaic's) while coming-soon is on?,"the 406 is traced from source and read on the demo site (1.0.14, /shop/ and a product page, read-only); the two-document case is predicted from the code only - measuring it needs a store template written on the demo site, which waits for moksa 總機. Do the facts entry with the next release, together with RELEASING.md",skill 總機 (demo /shop/ 406 trace 2026-11-24),closed 2026-11-25: references/facts.md section added with v1.42.0; the two-document case is still open (row below)
|
|
20
|
+
2026-11-25,Does a WooCommerce store page that HAS a Mosaic template print two documents while coming-soon is on?,"predicted from the code only (references/facts.md, WooCommerce coming soon section); measuring it needs a store template written on the shared demo site, which waits for moksa 總機",skill 總機 (demo /shop/ 406 trace 2026-11-24),open
|
|
21
|
+
2026-11-25,"Variable-mode switch vs Chrome's visited-link colour, and @property <color> vs var() fallbacks on links","reported by a fourth site (references/facts.md, fourth site); not reproduced here - needs a theme with a mode collection, a visited link and screenshots (getComputedStyle cannot show visited colours)",skill 總機 (sync_nodes interaction target brief 2026-11-25),open
|
|
22
|
+
2026-11-28,"With WooCommerce coming-soon on, why does a store URL with any query string answer 200 (WooCommerce's max-age=60) while the plain URL answers Mosaic's 406?","observed on the demo only (references/facts.md, No Mosaic template section); the code path that skips Mosaic's status for a query string was not traced. It matters because verify_navigation.py adds ?_v= and so misses the 406",skill 總機 (template brief 2026-11-28),open
|
package/data/variants.csv
CHANGED
|
@@ -81,78 +81,83 @@ ed5a3838-6b8c-0018-a497-57bb81a05511,Label,m-label,True,,.m-label,ba5adb79-0b53-
|
|
|
81
81
|
9adf1aa8-afb6-0afb-87c2-0e1fe047a741,Form step,m-form-step,True,,.m-form-step,3ed458ca-ce0f-01f7-b7fe-427895279f54,False,True,False,b0H
|
|
82
82
|
4e48111e-cd4b-0552-9001-20952f140103,Button,m-form-step-button,True,,.m-form-step-button-back|.m-form-step-button-next,3ed458ca-ce0f-01f7-b7fe-427895279f54,False,True,False,b0I
|
|
83
83
|
8234ef14-32e1-0dbc-b603-c1c81bc61496,Radio input,m-radio,True,,.m-radio,0aba491f-bf49-0ce1-ae11-a5b8b78ec4cd,False,True,False,b0J
|
|
84
|
-
05fbeaf8-2ba9-0d9d-9c3b-36cd70256005,
|
|
85
|
-
df2d64e1-e3ee-0c6d-8660-bb7cc614cad7,Option,m-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
84
|
+
05fbeaf8-2ba9-0d9d-9c3b-36cd70256005,List box,m-listbox,True,,.m-listbox,ba5adb79-0b53-04d7-9acb-5a3219841114,True,True,False,b0K
|
|
85
|
+
df2d64e1-e3ee-0c6d-8660-bb7cc614cad7,Option,m-listbox-option,True,,.m-listbox-option,05fbeaf8-2ba9-0d9d-9c3b-36cd70256005,False,True,False,b0L
|
|
86
|
+
f93d34d2-7b0b-0ca5-9403-cd67123097f9,Select,m-select,True,,.m-select,ba5adb79-0b53-04d7-9acb-5a3219841114,True,True,False,b0M
|
|
87
|
+
a1838d6d-9dbe-0465-8959-5c5eec97b54e,Toggle,m-select-toggle,True,,.m-select-toggle,f93d34d2-7b0b-0ca5-9403-cd67123097f9,False,True,False,b0N
|
|
88
|
+
3462b510-6e51-00dc-b51c-dc0d05d78be5,Placeholder,m-select-placeholder,True,,.m-select-placeholder-inner:where(.m-select-placeholder > .m-select-placeholder-inner),f93d34d2-7b0b-0ca5-9403-cd67123097f9,False,True,False,b0O
|
|
89
|
+
f320d35f-fe96-0d6d-9115-87094e35dac9,Options,m-select-options,True,,.m-select-options,f93d34d2-7b0b-0ca5-9403-cd67123097f9,False,True,False,b0P
|
|
90
|
+
31567887-60d7-058c-81b3-d9d261b2de3d,Option,m-select-option,True,,.m-select-option,f93d34d2-7b0b-0ca5-9403-cd67123097f9,False,True,False,b0Q
|
|
91
|
+
9b8bc2c1-08f4-0644-a198-c9b4dfb77168,Submit button,m-submit-button,True,,.m-submit-button,ba5adb79-0b53-04d7-9acb-5a3219841114,True,True,False,b0R
|
|
92
|
+
9c9cd6b9-a966-0f5a-9dda-bb579a6c0dbc,Submit label,m-submit-label,True,,.m-submit-label,9b8bc2c1-08f4-0644-a198-c9b4dfb77168,True,True,False,b0S
|
|
93
|
+
52919ea1-dc2a-087c-b3ed-9cdfc0dfa3e5,Submit loading,m-submit-loading,True,,.m-submit-loading,9b8bc2c1-08f4-0644-a198-c9b4dfb77168,True,True,False,b0T
|
|
94
|
+
2abe4d7d-6b0d-0ef6-98cd-435b52598cf9,Text area,m-textarea,True,,.m-textarea,ba5adb79-0b53-04d7-9acb-5a3219841114,False,True,False,b0U
|
|
95
|
+
9199c944-4081-0d5b-9997-683614c79902,Icon,m-icon,True,,.m-icon,,False,True,False,b0V
|
|
96
|
+
ed14cb45-d01b-0fd5-bdb1-173089b7eca0,Icon box,m-icon-box,True,,.m-icon-box,,False,True,False,b0W
|
|
97
|
+
c7f25ef0-944c-0970-aa19-f06f487a2717,Loop,m-loop,True,,.m-loop,,True,True,False,b0X
|
|
98
|
+
cdcc719a-b0c5-0749-bcd9-4afe63cb1ef9,Pagination,m-loop-pagination,True,,.m-loop-pagination,c7f25ef0-944c-0970-aa19-f06f487a2717,False,True,False,b0Y
|
|
99
|
+
364c2cfa-bcc1-0d2e-956f-579b07c5ee4b,Numbers,m-loop-pagination-numbers,True,,.m-loop-pagination-numbers,c7f25ef0-944c-0970-aa19-f06f487a2717,False,True,False,b0Z
|
|
100
|
+
57b78edf-a0c6-0d28-90b7-df46cee06d10,No result,m-loop-no-result,True,,.m-loop-no-result,c7f25ef0-944c-0970-aa19-f06f487a2717,False,True,False,b0a
|
|
101
|
+
0c33aca6-67a0-029f-8be6-4e8d5aa28c3c,Items,m-loop-items,True,,.m-loop-items,c7f25ef0-944c-0970-aa19-f06f487a2717,False,True,False,b0b
|
|
102
|
+
5e8a088d-bee4-0835-8493-a3152f9c641f,Item,m-loop-item,True,,.m-loop-item,c7f25ef0-944c-0970-aa19-f06f487a2717,False,True,False,b0c
|
|
103
|
+
8b4f19bb-55a1-0a61-a4b9-af8e0dee197f,Pagination button,m-loop-pagination-button,True,,.m-loop-pagination-button-previous|.m-loop-pagination-button-next,c7f25ef0-944c-0970-aa19-f06f487a2717,False,True,False,b0d
|
|
104
|
+
86785945-a2de-0d7b-aeec-fb3dd4ba38da,Number,m-loop-pagination-number,True,,.m-loop-pagination-number,c7f25ef0-944c-0970-aa19-f06f487a2717,False,True,False,b0e
|
|
105
|
+
ee488e25-50e4-0be6-8bde-080c69a88959,Slider,m-slider,True,,.m-slider,,True,True,False,b0f
|
|
106
|
+
655d4861-c507-07a9-bea4-82687cf750c3,Slides,m-slides,True,,.m-slides,ee488e25-50e4-0be6-8bde-080c69a88959,False,True,False,b0g
|
|
107
|
+
74bd7093-f924-033d-a67c-fdb8c320adfe,Loop slides,m-loop-slides,True,,.m-loop-slides,ee488e25-50e4-0be6-8bde-080c69a88959,False,True,False,b0h
|
|
108
|
+
5e0d0554-d43a-01e4-ac4e-84a3cd493660,Slide,m-slide-content,False,,.m-slide-content:where(.m-slide > .m-slide-content),ee488e25-50e4-0be6-8bde-080c69a88959,False,True,False,b0i
|
|
109
|
+
49772031-10a1-0a84-b2dd-df0666fcf907,Navigation,m-slider-navigation,True,,.m-slider-navigation,ee488e25-50e4-0be6-8bde-080c69a88959,False,True,False,b0j
|
|
110
|
+
21db5141-ef34-0e46-a1bd-66ecbcc945c8,Bullet,m-slider-bullet,True,,.m-slider-bullet,ee488e25-50e4-0be6-8bde-080c69a88959,False,True,False,b0k
|
|
111
|
+
829de3ab-c95a-0f0d-a522-7e13e156635b,Button,m-slider-arrow,True,,.m-slider-arrow-left|.m-slider-arrow-right,ee488e25-50e4-0be6-8bde-080c69a88959,False,True,False,b0l
|
|
112
|
+
246ad9ac-c8db-07ae-8bb3-11c428511643,Post content,m-post-content,True,,.m-post-content|.wp-block-post-content,,False,True,True,b0m
|
|
113
|
+
07923762-4124-4514-9410-84ba6a3d25c9,Shortcode,m-shortcode,True,,.m-shortcode,,False,True,False,b0n
|
|
114
|
+
e5fb8634-963c-0dd3-9a71-4c6efdba06ad,Inline link,m-inline-link,True,,.m-inline-link,,False,True,False,b0o
|
|
115
|
+
29311743-3270-043f-b298-ea31d4c7f70a,Span,m-span,True,,.m-span,,False,True,False,b0p
|
|
116
|
+
fcf8c83b-547b-018b-b646-6d7b34101792,Template,m-template-external,False,,.m-template-external,,False,False,False,b0q
|
|
117
|
+
6a9dad32-018a-04da-9bb7-2a6c6996e165,Template,m-template-internal,False,,.m-template-internal,,False,False,False,b0r
|
|
118
|
+
43b7ad91-51a2-0483-8c14-9b3e56dca5b6,Component,m-component-external,True,,.unknown,,False,False,False,b0s
|
|
119
|
+
e2096bb4-3ac7-0839-9125-0703ccf66d72,Component,m-component-internal,True,,.unknown,,False,False,False,b0t
|
|
120
|
+
03f7dc2d-5a63-0582-8b70-81f69956473f,Instance,m-component-instance,True,,.m-component-instance,,False,False,False,b0u
|
|
121
|
+
0d4bea5d-0712-0019-b509-f36b453c8457,Unknown,m-unknown,False,,.unknown,,False,False,False,b0v
|
|
122
|
+
3ab5005c-d401-00e6-ac68-20be50a4da3f,H1,m-gutenberg-h1,False,tag,":is(.entry-content, .wp-block-post-content) h1",,False,True,True,b0w
|
|
123
|
+
b6c9bcd9-402a-0227-828c-3df96d5e843d,H2,m-gutenberg-h2,False,tag,":is(.entry-content, .wp-block-post-content) h2",,False,True,True,b0x
|
|
124
|
+
60e8d822-bd39-0652-b1fd-b397b80e4e33,H3,m-gutenberg-h3,False,tag,":is(.entry-content, .wp-block-post-content) h3",,False,True,True,b0y
|
|
125
|
+
1b641570-c214-0fe8-b21a-eeb7e12835da,H4,m-gutenberg-h4,False,tag,":is(.entry-content, .wp-block-post-content) h4",,False,True,True,b0z
|
|
126
|
+
5717294e-7610-01bf-be2c-86fc4a4538ff,H5,m-gutenberg-h5,False,tag,":is(.entry-content, .wp-block-post-content) h5",,False,True,True,b10
|
|
127
|
+
bd88afbc-f1e6-0de9-8565-a12e36ccecfd,H6,m-gutenberg-h6,False,tag,":is(.entry-content, .wp-block-post-content) h6",,False,True,True,b11
|
|
128
|
+
9f74c74c-1f2b-002d-aa06-796eebaed2e1,Paragraph,m-gutenberg-paragraph,False,tag,":is(.entry-content, .wp-block-post-content) p",,False,True,True,b12
|
|
129
|
+
15f329b4-55bc-080b-86cf-399cb95bd0e4,Quote,m-gutenberg-quote,False,tag,":is(.entry-content, .wp-block-post-content) blockquote.wp-block-quote",,False,True,True,b13
|
|
130
|
+
84065d85-b043-0487-8be8-2bb95caee182,Cite,m-gutenberg-cite,False,tag,":is(.entry-content, .wp-block-post-content) blockquote.wp-block-quote cite",,False,True,True,b14
|
|
131
|
+
ae7da051-2971-0395-af33-9615547c8cf8,Image,m-gutenberg-image,False,tag,.wp-block-image,,False,True,True,b15
|
|
132
|
+
01a0c2e8-679f-06ce-a2ab-86abb0ef8995,Img,m-gutenberg-img,False,tag,.wp-block-image img,,False,True,True,b16
|
|
133
|
+
8d2c161c-d3f7-01ab-844a-d266eef4b7a6,Caption,m-gutenberg-caption,False,tag,.wp-block-image .wp-element-caption,,False,True,True,b17
|
|
134
|
+
98c4e76d-2723-0467-be0d-69c57ebbd02a,List,m-gutenberg-list,False,tag,":is(.entry-content, .wp-block-post-content) ul.wp-block-list",,False,True,True,b18
|
|
135
|
+
1f9fe5d4-900a-05d0-a7d6-601c9eae178e,Ordered list,m-gutenberg-ordered-list,False,tag,":is(.entry-content, .wp-block-post-content) ol.wp-block-list",,False,True,True,b19
|
|
136
|
+
f68b7526-9fbb-0986-a696-bbc65e7133fc,Footnotes,m-gutenberg-footnotes,False,tag,":is(.entry-content, .wp-block-post-content) ol.wp-block-footnotes",,False,True,True,b1A
|
|
137
|
+
d2664160-1b51-03f8-aaa7-4f3d007e75f8,List item,m-gutenberg-list-item,False,tag,":is(.entry-content, .wp-block-post-content) ul.wp-block-list li|:is(.entry-content, .wp-block-post-content) ol.wp-block-list li|:is(.entry-content, .wp-block-post-content) ol.wp-block-footnotes li",,False,True,True,b1B
|
|
138
|
+
9d4fa324-3bad-0a22-8457-d025a3e3ce57,Code,m-gutenberg-code,False,tag,":is(.entry-content, .wp-block-post-content) pre.wp-block-code",,False,True,True,b1C
|
|
139
|
+
8676e9bf-8f29-07b6-8029-cad1a7c3711f,Preformatted,m-gutenberg-preformatted,False,tag,":is(.entry-content, .wp-block-post-content) pre.wp-block-preformatted",,False,True,True,b1D
|
|
140
|
+
23a935c5-fdcc-02f3-a6c6-37391dd6c5a6,Verse,m-gutenberg-verse,False,tag,":is(.entry-content, .wp-block-post-content) pre.wp-block-verse",,False,True,True,b1E
|
|
141
|
+
af0741e0-9b1e-06c5-8dd3-7b44bfce9a53,Pullquote,m-gutenberg-pullquote,False,tag,":is(.entry-content, .wp-block-post-content) figure.wp-block-pullquote",,False,True,True,b1F
|
|
142
|
+
066d36f6-6f2f-01b7-b2ac-0c8c43544c12,Paragraph,m-gutenberg-pullquote-paragraph,False,tag,":is(.entry-content, .wp-block-post-content) figure.wp-block-pullquote p",,False,True,True,b1G
|
|
143
|
+
eb830eeb-7a4e-05b7-9363-13f3d57d77a8,Cite,m-gutenberg-pullquote-cite,False,tag,":is(.entry-content, .wp-block-post-content) figure.wp-block-pullquote cite",,False,True,True,b1H
|
|
144
|
+
16f872be-f86d-0d71-8528-196401a8dbdb,Separator,m-gutenberg-separator,False,tag,":is(.entry-content, .wp-block-post-content) hr.wp-block-separator.is-style-default",,False,True,True,b1I
|
|
145
|
+
86ab7467-0875-01c2-8ff5-13e91ce121fe,Wide separator,m-gutenberg-wide-separator,False,tag,":is(.entry-content, .wp-block-post-content) hr.wp-block-separator.is-style-wide",,False,True,True,b1J
|
|
146
|
+
5a718f74-12da-42a8-8607-3a26ce696190,Dots separator,m-gutenberg-dots-separator,False,tag,":is(.entry-content, .wp-block-post-content) hr.wp-block-separator.is-style-dots",,False,True,True,b1K
|
|
147
|
+
7e70a40a-205f-4bed-89f4-6f6e3a074b4c,Button,m-gutenberg-button,False,tag,":is(.entry-content, .wp-block-post-content) .wp-block-button__link:where(div.wp-block-button:not(.is-style-outline) > a.wp-element-button.wp-block-button__link)",,False,True,True,b1L
|
|
148
|
+
760f938d-5475-48de-a776-6a956df43d53,Outline button,m-gutenberg-outline-button,False,tag,":is(.entry-content, .wp-block-post-content) .wp-block-button__link:where(div.wp-block-button.is-style-outline > a.wp-element-button.wp-block-button__link)",,False,True,True,b1M
|
|
149
|
+
8de49a77-f767-0054-b1ac-e913ac6562ba,Video,m-video,True,,.m-video,,False,True,False,b1N
|
|
150
|
+
c637b22c-61b9-0964-bcdb-d5ae0d16986a,Google Maps,m-google-maps,True,,.m-google-maps,,False,True,False,b1O
|
|
151
|
+
1a360ae2-3d10-017a-9db6-cece7b44ce17,OpenStreetMap,m-osm,True,,.m-osm,,False,True,False,b1P
|
|
152
|
+
0dce60de-c4a6-0a2d-9990-b93070aeb7da,YouTube,m-youtube,True,,.m-youtube,,False,True,False,b1Q
|
|
153
|
+
be107226-ba10-0fc6-b22e-f984fb21d63b,Vimeo,m-vimeo,True,,.m-vimeo,,False,True,False,b1R
|
|
154
|
+
ea692231-151b-02df-bea7-d567347d1422,List,m-list,True,,.m-list,,True,True,False,b1S
|
|
155
|
+
69a8ab3f-dbdf-09bd-8449-6420570155b8,Horizontal list,m-list-horizontal,True,,.m-list-horizontal,ea692231-151b-02df-bea7-d567347d1422,False,True,False,b1T
|
|
156
|
+
3a8cfda3-1ded-0a3c-9e55-b56510827850,Unordered list,m-list-unordered,True,,.m-list-unordered,ea692231-151b-02df-bea7-d567347d1422,False,True,False,b1U
|
|
157
|
+
7dbba514-fd83-0e8f-ac46-68e6f651f2ff,Ordered list,m-list-ordered,True,,.m-list-ordered,ea692231-151b-02df-bea7-d567347d1422,False,True,False,b1V
|
|
158
|
+
1864859b-2942-44db-b09d-c7073d1df01e,Item,m-list-item,True,,.m-list-item,ea692231-151b-02df-bea7-d567347d1422,False,True,False,b1W
|
|
159
|
+
fb0c2625-dd5a-43c5-82e2-22e8c09ca06c,Loop items,m-list-loop-items,True,,.m-list-loop-items,ea692231-151b-02df-bea7-d567347d1422,False,True,False,b1X
|
|
160
|
+
d1a109c7-3b52-04ef-9a6c-11e0dc0d1a70,Modal,m-modal,True,,.m-modal,,False,True,False,b1Y
|
|
161
|
+
d1a1090d-6e4f-04ef-9a6c-11e0dc0d1a71,Window,m-modal-window,True,,.m-modal-window,d1a109c7-3b52-04ef-9a6c-11e0dc0d1a70,False,True,False,b1Z
|
|
162
|
+
d1a10004-e51a-04ef-9a6c-11e0dc0d1a72,Overlay,m-modal-overlay,True,,.m-modal-overlay,d1a109c7-3b52-04ef-9a6c-11e0dc0d1a70,False,True,False,b1a
|
|
163
|
+
d1a1000b-70b0-04ef-9a6c-11e0dc0d1a73,Popover,m-popover,True,,.m-popover,,False,True,False,b1b
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mosaic-headless",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "AI-agent skill: build Mosaic Pro (Nextend) WordPress sites by writing the underlying data model directly - 23 custom tables, no visual editor, no DOM. Every node type, style property and node property swept against a live install and asserted on the delivered HTML and compiled CSS. Installs into Claude Code, Cursor, Codex CLI, Gemini CLI, Copilot, Continue, Windsurf and Claude.ai.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wordpress",
|
package/references/data-files.md
CHANGED
|
@@ -95,7 +95,7 @@ Moved out of SKILL.md on 2026-11-16 (skill SOP pass). `scripts/check-release.mjs
|
|
|
95
95
|
| `data/tutorial-recipes-verification.csv` | 16 | **driven live** - Mosaic's four docs tutorials (dark/light switcher, loading overlay, class-driven reveal, loop with hover pause) plus the off-canvas toggle and the reading progress bar, built from `tools/interactions.py` and checked in Chromium |
|
|
96
96
|
| `data/menu-verification.csv` | 34 | **driven live** - every way to build a site menu on one page: hover dropdown and mega panel (mouse, keyboard, touch tablet), and three phone menus (modal drawer, navbar, the tutorial's click panel) on a 390px touch phone - Esc, focus trap and return, aria, scroll lock, a sticky header over the close button |
|
|
97
97
|
| `data/intro-verification.csv` | 8 + 15 | **sampled live** - the entrance sequence over fifteen timestamps on a monotonic clock, plus the eight assertions about it |
|
|
98
|
-
| `data/variants.csv` |
|
|
98
|
+
| `data/variants.csv` | 162 | **live** — the variant catalog (Mosaic's built-in element classes); their IDs are what a `variant` record must use, and `class_name` is what the element emits |
|
|
99
99
|
| `data/dynamic-variables.csv` | 76 | source — every `@VAR('ns/name')` expression, by namespace |
|
|
100
100
|
| `data/evaluator-functions.csv` | 19 | source — the `@` functions with their arity |
|
|
101
101
|
| `data/interaction-types.csv` | 16 | source — trigger types, `timed` vs `progress`; 1.0.9 added exitIntent, scrollDepth and modal, 1.0.10 adds popover (Popover visibility change: show / beforeClose / afterClose) |
|
|
@@ -6,7 +6,7 @@ were measured on a live install.
|
|
|
6
6
|
|
|
7
7
|
## Variants: style every element of a kind, once
|
|
8
8
|
|
|
9
|
-
The
|
|
9
|
+
The 162 rows in `data/variants.csv` (re-captured on 1.0.14) are the **variant catalog** — Mosaic's built-in
|
|
10
10
|
taxonomy of what an element *is* (Heading 2, Button, Section, Div, Body …), each
|
|
11
11
|
carrying the CSS selectors that identify it and, since 1.0.8, the class name the
|
|
12
12
|
element emits (`class_name`: `m-heading-2`, `m-button`) and whether that name is
|
|
@@ -66,6 +66,27 @@ Three things learned the hard way:
|
|
|
66
66
|
`class_name` (`m-loop-item`) or a name, and refuses a name that matches more than
|
|
67
67
|
one row.
|
|
68
68
|
|
|
69
|
+
What the rows in `wp_mosaic_variants` are (1.0.14, demo, 2026-11-28):
|
|
70
|
+
|
|
71
|
+
- **One row per catalog entry the theme has saved, and `data: {}` is normal.** The
|
|
72
|
+
table holds this theme's style for a built-in variant; `{}` means "not styled".
|
|
73
|
+
`VariantsRevisionModel::getRevisionRecordsRaw()` reads only rows whose ID is in
|
|
74
|
+
the catalog, and a variant applies by element type, not because a node names it -
|
|
75
|
+
so "no node references this variant" is not an orphan. The demo's main theme had
|
|
76
|
+
157 rows, 154 of them `{}` and named by no node.
|
|
77
|
+
- **The editor adds the rows a theme is missing when it saves.** After 1.0.12 split
|
|
78
|
+
the Select, creating one template in the editor added five `{}` rows - exactly the
|
|
79
|
+
five catalog entries 1.0.12 introduced (`Select` f93d34d2, `Toggle`, `Placeholder`,
|
|
80
|
+
`Options`, `Option`). They belong to the theme, not to the template, so deleting
|
|
81
|
+
the template leaves them; deleting them is harmless too (the editor writes them
|
|
82
|
+
again). The same template created and deleted by a REST commit added none - the
|
|
83
|
+
rows come from the editor's client, not from the server.
|
|
84
|
+
- **1.0.12 renamed the old Select variant.** `05fbeaf8…` was `Select` / `m-select`
|
|
85
|
+
and is now `List box` / `m-listbox` (its child `df2d64e1…` became
|
|
86
|
+
`m-listbox-option`); the new `select` node's variant is `f93d34d2…`. A style keyed
|
|
87
|
+
to the old ID now lands on the native list box. `data/variants.csv` was captured on
|
|
88
|
+
1.0.11 until 2026-11-28 and still showed the old names.
|
|
89
|
+
|
|
69
90
|
More from a client build on 1.0.10:
|
|
70
91
|
|
|
71
92
|
- **`HTML` and `Body` emit `html{…}` and `body{…}`**, and `customDeclarations` works
|
package/references/facts.md
CHANGED
|
@@ -494,3 +494,118 @@ also checked here against the 1.0.13 source.
|
|
|
494
494
|
- The `modal` open state is `:popover-open`, not `dialog[open]` (already above, under
|
|
495
495
|
1.0.10), and there is no `flex` style key (above, second site): both confirmed again
|
|
496
496
|
on this site.
|
|
497
|
+
|
|
498
|
+
## Measured on a fourth site (Mosaic 1.0.13, 2026-11-25)
|
|
499
|
+
|
|
500
|
+
From another site's conversion (an intro animation and a dark mode), handed to this
|
|
501
|
+
skill; each line says what was reproduced here on the demo site (Mosaic 1.0.14).
|
|
502
|
+
|
|
503
|
+
- **An interaction's target is a node ID, and an in-place sync used to break it.**
|
|
504
|
+
`settings.target = {"type": "element", "uuid": ...}` names the target node's `ID`.
|
|
505
|
+
`build_page.py` gives every pinned `nodeID` a fresh random uuid on each run, so a
|
|
506
|
+
spec never knows the live ids. `sync_nodes.py` before 1.42.0 wrote the spec's
|
|
507
|
+
interactions as they were: the targets named this run's random uuids, no node on
|
|
508
|
+
the site, and the animation did nothing (that site: an intro's curtain, horse and
|
|
509
|
+
logo stood still; only the wrapper faded). Reproduced on the demo: built with three
|
|
510
|
+
targets that existed, synced a duration change with 1.41.0 -> all three targets
|
|
511
|
+
MISSING; its read-back did say `@st-intro differs`, but next to two false
|
|
512
|
+
differences (below), so it read as noise. 1.42.0 rewrites spec ids to live ids
|
|
513
|
+
(spec `nodeID` -> attrID -> live `ID`) before writing, refuses a write whose target
|
|
514
|
+
is not a node of the document (or of the master, for a template), and fails the run
|
|
515
|
+
(exit 1) if a written node targets a missing node after the commit. Re-synced on
|
|
516
|
+
the demo with 1.42.0: the three targets were the live ids again, `document.getAnimations()`
|
|
517
|
+
in Chromium had an animation on each, and a dry run after it showed 0 differences.
|
|
518
|
+
- **Two tweens of the same property on one element do not chain.** At page load every
|
|
519
|
+
tween's `initial` is applied at once, so the later one's start value wins and the
|
|
520
|
+
first never shows. Demo, 1.0.14, Chromium: one element with `translateX` 0 -> 100px
|
|
521
|
+
(1.5 s) then 100px -> 200px (1.5 s, delay 1.5 s) stood at 100px from the first
|
|
522
|
+
sample (14 ms) until 1.5 s, then moved 100 -> 200px; a control with one tween
|
|
523
|
+
0 -> 200px over 3 s started at 0. Each tween is its own Web Animation (both on
|
|
524
|
+
`--mosaic-translate-x`). Use ONE tween with a longer duration (to
|
|
525
|
+
`calc(100vw + <width>)` for "runs off the screen") instead of two legs.
|
|
526
|
+
- **A variable-mode switch is an animation on `<html>`, and Chrome's visited-link
|
|
527
|
+
colour does not see it.** The mode-switch action is an `animation` action with a
|
|
528
|
+
`collectionMode` property meta (`tools/interactions.py` `mode_switch`), and it
|
|
529
|
+
runs as a Web Animation on `<html>` (the demo's `document.getAnimations()` lists one
|
|
530
|
+
targeting `HTML`). That site found that Chrome computes the colour of a VISITED link
|
|
531
|
+
without the animated values: after a switch to dark, links the visitor has opened
|
|
532
|
+
keep the light value and can disappear, and `getComputedStyle` cannot show it (it
|
|
533
|
+
reports the unvisited value, for privacy) - only a screenshot does. Its fix: after
|
|
534
|
+
every switch (and on load) copy the current value of each `--*` variable onto
|
|
535
|
+
`<html style>`. Reported by that site, not reproduced here (needs a theme with a
|
|
536
|
+
mode collection and a visited link).
|
|
537
|
+
- **A colour variable registered as `@property <color>` makes `var(--x, fallback)`
|
|
538
|
+
use the fallback on links** (that site: outlines and colours on `<a>` came out in the
|
|
539
|
+
fallback colour). Write colour variables without a fallback in generated CSS (font
|
|
540
|
+
variables are not affected). Reported by that site, not reproduced here.
|
|
541
|
+
- **Dark mode has to remap Mosaic's front-end colours too.** Mosaic's theme
|
|
542
|
+
stylesheet paints form fields from its own variables:
|
|
543
|
+
`input:where(:not([type=file],[type=checkbox],[type=radio])),textarea,select` get
|
|
544
|
+
`background-color: var(--mosaic-frontend-white)` (#ffffff), `color` from
|
|
545
|
+
`--mosaic-frontend-neutral-800` and the border from `-neutral-300`; `[type=checkbox],
|
|
546
|
+
[type=radio]` get the same white background, and a checked box is `-neutral-900` with
|
|
547
|
+
a `-white` tick (1.0.14 `themes/mosaic/public/style.css`). And
|
|
548
|
+
WooCommerce's fields use its own `--wc-form-color-*`. Without setting those on
|
|
549
|
+
`:root` for the dark mode, inputs and checkboxes stay white (that site). Map
|
|
550
|
+
`--mosaic-frontend-white`, `--mosaic-frontend-black`, `--mosaic-frontend-neutral-*`
|
|
551
|
+
and `--wc-form-color-*` to the mode's tokens.
|
|
552
|
+
- **Stored values `sync_nodes.py` now treats as equal** (demo, 1.0.14): `opacity ".35"`
|
|
553
|
+
is stored `"0.35"`; `url(x)` in `customDeclarations` is stored `url("x")`; an `rgba()`
|
|
554
|
+
keeps `.85` but gains spaces. And **`rel` must be a list**: on a `wysiwyg-link`,
|
|
555
|
+
`"rel": "noopener"` was stored as null and `["noopener"]` was kept (its validator is
|
|
556
|
+
`ValidatorArray`; `data/node-property-verification.csv` already had the list
|
|
557
|
+
APPLIED). `inline_html.py` and `from_elementor.py` wrote a string until 1.42.0, so
|
|
558
|
+
every converted `rel` was lost; they write a list now, and a sync treats an old
|
|
559
|
+
string `rel` against an empty one as no difference (with a note).
|
|
560
|
+
|
|
561
|
+
## No Mosaic template for the request -> HTTP 406 (demo, 2026-11-24 and 11-28)
|
|
562
|
+
|
|
563
|
+
The general rule (Mosaic 1.0.14): the Mosaic theme always loads its own `index.php`,
|
|
564
|
+
which looks up a template for the request's paths (the `X-Mosaic-Paths` header lists
|
|
565
|
+
them). When none matches - no template on that path, or one whose conditions fail -
|
|
566
|
+
`FrontendRenderer.php` (line 62) sends `status_header(406)` with an empty body for a
|
|
567
|
+
visitor, and a "Missing Mosaic template" page for a logged-in administrator. It is
|
|
568
|
+
not tied to any plugin; every case below is this rule.
|
|
569
|
+
|
|
570
|
+
- **Single post** (measured 2026-11-28, reported by another session filming on the
|
|
571
|
+
demo): the main theme had no `single-post.php` template, and a post answered 406
|
|
572
|
+
with or without a browser user agent. An Auto Single post template made it 200;
|
|
573
|
+
deleting the template made it 406 again. A template whose conditions do not match
|
|
574
|
+
the request (a query parameter the URL lacks) is the same as none: 406 without the
|
|
575
|
+
parameter, 200 with it.
|
|
576
|
+
- **WooCommerce store pages in coming-soon mode** - below. This one is a bug and not
|
|
577
|
+
only a missing template: WooCommerce has already printed its page, and Mosaic's
|
|
578
|
+
406 is sent on top of it.
|
|
579
|
+
|
|
580
|
+
What to do: give every path a visitor can reach a template, or keep a Fallback
|
|
581
|
+
(`index.php`, the editor's Empty) template as the catch-all
|
|
582
|
+
(`references/templates-and-conditions.md`). `verify_navigation.py` reports a 406 for
|
|
583
|
+
each page with no template; only a logged-out request shows it.
|
|
584
|
+
|
|
585
|
+
### WooCommerce "coming soon" + Mosaic: store pages answer 406 (demo, 2026-11-24)
|
|
586
|
+
|
|
587
|
+
Traced in source and read on the demo (Mosaic 1.0.14, WooCommerce 11.2, read only):
|
|
588
|
+
with WooCommerce's coming-soon mode on for **store pages only**, `/shop/` and every
|
|
589
|
+
product page answer **HTTP 406** on their plain URL.
|
|
590
|
+
|
|
591
|
+
- WooCommerce renders its coming-soon page itself and then returns `''` from the
|
|
592
|
+
`template_include` filter (`ComingSoonRequestHandler.php`, line 117) so WordPress
|
|
593
|
+
loads no theme template.
|
|
594
|
+
- Mosaic's theme ignores that and forces its own `index.php`
|
|
595
|
+
(`themes/mosaic/functions.php`, line 54).
|
|
596
|
+
- With no Mosaic template for the store (`archive-product` / `single-product`, nor a
|
|
597
|
+
generic archive / index one), the renderer throws `TemplateNotFoundException` and
|
|
598
|
+
`FrontendRenderer.php` (line 62) sends `status_header(406)`.
|
|
599
|
+
- **A query string hides it.** Re-read 2026-11-28, both uncached (`X-Cache: MISS`):
|
|
600
|
+
`/shop/` answered 406 with `Cache-Control: no-store, no-cache…`, and `/shop/?x=1`
|
|
601
|
+
answered 200 with WooCommerce's own `max-age=60` - the same coming-soon page both
|
|
602
|
+
times. So a health check that adds a cache-busting query string reports 200 for a
|
|
603
|
+
page every visitor gets as 406; check the plain URL. `verify_navigation.py` adds
|
|
604
|
+
`?_v=`, so it misses this case (a post with no template stays 406 with a query
|
|
605
|
+
string - only coming-soon flips). (The 11-24 note here called the query-string 200
|
|
606
|
+
a cached copy; the 11-28 re-read shows it was not cached.)
|
|
607
|
+
|
|
608
|
+
What to do: take the store out of coming-soon mode (go live), and give the store its
|
|
609
|
+
Mosaic templates. Not measured: a store page that DOES have a Mosaic template while
|
|
610
|
+
coming-soon is on may print two documents (WooCommerce's page and Mosaic's) - the
|
|
611
|
+
code predicts it; testing it needs a store template written on the demo.
|
|
@@ -78,6 +78,14 @@ editor's drag-to-reorder. The editor's fallback types map to paths as Single →
|
|
|
78
78
|
`index.php`. Masters order the same way: the first master by `ordering` is the one
|
|
79
79
|
a new template is offered by default.
|
|
80
80
|
|
|
81
|
+
**A new template with an `ordering` already taken renumbers the whole list.**
|
|
82
|
+
Committed with `ordering: "a0"` on a theme of 123 templates (1.0.14, demo,
|
|
83
|
+
2026-11-28), the new row went first and 90 other templates got a new `ordering`
|
|
84
|
+
string, a new `revision` and a new `modified_gmt`. Their relative order stayed the
|
|
85
|
+
same, so routing did not change, and deleting the new template did not put the old
|
|
86
|
+
strings back. A table checksum taken before such a commit will not match after it.
|
|
87
|
+
To leave the other rows alone, use an `ordering` after the last one.
|
|
88
|
+
|
|
81
89
|
**A template_assigns row with empty `parentID` and `parentType` binds nothing.** It is
|
|
82
90
|
what the editor writes for "Auto template" (`TemplateAssign` treats it as
|
|
83
91
|
auto-assigned and `Post::getAssignedTemplateID` skips it), so do not count it as a
|
|
@@ -92,6 +100,28 @@ One consequence worth knowing: **that endpoint creates a new template every time
|
|
|
92
100
|
Calling it twice for the same post leaves two template rows and one assign row —
|
|
93
101
|
`tools/build_all.py` resets the theme before rebuilding for exactly this reason.
|
|
94
102
|
|
|
103
|
+
**The editor offers Manual only for the post types in a site setting.** The Assign
|
|
104
|
+
choice, the post list's "Edit in Mosaic" link and the block editor's template panel
|
|
105
|
+
all ask `PostEdit::isManualAssignEnabledForPostType()`, which reads
|
|
106
|
+
`manualAssignEnabledForPostTypes` (Mosaic → Settings, `references/write-protocol.md`).
|
|
107
|
+
With nothing saved there the default is **`page` only**
|
|
108
|
+
(`PostEdit::getDefaultManualAssignedPostTypes()`), so on a stock 1.0.14 site a Single
|
|
109
|
+
post template can only be Auto - the dialog has no Manual (seen on the demo,
|
|
110
|
+
2026-11-28, where the setting was never saved). To limit an Auto post template, use
|
|
111
|
+
its conditions: query parameter, Cookie, current user, category, tag, post format,
|
|
112
|
+
product (`mo.py conditions --context template`). Or add `post` to the setting.
|
|
113
|
+
|
|
114
|
+
**The editor reads a template's variables from the front end, through the
|
|
115
|
+
template's conditions.** The variable list (Post data and so on) comes from the post's
|
|
116
|
+
own URL with `?mosaic_frontend_action=TemplatingContext`
|
|
117
|
+
(`ActionTemplatingContext`), and that request picks the template the same way a visit
|
|
118
|
+
does. If the template's conditions do not match that request - a query-parameter
|
|
119
|
+
condition the editor's request does not carry, say - Mosaic finds no template and
|
|
120
|
+
answers `templateNotExists`, and the editor shows **no variables at all**. Measured on
|
|
121
|
+
the demo (2026-11-28): with the condition `m17demo = 1` the editor had no variables;
|
|
122
|
+
with the condition removed they appeared. Build the layout without the condition and
|
|
123
|
+
add it last, or set the variables by hand (`references/dynamic-content.md`).
|
|
124
|
+
|
|
95
125
|
## The condition structure
|
|
96
126
|
|
|
97
127
|
The same shape drives template routing, element visibility (`node.data.conditions`),
|
package/references/tools.md
CHANGED
|
@@ -40,7 +40,7 @@ Every tool in `tools/`, and where the REST session comes from. Moved out of SKIL
|
|
|
40
40
|
| `verify_dialog.py` | the modal in a real browser (1.0.9 and 1.0.10 alike: open is read as `:popover-open` or `dialog.open`): does it open, close, answer Esc, remember, cap - and does an OpenStreetMap carry the coordinates it was given |
|
|
41
41
|
| `verify_popovers.py` | 1.0.10's popover in a real browser: opens, lands where its positioning says, blocks nothing, closes the way closedby says, flips, chains, and ends - every check reads `:popover-open`, never an attribute |
|
|
42
42
|
| `verify_dialog_lab.py` | the question after "does the modal work": can three nodes be made into a bottom sheet, a side drawer, a corner notice, a full takeover and a gate with no way out - and does each one still fit at phone width, which the page's own width check cannot see |
|
|
43
|
-
| `sync_nodes.py` | update a built site IN PLACE: matches the spec to the live master and each page's template by `attrID`, commits only the nodes whose data changed, rebuilds a page's template when its structure changed (one commit, or new tree first and old removed after in batches of 150), refuses a site split across masters or a document with two roots, saves every document's JSON before writing, re-reads and verifies after. Dry run unless `--apply`; `--attr a,b` limits the comparison and the writes to those subtrees. Before comparing it normalises what Mosaic rewrites on save (re-spaced CSS and colours, rewritten svg, keys a type does not keep, interaction ids, build_page's random list-item uuids) and leaves alone the children heal inserts (references/facts.md, third site). Read the dry run before `--apply`: it should list only what you changed. `build_site.py` makes a new master every run, so use this for any change to a site that is already built |
|
|
43
|
+
| `sync_nodes.py` | update a built site IN PLACE: matches the spec to the live master and each page's template by `attrID`, commits only the nodes whose data changed, rebuilds a page's template when its structure changed (one commit, or new tree first and old removed after in batches of 150), refuses a site split across masters or a document with two roots, saves every document's JSON before writing, re-reads and verifies after. Dry run unless `--apply`; `--attr a,b` limits the comparison and the writes to those subtrees. Before comparing it normalises what Mosaic rewrites on save (re-spaced CSS and colours, rewritten svg, keys a type does not keep, interaction ids, build_page's random list-item uuids) and leaves alone the children heal inserts (references/facts.md, third site). Interaction targets (`settings.target = {"type": "element", "uuid": ...}`) and any other reference to a spec node are rewritten to the live node's id before writing (spec `nodeID` -> attrID -> live id); a target that would name a node not in the document (or, for a template, its master) is refused before the commit and fails the run after it (exit 1). Read the dry run before `--apply`: it should list only what you changed. `build_site.py` makes a new master every run, so use this for any change to a site that is already built |
|
|
44
44
|
| `list_bindings.php` | read only, `wp eval-file tools/list_bindings.php <themeID> > bindings.json`: which template and master serve each post (`wp_mosaic_template_assigns`, which the REST API does not list) - the input `sync_nodes.py` needs |
|
|
45
45
|
| `verify_lightbox.py` | the WooCommerce product-image lightbox (PhotoSwipe) at 390 / 820 / 1024 / 1440px: close button flush with the toolbar's top-right corner, counter top-left, spinner out of the flow - WooCommerce's own skin breaks the first at 1024px and below (references/standard-fixes.md) |
|
|
46
46
|
| `verify_sticky.py` | a sticky element while the page scrolls: rectangle intersection with every `--avoid` element at each step, never past its `--bound` container, actually stuck at `--top` - a computed `position: sticky` passes a column that rides over the whole page |
|
package/tools/from_elementor.py
CHANGED
|
@@ -284,7 +284,7 @@ def as_button(el, ctx):
|
|
|
284
284
|
if link.get("is_external"):
|
|
285
285
|
data["target"] = "_blank"
|
|
286
286
|
if link.get("nofollow"):
|
|
287
|
-
data["rel"] = "nofollow"
|
|
287
|
+
data["rel"] = ["nofollow"] # a list; a string is dropped on save
|
|
288
288
|
node = {"type": "button", "data": data,
|
|
289
289
|
"children": inline_children(s.get("text") or s.get("button_text") or "")}
|
|
290
290
|
extra = {}
|
|
@@ -440,7 +440,7 @@ class Ctx:
|
|
|
440
440
|
if link.get("is_external"):
|
|
441
441
|
data["target"] = "_blank"
|
|
442
442
|
if link.get("nofollow"):
|
|
443
|
-
data["rel"] = "nofollow"
|
|
443
|
+
data["rel"] = ["nofollow"] # a list; a string is dropped on save
|
|
444
444
|
return {"type": "menu-link", "data": data, "children": [node]}
|
|
445
445
|
|
|
446
446
|
def note(self, el, why):
|
package/tools/inline_html.py
CHANGED
|
@@ -95,7 +95,8 @@ def _inline(nodes):
|
|
|
95
95
|
if attrs.get("target") in ("_self", "_blank", "_parent", "_top"):
|
|
96
96
|
data["target"] = attrs["target"]
|
|
97
97
|
if attrs.get("rel"):
|
|
98
|
-
|
|
98
|
+
# a list: rel's validator is ValidatorArray, a string is dropped on save
|
|
99
|
+
data["rel"] = attrs["rel"].split()
|
|
99
100
|
out.append({"type": "wysiwyg-link", "data": data, "children": _inline(kids)})
|
|
100
101
|
elif tag in SPAN_STYLE:
|
|
101
102
|
out.append({"type": "wysiwyg-span", "data": {},
|
package/tools/sync_nodes.py
CHANGED
|
@@ -18,7 +18,9 @@ What this does, per document (the shared master, and each page's own template):
|
|
|
18
18
|
is written to compute them - and matches spec nodes to live nodes by `attrID`
|
|
19
19
|
(nodes without one by their position under the nearest node that has one);
|
|
20
20
|
3. same structure, different content -> one commit to that document updating only
|
|
21
|
-
the nodes that differ (each node's top-level data keys the spec sets)
|
|
21
|
+
the nodes that differ (each node's top-level data keys the spec sets), with every
|
|
22
|
+
spec node id inside the written data - an interaction's target above all -
|
|
23
|
+
rewritten to the id of the live node it was matched to;
|
|
22
24
|
4. different structure in a PAGE -> that page's template is rebuilt in ONE commit
|
|
23
25
|
(old nodes deleted and new ones created together, so the page is never served
|
|
24
26
|
empty), on the master it already has. A structural change in the master's header
|
|
@@ -27,9 +29,11 @@ What this does, per document (the shared master, and each page's own template):
|
|
|
27
29
|
Safety: dry run unless --apply. Before writing, every document it will touch is
|
|
28
30
|
saved as JSON under --backup (a restore source; also take `wp db export` of
|
|
29
31
|
wp_mosaic_nodes on the host). It refuses a site whose pages sit on more than one
|
|
30
|
-
master.
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
master. Before a commit, every element target in it must name a node of the
|
|
33
|
+
document (or of the master, for a template). After writing it re-reads each
|
|
34
|
+
document: no extra root, no component instance newly reduced to override shells,
|
|
35
|
+
no written node targeting a node that does not exist, and the diff now empty -
|
|
36
|
+
otherwise exit 1. It writes only through the editor's REST routes (an admin request), never
|
|
33
37
|
from a front-end render. Pages that use components can be content-synced but not
|
|
34
38
|
rebuilt here (their overrides need build_site.py's override pass).
|
|
35
39
|
|
|
@@ -76,6 +80,11 @@ UUID_RE = re.compile(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]
|
|
|
76
80
|
TAG_RE = re.compile(r"<([A-Za-z][\w:.-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:\"[^\"]*\"|'[^']*'|[^\s>]+))?)*)\s*(/?)>")
|
|
77
81
|
ATTR_RE = re.compile(r"([^\s=>/]+)(?:\s*=\s*(\"[^\"]*\"|'[^']*'|[^\s>]+))?")
|
|
78
82
|
COLOR_FN_RE = re.compile(r"^\s*(?:rgba?|hsla?)\(", re.I)
|
|
83
|
+
LEAD_DOT_RE = re.compile(r"(?<![\w.])\.(\d)")
|
|
84
|
+
URL_ARG_RE = re.compile(r"url\((\"?)([^\")]*)\1\)")
|
|
85
|
+
NUMBERISH_RE = re.compile(r"^[-+]?(?:\d*\.)?\d+[a-z%]*$", re.I)
|
|
86
|
+
# Text keys: words, not values; .35 inside a sentence is left alone.
|
|
87
|
+
TEXT_KEYS = {"text", "v", "url", "alt", "title", "label", "placeholder"}
|
|
79
88
|
# Data keys a node type does not keep: sent, accepted, and stored as null (button and
|
|
80
89
|
# menu-link `attributes`, a form label's `forInput`, tabs-menu `accessibleLabel`;
|
|
81
90
|
# measured 2026-11-21). Compared only when the site does hold a value for them.
|
|
@@ -114,8 +123,15 @@ def css_norm(text: str) -> str:
|
|
|
114
123
|
# the spaces around them are significant.
|
|
115
124
|
text = (text or "").replace("'", '"')
|
|
116
125
|
text = re.sub(r"\s+", " ", text).strip()
|
|
117
|
-
text = re.sub(r"\s*([:;,{}()
|
|
118
|
-
|
|
126
|
+
text = re.sub(r"\s*([:;,{}()/!>])\s*", r"\1", text)
|
|
127
|
+
text = re.sub(r";+", ";", text)
|
|
128
|
+
text = URL_ARG_RE.sub(lambda m: 'url("%s")' % m.group(2), text) # url(x) is stored as url("x")
|
|
129
|
+
return lead_zero(text).rstrip(";")
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def lead_zero(text: str) -> str:
|
|
133
|
+
""".35 and 0.35 are the same number; Mosaic stores 0.35 for a style value of .35."""
|
|
134
|
+
return LEAD_DOT_RE.sub(r"0.\1", text)
|
|
119
135
|
|
|
120
136
|
|
|
121
137
|
def svg_norm(text: str) -> str:
|
|
@@ -138,6 +154,68 @@ def svg_norm(text: str) -> str:
|
|
|
138
154
|
return re.sub(r">\s+<", "><", re.sub(r"\s+", " ", text)).strip()
|
|
139
155
|
|
|
140
156
|
|
|
157
|
+
def remap_ids(value, id_map: dict):
|
|
158
|
+
"""A copy of a spec data value with every spec node id replaced by the live id of the
|
|
159
|
+
node it was matched to. refresh_node_ids gives each pinned nodeID a NEW random uuid on
|
|
160
|
+
every run, and an interaction's `settings.target = {"type": "element", "uuid": ...}`
|
|
161
|
+
carries that uuid; written as is, the target names a node that is not on the site and
|
|
162
|
+
the animation silently does nothing (live site, 2026-11-25: three elements stopped)."""
|
|
163
|
+
def walk(v):
|
|
164
|
+
if isinstance(v, dict):
|
|
165
|
+
return {(id_map.get(k.lower(), k) if isinstance(k, str) else k): walk(x) for k, x in v.items()}
|
|
166
|
+
if isinstance(v, list):
|
|
167
|
+
return [walk(x) for x in v]
|
|
168
|
+
if isinstance(v, str):
|
|
169
|
+
return id_map.get(v.lower(), v)
|
|
170
|
+
return v
|
|
171
|
+
return walk(value)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def id_strings(value) -> set:
|
|
175
|
+
"""Every string (and dict key) in a value, lower-cased: to find spec ids left in it."""
|
|
176
|
+
out = set()
|
|
177
|
+
|
|
178
|
+
def walk(v):
|
|
179
|
+
if isinstance(v, dict):
|
|
180
|
+
for k, x in v.items():
|
|
181
|
+
if isinstance(k, str):
|
|
182
|
+
out.add(k.lower())
|
|
183
|
+
walk(x)
|
|
184
|
+
elif isinstance(v, list):
|
|
185
|
+
for x in v:
|
|
186
|
+
walk(x)
|
|
187
|
+
elif isinstance(v, str):
|
|
188
|
+
out.add(v.lower())
|
|
189
|
+
walk(value)
|
|
190
|
+
return out
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def element_targets(value) -> list[str]:
|
|
194
|
+
"""The node ids a value points at: every {"type": "element", "uuid": <id>}."""
|
|
195
|
+
out = []
|
|
196
|
+
|
|
197
|
+
def walk(v):
|
|
198
|
+
if isinstance(v, dict):
|
|
199
|
+
t = v.get("target")
|
|
200
|
+
if isinstance(t, dict) and t.get("type") == "element" and isinstance(t.get("uuid"), str):
|
|
201
|
+
out.append(t["uuid"])
|
|
202
|
+
for x in v.values():
|
|
203
|
+
walk(x)
|
|
204
|
+
elif isinstance(v, list):
|
|
205
|
+
for x in v:
|
|
206
|
+
walk(x)
|
|
207
|
+
walk(value)
|
|
208
|
+
return out
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def dangling_targets(nodes: list[dict], also=()) -> list[tuple[dict, str]]:
|
|
212
|
+
"""(node, target id) for every element target that is not a live node of this document
|
|
213
|
+
(or of `also`: the master's node ids, for a template)."""
|
|
214
|
+
known = {n["ID"].lower() for n in nodes if n.get("status") != "delete"} | {x.lower() for x in also}
|
|
215
|
+
return [(n, t) for n in nodes if n.get("status") != "delete"
|
|
216
|
+
for t in element_targets(n.get("data") or {}) if t.lower() not in known]
|
|
217
|
+
|
|
218
|
+
|
|
141
219
|
def normalise(value, id_map: dict, stable: set, key=None):
|
|
142
220
|
"""A comparable copy of one data value: spec node ids mapped to live ones, run-random
|
|
143
221
|
uuids renamed in order of appearance, CSS and SVG text normalised."""
|
|
@@ -174,7 +252,9 @@ def normalise(value, id_map: dict, stable: set, key=None):
|
|
|
174
252
|
if key == "svg":
|
|
175
253
|
return svg_norm(v)
|
|
176
254
|
if COLOR_FN_RE.match(v): # rgba(0, 0, 0, 0) is stored for rgba(0,0,0,0)
|
|
177
|
-
return re.sub(r"\s+", "", v)
|
|
255
|
+
return lead_zero(re.sub(r"\s+", "", v))
|
|
256
|
+
if key not in TEXT_KEYS and NUMBERISH_RE.match(v.strip()):
|
|
257
|
+
return lead_zero(v.strip()) # opacity ".35" is stored as "0.35"
|
|
178
258
|
return u(v)
|
|
179
259
|
return v
|
|
180
260
|
return walk(value, key)
|
|
@@ -274,13 +354,19 @@ def plan(spec_records: list[dict], spec_top: str, live_nodes: list[dict], live_t
|
|
|
274
354
|
if struct:
|
|
275
355
|
return False, struct, updates, notes
|
|
276
356
|
id_map = {s["ID"].lower(): l["ID"].lower() for s, l, _, _ in pairs}
|
|
357
|
+
write_map = {s["ID"].lower(): l["ID"] for s, l, _, _ in pairs}
|
|
358
|
+
unmatched = {r["ID"].lower() for r in spec_records} - set(id_map)
|
|
277
359
|
stable = stable_uuids() | {v.lower() for v in VAR_IDS.values()} | {l["ID"].lower() for _, l, _, _ in pairs}
|
|
278
360
|
for s, l, key, anc in pairs:
|
|
279
361
|
if not inside(key, anc):
|
|
280
362
|
continue
|
|
281
363
|
sd, ld = s.get("data") or {}, l.get("data") or {}
|
|
364
|
+
if isinstance(sd.get("rel"), str) and ld.get("rel") in (None, [], ""):
|
|
365
|
+
notes.append("%s: rel %r is a string - Mosaic keeps rel only as a list (%r); not counted"
|
|
366
|
+
% (key, sd["rel"], sd["rel"].split()))
|
|
282
367
|
changed = [k for k in sd
|
|
283
368
|
if not (k in DROPPED_ON_SAVE and ld.get(k) in (None, [], ""))
|
|
369
|
+
and not (k == "rel" and isinstance(sd[k], str) and ld.get(k) in (None, [], ""))
|
|
284
370
|
and json.dumps(normalise(sd[k], id_map, stable, k), sort_keys=True)
|
|
285
371
|
!= json.dumps(normalise(ld.get(k), id_map, stable, k), sort_keys=True)]
|
|
286
372
|
extra_keys = [k for k in ld if k not in sd]
|
|
@@ -288,8 +374,17 @@ def plan(spec_records: list[dict], spec_top: str, live_nodes: list[dict], live_t
|
|
|
288
374
|
notes.append("%s keeps live-only keys %s" % (key, ", ".join(extra_keys)))
|
|
289
375
|
if changed:
|
|
290
376
|
merged = dict(ld)
|
|
291
|
-
|
|
377
|
+
# spec node ids -> live ids, so an interaction target names the node that is
|
|
378
|
+
# actually on the site, not this run's random uuid
|
|
379
|
+
merged.update({k: remap_ids(sd[k], write_map) for k in changed})
|
|
380
|
+
lost = id_strings({k: merged[k] for k in changed}) & unmatched
|
|
381
|
+
if lost:
|
|
382
|
+
struct.append("%s: %s points at spec node(s) not on the site (%s) - a target "
|
|
383
|
+
"outside --attr that does not exist yet?" % (key, ", ".join(changed), ", ".join(sorted(lost))[:80]))
|
|
384
|
+
continue
|
|
292
385
|
updates.append((dict(l, _key=key), merged, changed))
|
|
386
|
+
if struct:
|
|
387
|
+
return False, struct, [], notes
|
|
293
388
|
return True, struct, updates, notes
|
|
294
389
|
|
|
295
390
|
|
|
@@ -348,6 +443,7 @@ class Run:
|
|
|
348
443
|
self.batch, self.pause = max(1, batch), max(0.0, pause)
|
|
349
444
|
self.failed = False
|
|
350
445
|
self.wrote = 0
|
|
446
|
+
self._master_ids: dict[str, set] = {}
|
|
351
447
|
|
|
352
448
|
def commit_batches(self, instance: str, what: str, key: str, records: list[dict], label: str) -> bool:
|
|
353
449
|
"""Commit in batches of self.batch records: one request carrying ~420 deletes was
|
|
@@ -371,6 +467,14 @@ class Run:
|
|
|
371
467
|
return False
|
|
372
468
|
return True
|
|
373
469
|
|
|
470
|
+
def master_ids(self, master_id: str) -> set:
|
|
471
|
+
"""The master's node ids: a template's interaction may target a header node."""
|
|
472
|
+
if master_id not in self._master_ids:
|
|
473
|
+
doc = self.read("masterDocumentInstance/%s" % master_id, "masterDocumentInstance")
|
|
474
|
+
self._master_ids[master_id] = {n["ID"] for n in doc.get("node/master/%s" % master_id) or []
|
|
475
|
+
if n.get("status") != "delete"}
|
|
476
|
+
return self._master_ids[master_id]
|
|
477
|
+
|
|
374
478
|
def read(self, instance: str, what: str) -> dict:
|
|
375
479
|
return unwrap(self.client.get(instance), what)
|
|
376
480
|
|
|
@@ -390,12 +494,44 @@ class Run:
|
|
|
390
494
|
self.wrote += 1
|
|
391
495
|
return True
|
|
392
496
|
|
|
393
|
-
def
|
|
497
|
+
def targets_ok(self, label: str, records: list[dict], live_ids: set, also=()) -> bool:
|
|
498
|
+
"""Before a commit: every element target in what is about to be written names a
|
|
499
|
+
node that will exist (live, or created in this same write)."""
|
|
500
|
+
known = {x.lower() for x in live_ids} | {x.lower() for x in also}
|
|
501
|
+
known |= {r["newRevisionRecord"]["ID"].lower() for r in records
|
|
502
|
+
if r["newRevisionRecord"].get("status") != "delete"}
|
|
503
|
+
known -= {r["newRevisionRecord"]["ID"].lower() for r in records
|
|
504
|
+
if r["newRevisionRecord"].get("status") == "delete"}
|
|
505
|
+
bad = [(r["newRevisionRecord"], t) for r in records if r["newRevisionRecord"].get("status") != "delete"
|
|
506
|
+
for t in element_targets(r["newRevisionRecord"].get("data") or {}) if t.lower() not in known]
|
|
507
|
+
for n, t in bad[:8]:
|
|
508
|
+
print(" REFUSE %s: %s targets %s, which is not on the site" % (label, (n.get("data") or {}).get("attrID") or n["ID"][:8], t))
|
|
509
|
+
if bad:
|
|
510
|
+
self.failed = True
|
|
511
|
+
return not bad
|
|
512
|
+
|
|
513
|
+
def verify(self, instance: str, what: str, key: str, before_shells: int, recheck,
|
|
514
|
+
wrote=(), also=()) -> None:
|
|
394
515
|
doc = self.read(instance, what)
|
|
395
516
|
nodes = doc.get(key) or []
|
|
396
517
|
if extra_roots(nodes):
|
|
397
518
|
print(" FAIL %s now has more than one root" % what)
|
|
398
519
|
self.failed = True
|
|
520
|
+
# The data diff alone can miss a target that points nowhere (both sides can carry
|
|
521
|
+
# an id that is not a node), so every element target is checked against the
|
|
522
|
+
# document's node ids (and the master's, for a template).
|
|
523
|
+
wrote = {x.lower() for x in wrote}
|
|
524
|
+
mine, older = [], []
|
|
525
|
+
for n, t in dangling_targets(nodes, also):
|
|
526
|
+
(mine if n["ID"].lower() in wrote else older).append((n, t))
|
|
527
|
+
for n, t in mine[:8]:
|
|
528
|
+
print(" FAIL %s: %s targets %s - no such node in the document"
|
|
529
|
+
% (what, (n.get("data") or {}).get("attrID") or n["ID"][:8], t))
|
|
530
|
+
if mine:
|
|
531
|
+
self.failed = True
|
|
532
|
+
for n, t in older[:8]:
|
|
533
|
+
print(" note %s: %s (not written by this run) targets %s - no such node"
|
|
534
|
+
% (what, (n.get("data") or {}).get("attrID") or n["ID"][:8], t))
|
|
399
535
|
after = all_shell_instances(nodes)
|
|
400
536
|
if after > before_shells:
|
|
401
537
|
print(" FAIL %s: %d component instance(s) newly reduced to override shells - restore from %s"
|
|
@@ -447,11 +583,13 @@ def sync_shell(run: Run, site: dict, master_id: str, surface, comps) -> None:
|
|
|
447
583
|
print(" update %s %s (%s)" % (ln["_key"], ln["type"], ", ".join(changed)))
|
|
448
584
|
if not (updates and run.apply):
|
|
449
585
|
return
|
|
450
|
-
print(" backup %s" % run.save(label, doc))
|
|
451
586
|
before = all_shell_instances(nodes)
|
|
452
587
|
records = [{"newRevisionRecord": {k: v for k, v in dict(ln, data=merged).items() if not k.startswith("_")},
|
|
453
588
|
"originalRevisionRecord": {k: v for k, v in ln.items() if not k.startswith("_")}}
|
|
454
589
|
for ln, merged, _ in updates]
|
|
590
|
+
if not run.targets_ok(label, records, {n["ID"] for n in nodes if n.get("status") != "delete"}):
|
|
591
|
+
return
|
|
592
|
+
print(" backup %s" % run.save(label, doc))
|
|
455
593
|
if run.commit_batches(instance, "masterDocumentInstance", key, records, label):
|
|
456
594
|
def recheck(new_nodes):
|
|
457
595
|
left = []
|
|
@@ -460,7 +598,8 @@ def sync_shell(run: Run, site: dict, master_id: str, surface, comps) -> None:
|
|
|
460
598
|
same, struct, ups, _ = plan(recs, "SPEC-TOP", new_nodes, region_parent[region], run.attrs)
|
|
461
599
|
left += struct + ["%s differs" % u[0]["_key"] for u in ups]
|
|
462
600
|
return left
|
|
463
|
-
run.verify(instance, "masterDocumentInstance", key, before, recheck
|
|
601
|
+
run.verify(instance, "masterDocumentInstance", key, before, recheck,
|
|
602
|
+
wrote={r["newRevisionRecord"]["ID"] for r in records})
|
|
464
603
|
|
|
465
604
|
|
|
466
605
|
def sync_page(run: Run, page: dict, binding: dict, surface, comps) -> None:
|
|
@@ -490,10 +629,13 @@ def sync_page(run: Run, page: dict, binding: dict, surface, comps) -> None:
|
|
|
490
629
|
print(" update %s %s (%s)" % (ln["_key"], ln["type"], ", ".join(changed)))
|
|
491
630
|
if not (updates and run.apply):
|
|
492
631
|
return
|
|
493
|
-
print(" backup %s" % run.save(label, doc))
|
|
494
632
|
records = [{"newRevisionRecord": {k: v for k, v in dict(ln, data=merged).items() if not k.startswith("_")},
|
|
495
633
|
"originalRevisionRecord": {k: v for k, v in ln.items() if not k.startswith("_")}}
|
|
496
634
|
for ln, merged, _ in updates]
|
|
635
|
+
if not run.targets_ok(label, records, {n["ID"] for n in nodes if n.get("status") != "delete"},
|
|
636
|
+
run.master_ids(master_id)):
|
|
637
|
+
return
|
|
638
|
+
print(" backup %s" % run.save(label, doc))
|
|
497
639
|
ok = run.commit_batches(instance, "templateDocumentInstance", key, records, label)
|
|
498
640
|
else:
|
|
499
641
|
print("%s: structure changed (%d difference(s)) - rebuild template %s on master %s"
|
|
@@ -519,6 +661,10 @@ def sync_page(run: Run, page: dict, binding: dict, surface, comps) -> None:
|
|
|
519
661
|
deletes = [{"newRevisionRecord": dict(n, status="delete"), "originalRevisionRecord": n}
|
|
520
662
|
for n in depth_order(old)]
|
|
521
663
|
creates = [{"newRevisionRecord": r, "originalRevisionRecord": None} for r in new] # parents first
|
|
664
|
+
records = deletes + creates
|
|
665
|
+
if not run.targets_ok(label, records, {n["ID"] for n in nodes if n.get("status") != "delete"},
|
|
666
|
+
run.master_ids(master_id)):
|
|
667
|
+
return
|
|
522
668
|
if len(deletes) + len(creates) <= run.batch:
|
|
523
669
|
ok = run.commit(instance, doc, key, deletes + creates, label)
|
|
524
670
|
how = "in one commit"
|
|
@@ -536,7 +682,8 @@ def sync_page(run: Run, page: dict, binding: dict, surface, comps) -> None:
|
|
|
536
682
|
new_root = next((n for n in new_nodes if n["type"] == "template-internal" and n.get("status") != "delete"), None)
|
|
537
683
|
s2, st2, ups2, _ = plan(r2, "SPEC-TOP", new_nodes, new_root["ID"] if new_root else "", run.attrs)
|
|
538
684
|
return st2 + ["%s differs" % u[0]["_key"] for u in ups2]
|
|
539
|
-
run.verify(instance, "templateDocumentInstance", key, before, recheck
|
|
685
|
+
run.verify(instance, "templateDocumentInstance", key, before, recheck,
|
|
686
|
+
wrote={r["newRevisionRecord"]["ID"] for r in records}, also=run.master_ids(master_id))
|
|
540
687
|
body = run.client.page(page["slug"])
|
|
541
688
|
print(" page %s: %s, %d bytes" % (page["slug"], "OK" if len(body) >= MIN_HEALTHY_BYTES else "BROKEN", len(body)))
|
|
542
689
|
if len(body) < MIN_HEALTHY_BYTES:
|
package/tools/test_mosaic.py
CHANGED
|
@@ -588,6 +588,89 @@ class SyncNodesPlan(unittest.TestCase):
|
|
|
588
588
|
self.assertNotEqual(self.sn.svg_norm('<svg a="1"><path d="M0"/></svg>'),
|
|
589
589
|
self.sn.svg_norm('<svg a="1"><path d="M1"/></svg>'))
|
|
590
590
|
|
|
591
|
+
# 2026-11-25, live site: a sync of a changed intro animation wrote run-random uuids
|
|
592
|
+
# into settings.target, so three animated elements pointed at nodes that do not exist
|
|
593
|
+
def opener_spec(self, duration):
|
|
594
|
+
t = self.rich_tree()
|
|
595
|
+
opener = t["children"][-1]
|
|
596
|
+
opener["data"]["interactions"][0]["settings"]["duration"] = duration
|
|
597
|
+
return t
|
|
598
|
+
|
|
599
|
+
def test_interaction_target_is_written_as_the_live_id(self):
|
|
600
|
+
live = self.as_stored(self.flat(self.opener_spec(300), "L"))
|
|
601
|
+
btn = next(n for n in live if (n.get("data") or {}).get("attrID") == "r-btn")
|
|
602
|
+
same, struct, updates, _ = self.sn.plan(self.flat(self.opener_spec(900), "S"), "S", live, "L")
|
|
603
|
+
self.assertTrue(same, struct)
|
|
604
|
+
self.assertEqual([(u[0]["data"].get("attrID"), u[2]) for u in updates], [("r-opener", ["interactions"])])
|
|
605
|
+
merged = updates[0][1]
|
|
606
|
+
self.assertEqual(self.sn.element_targets(merged), [btn["ID"]])
|
|
607
|
+
# and the document after that write has no dangling target
|
|
608
|
+
after = [dict(n, data=merged) if n["ID"] == updates[0][0]["ID"] else n for n in live]
|
|
609
|
+
self.assertEqual(self.sn.dangling_targets(after), [])
|
|
610
|
+
|
|
611
|
+
def test_the_old_write_left_a_dangling_target_and_is_caught(self):
|
|
612
|
+
# what 1.41.0 wrote: the spec's value as is - its target is this run's random uuid
|
|
613
|
+
live = self.as_stored(self.flat(self.opener_spec(300), "L"))
|
|
614
|
+
spec = self.flat(self.opener_spec(900), "S")
|
|
615
|
+
raw = next(r for r in spec if (r.get("data") or {}).get("attrID") == "r-opener")["data"]["interactions"]
|
|
616
|
+
after = [dict(n, data=dict(n["data"], interactions=raw))
|
|
617
|
+
if (n.get("data") or {}).get("attrID") == "r-opener" else n for n in live]
|
|
618
|
+
bad = self.sn.dangling_targets(after)
|
|
619
|
+
self.assertEqual(len(bad), 1)
|
|
620
|
+
self.assertEqual(bad[0][0]["data"]["attrID"], "r-opener")
|
|
621
|
+
# a target in the master counts as present for a template
|
|
622
|
+
self.assertEqual(self.sn.dangling_targets(after, also={bad[0][1]}), [])
|
|
623
|
+
|
|
624
|
+
def test_target_to_a_node_outside_attr_that_is_not_on_the_site_is_refused(self):
|
|
625
|
+
live = self.as_stored(self.flat(self.opener_spec(300), "L"))
|
|
626
|
+
spec = self.opener_spec(900)
|
|
627
|
+
spec["children"][4]["data"]["attrID"] = "r-btn-renamed" # the target is not on the site
|
|
628
|
+
same, struct, updates, _ = self.sn.plan(self.flat(spec, "S"), "S", live, "L", {"r-opener"})
|
|
629
|
+
self.assertFalse(same)
|
|
630
|
+
self.assertEqual(updates, [])
|
|
631
|
+
self.assertTrue(any("not on the site" in s for s in struct), struct)
|
|
632
|
+
|
|
633
|
+
def test_run_refuses_a_write_with_a_dangling_target(self):
|
|
634
|
+
run = self.sn.Run(None, True, "unused")
|
|
635
|
+
rec = {"newRevisionRecord": {"ID": "n1", "data": {"interactions": [
|
|
636
|
+
{"settings": {"target": {"type": "element", "uuid": "nowhere"}}}]}}, "originalRevisionRecord": None}
|
|
637
|
+
import contextlib
|
|
638
|
+
import io
|
|
639
|
+
with contextlib.redirect_stdout(io.StringIO()):
|
|
640
|
+
self.assertFalse(run.targets_ok("t", [rec], {"a", "b"}))
|
|
641
|
+
self.assertTrue(run.failed)
|
|
642
|
+
run2 = self.sn.Run(None, True, "unused")
|
|
643
|
+
self.assertTrue(run2.targets_ok("t", [rec], {"nowhere"}))
|
|
644
|
+
|
|
645
|
+
def test_stored_rewrites_are_not_differences(self):
|
|
646
|
+
# 2026-11-25, live site: opacity ".35" is stored "0.35"; url(x) as url("x");
|
|
647
|
+
# rgba(...,.85) keeps or drops its zero
|
|
648
|
+
self.assertEqual(self.sn.css_norm("mask:url(/a.webp) center/contain;transition:opacity .2s"),
|
|
649
|
+
self.sn.css_norm('mask: url("/a.webp") center / contain;\ntransition: opacity 0.2s;'))
|
|
650
|
+
self.assertEqual(self.sn.css_norm("color:red!important;;"), self.sn.css_norm("color: red !important;"))
|
|
651
|
+
n = lambda v, k="opacity": self.sn.normalise(v, {}, set(), k)
|
|
652
|
+
self.assertEqual(n(".35"), n("0.35"))
|
|
653
|
+
self.assertEqual(n("rgba(255,255,255,.85)", "color"), n("rgba(255, 255, 255, 0.85)", "color"))
|
|
654
|
+
self.assertNotEqual(n(".35"), n("0.36"))
|
|
655
|
+
self.assertNotEqual(n("Price .35", "text"), n("Price 0.35", "text")) # words are not values
|
|
656
|
+
|
|
657
|
+
def test_string_rel_is_not_a_difference_but_a_list_is_written(self):
|
|
658
|
+
# measured on the demo (1.0.14, 2026-11-25): rel "noopener" is stored as null,
|
|
659
|
+
# ["noopener"] is kept (rel's validator is ValidatorArray)
|
|
660
|
+
def tree(rel):
|
|
661
|
+
return {"type": "text", "data": {"attrID": "l-root"}, "children": [
|
|
662
|
+
{"type": "wysiwyg-link", "data": {"attrID": "l-a", "url": "/a/", "rel": rel},
|
|
663
|
+
"children": [{"type": "wysiwyg-text", "data": {"text": "a"}}]}]}
|
|
664
|
+
live = self.flat(tree(None), "L")
|
|
665
|
+
same, _, updates, notes = self.sn.plan(self.flat(tree("noopener"), "S"), "S", live, "L")
|
|
666
|
+
self.assertEqual(updates, [])
|
|
667
|
+
self.assertTrue(any("only as a list" in x for x in notes), notes)
|
|
668
|
+
same, _, updates, _ = self.sn.plan(self.flat(tree(["noopener"]), "S"), "S", live, "L")
|
|
669
|
+
self.assertEqual([u[2] for u in updates], [["rel"]])
|
|
670
|
+
import inline_html
|
|
671
|
+
link = inline_html.inline_children('<a href="/x/" rel="noopener nofollow">x</a>')[0]
|
|
672
|
+
self.assertEqual(link["data"]["rel"], ["noopener", "nofollow"])
|
|
673
|
+
|
|
591
674
|
def test_override_shell_counter(self):
|
|
592
675
|
shell = {"parentType": "override", "parentID": "I", "status": "publish",
|
|
593
676
|
"data": {"override": {"originalID": "X"}}}
|