initial commit ng-app-web

pull/19/head
Niko PLP 2 years ago
parent 9de28d04ca
commit 5486f894f4
  1. 7
      Cargo.lock
  2. 1
      Cargo.toml
  3. 9
      flake.nix
  4. 17
      ng-app-web/Cargo.toml
  5. 16
      ng-app-web/LICENSE-APACHE2
  6. 22
      ng-app-web/LICENSE-MIT
  7. 42
      ng-app-web/README.md
  8. 15
      ng-app-web/index.html
  9. 11
      ng-app-web/src/lib.rs

7
Cargo.lock generated

@ -946,6 +946,13 @@ dependencies = [
"tempfile", "tempfile",
] ]
[[package]]
name = "ng-app-web"
version = "0.1.0"
dependencies = [
"wasm-bindgen",
]
[[package]] [[package]]
name = "ngcli" name = "ngcli"
version = "0.1.0" version = "0.1.0"

@ -7,4 +7,5 @@ members = [
"p2p-stores-lmdb", "p2p-stores-lmdb",
"ngcli", "ngcli",
"ngd", "ngd",
"ng-app-web",
] ]

@ -30,6 +30,11 @@
myNativeBuildInputs = with pkgs; myNativeBuildInputs = with pkgs;
[ [
pkgconfig pkgconfig
(rust-bin.stable.latest.default.override {
targets = [ "wasm32-unknown-unknown" ];
})
wasm-pack
wasm-bindgen-cli
] ]
++ lib.optionals stdenv.isLinux ++ lib.optionals stdenv.isLinux
(with pkgs; [ (with pkgs; [
@ -89,6 +94,10 @@
pname = "ngd"; pname = "ngd";
buildAndTestSubdir = "./ngd"; buildAndTestSubdir = "./ngd";
}; };
ng-app-web = myBuildRustPackage rec {
pname = "ng-app-web";
buildAndTestSubdir = "./ng-app-web";
};
default = ngd; default = ngd;
}; };

@ -0,0 +1,17 @@
[package]
name = "ng-app-web"
version = "0.1.0"
edition = "2021"
license = "MIT/Apache-2.0"
authors = ["Niko PLP <niko@nextgraph.org>"]
description = "Web app client of NextGraph"
repository = "https://git.nextgraph.org/NextGraph/nextgraph-rs"
[package.metadata.wasm-pack.profile.release]
wasm-opt = false
[lib]
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "0.2"

@ -0,0 +1,16 @@
Apache 2.0 License
Copyright (c) 2022-2023 Niko Bonnieure, Par le Peuple, NextGraph.org developers
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2022-2023 Niko Bonnieure, Par le Peuple, NextGraph.org developers
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,42 @@
# ng-app-web
Web JS/WASM module of NextGraph
## NextGraph
> NextGraph brings about the convergence between P2P and Semantic Web technologies, towards a decentralized, secure and privacy-preserving cloud, based on CRDTs.
>
> This open source ecosystem provides solutions for end-users and software developers alike, wishing to use or create **decentralized** apps featuring: **live collaboration** on rich-text documents, peer to peer communication with end-to-end encryption, offline-first, **local-first**, portable and interoperable data, total ownership of data and software, security and privacy. Centered on repositories containing **semantic data** (RDF), **rich text**, and structured data formats like **JSON**, synced between peers belonging to permissioned groups of users, it offers strong eventual consistency, thanks to the use of **CRDTs**. Documents can be linked together, signed, shared securely, queried using the **SPARQL** language and organized into sites and containers.
>
> More info here [https://nextgraph.org](https://nextgraph.org)
## Web JS/WASM module
This module is part of the SDK of NextGraph.
## Support
Documentation can be found here [https://docs.nextgraph.org](https://docs.nextgraph.org)
And our community forum where you can ask questions is here [https://forum.nextgraph.org](https://forum.nextgraph.org)
## For developers
Read our [getting started guide](https://docs.nextgraph.org/en/getting-started/).
```
npm i np-app-web
```
## License
Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE2](LICENSE-APACHE2) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
`SPDX-License-Identifier: Apache-2.0 OR MIT`
---
NextGraph received funding through the [NGI Assure Fund](https://nlnet.nl/project/NextGraph/index.html), a fund established by [NLnet](https://nlnet.nl/) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu/) programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 957073.

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>hello-wasm example</title>
</head>
<body>
<script type="module">
import init, { greet } from "./pkg/ng_app_web.js";
init().then(() => {
greet("WebAssembly");
});
</script>
</body>
</html>

@ -0,0 +1,11 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern {
pub fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet(name: &str) {
alert(&format!("Hello, {}!", name));
}
Loading…
Cancel
Save