htmx-router 0.1.1 → 0.1.3

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.
@@ -1,5 +1,6 @@
1
1
  export declare function Link(props: {
2
2
  to: string;
3
+ class?: string;
3
4
  target?: string;
4
5
  style?: string;
5
6
  }, contents: string[]): string;
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": '{"Cache-Control": "no-cache"}' }, contents);
29
+ return elements.createElement("a", { target: props.target || "", class: props.class || "", style: props.style || "", href: props.to, "hx-get": props.to, "hx-headers": '{"Cache-Control": "no-cache"}' }, contents);
30
30
  }
31
31
  exports.Link = Link;
@@ -27,7 +27,7 @@ exports.RenderArgs = exports.MaskType = void 0;
27
27
  const elements = __importStar(require("typed-html"));
28
28
  const titleScript = `<script>` +
29
29
  `document.addEventListener("DOMContentLoaded",function(){` +
30
- `document.body.addEventListener("setTitle",function(evt){document.title = evt.detail.value;})` +
30
+ `document.body.addEventListener("setTitle",function(evt){document.title=decodeURIComponent(evt.detail.value);})` +
31
31
  `});` +
32
32
  `</script>`;
33
33
  const attrRegex = /^[A-z][A-z\-0-9]+$/;
@@ -124,7 +124,7 @@ class RenderArgs {
124
124
  this._outletChain.push(route);
125
125
  }
126
126
  _applyMask(mask, depth) {
127
- const padded = new Array(this._outletChain.length - mask.length).fill(false);
127
+ const padded = new Array(Math.max(0, this._outletChain.length - mask.length)).fill(false);
128
128
  for (let i = mask.length - 1; i >= 0; i--) {
129
129
  padded.push(mask[i]);
130
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "htmx-router",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A remix.js style file path router for htmX websites",
5
5
  "main": "./bin/index.js",
6
6
  "scripts": {