@cesarvenzac/closeup 0.1.1 → 0.2.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/README.md +9 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -1
- package/dist/ui/panel.d.ts +2 -1
- package/dist/ui/panel.js +8 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Film any part of a web page in close-up, sharp at any size: photos and videos of an element or
|
|
4
4
|
a region, with a drawn macOS-like cursor that follows your mouse or plays a path you draw, on a
|
|
5
|
-
background, with click sounds.
|
|
5
|
+
background, with click sounds. Try it on [its page](https://cesarvenzac.com/lab/closeup).
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
npm install @cesarvenzac/closeup
|
|
@@ -24,6 +24,14 @@ addEventListener("keydown", (event) => {
|
|
|
24
24
|
});
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
Or open it on an element, ready to film, from a button of your own:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { open } from "@cesarvenzac/closeup";
|
|
31
|
+
|
|
32
|
+
filmIt.addEventListener("click", () => open({ pick: document.querySelector("#demo") }));
|
|
33
|
+
```
|
|
34
|
+
|
|
27
35
|
Press the shortcut, point at an element (↑ and ↓ widen and narrow the pick) or draw a region,
|
|
28
36
|
choose a photo or a video, and press Record. Chrome asks once to share the tab. Options set the
|
|
29
37
|
shape (16:9, 1:1, 4:5, 9:16 or the pick's own), the room round the pick, a background (a colour,
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ export { parseScript, type Script, type Step, type Target } from "./script.ts";
|
|
|
15
15
|
export type { Settings } from "./settings.ts";
|
|
16
16
|
export { loadScript, saveScript } from "./store.ts";
|
|
17
17
|
export declare const DEFAULT_SHORTCUT = "Alt+Shift+C";
|
|
18
|
-
|
|
18
|
+
/** Opens Closeup. With `pick`, an element of the page, it opens on it, ready to film; without, it asks what to film. */
|
|
19
|
+
export declare const open: ({ pick }?: {
|
|
20
|
+
pick?: Element | null;
|
|
21
|
+
}) => void;
|
|
19
22
|
export declare const close: () => void | undefined;
|
|
20
23
|
export declare const toggle: () => void;
|
|
21
24
|
/** Opens and closes Closeup with `shortcut` (⌥⇧C unless told otherwise). Returns what removes it. */
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,8 @@ export const DEFAULT_SHORTCUT = "Alt+Shift+C";
|
|
|
19
19
|
let panel = null;
|
|
20
20
|
let label = shortcutLabel(parseShortcut(DEFAULT_SHORTCUT));
|
|
21
21
|
const instance = () => (panel ??= new Panel(label));
|
|
22
|
-
|
|
22
|
+
/** Opens Closeup. With `pick`, an element of the page, it opens on it, ready to film; without, it asks what to film. */
|
|
23
|
+
export const open = ({ pick } = {}) => instance().open(pick ?? undefined);
|
|
23
24
|
export const close = () => panel?.close();
|
|
24
25
|
export const toggle = () => instance().toggle();
|
|
25
26
|
/** Opens and closes Closeup with `shortcut` (⌥⇧C unless told otherwise). Returns what removes it. */
|
package/dist/ui/panel.d.ts
CHANGED
|
@@ -32,7 +32,8 @@ export declare class Panel {
|
|
|
32
32
|
private rehearsal;
|
|
33
33
|
constructor(shortcutLabel: string);
|
|
34
34
|
get isOpen(): boolean;
|
|
35
|
-
|
|
35
|
+
/** Opens on `pick`, an element of the page, ready to film; without one, asks what to film. */
|
|
36
|
+
open(pick?: Element): void;
|
|
36
37
|
close(): void;
|
|
37
38
|
toggle(): void;
|
|
38
39
|
private startPick;
|
package/dist/ui/panel.js
CHANGED
|
@@ -90,7 +90,11 @@ export class Panel {
|
|
|
90
90
|
get isOpen() {
|
|
91
91
|
return this.mounted;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
/** Opens on `pick`, an element of the page, ready to film; without one, asks what to film. */
|
|
94
|
+
open(pick) {
|
|
95
|
+
// Already filming, editing or showing a take: that comes first.
|
|
96
|
+
if (this.mounted && this.state !== "idle" && this.state !== "picking" && this.state !== "picked")
|
|
97
|
+
return;
|
|
94
98
|
if (!this.mounted) {
|
|
95
99
|
document.documentElement.append(this.layer, this.ui);
|
|
96
100
|
this.mounted = true;
|
|
@@ -104,7 +108,9 @@ export class Panel {
|
|
|
104
108
|
}
|
|
105
109
|
this.$(".bar").hidden = false;
|
|
106
110
|
this.renderBar();
|
|
107
|
-
if (
|
|
111
|
+
if (pick?.isConnected)
|
|
112
|
+
this.choose({ element: pick, rect: toRect(pick.getBoundingClientRect()), label: describe(pick) });
|
|
113
|
+
else if (!this.picked)
|
|
108
114
|
this.startPick();
|
|
109
115
|
else
|
|
110
116
|
this.showPicked();
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cesarvenzac/closeup",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Film any part of a web page in close-up, sharp at any size: photos and videos with a drawn cursor, backgrounds and sound.",
|
|
5
5
|
"keywords": ["screen-recording", "screencast", "screenshot", "video", "cursor", "demo", "region-capture", "browser"],
|
|
6
|
-
"homepage": "https://
|
|
6
|
+
"homepage": "https://cesarvenzac.com/lab/closeup",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/cesarvenzac/closeup.git"
|