mosaic-headless 1.36.1 → 1.36.2

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/SKILL.md CHANGED
@@ -5,7 +5,7 @@ description: |
5
5
  license: "MIT"
6
6
  metadata:
7
7
  author: "moksa (https://moksaweb.com)"
8
- version: "1.36.1"
8
+ version: "1.36.2"
9
9
  homepage: "https://github.com/Moksa1123/mosaic-headless"
10
10
  ---
11
11
 
@@ -149,6 +149,7 @@ them headlessly, measured.
149
149
  | a block repeated on several pages | a component, one definition, overrides per instance | references/design-system.md (components) |
150
150
  | a popup, a drawer, a tour | the `modal` / `popover` nodes and their actions | references/dialog-and-triggers.md |
151
151
  | a site menu: desktop hover dropdown + phone drawer | `dropdown` / `dropdown-wide` with `openOn: hover`; a `modal` drawer opened by `modalOpen` (there is no off-canvas node) | references/design-system.md (site menus), `tools/verify_menus.py` |
152
+ | a typeface, site-wide | a `fontFamily` collection variable, `{"var": id}` in styles; Settings: `saveGoogleFontsLocally` on and `fontDisplay: swap` (unset is `block`) | references/styling.md (fonts) - saving Google fonts locally took a CJK page from 68 to 96 on mobile |
152
153
  | remembering a visitor's choice | `setCookie`, `remember` / `forget`, cookie conditions | references/interactions.md |
153
154
  | text that comes from the post, the user, a field | a dynamic `{"v": "@VAR(...)"}` value | references/dynamic-content.md |
154
155
  | a colour, a size used twice | a collection variable | references/design-system.md |
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.36.1"
23
+ "version": "1.36.2"
24
24
  },
25
25
  "loaderBehaviour": "Upload via Settings -> Skills -> Upload. Claude.ai parses SKILL.md frontmatter and surfaces the skill in your library. The extraction tool (extract-block-schema.php) needs a live WP-CLI connection and won't run in the sandbox; use it from a local terminal against your own site instead.",
26
26
  "uploadSteps": [
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.36.1"
23
+ "version": "1.36.2"
24
24
  },
25
25
  "loaderBehaviour": "Auto-loads on session start when SKILL.md frontmatter parses successfully.",
26
26
  "verified": true,
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.36.1"
23
+ "version": "1.36.2"
24
24
  },
25
25
  "loaderBehaviour": "Confirmed (2026-07-11): Codex CLI natively supports the SKILL.md spec. Place SKILL.md under .codex/skills/<name>/ (project) or ~/.codex/skills/<name>/ (personal) and Codex loads the name+description at session start, then the full body on demand. A parallel, broader convention .agents/skills/ (searched from cwd up to repo root, then ~/.agents/skills/) also exists across multiple tools - if your Codex CLI version prioritizes that path instead, mirror the same SKILL.md there.",
26
26
  "verified": true,
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.36.1"
23
+ "version": "1.36.2"
24
24
  },
25
25
  "loaderBehaviour": "CHANGED as of 2026-07-11: GitHub Copilot added a proper '.github/skills/' Agent Skills directory (December 2025), alongside the older single-file .github/copilot-instructions.md convention. This config targets the new skills-directory form. If your Copilot version predates this (pre Dec 2025), use the instructions-append fallback instead (see fallback below).",
26
26
  "fallback": {
@@ -20,7 +20,7 @@
20
20
  "description": "Build and modify Mosaic Pro (Nextend) sites by writing the underlying data model directly - no visual editor, no DOM. Query the real surface (122 node types, 181 node properties, 101 style properties, 53 style states, 151 element classes, 74 dynamic variables, 114 REST routes, 23 tables) instead of guessing, with every node type placed on a live site one at a time and asserted against the delivered HTML, every style and node property swept against the compiled CSS and markup, and 569 responsive declarations checked against the stylesheet the site actually served.",
21
21
  "license": "MIT",
22
22
  "author": "moksa (https://moksaweb.com)",
23
- "version": "1.36.1"
23
+ "version": "1.36.2"
24
24
  },
25
25
  "loaderBehaviour": "CHANGED as of 2026-07-11: Gemini CLI now natively supports the same SKILL.md standard as Claude Code and Codex CLI - the same directory-based skill works unmodified. Gemini CLI discovers skills in this precedence order: built-in, extension skills, ~/.gemini/skills/ (personal), .gemini/skills/ (project, shared via version control). At session start Gemini injects each discovered skill's name+description into the system prompt and calls activate_skill when a task matches.",
26
26
  "verified": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mosaic-headless",
