feature/dwn echo middleware (#17)

* refactor: remove indexedDB dependency and replace with browser filesystem

* refactor: remove unused layout templating from global block

* feat: add support for building from source

* feat: add Credential creation and retrieval via Dexie database

* feat: add breadcrumbs component
This commit is contained in:
Prad Nukala
2024-09-19 19:09:01 -04:00
committed by GitHub
parent 96e6486c43
commit a115b79db7
36 changed files with 558 additions and 1103 deletions
+6
View File
@@ -0,0 +1,6 @@
package scripts
type (
DatabaseAPI interface{}
NavigatorAPI interface{}
)
+21
View File
@@ -0,0 +1,21 @@
package scripts
templ InitializeDatabase() {
<script type="module">
// Import Dexie
import { Dexie } from 'https://unpkg.com/dexie/dist/modern/dexie.mjs';
// Create a new Dexie database
const db = new Dexie('myDatabase');
// Define the schema for the database
db.version(1).stores({
users: '++id, name, age',
posts: '++id, title, content, authorId',
comments: '++id, content, postId, authorId',
});
// Export the database instance
export default db;
</script>
}
@@ -0,0 +1,37 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.771
package scripts
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func InitializeDatabase() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script type=\"module\">\n // Import Dexie\n import { Dexie } from 'https://unpkg.com/dexie/dist/modern/dexie.mjs';\n \n // Create a new Dexie database\n const db = new Dexie('myDatabase');\n \n // Define the schema for the database\n db.version(1).stores({\n users: '++id, name, age',\n posts: '++id, title, content, authorId',\n comments: '++id, content, postId, authorId',\n });\n \n // Export the database instance\n export default db;\n </script>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate
@@ -0,0 +1,41 @@
package scripts
templ CreateCredential() {
<script type="module">
// Import Dexie
import { Dexie } from 'https://unpkg.com/dexie/dist/modern/dexie.mjs';
// Create a new Dexie database
const db = new Dexie('myDatabase');
// Define the schema for the database
db.version(1).stores({
users: '++id, name, age',
posts: '++id, title, content, authorId',
comments: '++id, content, postId, authorId',
});
// Export the database instance
window.vault = db;
</script>
}
templ GetCredential() {
<script type="module">
// Import Dexie
import { Dexie } from 'https://unpkg.com/dexie/dist/modern/dexie.mjs';
// Create a new Dexie database
const db = new Dexie('myDatabase');
// Define the schema for the database
db.version(1).stores({
users: '++id, name, age',
posts: '++id, title, content, authorId',
comments: '++id, content, postId, authorId',
});
// Export the database instance
export default db;
</script>
}
@@ -0,0 +1,63 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.771
package scripts
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func CreateCredential() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script type=\"module\">\n // Import Dexie\n import { Dexie } from 'https://unpkg.com/dexie/dist/modern/dexie.mjs';\n \n // Create a new Dexie database\n const db = new Dexie('myDatabase');\n \n // Define the schema for the database\n db.version(1).stores({\n users: '++id, name, age',\n posts: '++id, title, content, authorId',\n comments: '++id, content, postId, authorId',\n });\n \n // Export the database instance\n window.vault = db;\n </script>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func GetCredential() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script type=\"module\">\n // Import Dexie\n import { Dexie } from 'https://unpkg.com/dexie/dist/modern/dexie.mjs';\n \n // Create a new Dexie database\n const db = new Dexie('myDatabase');\n \n // Define the schema for the database\n db.version(1).stores({\n users: '++id, name, age',\n posts: '++id, title, content, authorId',\n comments: '++id, content, postId, authorId',\n });\n \n // Export the database instance\n export default db;\n </script>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate