hypel 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/hypel.js +14 -9
  2. package/package.json +7 -7
package/hypel.js CHANGED
@@ -85,12 +85,20 @@ const hypelsvg = h => {
85
85
  // div.properties.id; // hello
86
86
  const encodeid = idstr => idstr.replace(nsSepPlainRe, ':')
87
87
  const decodeid = idstr => idstr.replace(nsSepEncodeRe, '/')
88
- const getoptsclassidstr = (opts, classidstr) => (
89
- encodeid(classidstr.replace(nsKeyRe, m => (
88
+ const charCodeHyphen = 45 // the char "-"
89
+ const tryprefixroot = (opts, classstr, prop) => (
90
+ prop = opts[prop + 'root'],
91
+ prop && prop !== classstr ? classstr + '.' + prop : classstr)
92
+ const getoptsclassidstr = (opts, classidstr, s) => (
93
+ s = encodeid(classidstr.replace(nsKeyRe, (m, offset, r) => (
90
94
  m = m.slice(1),
91
- m = m in opts ? String(opts[m]) : m,
92
- m
93
- ))))
95
+ r = m in opts ? String(opts[m]) : m,
96
+ r = classidstr.charCodeAt(offset + m.length + 1) === charCodeHyphen
97
+ ? r : tryprefixroot(opts, r, m),
98
+ r
99
+ ))),
100
+ s
101
+ )
94
102
 
95
103
  const buildoptfns = helperfns => helperfns.TAG_NAMES.reduce((hhh, cur) => (
96
104
  hhh[cur] = (...args) => {
@@ -109,10 +117,7 @@ const buildhelper = helpers => h => {
109
117
  const hhopts = opts => helperobj.TAG_NAMES.reduce((hhopts, cur) => (
110
118
  hhopts[cur] = (...args) => namespace[cur](opts, ...args),
111
119
  hhopts
112
- ), {})
113
-
114
- hhopts.encodeid = encodeid
115
- hhopts.decodeid = decodeid
120
+ ), { encodeid, decodeid })
116
121
 
117
122
  return helperobj.TAG_NAMES.reduce((hhoptsfn, tagname) => (
118
123
  hhoptsfn[tagname] = namespace[tagname],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hypel",
3
3
  "type": "module",
4
- "version": "0.2.1",
4
+ "version": "0.2.3",
5
5
  "license": "MIT",
6
6
  "readmeFilename": "README.md",
7
7
  "description": "Terse syntax for hyperscript",
@@ -26,14 +26,14 @@
26
26
  "dynamic class"
27
27
  ],
28
28
  "devDependencies": {
29
- "inferno-hyperscript": "8.2.2",
30
- "inferno-server": "8.2.2",
29
+ "inferno-hyperscript": "9.0.3",
30
+ "inferno-server": "9.0.3",
31
31
  "html-tag-names": "^2.1.0",
32
32
  "hyperscript": "^2.0.2",
33
- "snabbdom": "3.5.1",
34
- "eslint": "^8.51.0",
35
- "jsdom": "^22.1.0",
36
- "react": "^18.2.0"
33
+ "snabbdom": "3.6.2",
34
+ "eslint": "^9.32.0",
35
+ "jsdom": "^26.1.0",
36
+ "react": "^19.1.1"
37
37
  },
38
38
  "scripts" : {
39
39
  "lint": "eslint .",