-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
780 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@import "tailwindcss/base"; | ||
@import "tailwindcss/components"; | ||
@import "tailwindcss/utilities"; | ||
|
||
@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); | ||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); | ||
|
||
pre { | ||
@apply bg-zinc-500 text-white rounded px-2 text-sm; | ||
} | ||
|
||
h1, h2, h3, h4, h5 { | ||
@apply font-fancy font-semibold; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// See the Tailwind configuration guide for advanced usage | ||
// https://tailwindcss.com/docs/configuration | ||
|
||
const defaultTheme = require("tailwindcss/defaultTheme"); | ||
|
||
module.exports = { | ||
content: ["./js/**/*.js", "./lib/**/*.ex"], | ||
theme: { | ||
extend: { | ||
fontFamily: { | ||
sans: ['"Inter"', ...defaultTheme.fontFamily.sans], | ||
fancy: ['"Rubik"', ...defaultTheme.fontFamily.sans], | ||
}, | ||
}, | ||
}, | ||
plugins: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
import Config | ||
|
||
config :next_ls, :assets, tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]} | ||
|
||
config :web_dev_utils, :reload_url, "'wss://' + location.host + '/ws'" | ||
config :web_dev_utils, :reload_log, true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
defmodule NextLS.UI.Component do | ||
@moduledoc false | ||
use Temple.Component | ||
|
||
defmacro __using__(_) do | ||
quote do | ||
import Temple | ||
import unquote(__MODULE__) | ||
end | ||
end | ||
end | ||
|
||
defmodule NextLS.UI.Components do | ||
@moduledoc false | ||
use NextLS.UI.Component | ||
|
||
@env Mix.env() | ||
|
||
def root(assigns) do | ||
assigns = Map.put(assigns, :env, @env) | ||
|
||
temple do | ||
"<!DOCTYPE html>" | ||
|
||
html lang: "en" do | ||
head do | ||
meta charset: "utf-8" | ||
meta http_equiv: "X-UA-Compatible", content: "IE=edge" | ||
meta name: "viewport", content: "width=device-width, initial-scale=1.0" | ||
|
||
title do | ||
"Next LS Inspector" | ||
end | ||
|
||
script src: "https://unpkg.com/htmx.org@1.9.6" | ||
script src: "https://unpkg.com/htmx.org/dist/ext/ws.js" | ||
script src: "https://unpkg.com/htmx.org/dist/ext/morphdom-swap.js" | ||
|
||
script src: "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.0/chart.umd.min.js" | ||
|
||
script src: "https://cdn.jsdelivr.net/npm/luxon@^2" | ||
script src: "https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@^1" | ||
|
||
|
||
link rel: "stylesheet", href: "/css/site.css" | ||
end | ||
|
||
body class: "bg-zinc-200 dark:bg-zinc-900 font-sans", hx_ext: "morphdom-swap" do | ||
main class: "container mx-auto" do | ||
header class: "mb-8 py-2" do | ||
div class: "flex items-center space-x-2" do | ||
a href: "/", class: "hover:underline" do | ||
img src: "/nextls-logo-no-background.png", class: "h-8 w-8" | ||
end | ||
|
||
h2 class: "text-xl dark:text-white" do | ||
a href: "/" do | ||
"Next LS Inspector" | ||
end | ||
end | ||
end | ||
end | ||
|
||
slot @inner_block | ||
|
||
footer class: "flex justify-between dark:text-white mt-8 py-4" do | ||
div do | ||
a class: "underline", | ||
href: "https://github.com/elixir-tools/next-ls", | ||
do: "Source Code" | ||
end | ||
|
||
div class: "italic" do | ||
span do: "Built with" | ||
|
||
a class: "underline", | ||
href: "https://github.com/mhanberg/temple", | ||
do: "Temple," | ||
|
||
a class: "underline", | ||
href: "https://tailwindcss.com", | ||
do: "TailwindCSS," | ||
|
||
a class: "underline", | ||
href: "https://htmx.org", | ||
do: "HTMX," | ||
|
||
" and" | ||
|
||
span class: "text-red-500", do: "♥" | ||
end | ||
end | ||
end | ||
|
||
if @env == :dev do | ||
c &WebDevUtils.Components.live_reload/1 | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
def card(assigns) do | ||
temple do | ||
div class: "#{assigns[:class]} bg-zinc-50 dark:bg-zinc-700 dark:text-white rounded shadow-xl p-2", | ||
rest!: Map.take(assigns, [:id]) do | ||
slot @inner_block | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule NextLS.UI.Logger do | ||
@moduledoc false | ||
def log(event, _config) do | ||
if Process.alive?(Process.whereis(NextLS.UI.Registry)) do | ||
Registry.dispatch(NextLS.UI.Registry, :log_socket, fn entries -> | ||
for {pid, _} <- entries do | ||
send(pid, {:log, event}) | ||
end | ||
end) | ||
end | ||
end | ||
end |
Oops, something went wrong.