From a785d3a01f41eac42db95340d4d37b3891df90af Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Wed, 25 Sep 2024 22:09:15 -0400 Subject: [PATCH] chore: add nebula assets to proxy server --- app/proxy/server.go | 2 + devbox.json | 17 +- devbox.lock | 48 + nebula/assets/{js => }/htmx.min.js | 0 nebula/assets/main.js | 3 + nebula/assets/styles.css | 1764 ++++++++++++++++++++++++++++ nebula/blocks/blocks.go | 47 - nebula/blocks/global.templ | 41 + nebula/blocks/global_templ.go | 42 + nebula/package.json | 14 + nebula/src/main.ts | 2 + nebula/src/styles.css | 6 + nebula/tailwind.config.js | 12 + nebula/tsconfig.json | 13 + 14 files changed, 1959 insertions(+), 52 deletions(-) rename nebula/assets/{js => }/htmx.min.js (100%) create mode 100644 nebula/assets/main.js create mode 100644 nebula/assets/styles.css delete mode 100644 nebula/blocks/blocks.go create mode 100644 nebula/package.json create mode 100644 nebula/src/main.ts create mode 100644 nebula/src/styles.css create mode 100644 nebula/tailwind.config.js create mode 100644 nebula/tsconfig.json diff --git a/app/proxy/server.go b/app/proxy/server.go index f77afdd96..f6d503707 100644 --- a/app/proxy/server.go +++ b/app/proxy/server.go @@ -9,6 +9,7 @@ import ( "github.com/labstack/echo/v4" "github.com/labstack/gommon/log" + "github.com/onsonr/sonr/nebula" "github.com/onsonr/sonr/nebula/pages" ) @@ -18,6 +19,7 @@ func startServer() { e.Logger.SetLevel(log.INFO) // Configure the server + nebula.UseAssets(e) e.GET("/", pages.Home) e.GET("/allocate", pages.Profile) diff --git a/devbox.json b/devbox.json index 0952852e5..2b509576a 100644 --- a/devbox.json +++ b/devbox.json @@ -1,7 +1,8 @@ { "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json", "packages": [ - "go@1.22" + "go@1.22", + "bun@latest" ], "env": { "CLOUDFLARE_API_TOKEN": "$CLOUDFLARE_API_TOKEN", @@ -28,6 +29,9 @@ "build:image": [ "make local-image" ], + "build:nebula": [ + "cd nebula && bun run build" + ], "gen:proto": [ "make proto-gen" ], @@ -37,9 +41,6 @@ "gen:templ": [ "make templ" ], - "serve:air": [ - "make air" - ], "serve:ipfs": [ "make ipfs" ], @@ -50,7 +51,13 @@ "make sh-testnet" ], "serve:proxy": [ - "make sh-testnet" + "go run ./cmd/sonrd/main.go dwn-proxy" + ], + "watch:air": [ + "make air" + ], + "watch:nebula": [ + "cd nebula && bun run watch" ] } } diff --git a/devbox.lock b/devbox.lock index b05e2e892..2e3426763 100644 --- a/devbox.lock +++ b/devbox.lock @@ -1,6 +1,54 @@ { "lockfile_version": "1", "packages": { + "bun@latest": { + "last_modified": "2024-09-20T22:35:44Z", + "resolved": "github:NixOS/nixpkgs/a1d92660c6b3b7c26fb883500a80ea9d33321be2#bun", + "source": "devbox-search", + "version": "1.1.29", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/1hn8dddmy3l99x502d0fqz901gfk74px-bun-1.1.29", + "default": true + } + ], + "store_path": "/nix/store/1hn8dddmy3l99x502d0fqz901gfk74px-bun-1.1.29" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/q1k3hsk9hwsg6xllgd25pb0lrh51ym7z-bun-1.1.29", + "default": true + } + ], + "store_path": "/nix/store/q1k3hsk9hwsg6xllgd25pb0lrh51ym7z-bun-1.1.29" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/0wi8b58g19k1gpvniyvax2hpb77sp0w6-bun-1.1.29", + "default": true + } + ], + "store_path": "/nix/store/0wi8b58g19k1gpvniyvax2hpb77sp0w6-bun-1.1.29" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/mqzlk40bnhx54by2m4lyyc02syippzad-bun-1.1.29", + "default": true + } + ], + "store_path": "/nix/store/mqzlk40bnhx54by2m4lyyc02syippzad-bun-1.1.29" + } + } + }, "go@1.22": { "last_modified": "2024-09-12T11:58:09Z", "resolved": "github:NixOS/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1#go", diff --git a/nebula/assets/js/htmx.min.js b/nebula/assets/htmx.min.js similarity index 100% rename from nebula/assets/js/htmx.min.js rename to nebula/assets/htmx.min.js diff --git a/nebula/assets/main.js b/nebula/assets/main.js new file mode 100644 index 000000000..b41152d06 --- /dev/null +++ b/nebula/assets/main.js @@ -0,0 +1,3 @@ +"use strict"; +// src/ts/main.ts +console.log("Hello from TypeScript!"); diff --git a/nebula/assets/styles.css b/nebula/assets/styles.css new file mode 100644 index 000000000..9c953eaef --- /dev/null +++ b/nebula/assets/styles.css @@ -0,0 +1,1764 @@ +/* src/css/styles.css */ + +*, ::before, ::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +/* ! tailwindcss v3.4.13 | MIT License | https://tailwindcss.com */ + +/* +1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) +2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) +*/ + +*, +::before, +::after { + box-sizing: border-box; + /* 1 */ + border-width: 0; + /* 2 */ + border-style: solid; + /* 2 */ + border-color: #e5e7eb; + /* 2 */ +} + +::before, +::after { + --tw-content: ''; +} + +/* +1. Use a consistent sensible line-height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +3. Use a more readable tab size. +4. Use the user's configured `sans` font-family by default. +5. Use the user's configured `sans` font-feature-settings by default. +6. Use the user's configured `sans` font-variation-settings by default. +7. Disable tap highlights on iOS +*/ + +html, +:host { + line-height: 1.5; + /* 1 */ + -webkit-text-size-adjust: 100%; + /* 2 */ + -moz-tab-size: 4; + /* 3 */ + -o-tab-size: 4; + tab-size: 4; + /* 3 */ + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + /* 4 */ + font-feature-settings: normal; + /* 5 */ + font-variation-settings: normal; + /* 6 */ + -webkit-tap-highlight-color: transparent; + /* 7 */ +} + +/* +1. Remove the margin in all browsers. +2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. +*/ + +body { + margin: 0; + /* 1 */ + line-height: inherit; + /* 2 */ +} + +/* +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +3. Ensure horizontal rules are visible by default. +*/ + +hr { + height: 0; + /* 1 */ + color: inherit; + /* 2 */ + border-top-width: 1px; + /* 3 */ +} + +/* +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +/* +Remove the default font size and weight for headings. +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/* +Reset links to optimize for opt-in styling instead of opt-out. +*/ + +a { + color: inherit; + text-decoration: inherit; +} + +/* +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/* +1. Use the user's configured `mono` font-family by default. +2. Use the user's configured `mono` font-feature-settings by default. +3. Use the user's configured `mono` font-variation-settings by default. +4. Correct the odd `em` font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + /* 1 */ + font-feature-settings: normal; + /* 2 */ + font-variation-settings: normal; + /* 3 */ + font-size: 1em; + /* 4 */ +} + +/* +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/* +Prevent `sub` and `sup` elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +3. Remove gaps between table borders by default. +*/ + +table { + text-indent: 0; + /* 1 */ + border-color: inherit; + /* 2 */ + border-collapse: collapse; + /* 3 */ +} + +/* +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +3. Remove default padding in all browsers. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + /* 1 */ + font-feature-settings: inherit; + /* 1 */ + font-variation-settings: inherit; + /* 1 */ + font-size: 100%; + /* 1 */ + font-weight: inherit; + /* 1 */ + line-height: inherit; + /* 1 */ + letter-spacing: inherit; + /* 1 */ + color: inherit; + /* 1 */ + margin: 0; + /* 2 */ + padding: 0; + /* 3 */ +} + +/* +Remove the inheritance of text transform in Edge and Firefox. +*/ + +button, +select { + text-transform: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Remove default button styles. +*/ + +button, +input:where([type='button']), +input:where([type='reset']), +input:where([type='submit']) { + -webkit-appearance: button; + /* 1 */ + background-color: transparent; + /* 2 */ + background-image: none; + /* 2 */ +} + +/* +Use the modern Firefox focus style for all focusable elements. +*/ + +:-moz-focusring { + outline: auto; +} + +/* +Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/* +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/* +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/* +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/* +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to `inherit` in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} + +/* +Removes the default spacing and border for appropriate elements. +*/ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +fieldset { + margin: 0; + padding: 0; +} + +legend { + padding: 0; +} + +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} + +/* +Reset default styling for dialogs. +*/ + +dialog { + padding: 0; +} + +/* +Prevent resizing textareas horizontally by default. +*/ + +textarea { + resize: vertical; +} + +/* +1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) +2. Set the default placeholder color to the user's configured gray 400 color. +*/ + +input::-moz-placeholder, textarea::-moz-placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +input::placeholder, +textarea::placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +/* +Set the default cursor for buttons. +*/ + +button, +[role="button"] { + cursor: pointer; +} + +/* +Make sure disabled buttons don't get the pointer cursor. +*/ + +:disabled { + cursor: default; +} + +/* +1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) +2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) + This can trigger a poorly considered lint error in some tools but is included by design. +*/ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + /* 1 */ + vertical-align: middle; + /* 2 */ +} + +/* +Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) +*/ + +img, +video { + max-width: 100%; + height: auto; +} + +/* Make elements with the HTML hidden attribute stay hidden by default */ + +[hidden] { + display: none; +} + +.absolute { + position: absolute; +} + +.relative { + position: relative; +} + +.left-0 { + left: 0px; +} + +.left-1\/2 { + left: 50%; +} + +.right-0 { + right: 0px; +} + +.top-0 { + top: 0px; +} + +.z-10 { + z-index: 10; +} + +.z-20 { + z-index: 20; +} + +.z-30 { + z-index: 30; +} + +.z-50 { + z-index: 50; +} + +.mx-auto { + margin-left: auto; + margin-right: auto; +} + +.mb-1 { + margin-bottom: 0.25rem; +} + +.mb-3 { + margin-bottom: 0.75rem; +} + +.mb-6 { + margin-bottom: 1.5rem; +} + +.ml-2 { + margin-left: 0.5rem; +} + +.mr-1 { + margin-right: 0.25rem; +} + +.mr-7 { + margin-right: 1.75rem; +} + +.mt-1 { + margin-top: 0.25rem; +} + +.mt-12 { + margin-top: 3rem; +} + +.mt-2 { + margin-top: 0.5rem; +} + +.mt-5 { + margin-top: 1.25rem; +} + +.mt-6 { + margin-top: 1.5rem; +} + +.block { + display: block; +} + +.inline-block { + display: inline-block; +} + +.flex { + display: flex; +} + +.inline-flex { + display: inline-flex; +} + +.table { + display: table; +} + +.inline-grid { + display: inline-grid; +} + +.h-10 { + height: 2.5rem; +} + +.h-14 { + height: 3.5rem; +} + +.h-20 { + height: 5rem; +} + +.h-3 { + height: 0.75rem; +} + +.h-32 { + height: 8rem; +} + +.h-5 { + height: 1.25rem; +} + +.h-6 { + height: 1.5rem; +} + +.h-8 { + height: 2rem; +} + +.h-9 { + height: 2.25rem; +} + +.h-auto { + height: auto; +} + +.h-full { + height: 100%; +} + +.w-1\/2 { + width: 50%; +} + +.w-14 { + width: 3.5rem; +} + +.w-16 { + width: 4rem; +} + +.w-20 { + width: 5rem; +} + +.w-3 { + width: 0.75rem; +} + +.w-4 { + width: 1rem; +} + +.w-5 { + width: 1.25rem; +} + +.w-6 { + width: 1.5rem; +} + +.w-8 { + width: 2rem; +} + +.w-\[365px\] { + width: 365px; +} + +.w-\[full\] { + width: full; +} + +.w-auto { + width: auto; +} + +.w-fit { + width: -moz-fit-content; + width: fit-content; +} + +.w-full { + width: 100%; +} + +.min-w-full { + min-width: 100%; +} + +.max-w-2xl { + max-width: 42rem; +} + +.max-w-lg { + max-width: 32rem; +} + +.max-w-sm { + max-width: 24rem; +} + +.max-w-xl { + max-width: 36rem; +} + +.-translate-x-0 { + --tw-translate-x: -0px; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.-translate-x-1\/2 { + --tw-translate-x: -50%; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.-translate-x-4 { + --tw-translate-x: -1rem; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.-translate-x-7 { + --tw-translate-x: -1.75rem; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.-translate-y-0\.5 { + --tw-translate-y: -0.125rem; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.translate-y-24 { + --tw-translate-y: 6rem; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.translate-y-3 { + --tw-translate-y: 0.75rem; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.translate-y-px { + --tw-translate-y: 1px; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.cursor-default { + cursor: default; +} + +.cursor-pointer { + cursor: pointer; +} + +.select-none { + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} + +.grid-cols-3 { + grid-template-columns: repeat(3, minmax(0, 1fr)); +} + +.flex-row { + flex-direction: row; +} + +.flex-col { + flex-direction: column; +} + +.items-start { + align-items: flex-start; +} + +.items-center { + align-items: center; +} + +.justify-center { + justify-content: center; +} + +.justify-between { + justify-content: space-between; +} + +.gap-2 { + gap: 0.5rem; +} + +.gap-3 { + gap: 0.75rem; +} + +.gap-x-3 { + -moz-column-gap: 0.75rem; + column-gap: 0.75rem; +} + +.space-x-1 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.25rem * var(--tw-space-x-reverse)); + margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse))); +} + +.space-x-3 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.75rem * var(--tw-space-x-reverse)); + margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse))); +} + +.space-y-1 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); +} + +.space-y-1\.5 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.375rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.375rem * var(--tw-space-y-reverse)); +} + +.space-y-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)); +} + +.space-y-3 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)); +} + +.divide-y > :not([hidden]) ~ :not([hidden]) { + --tw-divide-y-reverse: 0; + border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse))); + border-bottom-width: calc(1px * var(--tw-divide-y-reverse)); +} + +.divide-neutral-200 > :not([hidden]) ~ :not([hidden]) { + --tw-divide-opacity: 1; + border-color: rgb(229 229 229 / var(--tw-divide-opacity)); +} + +.overflow-hidden { + overflow: hidden; +} + +.overflow-x-auto { + overflow-x: auto; +} + +.whitespace-nowrap { + white-space: nowrap; +} + +.rounded { + border-radius: 0.25rem; +} + +.rounded-full { + border-radius: 9999px; +} + +.rounded-lg { + border-radius: 0.5rem; +} + +.rounded-md { + border-radius: 0.375rem; +} + +.border { + border-width: 1px; +} + +.border-2 { + border-width: 2px; +} + +.border-t { + border-top-width: 1px; +} + +.border-blue-600 { + --tw-border-opacity: 1; + border-color: rgb(37 99 235 / var(--tw-border-opacity)); +} + +.border-gray-100 { + --tw-border-opacity: 1; + border-color: rgb(243 244 246 / var(--tw-border-opacity)); +} + +.border-gray-200\/70 { + border-color: rgb(229 231 235 / 0.7); +} + +.border-green-600 { + --tw-border-opacity: 1; + border-color: rgb(22 163 74 / var(--tw-border-opacity)); +} + +.border-neutral-200\/60 { + border-color: rgb(229 229 229 / 0.6); +} + +.border-neutral-200\/70 { + border-color: rgb(229 229 229 / 0.7); +} + +.border-neutral-300 { + --tw-border-opacity: 1; + border-color: rgb(212 212 212 / var(--tw-border-opacity)); +} + +.border-neutral-900 { + --tw-border-opacity: 1; + border-color: rgb(23 23 23 / var(--tw-border-opacity)); +} + +.border-red-600 { + --tw-border-opacity: 1; + border-color: rgb(220 38 38 / var(--tw-border-opacity)); +} + +.border-transparent { + border-color: transparent; +} + +.border-white { + --tw-border-opacity: 1; + border-color: rgb(255 255 255 / var(--tw-border-opacity)); +} + +.border-yellow-500 { + --tw-border-opacity: 1; + border-color: rgb(234 179 8 / var(--tw-border-opacity)); +} + +.bg-blue-50 { + --tw-bg-opacity: 1; + background-color: rgb(239 246 255 / var(--tw-bg-opacity)); +} + +.bg-blue-600 { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); +} + +.bg-gray-100 { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} + +.bg-green-50 { + --tw-bg-opacity: 1; + background-color: rgb(240 253 244 / var(--tw-bg-opacity)); +} + +.bg-green-500 { + --tw-bg-opacity: 1; + background-color: rgb(34 197 94 / var(--tw-bg-opacity)); +} + +.bg-green-600 { + --tw-bg-opacity: 1; + background-color: rgb(22 163 74 / var(--tw-bg-opacity)); +} + +.bg-neutral-50 { + --tw-bg-opacity: 1; + background-color: rgb(250 250 250 / var(--tw-bg-opacity)); +} + +.bg-neutral-900 { + --tw-bg-opacity: 1; + background-color: rgb(23 23 23 / var(--tw-bg-opacity)); +} + +.bg-neutral-950 { + --tw-bg-opacity: 1; + background-color: rgb(10 10 10 / var(--tw-bg-opacity)); +} + +.bg-red-50 { + --tw-bg-opacity: 1; + background-color: rgb(254 242 242 / var(--tw-bg-opacity)); +} + +.bg-red-600 { + --tw-bg-opacity: 1; + background-color: rgb(220 38 38 / var(--tw-bg-opacity)); +} + +.bg-transparent { + background-color: transparent; +} + +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + +.bg-yellow-50 { + --tw-bg-opacity: 1; + background-color: rgb(254 252 232 / var(--tw-bg-opacity)); +} + +.bg-yellow-500 { + --tw-bg-opacity: 1; + background-color: rgb(234 179 8 / var(--tw-bg-opacity)); +} + +.bg-yellow-600 { + --tw-bg-opacity: 1; + background-color: rgb(202 138 4 / var(--tw-bg-opacity)); +} + +.object-cover { + -o-object-fit: cover; + object-fit: cover; +} + +.p-1 { + padding: 0.25rem; +} + +.p-4 { + padding: 1rem; +} + +.p-5 { + padding: 1.25rem; +} + +.p-6 { + padding: 1.5rem; +} + +.p-7 { + padding: 1.75rem; +} + +.px-2\.5 { + padding-left: 0.625rem; + padding-right: 0.625rem; +} + +.px-3 { + padding-left: 0.75rem; + padding-right: 0.75rem; +} + +.px-3\.5 { + padding-left: 0.875rem; + padding-right: 0.875rem; +} + +.px-4 { + padding-left: 1rem; + padding-right: 1rem; +} + +.px-5 { + padding-left: 1.25rem; + padding-right: 1.25rem; +} + +.px-7 { + padding-left: 1.75rem; + padding-right: 1.75rem; +} + +.py-0\.5 { + padding-top: 0.125rem; + padding-bottom: 0.125rem; +} + +.py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + +.py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.py-3 { + padding-top: 0.75rem; + padding-bottom: 0.75rem; +} + +.py-4 { + padding-top: 1rem; + padding-bottom: 1rem; +} + +.pb-1 { + padding-bottom: 0.25rem; +} + +.pb-2 { + padding-bottom: 0.5rem; +} + +.pb-3 { + padding-bottom: 0.75rem; +} + +.pb-6 { + padding-bottom: 1.5rem; +} + +.pl-4 { + padding-left: 1rem; +} + +.pr-2 { + padding-right: 0.5rem; +} + +.pr-4 { + padding-right: 1rem; +} + +.pt-0 { + padding-top: 0px; +} + +.pt-2 { + padding-top: 0.5rem; +} + +.pt-8 { + padding-top: 2rem; +} + +.text-left { + text-align: left; +} + +.text-right { + text-align: right; +} + +.text-2xl { + font-size: 1.5rem; + line-height: 2rem; +} + +.text-base { + font-size: 1rem; + line-height: 1.5rem; +} + +.text-lg { + font-size: 1.125rem; + line-height: 1.75rem; +} + +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + +.text-xs { + font-size: 0.75rem; + line-height: 1rem; +} + +.font-bold { + font-weight: 700; +} + +.font-medium { + font-weight: 500; +} + +.font-normal { + font-weight: 400; +} + +.font-semibold { + font-weight: 600; +} + +.uppercase { + text-transform: uppercase; +} + +.leading-none { + line-height: 1; +} + +.tracking-tight { + letter-spacing: -0.025em; +} + +.tracking-wide { + letter-spacing: 0.025em; +} + +.text-blue-500 { + --tw-text-opacity: 1; + color: rgb(59 130 246 / var(--tw-text-opacity)); +} + +.text-blue-600 { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); +} + +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.text-gray-400\/70 { + color: rgb(156 163 175 / 0.7); +} + +.text-gray-500 { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity)); +} + +.text-gray-600 { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity)); +} + +.text-gray-700 { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity)); +} + +.text-gray-900 { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity)); +} + +.text-green-500 { + --tw-text-opacity: 1; + color: rgb(34 197 94 / var(--tw-text-opacity)); +} + +.text-green-600 { + --tw-text-opacity: 1; + color: rgb(22 163 74 / var(--tw-text-opacity)); +} + +.text-neutral-100 { + --tw-text-opacity: 1; + color: rgb(245 245 245 / var(--tw-text-opacity)); +} + +.text-neutral-500 { + --tw-text-opacity: 1; + color: rgb(115 115 115 / var(--tw-text-opacity)); +} + +.text-neutral-800 { + --tw-text-opacity: 1; + color: rgb(38 38 38 / var(--tw-text-opacity)); +} + +.text-neutral-900 { + --tw-text-opacity: 1; + color: rgb(23 23 23 / var(--tw-text-opacity)); +} + +.text-red-500 { + --tw-text-opacity: 1; + color: rgb(239 68 68 / var(--tw-text-opacity)); +} + +.text-red-600 { + --tw-text-opacity: 1; + color: rgb(220 38 38 / var(--tw-text-opacity)); +} + +.text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.text-yellow-600 { + --tw-text-opacity: 1; + color: rgb(202 138 4 / var(--tw-text-opacity)); +} + +.opacity-50 { + opacity: 0.5; +} + +.opacity-70 { + opacity: 0.7; +} + +.shadow-sm { + --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); + --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.transition-all { + transition-property: all; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} + +.transition-colors { + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} + +.duration-100 { + transition-duration: 100ms; +} + +.duration-200 { + transition-duration: 200ms; +} + +.duration-300 { + transition-duration: 300ms; +} + +.ease-out { + transition-timing-function: cubic-bezier(0, 0, 0.2, 1); +} + +/* Custom styles */ + +.placeholder\:text-neutral-400::-moz-placeholder { + --tw-text-opacity: 1; + color: rgb(163 163 163 / var(--tw-text-opacity)); +} + +.placeholder\:text-neutral-400::placeholder { + --tw-text-opacity: 1; + color: rgb(163 163 163 / var(--tw-text-opacity)); +} + +.hover\:bg-blue-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity)); +} + +.hover\:bg-blue-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); +} + +.hover\:bg-blue-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(29 78 216 / var(--tw-bg-opacity)); +} + +.hover\:bg-gray-50:hover { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity)); +} + +.hover\:bg-green-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(220 252 231 / var(--tw-bg-opacity)); +} + +.hover\:bg-green-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(22 163 74 / var(--tw-bg-opacity)); +} + +.hover\:bg-green-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(21 128 61 / var(--tw-bg-opacity)); +} + +.hover\:bg-neutral-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(245 245 245 / var(--tw-bg-opacity)); +} + +.hover\:bg-neutral-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(38 38 38 / var(--tw-bg-opacity)); +} + +.hover\:bg-neutral-900:hover { + --tw-bg-opacity: 1; + background-color: rgb(23 23 23 / var(--tw-bg-opacity)); +} + +.hover\:bg-red-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 226 226 / var(--tw-bg-opacity)); +} + +.hover\:bg-red-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(220 38 38 / var(--tw-bg-opacity)); +} + +.hover\:bg-red-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(185 28 28 / var(--tw-bg-opacity)); +} + +.hover\:bg-yellow-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 249 195 / var(--tw-bg-opacity)); +} + +.hover\:bg-yellow-500:hover { + --tw-bg-opacity: 1; + background-color: rgb(234 179 8 / var(--tw-bg-opacity)); +} + +.hover\:bg-yellow-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(161 98 7 / var(--tw-bg-opacity)); +} + +.hover\:text-blue-600:hover { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); +} + +.hover\:text-blue-700:hover { + --tw-text-opacity: 1; + color: rgb(29 78 216 / var(--tw-text-opacity)); +} + +.hover\:text-green-600:hover { + --tw-text-opacity: 1; + color: rgb(22 163 74 / var(--tw-text-opacity)); +} + +.hover\:text-neutral-600:hover { + --tw-text-opacity: 1; + color: rgb(82 82 82 / var(--tw-text-opacity)); +} + +.hover\:text-neutral-700:hover { + --tw-text-opacity: 1; + color: rgb(64 64 64 / var(--tw-text-opacity)); +} + +.hover\:text-neutral-900:hover { + --tw-text-opacity: 1; + color: rgb(23 23 23 / var(--tw-text-opacity)); +} + +.hover\:text-red-600:hover { + --tw-text-opacity: 1; + color: rgb(220 38 38 / var(--tw-text-opacity)); +} + +.hover\:text-white:hover { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); +} + +.hover\:text-yellow-700:hover { + --tw-text-opacity: 1; + color: rgb(161 98 7 / var(--tw-text-opacity)); +} + +.hover\:underline:hover { + text-decoration-line: underline; +} + +.focus\:border-neutral-300:focus { + --tw-border-opacity: 1; + border-color: rgb(212 212 212 / var(--tw-border-opacity)); +} + +.focus\:bg-white:focus { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + +.focus\:outline-none:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.focus\:ring-2:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:ring-blue-100:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(219 234 254 / var(--tw-ring-opacity)); +} + +.focus\:ring-blue-700:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(29 78 216 / var(--tw-ring-opacity)); +} + +.focus\:ring-gray-700:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity)); +} + +.focus\:ring-green-100:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(220 252 231 / var(--tw-ring-opacity)); +} + +.focus\:ring-green-700:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(21 128 61 / var(--tw-ring-opacity)); +} + +.focus\:ring-neutral-100:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(245 245 245 / var(--tw-ring-opacity)); +} + +.focus\:ring-neutral-200\/60:focus { + --tw-ring-color: rgb(229 229 229 / 0.6); +} + +.focus\:ring-neutral-400:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(163 163 163 / var(--tw-ring-opacity)); +} + +.focus\:ring-neutral-900:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(23 23 23 / var(--tw-ring-opacity)); +} + +.focus\:ring-red-100:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(254 226 226 / var(--tw-ring-opacity)); +} + +.focus\:ring-red-700:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(185 28 28 / var(--tw-ring-opacity)); +} + +.focus\:ring-yellow-100:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(254 249 195 / var(--tw-ring-opacity)); +} + +.focus\:ring-yellow-700:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(161 98 7 / var(--tw-ring-opacity)); +} + +.focus\:ring-offset-2:focus { + --tw-ring-offset-width: 2px; +} + +.focus-visible\:outline-none:focus-visible { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.focus-visible\:ring-2:focus-visible { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus-visible\:ring-offset-2:focus-visible { + --tw-ring-offset-width: 2px; +} + +.active\:bg-white:active { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + +.disabled\:pointer-events-none:disabled { + pointer-events: none; +} + +.disabled\:cursor-not-allowed:disabled { + cursor: not-allowed; +} + +.disabled\:opacity-50:disabled { + opacity: 0.5; +} + +.peer:disabled ~ .peer-disabled\:cursor-not-allowed { + cursor: not-allowed; +} + +.peer:disabled ~ .peer-disabled\:opacity-70 { + opacity: 0.7; +} + +@media (min-width: 640px) { + .sm\:mb-0 { + margin-bottom: 0px; + } +} + +@media (min-width: 768px) { + .md\:flex-row { + flex-direction: row; + } + + .md\:gap-4 { + gap: 1rem; + } + + .md\:gap-6 { + gap: 1.5rem; + } +} + +@media (min-width: 1024px) { + .lg\:text-2xl { + font-size: 1.5rem; + line-height: 2rem; + } + + .lg\:text-3xl { + font-size: 1.875rem; + line-height: 2.25rem; + } + + .lg\:text-xl { + font-size: 1.25rem; + line-height: 1.75rem; + } +} + +.\[\&\:has\(svg\)\]\:pl-11:has(svg) { + padding-left: 2.75rem; +} + +.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div { + --tw-translate-y: -3px; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.\[\&\>svg\]\:absolute>svg { + position: absolute; +} + +.\[\&\>svg\]\:left-4>svg { + left: 1rem; +} + +.\[\&\>svg\]\:top-4>svg { + top: 1rem; +} + +.\[\&_\.active-breadcrumb\]\:font-medium .active-breadcrumb { + font-weight: 500; +} + +.\[\&_\.active-breadcrumb\]\:text-neutral-600 .active-breadcrumb { + --tw-text-opacity: 1; + color: rgb(82 82 82 / var(--tw-text-opacity)); +} diff --git a/nebula/blocks/blocks.go b/nebula/blocks/blocks.go deleted file mode 100644 index 098e91dcf..000000000 --- a/nebula/blocks/blocks.go +++ /dev/null @@ -1,47 +0,0 @@ -package blocks - -import ( - "strings" - - "github.com/a-h/templ" -) - -type Icon interface { - Render() templ.Component -} - -type Variant interface { - Attributes() templ.Attributes -} - -func clsxMerge(variants ...Variant) templ.Attributes { - combinedAttrs := templ.Attributes{} - var classElements []string - - for _, variant := range variants { - attrs := variant.Attributes() - if class, ok := attrs["class"].(string); ok { - classElements = append(classElements, strings.Fields(class)...) - } - for key, value := range attrs { - if key != "class" { - combinedAttrs[key] = value - } - } - } - - if len(classElements) > 0 { - combinedAttrs["class"] = strings.Join(classElements, " ") - } - return combinedAttrs -} - -func clsxBuilder(classes ...string) templ.Attributes { - if len(classes) == 0 { - return templ.Attributes{} - } - class := strings.Join(classes, " ") - return templ.Attributes{ - "class": class, - } -} diff --git a/nebula/blocks/global.templ b/nebula/blocks/global.templ index d353eb080..c7dcef0f2 100644 --- a/nebula/blocks/global.templ +++ b/nebula/blocks/global.templ @@ -1,5 +1,46 @@ package blocks +import "strings" + +type Icon interface { + Render() templ.Component +} + +type Variant interface { + Attributes() templ.Attributes +} + +func clsxMerge(variants ...Variant) templ.Attributes { + combinedAttrs := templ.Attributes{} + var classElements []string + + for _, variant := range variants { + attrs := variant.Attributes() + if class, ok := attrs["class"].(string); ok { + classElements = append(classElements, strings.Fields(class)...) + } + for key, value := range attrs { + if key != "class" { + combinedAttrs[key] = value + } + } + } + + if len(classElements) > 0 { + combinedAttrs["class"] = strings.Join(classElements, " ") + } + return combinedAttrs +} + +func clsxBuilder(classes ...string) templ.Attributes { + if len(classes) == 0 { + return templ.Attributes{} + } + class := strings.Join(classes, " ") + return templ.Attributes{ + "class": class, + } +} templ Spacer() {
diff --git a/nebula/blocks/global_templ.go b/nebula/blocks/global_templ.go index fa527537a..9dd760e40 100644 --- a/nebula/blocks/global_templ.go +++ b/nebula/blocks/global_templ.go @@ -8,6 +8,48 @@ package blocks import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" +import "strings" + +type Icon interface { + Render() templ.Component +} + +type Variant interface { + Attributes() templ.Attributes +} + +func clsxMerge(variants ...Variant) templ.Attributes { + combinedAttrs := templ.Attributes{} + var classElements []string + + for _, variant := range variants { + attrs := variant.Attributes() + if class, ok := attrs["class"].(string); ok { + classElements = append(classElements, strings.Fields(class)...) + } + for key, value := range attrs { + if key != "class" { + combinedAttrs[key] = value + } + } + } + + if len(classElements) > 0 { + combinedAttrs["class"] = strings.Join(classElements, " ") + } + return combinedAttrs +} + +func clsxBuilder(classes ...string) templ.Attributes { + if len(classes) == 0 { + return templ.Attributes{} + } + class := strings.Join(classes, " ") + return templ.Attributes{ + "class": class, + } +} + func Spacer() 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/package.json b/nebula/package.json new file mode 100644 index 000000000..cb54f5132 --- /dev/null +++ b/nebula/package.json @@ -0,0 +1,14 @@ +{ + "scripts": { + "build:ts": "tsc", + "build:css": "bunx tailwindcss -i ./src/styles.css -o ./assets/styles.css", + "build": "bun run build:ts && bun run build:css", + "watch:ts": "tsc -w", + "watch:css": "bunx tailwindcss -i ./src/styles.css -o ./assets/styles.css --watch", + "watch": "bun run watch:ts & bun run watch:css" + }, + "devDependencies": { + "tailwindcss": "^3.3.0", + "typescript": "^4.9.0" + } +} diff --git a/nebula/src/main.ts b/nebula/src/main.ts new file mode 100644 index 000000000..74fac85b0 --- /dev/null +++ b/nebula/src/main.ts @@ -0,0 +1,2 @@ +// src/ts/main.ts +console.log("Hello from TypeScript!"); diff --git a/nebula/src/styles.css b/nebula/src/styles.css new file mode 100644 index 000000000..606004e4e --- /dev/null +++ b/nebula/src/styles.css @@ -0,0 +1,6 @@ +/* src/css/styles.css */ +@tailwind base; +@tailwind components; +@tailwind utilities; + +/* Custom styles */ diff --git a/nebula/tailwind.config.js b/nebula/tailwind.config.js new file mode 100644 index 000000000..823bff033 --- /dev/null +++ b/nebula/tailwind.config.js @@ -0,0 +1,12 @@ +// tailwind.config.js +module.exports = { + content: [ + "./blocks/**/*.{templ,html}", + "./pages/**/*.{templ,html}", + "./src/**/*.ts", + ], + theme: { + extend: {}, + }, + plugins: [], +}; diff --git a/nebula/tsconfig.json b/nebula/tsconfig.json new file mode 100644 index 000000000..fd6a27b1b --- /dev/null +++ b/nebula/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "outDir": "./assets", + "rootDir": "./src", + "target": "ES6", + "module": "ES6", + "moduleResolution": "node", + "strict": true + }, + "include": [ + "src/**/*" + ] +}