Work on sync element, now a custom HTML element

This commit is contained in:
Magnus Åhall 2026-05-03 09:17:20 +02:00
parent 99063d34be
commit 9fc4a14ce3
10 changed files with 190 additions and 1001 deletions

View file

@ -2,21 +2,11 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/main.css">
<script type="importmap">
{
"imports": {
"preact": "/js/{{ .VERSION }}/lib/preact/preact.mjs",
"preact/hooks": "/js/{{ .VERSION }}/lib/preact/hooks.mjs",
{{- if .Data._dev }}
"preact/debug": "/js/{{ .VERSION }}/lib/preact/debug.mjs",
"preact/devtools": "/js/{{ .VERSION }}/lib/preact/devtools.mjs",
{{- end }}
"@preact/signals-core": "/js/{{ .VERSION }}/lib/signals/signals-core.mjs",
"preact/signals": "/js/{{ .VERSION }}/lib/signals/signals.mjs",
"htm": "/js/{{ .VERSION }}/lib/htm/htm.mjs",
"api": "/js/{{ .VERSION }}/api.mjs",
"sync": "/js/{{ .VERSION }}/sync.mjs",
"key": "/js/{{ .VERSION }}/key.mjs",

View file

@ -2,44 +2,32 @@
<div id="notes2">
<div id="tree" tabindex=0></div>
<div id="crumbs"></div>
<div id="sync-progress">
<progress min=0 max=1 value=0></progress>
<div class="count">0 / 1</div>
</div>
<div id="note"></div>
<!--div id="blank"></div-->
<n2-syncprogress></n2-syncprogress>
<n2-nodeui id="note"></n2-nodeui>
</div>
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/notes2.css">
<script type="module">
import { h, Component, render, createRef } from 'preact'
import htm from 'htm'
{{ if .Data._dev -}}
import 'preact/debug'
import 'preact/devtools'
{{- end }}
import { NodeStore } from 'node_store'
import { App } from "/js/{{ .VERSION }}/app.mjs"
import { API } from 'api'
import { Sync } from 'sync'
import {NodeStore} from 'node_store'
import {App} from "/js/{{ .VERSION }}/app.mjs"
import {API} from 'api'
import {Sync} from 'sync'
window.Sync = Sync
window.Sync = Sync
if (!API.hasAuthenticationToken()) {
location.href = '/login'
} else {
const html = htm.bind(h)
try {
window.nodeStore = new NodeStore()
window.nodeStore.initializeDB().then(() => {
window._app = new App()
})
} catch (e) {
alert(e)
if (!API.hasAuthenticationToken()) {
location.href = '/login'
} else {
try {
window.nodeStore = new NodeStore()
window.nodeStore.initializeDB().then(() => {
window._app = new App()
})
} catch (e) {
alert(e)
}
}
}
</script>
{{ end }}