@panphora/clayjs 1.13.0 → 1.13.1

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.
@@ -1,4 +1,4 @@
1
- /* clayjs 1.13.0 standalone build: every clayjs module in one file. https://clayjs.com/offline
1
+ /* clayjs 1.13.1 standalone build: every clayjs module in one file. https://clayjs.com/offline
2
2
  Third-party code inside keeps its own license (Sortable MIT, Squire MIT, DOMPurify Apache-2.0 OR MPL-2.0, MicroModal MIT, parse5 MIT): https://clayjs.com/THIRD-PARTY-NOTICES.md */
3
3
  (() => {
4
4
  var __create = Object.create;
@@ -36570,7 +36570,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
36570
36570
  root3.setAttribute("data-hcp-state", state2);
36571
36571
  if (reason) root3.setAttribute("data-hcp-reason", reason);
36572
36572
  tab.setAttribute("aria-expanded", state2 === "card" ? "true" : "false");
36573
- if (state2 === "card") {
36573
+ if (state2 === "card" || state2 === "mini") {
36574
36574
  mem.shown = true;
36575
36575
  memory.save();
36576
36576
  root3.setAttribute("data-hcp-arrived", "");
@@ -36653,8 +36653,8 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
36653
36653
  tab.focus();
36654
36654
  } else {
36655
36655
  mem.dismissed = true;
36656
- memory.save();
36657
- set3("dismissed");
36656
+ set3("mini");
36657
+ tab.focus();
36658
36658
  }
36659
36659
  }
36660
36660
  return;
@@ -36685,10 +36685,6 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
36685
36685
  if (root3.getAttribute("data-hcp-reason") === "error") root3.setAttribute("data-hcp-reason", "use");
36686
36686
  }
36687
36687
  const api = { set: set3, root: root3, showError, clearError };
36688
- if (mem.dismissed) {
36689
- root3.setAttribute("data-hcp-state", "dismissed");
36690
- return api;
36691
- }
36692
36688
  document.addEventListener("input", onUse, true);
36693
36689
  document.addEventListener("change", onUse, true);
36694
36690
  document.addEventListener("focusin", onFocusIn);
@@ -36696,7 +36692,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
36696
36692
  addEventListener("scroll", lift, { passive: true });
36697
36693
  addEventListener("resize", lift);
36698
36694
  document.addEventListener("transitionend", lift, true);
36699
- set3(mem.shown ? "mini" : "tab");
36695
+ set3(mem.shown || mem.dismissed ? "mini" : "tab");
36700
36696
  if (!mem.shown && (mem.uses || 0) >= USES_TO_SHOW) maybeShow("return");
36701
36697
  return api;
36702
36698
  }
@@ -36723,7 +36719,7 @@ tr.hcms-shell.hcms-inline-ghost { display: table-row; }
36723
36719
  </section>
36724
36720
  <div class="hcp-dock">
36725
36721
  <button type="button" class="hcp-btn hcp-tab" data-hcp="open" aria-controls="hcp-card" aria-expanded="false" aria-label="This app is free to keep"><span><svg width="16" height="16" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg><span class="hcp-tab__label">This app is free to keep</span></span></button>
36726
- <button type="button" class="hcp-x" data-hcp="dismiss" aria-label="Hide this for good"><svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true"><path d="M1.4 0 6 4.6 10.6 0 12 1.4 7.4 6 12 10.6 10.6 12 6 7.4 1.4 12 0 10.6 4.6 6 0 1.4z"/></svg></button>
36722
+ <button type="button" class="hcp-x" data-hcp="minimize" aria-label="Minimize download notice"><svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true"><path d="M1.4 0 6 4.6 10.6 0 12 1.4 7.4 6 12 10.6 10.6 12 6 7.4 1.4 12 0 10.6 4.6 6 0 1.4z"/></svg></button>
36727
36723
  </div>
36728
36724
  </aside>`;
36729
36725
  }
package/docs/guide.md CHANGED
@@ -1753,7 +1753,7 @@ When there is a release video, add it as the first element of the template, and
1753
1753
 
1754
1754
  An element inside the template with `[visitor-intro-start]` scrolls to the app, and one with `[visitor-intro-dismiss]` closes the intro the same way the `x` does. A deep link (a URL with a `#...`) skips the intro so a shared link opens where it points, a draft skips it too, and `?intro=1` forces it.
1755
1755
 
