@panphora/clayjs 1.12.2 → 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.
@@ -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;