Skip to content

Releases: HapticX/happyx

CLI and templates

05 May 14:55
Compare
Choose a tag to compare

Since version 0.8.0 HappyX Provides own CLI tool that allows to create and serving projects written in HappyX

Changelog

  • CLI 🔧
    Two commands available now:
    • hpx create: create HappyX project and (SPA/SSG).
    • hpx dev: serving HappyX SPA project.
  • templates 👔
    Since version 0.6.0 HappyX support templates via nimja template engine.

v0.5.2

19 Apr 15:44
Compare
Choose a tag to compare

Default values in components is available now🎉

component MyComponent:
  counter: int = 100

...
"/":
  component MyComponent
  component MyComponent(counter = 10)

v0.5.1

18 Apr 14:43
Compare
Choose a tag to compare

SPA, States And More Other 🎉

In this release we added powerful state management and components!

Components

Project structure:

project/
-- components/
-- -- hello_world.nim
-- main.nim

project/components/hello_world.nim

import happyx

component MyComponent:
  counter: int
  
  `template`:
    {self.counter}
    button:
      "Increase"
      @click:
        self.counter += 1
  
  `script`:
    echo self.counter
  
  `style`:
    """
    button {
      background: #212121;
      color: #dfdfdf;
      padding: 12px {self.counter + 1}px;
    }
    """

project/main.nim

import happyx

var app = registerApp()
app.routes:
  "/":
    component MyComponent(counter = 5)
app.start()

v0.5.0

15 Apr 07:31
Compare
Choose a tag to compare

Changelog

  • Support routing in SPA like SSG (#12).
  • Support event handling in buildHtml macro (#14).
  • Tags in buildHtml can be starts with t, h or tag (#18).

v0.4.8

13 Apr 13:25
Compare
Choose a tag to compare

Changelog

  • Support staticDir in SSG routing (#8).
    server.routes:
      staticDir "myDirectory"
  • Support regex patterns SSG routing (#9).
    server.routes:
      "/regex/pattern{patternId:/[a-zA-Z0-9_]/}"
        echo patternId
  • Support SPA with JS backend.
    var app = newApp()
    app.routes:
      "#/":
        echo path
        buildHtml(`div`):
          "Hello, world!"
      "#/hello!":
        buildHtml(`div`):
          "No, bye!"
    app.start()
  • New syntax sugar (#10).
  • Some fixes and improves (#11)

v0.4.6

02 Apr 06:25
Compare
Choose a tag to compare

Changelog

  • Support middleware (#3) and request methods (#3) in server 🌟
    server.routes:
      get "/":
        req.answer "Root via GET"
      post "/":
        req.answer "Root via POST"
      middleware:
        echo req
  • Support JSON and HTML answers (#2) 📤
    var
      server = newServer()
      userId = 0
    server.routes:
      get "/html":
        req.answerHtml:
          buildHtml(`div`):
            script(src="https://cdn.tailwindcss.com")  # Tailwind CSS :D
            `div`(class="bg-gray-700 text-pink-400 px-8 py-24"):
              "Hello, world!"
    
      post "/user":
        inc userId
        req.answerJson {"response": {"id": %userId}}
  • Some improves and fixes 🐛

v0.4.5

01 Apr 15:09
Compare
Choose a tag to compare

Changelog

  • Support variables in strings in if and for statements
  • Support attributes and children if and for statements
  • Support variables in curly brackets:
    var state = remember true
    var html = buildHtml(`div`):
      {state}
  • if and for statements does not generates root tags.

v0.4.4

30 Mar 15:49
Compare
Choose a tag to compare

Changelog

  • Support for statement in buildHtml macro.
  • Refactor renderer.nim, tag.nim

v0.4.2

30 Mar 02:44
Compare
Choose a tag to compare

Improve tag.nim and renderer.nim

v0.4.0

29 Mar 15:18
Compare
Choose a tag to compare

SPA? 👀