mosaic-headless 1.43.0 → 1.44.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/SKILL.md CHANGED
@@ -6,7 +6,7 @@ license: "MIT"
6
6
  user-invocable: true
7
7
  metadata:
8
8
  author: "moksa (https://moksaweb.com)"
9
- version: "1.43.0"
9
+ version: "1.44.0"
10
10
  homepage: "https://github.com/Moksa1123/mosaic-headless"
11
11
  ---
12
12
 
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "metadata": {
23
23
  "author": "moksa (https://moksaweb.com)",
24
- "version": "1.43.0",
24
+ "version": "1.44.0",
25
25
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
26
26
  }
27
27
  },
@@ -24,7 +24,7 @@
24
24
  "user-invocable": true,
25
25
  "metadata": {
26
26
  "author": "moksa (https://moksaweb.com)",
27
- "version": "1.43.0",
27
+ "version": "1.44.0",
28
28
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
29
29
  }
30
30
  },
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "metadata": {
23
23
  "author": "moksa (https://moksaweb.com)",
24
- "version": "1.43.0",
24
+ "version": "1.44.0",
25
25
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
26
26
  }
27
27
  },
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "metadata": {
23
23
  "author": "moksa (https://moksaweb.com)",
24
- "version": "1.43.0",
24
+ "version": "1.44.0",
25
25
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
26
26
  }
27
27
  },
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "metadata": {
23
23
  "author": "moksa (https://moksaweb.com)",
24
- "version": "1.43.0",
24
+ "version": "1.44.0",
25
25
  "homepage": "https://github.com/Moksa1123/mosaic-headless"
26
26
  }
27
27
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mosaic-headless",
3
- "version": "1.43.0",
3
+ "version": "1.44.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",
@@ -609,3 +609,106 @@ What to do: take the store out of coming-soon mode (go live), and give the store
609
609
  Mosaic templates. Not measured: a store page that DOES have a Mosaic template while
610
610
  coming-soon is on may print two documents (WooCommerce's page and Mosaic's) - the
611
611
  code predicts it; testing it needs a store template written on the demo.