1756
- **The prompt** needs nothing from the app but its name: a small tab at the bottom right ("This app is free to keep") that opens into a card holding the download link and "Don't show again", with a minimize button in its corner. It opens itself once after the visitor has touched three fields, and stays away for that slot after "Don't show again". A storage failure opens it in its error state, and the next good save clears it. In that error state the download link does not go to the host, whose download page would read the stored copy that just failed to be written: the plugin builds the file from the live page in the browser instead, named after the page file with `.htmlclay` at the end.
1756
+ **The prompt** needs nothing from the app but its name: a small tab at the bottom right ("This app is free to keep") that opens into a card holding the download link and "Don't show again", with a minimize button in its corner. The tab's X and the card's minimize button leave an icon that reopens the download card. That choice survives reload. It opens itself once after the visitor has touched three fields. "Don't show again" stops those reminders for that slot but keeps the icon, including for previously dismissed notices. A storage failure opens it in its error state, and the next good save clears it. In that error state the download link does not go to the host, whose download page would read the stored copy that just failed to be written: the plugin builds the file from the live page in the browser instead, named after the page file with `.htmlclay` at the end.
1757
1757
 
1758
1758
  **The download link** is `/_/download<path>?as=htmlclay`, with the page's path (`/_/download?as=htmlclay` for `/`) and `&src=<src>` when this slot has one. `clay.visitorDrafts.downloadUrl()` returns it. **`?src=` is first touch**: the first valid value the page sees for this slot is kept and rides into the download link and every signup. Valid values match `/^[a-z0-9][a-z0-9-]{0,39}$/`.
1759
1759
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panphora/clayjs",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "type": "module",
5
5
  "description": "clayjs: malleable documents. Save lifecycle for self-saving HTML.",
6
6
  "license": "MIT-0",
@@ -20,7 +20,7 @@ const ASIDE = `<aside class="hcp" id="hcp" hidden aria-label="Download this app"
20
20
  </section>
21
21
  <div class="hcp-dock">
22
22
  <button type="button" class="hcp-btn hcp-tab" data-hcp="open" aria-controls="hcp-card" aria-expanded="false" aria-label="This app is free to keep"><span><svg width="16" height="16" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg><span class="hcp-tab__label">This app is free to keep</span></span></button>
23
- <button type="button" class="hcp-x" data-hcp="dismiss" aria-label="Hide this for good"><svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true"><path d="M1.4 0 6 4.6 10.6 0 12 1.4 7.4 6 12 10.6 10.6 12 6 7.4 1.4 12 0 10.6 4.6 6 0 1.4z"/></svg></button>
23
+ <button type="button" class="hcp-x" data-hcp="minimize" aria-label="Minimize download notice"><svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true"><path d="M1.4 0 6 4.6 10.6 0 12 1.4 7.4 6 12 10.6 10.6 12 6 7.4 1.4 12 0 10.6 4.6 6 0 1.4z"/></svg></button>
24
24
  </div>
25
25
  </aside>`;
26
26
 
@@ -50,7 +50,7 @@ export function mountPrompt({ memory, appName, link }) {
50
50
  root.setAttribute("data-hcp-state", state);
51
51
  if (reason) root.setAttribute("data-hcp-reason", reason);
52
52
  tab.setAttribute("aria-expanded", state === "card" ? "true" : "false");
53
- if (state === "card") { mem.shown = true; memory.save(); root.setAttribute("data-hcp-arrived", ""); }
53
+ if (state === "card" || state === "mini") { mem.shown = true; memory.save(); root.setAttribute("data-hcp-arrived", ""); }
54
54
  lift();
55
55
  }
56
56
 
@@ -126,7 +126,7 @@ export function mountPrompt({ memory, appName, link }) {
126
126
  else if (act === "minimize") { set("mini"); tab.focus(); }
127
127
  else if (act === "dismiss") {
128
128
  if (root.getAttribute("data-hcp-reason") === "error") { set("mini"); tab.focus(); }
129
- else { mem.dismissed = true; memory.save(); set("dismissed"); }
129
+ else { mem.dismissed = true; set("mini"); tab.focus(); }
130
130
  }
131
131
  return;
132
132
  }
@@ -151,8 +151,6 @@ export function mountPrompt({ memory, appName, link }) {
151
151
  }
152
152
  const api = { set, root, showError, clearError };
153
153
 
154
- if (mem.dismissed) { root.setAttribute("data-hcp-state", "dismissed"); return api; }
155
-
156
154
  document.addEventListener("input", onUse, true);
157
155
  document.addEventListener("change", onUse, true);
158
156
  document.addEventListener("focusin", onFocusIn);
@@ -161,7 +159,7 @@ export function mountPrompt({ memory, appName, link }) {
161
159
  addEventListener("resize", lift);
162
160
  document.addEventListener("transitionend", lift, true);
163
161
 
164
- set(mem.shown ? "mini" : "tab");
162
+ set(mem.shown || mem.dismissed ? "mini" : "tab");
165
163
  if (!mem.shown && (mem.uses || 0) >= USES_TO_SHOW) maybeShow("return");
166
164
 
167
165
  return api;