okno 1.0.0-beta.34 → 1.0.0-beta.36

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 +1 @@
1
- {"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAyQA,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAuTA,OAAO,EAAE,CAAA"}
package/dist/boot.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const e = globalThis;
2
- let r = !1;
3
- const m = "okno-win-opened", l = "okno-shadow-root", c = "okno-vt-style", i = "okno-nav-vt";
2
+ let a = !1;
3
+ const m = "okno-win-opened", c = "okno-shadow-root", l = "okno-vt-style", r = "okno-nav-vt";
4
4
  function u() {
5
5
  try {
6
6
  return e.localStorage?.getItem(m) === "true";
@@ -14,7 +14,7 @@ function h() {
14
14
  function _() {
15
15
  if (!e.document) return !1;
16
16
  for (const t of Array.from(e.document.styleSheets)) {
17
- if (t.ownerNode?.id === c) continue;
17
+ if (t.ownerNode?.id === l) continue;
18
18
  let n;
19
19
  try {
20
20
  n = t.cssRules;
@@ -27,58 +27,58 @@ function _() {
27
27
  return !1;
28
28
  }
29
29
  function d() {
30
- if (!e.document || e.document.getElementById(c) || !h()) return;
30
+ if (!e.document || e.document.getElementById(l) || !h()) return;
31
31
  const t = _(), n = e.document.createElement("style");
32
- n.id = c;
32
+ n.id = l;
33
33
  let o = `
34
- html.${i}::view-transition-group(okno-shell) { animation-duration: 420ms; }
35
- html.${i}::view-transition-old(okno-shell) { animation: okno-shell-hold 420ms both; }
36
- html.${i}::view-transition-new(okno-shell) { animation: none; }
34
+ html.${r}::view-transition-group(okno-shell) { animation-duration: 420ms; }
35
+ html.${r}::view-transition-old(okno-shell) { animation: okno-shell-hold 420ms both; }
36
+ html.${r}::view-transition-new(okno-shell) { animation: none; }
37
37
  @keyframes okno-shell-hold { from { opacity: 1 } to { opacity: 1 } }
38
38
  `;
39
39
  t || (o += `
40
40
  @view-transition { navigation: auto; }
41
- html.${i}::view-transition-group(root),
42
- html.${i}::view-transition-old(root),
43
- html.${i}::view-transition-new(root) { animation: none; }
41
+ html.${r}::view-transition-group(root),
42
+ html.${r}::view-transition-old(root),
43
+ html.${r}::view-transition-new(root) { animation: none; }
44
44
  `), n.textContent = o, e.document.head.appendChild(n);
45
45
  }
46
- function w(t) {
46
+ function v(t) {
47
47
  t.style.cssText += ";position:fixed;inset:0;pointer-events:none;view-transition-name:okno-shell";
48
48
  }
49
- function v(t) {
49
+ function p(t) {
50
50
  if (!u() || !t.viewTransition) return;
51
- e.document?.documentElement.classList.add(i);
52
- const n = e.document?.getElementById(l);
53
- n instanceof HTMLElement && w(n);
51
+ e.document?.documentElement.classList.add(r);
52
+ const n = e.document?.getElementById(c);
53
+ n instanceof HTMLElement && v(n);
54
54
  }
55
- function y(t) {
55
+ function w(t) {
56
56
  const n = t.viewTransition;
57
57
  if (!u() || !n || !e.document) return;
58
58
  const o = e.document.documentElement;
59
- o.classList.add(i), n.finished?.then?.(
60
- () => o.classList.remove(i),
61
- () => o.classList.remove(i)
59
+ o.classList.add(r), n.finished?.then?.(
60
+ () => o.classList.remove(r),
61
+ () => o.classList.remove(r)
62
62
  );
63
- let s = e.document.getElementById(l);
64
- s || (s = e.document.createElement("div"), s.id = l, e.document.body.appendChild(s)), s instanceof HTMLElement && (s.style.cssText = "position:fixed;inset:0;pointer-events:none;view-transition-name:okno-shell");
63
+ let i = e.document.getElementById(c);
64
+ i || (i = e.document.createElement("div"), i.id = c, e.document.body.appendChild(i)), i instanceof HTMLElement && (i.style.cssText = "position:fixed;inset:0;pointer-events:none;view-transition-name:okno-shell");
65
65
  }
66
66
  function f() {
67
67
  return !!e.__okno_loaded;
68
68
  }
69
- function E() {
69
+ function y() {
70
70
  let t = e.document?.activeElement;
71
71
  for (; t && t.shadowRoot?.activeElement; )
72
72
  t = t.shadowRoot.activeElement;
73
73
  const n = t?.tagName;
74
74
  return n === "INPUT" || n === "TEXTAREA" || t?.isContentEditable === !0;
75
75
  }
76
- function a(t) {
77
- r || f() || (r = !0, e.__okno_autostart = t, import("okno/editor").catch((n) => {
78
- r = !1, console.error("[okno] failed to load editor bundle", n);
76
+ function s(t) {
77
+ a || f() || (a = !0, e.__okno_autostart = t, import("okno/editor").catch((n) => {
78
+ a = !1, console.error("[okno] failed to load editor bundle", n);
79
79
  }));
80
80
  }
81
- function p() {
81
+ function E() {
82
82
  const t = e.location;
83
83
  if (!t) return !1;
84
84
  try {
@@ -87,12 +87,36 @@ function p() {
87
87
  }
88
88
  return typeof t.hash == "string" && /(?:^#|[#&])okno(?:$|[=&])/.test(t.hash);
89
89
  }
90
+ function k() {
91
+ const t = e.location;
92
+ if (!t || typeof t.hash != "string") return null;
93
+ const n = /(?:^#|[#&])okno-invite=([^&]+)/.exec(t.hash);
94
+ if (!n?.[1]) return null;
95
+ let o;
96
+ try {
97
+ o = decodeURIComponent(n[1]);
98
+ } catch {
99
+ return null;
100
+ }
101
+ try {
102
+ const i = t.hash.replace(/(^#|[#&])okno-invite=[^&]*/, "$1").replace(/^[#&]+$/, "");
103
+ e.history?.replaceState(null, "", t.pathname + t.search + (i && i !== "#" ? i : ""));
104
+ } catch {
105
+ }
106
+ return o;
107
+ }
90
108
  function g() {
91
109
  if (!e.document || (typeof __OKNO_IS_DEV__ < "u" ? __OKNO_IS_DEV__ : !1) || e.__okno_gate_installed) return;
92
- e.__okno_gate_installed = !0, e.document.addEventListener("keydown", (o) => {
93
- f() || o.key !== "e" || o.ctrlKey || o.metaKey || o.altKey || E() || a("key");
110
+ e.__okno_gate_installed = !0, e.document.addEventListener("keydown", (i) => {
111
+ f() || i.key !== "e" || i.ctrlKey || i.metaKey || i.altKey || y() || s("key");
94
112
  }), e.__okno_ensure_vt = d;
95
113
  const n = window;
96
- n.addEventListener("pageswap", v), n.addEventListener("pagereveal", y), u() && (d(), a("session")), p() && a("url");
114
+ n.addEventListener("pageswap", p), n.addEventListener("pagereveal", w), u() && (d(), s("session"));
115
+ const o = k();
116
+ if (o) {
117
+ e.__okno_invite = o, s("url");
118
+ return;
119
+ }
120
+ E() && s("url");
97
121
  }
98
122
  g();
@@ -1 +1 @@
1
- {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/codegen/modules.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,eAAe,oHACoF,CAAA;AAoBhH;kEACkE;AAClE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAKhD;AAED;;;mCAGmC;AACnC,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AA+GD;;;;;+EAK+E;AAC/E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAoD1D;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsDzE;AAED,0CAA0C;AAC1C,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAmFtG;AAED,2FAA2F;AAC3F,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CA6H7H;AAED,4CAA4C;AAC5C,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAuExG"}
1
+ {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/codegen/modules.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,eAAe,oHACoF,CAAA;AAoBhH;kEACkE;AAClE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAK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