@crossbind/extension-page-drops 0.0.0-stage → 2.0.0-beta.69

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Buğra Sarı and crossbind contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # @crossbind/extension-page-drops
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The paths of files dropped on a desktop page, which a web page never gets.
4
+
5
+ An app has it by having `@crossbind/core-app-host`, which lists it as a dependency: there is nothing to install or list.
6
+
7
+ ## What it does
8
+
9
+ A desktop page hears of the files its user drops on it as the event `drop`, `{ paths, x, y }`: their absolute paths and
10
+ where they were dropped, which a web page never gets. The page's own `drop` event goes on, with its `File`s.
11
+
12
+ ```js
13
+ import { events } from 'crossbind/app';
14
+
15
+ events.on('drop', ({ paths }) => importAll(paths));
16
+ ```
17
+
18
+ ## Platforms
19
+
20
+ macOS, Linux and Windows.
21
+
22
+ ## Replace or leave out
23
+
24
+ It holds the role `page-drops`. An extension that gives `replaces: 'page-drops'` takes it; `app: { without: ['page-drops'] }` in `crossbind.config.js` leaves it out. [The guide](https://crossbind.dev/guide/extensions/#replace) shows how, and [extensions.md](https://github.com/crossbind/crossbind/blob/main/docs/api/extensions.md#the-hosts-own-extensions) what a replacement answers.
25
+
26
+ [extensions.md](https://github.com/crossbind/crossbind/blob/main/docs/api/extensions.md#the-pages-requests) has the hooks a replacement answers.
@@ -0,0 +1,12 @@
1
+ export default function pageDrops() {
2
+ return {
3
+ name: 'page-drops',
4
+ contract: 1,
5
+ root: import.meta.dirname,
6
+ app: {
7
+ macos: { sources: ['native/drops.cpp'] },
8
+ linux: { sources: ['native/drops.cpp'] },
9
+ windows: { sources: ['native/drops.cpp'] },
10
+ },
11
+ };
12
+ }
@@ -0,0 +1,16 @@
1
+ #include "crossbind/app.h"
2
+ #include "crossbind/extension.h"
3
+
4
+ // The host's page-drops: the page the files were dropped on hears of each drop as the event drop, of { paths, x, y },
5
+ // and reaches each path through crossbind/app's shell functions, as one its user picked.
6
+ void crossbind_extension_page_drops(crossbind::Registry &registry) {
7
+ registry.onDrop([](const crossbind::Drop &drop) {
8
+ crossbind::Value::Array listed;
9
+ for (const auto &path : drop.paths) {
10
+ crossbind::allowPath(path);
11
+ listed.emplace_back(path);
12
+ }
13
+ const crossbind::Value value(crossbind::Value::Object{{"paths", crossbind::Value(std::move(listed))}, {"x", drop.x}, {"y", drop.y}});
14
+ crossbind::app::emitEvent("drop", value.json(), drop.page.id());
15
+ });
16
+ }
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@crossbind/extension-page-drops",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.0.0-beta.69",
4
+ "description": "crossbind app extension: the paths of files dropped on a desktop page, which a web page never gets.",
5
+ "homepage": "https://github.com/crossbind/crossbind/tree/main/extensions/page-drops#readme",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/crossbind/crossbind.git"
9
+ },
10
+ "license": "MIT",
11
+ "type": "module",
12
+ "exports": {
13
+ "./page": {
14
+ "types": "./page.d.ts"
15
+ },
16
+ "./crossbind.extension.js": "./crossbind.extension.js"
17
+ },
18
+ "files": [
19
+ "crossbind.extension.js",
20
+ "native",
21
+ "page.d.ts"
22
+ ],
23
+ "crossbind": {
24
+ "extension": "./crossbind.extension.js"
25
+ },
26
+ "peerDependencies": {
27
+ "crossbind": "^2.0.0-beta.69"
28
+ },
29
+ "devDependencies": {
30
+ "crossbind": "^2.0.0-beta.69"
31
+ },
32
+ "keywords": [
33
+ "crossbind-extension",
34
+ "crossbind",
35
+ "page",
36
+ "drops",
37
+ "app"
38
+ ]
6
39
  }
package/page.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /** What the event drop carries: the absolute paths of the files the app's user dropped on the page at once, and the page's point they were dropped at, in CSS pixels from its top left. */
2
+ export interface PageDrop {
3
+ paths: string[];
4
+ x: number;
5
+ y: number;
6
+ }
7
+
8
+ declare module 'crossbind/app/core' {
9
+ interface AppEvents {
10
+ /** Calls listener with the files of each drop of the app's user's on the page, on the desktop, as the page's own drop event goes on, until the function it returns is called. The page may reach each path through shell's functions, as one its user picked. */
11
+ drop: PageDrop;
12
+ }
13
+ }