htmx-router 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/components.js CHANGED
@@ -26,6 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Link = void 0;
27
27
  const elements = __importStar(require("typed-html"));
28
28
  function Link(props, contents) {
29
- return elements.createElement("a", { target: props.target || "", style: props.style || "", href: props.to, "hx-get": props.to, "hx-headers": '{"hx-headless": "true"}' }, contents);
29
+ return elements.createElement("a", { target: props.target || "", style: props.style || "", href: props.to, "hx-get": props.to }, contents);
30
30
  }
31
31
  exports.Link = Link;
package/bin/router.js CHANGED
@@ -161,13 +161,13 @@ class RouteTree {
161
161
  return new shared_1.Redirect(url.pathname.slice(0, -1) + url.search);
162
162
  }
163
163
  const args = new render_args_1.RenderArgs(req, res, url);
164
- const from = req.headers['hx-headless'] ?
164
+ res.setHeader('Vary', "hx-current-url");
165
+ const from = req.headers['hx-current-url'] ?
165
166
  new URL(((_a = req.headers['hx-current-url']) === null || _a === void 0 ? void 0 : _a.toString()) || "/").pathname :
166
167
  "";
167
168
  try {
168
169
  const depth = BuildOutlet(this, args, from);
169
170
  if (from) {
170
- res.setHeader('Vary', "HX-Push-Url");
171
171
  res.setHeader('HX-Push-Url', req.url || "/");
172
172
  if (depth > 0) {
173
173
  res.setHeader('HX-Retarget', `#hx-route-${depth.toString(16)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "htmx-router",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "A remix.js style file path router for htmX websites",
5
5
  "main": "./bin/index.js",
6
6
  "scripts": {