612
+
613
+ ## WooCommerce block emails become "Mosaic is running!" (demo, 2026-11-29)
614
+
615
+ Mosaic 1.0.14, WooCommerce 11.3.1, read in source and reproduced on the demo inside
616
+ one WP-CLI process (block email editor switched on for that process only, every mail
617
+ blocked by `pre_wp_mail`, nothing written, nothing sent).
618
+
619
+ **Cause.** `MosaicCurrentTheme.php` (lines 114-155) hooks `get_block_file_template`
620
+ at priority 10. For any `wp_template` id whose theme part is a Mosaic theme
621
+ (`mosaic-1-1-<uuid>//…`, `WPThemeManager::templateIDIsMosaicTheme`) and whose slug
622
+ Mosaic has no template for, it builds a template whose content is
623
+ `themes/mosaic/templates/running.html` - a single `<h1>Mosaic is running!</h1>`
624
+ (line 138). WooCommerce's block email renderer asks for its frame templates exactly
625
+ that way: `get_block_template( get_stylesheet() . '//' . $slug )`
626
+ (`packages/email-editor/src/Engine/Templates/class-templates.php`, line 74), slug
627
+ `wooemailtemplate` or `email-general` (`Renderer/class-renderer.php`, line 118).
628
+ WordPress only reaches the registered (plugin) template after that filter, so the
629
+ placeholder wins.
630
+
631
+ **What breaks.** Measured: `email-general` and `wooemailtemplate` both resolved to
632
+ the 105-byte placeholder (`source=theme`), and rendering a throwaway email body
633
+ through WooCommerce's own renderer gave a 3,420-byte message that contained
634
+ "Mosaic is running!" and **not** the body text. No error, no log line - the email is
635
+ sent like that. Only sites with the block email editor ON
636
+ (`woocommerce_feature_block_email_editor_enabled = yes`) send these; classic emails
637
+ use WooCommerce's PHP templates and do not go through this lookup
638
+ (`WC_Email::get_content()`, `class-wc-email.php` line 907, takes the block path only
639
+ when block content exists).
640
+
641
+ **Scope.** Every slug Mosaic has no template for gets the placeholder, not only
642
+ emails: `single-product`, `checkout`, `coming-soon` and a made-up slug all did. On
643
+ the front end that is invisible (Mosaic renders pages through its own `index.php`);
644
+ it shows wherever something reads the block template's content - WooCommerce's block
645
+ emails are the case met in the field.
646
+
647
+ **Fix - a mu-plugin or site plugin, recommended form:**
648
+
649
+ ```php
650
+ add_filter('get_block_file_template', function ($template, $id, $type) {
651
+ if ($type !== 'wp_template' || !is_string($id) || strpos($id, 'mosaic-') !== 0) {
652
+ return $template; // not a Mosaic theme id
653
+ }
654
+ $slug = explode('//', $id, 2)[1] ?? '';
655
+ $registered = WP_Block_Templates_Registry::get_instance()->get_by_slug($slug);
656
+ if (!$registered instanceof WP_Block_Template
657
+ || !in_array('woo_email', (array) $registered->post_types, true)) {
658
+ return $template; // site templates stay Mosaic's
659
+ }
660
+ $copy = clone $registered; // never edit the registry's object
661
+ $copy->id = $id;
662
+ return $copy;
663
+ }, 20, 3); // after Mosaic's priority 10
664
+ ```
665
+
666
+ Two fixes already run in the field; both were tried on the demo and both work
667
+ (the templates came back as `source=plugin`, the rendered email was 9,911 bytes with
668
+ the body in it and no placeholder):
669
+
670
+ - slug test: give back the registered template when the slug contains `email` and
671
+ the theme starts with `mosaic-`.
672
+ - post-type test (above): give it back when WooCommerce registered the template for
673
+ `woo_email`.
674
+
675
+ Why the post-type test: it uses WooCommerce's own declaration of what is an email
676
+ template, so a future email template with another slug is covered, and a site or
677
+ plugin template that merely has "email" in its slug (an "email preferences" page) is
678
+ left to Mosaic. The clone keeps the registry's shared object untouched; giving the
679
+ copy the requested id is consistency only - the rendered email was identical either
680
+ way. Keep the `mosaic-` prefix test so the filter does nothing on other themes.
681
+
682
+ **Check without sending mail:** `wp eval-file tools/email_template_check.php` asks
683
+ `get_block_template()` for every `woo_email` template the way WooCommerce does and
684
+ prints OK / REPLACED; it exits 1 only when block emails are on and a template is
685
+ replaced, and warns when they are off (what turning them on would do). To see a whole
686
+ email, render it in a process where `pre_wp_mail` returns `true` - a test site may
687
+ have no mail isolation of its own (the demo has none), so never trigger a real send.
688
+
689
+ ## Form submissions, page-builder notes (demo, 2026-11-29)
690
+
691
+ Reported by the session filming the demo, checked against the 1.0.14 source where
692
+ the source says it:
693
+
694
+ - **A front-end form submit always writes a row to `wp_mosaic_submissions`**
695
+ (`clientIP`, `userAgent`, `valuesJSON`, `spamProtectionJSON`), whatever actions the
696
+ form has, and the first submit creates the option `mosaic_form_upload_hmac_key`
697
+ (`Submissions/Upload/SecureUploadStore.php`, line 300). List both as expected
698
+ changes when comparing a site before and after a form test, and delete the test rows
699
+ afterwards. A form with a send-email action really sends: the recipient defaults to
700
+ the site's `admin_email`.
701
+ - **A page URL with `?s=`** (WordPress's search parameter) makes the form's POST
702
+ answer 404 with `success: true`, and the front end shows its "could not confirm"
703
+ message. Test forms on the plain URL.
704
+ - **`mosaic-accordion` is `display: contents`**, so its `getBoundingClientRect()` is
705
+ all zeros; measure `.m-accordion-item` instead.
706
+ - **A text node's default line height is 24px.** Set `lineHeight` whenever the
707
+ font size goes up - at 64px two lines overlap.
708
+ - **A fixed header with z-index 100** (a master header) covers a sticky element with a
709
+ lower one; a sticky reading-progress bar needs `zIndex` 200 or more to stay visible.
710
+ - **`ordering` compares case-insensitively in SQL.** The column has the table's
711
+ default collation, so `GROUP BY ordering` on the demo showed 27 "duplicates"
712
+ (`bFz` / `bFZ`) where all 113 values were distinct. Mosaic itself sorts with
713
+ `ORDER BY BINARY ordering` (`MosaicCurrentTheme.php`, line 187). Look for clashes
714
+ with `GROUP BY BINARY ordering`.
@@ -84,7 +84,9 @@ Committed with `ordering: "a0"` on a theme of 123 templates (1.0.14, demo,
84
84
  string, a new `revision` and a new `modified_gmt`. Their relative order stayed the
85
85
  same, so routing did not change, and deleting the new template did not put the old
86
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.
87
+ To leave the other rows alone, use an `ordering` after the last one. Compare `ordering` values
88
+ with `BINARY`: the column sorts case-insensitively in SQL but Mosaic orders by
89
+ `BINARY ordering`, so `bFz` and `bFZ` are different places (references/facts.md).
88
90
 
89
91
  **A template_assigns row with empty `parentID` and `parentType` binds nothing.** It is
90
92
  what the editor writes for "Auto template" (`TemplateAssign` treats it as
@@ -54,6 +54,7 @@ Every tool in `tools/`, and where the REST session comes from. Moved out of SKIL
54
54
  | `mint_session.php` | a matching cookie + `wp_rest` nonce from WP-CLI; `wp eval-file tools/mint_session.php - 20` sets the lifetime in hours (12 by default; the nonce itself lapses within a day). A run that hits an expired session now says SESSION EXPIRED |
55
55
  | `mosaic_config.py` | the one place a tool resolves the site URL and session - environment (`MOSAIC_SITE_URL` / `MOSAIC_REST_COOKIE` / `MOSAIC_REST_NONCE`) over `--config` file, so a credential never has to be written to disk |
56
56
  | `override_health.sql` | read only, `wp db query < tools/override_health.sql`: component instances whose override nodes heal emptied into `{"override":{"originalID":…}}` shells, and duplicate override nodes. Run it before and after deleting a root or changing a component (references/facts.md) |
57
+ | `email_template_check.php` | read only, `wp eval-file tools/email_template_check.php`: on a Mosaic site with WooCommerce, whether each block-email template (`email-general`, `wooemailtemplate`, every `woo_email` one) resolves to Mosaic's "Mosaic is running!" placeholder. Sends no mail; exits 1 only when block emails are on and one is replaced (references/facts.md) |
57
58
  | `check_tables.py` | re-extract all eleven source-derived tables and diff them against the shipped ones - the check for a table that is not wrong but STALE, which nothing else can see |
58
59
 
59
60
  ## The session, and where it comes from
@@ -21,15 +21,15 @@ Status, per tutorial:
21
21
  | docs: dark-light-mode-switcher | site-wide mode toggle, remembered | MEASURED | second `collectionMode`, `mode_switch` on `document` + `set_cookie`, `pageLoad` gated by `cookie_is` |
22
22
  | docs: loading-animation | full-page loader that fades out | MEASURED | fixed div, `data.hidden: true`, `pageLoad` opacity + `hide_at_end` |
23
23
  | docs: reusable-animations | one scroll reveal reused by class | MEASURED | `elementScrollIntoView`, `trigger=class_target`, no target, `children` modifier; per-child delay with `tween(delay=)` |
24
- | docs: animation-loop | endless vertical ticker, pause on hover | MEASURED (loop + hover pause) | `on(..., loop=True, ix_id=, out_of_view="1")`, hover `suspend`/`resume` by ID; the reposition tweens are `duration: 0` with a `delay` |
25
- | interactions: reading-progress-bar | bar that fills while reading | MEASURED | sticky outer, `scrollIntoView` on the article targeting the bar, translateX `-100%` to `0%`, `progress=True, easing="linear"` |
24
+ | docs: animation-loop | endless vertical ticker, pause on hover | MEASURED (loop + hover pause) | `on(..., loop=True, ix_id=, out_of_view="1")`, hover `suspend`/`resume` by ID; the reposition tweens are `duration: 0` with a `delay`. A horizontal marquee needs no reposition tween: put the content in twice and tween translateX `0%`>`-50%` with `linear` + `loop=True`; hover `suspend`/`resume` by ID pause and continue it (measured 2026-11-29) |
25
+ | interactions: reading-progress-bar | bar that fills while reading | MEASURED | sticky outer, `scrollIntoView` on the article targeting the bar, translateX `-100%` to `0%`, `progress=True, easing="linear"`; set the trigger's `startWhen: topOfThePage`, `endWhen: bottomOfThePage` so the bar tracks the whole page - the default `middleOfTheScreen` to `middleOfTheScreen` spans only the article's own height and a short page fills it in ~300px (measured 2026-11-29) |
26
26
  | menus: off-canvas-menu | full-screen menu, hamburger/close | MEASURED (the toggle) | click `odd` slot: `display(start="flex")` + translateX `100%`>`0%`; `even`: back + `display(end="none")`; `data.hidden: true` on the panel; arrow-on-hover is a CSS state + `transition` |
27
27
  | interactions: animated-shape-dividers | SVG divider that scales in and loops | PARTS | icon node with SVG, `transformOrigin`, `pageLoad` scaleY `70%`>`100%`, a second tween back, `loop=True` |
28
28
  | interactions: background-clip | image through the letters | PARTS | `backgroundStyle` (clip text, fixed) + transparent `color`; references/styling.md |
29
29
  | interactions: background-parallax | fixed section background | PARTS | `backgroundStyle` fixed |
30
30
  | interactions: blurred-sticky-cta | frosted sticky button | PARTS | `position: sticky`, `bottom`, `backdropFilter`, background with alpha |
31
31
  | interactions: flip-box-3d | card flips on hover | PARTS | `perspective`, `transformStyle`, back-face via `customDeclarations` (the tutorial does the same), hover `in`/`out` rotateY `180deg`/`0deg` on the wrapper |
32
- | interactions: parallax-effect | rows drifting at two speeds | PARTS | `scrollIntoView` on the section targeting each grid, translateX `10%`>`-10%` and back; start/end via `settings` |
32
+ | interactions: parallax-effect | rows drifting at two speeds | PARTS | `scrollIntoView` on the section targeting each grid, translateX `10%`>`-10%` and back; start/end via `settings` - `startEntering` to `isFullyHidden` moves smoothest (measured 2026-11-29) |
33
33
  | interactions: scroll-timeline | sticky icons, fading rows, nested components | PARTS | `elementScrollIntoView` `in`/`out` slots, opacity and colour tweens with variables, sticky `top: 50vh`, nested Part components |
34
34
  | interactions: video-controls | custom play / pause / overlay | OPEN (player actions) | click `odd`/`even`, opacity tweens, `player_play` / `player_pause` - their shape is read from the source, not driven yet |
35
35
  | interactions: vimeo-hover-play | Vimeo plays on hover, pauses on leave | OPEN (player actions) | hover `in`/`out`, translateY overlay, `player_play`/`player_pause` |
@@ -0,0 +1,67 @@
1
+ <?php
2
+ /**
3
+ * Are WooCommerce's block-email templates being replaced by Mosaic's placeholder?
4
+ * Read only: no mail is sent, nothing is written.
5
+ *
6
+ * wp eval-file tools/email_template_check.php
7
+ *
8
+ * Mosaic's MosaicCurrentTheme hooks get_block_file_template and answers EVERY
9
+ * "<mosaic theme>//<slug>" it has no template for with themes/mosaic/templates/running.html
10
+ * ("Mosaic is running!"). WooCommerce's block email editor looks its frame templates up
11
+ * the same way (get_stylesheet() . '//email-general', '//wooemailtemplate'), so on a
12
+ * Mosaic site every block email goes out as that one heading, and nothing reports an
13
+ * error (references/facts.md, "WooCommerce block emails become 'Mosaic is running!'").
14
+ *
15
+ * The check asks get_block_template() for each email template exactly as WooCommerce
16
+ * does, so a site that already carries a fix, or has the template saved in the editor,
17
+ * reads OK. Templates checked: every registered template whose post_types include
18
+ * woo_email, plus email-general and wooemailtemplate by name.
19
+ *
20
+ * Lines: OK / REPLACED per template, then a verdict. Exit code 1 only when block emails
21
+ * are ON and at least one template is replaced; with the editor off the replaced lines
22
+ * are a warning of what turning it on would do.
23
+ */
24
+ if (!function_exists('get_block_template')) {
25
+ WP_CLI::error('WordPress 5.9+ is required');
26
+ }
27
+ $stylesheet = get_stylesheet();
28
+ $isMosaic = strpos($stylesheet, 'mosaic-') === 0;
29
+ $wooActive = class_exists('WooCommerce');
30
+ $blockEmail = get_option('woocommerce_feature_block_email_editor_enabled', 'no') === 'yes';
31
+ WP_CLI::log("theme: $stylesheet" . ($isMosaic ? ' (Mosaic)' : ' (not a Mosaic theme)'));
32
+ WP_CLI::log('WooCommerce: ' . ($wooActive ? 'active' : 'not active') . '; block email editor: ' . ($blockEmail ? 'ON' : 'off'));
33
+
34
+ $placeholder = defined('MOSAIC_PATH') && is_readable(MOSAIC_PATH . 'themes/mosaic/templates/running.html')
35
+ ? trim((string) file_get_contents(MOSAIC_PATH . 'themes/mosaic/templates/running.html')) : '';
36
+
37
+ $slugs = ['email-general' => true, 'wooemailtemplate' => true];
38
+ if (class_exists('WP_Block_Templates_Registry')) {
39
+ foreach (WP_Block_Templates_Registry::get_instance()->get_all_registered() as $t) {
40
+ if (in_array('woo_email', (array) $t->post_types, true)) {
41
+ $slugs[$t->slug] = true;
42
+ }
43
+ }
44
+ }
45
+
46
+ $replaced = 0;
47
+ foreach (array_keys($slugs) as $slug) {
48
+ $t = get_block_template($stylesheet . '//' . $slug, 'wp_template');
49
+ $content = $t ? trim((string) $t->content) : '';
50
+ $isPlaceholder = $content !== '' && (strpos($content, 'Mosaic is running') !== false
51
+ || ($placeholder !== '' && $content === $placeholder));
52
+ if ($isPlaceholder) {
53
+ $replaced++;
54
+ }
55
+ WP_CLI::log(sprintf(' %-9s %-22s source=%s', $isPlaceholder ? 'REPLACED' : ($t ? 'OK' : 'MISSING'), $slug,
56
+ $t ? $t->source : '-'));
57
+ }
58
+
59
+ if ($replaced === 0) {
60
+ WP_CLI::success('no email template is replaced by the Mosaic placeholder');
61
+ return;
62
+ }
63
+ $msg = "$replaced email template(s) resolve to Mosaic's running.html - block emails would be sent as 'Mosaic is running!'";
64
+ if ($blockEmail && $wooActive) {
65
+ WP_CLI::error($msg . '. Fix: references/facts.md');
66
+ }
67
+ WP_CLI::warning($msg . ' once the block email editor is turned on. Fix before turning it on: references/facts.md');