Skip to content

Commit 0b86850

Browse files
committed
mix phx.new counter #166
1 parent 9d99f7e commit 0b86850

File tree

909 files changed

+4752
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

909 files changed

+4752
-0
lines changed

assets/css/app.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import "tailwindcss/base";
2+
@import "tailwindcss/components";
3+
@import "tailwindcss/utilities";
4+
5+
/* This file is for your main application CSS */

assets/js/app.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// If you want to use Phoenix channels, run `mix help phx.gen.channel`
2+
// to get started and then uncomment the line below.
3+
// import "./user_socket.js"
4+
5+
// You can include dependencies in two ways.
6+
//
7+
// The simplest option is to put them in assets/vendor and
8+
// import them using relative paths:
9+
//
10+
// import "../vendor/some-package.js"
11+
//
12+
// Alternatively, you can `npm install some-package --prefix assets` and import
13+
// them using a path starting with the package name:
14+
//
15+
// import "some-package"
16+
//
17+
18+
// Include phoenix_html to handle method=PUT/DELETE in forms and buttons.
19+
import "phoenix_html"
20+
// Establish Phoenix Socket and LiveView configuration.
21+
import {Socket} from "phoenix"
22+
import {LiveSocket} from "phoenix_live_view"
23+
import topbar from "../vendor/topbar"
24+
25+
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
26+
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})
27+
28+
// Show progress bar on live navigation and form submits
29+
topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
30+
window.addEventListener("phx:page-loading-start", _info => topbar.show(300))
31+
window.addEventListener("phx:page-loading-stop", _info => topbar.hide())
32+
33+
// connect if there are any LiveViews on the page
34+
liveSocket.connect()
35+
36+
// expose liveSocket on window for web console debug logs and latency simulation:
37+
// >> liveSocket.enableDebug()
38+
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
39+
// >> liveSocket.disableLatencySim()
40+
window.liveSocket = liveSocket
41+

assets/tailwind.config.js

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// See the Tailwind configuration guide for advanced usage
2+
// https://tailwindcss.com/docs/configuration
3+
4+
const plugin = require("tailwindcss/plugin")
5+
const fs = require("fs")
6+
const path = require("path")
7+
8+
module.exports = {
9+
content: [
10+
"./js/**/*.js",
11+
"../lib/*_web.ex",
12+
"../lib/*_web/**/*.*ex"
13+
],
14+
theme: {
15+
extend: {
16+
colors: {
17+
brand: "#FD4F00",
18+
}
19+
},
20+
},
21+
plugins: [
22+
require("@tailwindcss/forms"),
23+
// Allows prefixing tailwind classes with LiveView classes to add rules
24+
// only when LiveView classes are applied, for example:
25+
//
26+
// <div class="phx-click-loading:animate-ping">
27+
//
28+
plugin(({addVariant}) => addVariant("phx-no-feedback", [".phx-no-feedback&", ".phx-no-feedback &"])),
29+
plugin(({addVariant}) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])),
30+
plugin(({addVariant}) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])),
31+
plugin(({addVariant}) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])),
32+
33+
// Embeds Heroicons (https://heroicons.com) into your app.css bundle
34+
// See your `CoreComponents.icon/1` for more information.
35+
//
36+
plugin(function({matchComponents, theme}) {
37+
let iconsDir = path.join(__dirname, "./vendor/heroicons/optimized")
38+
let values = {}
39+
let icons = [
40+
["", "/24/outline"],
41+
["-solid", "/24/solid"],
42+
["-mini", "/20/solid"]
43+
]
44+
icons.forEach(([suffix, dir]) => {
45+
fs.readdirSync(path.join(iconsDir, dir)).map(file => {
46+
let name = path.basename(file, ".svg") + suffix
47+
values[name] = {name, fullPath: path.join(iconsDir, dir, file)}
48+
})
49+
})
50+
matchComponents({
51+
"hero": ({name, fullPath}) => {
52+
let content = fs.readFileSync(fullPath).toString().replace(/\r?\n|\r/g, "")
53+
return {
54+
[`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
55+
"-webkit-mask": `var(--hero-${name})`,
56+
"mask": `var(--hero-${name})`,
57+
"mask-repeat": "no-repeat",
58+
"background-color": "currentColor",
59+
"vertical-align": "middle",
60+
"display": "inline-block",
61+
"width": theme("spacing.5"),
62+
"height": theme("spacing.5")
63+
}
64+
}
65+
}, {values})
66+
})
67+
]
68+
}

assets/vendor/heroicons/LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Refactoring UI Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

assets/vendor/heroicons/UPGRADE.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
You are running heroicons v2.0.16. To upgrade in place, you can run the following command,
2+
where your `HERO_VSN` export is your desired version:
3+
4+
export HERO_VSN="2.0.16" ; \
5+
curl -L "https://github.com/tailwindlabs/heroicons/archive/refs/tags/v${HERO_VSN}.tar.gz" | \
6+
tar -xvz --strip-components=1 heroicons-${HERO_VSN}/optimized
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)