-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit e427175
Showing
96 changed files
with
10,887 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
import_deps: [:ecto, :ecto_sql, :phoenix], | ||
subdirectories: ["priv/*/migrations"], | ||
plugins: [Phoenix.LiveView.HTMLFormatter], | ||
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/seeds.exs"] | ||
] |
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,37 @@ | ||
# The directory Mix will write compiled artifacts to. | ||
/_build/ | ||
|
||
# If you run "mix test --cover", coverage assets end up here. | ||
/cover/ | ||
|
||
# The directory Mix downloads your dependencies sources to. | ||
/deps/ | ||
|
||
# Where 3rd-party dependencies like ExDoc output generated docs. | ||
/doc/ | ||
|
||
# Ignore .fetch files in case you like to edit your project deps locally. | ||
/.fetch | ||
|
||
# If the VM crashes, it generates a dump, let's ignore it too. | ||
erl_crash.dump | ||
|
||
# Also ignore archive artifacts (built via "mix archive.build"). | ||
*.ez | ||
|
||
# Temporary files, for example, from tests. | ||
/tmp/ | ||
|
||
# Ignore package tarball (built via "mix hex.build"). | ||
munch-*.tar | ||
|
||
# Ignore assets that are produced by build tools. | ||
/priv/static/assets/ | ||
|
||
# Ignore digested assets cache. | ||
/priv/static/cache_manifest.json | ||
|
||
# In case you use Node.js/npm, you want to ignore these. | ||
npm-debug.log | ||
/assets/node_modules/ | ||
|
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,18 @@ | ||
# Munch | ||
|
||
To start your Phoenix server: | ||
|
||
* Run `mix setup` to install and setup dependencies | ||
* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server` | ||
|
||
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. | ||
|
||
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html). | ||
|
||
## Learn more | ||
|
||
* Official website: https://www.phoenixframework.org/ | ||
* Guides: https://hexdocs.pm/phoenix/overview.html | ||
* Docs: https://hexdocs.pm/phoenix | ||
* Forum: https://elixirforum.com/c/phoenix-forum | ||
* Source: https://github.com/phoenixframework/phoenix |
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,5 @@ | ||
@import "tailwindcss/base"; | ||
@import "tailwindcss/components"; | ||
@import "tailwindcss/utilities"; | ||
|
||
/* This file is for your main application CSS */ |
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,73 @@ | ||
// If you want to use Phoenix channels, run `mix help phx.gen.channel` | ||
// to get started and then uncomment the line below. | ||
// import "./user_socket.js" | ||
|
||
// You can include dependencies in two ways. | ||
// | ||
// The simplest option is to put them in assets/vendor and | ||
// import them using relative paths: | ||
// | ||
// import "../vendor/some-package.js" | ||
// | ||
// Alternatively, you can `npm install some-package --prefix assets` and import | ||
// them using a path starting with the package name: | ||
// | ||
// import "some-package" | ||
// | ||
|
||
// Include phoenix_html to handle method=PUT/DELETE in forms and buttons. | ||
import "phoenix_html" | ||
// Establish Phoenix Socket and LiveView configuration. | ||
import { Socket } from "../../../../" | ||
import { LiveSocket } from "phoenix_live_view" | ||
import topbar from "../vendor/topbar" | ||
import Sortable from "../vendor/Sortable.min" | ||
|
||
|
||
let Hooks = { | ||
SortableInputs: { | ||
mounted() { | ||
// SortableJS triggers change events on the parent element, but LiveView errors if a | ||
// change event is triggered on a non-input element, so we suppress the change event | ||
// and use a proxy input element to send the change event to LiveView. | ||
this.el.addEventListener('change', (e) => { | ||
e.stopPropagation() | ||
e.preventDefault() | ||
}); | ||
let proxy = document.createElement('input'); | ||
proxy.type = 'hidden'; | ||
proxy.name = 'sortable-change-proxy'; | ||
this.el.appendChild(proxy); | ||
Sortable.create(this.el, { | ||
animation: 150, | ||
onEnd: (e) => { | ||
proxy.dispatchEvent(new Event('change', { bubbles: true })) | ||
} | ||
}); | ||
|
||
} | ||
} | ||
} | ||
|
||
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content") | ||
let liveSocket = new LiveSocket("/live", Socket, { | ||
longPollFallbackMs: 2500, | ||
params: { _csrf_token: csrfToken }, | ||
hooks: Hooks | ||
}) | ||
|
||
// Show progress bar on live navigation and form submits | ||
topbar.config({ barColors: { 0: "#29d" }, shadowColor: "rgba(0, 0, 0, .3)" }) | ||
window.addEventListener("phx:page-loading-start", _info => topbar.show(300)) | ||
window.addEventListener("phx:page-loading-stop", _info => topbar.hide()) | ||
|
||
// connect if there are any LiveViews on the page | ||
liveSocket.connect() | ||
|
||
// expose liveSocket on window for web console debug logs and latency simulation: | ||
// >> liveSocket.enableDebug() | ||
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session | ||
// >> liveSocket.disableLatencySim() | ||
liveSocket.enableDebug() | ||
window.liveSocket = liveSocket | ||
|
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,74 @@ | ||
// See the Tailwind configuration guide for advanced usage | ||
// https://tailwindcss.com/docs/configuration | ||
|
||
const plugin = require("tailwindcss/plugin") | ||
const fs = require("fs") | ||
const path = require("path") | ||
|
||
module.exports = { | ||
content: [ | ||
"./js/**/*.js", | ||
"../lib/munch_web.ex", | ||
"../lib/munch_web/**/*.*ex" | ||
], | ||
theme: { | ||
extend: { | ||
colors: { | ||
brand: "#FD4F00", | ||
} | ||
}, | ||
}, | ||
plugins: [ | ||
require("@tailwindcss/forms"), | ||
// Allows prefixing tailwind classes with LiveView classes to add rules | ||
// only when LiveView classes are applied, for example: | ||
// | ||
// <div class="phx-click-loading:animate-ping"> | ||
// | ||
plugin(({addVariant}) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])), | ||
plugin(({addVariant}) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])), | ||
plugin(({addVariant}) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])), | ||
|
||
// Embeds Heroicons (https://heroicons.com) into your app.css bundle | ||
// See your `CoreComponents.icon/1` for more information. | ||
// | ||
plugin(function({matchComponents, theme}) { | ||
let iconsDir = path.join(__dirname, "../deps/heroicons/optimized") | ||
let values = {} | ||
let icons = [ | ||
["", "/24/outline"], | ||
["-solid", "/24/solid"], | ||
["-mini", "/20/solid"], | ||
["-micro", "/16/solid"] | ||
] | ||
icons.forEach(([suffix, dir]) => { | ||
fs.readdirSync(path.join(iconsDir, dir)).forEach(file => { | ||
let name = path.basename(file, ".svg") + suffix | ||
values[name] = {name, fullPath: path.join(iconsDir, dir, file)} | ||
}) | ||
}) | ||
matchComponents({ | ||
"hero": ({name, fullPath}) => { | ||
let content = fs.readFileSync(fullPath).toString().replace(/\r?\n|\r/g, "") | ||
let size = theme("spacing.6") | ||
if (name.endsWith("-mini")) { | ||
size = theme("spacing.5") | ||
} else if (name.endsWith("-micro")) { | ||
size = theme("spacing.4") | ||
} | ||
return { | ||
[`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`, | ||
"-webkit-mask": `var(--hero-${name})`, | ||
"mask": `var(--hero-${name})`, | ||
"mask-repeat": "no-repeat", | ||
"background-color": "currentColor", | ||
"vertical-align": "middle", | ||
"display": "inline-block", | ||
"width": size, | ||
"height": size | ||
} | ||
} | ||
}, {values}) | ||
}) | ||
] | ||
} |
Oops, something went wrong.