From e2b8f4112bb61ff42cb1d2846c021185657a45ea Mon Sep 17 00:00:00 2001 From: Joel Drapper Date: Tue, 3 Sep 2024 17:27:43 +0100 Subject: [PATCH] Updates --- .vitepress/config.mts | 11 +++++++++-- design/caching.md | 2 +- guide/attributes.md | 19 +++++++++++++++++++ community.md => project/community.md | 0 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 guide/attributes.md rename community.md => project/community.md (100%) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index a6b7a9b..65bc418 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -6,10 +6,15 @@ export default defineConfig({ themeConfig: { nav: [ { text: "Home", link: "/" }, - { text: "Community", link: "/community" }, + { text: "Community", link: "project/community" }, { text: "Guide", link: "/guide" }, ], sidebar: [ + { + text: "Project", + collapsed: false, + items: [{ text: "Community", link: "/project/community" }], + }, { text: "Guide", collapsed: false, @@ -18,6 +23,7 @@ export default defineConfig({ { text: "Setup", link: "/guide/setup" }, { text: "Your first component", link: "/guide/first-component" }, { text: "Under the hood", link: "/guide/under-the-hood" }, + { text: "Attributes deep-dive", link: "/guide/attributes" }, ], }, { @@ -32,8 +38,9 @@ export default defineConfig({ text: "Rails", collapsed: false, items: [ - { text: "Streaming", link: "/reference/rails/streaming" }, { text: "Helpers", link: "/reference/rails/helpers" }, + { text: "Generators", link: "/reference/rails/generators" }, + { text: "Streaming", link: "/reference/rails/streaming" }, ], }, ], diff --git a/design/caching.md b/design/caching.md index 23d952c..056700f 100644 --- a/design/caching.md +++ b/design/caching.md @@ -4,7 +4,7 @@ The most expensive (performance-wise) process in Phlex is building attributes, w Phlex supports all kinds of attributes including deeply-nested hashes, arrays, sets, strings, symbols, boolean values and even custom objects. It even has special handling for `class` and `style` attributes. -Attributes need to be calculated thousands of times per render. One advantage we have is attributes are always calculated the same way. The same Hash will always produce the same String of HTML. +Attributes need to be calculated thousands of times per render. One advantage we have is attributes are always calculated the same way. The same hash will always produce the same string of HTML. This problem lends itself well to caching. If we store the result of the first calculation, we can then resuse it the next time we get the same set of attributes. diff --git a/guide/attributes.md b/guide/attributes.md new file mode 100644 index 0000000..58c7281 --- /dev/null +++ b/guide/attributes.md @@ -0,0 +1,19 @@ +# Attributes deep dive + +You’ve just rebuilt 90% of Phlex so you know a thing or two about rendering attributes. + +## `String` and `Symbol` keys + +## `String` and `Symbol` values + +## `Array` and `Set` attributes + +## Nested `Hash` attributes + +## The `style` attribute + +## The `class` attribute + +## Custom objects as attribute values + +## Boolean attributes diff --git a/community.md b/project/community.md similarity index 100% rename from community.md rename to project/community.md