diff --git a/.github/DISCUSSION_TEMPLATE/milestone.yml b/.github/DISCUSSION_TEMPLATE/milestone.yml new file mode 100644 index 000000000..f82d88681 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/milestone.yml @@ -0,0 +1,30 @@ +title: "[Milestone] " +labels: ["#OKR", "#PLANNING"] +body: + - type: input + id: has-version + attributes: + label: Version + description: A tag for the associated milestone. + placeholder: v0.6.0 + validations: + required: true + - type: textarea + attributes: + label: Objective + description: Explain the objective of the OKR in less than 100 characters. + placeholder: Ethereum IBC integration with Sonr. + render: markdown + validations: + required: true + - type: textarea + attributes: + label: Task List + description: | + Break down the objective into a list of tasks to be completed. + value: | + - [ ] # + - [ ] # + - [ ] # + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/okr.yml b/.github/ISSUE_TEMPLATE/okr.yml deleted file mode 100644 index c4ae72731..000000000 --- a/.github/ISSUE_TEMPLATE/okr.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Tracking issue -description: Use this template for tracking new features. -title: "(v0.6): FEATURE NAME" -labels: ["#TRACK", "#OKR"] -assignees: ["prnk28"] -projects: ["onsonr/37"] -body: - - type: checkboxes - attributes: - label: Is this associated with a milestone? - description: This is a tracking issue for tracking a new feature for a given milestone. - options: - - label: I have confirmed this is an OKR tracking issue - required: true - - type: textarea - attributes: - label: Objective - description: Explain the objective of the feature and add any relevant links. - render: markdown - validations: - required: false - - type: textarea - attributes: - label: Task List - description: | - Break down the objective into a list of tasks to be completed. - value: | - - [ ] - validations: - required: false diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml index ca8451089..81299a2cd 100644 --- a/.github/pr-labeler.yml +++ b/.github/pr-labeler.yml @@ -1,3 +1,5 @@ -feature: ["feature/*", "feat/*"] -fix: fix/* -chore :hammer:: chore/* +"@pr/feature": ["feature/*", "feat/*"] +"@pr/fix": fix/* +"@pr/chore": chore/* +"@pr/docs": docs/* +"@pr/refactor": refactor/* diff --git a/.github/workflows/deploy-hway.yml b/.github/workflows/deploy-hway.yml deleted file mode 100644 index 05c09a6b4..000000000 --- a/.github/workflows/deploy-hway.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Deploy Hway (sonr.id) - -on: - push: - branches: - - develop - -jobs: - deploy: - runs-on: ubuntu-latest - name: Deploy Sonr.ID on Cloudflare - steps: - - uses: actions/checkout@v4 - - name: Install devbox - uses: jetify-com/devbox-install-action@v0.11.0 - - name: Deploy - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{ secrets.CF_WORKERS_TOKEN }} - workingDirectory: web diff --git a/.gitignore b/.gitignore index 35625dd53..1bf639ce3 100644 --- a/.gitignore +++ b/.gitignore @@ -75,6 +75,7 @@ nebula/node_modules mprocs.yaml build +sonr.wiki !devbox.lock !buf.lock diff --git a/Makefile b/Makefile index d07419580..89a8bc5ae 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,7 @@ draw-deps: @goviz -i ./cmd/sonrd -d 2 | dot -Tpng -o dependency-graph.png clean: + rm -rf pkg/nebula/node_modules rm -rf snapcraft-local.yaml build/ distclean: clean @@ -315,10 +316,9 @@ pkl-gen: nebula-build: @echo "(ui) Building nebula" - cd nebula && bun install && bun run build - rm -rf ./nebula/node_modules + cd pkg/nebula && bun install && bun run build -motr-build: templ-gen pkl-gen +motr-build: nebula-build templ-gen pkl-gen @echo "(dwn) Building motr.wasm -> Service Worker IPFS Vault" GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./cmd/motr/main.go diff --git a/app/app.go b/app/app.go index 1475a55f4..f8090e7e7 100644 --- a/app/app.go +++ b/app/app.go @@ -632,15 +632,6 @@ func NewChainApp( app.StakingKeeper, ) - // Create the vault Keeper - app.VaultKeeper = vaultkeeper.NewKeeper( - appCodec, - sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]), - logger, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - app.AccountKeeper, - app.DidKeeper, - ) // Create the macaroon Keeper app.MacaroonKeeper = macaroonkeeper.NewKeeper( appCodec, @@ -651,6 +642,17 @@ func NewChainApp( app.DidKeeper, ) + // Create the vault Keeper + app.VaultKeeper = vaultkeeper.NewKeeper( + appCodec, + sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]), + logger, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.AccountKeeper, + app.DidKeeper, + app.MacaroonKeeper, + ) + // Create the service Keeper app.ServiceKeeper = servicekeeper.NewKeeper( appCodec, @@ -661,6 +663,7 @@ func NewChainApp( app.GroupKeeper, app.MacaroonKeeper, app.NFTKeeper, + app.VaultKeeper, ) // Create the globalfee keeper diff --git a/cmd/hway/main.go b/cmd/hway/main.go index b35e69a3f..7cbd747ae 100644 --- a/cmd/hway/main.go +++ b/cmd/hway/main.go @@ -5,13 +5,13 @@ package main import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/internal/ctx" - "github.com/onsonr/sonr/workers/routes" + "github.com/onsonr/sonr/pkg/workers/routes" "github.com/syumai/workers" ) func main() { s := echo.New() - s.Use(ctx.UseSession) + s.Use(ctx.SessionMiddleware) routes.RegisterProxyViews(s) routes.RegisterProxyAPI(s) workers.Serve(s) diff --git a/cmd/motr/main.go b/cmd/motr/main.go index b90903a63..2454db36a 100644 --- a/cmd/motr/main.go +++ b/cmd/motr/main.go @@ -4,16 +4,43 @@ package main import ( + "encoding/json" + "os" + "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/cmd/motr/fetch" "github.com/onsonr/sonr/internal/ctx" - "github.com/onsonr/sonr/workers/routes" + "github.com/onsonr/sonr/internal/dwn" + dwngen "github.com/onsonr/sonr/internal/dwn/gen" + "github.com/onsonr/sonr/pkg/workers/routes" ) +var config *dwngen.Config + func main() { + // Load dwn config + if err := loadDwnConfig(); err != nil { + panic(err) + } + + // Setup HTTP server e := echo.New() - e.Use(ctx.UseSession) - routes.RegisterClientViews(e) + e.Use(ctx.SessionMiddleware) routes.RegisterClientAPI(e) - fetch.Serve(e) + routes.RegisterClientViews(e) + dwn.Serve(e) +} + +func loadDwnConfig() error { + // Read dwn.json config + dwnBz, err := os.ReadFile("dwn.json") + if err != nil { + return err + } + dwnConfig := &dwngen.Config{} + err = json.Unmarshal(dwnBz, dwnConfig) + if err != nil { + return err + } + config = dwnConfig + return nil } diff --git a/devbox.lock b/devbox.lock index 886cce0f1..19ddfab17 100644 --- a/devbox.lock +++ b/devbox.lock @@ -49,54 +49,6 @@ } } }, - "cloudflared@latest": { - "last_modified": "2024-09-10T15:01:03Z", - "resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#cloudflared", - "source": "devbox-search", - "version": "2024.8.3", - "systems": { - "aarch64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/nmmh1dx4rvqayxq31c99gxpbwvcchx9w-cloudflared-2024.8.3", - "default": true - } - ], - "store_path": "/nix/store/nmmh1dx4rvqayxq31c99gxpbwvcchx9w-cloudflared-2024.8.3" - }, - "aarch64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/kwikn13v0rddmr8kjhnj67li8aq8qwa6-cloudflared-2024.8.3", - "default": true - } - ], - "store_path": "/nix/store/kwikn13v0rddmr8kjhnj67li8aq8qwa6-cloudflared-2024.8.3" - }, - "x86_64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/9630bavr6jb44g0pcwwqn0zpgin39dc7-cloudflared-2024.8.3", - "default": true - } - ], - "store_path": "/nix/store/9630bavr6jb44g0pcwwqn0zpgin39dc7-cloudflared-2024.8.3" - }, - "x86_64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/hybva7brncispiqm6f0qrpn897r3y3ja-cloudflared-2024.8.3", - "default": true - } - ], - "store_path": "/nix/store/hybva7brncispiqm6f0qrpn897r3y3ja-cloudflared-2024.8.3" - } - } - }, "go@1.22": { "last_modified": "2024-09-12T11:58:09Z", "resolved": "github:NixOS/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1#go", @@ -151,54 +103,6 @@ "source": "devbox-search", "version": "0.17.0" }, - "skate@latest": { - "last_modified": "2024-09-10T15:01:03Z", - "resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#skate", - "source": "devbox-search", - "version": "1.0.0", - "systems": { - "aarch64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/5hn4s18zy08inhimckf3794zszxjn077-skate-1.0.0", - "default": true - } - ], - "store_path": "/nix/store/5hn4s18zy08inhimckf3794zszxjn077-skate-1.0.0" - }, - "aarch64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/jxwx4fn5qbaz2nan3gmpydqx6vv8ldp1-skate-1.0.0", - "default": true - } - ], - "store_path": "/nix/store/jxwx4fn5qbaz2nan3gmpydqx6vv8ldp1-skate-1.0.0" - }, - "x86_64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/zs6ik66kpz9q8mdmzxqmgjv51y39r76h-skate-1.0.0", - "default": true - } - ], - "store_path": "/nix/store/zs6ik66kpz9q8mdmzxqmgjv51y39r76h-skate-1.0.0" - }, - "x86_64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0", - "default": true - } - ], - "store_path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0" - } - } - }, "templ@latest": { "last_modified": "2024-09-10T15:01:03Z", "resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#templ", diff --git a/go.mod b/go.mod index 38e515140..c7d53f314 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/onsonr/sonr -go 1.22.5 +go 1.23 + +toolchain go1.23.1 // overrides replace ( @@ -44,7 +46,7 @@ require ( cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.1.0 cosmossdk.io/x/nft v0.1.0 - cosmossdk.io/x/tx v0.13.3 + cosmossdk.io/x/tx v0.13.5 cosmossdk.io/x/upgrade v0.1.1 github.com/a-h/templ v0.2.778 github.com/apple/pkl-go v0.8.0 @@ -56,15 +58,15 @@ require ( github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.5 - github.com/cosmos/gogoproto v1.4.12 + github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2-0.20240228211029-91e486ec4dbb github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.2.0 - github.com/donseba/go-htmx v1.10.0 github.com/ethereum/go-ethereum v1.14.6 github.com/go-webauthn/webauthn v0.10.2 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 + github.com/gorilla/sessions v1.4.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/ipfs/boxo v0.21.0 github.com/ipfs/kubo v0.29.0 @@ -181,6 +183,7 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.2 // indirect github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/securecookie v1.1.2 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect diff --git a/go.sum b/go.sum index 29da40697..0093bc405 100644 --- a/go.sum +++ b/go.sum @@ -794,8 +794,8 @@ cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= cosmossdk.io/x/nft v0.1.0 h1:VhcsFiEK33ODN27kxKLa0r/CeFd8laBfbDBwYqCyYCM= cosmossdk.io/x/nft v0.1.0/go.mod h1:ec4j4QAO4mJZ+45jeYRnW7awLHby1JZANqe1hNZ4S3g= -cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= -cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= +cosmossdk.io/x/tx v0.13.5 h1:FdnU+MdmFWn1pTsbfU0OCf2u6mJ8cqc1H4OMG418MLw= +cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -1024,8 +1024,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE= -github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2-0.20240228211029-91e486ec4dbb h1:jcSPWsQTcbpQcFKmZppgD37GIXAzvFmYRH4E6kxPBFQ= @@ -1091,8 +1091,6 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/donseba/go-htmx v1.10.0 h1:ByeQd8frMPSX38vkjvsprSQ7+xTkHMDrkzBV0ljfYvA= -github.com/donseba/go-htmx v1.10.0/go.mod h1:8PTAYvNKf8+QYis+DpAsggKz+sa2qljtMgvdAeNBh5s= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= @@ -1377,6 +1375,10 @@ github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyE github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= +github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= +github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ= +github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= diff --git a/internal/ctx/macaroon.go b/internal/ctx/authorize.go similarity index 100% rename from internal/ctx/macaroon.go rename to internal/ctx/authorize.go diff --git a/internal/ctx/cookies.go b/internal/ctx/cookies.go deleted file mode 100644 index b747f657c..000000000 --- a/internal/ctx/cookies.go +++ /dev/null @@ -1,41 +0,0 @@ -package ctx - -import ( - "net/http" - "time" - - "github.com/donseba/go-htmx" - "github.com/labstack/echo/v4" -) - -type Session struct { - echo.Context - htmx *htmx.HTMX -} - -func (c *Session) Htmx() *htmx.HTMX { - return c.htmx -} - -func (c *Session) ID() string { - return ReadCookie(c, "session") -} - -func ReadCookie(c echo.Context, key string) string { - cookie, err := c.Cookie(key) - if err != nil { - return "" - } - if cookie == nil { - return "" - } - return cookie.Value -} - -func WriteCookie(c echo.Context, key string, value string) { - cookie := new(http.Cookie) - cookie.Name = key - cookie.Value = value - cookie.Expires = time.Now().Add(24 * time.Hour) - c.SetCookie(cookie) -} diff --git a/internal/ctx/session.go b/internal/ctx/session.go index 069cb1d97..1117a8400 100644 --- a/internal/ctx/session.go +++ b/internal/ctx/session.go @@ -1,33 +1,80 @@ package ctx import ( + "context" + "errors" + "net/http" + "time" + + "github.com/gorilla/sessions" "github.com/labstack/echo/v4" "github.com/segmentio/ksuid" ) -// GetSession returns the current Session -func GetSession(c echo.Context) *Session { - return c.(*Session) -} +var store sessions.Store -// UseSession establishes a Session Cookie. -func UseSession(next echo.HandlerFunc) echo.HandlerFunc { +type ctxKeySessionID struct{} + +// SessionMiddleware establishes a Session Cookie. +func SessionMiddleware(next echo.HandlerFunc) echo.HandlerFunc { + store = sessions.NewCookieStore([]byte("SESSION_KEY")) return func(c echo.Context) error { - sc := initSession(c) - headers := new(RequestHeaders) - err := sc.Bind(headers) + ctx := c.Request().Context() + + // Attempt to read the session ID from the "session" cookie + sessionID, err := readSessionIDFromCookie(c) if err != nil { - return err + // Generate a new KSUID if the session cookie is missing or invalid + sessionID = ksuid.New().String() + // Write the new session ID to the "session" cookie + err = writeSessionIDToCookie(c, sessionID) + if err != nil { + return c.JSON( + http.StatusInternalServerError, + map[string]string{"error": "Failed to set session cookie"}, + ) + } } - return next(sc) + + // Inject the session ID into the context + ctx = context.WithValue(ctx, ctxKeySessionID{}, sessionID) + // Update the request with the new context + c.SetRequest(c.Request().WithContext(ctx)) + + return next(c) } } -func initSession(c echo.Context) *Session { - s := &Session{Context: c} - if val := ReadCookie(c, "session"); val == "" { - id := ksuid.New().String() - WriteCookie(c, "session", id) +func getSessionID(ctx context.Context) (string, error) { + sessionID, ok := ctx.Value(ctxKeySessionID{}).(string) + if !ok || sessionID == "" { + return "", errors.New("session ID not found in context") } - return s + return sessionID, nil +} + +func readSessionIDFromCookie(c echo.Context) (string, error) { + cookie, err := c.Cookie("session") + if err != nil { + // Cookie not found or other error + return "", err + } + if cookie == nil || cookie.Value == "" { + // Cookie is empty + return "", http.ErrNoCookie + } + return cookie.Value, nil +} + +func writeSessionIDToCookie(c echo.Context, sessionID string) error { + cookie := &http.Cookie{ + Name: "session", + Value: sessionID, + Expires: time.Now().Add(24 * time.Hour), + HttpOnly: true, + Path: "/", + // Add Secure and SameSite attributes as needed + } + c.SetCookie(cookie) + return nil } diff --git a/internal/ctx/state.go b/internal/ctx/state.go new file mode 100644 index 000000000..a0c24662e --- /dev/null +++ b/internal/ctx/state.go @@ -0,0 +1,61 @@ +package ctx + +import "github.com/labstack/echo/v4" + +type State string + +const ( + StateAuthenticated State = "authenticated" + StateUnauthenticated State = "unauthenticated" + StatePendingCredentials State = "pending_credentials" + StatePendingAssertion State = "pending_assertion" + StateDisabled State = "disabled" + StateDisconnected State = "disconnected" +) + +func (s State) String() string { + return string(s) +} + +func StateFromString(s string) State { + switch s { + case StateAuthenticated.String(): + return StateAuthenticated + case StateUnauthenticated.String(): + return StateUnauthenticated + case StatePendingCredentials.String(): + return StatePendingCredentials + case StatePendingAssertion.String(): + return StatePendingAssertion + case StateDisabled.String(): + return StateDisabled + case StateDisconnected.String(): + return StateDisconnected + default: + return State("") + } +} + +func readSessionFromStore(c echo.Context, id string) (*session, error) { + sess, err := store.Get(c.Request(), id) + if err != nil { + return nil, err + } + return NewSessionFromValues(sess.Values), nil +} + +func writeSessionToStore( + c echo.Context, + id string, +) error { + sess, err := store.Get(c.Request(), id) + if err != nil { + return err + } + s := defaultSession(id, sess) + err = s.SaveHTTP(c) + if err != nil { + return err + } + return nil +} diff --git a/internal/ctx/store.go b/internal/ctx/store.go new file mode 100644 index 000000000..553b01908 --- /dev/null +++ b/internal/ctx/store.go @@ -0,0 +1,142 @@ +package ctx + +import ( + "fmt" + + "github.com/go-webauthn/webauthn/protocol" + "github.com/gorilla/sessions" + "github.com/labstack/echo/v4" +) + +type WebBytes = protocol.URLEncodedBase64 + +type Session interface { + ID() string + Origin() string + + Address() string + ChainID() string + + GetChallenge(subject string) (WebBytes, error) + ValidateChallenge(challenge WebBytes, subject string) error + + IsState(State) bool + SaveHTTP(c echo.Context) error +} + +func defaultSession(id string, s *sessions.Session) *session { + return &session{ + session: s, + id: id, + origin: "", + address: "", + chainID: "", + state: StateUnauthenticated, + } +} + +func NewSessionFromValues(vals map[interface{}]interface{}) *session { + s := &session{ + id: vals["id"].(string), + origin: vals["origin"].(string), + address: vals["address"].(string), + chainID: vals["chainID"].(string), + state: StateFromString(vals["state"].(string)), + challenge: vals["challenge"].(WebBytes), + subject: vals["subject"].(string), + } + return s +} + +type session struct { + // Defaults + session *sessions.Session + id string // Generated ksuid http cookie; Initialized on first request + origin string // Webauthn mapping to Relaying Party ID; Initialized on first request + + // Initialization + address string // Webauthn mapping to User ID; Supplied by DWN frontend + chainID string // Macaroon mapping to location; Supplied by DWN frontend + + // Authentication + challenge WebBytes // Webauthn mapping to Challenge; Per session based on origin + subject string // Webauthn mapping to User Displayable Name; Supplied by DWN frontend + + // State + state State +} + +func (s *session) ID() string { + return s.id +} + +func (s *session) Origin() string { + return s.origin +} + +func (s *session) Address() string { + return s.address +} + +func (s *session) ChainID() string { + return s.chainID +} + +func (s *session) GetChallenge(subject string) (WebBytes, error) { + if s.challenge == nil { + return nil, nil + } + return s.challenge, nil +} + +func (s *session) ValidateChallenge(challenge WebBytes, subject string) error { + if s.challenge == nil { + return nil + } + if s.challenge.String() != challenge.String() { + return fmt.Errorf("invalid challenge") + } + s.subject = subject + s.state = StateAuthenticated + return nil +} + +func (s *session) IsState(state State) bool { + return s.state == state +} + +func (s *session) SaveHTTP(c echo.Context) error { + sess, err := store.Get(c.Request(), s.id) + if err != nil { + return err + } + sess.Values = s.Values() + err = sess.Save(c.Request(), c.Response().Writer) + if err != nil { + return err + } + return nil +} + +func (s *session) Values() map[interface{}]interface{} { + vals := make(map[interface{}]interface{}) + vals["id"] = s.id + vals["address"] = s.address + vals["chainID"] = s.chainID + vals["state"] = s.state + vals["challenge"] = s.challenge + vals["subject"] = s.subject + return vals +} + +func GetSession(c echo.Context) Session { + id, _ := getSessionID(c.Request().Context()) + sess, _ := store.Get(c.Request(), id) + if sess.IsNew { + s := defaultSession(id, sess) + s.SaveHTTP(c) + return s + } + s, _ := readSessionFromStore(c, id) + return s +} diff --git a/internal/dwn/embed.go b/internal/dwn/embed.go index 23acfee28..aa8f5acbd 100644 --- a/internal/dwn/embed.go +++ b/internal/dwn/embed.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/boxo/files" "github.com/onsonr/sonr/internal/dwn/gen" - "github.com/onsonr/sonr/nebula/components/index" + "github.com/onsonr/sonr/pkg/nebula/components/index" ) //go:embed app.wasm diff --git a/cmd/motr/fetch/serve.go b/internal/dwn/serve.go similarity index 99% rename from cmd/motr/fetch/serve.go rename to internal/dwn/serve.go index 8e44b86ea..0de8251a2 100644 --- a/cmd/motr/fetch/serve.go +++ b/internal/dwn/serve.go @@ -1,7 +1,7 @@ //go:build js && wasm // +build js,wasm -package fetch +package dwn import ( "bytes" diff --git a/internal/orm/models/marketing.go b/internal/orm/marketing/models.go similarity index 99% rename from internal/orm/models/marketing.go rename to internal/orm/marketing/models.go index 95900129c..37739fc1c 100644 --- a/internal/orm/models/marketing.go +++ b/internal/orm/marketing/models.go @@ -1,4 +1,4 @@ -package models +package marketing type Button struct { Text string diff --git a/internal/orm/webauthn.go b/internal/orm/webauthn.go new file mode 100644 index 000000000..4927f44b5 --- /dev/null +++ b/internal/orm/webauthn.go @@ -0,0 +1,58 @@ +package orm + +import ( + "github.com/go-webauthn/webauthn/protocol" + "github.com/go-webauthn/webauthn/protocol/webauthncose" +) + +func NewCredentialCreationOptions(subject, address string) (*protocol.PublicKeyCredentialCreationOptions, error) { + chl, err := protocol.CreateChallenge() + if err != nil { + return nil, err + } + return &protocol.PublicKeyCredentialCreationOptions{ + Challenge: chl, + User: protocol.UserEntity{ + DisplayName: subject, + ID: address, + }, + Attestation: defaultAttestation(), + AuthenticatorSelection: defaultAuthenticatorSelection(), + Parameters: defaultCredentialParameters(), + }, nil +} + +func buildUserEntity(userID string) protocol.UserEntity { + return protocol.UserEntity{ + ID: userID, + } +} + +func defaultAttestation() protocol.ConveyancePreference { + return protocol.PreferDirectAttestation +} + +func defaultAuthenticatorSelection() protocol.AuthenticatorSelection { + return protocol.AuthenticatorSelection{ + AuthenticatorAttachment: "platform", + ResidentKey: protocol.ResidentKeyRequirementPreferred, + UserVerification: "preferred", + } +} + +func defaultCredentialParameters() []protocol.CredentialParameter { + return []protocol.CredentialParameter{ + { + Type: "public-key", + Algorithm: webauthncose.AlgES256, + }, + { + Type: "public-key", + Algorithm: webauthncose.AlgES256K, + }, + { + Type: "public-key", + Algorithm: webauthncose.AlgEdDSA, + }, + } +} diff --git a/nebula/components/auth/modal.templ b/nebula/components/auth/modal.templ deleted file mode 100644 index 1cb4718fe..000000000 --- a/nebula/components/auth/modal.templ +++ /dev/null @@ -1,13 +0,0 @@ -package auth - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/nebula/components/auth/sections" - "github.com/onsonr/sonr/nebula/global/styles" -) - -templ Modal(c echo.Context) { - @styles.OpenModal("Account Registration", "Enter your account information below to create your account.") { - @sections.RegisterStart() - } -} diff --git a/nebula/components/auth/modal_templ.go b/nebula/components/auth/modal_templ.go deleted file mode 100644 index b4abfe0d0..000000000 --- a/nebula/components/auth/modal_templ.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package auth - -//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" - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/nebula/components/auth/sections" - "github.com/onsonr/sonr/nebula/global/styles" -) - -func Modal(c echo.Context) 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 - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - 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_Var2 := 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_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/nebula/components/dash/page.templ b/nebula/components/dash/page.templ deleted file mode 100644 index 179a0fa8f..000000000 --- a/nebula/components/dash/page.templ +++ /dev/null @@ -1,15 +0,0 @@ -package dash - -import ( - "github.com/onsonr/sonr/nebula/components/home/sections" - "github.com/onsonr/sonr/nebula/global/styles" -) - -templ View() { - @styles.LayoutNoBody("Sonr.ID", true) { - @sections.Header() - @sections.Lowlights() - @sections.CallToAction() - @sections.Footer() - } -} diff --git a/nebula/components/dash/page_templ.go b/nebula/components/dash/page_templ.go deleted file mode 100644 index 61b503086..000000000 --- a/nebula/components/dash/page_templ.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package dash - -//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" - -import ( - "github.com/onsonr/sonr/nebula/components/home/sections" - "github.com/onsonr/sonr/nebula/global/styles" -) - -func View() 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 - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - 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_Var2 := 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_Err = sections.Header().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sections.Lowlights().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sections.CallToAction().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sections.Footer().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = styles.LayoutNoBody("Sonr.ID", true).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/nebula/components/dash/route.go b/nebula/components/dash/route.go deleted file mode 100644 index 2a039ff5f..000000000 --- a/nebula/components/dash/route.go +++ /dev/null @@ -1,10 +0,0 @@ -package dash - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/ctx" -) - -func Route(c echo.Context) error { - return ctx.RenderTempl(c, View()) -} diff --git a/nebula/components/pay/route.go b/nebula/components/pay/route.go deleted file mode 100644 index 9d070ab7d..000000000 --- a/nebula/components/pay/route.go +++ /dev/null @@ -1,10 +0,0 @@ -package pay - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/ctx" -) - -func Route(c echo.Context) error { - return ctx.RenderTempl(c, nil) -} diff --git a/nebula/README.md b/pkg/nebula/README.md similarity index 83% rename from nebula/README.md rename to pkg/nebula/README.md index 5d635ef7a..4ac359740 100644 --- a/nebula/README.md +++ b/pkg/nebula/README.md @@ -26,9 +26,9 @@ A Templ component library for the Sonr DWN (Decentralized Web Node) client. package main import ( - "github.com/onsonr/sonr/nebula" - "github.com/onsonr/sonr/nebula/components" - "github.com/onsonr/sonr/nebula/pages" + "github.com/onsonr/sonr/pkg/nebula" + "github.com/onsonr/sonr/pkg/nebula/components" + "github.com/onsonr/sonr/pkg/nebula/pages" ) func main() { diff --git a/nebula/assets/css/styles.css b/pkg/nebula/assets/css/styles.css similarity index 100% rename from nebula/assets/css/styles.css rename to pkg/nebula/assets/css/styles.css diff --git a/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff b/pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff similarity index 100% rename from nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff rename to pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff diff --git a/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 b/pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 similarity index 100% rename from nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 rename to pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 diff --git a/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff b/pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff similarity index 100% rename from nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff rename to pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff diff --git a/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 b/pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 similarity index 100% rename from nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 rename to pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 diff --git a/nebula/assets/js/alpine.min.js b/pkg/nebula/assets/js/alpine.min.js similarity index 100% rename from nebula/assets/js/alpine.min.js rename to pkg/nebula/assets/js/alpine.min.js diff --git a/nebula/assets/js/dexie.min.js b/pkg/nebula/assets/js/dexie.min.js similarity index 100% rename from nebula/assets/js/dexie.min.js rename to pkg/nebula/assets/js/dexie.min.js diff --git a/nebula/assets/js/htmx.min.js b/pkg/nebula/assets/js/htmx.min.js similarity index 100% rename from nebula/assets/js/htmx.min.js rename to pkg/nebula/assets/js/htmx.min.js diff --git a/nebula/assets/js/sw.js b/pkg/nebula/assets/js/sw.js similarity index 100% rename from nebula/assets/js/sw.js rename to pkg/nebula/assets/js/sw.js diff --git a/nebula/bun.lockb b/pkg/nebula/bun.lockb similarity index 100% rename from nebula/bun.lockb rename to pkg/nebula/bun.lockb diff --git a/nebula/components/auth/forms/consent_privacy.templ b/pkg/nebula/components/auth/forms/consent_privacy.templ similarity index 100% rename from nebula/components/auth/forms/consent_privacy.templ rename to pkg/nebula/components/auth/forms/consent_privacy.templ diff --git a/nebula/components/auth/forms/consent_privacy_templ.go b/pkg/nebula/components/auth/forms/consent_privacy_templ.go similarity index 100% rename from nebula/components/auth/forms/consent_privacy_templ.go rename to pkg/nebula/components/auth/forms/consent_privacy_templ.go diff --git a/nebula/components/auth/forms/credential_assert.templ b/pkg/nebula/components/auth/forms/credential_assert.templ similarity index 100% rename from nebula/components/auth/forms/credential_assert.templ rename to pkg/nebula/components/auth/forms/credential_assert.templ diff --git a/nebula/components/auth/forms/credential_assert_templ.go b/pkg/nebula/components/auth/forms/credential_assert_templ.go similarity index 100% rename from nebula/components/auth/forms/credential_assert_templ.go rename to pkg/nebula/components/auth/forms/credential_assert_templ.go diff --git a/nebula/components/auth/forms/credential_register.templ b/pkg/nebula/components/auth/forms/credential_register.templ similarity index 100% rename from nebula/components/auth/forms/credential_register.templ rename to pkg/nebula/components/auth/forms/credential_register.templ diff --git a/nebula/components/auth/forms/credential_register_templ.go b/pkg/nebula/components/auth/forms/credential_register_templ.go similarity index 100% rename from nebula/components/auth/forms/credential_register_templ.go rename to pkg/nebula/components/auth/forms/credential_register_templ.go diff --git a/nebula/components/auth/forms/details_basic.templ b/pkg/nebula/components/auth/forms/details_basic.templ similarity index 100% rename from nebula/components/auth/forms/details_basic.templ rename to pkg/nebula/components/auth/forms/details_basic.templ diff --git a/nebula/components/auth/forms/details_basic_templ.go b/pkg/nebula/components/auth/forms/details_basic_templ.go similarity index 100% rename from nebula/components/auth/forms/details_basic_templ.go rename to pkg/nebula/components/auth/forms/details_basic_templ.go diff --git a/pkg/nebula/components/auth/modal.templ b/pkg/nebula/components/auth/modal.templ new file mode 100644 index 000000000..924686bee --- /dev/null +++ b/pkg/nebula/components/auth/modal.templ @@ -0,0 +1,25 @@ +package auth + +import ( + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/auth/sections" + "github.com/onsonr/sonr/pkg/nebula/global/styles" +) + +templ RegisterModal(c echo.Context) { + @styles.OpenModal("Account Registration", "Enter your account information below to create your account.") { + @sections.RegisterStart() + } +} + +templ LoginModal(c echo.Context) { + @styles.OpenModal("Account Registration", "Enter your account information below to create your account.") { + @sections.RegisterStart() + } +} + +templ AuthorizeModal(c echo.Context) { + @styles.OpenModal("Account Registration", "Enter your account information below to create your account.") { + @sections.RegisterStart() + } +} diff --git a/pkg/nebula/components/auth/modal_templ.go b/pkg/nebula/components/auth/modal_templ.go new file mode 100644 index 000000000..4fa86f454 --- /dev/null +++ b/pkg/nebula/components/auth/modal_templ.go @@ -0,0 +1,158 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.778 +package auth + +//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" + +import ( + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/auth/sections" + "github.com/onsonr/sonr/pkg/nebula/global/styles" +) + +func RegisterModal(c echo.Context) 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 + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + 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_Var2 := 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_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func LoginModal(c echo.Context) 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 + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + 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_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var4 := 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_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func AuthorizeModal(c echo.Context) 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 + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + 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_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := 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_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/nebula/components/auth/route.go b/pkg/nebula/components/auth/route.go similarity index 63% rename from nebula/components/auth/route.go rename to pkg/nebula/components/auth/route.go index 260bf49ee..73a376bc5 100644 --- a/nebula/components/auth/route.go +++ b/pkg/nebula/components/auth/route.go @@ -6,13 +6,13 @@ import ( ) func AuthorizeRoute(c echo.Context) error { - return ctx.RenderTempl(c, Modal(c)) + return ctx.RenderTempl(c, AuthorizeModal(c)) } func LoginRoute(c echo.Context) error { - return ctx.RenderTempl(c, Modal(c)) + return ctx.RenderTempl(c, LoginModal(c)) } func RegisterRoute(c echo.Context) error { - return ctx.RenderTempl(c, Modal(c)) + return ctx.RenderTempl(c, RegisterModal(c)) } diff --git a/nebula/components/auth/sections/authorize.templ b/pkg/nebula/components/auth/sections/authorize.templ similarity index 83% rename from nebula/components/auth/sections/authorize.templ rename to pkg/nebula/components/auth/sections/authorize.templ index 152e1b842..b52d47492 100644 --- a/nebula/components/auth/sections/authorize.templ +++ b/pkg/nebula/components/auth/sections/authorize.templ @@ -1,9 +1,9 @@ package sections import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) templ AuthorizeStart() { diff --git a/nebula/components/auth/sections/authorize_templ.go b/pkg/nebula/components/auth/sections/authorize_templ.go similarity index 94% rename from nebula/components/auth/sections/authorize_templ.go rename to pkg/nebula/components/auth/sections/authorize_templ.go index 83a0ca845..cfa05d036 100644 --- a/nebula/components/auth/sections/authorize_templ.go +++ b/pkg/nebula/components/auth/sections/authorize_templ.go @@ -9,9 +9,9 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) func AuthorizeStart() templ.Component { diff --git a/nebula/components/auth/sections/login.templ b/pkg/nebula/components/auth/sections/login.templ similarity index 83% rename from nebula/components/auth/sections/login.templ rename to pkg/nebula/components/auth/sections/login.templ index e8b596a0a..2c35ffc91 100644 --- a/nebula/components/auth/sections/login.templ +++ b/pkg/nebula/components/auth/sections/login.templ @@ -1,9 +1,9 @@ package sections import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) templ LoginStart() { diff --git a/nebula/components/auth/sections/login_templ.go b/pkg/nebula/components/auth/sections/login_templ.go similarity index 94% rename from nebula/components/auth/sections/login_templ.go rename to pkg/nebula/components/auth/sections/login_templ.go index db440a0ee..afe89f36d 100644 --- a/nebula/components/auth/sections/login_templ.go +++ b/pkg/nebula/components/auth/sections/login_templ.go @@ -9,9 +9,9 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) func LoginStart() templ.Component { diff --git a/nebula/components/auth/sections/register.templ b/pkg/nebula/components/auth/sections/register.templ similarity index 83% rename from nebula/components/auth/sections/register.templ rename to pkg/nebula/components/auth/sections/register.templ index eccefd2e8..123dc8045 100644 --- a/nebula/components/auth/sections/register.templ +++ b/pkg/nebula/components/auth/sections/register.templ @@ -1,9 +1,9 @@ package sections import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) templ RegisterStart() { diff --git a/nebula/components/auth/sections/register_templ.go b/pkg/nebula/components/auth/sections/register_templ.go similarity index 94% rename from nebula/components/auth/sections/register_templ.go rename to pkg/nebula/components/auth/sections/register_templ.go index fa3458dc1..7f30081d9 100644 --- a/nebula/components/auth/sections/register_templ.go +++ b/pkg/nebula/components/auth/sections/register_templ.go @@ -9,9 +9,9 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) func RegisterStart() templ.Component { diff --git a/nebula/components/home/page.templ b/pkg/nebula/components/home/page.templ similarity index 71% rename from nebula/components/home/page.templ rename to pkg/nebula/components/home/page.templ index 1f91b4a74..185f55012 100644 --- a/nebula/components/home/page.templ +++ b/pkg/nebula/components/home/page.templ @@ -1,8 +1,8 @@ package home import ( - "github.com/onsonr/sonr/nebula/components/home/sections" - "github.com/onsonr/sonr/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/components/home/sections" + "github.com/onsonr/sonr/pkg/nebula/global/styles" ) templ View() { diff --git a/nebula/components/home/page_templ.go b/pkg/nebula/components/home/page_templ.go similarity index 97% rename from nebula/components/home/page_templ.go rename to pkg/nebula/components/home/page_templ.go index e1df8e53e..378203192 100644 --- a/nebula/components/home/page_templ.go +++ b/pkg/nebula/components/home/page_templ.go @@ -9,8 +9,8 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/components/home/sections" - "github.com/onsonr/sonr/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/components/home/sections" + "github.com/onsonr/sonr/pkg/nebula/global/styles" ) func View() templ.Component { diff --git a/nebula/components/home/route.go b/pkg/nebula/components/home/route.go similarity index 75% rename from nebula/components/home/route.go rename to pkg/nebula/components/home/route.go index bdd2c6cc4..737d37843 100644 --- a/nebula/components/home/route.go +++ b/pkg/nebula/components/home/route.go @@ -1,10 +1,15 @@ package home import ( + "log" + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/internal/ctx" ) func Route(c echo.Context) error { + s := ctx.GetSession(c) + log.Println(s.ID()) return ctx.RenderTempl(c, View()) } diff --git a/nebula/components/home/sections/architecture.templ b/pkg/nebula/components/home/sections/architecture.templ similarity index 100% rename from nebula/components/home/sections/architecture.templ rename to pkg/nebula/components/home/sections/architecture.templ diff --git a/nebula/components/home/sections/architecture_templ.go b/pkg/nebula/components/home/sections/architecture_templ.go similarity index 100% rename from nebula/components/home/sections/architecture_templ.go rename to pkg/nebula/components/home/sections/architecture_templ.go diff --git a/nebula/components/home/sections/cta.templ b/pkg/nebula/components/home/sections/cta.templ similarity index 100% rename from nebula/components/home/sections/cta.templ rename to pkg/nebula/components/home/sections/cta.templ diff --git a/nebula/components/home/sections/cta_templ.go b/pkg/nebula/components/home/sections/cta_templ.go similarity index 100% rename from nebula/components/home/sections/cta_templ.go rename to pkg/nebula/components/home/sections/cta_templ.go diff --git a/nebula/components/home/sections/footer.templ b/pkg/nebula/components/home/sections/footer.templ similarity index 100% rename from nebula/components/home/sections/footer.templ rename to pkg/nebula/components/home/sections/footer.templ diff --git a/nebula/components/home/sections/footer_templ.go b/pkg/nebula/components/home/sections/footer_templ.go similarity index 100% rename from nebula/components/home/sections/footer_templ.go rename to pkg/nebula/components/home/sections/footer_templ.go diff --git a/nebula/components/home/sections/header.templ b/pkg/nebula/components/home/sections/header.templ similarity index 100% rename from nebula/components/home/sections/header.templ rename to pkg/nebula/components/home/sections/header.templ diff --git a/nebula/components/home/sections/header_templ.go b/pkg/nebula/components/home/sections/header_templ.go similarity index 100% rename from nebula/components/home/sections/header_templ.go rename to pkg/nebula/components/home/sections/header_templ.go diff --git a/nebula/components/home/sections/hero.templ b/pkg/nebula/components/home/sections/hero.templ similarity index 96% rename from nebula/components/home/sections/hero.templ rename to pkg/nebula/components/home/sections/hero.templ index a6a8b94fd..c0dea16bc 100644 --- a/nebula/components/home/sections/hero.templ +++ b/pkg/nebula/components/home/sections/hero.templ @@ -1,8 +1,8 @@ package sections import ( - "github.com/onsonr/sonr/internal/orm/models" - "github.com/onsonr/sonr/nebula/global/ui" + models "github.com/onsonr/sonr/internal/orm/marketing" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) templ Hero(hero *models.Hero) { @@ -105,10 +105,10 @@ script counterAnimation() { } } this.animationRequestId = window.requestAnimationFrame(this.step); - }, + }, easeOut(t) { return 1 - Math.pow(1 - t, 5) - }, + }, destroy() { // Detach the handler, avoiding memory and side-effect leakage this.animationRequestId && window.cancelAnimationFrame(this.step) diff --git a/nebula/components/home/sections/hero_templ.go b/pkg/nebula/components/home/sections/hero_templ.go similarity index 90% rename from nebula/components/home/sections/hero_templ.go rename to pkg/nebula/components/home/sections/hero_templ.go index 0b37dde62..ed3a3b33f 100644 --- a/nebula/components/home/sections/hero_templ.go +++ b/pkg/nebula/components/home/sections/hero_templ.go @@ -9,8 +9,8 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/internal/orm/models" - "github.com/onsonr/sonr/nebula/global/ui" + models "github.com/onsonr/sonr/internal/orm/marketing" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) func Hero(hero *models.Hero) templ.Component { @@ -41,7 +41,7 @@ func Hero(hero *models.Hero) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleFirst) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 17, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 17, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -54,7 +54,7 @@ func Hero(hero *models.Hero) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleEmphasis) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 19, Col: 28} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 19, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -67,7 +67,7 @@ func Hero(hero *models.Hero) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleSecond) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 24, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 24, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -80,7 +80,7 @@ func Hero(hero *models.Hero) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Subtitle) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 27, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 27, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -146,7 +146,7 @@ func heroImage(hero *models.Hero) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Src) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 47, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 47, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -159,7 +159,7 @@ func heroImage(hero *models.Hero) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Width) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 48, Col: 27} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 48, Col: 27} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -172,7 +172,7 @@ func heroImage(hero *models.Hero) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Height) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 49, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 49, Col: 29} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -219,7 +219,7 @@ func stats(stats []*models.Stat) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(item.Value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 61, Col: 145} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 61, Col: 145} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -232,7 +232,7 @@ func stats(stats []*models.Stat) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Denom) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 61, Col: 166} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 61, Col: 166} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -245,7 +245,7 @@ func stats(stats []*models.Stat) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(item.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 62, Col: 50} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 62, Col: 50} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -274,8 +274,8 @@ func stats(stats []*models.Stat) templ.Component { func counterAnimation() templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_counterAnimation_524d`, - Function: `function __templ_counterAnimation_524d(){document.addEventListener('alpine:init', () => { + Name: `__templ_counterAnimation_cac3`, + Function: `function __templ_counterAnimation_cac3(){document.addEventListener('alpine:init', () => { Alpine.data('counter', (target = 0, duration = 3000) => ({ startTimestamp: null, step: null, @@ -312,10 +312,10 @@ func counterAnimation() templ.ComponentScript { } } this.animationRequestId = window.requestAnimationFrame(this.step); - }, + }, easeOut(t) { return 1 - Math.pow(1 - t, 5) - }, + }, destroy() { // Detach the handler, avoiding memory and side-effect leakage this.animationRequestId && window.cancelAnimationFrame(this.step) @@ -324,8 +324,8 @@ func counterAnimation() templ.ComponentScript { })) }) }`, - Call: templ.SafeScript(`__templ_counterAnimation_524d`), - CallInline: templ.SafeScriptInline(`__templ_counterAnimation_524d`), + Call: templ.SafeScript(`__templ_counterAnimation_cac3`), + CallInline: templ.SafeScriptInline(`__templ_counterAnimation_cac3`), } } diff --git a/nebula/components/home/sections/highlights.templ b/pkg/nebula/components/home/sections/highlights.templ similarity index 99% rename from nebula/components/home/sections/highlights.templ rename to pkg/nebula/components/home/sections/highlights.templ index df376f838..7a51227df 100644 --- a/nebula/components/home/sections/highlights.templ +++ b/pkg/nebula/components/home/sections/highlights.templ @@ -1,6 +1,6 @@ package sections -import "github.com/onsonr/sonr/internal/orm/models" +import models "github.com/onsonr/sonr/internal/orm/marketing" templ Highlights(highlights *models.Highlights) { diff --git a/nebula/components/home/sections/highlights_templ.go b/pkg/nebula/components/home/sections/highlights_templ.go similarity index 96% rename from nebula/components/home/sections/highlights_templ.go rename to pkg/nebula/components/home/sections/highlights_templ.go index a2d818def..e7cbe6dac 100644 --- a/nebula/components/home/sections/highlights_templ.go +++ b/pkg/nebula/components/home/sections/highlights_templ.go @@ -8,7 +8,7 @@ package sections import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -import "github.com/onsonr/sonr/internal/orm/models" +import models "github.com/onsonr/sonr/internal/orm/marketing" func Highlights(highlights *models.Highlights) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { @@ -38,7 +38,7 @@ func Highlights(highlights *models.Highlights) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(highlights.Heading) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/highlights.templ`, Line: 14, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/highlights.templ`, Line: 14, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -51,7 +51,7 @@ func Highlights(highlights *models.Highlights) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(highlights.Subtitle) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/highlights.templ`, Line: 17, Col: 27} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/highlights.templ`, Line: 17, Col: 27} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { diff --git a/nebula/components/home/sections/lowlights.templ b/pkg/nebula/components/home/sections/lowlights.templ similarity index 100% rename from nebula/components/home/sections/lowlights.templ rename to pkg/nebula/components/home/sections/lowlights.templ diff --git a/nebula/components/home/sections/lowlights_templ.go b/pkg/nebula/components/home/sections/lowlights_templ.go similarity index 100% rename from nebula/components/home/sections/lowlights_templ.go rename to pkg/nebula/components/home/sections/lowlights_templ.go diff --git a/nebula/components/home/sections/mission.templ b/pkg/nebula/components/home/sections/mission.templ similarity index 100% rename from nebula/components/home/sections/mission.templ rename to pkg/nebula/components/home/sections/mission.templ diff --git a/nebula/components/home/sections/mission_templ.go b/pkg/nebula/components/home/sections/mission_templ.go similarity index 100% rename from nebula/components/home/sections/mission_templ.go rename to pkg/nebula/components/home/sections/mission_templ.go diff --git a/nebula/components/home/static.go b/pkg/nebula/components/home/static.go similarity index 98% rename from nebula/components/home/static.go rename to pkg/nebula/components/home/static.go index 948860f56..8240eebc4 100644 --- a/nebula/components/home/static.go +++ b/pkg/nebula/components/home/static.go @@ -1,6 +1,6 @@ package home -import "github.com/onsonr/sonr/internal/orm/models" +import models "github.com/onsonr/sonr/internal/orm/marketing" var hero = &models.Hero{ TitleFirst: "Simplified", diff --git a/nebula/components/index/build.go b/pkg/nebula/components/index/build.go similarity index 100% rename from nebula/components/index/build.go rename to pkg/nebula/components/index/build.go diff --git a/nebula/components/index/index.templ b/pkg/nebula/components/index/index.templ similarity index 77% rename from nebula/components/index/index.templ rename to pkg/nebula/components/index/index.templ index ca1d256ee..9d85eba18 100644 --- a/nebula/components/index/index.templ +++ b/pkg/nebula/components/index/index.templ @@ -1,10 +1,14 @@ package index import ( - "github.com/onsonr/sonr/nebula/global/state" - "github.com/onsonr/sonr/nebula/global/styles" + "github.com/onsonr/sonr/internal/dwn/gen" + "github.com/onsonr/sonr/pkg/nebula/global/state" + "github.com/onsonr/sonr/pkg/nebula/global/styles" ) +func ConfigFile(dwnConfig *gen.Config) { +} + templ IndexFile() { diff --git a/nebula/components/index/index_templ.go b/pkg/nebula/components/index/index_templ.go similarity index 93% rename from nebula/components/index/index_templ.go rename to pkg/nebula/components/index/index_templ.go index a134bc196..7dc6f32d8 100644 --- a/nebula/components/index/index_templ.go +++ b/pkg/nebula/components/index/index_templ.go @@ -9,10 +9,14 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/global/state" - "github.com/onsonr/sonr/nebula/global/styles" + "github.com/onsonr/sonr/internal/dwn/gen" + "github.com/onsonr/sonr/pkg/nebula/global/state" + "github.com/onsonr/sonr/pkg/nebula/global/styles" ) +func ConfigFile(dwnConfig *gen.Config) { +} + func IndexFile() 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 diff --git a/nebula/deps.mjs b/pkg/nebula/deps.mjs similarity index 100% rename from nebula/deps.mjs rename to pkg/nebula/deps.mjs diff --git a/nebula/global/state/credentials.templ b/pkg/nebula/global/state/credentials.templ similarity index 100% rename from nebula/global/state/credentials.templ rename to pkg/nebula/global/state/credentials.templ diff --git a/nebula/global/state/credentials_templ.go b/pkg/nebula/global/state/credentials_templ.go similarity index 100% rename from nebula/global/state/credentials_templ.go rename to pkg/nebula/global/state/credentials_templ.go diff --git a/nebula/global/state/database.templ b/pkg/nebula/global/state/database.templ similarity index 100% rename from nebula/global/state/database.templ rename to pkg/nebula/global/state/database.templ diff --git a/nebula/global/state/database_templ.go b/pkg/nebula/global/state/database_templ.go similarity index 100% rename from nebula/global/state/database_templ.go rename to pkg/nebula/global/state/database_templ.go diff --git a/pkg/nebula/global/state/state.go b/pkg/nebula/global/state/state.go new file mode 100644 index 000000000..7bf2df5b4 --- /dev/null +++ b/pkg/nebula/global/state/state.go @@ -0,0 +1 @@ +package state diff --git a/nebula/global/state/worker.templ b/pkg/nebula/global/state/worker.templ similarity index 100% rename from nebula/global/state/worker.templ rename to pkg/nebula/global/state/worker.templ diff --git a/nebula/global/state/worker_templ.go b/pkg/nebula/global/state/worker_templ.go similarity index 100% rename from nebula/global/state/worker_templ.go rename to pkg/nebula/global/state/worker_templ.go diff --git a/nebula/global/styles/globals.css b/pkg/nebula/global/styles/globals.css similarity index 100% rename from nebula/global/styles/globals.css rename to pkg/nebula/global/styles/globals.css diff --git a/nebula/global/styles/layout.templ b/pkg/nebula/global/styles/layout.templ similarity index 100% rename from nebula/global/styles/layout.templ rename to pkg/nebula/global/styles/layout.templ diff --git a/nebula/global/styles/layout_templ.go b/pkg/nebula/global/styles/layout_templ.go similarity index 96% rename from nebula/global/styles/layout_templ.go rename to pkg/nebula/global/styles/layout_templ.go index 0076fc4fe..b9d307b01 100644 --- a/nebula/global/styles/layout_templ.go +++ b/pkg/nebula/global/styles/layout_templ.go @@ -167,7 +167,7 @@ func Layout(title string, remote bool) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 38, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 38, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -237,7 +237,7 @@ func LayoutNoBody(title string, remote bool) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 63, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 63, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -287,7 +287,7 @@ func OpenModal(title, description string) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 111, Col: 47} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 111, Col: 47} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -300,7 +300,7 @@ func OpenModal(title, description string) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(description) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 117, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 117, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { diff --git a/nebula/global/styles/scripts.templ b/pkg/nebula/global/styles/scripts.templ similarity index 100% rename from nebula/global/styles/scripts.templ rename to pkg/nebula/global/styles/scripts.templ diff --git a/nebula/global/styles/scripts_templ.go b/pkg/nebula/global/styles/scripts_templ.go similarity index 94% rename from nebula/global/styles/scripts_templ.go rename to pkg/nebula/global/styles/scripts_templ.go index 5d5734639..474639ddb 100644 --- a/nebula/global/styles/scripts_templ.go +++ b/pkg/nebula/global/styles/scripts_templ.go @@ -76,7 +76,7 @@ func Styles() templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/css/styles.css") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 20, Col: 50} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 20, Col: 50} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -118,7 +118,7 @@ func Alpine() templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/alpine.min.js") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 24, Col: 53} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 24, Col: 53} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -160,7 +160,7 @@ func Dexie() templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/dexie.min.js") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 28, Col: 52} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 28, Col: 52} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -202,7 +202,7 @@ func Htmx() templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/htmx.min.js") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 32, Col: 51} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 32, Col: 51} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { diff --git a/nebula/global/styles/sizes.templ b/pkg/nebula/global/styles/sizes.templ similarity index 100% rename from nebula/global/styles/sizes.templ rename to pkg/nebula/global/styles/sizes.templ diff --git a/nebula/global/styles/sizes_templ.go b/pkg/nebula/global/styles/sizes_templ.go similarity index 100% rename from nebula/global/styles/sizes_templ.go rename to pkg/nebula/global/styles/sizes_templ.go diff --git a/nebula/global/styles/typography.templ b/pkg/nebula/global/styles/typography.templ similarity index 100% rename from nebula/global/styles/typography.templ rename to pkg/nebula/global/styles/typography.templ diff --git a/nebula/global/styles/typography_templ.go b/pkg/nebula/global/styles/typography_templ.go similarity index 92% rename from nebula/global/styles/typography_templ.go rename to pkg/nebula/global/styles/typography_templ.go index a35d9626e..fe140728b 100644 --- a/nebula/global/styles/typography_templ.go +++ b/pkg/nebula/global/styles/typography_templ.go @@ -54,7 +54,7 @@ func renderText(level int, text string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 23, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 23, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -72,7 +72,7 @@ func renderText(level int, text string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 27, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 27, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -90,7 +90,7 @@ func renderText(level int, text string) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 31, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 31, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -108,7 +108,7 @@ func renderText(level int, text string) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 35, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 35, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -159,7 +159,7 @@ func renderLink(attrs templ.Attributes, text string) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 42, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 42, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -209,7 +209,7 @@ func renderStrong(attrs templ.Attributes, text string) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 48, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 48, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -259,7 +259,7 @@ func renderEmphasis(attrs templ.Attributes, text string) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 54, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 54, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -309,7 +309,7 @@ func renderCode(attrs templ.Attributes, text string) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 60, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 60, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { diff --git a/nebula/global/ui/badge.templ b/pkg/nebula/global/ui/badge.templ similarity index 100% rename from nebula/global/ui/badge.templ rename to pkg/nebula/global/ui/badge.templ diff --git a/nebula/global/ui/badge_templ.go b/pkg/nebula/global/ui/badge_templ.go similarity index 100% rename from nebula/global/ui/badge_templ.go rename to pkg/nebula/global/ui/badge_templ.go diff --git a/nebula/global/ui/button.templ b/pkg/nebula/global/ui/button.templ similarity index 99% rename from nebula/global/ui/button.templ rename to pkg/nebula/global/ui/button.templ index 76fc34075..2e0f34d50 100644 --- a/nebula/global/ui/button.templ +++ b/pkg/nebula/global/ui/button.templ @@ -1,6 +1,6 @@ package ui -import "github.com/onsonr/sonr/nebula/global/styles" +import "github.com/onsonr/sonr/pkg/nebula/global/styles" templ PrimaryButton(href string, text string) {