@graview/guest 0.2.15 → 0.2.16

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.
Files changed (88) hide show
  1. package/README.md +88 -1
  2. package/dist/headless/describe.d.ts +3 -0
  3. package/dist/headless/describe.d.ts.map +1 -1
  4. package/dist/headless/describe.js +15 -0
  5. package/dist/headless/describe.js.map +1 -1
  6. package/dist/headless/index.d.ts +3 -0
  7. package/dist/headless/index.d.ts.map +1 -1
  8. package/dist/headless/index.js +1 -0
  9. package/dist/headless/index.js.map +1 -1
  10. package/dist/headless/judge.js +2 -2
  11. package/dist/headless/judge.js.map +1 -1
  12. package/dist/headless/protocol.d.ts +3 -0
  13. package/dist/headless/protocol.d.ts.map +1 -1
  14. package/dist/headless/protocol.js.map +1 -1
  15. package/dist/headless/runtime.generated.d.ts.map +1 -1
  16. package/dist/headless/runtime.generated.js +1 -1
  17. package/dist/headless/runtime.generated.js.map +1 -1
  18. package/dist/host/embed-player.d.ts +16 -0
  19. package/dist/host/embed-player.d.ts.map +1 -0
  20. package/dist/host/embed-player.js +248 -0
  21. package/dist/host/embed-player.js.map +1 -0
  22. package/dist/host/embeds.d.ts +48 -0
  23. package/dist/host/embeds.d.ts.map +1 -0
  24. package/dist/host/embeds.js +153 -0
  25. package/dist/host/embeds.js.map +1 -0
  26. package/dist/host/frame.d.ts +12 -0
  27. package/dist/host/frame.d.ts.map +1 -1
  28. package/dist/host/frame.js +71 -4
  29. package/dist/host/frame.js.map +1 -1
  30. package/dist/host/media.d.ts +3 -0
  31. package/dist/host/media.d.ts.map +1 -1
  32. package/dist/host/media.js +23 -0
  33. package/dist/host/media.js.map +1 -1
  34. package/dist/host/mine.d.ts +11 -1
  35. package/dist/host/mine.d.ts.map +1 -1
  36. package/dist/host/mine.js +111 -15
  37. package/dist/host/mine.js.map +1 -1
  38. package/dist/host/open-draw.d.ts +1 -1
  39. package/dist/host/open-draw.d.ts.map +1 -1
  40. package/dist/host/open-draw.js +2 -0
  41. package/dist/host/open-draw.js.map +1 -1
  42. package/dist/host/problems.d.ts +1 -1
  43. package/dist/host/problems.d.ts.map +1 -1
  44. package/dist/host/problems.js +6 -0
  45. package/dist/host/problems.js.map +1 -1
  46. package/dist/host/react.d.ts +17 -0
  47. package/dist/host/react.d.ts.map +1 -1
  48. package/dist/host/react.js +77 -11
  49. package/dist/host/react.js.map +1 -1
  50. package/dist/host/session.d.ts +18 -0
  51. package/dist/host/session.d.ts.map +1 -1
  52. package/dist/host/session.js +38 -4
  53. package/dist/host/session.js.map +1 -1
  54. package/dist/host/view-ahead.d.ts +21 -0
  55. package/dist/host/view-ahead.d.ts.map +1 -0
  56. package/dist/host/view-ahead.js +29 -0
  57. package/dist/host/view-ahead.js.map +1 -0
  58. package/dist/host/view-runtime.generated.d.ts.map +1 -1
  59. package/dist/host/view-runtime.generated.js +1 -1
  60. package/dist/host/view-runtime.generated.js.map +1 -1
  61. package/dist/host/view-script.d.ts +1 -0
  62. package/dist/host/view-script.d.ts.map +1 -1
  63. package/dist/host/view-script.js +1 -1
  64. package/dist/host/view-script.js.map +1 -1
  65. package/dist/host/view.d.ts +30 -0
  66. package/dist/host/view.d.ts.map +1 -1
  67. package/dist/host/view.js +203 -22
  68. package/dist/host/view.js.map +1 -1
  69. package/dist/host/views.d.ts +2 -0
  70. package/dist/host/views.d.ts.map +1 -1
  71. package/dist/host/views.js +1 -0
  72. package/dist/host/views.js.map +1 -1
  73. package/dist/host/worker-react.d.ts +3 -0
  74. package/dist/host/worker-react.d.ts.map +1 -1
  75. package/dist/host/worker-react.js +114 -24
  76. package/dist/host/worker-react.js.map +1 -1
  77. package/dist/host/worker.d.ts +4 -0
  78. package/dist/host/worker.d.ts.map +1 -1
  79. package/dist/host/worker.js +4 -0
  80. package/dist/host/worker.js.map +1 -1
  81. package/dist/open-kit.d.ts +1 -1
  82. package/dist/open-kit.d.ts.map +1 -1
  83. package/dist/open-kit.js +8 -2
  84. package/dist/open-kit.js.map +1 -1
  85. package/dist/worker/view-global.d.ts.map +1 -1
  86. package/dist/worker/view-global.js +64 -17
  87. package/dist/worker/view-global.js.map +1 -1
  88. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.generated.js","sourceRoot":"","sources":["../../src/headless/runtime.generated.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAW,u79IAAu79I,CAAC"}
