htmx-router 0.0.1 → 0.0.2

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/helper.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export declare function StyleCSS(props: {
2
- [key: string]: string | number;
3
- }): string;
1
+ import type * as CSS from 'csstype';
2
+ export declare function StyleCSS(props: CSS.Properties<string | number>): string;
package/bin/helper.js CHANGED
@@ -4,8 +4,11 @@ exports.StyleCSS = void 0;
4
4
  function StyleCSS(props) {
5
5
  let out = "";
6
6
  for (const key in props) {
7
+ const value = props[key];
8
+ if (typeof (value) !== "string" && typeof (value) !== "number")
9
+ continue;
7
10
  const safeKey = key.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
8
- const safeVal = props[key].toString().replace(/"/g, "\\\"");
11
+ const safeVal = value.toString().replace(/"/g, "\\\"");
9
12
  out += `${safeKey}: ${safeVal};`;
10
13
  }
11
14
  return out;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "htmx-router",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A remix.js style file path router for htmX websites",
5
5
  "main": "./bin/index.js",
6
6
  "scripts": {
@@ -23,5 +23,9 @@
23
23
  "@types/node": "^20.4.5",
24
24
  "ts-node": "^10.9.1",
25
25
  "typescript": "^5.1.6"
26
+ },
27
+ "dependencies": {
28
+ "csstype": "^3.1.2",
29
+ "import": "^0.0.6"
26
30
  }
27
31
  }