diff --git a/README.md b/README.md index 50e9549..0209e08 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,60 @@ The idea is to support multiple chat app platforms. The following come to mind a ## PROPOSALS +### December-12-2025 Update + +Yes, it has been this long since I have been able to even look at this project again. I have thought about it a lot. Here are my latest thoughts, after moar knowledge gained. + +Let's start with the sigil and go from there. + +Elixir supports custom sigils. So we can define a sigil `~C` for ChEEx templates. (NOTE: I am unsure of the community patterns on custom sigils now that they can be multiple characters since Elixir 1.15, so this may change to something like `~CHAT`) + +```elixir +~C""" +<%= slack do %> + <.header text=":jigsaw: Discuss something" /> + <.divider /> + <.actions> + <.button text=":dart: Assign task" action={Actions.Tasks.new_modal} /> + <.button text=":bar_chart: Survey team" action={Actions.Polls.new_modal} /> + +<% end %> +""" +``` + +This would be handled by a custom macro `sigil_C` that would use `EEx` to compile the string. + +The above can be placed within the block kit of a Slack message payload or a Slack view payload. For example, it can be placed in a view and published to app home. +This can be handled a la Heex's layouts and slots. + +```elixir +~C""" +<.slack.view> + {@inner_content} + +""" +``` + +### Phoenix implementation notes + +`Phoenix.Controller.render/3` takes in a `conn` (`context`), a `template` (e.g. `:show`) (name of "action"), and `assigns` which is data that gets interlaced with the template. + +Similar + +view -> instead of determining "format", determines "platform" +template -> instead of "show.html.eex", it is ":meeting_reminder" +- based on the `platform`, it first looks for `templates/setup/meeting_reminder.slack.cheex` +- else, it looks for `templates/setup/meeting_reminder.cheex` +- route = `meetings#create_reminder`, params: `time: 5pm` +- controller = `MeetingsController#create_reminder` + - `send_message(context, :meeting_reminder, users: [], ...)` +- view gets created + - `views/meetings/create_reminder/slack_view` + - `views/meetings/create_reminder_view` + - `views/meetings_view` +- view renders each template based on platform and action, and then controller +- creates a view (if one is not created), (`View::MeetingReminder`) that takes care of the whole template (instead of phoenix has one view per controller with functions being the actions), I think this needs a set of template-only functions and controller-grouped functions.... + ### Support for seperate platforms I am unsure if it is possible to define one language dsl for all but I do know that exceptions will have to be made. I am think at the very best, you could have a "ChEEx DSL" and then have exceptions for each platform, similar to something like React Native. I think it would be wise to see how it looks for various platforms and then see if there are enough commonalities to create a common engine.