Skip to content

Commit

Permalink
Merge branch 'main' into site_wide_handle_info_callbacks_feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ddink authored Aug 28, 2024
2 parents 92a4a38 + 2ee21c4 commit 1f68ecb
Show file tree
Hide file tree
Showing 29 changed files with 513 additions and 355 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.1.0-dev

## 0.1.0-rc.1 (2024-08-27)

### Enhancements
* Added Shared Event Handlers which are global event handlers shared among all pages.
That's a simple model to work with where a layout, component, or multiple pages may share the same event handler,
for example a newsletter subscription form in a component called in a layout doesn't need to duplicate the same
event handler in all pages.

### Breaking Changes
* Remove Page Event Handlers in favor of Shared Event Handlers.
With Shared Event Handlers, it doesn't make sense to have page event handlers unless overriding becomes a neccessity.
The data is automatically migrated in a best-effort way, duplicated event handler names (from multiple pages) are
consolidated into a single shared event handler. See the migration `V002` for more info.

## Fixes
* Display parsed page title on live renders

## 0.1.0-rc.0 (2024-08-02)

### Enhancements
Expand Down
4 changes: 2 additions & 2 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beacon",
"version": "0.1.0-rc.0",
"version": "0.1.0-rc.1",
"license": "MIT",
"repository": {},
"scripts": {
Expand Down
117 changes: 59 additions & 58 deletions assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
// https://tailwindcss.com/docs/configuration

const plugin = require("tailwindcss/plugin")
const fs = require("fs")
const path = require("path")
// FIXME: enable heroicons plugin
// const fs = require("fs")
// const path = require("path")

export default {
content: [],
Expand All @@ -28,65 +29,65 @@ export default {
// Embeds Heroicons (https://heroicons.com) into your app.css bundle
// See your `CoreComponents.icon/1` for more information.
//
plugin(function ({ matchComponents, theme }) {
let values = {}
let iconsDir = null
// plugin(function ({ matchComponents, theme }) {
// let values = {}
// let iconsDir = null

// Copy from host app deps.
let hostIconsDir = path.join(__dirname, "../../heroicons/optimized")
// // Copy from host app deps.
// let hostIconsDir = path.join(__dirname, "../../heroicons/optimized")

// Copy from release.
// Adjust for Umbrella apps. See the Heroicons guide for more info.
let releaseIconsDir = path.join(__dirname, "../../../vendor/heroicons/optimized")
// // Copy from release.
// // Adjust for Umbrella apps. See the Heroicons guide for more info.
// let releaseIconsDir = path.join(__dirname, "../../../vendor/heroicons/optimized")

if (fs.existsSync(hostIconsDir)) {
iconsDir = hostIconsDir
} else if (fs.existsSync(releaseIconsDir)) {
iconsDir = releaseIconsDir
} else {
return matchComponents({ hero: ({ _name, _fullPath }) => {} }, { values })
}
// if (fs.existsSync(hostIconsDir)) {
// iconsDir = hostIconsDir
// } else if (fs.existsSync(releaseIconsDir)) {
// iconsDir = releaseIconsDir
// } else {
// return matchComponents({ hero: ({ _name, _fullPath }) => {} }, { 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 },
)
}),
// 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 },
// )
// }),
],
}
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if Mix.env() == :dev do
cdn: esbuild.(~w(--format=iife --target=es2016 --global-name=Beacon --outfile=../priv/static/beacon.js)),
cdn_min: esbuild.(~w(--format=iife --target=es2016 --global-name=Beacon --minify --outfile=../priv/static/beacon.min.js)),
tailwind_bundle: [
args: ~w(tailwind.config.js --bundle --platform=node --format=esm --target=es2020 --outfile=../priv/tailwind.config.bundle.js),
args: ~w(tailwind.config.js --bundle --format=esm --target=es2020 --outfile=../priv/tailwind.config.bundle.js),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]
Expand Down
4 changes: 2 additions & 2 deletions guides/introduction/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Note that Beacon supports Umbrella applications as well.
7. Add `:beacon` and `:beacon_live_admin` dependencies to `mix.exs`

```diff
+ {:beacon, "~> 0.1.0-rc.0", override: true},
+ {:beacon_live_admin, "~> 0.1.0-rc.0"},
+ {:beacon, "~> 0.1.0-rc.1", override: true},
+ {:beacon_live_admin, "~> 0.1.0-rc.1"},
```

8. Add `:beacon` and `:beacon_live_admin` into `:import_deps` in file `.formatter.exs`
Expand Down
27 changes: 27 additions & 0 deletions guides/upgrading/v0.1.0-rc.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Upgrading to v0.1.0-rc.1

## Bump your deps

Update Beacon to the specific release candidate version:

```elixir
[
{:beacon, "~> 0.1.0-rc.1"}
]
```

Remember to keep the option `override: true` if running BeaconLiveAdmin in the same project.

## Update Beacon tables

```sh
mix ecto.gen.migration update_beacon_v002
```

Within the migration module:

```elixir
use Ecto.Migration
def up, do: Beacon.Migration.up()
def down, do: Beacon.Migration.down()
```
3 changes: 2 additions & 1 deletion lib/beacon/boot.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ defmodule Beacon.Boot do
Task.Supervisor.async(task_supervisor, fn -> Beacon.Loader.reload_layouts_modules(config.site) end),
Task.Supervisor.async(task_supervisor, fn -> Beacon.Loader.reload_error_page_module(config.site) end),
Task.Supervisor.async(task_supervisor, fn -> Beacon.Loader.reload_pages_modules(config.site, per_page: 20) end),
Task.Supervisor.async(task_supervisor, fn -> Beacon.Loader.reload_info_handlers_module(config.site) end)
Task.Supervisor.async(task_supervisor, fn -> Beacon.Loader.reload_info_handlers_module(config.site) end),
Task.Supervisor.async(task_supervisor, fn -> Beacon.Loader.reload_event_handlers_module(config.site) end)
# TODO: load main pages (order_by: path, per_page: 10) to avoid SEO issues
]

Expand Down
Loading

0 comments on commit 1f68ecb

Please sign in to comment.