3
- "version": "1.36.1",
3
+ "version": "1.36.2",
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",
@@ -266,8 +266,10 @@ modal closedby: everything, accessibleLabel, padding 0 (the browser's
266
266
  modal-overlay backgroundColor with alpha
267
267
  modal-window position absolute, top 0, right 0, height 100dvh (the NATIVE field), width 86%,
268
268
  maxWidth 360px, overflow auto; first child: a button with modalClose
269
- opener a button with click -> modalOpen, target = the modal's nodeID (a uuid5, so a
270
- rebuild keeps it)
269
+ opener a button with click -> modalOpen, target = the modal's pinned nodeID. The pin
270
+ only makes the two agree within one build: build_page and fill_shell re-key
271
+ it every run (refresh_node_ids), since (ID, themeID) is the primary key and
272
+ the previous master keeps its rows until pruned. Any uuid will do.
271
273
  ```
272
274
 
273
275
  A notch inset: `paddingTop: "max(16px, env(safe-area-inset-top))"` and the `calc()`
@@ -495,3 +495,33 @@ end reads the loop name out of any function call; the editor only out of `@VAR`.
495
495
  Write `@VAR('post/<loop>')`. No server-side check can see this - the page is 200 and
496
496
  complete - so it is only caught by opening the editor. Details in
497
497
  `references/custom-fields.md`.
498
+
499
+ ## The editor canvas does not load a plugin's front-end CSS
500
+
501
+ The canvas is a srcdoc iframe whose `<head>` comes from
502
+ `ThemeMResource::getHead()`: a fresh `WP_Styles`, `do_action('enqueue_block_assets')`,
503
+ Mosaic's own `style.css` and `AppWebPageEditorPreview.css`. `wp_enqueue_scripts`
504
+ never runs there. Measured with a probe mu-plugin on 1.0.12: a style enqueued on
505
+ `wp_enqueue_scripts` reached the front end and not the canvas; the same style on
506
+ `enqueue_block_assets` reached both. A code node whose decoration is styled by a
507
+ companion plugin therefore shows unstyled in the editor - on sharho a full-width
508
+ black disc over the whole canvas. Enqueue that CSS on `enqueue_block_assets` (it
509
+ also fires in the block editor, so scope the selectors), or ship an editor-only
510
+ sheet there that gives the element a static look; front-end scripts do not run in
511
+ the canvas either.
512
+
513
+ ## Inline editing re-serialises a text's runs (client report, 1.0.11)
514
+
515
+ On sharho, a heading built as `text > wysiwyg-span > wysiwyg-span` (a visually-hidden
516
+ and a no-wrap span nested inside another) came back from double-click -> Done -
517
+ with no character typed - as two flat spans, and the undo button lit. The front end
518
+ renders the nested structure fine (measured: `<span><span>` delivered), so the loss
519
+ is the editor's serialiser. The editor's own bold and italic are not spans: they are
520
+ `wysiwyg-text` `format: ["bold"]` / `["italic"]`, delivered as `<strong>` / `<em>`
521
+ (`<strong><em>` for both, measured). Keep runs in shapes the editor itself writes,
522
+ and tell a client not to edit a heading that needs nesting.
523
+
524
+ Mosaic also keeps unsaved edits in the browser: reopening that template offered
525
+ "a backup of this post stored in the browser differs from the version below" with
526
+ Restore / Cancel. Restore brings the flattened version back, and the next save
527
+ writes it. When reproducing an editor problem, press Cancel.
@@ -280,6 +280,52 @@ dropped, which is the only reason they cost minutes instead of a debugging sessi
280
280
  — a property that is not in the registry cannot be set at all, and Mosaic's own
281
281
  API accepts the write and discards it.
282
282
 
283
+ ## Fonts: what Mosaic loads, and what makes a CJK site slow (measured, 1.0.12)
284
+
285
+ A font is a collection variable of type `fontFamily` (not `font` - an unknown type
286
+ is a PHP fatal on commit), referenced from a style as `fontFamily: {"var": id}`. Its
287
+ value per mode is one of two providers:
288
+
289
+ ```
290
+ {"provider": "google", "fallbacks": "sans-serif",
291
+ "googleOptions": {"fontFamily": "Noto Sans TC", "fontVariants": ["400", "700"]}}
292
+ {"provider": "custom", "fallbacks": "sans-serif",
293
+ "customOptions": {"fontFamily": "\"PingFang TC\", \"Microsoft JhengHei\", sans-serif",
294
+ "fontFaces": "@font-face { ... }"}} # fontFaces may be ""
295
+ ```
296
+
297
+ - `google` loads only the ticked weights, one css2 URL for every Google font.
298
+ - `custom` inlines its `@font-face` rules in the page (no extra request). The
299
+ validator keeps `font-family`, `src` (url / local + format), `font-weight`,
300
+ `font-style`, `font-stretch`, `unicode-range` and `font-display`, and drops the
301
+ rest (`size-adjust`, the overrides). There is no upload UI: the woff2 is yours to
302
+ host. An empty `fontFaces` makes a system-font variable the client can still swap.
303
+ - **Every published font variable is loaded on every page**, used or not
304
+ (`FontRenderingManager::enqueueFontFamilies`). Delete the ones nothing uses.
305
+ - Site settings (Mosaic -> Settings, `settingsEditorInstance`): `fontDisplay`
306
+ (auto | block | swap | fallback | optional; **unset means `block`**, so text is
307
+ invisible until the font arrives), `saveGoogleFontsLocally` (CSS and woff2
308
+ copied to `wp-content/cache/mosaic/web/googlefonts/`), `criticalPreload` (an HTTP
309
+ preload of the font CSS, not of font files). There is no font-file preload.
310
+
311
+ Lighthouse mobile, median of three, a Chinese page (h1 700, body 400 + 500, a
312
+ Poppins 600 label) on the demo site:
313
+
314
+ | set-up | score | FCP | LCP | font bytes |
315
+ |---|---|---|---|---|
316
+ | Google Noto Sans TC 400/500/700 + Poppins, `fontDisplay` unset | 68-69 | 3.7-4.0 s | 6.2 s | 649 KB |
317
+ | the same, `fontDisplay: swap` only | 63-72 | 4.6-6.0 s | 4.7-6.1 s | 649 KB |
318
+ | the same + `saveGoogleFontsLocally` | 96 | 2.1 s | 2.1 s | 666 KB |
319
+ | 400/700 only + swap + local | 97 | 1.9 s | 1.9 s | 627 KB |
320
+ | CJK on a system stack (custom, no @font-face), Poppins from Google | 93 | 2.5 s | 2.5 s | 17 KB |
321
+ | the same, Poppins saved locally | 99 | 1.4 s | 1.5 s | 17 KB |
322
+
323
+ What costs the time is the render-blocking stylesheet on fonts.googleapis.com, not
324
+ the size of the CJK files - Google already slices them by `unicode-range` and the
325
+ browser fetches only the slices the page uses. `swap` alone does not help; saving
326
+ locally does. Hand-subsetting a CJK font is not worth it: the slices already do
327
+ that, and text a client adds later falls outside a hand-made subset.
328
+
283
329
  ## `fontFamily` takes a plain family list, nothing else
284
330
 
285
331
  `ValidatorStyleFontFamily` (NEXT-5841) accepts quoted names and unquoted identifier
@@ -130,7 +130,12 @@ def fill_shell(client, cfg, site, surface, master_id, header_id, footer_id, comp
130
130
  leaves an extra master behind on every build."""
131
131
  instance = "masterDocumentInstance/%s" % master_id
132
132
  key = "node/master/%s" % master_id
133
- shell = site.get("shell") or {}
133
+ # Re-key pinned nodeIDs here too, as build_page_document does: an old master
134
+ # keeps its rows until it is pruned and the key is (ID, themeID), so a pinned
135
+ # id is single-use. Both regions in one pass, so a header button whose
136
+ # modalOpen names a modal in the footer keeps pointing at it.
137
+ shell = refresh_node_ids({k: v for k, v in (site.get("shell") or {}).items()
138
+ if k in ("header", "footer")})
134
139
  COMPONENT_USES.clear()
135
140
  records = []
136
141
  for region, parent in (("header", header_id), ("footer", footer_id)):
@@ -186,6 +186,15 @@ def tree():
186
186
  "paddingLeft": "20px", "paddingRight": "20px"}}},
187
187
  "children": [{"type": "text", "data": {"attrID": "ml-copy", "tagName": "p"},
188
188
  "text": "選單實驗頁:桌機 hover 下拉、mega 下拉、modal 抽屜、navbar 收合、互動面板。"},
189
+ # probe: native run formats vs nested spans (sharho report)
190
+ {"type": "text", "data": {"attrID": "ml-fmt", "tagName": "p"}, "children": [
191
+ {"type": "wysiwyg-text", "data": {"text": "B", "format": ["bold"]}},
192
+ {"type": "wysiwyg-text", "data": {"text": "I", "format": ["italic"]}},
193
+ {"type": "wysiwyg-text", "data": {"text": "BI", "format": ["italic", "bold"]}},
194
+ {"type": "wysiwyg-span", "data": {"attrID": "ml-sp-out"}, "children": [
195
+ {"type": "wysiwyg-text", "data": {"text": "outer "}},
196
+ {"type": "wysiwyg-span", "data": {"attrID": "ml-sp-in"}, "children": [
197
+ {"type": "wysiwyg-text", "data": {"text": "inner"}}]}]}]},
189
198
  # which spelling of a notch inset survives the style validator
190
199
  {"type": "div", "data": {"attrID": "ml-safe-native"},
191
200
  "style": {"&": {"_": {"paddingTop": "max(16px, env(safe-area-inset-top))"}}}},