packages feed

datastar-hs 1.1.1.0 → 1.1.2.0

raw patch · 6 files changed

+26/−17 lines, 6 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Hypermedia.Datastar.ExecuteScript: instance GHC.Internal.Show.Show Hypermedia.Datastar.ExecuteScript.ExecuteScript
- Hypermedia.Datastar.PatchElements: instance GHC.Internal.Show.Show Hypermedia.Datastar.PatchElements.PatchElements
- Hypermedia.Datastar.PatchSignals: instance GHC.Internal.Show.Show Hypermedia.Datastar.PatchSignals.PatchSignals
- Hypermedia.Datastar.Types: instance GHC.Internal.Show.Show Hypermedia.Datastar.Types.ElementNamespace
- Hypermedia.Datastar.Types: instance GHC.Internal.Show.Show Hypermedia.Datastar.Types.ElementPatchMode
- Hypermedia.Datastar.Types: instance GHC.Internal.Show.Show Hypermedia.Datastar.Types.EventType
- Hypermedia.Datastar.WAI: instance GHC.Internal.Show.Show Hypermedia.Datastar.WAI.CompressionStrategy
+ Hypermedia.Datastar.ExecuteScript: instance GHC.Show.Show Hypermedia.Datastar.ExecuteScript.ExecuteScript
+ Hypermedia.Datastar.PatchElements: instance GHC.Show.Show Hypermedia.Datastar.PatchElements.PatchElements
+ Hypermedia.Datastar.PatchSignals: instance GHC.Show.Show Hypermedia.Datastar.PatchSignals.PatchSignals
+ Hypermedia.Datastar.Types: instance GHC.Show.Show Hypermedia.Datastar.Types.ElementNamespace
+ Hypermedia.Datastar.Types: instance GHC.Show.Show Hypermedia.Datastar.Types.ElementPatchMode
+ Hypermedia.Datastar.Types: instance GHC.Show.Show Hypermedia.Datastar.Types.EventType
+ Hypermedia.Datastar.WAI: instance GHC.Show.Show Hypermedia.Datastar.WAI.CompressionStrategy

Files

CHANGELOG.md view
@@ -1,5 +1,13 @@ # Changelog +## 1.1.2.0++* Bump the examples and the e2e test page to Datastar 1.0.5+* Docs: say "HTML elements" instead of "HTML fragments", following the+  Datastar ADR, which requires complete HTML elements. The+  `Hypermedia.Datastar.PatchElements` docs now also state that, without a+  selector, each top-level element needs an `id`.+ ## 1.1.1.0  * Add `peViewTransitionSelector` to `PatchElements`: a CSS selector for the
README.md view
@@ -109,23 +109,23 @@  ``` === Identical large grid every tick ===-  400 events, ~130.7 KB uncompressed per fragment+  400 events, ~130.7 KB of HTML per event, uncompressed    none   :      51.1 MB   gzip   :       4.0 MB  (   12.8x vs none)-  brotli :       9.0 KB  ( 5779.1x vs none)+  brotli :       9.1 KB  ( 5764.8x vs none)   zstd   :      13.6 KB  ( 3854.3x vs none)  === Fat update: large grid, only the caption changes each tick ===-  400 events, ~130.7 KB uncompressed per fragment+  400 events, ~130.7 KB of HTML per event, uncompressed    none   :      51.1 MB   gzip   :       4.0 MB  (   12.7x vs none)-  brotli :       9.9 KB  ( 5265.5x vs none)+  brotli :      10.0 KB  ( 5248.5x vs none)   zstd   :      19.4 KB  ( 2697.3x vs none)  === Small update: tiny clock div each tick ===-  400 events, ~23 B uncompressed per fragment+  400 events, ~23 B of HTML per event, uncompressed    none   :      28.4 KB   gzip   :       4.4 KB  (    6.5x vs none)
datastar-hs.cabal view
@@ -1,10 +1,10 @@ cabal-version:   3.0 name:            datastar-hs-version:         1.1.1.0+version:         1.1.2.0 synopsis:        Haskell bindings for Datastar description:   Server-side SDK for building real-time hypermedia applications with-  <https://data-star.dev/ Datastar>. Stream HTML fragments, reactive+  <https://data-star.dev/ Datastar>. Stream HTML elements, reactive   signal updates, and scripts to the browser over server-sent events   (SSE). Built on WAI so it works with Warp, Scotty, Servant, Yesod,   and any other WAI-compatible framework.
e2e-server/Main.hs view
@@ -48,7 +48,7 @@ testPage = renderBS $ doctypehtml_ $ do   head_ $ do     title_ "datastar-hs e2e tests"-    script_ [type_ "module", src_ "https://cdn.jsdelivr.net/gh/starfederation/datastar@1.0.3/bundles/datastar.js"] ("" :: T.Text)+    script_ [type_ "module", src_ "https://cdn.jsdelivr.net/gh/starfederation/datastar@1.0.5/bundles/datastar.js"] ("" :: T.Text)   body_ [makeAttributes "data-signals" "{}"] $ do     h1_ "datastar-hs E2E Test Page" 
src/Hypermedia/Datastar.hs view
@@ -6,7 +6,7 @@ building a JSON API and a JavaScript SPA, you write HTML on the server and let Datastar handle the interactivity. The browser sends requests, the server holds the connection open as a server-sent event (SSE) stream, and-pushes HTML fragments, signal updates, or scripts back to the browser as+pushes HTML elements, signal updates, or scripts back to the browser as things change.  This SDK provides the server-side Haskell API. It builds on
src/Hypermedia/Datastar/PatchElements.hs view
@@ -1,14 +1,15 @@ {- | Module      : Hypermedia.Datastar.PatchElements-Description : Send HTML fragments to patch the browser DOM+Description : Send HTML elements to patch the browser DOM  \"Patch elements\" is Datastar's primary mechanism for updating the page: the-server sends an HTML fragment and the browser morphs it into the DOM. The-morphing algorithm preserves focus, scroll position, and CSS transitions,+server sends complete HTML elements and the browser morphs them into the DOM.+The morphing algorithm preserves focus, scroll position, and CSS transitions, so partial page updates feel seamless.  The simplest case — send HTML and let Datastar match elements by @id@ —-needs only 'patchElements':+needs only 'patchElements'. Without a selector, each top-level element needs+an @id@.  @ sendPatchElements gen (patchElements "\<div id=\\\"count\\\"\>42\<\/div\>")@@ -55,13 +56,13 @@ -} data PatchElements = PatchElements   { peElements :: Maybe Text-  {- ^ The HTML fragment to patch into the DOM. 'Nothing' when removing-  elements (see 'removeElements').+  {- ^ One or more complete HTML elements to patch into the DOM. 'Nothing'+  when removing elements (see 'removeElements').   -}   , peSelector :: Maybe Text   {- ^ CSS selector for the target element. When 'Nothing' (the default),-  Datastar matches by the @id@ attribute of the root element in-  'peElements'.+  Datastar matches each top-level element in 'peElements' by its @id@+  attribute.   -}   , peMode :: ElementPatchMode   {- ^ How to apply the patch. Default: 'Outer' (replace the matched