@guidelytech/guide-runtime 0.10.0 → 0.11.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/dist/capture.cjs CHANGED
@@ -746,6 +746,9 @@ function screenshotDataUrl(canvas) {
746
746
  }
747
747
  }
748
748
 
749
+ // src/host.ts
750
+ var import_runtime3 = require("@guidelytech/shared/runtime");
751
+
749
752
  // src/styles.ts
750
753
  var STYLES = `
751
754
  :host{all:initial;position:static;display:block;contain:none}
@@ -929,6 +932,21 @@ var STYLES = `
929
932
  .g-auth-outline.g-picked .g-auth-label{background:#16a34a}
930
933
  .g-highlight{position:fixed;z-index:calc(var(--g-z) + 8);pointer-events:none;border:2px dashed #f59e0b;background:rgba(245,158,11,.12);border-radius:4px}
931
934
  @media (max-width:480px){.g-card.g-modal,.g-panel{width:calc(100vw - 32px)}.g-inner{padding:16px}}
935
+ /* resource center: unread badge + "What's new" */
936
+ .g-launcher-badge{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:#dc2626;color:#fff;font-size:11px;font-weight:700;line-height:20px;text-align:center;box-shadow:0 0 0 2px var(--g-bg)}
937
+ .g-rc-news{padding:10px 20px 12px;border-bottom:1px solid var(--g-border)}
938
+ .g-rc-news:last-of-type{border-bottom:0}
939
+ .g-rc-news-head{display:flex;align-items:baseline;gap:8px}
940
+ .g-rc-news-title{margin:0;font-size:14px;font-weight:600;line-height:1.35;flex:1}
941
+ .g-rc-news-new{flex:none;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--g-primary-text);background:var(--g-primary);border-radius:999px;padding:2px 7px}
942
+ .g-rc-news-date{display:block;font-size:12px;color:var(--g-muted);margin:2px 0 6px}
943
+ .g-rc-news-body{font-size:13px}
944
+ .g-rc-news-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
945
+ .g-rc-news-actions .g-btn{min-height:32px;padding:6px 12px;font-size:13px}
946
+ /* accessibility */
947
+ .g-sr-only{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
948
+ .g-hotspot:focus-visible,.g-custom:focus-visible,.g-card:focus-visible{outline:2px solid var(--g-primary);outline-offset:2px}
949
+ @media (forced-colors:active){.g-card,.g-panel,.g-banner{border:1px solid CanvasText}.g-btn{border:1px solid ButtonText}}
932
950
  `;
933
951
 
934
952
  // src/host.ts
@@ -1017,6 +1035,7 @@ function resolveTheme(theme, appearance) {
1017
1035
  }
1018
1036
  function applyTheme(el, vars) {
1019
1037
  el.style.setProperty("--g-primary", vars.primary);
1038
+ if (/^#[0-9a-f]{3}([0-9a-f]{3})?$/i.test(vars.primary)) el.style.setProperty("--g-primary-text", (0, import_runtime3.readableTextOn)(vars.primary));
1020
1039
  el.style.setProperty("--g-bg", vars.bg);
1021
1040
  el.style.setProperty("--g-text", vars.text);
1022
1041
  el.style.setProperty("--g-radius", `${vars.radius}px`);
@@ -1033,6 +1052,16 @@ function createScope(theme, appearance, doc = document) {
1033
1052
  const vars = resolveTheme(theme, appearance);
1034
1053
  applyTheme(el, vars);
1035
1054
  handle.shadow.appendChild(el);
1055
+ const css = [appearance ? theme?.customCss : void 0, appearance?.customCss].filter((c) => !!c && !!c.trim());
1056
+ let style = null;
1057
+ if (css.length) {
1058
+ const id = `c${++cssScopeSeq}`;
1059
+ el.setAttribute("data-g-css", id);
1060
+ style = doc.createElement("style");
1061
+ style.setAttribute("data-g-custom", id);
1062
+ style.textContent = css.map((c) => (0, import_runtime3.scopeCustomCss)(c, `.g-scope[data-g-css="${id}"]`)).join("\n");
1063
+ handle.shadow.insertBefore(style, el);
1064
+ }
1036
1065
  let mq = null;
1037
1066
  const onChange = () => applyTheme(el, resolveTheme(theme, appearance));
1038
1067
  if ((appearance?.theme ?? "auto") === "auto" && typeof window !== "undefined" && typeof window.matchMedia === "function") {
@@ -1048,10 +1077,12 @@ function createScope(theme, appearance, doc = document) {
1048
1077
  vars,
1049
1078
  destroy() {
1050
1079
  mq?.removeEventListener?.("change", onChange);
1080
+ style?.remove();
1051
1081
  el.remove();
1052
1082
  }
1053
1083
  };
1054
1084
  }
1085
+ var cssScopeSeq = 0;
1055
1086
 
1056
1087
  // src/capture.ts
1057
1088
  var DOUBLE_CLICK_MS = 400;