Skip to content

Releases: ServerfulArch/Views

0.0.3

11 Mar 19:44
Compare
Choose a tag to compare
0.0.3 Pre-release
Pre-release

A prerelease of the Serverful/Views extension.

This version includes a fix and a major change.

Fixes

  • Fixed synchronisation issues with rendering.

Views

  • In the header insertion format, a / is now needed to comply with general HTML styling.
    • An example would be <serverful navbar/> where navbar is the header identifier.

0.0.2

02 Mar 16:01
Compare
Choose a tag to compare
0.0.2 Pre-release
Pre-release

A prerelease of the Serverful/Views extension.

This version adds type checking to the inputs, as well as the ability to make presets, known as "headers".

Views

  • Serverful.Extension(Views(Content: Pathlike, Headers?: Pathlike)) -> Void
    • Register the Serverful/Views extension.
    • The Content argument is still the same, required content directory.
    • A Headers directory is added that includes files with predefined formatting, like navigation, footers, etc.

The filename is the name of the header.

// Configured headers:
// Headers/Navigation.html
<ul class="nav">
    <li><a href="#">Home</a></li>
    <li><a href="#">Github</a></li>
    <li><a href="#">Contact</a></li>
</ul>

// Headers/Footer.html
<div class="footer">
    <p>&copy; Smally</p>
    <p><a href="#">Terms</a></p>
</div>

These presets can be used inside of the configured views. They're applied when the cache is loaded.

<body>
    <serverful navigation>
    <main> ... </main>
    <serverful footer>
</body>

0.0.1

01 Mar 13:53
Compare
Choose a tag to compare
0.0.1 Pre-release
Pre-release

A prerelease of the Serverful/Views extension.

The Views plugin extends the RequestManager class of each Packet when registered. Configuring this extension must be done before creating your server instance, and these changes will be global. If any changes are done to the resource directory, the cache will immediately reload.

Views

  • Serverful.Extension(Views(Pathlike: Pathlike)) -> Void
    • Register the Serverful/Views extension.
    • The Pathlike argument will be the resource directory.

RequestManager

  • RequestManager.Fetch(Identifier: String) -> Object<Resource, Static, Type>

    • Retrieves an object with the resource, whether it's static HTML and the type.
    • A type can be application/json, text/html, text/css, etc.
  • RequestManager.View(Identifier: String, Code?: Integer) -> RequestManager

    • Immediately writes a view to the client and ends the request.
  • RequestManager.Render(Identifier: String, Document?: Object | Array, Code?: Integer) -> RequestManager

    • Renders a view and ends the request.
    • A document is the context object with items to include for the render.

I have a few other things planned In the Serverful/Views roadmap, such as header insertion and handlers.