1
+ {"version":3,"file":"runtime.generated.js","sourceRoot":"","sources":["../../src/headless/runtime.generated.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAW,yqpJAAyqpJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { type EmbedHost } from "./embeds.js";
2
+ export interface EmbedPlayers {
3
+ /** Draw (or keep) what the element names; why nothing was, as the rest of a sentence about it. */
4
+ draw(element: Element, shadow: ShadowRoot): string | undefined;
5
+ /** The element names no video on a provider any longer: what was drawn for one is let go. */
6
+ forget(element: Element): void;
7
+ /** Stop whatever plays. */
8
+ dispose(): void;
9
+ }
10
+ export interface EmbedPlayerOptions {
11
+ readonly embeds?: EmbedHost;
12
+ /** The page's own policy refused the player: why, as the rest of a sentence about it. */
13
+ readonly onRefused: (why: string) => void;
14
+ }
15
+ export declare function createEmbedPlayers(window: Window & typeof globalThis, options: EmbedPlayerOptions): EmbedPlayers;
16
+ //# sourceMappingURL=embed-player.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed-player.d.ts","sourceRoot":"","sources":["../../src/host/embed-player.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiG,KAAK,SAAS,EAAmB,MAAM,aAAa,CAAC;AAsB7J,MAAM,WAAW,YAAY;IAC3B,kGAAkG;IAClG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/D,6FAA6F;IAC7F,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,2BAA2B;IAC3B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,yFAAyF;IACzF,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AA8BD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,UAAU,EAAE,OAAO,EAAE,kBAAkB,GAAG,YAAY,CA2MhH"}
@@ -0,0 +1,248 @@
1
+ import { EMBED_ORIGINS, EMBED_WORDS, embedKey, embedLink, embedPlays, embedSrc, embedTitle, namedEmbed } from "./embeds.js";
2
+ const CSS = `
3
+ :host { display: block; min-width: 0; }
4
+ figure { margin: 0; display: grid; gap: 6px; color: var(--graview-ink, CanvasText); font-family: var(--graview-font-body, system-ui, sans-serif); line-height: 1.4; text-align: start; }
5
+ [data-frame] { position: relative; overflow: hidden; width: 100%; container-type: inline-size; border-radius: var(--graview-radius, 8px); background: #17191d; color: #fff; }
6
+ [data-frame] > * { position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box; border: 0; margin: 0; }
7
+ img { display: block; object-fit: cover; }
8
+ [data-words] { display: grid; place-content: center; padding: 16px; text-align: center; overflow-wrap: anywhere; }
9
+ button { display: grid; place-content: center; justify-items: center; gap: 10px; padding: 16px; background: rgb(0 0 0 / 0.6); color: #fff; font: inherit; font-weight: 600; text-align: center; cursor: pointer; border-radius: inherit; touch-action: manipulation; }
10
+ button > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
11
+ button > svg { width: min(64px, 30cqw); height: auto; }
12
+ button:hover { background: rgb(0 0 0 / 0.55); }
13
+ :focus-visible { outline: 2px solid var(--graview-ring-color, Highlight); outline-offset: 2px; }
14
+ button:focus-visible { outline: 3px solid #fff; outline-offset: -6px; box-shadow: inset 0 0 0 3px #000; }
15
+ figcaption { font-size: 0.875rem; overflow-wrap: anywhere; }
16
+ a { color: var(--graview-accent, LinkText); display: inline-block; padding-block: 3px; }
17
+ [data-address] { display: none; }
18
+ @media print { iframe { opacity: 0; } svg, img ~ button { display: none; } [data-frame] { background: none; color: inherit; outline: 1px solid; outline-offset: -1px; } button { background: none; color: inherit; } [data-address] { display: inline; } }
19
+ `;
20
+ /* One plays at a time, whichever view it is in: the last one's way back to its poster. */
21
+ let playing;
22
+ export function createEmbedPlayers(window, options) {
23
+ const document = window.document;
24
+ const drawn = new Map();
25
+ const part = (name, mark) => {
26
+ const element = document.createElement(name);
27
+ if (mark)
28
+ element.setAttribute(mark, "");
29
+ return element;
30
+ };
31
+ const make = (element, shadow, first, offered, preview, key) => {
32
+ const provider = EMBED_WORDS[first.provider];
33
+ const origin = EMBED_ORIGINS[first.provider];
34
+ let embed = first;
35
+ let title = "";
36
+ shadow.replaceChildren();
37
+ const style = part("style");
38
+ style.textContent = CSS;
39
+ const figure = part("figure");
40
+ figure.setAttribute("role", "group");
41
+ const frame = part("div", "data-frame");
42
+ const image = part("img");
43
+ image.alt = "";
44
+ image.referrerPolicy = "no-referrer";
45
+ const words = part("div", "data-words");
46
+ const button = part("button", "data-graview-embed-play");
47
+ button.type = "button";
48
+ button.innerHTML = '<svg viewBox="0 0 64 64" width="64" height="64" aria-hidden="true"><circle cx="32" cy="32" r="31" fill="#000" fill-opacity=".72" stroke="#fff" stroke-width="2"/><path d="M26 20v24l20-12z" fill="#fff"/></svg>';
49
+ const name = part("span");
50
+ button.append(name);
51
+ const caption = part("figcaption");
52
+ const link = part("a");
53
+ link.target = "_blank";
54
+ link.rel = "noopener noreferrer";
55
+ link.referrerPolicy = "no-referrer";
56
+ const address = part("span", "data-address");
57
+ caption.append(link, address);
58
+ if (offered)
59
+ figure.append(frame);
60
+ figure.append(caption);
61
+ shadow.append(style, figure);
62
+ /* A press on the player is the player's: the card around it is not opened, and the view is told nothing. */
63
+ const own = (event) => {
64
+ const pressed = event.key;
65
+ if (event.type !== "keydown" || pressed === "Enter" || pressed === " ")
66
+ event.stopPropagation();
67
+ };
68
+ for (const type of ["click", "dblclick", "keydown"])
69
+ figure.addEventListener(type, own);
70
+ /* Once the page's policy refused it, the video is its link. */
71
+ let refused = false;
72
+ let end = () => { };
73
+ const refuse = () => {
74
+ const had = shadow.activeElement !== null;
75
+ refused = true;
76
+ end();
77
+ button.remove();
78
+ words.textContent = `${provider} videos do not play on this page. The link below opens this one.`;
79
+ words.style.background = "rgb(0 0 0 / 0.72)";
80
+ words.setAttribute("role", "status");
81
+ frame.append(words);
82
+ if (had)
83
+ link.focus({ preventScroll: true });
84
+ options.onRefused(`names a ${provider} video, and the page's policy allows no frame from ${origin} (frame-src): its link stands alone`);
85
+ };
86
+ const play = () => {
87
+ if (refused)
88
+ return;
89
+ playing?.();
90
+ const player = part("iframe");
91
+ player.setAttribute("data-graview-embed", first.provider);
92
+ player.title = `${title} (${provider} player)`;
93
+ player.setAttribute("sandbox", "allow-scripts allow-same-origin");
94
+ player.setAttribute("allow", "autoplay; encrypted-media; fullscreen; picture-in-picture");
95
+ player.setAttribute("allowfullscreen", "");
96
+ player.setAttribute("loading", "lazy");
97
+ /* The page's origin and nothing more of it: YouTube's player plays for no page that says none. */
98
+ player.setAttribute("referrerpolicy", "strict-origin-when-cross-origin");
99
+ player.setAttribute("src", embedSrc(embed));
100
+ /* Where the page's own policy refuses the frame: the link and why, never an empty box. */
101
+ const violated = (event) => {
102
+ if (event.disposition !== "report" && /^(frame|child|default)-src/.test(event.effectiveDirective) && `${event.blockedURI}/`.startsWith(`${origin}/`))
103
+ refuse();
104
+ };
105
+ /* Off the page, or hidden with the place it was on. */
106
+ const gone = () => {
107
+ if (!player.isConnected || player.getClientRects().length === 0 || player.checkVisibility?.({ visibilityProperty: true }) === false)
108
+ end();
109
+ };
110
+ /* Moved, or taken out and put back: its frame would start over where it stands, so it goes back to its poster at once. Watched in every root it stands in, only while it plays. */
111
+ const moves = new window.MutationObserver((records) => {
112
+ for (const record of records)
113
+ for (const removed of record.removedNodes)
114
+ for (let at = element; at; at = at.parentNode ?? at.host ?? null)
115
+ if (at === removed)
116
+ return end();
117
+ });
118
+ for (let root = element.getRootNode();; root = root.host.getRootNode()) {
119
+ moves.observe(root, { childList: true, subtree: true });
120
+ if (!root.host)
121
+ break;
122
+ }
123
+ /* Whether the keyboard is in the player, kept as the page moves it: a frame taken off the page takes it away unsaid. */
124
+ let keyboard = true;
125
+ const keyboardMoved = () => (keyboard = shadow.activeElement === player);
126
+ document.addEventListener("focusin", keyboardMoved);
127
+ /* A press on the page itself takes it out with no focus of its own to say so. */
128
+ const pressedElsewhere = () => void (keyboard = false);
129
+ document.addEventListener("pointerdown", pressedElsewhere, true);
130
+ const watch = typeof window.ResizeObserver === "function" ? new window.ResizeObserver(gone) : undefined;
131
+ const timer = window.setInterval(gone, 1_000);
132
+ const stop = () => {
133
+ if (playing === stop)
134
+ playing = undefined;
135
+ end = () => { };
136
+ document.removeEventListener("securitypolicyviolation", violated);
137
+ watch?.disconnect();
138
+ window.clearInterval(timer);
139
+ moves.disconnect();
140
+ document.removeEventListener("focusin", keyboardMoved);
141
+ document.removeEventListener("pointerdown", pressedElsewhere, true);
142
+ const nowhere = document.activeElement === null || document.activeElement === document.body;
143
+ const had = shadow.activeElement === player || (keyboard && nowhere);
144
+ player.remove();
145
+ frame.append(button);
146
+ if (had)
147
+ button.focus({ preventScroll: true });
148
+ };
149
+ end = stop;
150
+ playing = stop;
151
+ document.addEventListener("securitypolicyviolation", violated);
152
+ frame.append(player);
153
+ player.focus({ preventScroll: true });
154
+ button.remove();
155
+ watch?.observe(player);
156
+ };
157
+ button.addEventListener("click", play);
158
+ if (offered && !preview)
159
+ frame.append(button);
160
+ return {
161
+ key,
162
+ stop: () => end(),
163
+ says(saidTitle, poster, saidEmbed) {
164
+ embed = saidEmbed;
165
+ title = saidTitle;
166
+ const [wide, tall] = embed.shape.split(":");
167
+ frame.style.aspectRatio = `${wide} / ${tall}`;
168
+ /* A tall one is held to a height a person sees whole. */
169
+ frame.style.maxWidth = embed.shape === "9:16" ? "min(100%, 45vh)" : "";
170
+ figure.setAttribute("aria-label", title);
171
+ button.setAttribute("aria-label", `Play: ${title}`);
172
+ name.textContent = title;
173
+ const href = embedLink(embed);
174
+ link.setAttribute("href", href);
175
+ link.textContent = offered ? `Watch on ${provider} ↗` : `${title}: watch on ${provider} ↗`;
176
+ link.setAttribute("aria-label", `${offered ? `Watch on ${provider}: ${title}` : `${title}: watch on ${provider}`} (opens in a new tab)`);
177
+ address.textContent = ` ${title}: ${href}`;
178
+ const player = frame.querySelector("iframe");
179
+ if (player)
180
+ player.title = `${title} (${provider} player)`;
181
+ if (poster) {
182
+ if (image.getAttribute("src") !== poster)
183
+ image.setAttribute("src", poster);
184
+ if (!image.isConnected)
185
+ frame.prepend(image);
186
+ }
187
+ else
188
+ image.remove();
189
+ /* Pictured in the Scene with no picture of its own, it says its title on the host's plain ground. */
190
+ if (preview && !refused) {
191
+ words.textContent = title;
192
+ if (poster)
193
+ words.remove();
194
+ else
195
+ frame.append(words);
196
+ }
197
+ },
198
+ };
199
+ };
200
+ const forget = (element) => {
201
+ drawn.get(element)?.stop();
202
+ drawn.delete(element);
203
+ };
204
+ return {
205
+ forget,
206
+ draw(element, shadow) {
207
+ const said = (name) => element.getAttribute(name);
208
+ const named = namedEmbed(said);
209
+ /* What a view no longer draws is stopped and let go. */
210
+ for (const one of [...drawn.keys()])
211
+ if (!one.isConnected)
212
+ forget(one);
213
+ if ("why" in named) {
214
+ forget(element);
215
+ shadow.replaceChildren();
216
+ element.setAttribute("data-graview-player", "");
217
+ return named.why;
218
+ }
219
+ /* In the Scene's card a place is pictured, not used: the poster and the link, and no player on the plane. */
220
+ const root = element.getRootNode();
221
+ const preview = (root.host ?? element).closest("[data-graview-preview]") !== null;
222
+ const offered = embedPlays(named.embed.provider, options.embeds);
223
+ const key = `${embedKey(named.embed)} ${offered} ${preview}`;
224
+ let held = drawn.get(element);
225
+ let keyboardIn;
226
+ if (held?.key !== key) {
227
+ const had = shadow.activeElement !== null;
228
+ held?.stop();
229
+ held = make(element, shadow, named.embed, offered, preview, key);
230
+ drawn.set(element, held);
231
+ /* Another video in its place keeps the keyboard there. */
232
+ if (had)
233
+ keyboardIn = shadow;
234
+ }
235
+ /* The room the region kept for it while its player was on its way is its own now (REGION_CSS). */
236
+ element.setAttribute("data-graview-player", "");
237
+ held.says(embedTitle(said, named.embed), said("poster") || null, named.embed);
238
+ keyboardIn?.querySelector("button, a")?.focus({ preventScroll: true });
239
+ return undefined;
240
+ },
241
+ dispose() {
242
+ for (const one of drawn.values())
243
+ one.stop();
244
+ drawn.clear();
245
+ },
246
+ };
247
+ }
248
+ //# sourceMappingURL=embed-player.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed-player.js","sourceRoot":"","sources":["../../src/host/embed-player.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAmC,MAAM,aAAa,CAAC;AA2C7J,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;CAiBX,CAAC;AAEF,0FAA0F;AAC1F,IAAI,OAAiC,CAAC;AAEtC,MAAM,UAAU,kBAAkB,CAAC,MAAkC,EAAE,OAA2B;IAChG,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,MAAM,IAAI,GAAG,CAAwC,IAAO,EAAE,IAAa,EAA4B,EAAE;QACvG,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,IAAI;YAAE,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAE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AC,OAAO,CAAC,CAAC;YAC9B,IAAI,UAAkC,CAAC;YACvC,IAAI,IAAI,EAAE,GAAG,KAAK,GAAG,EAAE,CAAC;gBACtB,MAAM,GAAG,GAAG,MAAM,CAAC,aAAa,KAAK,IAAI,CAAC;gBAC1C,IAAI,EAAE,IAAI,EAAE,CAAC;gBACb,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;gBACjE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBACzB,0DAA0D;gBAC1D,IAAI,GAAG;oBAAE,UAAU,GAAG,MAAM,CAAC;YAC/B,CAAC;YACD,kGAAkG;YAClG,OAAO,CAAC,YAAY,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;YAChD,IAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC/E,UAAU,EAAE,aAAa,CAAc,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;YACpF,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO;YACL,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE;gBAAE,GAAG,CAAC,IAAI,EAAE,CAAC;YAC7C,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ /** The providers a view may play a video from. */
2
+ export declare const EMBED_PROVIDERS: readonly ["youtube", "vimeo"];
3
+ export type EmbedProvider = (typeof EMBED_PROVIDERS)[number];
4
+ /** A provider as a person says it. */
5
+ export declare const EMBED_WORDS: Readonly<Record<EmbedProvider, string>>;
6
+ /** The one origin each provider's player is drawn from: what a host's `frame-src` lists. */
7
+ export declare const EMBED_ORIGINS: Readonly<Record<EmbedProvider, string>>;
8
+ /** The shapes a player may have: its width by its height. */
9
+ export declare const EMBED_SHAPES: readonly ["16:9", "4:3", "1:1", "9:16"];
10
+ export type EmbedShape = (typeof EMBED_SHAPES)[number];
11
+ export interface NamedEmbed {
12
+ readonly provider: EmbedProvider;
13
+ readonly id: string;
14
+ /** An unlisted Vimeo video's key, as its own address says it. */
15
+ readonly hash?: string;
16
+ /** Where it starts, in whole seconds. */
17
+ readonly start?: number;
18
+ readonly shape: EmbedShape;
19
+ }
20
+ /** A start as a person or an address says one — `90`, `90s`, `1m30s`, `1h2m3s` — in whole seconds; undefined where it says none. */
21
+ export declare function startOf(said: string | null | undefined): number | undefined;
22
+ /** What an element says, by attribute: `element.getAttribute`. */
23
+ export type SaidBy = (name: string) => string | null;
24
+ /** Whether a `<graview-video>` names a video on a provider, rather than a record's or the app's own. */
25
+ export declare const namesEmbed: (said: SaidBy) => boolean;
26
+ /**
27
+ * The video a `<graview-video>` names on a provider, or why it names none,
28
+ * as the rest of a sentence about it ("it …").
29
+ */
30
+ export declare function namedEmbed(said: SaidBy): {
31
+ readonly embed: NamedEmbed;
32
+ } | {
33
+ readonly why: string;
34
+ };
35
+ /** Which video it is, whatever its start and shape: one player is kept for it across a view's drawings. */
36
+ export declare const embedKey: (embed: NamedEmbed) => string;
37
+ /** The player's address, the only one a frame is given: played at once, since a person's press asks for it. */
38
+ export declare function embedSrc(embed: NamedEmbed): string;
39
+ /** Where the video is watched on the provider's own site: the link that is always there. */
40
+ export declare function embedLink(embed: NamedEmbed): string;
41
+ /** Which providers a host plays from (`embeds` on a view's definition): every one where it says nothing, none for an empty list. */
42
+ export interface EmbedHost {
43
+ readonly providers: readonly EmbedProvider[];
44
+ }
45
+ export declare const embedPlays: (provider: EmbedProvider, host: EmbedHost | undefined) => boolean;
46
+ /** A title as a view said it, held to a line. */
47
+ export declare const embedTitle: (said: SaidBy, embed: NamedE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U,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CA4BlG;AAED,2GAA2G;AAC3G,eAAO,MAAM,QAAQ,GAAI,OAAO,UAAU,KAAG,MAA8E,CAAC;AAE5H,+GAA+G;AAC/G,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAGlD;AAED,4FAA4F;AAC5F,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAGnD;AAED,oIAAoI;AACpI,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;CAC9C;AACD,eAAO,MAAM,UAAU,GAAI,UAAU,aAAa,EAAE,MAAM,SAAS,GAAG,SAAS,KAAG,OAAkE,CAAC;AAErJ,iDAAiD;AACjD,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,OAAO,UAAU,KAAG,MAG5D,CAAC"}
@@ -0,0 +1,153 @@
1
+ /*
2
+ * A VIDEO ON YOUTUBE OR VIMEO, NAMED BY A VIEW (HQ f-view-video-embeds):
3
+ * what the view said, read down to a provider and a checked id, and the only
4
+ * addresses made from them.
5
+ *
6
+ * <graview-video data-provider="youtube" data-video="dQw4w9WgXcQ"></graview-video>
7
+ * <graview-video data-watch="https://vimeo.com/76979871"></graview-video>
8
+ *
9
+ * THE PROVIDERS ARE A CLOSED LIST, and nothing a view says reaches an
10
+ * address but what is read here: an id of the provider's own alphabet and
11
+ * length, an unlisted Vimeo video's key, a start in whole seconds. The rest
12
+ * of a watch address is dropped, so the host builds each player's address
13
+ * from its own words. Anything else is refused, with why.
14
+ *
15
+ * Pure, and carried by a headless run: no DOM, nothing of the framework's,
16
+ * and no URL parser, which a headless isolate may not have.
17
+ */
18
+ /** The providers a view may play a video from. */
19
+ export const EMBED_PROVIDERS = ["youtube", "vimeo"];
20
+ /** A provider as a person says it. */
21
+ export const EMBED_WORDS = { youtube: "YouTube", vimeo: "Vimeo" };
22
+ /** The one origin each provider's player is drawn from: what a host's `frame-src` lists. */
23
+ export const EMBED_ORIGINS = { youtube: "https://www.youtube-nocookie.com", vimeo: "https://player.vimeo.com" };
24
+ /** The shapes a player may have: its width by its height. */
25
+ export const EMBED_SHAPES = ["16:9", "4:3", "1:1", "9:16"];
26
+ const YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
27
+ /* Words of YouTube's own that stand where an id does, and are no video. */
28
+ const NOT_A_VIDEO = new Set(["videoseries", "live_stream"]);
29
+ const VIMEO_ID = /^[1-9][0-9]{0,11}$/;
30
+ const VIMEO_HASH = /^[0-9a-f]{6,20}$/;
31
+ /** The latest a video may be started, in seconds: a day. */
32
+ const LATEST = 86_400;
33
+ const YOUTUBE_HOSTS = new Set(["youtube.com", "www.youtube.com", "m.youtube.com", "music.youtube.com", "www.youtube-nocookie.com", "youtube-nocookie.com"]);
34
+ const VIMEO_HOSTS = new Set(["vimeo.com", "www.vimeo.com"]);
35
+ /** A start as a person or an address says one — `90`, `90s`, `1m30s`, `1h2m3s` — in whole seconds; undefined where it says none. */
36
+ export function startOf(said) {
37
+ if (typeof said !== "string" || said === "" || said.length > 12)
38
+ return undefined;
39
+ const plain = /^([0-9]{1,6})s?$/.exec(said);
40
+ const parts = plain ? undefined : /^(?:([0-9]{1,2})h)?(?:([0-9]{1,4})m)?(?:([0-9]{1,6})s)?$/.exec(said);
41
+ if (!plain && !parts)
42
+ return undefined;
43
+ const seconds = plain ? Number(plain[1]) : Number(parts[1] ?? 0) * 3600 + Number(parts[2] ?? 0) * 60 + Number(parts[3] ?? 0);
44
+ return seconds <= LATEST ? seconds : undefined;
45
+ }
46
+ /** One value of a query or a fragment, where it is said exactly once. */
47
+ function once(pairs, name) {
48
+ const found = pairs.split("&").flatMap((pair) => (pair.startsWith(`${name}=`) ? [pair.slice(name.length + 1)] : []));
49
+ return found.length === 1 ? found[0] : undefined;
50
+ }
51
+ /* Plain printable ASCII with no user, port or backslash, and nothing encoded in its path: an address of the providers' own writing, with nothing in it to be read two ways. */
52
+ const ADDRESS = /^https?:\/\/([a-z.-]{1,40})(\/[A-Za-z0-9_\-/]{0,120})?(?:\?([A-Za-z0-9_\-.=&~+%:/,]{0,300}))?(?:#([A-Za-z0-9_\-.=&]{0,60}))?$/;
53
+ /** The video a watch address names, or undefined where it names none on the list. */
54
+ function readAddress(address) {
55
+ if (address.length > 500)
56
+ return undefined;
57
+ const split = ADDRESS.exec(address);
58
+ if (!split)
59
+ return undefined;
60
+ const host = split[1];
61
+ const path = (split[2] ?? "/").replace(/(.)\/$/, "$1");
62
+ const query = split[3] ?? "";
63
+ const fragment = split[4] ?? "";
64
+ const asked = startOf(once(query, "t") ?? once(query, "start") ?? once(fragment, "t"));
65
+ const start = asked ? { start: asked } : {};
66
+ if (host === "youtu.be" || YOUTUBE_HOSTS.has(host)) {
67
+ const short = /^\/([A-Za-z0-9_-]+)$/.exec(path);
68
+ const held = /^\/(embed|shorts|live|v)\/([A-Za-z0-9_-]+)$/.exec(path);
69
+ const id = host === "youtu.be" ? short?.[1] : path === "/watch" ? once(query, "v") : held?.[2];
70
+ if (id === undefined || !YOUTUBE_ID.test(id) || NOT_A_VIDEO.has(id))
71
+ return undefined;
72
+ return { provider: "youtube", id, ...start, ...(host !== "youtu.be" && held?.[1] === "shorts" ? { tall: true } : {}) };
73
+ }
74
+ if (VIMEO_HOSTS.has(host) || host === "player.vimeo.com") {
75
+ const held = host === "player.vimeo.com" ? /^\/video\/([0-9]+)$/.exec(path) : /^\/(?:channels\/[A-Za-z0-9_-]+\/)?([0-9]+)(?:\/([0-9a-f]+))?$/.exec(path);
76
+ const id = held?.[1];
77
+ if (id === undefined || !VIMEO_ID.test(id))
78
+ return undefined;
79
+ const hash = held?.[2] ?? once(query, "h");
80
+ if (hash !== undefined && !VIMEO_HASH.test(hash))
81
+ return undefined;
82
+ return { provider: "vimeo", id, ...(hash ? { hash } : {}), ...start };
83
+ }
84
+ return undefined;
85
+ }
86
+ /** Whether a `<graview-video>` names a video on a provider, rather than a record's or the app's own. */
87
+ export const namesEmbed = (said) => said("data-provider") !== null || said("data-video") !== null || said("data-watch") !== null;
88
+ const shown = (value) => JSON.stringify(value.length > 80 ? `${value.slice(0, 79)}…` : value);
89
+ const LIST = 'YouTube (data-provider="youtube") and Vimeo (data-provider="vimeo")';
90
+ /**
91
+ * The video a `<graview-video>` names on a provider, or why it names none,
92
+ * as the rest of a sentence about it ("it …").
93
+ */
94
+ export function namedEmbed(said) {
95
+ const provider = said("data-provider");
96
+ const video = said("data-video");
97
+ const watch = said("data-watch");
98
+ let read;
99
+ if (watch !== null) {
100
+ if (provider !== null || video !== null)
101
+ return { why: "names a video twice: by its watch address (data-watch), or by its provider and id (data-provider, data-video), and not both" };
102
+ read = readAddress(watch.trim());
103
+ if (!read)
104
+ return { why: `names the address ${shown(watch)}, which is no watch address of a provider a view plays: ${LIST}, as https://www.youtube.com/watch?v=<id>, https://youtu.be/<id> or https://vimeo.com/<id>` };
105
+ }
106
+ else {
107
+ if (provider === null)
108
+ return { why: `names the video ${shown(video ?? "")} and no provider: a view plays from ${LIST}` };
109
+ if (!EMBED_PROVIDERS.includes(provider))
110
+ return { why: `names the provider ${shown(provider)}, which is none a view plays from: ${LIST}` };
111
+ const id = video ?? "";
112
+ if (provider === "youtube") {
113
+ if (!YOUTUBE_ID.test(id) || NOT_A_VIDEO.has(id))
114
+ return { why: `names the YouTube video ${shown(id)}, which is no id of a video: one is 11 letters, digits, - and _ (the v= of its address)` };
115
+ read = { provider, id };
116
+ }
117
+ else {
118
+ const split = /^([0-9]+)(?:\/([0-9a-f]+))?$/.exec(id);
119
+ if (!split || !VIMEO_ID.test(split[1]) || (split[2] !== undefined && !VIMEO_HASH.test(split[2])))
120
+ return { why: `names the Vimeo video ${shown(id)}, which is no id of a video: one is digits, with an unlisted video's key after a slash ("76979871/8272103f6e")` };
121
+ read = { provider: "vimeo", id: split[1], ...(split[2] ? { hash: split[2] } : {}) };
122
+ }
123
+ }
124
+ const at = said("data-start");
125
+ const start = at === null ? read.start : startOf(at.trim());
126
+ if (at !== null && start === undefined)
127
+ return { why: `starts at ${shown(at)}, which is no time in it: data-start is whole seconds ("90") or "1m30s", within a day` };
128
+ const asked = said("data-shape");
129
+ if (asked !== null && !EMBED_SHAPES.includes(asked))
130
+ return { why: `asks for the shape ${shown(asked)}: a player is 16:9, 4:3, 1:1 or 9:16 (data-shape)` };
131
+ return { embed: { provider: read.provider, id: read.id, ...(read.hash ? { hash: read.hash } : {}), ...(start ? { start } : {}), shape: asked !== null ? asked : read.tall ? "9:16" : "16:9" } };
132
+ }
133
+ /** Which video it is, whatever its start and shape: one player is kept for it across a view's drawings. */
134
+ export const embedKey = (embed) => `${embed.provider}:${embed.id}${embed.hash ? `/${embed.hash}` : ""}`;
135
+ /** The player's address, the only one a frame is given: played at once, since a person's press asks for it. */
136
+ export function embedSrc(embed) {
137
+ if (embed.provider === "youtube")
138
+ return `${EMBED_ORIGINS.youtube}/embed/${embed.id}?autoplay=1&playsinline=1&rel=0${embed.start ? `&start=${embed.start}` : ""}`;
139
+ return `${EMBED_ORIGINS.vimeo}/video/${embed.id}?autoplay=1&dnt=1${embed.hash ? `&h=${embed.hash}` : ""}${embed.start ? `#t=${embed.start}s` : ""}`;
140
+ }
141
+ /** Where the video is watched on the provider's own site: the link that is always there. */
142
+ export function embedLink(embed) {
143
+ if (embed.provider === "youtube")
144
+ return `https://www.youtube.com/watch?v=${embed.id}${embed.start ? `&t=${embed.start}s` : ""}`;
145
+ return `https://vimeo.com/${embed.id}${embed.hash ? `/${embed.hash}` : ""}${embed.start ? `#t=${embed.start}s` : ""}`;
146
+ }
147
+ export const embedPlays = (provider, host) => host === undefined || host.providers.includes(provider);
148
+ /** A title as a view said it, held to a line. */
149
+ export const embedTitle = (said, embed) => {
150
+ const given = (said("aria-label") ?? said("title") ?? "").replace(/\s+/g, " ").trim().slice(0, 200);
151
+ return given || `A ${EMBED_WORDS[embed.provider]} video`;
152
+ };
153
+ //# sourceMappingURL=embeds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeds.js","sourceRoot":"","sources":["../../src/host/embeds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,kDAAkD;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,OAAO,CAAU,CAAC;AAG7D,sCAAsC;AACtC,MAAM,CAAC,MAAM,WAAW,GAA4C,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC3G,4FAA4F;AAC5F,MAAM,CAAC,MAAM,aAAa,GAA4C,EAAE,OAAO,EAAE,kCAAkC,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC;AAEzJ,6DAA6D;AAC7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC;AAapE,MAAM,UAAU,GAAG,qBAAqB,CAAC;AACzC,2EAA2E;AAC3E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;AAC5D,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AACtC,MAAM,UAAU,GAAG,kBAAkB,CAAC;AACtC,4DAA4D;AAC5D,MAAM,MAAM,GAAG,MAAM,CAAC;AAEtB,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,sBAAsB,CAAC,CAAC,CAAC;AAC5J,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;AAE5D,oIAAoI;AACpI,MAAM,UAAU,OAAO,CAAC,IAA+B;IACrD,IAAI,OAAO,IAAI,KAAK,QAAQ,IA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C;AAErJ,iDAAiD;AACjD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,KAAiB,EAAU,EAAE;IACpE,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpG,OAAO,KAAK,IAAI,KAAK,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAC3D,CAAC,CAAC"}
@@ -110,6 +110,18 @@ export interface GuestFrame {
110
110
  readonly iframe: HTMLIFrameElement;
111
111
  /** Push again: the view's input moved. */
112
112
  update(): void;
113
+ /**
114
+ * OFF THE PAGE, TO BE GONE BACK TO (Graview HQ f-custom-pages-do-not-flash):
115
+ * the frame is moved out of sight with its document as it is, still handed
116
+ * what changes, an act it asks for refused, a navigate and a height
117
+ * dropped. False where it has not drawn, or the browser cannot move a frame
118
+ * without loading it again (`Element.moveBefore`): the host disposes of it
119
+ * as ever. `gone` is called where it was handed a record its seat may no
120
+ * longer see: the host disposes of it then.
121
+ */
122
+ rest(gone: () => void): boolean;
123
+ /** Back on the page, in this element, as it stood. False where it cannot be: the host disposes of it and draws it anew. */
124
+ wake(onto: HTMLElement): boolean;
113
125
  /** What this frame has been refused or had dropped, across every document it has loaded. */
114
126
  readonly stats: Readonly<GuestStats>;
115
127
  dispose(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/host/frame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAA8E,KAAK,UAAU,EAAE,KAAK,U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