From 254ad56e5bc615685c023786565c1c97b849a364 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Mon, 2 Sep 2024 05:32:07 +0300 Subject: [PATCH] edit title and intro --- Cargo.lock | 1 + RELEASE-NOTE.md | 1 - ng-app/index-web.html | 9 +- ng-app/src-tauri/src/lib.rs | 49 +++++++ ng-app/src/api.ts | 2 + ng-app/src/apps/ContainerView.svelte | 34 ++++- ng-app/src/apps/SparqlQueryEditor.svelte | 4 +- ng-app/src/classes.ts | 77 +++++----- ng-app/src/lib/Document.svelte | 4 +- ng-app/src/lib/FullLayout.svelte | 123 +++++++++------- ng-app/src/lib/icons/DataClassIcon.svelte | 10 +- ng-app/src/lib/popups/Header.svelte | 70 +++++++++ ng-app/src/locales/en.json | 13 +- ng-app/src/routes/WalletInfo.svelte | 4 +- ng-app/src/routes/WalletLogin.svelte | 42 +++--- ng-app/src/store.ts | 61 +++++++- ng-app/src/styles.css | 6 +- ng-app/src/tab.ts | 7 +- ng-app/src/zeras.ts | 32 ++--- ng-net/src/app_protocol.rs | 56 +++++++- ng-oxigraph/src/oxigraph/sparql/dataset.rs | 26 +++- ng-oxigraph/src/oxigraph/storage/mod.rs | 12 +- ng-repo/src/repo.rs | 11 +- ng-repo/src/store.rs | 90 ++++++++---- ng-repo/src/types.rs | 17 +++ ng-sdk-js/app-node/index.js | 64 +++++---- ng-sdk-js/src/lib.rs | 110 ++++++++++++++ ng-verifier/Cargo.toml | 1 + ng-verifier/src/commits/transaction.rs | 99 +++++++++---- ng-verifier/src/request_processor.rs | 159 +++++++++++++++++++++ ng-verifier/src/site.rs | 2 +- ng-verifier/src/types.rs | 13 ++ ng-verifier/src/verifier.rs | 100 ++++++++++--- 33 files changed, 1033 insertions(+), 276 deletions(-) create mode 100644 ng-app/src/lib/popups/Header.svelte diff --git a/Cargo.lock b/Cargo.lock index 0b66a14..50f07c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3507,6 +3507,7 @@ dependencies = [ "either", "futures", "getrandom 0.2.10", + "lazy_static", "ng-net", "ng-oxigraph", "ng-repo", diff --git a/RELEASE-NOTE.md b/RELEASE-NOTE.md index 48ec1c4..c5e774c 100644 --- a/RELEASE-NOTE.md +++ b/RELEASE-NOTE.md @@ -40,6 +40,5 @@ The `ngcli` daemon is release with the basic features listed in `ngcli --help`. - you cannot share documents with other users. Everything is ready for this internally, but there is still some wiring to do that will take some more time. - the Rich text editors (both for normal Post/Article and in Markdown) do not let you insert images nor links to other documents. -- your documents listed in your 3 stores do not display any title or content type, making it difficult to understand which document is which by just reading the 7-character ID of the documents. This will be addressed very quickly, as soon as the "Header branch" feature will be implemented. For the same reason (lack of this feature), and in the web-app only, when you will have created many docs with many modifications, the loading of your app can take some time because it is loading all the content of all the docs at startup. The native apps are already working well and do not suffer from this caveat. For the web-app, it is not the intended behaviour of course, but we need the "Header branch" feature to fix this. - The webapp has some limitation for now when it is offline, because it doesn't have a UserStorage. it works differently than the native apps, as it has to replay all the commits at every load. This will stay like that for now, as the feature "Web UserStorage" based on IndexedDB will take some time to be coded. - JSON-LD isn't ready yet as we need the "Context branch" feature in order to enter the list of ontologies each document is based on. diff --git a/ng-app/index-web.html b/ng-app/index-web.html index 12b3a4f..729114b 100644 --- a/ng-app/index-web.html +++ b/ng-app/index-web.html @@ -116,19 +116,24 @@
{#each contained(commits.graph) as doc} - + {#await fetch_header(doc.repo)} + + {:then header} +
{#if header.class}{:else}{/if}
+ {/await} {/each} {#if commits.graph.length == 0 || contained(commits.graph).length == 0}

{$t("doc.empty_container")}

diff --git a/ng-app/src/apps/SparqlQueryEditor.svelte b/ng-app/src/apps/SparqlQueryEditor.svelte index dc8bcb8..76fbf34 100644 --- a/ng-app/src/apps/SparqlQueryEditor.svelte +++ b/ng-app/src/apps/SparqlQueryEditor.svelte @@ -55,7 +55,7 @@ await reset_toasts(); results = await sparql_query($in_memory_discrete, union); } catch(e) { - console.log(e) + console.error(e) toast_error(display_error(e)); } } @@ -112,7 +112,7 @@ {#each results.results.bindings as row} {#each results.head.vars as variable} - {row[variable].value} + {#if row[variable]} {row[variable].value }{/if} {/each} {/each} diff --git a/ng-app/src/classes.ts b/ng-app/src/classes.ts index 6499364..5929e0e 100644 --- a/ng-app/src/classes.ts +++ b/ng-app/src/classes.ts @@ -12,7 +12,7 @@ // "data:graph", "data:json", "data:array", "data:map", "data:xml", "data:table", "data:collection", "data:board", "data:grid", "data:geomap", // "e:email", "e:web", "e:http://[url of class in ontology]", "e:rdf" (read-only cache of RDF fetched from web2.0) // "mc:text", "mc:link", "mc:card", "mc:pad", -// "doc:diagram","doc:chart", "doc:pdf", "doc:odf", "doc:latex", "doc:ps", "doc:music", "doc:maths", "doc:chemistry", "doc:braille", "doc:ancientscript", +// "diagram","chart", "doc:pdf", "doc:odf", "doc:latex", "doc:ps", "doc:music", "doc:maths", "doc:chemistry", "doc:braille", "doc:ancientscript", // "media:image", "media:reel", "media:album", "media:video", "media:audio", "media:song", "media:subtitle", "media:overlay", // "social:channel", "social:stream", "social:contact", "social:event", "social:calendar", "social:scheduler", "social:reaction", "social:chatroom", // "prod:task", "prod:project", "prod:issue", "prod:form", "prod:filling", "prod:cad", "prod:slides", "prod:question", "prod:answer", "prod:poll", "prod:vote" @@ -165,35 +165,24 @@ export const official_classes = { }, "ng:compat": ["rdfs:Class"], }, - "schema:rdfs": { + "schema": { // display with https://github.com/VisualDataWeb/WebVOWL "ng:crdt": "Graph", - "ng:n": "Schema - RDFS", - "ng:a": "Define the Schema, Ontology or Vocabulary for your data and the relations between them, with RDFS", - "ng:o": "n:g:z:json_ld_viewer", // default viewer + "ng:n": "Schema - RDFS/OWL", + "ng:a": "Define the Schema, Ontology or Vocabulary for your data and the relations between them, with RDFS and/or OWL", + "ng:o": "n:g:z:ontology_viewer", // default viewer "ng:w": "n:g:z:ontology_editor", // default editor "ng:x": { "rdfs":true, - }, - "ng:include": ["data:graph"], - "ng:compat": ["rdfs:*","class"], - }, - "schema:owl": { // display with https://github.com/VisualDataWeb/WebVOWL - "ng:crdt": "Graph", - "ng:n": "Schema - OWL", - "ng:a": "Define the Schema, Ontology or Vocabulary for your data and the relations between them, with OWL", - "ng:o": "n:g:z:owl_viewer", // default viewer - "ng:w": "n:g:z:ontology_editor", // default editor - "ng:x": { "owl":true, }, "ng:include": ["data:graph"], - "ng:compat": ["owl:Ontology"], + "ng:compat": ["rdfs:*","class","owl:Ontology"], }, "schema:shacl": { "ng:crdt": "Graph", "ng:n": "Schema - SHACL", - "ng:a": "Define the Schema, Ontology or Vocabulary for your data and the relations between them, with SHACL", - "ng:o": "n:g:z:json_ld_viewer", // default viewer + "ng:a": "Define the rules for your data with SHACL", + "ng:o": "n:g:z:ontology_viewer", // default viewer "ng:w": "n:g:z:ontology_editor", // default editor "ng:x": { "sh":true, @@ -204,8 +193,8 @@ export const official_classes = { "schema:shex": { "ng:crdt": "Graph", "ng:n": "Schema - SHEX", - "ng:a": "Define the Schema, Ontology or Vocabulary for your data and the relations between them, with SHEX", - "ng:o": "n:g:z:json_ld_viewer", // default viewer + "ng:a": "Define the rules for your data with SHEX", + "ng:o": "n:g:z:ontology_viewer", // default viewer "ng:w": "n:g:z:ontology_editor", // default editor "ng:x": { "shex":true, @@ -426,13 +415,13 @@ export const official_classes = { "ng:n": "Link", "ng:a": "Link to a document. kept in Magic Carpet", }, - "plato/card": { + "plato:card": { "ng:crdt": "Graph", "ng:n": "Card", "ng:a": "Card representation of a document", "ng:o": "n:g:z:card", }, - "plato/pad": { + "plato:pad": { "ng:crdt": "Graph", "ng:n": "Pad", "ng:a": "Pad representation of a document", @@ -445,62 +434,62 @@ export const official_classes = { "ng:o": "n:g:z:compose:viewer", "ng:w": "n:g:z:compose:editor", }, - "doc:diagram:mermaid" : { + "diagram:mermaid" : { "ng:crdt": "YText", "ng:n": "Diagram - Mermaid", "ng:a": "Describe Diagrams with Mermaid", "ng:compat": ["file:iana:application:vnd.mermaid"] }, - "doc:diagram:drawio" : { + "diagram:drawio" : { "ng:crdt": "YXml", "ng:n": "Diagram - DrawIo", "ng:a": "Draw Diagrams with DrawIo", "ng:compat": ["file:iana:application:vnd.jgraph.mxfile","file:iana:application:x-drawio"] }, - "doc:diagram:graphviz" : { + "diagram:graphviz" : { "ng:crdt": "YText", "ng:n": "Diagram - Graphviz", "ng:a": "Describe Diagrams with Graphviz", "ng:compat": ["file:iana:text:vnd.graphviz"] }, - "doc:diagram:excalidraw" : { + "diagram:excalidraw" : { "ng:crdt": "Automerge", "ng:n": "Diagram - Excalidraw", "ng:a": "Collaborate on Diagrams with Excalidraw", "ng:compat": ["file:iana:application:vnd.excalidraw+json"] }, - "doc:diagram:gantt" : { //https://github.com/frappe/gantt + "diagram:gantt" : { //https://github.com/frappe/gantt "ng:crdt": "Automerge", "ng:n": "Diagram - Gantt", "ng:a": "Interactive gantt chart", "ng:compat": [] }, - "doc:diagram:flowchart" : { //https://github.com/adrai/flowchart.js + "diagram:flowchart" : { //https://github.com/adrai/flowchart.js "ng:crdt": "YText", "ng:n": "Diagram - Flowchart", "ng:a": "flow chart diagrams", "ng:compat": [] }, - "doc:diagram:sequence" : { //https://github.com/bramp/js-sequence-diagrams + "diagram:sequence" : { //https://github.com/bramp/js-sequence-diagrams "ng:crdt": "YText", "ng:n": "Diagram - Sequence", "ng:a": "sequence diagrams", "ng:compat": [] }, // checkout https://www.mindmaps.app/ but it is AGPL - "doc:diagram:markmap" : { //https://github.com/markmap/markmap + "diagram:markmap" : { //https://github.com/markmap/markmap "ng:crdt": "YText", "ng:n": "Diagram - Markmap", "ng:a": "mindmaps with markmap", "ng:compat": [] }, - "doc:diagram:mymind" : { //https://github.com/markmap/markmap + "diagram:mymind" : { //https://github.com/markmap/markmap "ng:crdt": "YText", // see MyMind format, MindMup JSON, FreeMind XML and MindMap Architect XML "ng:n": "Diagram - Mymind", "ng:a": "mindmaps with mymind", "ng:compat": [] // https://github.com/ondras/my-mind/wiki/Saving-and-loading#file-formats }, - "doc:diagram:jsmind" : { //https://github.com/hizzgdev/jsmind + "diagram:jsmind" : { //https://github.com/hizzgdev/jsmind "ng:crdt": "Automerge", "ng:n": "Diagram - jsmind", "ng:a": "mindmaps with jsmind", @@ -514,69 +503,69 @@ export const official_classes = { // https://github.com/Rich-Harris/pancake // https://github.com/williamngan/pts // https://visjs.org/ - "doc:viz:cytoscape" : { + "viz:cytoscape" : { "ng:crdt": "Automerge", "ng:n": "Viz - Cytoscape", "ng:a": "Graph theory (network) visualization", "ng:compat": [] // https://github.com/cytoscape/cytoscape.js }, - "doc:viz:vega" : { + "viz:vega" : { "ng:crdt": "Automerge", "ng:n": "Viz - Vega", "ng:a": "Grammar for interactive graphics", "ng:compat": [] // https://vega.github.io/vega-lite/docs/ https://github.com/vega/editor }, - "doc:viz:vizzu" : { + "viz:vizzu" : { "ng:crdt": "Automerge", "ng:n": "Viz - Vizzu", "ng:a": "Animated data visualizations and data stories", "ng:compat": [] // https://github.com/vizzuhq/vizzu-lib }, - "doc:viz:plotly" : { //https://github.com/plotly/plotly.js + "viz:plotly" : { //https://github.com/plotly/plotly.js "ng:crdt": "Automerge", "ng:n": "Viz - Plotly", "ng:a": "Declarative charts", "ng:compat": [] // https://github.com/cytoscape/cytoscape.js }, - "doc:viz:avail" : { + "viz:avail" : { "ng:crdt": "Automerge", "ng:n": "Viz - Avail", "ng:a": "Time Data Availability Visualization", "ng:compat": [] // https://github.com/flrs/visavail }, - "doc:chart:frappecharts" : { + "chart:frappecharts" : { "ng:crdt": "Automerge", "ng:n": "Charts - Frappe", "ng:a": "GitHub-inspired responsive charts", "ng:compat": [] // https://github.com/frappe/charts }, - "doc:chart:financial" : { + "chart:financial" : { "ng:crdt": "Automerge", "ng:n": "Charts - Financial", "ng:a": "Financial charts", "ng:compat": [] //https://github.com/tradingview/lightweight-charts }, // have a look at https://github.com/cube-js/cube and https://awesome.cube.dev/ and https://frappe.io/products - "doc:chart:apexcharts" : { + "chart:apexcharts" : { "ng:crdt": "Automerge", "ng:n": "Charts - ApexCharts", "ng:a": "Interactive data visualizations", "ng:compat": [] // https://github.com/apexcharts/apexcharts.js }, //realtime data with https://github.com/square/cubism - "doc:chart:billboard" : { + "chart:billboard" : { "ng:crdt": "Automerge", "ng:n": "Charts - BillBoard", "ng:a": "Interactive data visualizations based on D3", "ng:compat": [] // https://github.com/naver/billboard.js }, - "doc:chart:echarts" : { + "chart:echarts" : { "ng:crdt": "Automerge", "ng:n": "Charts - ECharts", "ng:a": "Interactive charting and data visualization with Apache ECharts", "ng:compat": [] // https://github.com/apache/echarts }, - "doc:chart:chartjs" : { + "chart:chartjs" : { "ng:crdt": "Automerge", "ng:n": "Charts - Chart.js", "ng:a": "Simple yet flexible charting for designers & developers with Chart.js", diff --git a/ng-app/src/lib/Document.svelte b/ng-app/src/lib/Document.svelte index 939124d..457e642 100644 --- a/ng-app/src/lib/Document.svelte +++ b/ng-app/src/lib/Document.svelte @@ -14,7 +14,7 @@ branch_subscribe, active_session, cannot_load_offline, - online, + open_doc_popup } from "../store"; import { @@ -42,7 +42,7 @@ const inview_options = {};//{rootMargin: "-44px"}; function openEditHeader() { - //TODO + open_doc_popup("header"); } diff --git a/ng-app/src/lib/FullLayout.svelte b/ng-app/src/lib/FullLayout.svelte index 381ccf5..15c88f9 100644 --- a/ng-app/src/lib/FullLayout.svelte +++ b/ng-app/src/lib/FullLayout.svelte @@ -34,7 +34,6 @@ import BranchIcon from "./icons/BranchIcon.svelte"; import Message from "./components/Message.svelte"; - import Signature from "./popups/Signature.svelte"; import { get, } from "svelte/store"; @@ -47,11 +46,11 @@ has_editor_chat, all_files_count, all_comments_count, hideMenu, show_modal_menu, show_modal_create, cur_tab_branch_nuri, cur_tab_doc_can_edit, cur_tab_doc_is_member, cur_tab_right_pane, cur_tab_folders_pane, cur_tab_toc_pane, cur_tab_show_menu, cur_tab_branch_has_discrete, cur_tab_graph_or_discrete, cur_tab_view_or_edit, show_spinner, - in_private_store, show_doc_popup, cur_doc_popup, open_doc_popup } from "../tab"; + in_private_store, show_doc_popup, cur_doc_popup } from "../tab"; import { active_session, redirect_after_login, toasts, check_has_camera, toast_error, reset_toasts, redirect_if_wallet_is, active_wallet, - display_error, openModalCreate + display_error, openModalCreate, open_doc_popup } from "../store"; import ZeraIcon from "./icons/ZeraIcon.svelte"; import ng from "../api"; @@ -300,33 +299,33 @@ ]; const create_chart_items = [ - "doc:chart:frappecharts", - "doc:chart:financial", - "doc:chart:apexcharts", - "doc:chart:billboard", - "doc:chart:echarts", - "doc:chart:chartjs", + "chart:frappecharts", + "chart:financial", + "chart:apexcharts", + "chart:billboard", + "chart:echarts", + "chart:chartjs", ]; const create_viz_items = [ - "doc:viz:cytoscape", - "doc:viz:vega", - "doc:viz:vizzu", - "doc:viz:plotly", - "doc:viz:avail", + "viz:cytoscape", + "viz:vega", + "viz:vizzu", + "viz:plotly", + "viz:avail", ]; const create_diagram_items = [ - "doc:diagram:mermaid", - "doc:diagram:drawio", - "doc:diagram:graphviz", - "doc:diagram:excalidraw", - "doc:diagram:gantt", - "doc:diagram:flowchart", - "doc:diagram:sequence", - "doc:diagram:markmap", - "doc:diagram:mymind", - "doc:diagram:jsmind", + "diagram:mermaid", + "diagram:drawio", + "diagram:graphviz", + "diagram:excalidraw", + "diagram:gantt", + "diagram:flowchart", + "diagram:sequence", + "diagram:markmap", + "diagram:mymind", + "diagram:jsmind", ]; const create_doc_items = [ @@ -367,6 +366,19 @@ "app:n:xxx.xx.xx", ]; + import Signature from "./popups/Signature.svelte"; + import Header from "./popups/Header.svelte"; + + const doc_popups = { + "signature": Signature, + "header": Header, + } + + const doc_popups_size = { + "signature": "xs", + "header": "md", + } + let top; let shareMenu; let toolsMenu; @@ -428,7 +440,7 @@ const openAction = (action:string) => { hideMenu(); - if (doc_popups[action]) open_doc_popup(action); + open_doc_popup(action); } const openPane = (pane:string) => { @@ -564,10 +576,6 @@ "mc":Sparkles, }; - const doc_popups = { - "signature": Signature, - } - let destination = "store"; $: destination = $cur_tab_branch_nuri === "" ? "mc" : destination == "mc" ? "store" : destination; @@ -755,7 +763,8 @@ {/if} {#if $cur_tab_doc_can_edit} - openAction("new_block") }> + + {/if} {#if $has_editor_chat} - openPane("chat") }> + + {$t("doc.menu.items.editor_chat.label")} @@ -794,14 +804,16 @@ {#if open_share } {#each share_items as share} - openShare(share.n) }> + + {$t(`doc.menu.items.${share.n}.label`)} {/each} {/if} {:else} - openShare("download") }> + + {$t(`doc.menu.items.download.label`)} @@ -823,37 +835,37 @@ {$t("doc.menu.items.history.label")} - - + + {$t("doc.menu.items.find.label")} - - + + {$t("doc.menu.items.bookmark.label")} - - + + {$t("doc.menu.items.annotate.label")} - - openPane("info") }> + + {$t("doc.menu.items.info.label")} - - openAction("notifs") }> + + {$t("doc.menu.items.notifs.label")} {#if $cur_tab_doc_is_member && !$in_private_store} - openAction("permissions") }> + + {$t("doc.menu.items.permissions.label")} {/if} - openAction("settings") }> + + openAction(tool.n) }> + + openAction(tool.n) : undefined }> {$t(`doc.menu.items.${tool.n}.label`)} @@ -895,11 +910,13 @@ {/each} {/if} {/if} - openPane("mc") }> + + {$t("doc.menu.items.mc.label")} - openArchive() }> + + - + {#if doc_popups[$cur_doc_popup]}{/if}
{ createMenuOpened.chart = !createMenuOpened.chart; scrollToCreateMenu("chart"); } }> - + {$t("doc.chart")} {#if createMenuOpened.chart } @@ -1136,7 +1153,7 @@
{ createMenuOpened.viz = !createMenuOpened.viz; scrollToCreateMenu("viz"); } }> - + {$t("doc.viz")} {#if createMenuOpened.viz } @@ -1151,7 +1168,7 @@
{ createMenuOpened.diagram = !createMenuOpened.diagram; scrollToCreateMenu("diagram"); } }> - + {$t("doc.diagram")} {#if createMenuOpened.diagram } diff --git a/ng-app/src/lib/icons/DataClassIcon.svelte b/ng-app/src/lib/icons/DataClassIcon.svelte index 58cbfb8..54a4284 100644 --- a/ng-app/src/lib/icons/DataClassIcon.svelte +++ b/ng-app/src/lib/icons/DataClassIcon.svelte @@ -116,8 +116,8 @@ "e:link": Link, "mc:text": Bars3BottomLeft, "mc:link": Link, - "plato/card": Clipboard, - "plato/pad": Square2Stack, + "plato:card": Clipboard, + "plato:pad": Square2Stack, "media:image": Photo, "media:reel": VideoCamera, "media:video": Film, @@ -171,9 +171,9 @@ "app:": StopCircle, "query:": RocketLaunch, "data:": CircleStack, - "doc:diagram": DocumentChartBar, - "doc:chart": ChartPie, - "doc:viz": ArrowTrendingUp, + "diagram": DocumentChartBar, + "chart": ChartPie, + "viz": ArrowTrendingUp, "doc:": ClipboardDocumentList, file: Document, }; diff --git a/ng-app/src/lib/popups/Header.svelte b/ng-app/src/lib/popups/Header.svelte new file mode 100644 index 0000000..03c5d5c --- /dev/null +++ b/ng-app/src/lib/popups/Header.svelte @@ -0,0 +1,70 @@ + + + + +
+ {$t("doc.header.buttons.edit_intro")} + {$t("doc.header.doc.title")} : + + {$t("doc.header.doc.about")} : +