@jackens/nnn 2026.4.12 → 2026.4.13
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/nnn.js +46 -50
- package/package.json +1 -1
- package/readme.md +1 -1
package/nnn.js
CHANGED
|
@@ -67,65 +67,61 @@ var isRecord = (arg) => typeof arg === "object" && arg != null && !isArray(arg);
|
|
|
67
67
|
|
|
68
68
|
// src/nnn/h.ts
|
|
69
69
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
70
|
-
var
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
if (nsKey === "xlink") {
|
|
96
|
-
const basename = name.slice(indexOfColon + 1);
|
|
97
|
-
if (value === true) {
|
|
98
|
-
node.setAttributeNS(XLINK_NS, basename, "");
|
|
99
|
-
} else if (value === false) {
|
|
100
|
-
node.removeAttributeNS(XLINK_NS, basename);
|
|
101
|
-
} else {
|
|
102
|
-
node.setAttributeNS(XLINK_NS, basename, "" + value);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
70
|
+
var _h = (createElement, tagOrNode, ...args) => {
|
|
71
|
+
const node = isString(tagOrNode) ? createElement(tagOrNode) : tagOrNode;
|
|
72
|
+
args.forEach((arg) => {
|
|
73
|
+
let child = null;
|
|
74
|
+
if (arg instanceof Node) {
|
|
75
|
+
child = arg;
|
|
76
|
+
} else if (isArray(arg)) {
|
|
77
|
+
child = _h(createElement, ...arg);
|
|
78
|
+
} else if (isRecord(arg)) {
|
|
79
|
+
for (const name in arg) {
|
|
80
|
+
const value = arg[name];
|
|
81
|
+
if (name[0] === "$") {
|
|
82
|
+
const name1 = name.slice(1);
|
|
83
|
+
if (isRecord(value)) {
|
|
84
|
+
node[name1] ??= {};
|
|
85
|
+
Object.assign(node[name1], value);
|
|
86
|
+
} else {
|
|
87
|
+
node[name1] = value;
|
|
88
|
+
}
|
|
89
|
+
} else if (node instanceof Element) {
|
|
90
|
+
const indexOfColon = name.indexOf(":");
|
|
91
|
+
if (indexOfColon >= 0) {
|
|
92
|
+
const nsKey = name.slice(0, indexOfColon);
|
|
93
|
+
if (nsKey === "xlink") {
|
|
94
|
+
const basename = name.slice(indexOfColon + 1);
|
|
106
95
|
if (value === true) {
|
|
107
|
-
node.
|
|
96
|
+
node.setAttributeNS(XLINK_NS, basename, "");
|
|
108
97
|
} else if (value === false) {
|
|
109
|
-
node.
|
|
98
|
+
node.removeAttributeNS(XLINK_NS, basename);
|
|
110
99
|
} else {
|
|
111
|
-
node.
|
|
100
|
+
node.setAttributeNS(XLINK_NS, basename, "" + value);
|
|
112
101
|
}
|
|
113
102
|
}
|
|
103
|
+
} else {
|
|
104
|
+
if (value === true) {
|
|
105
|
+
node.setAttribute(name, "");
|
|
106
|
+
} else if (value === false) {
|
|
107
|
+
node.removeAttribute(name);
|
|
108
|
+
} else {
|
|
109
|
+
node.setAttribute(name, "" + value);
|
|
110
|
+
}
|
|
114
111
|
}
|
|
115
112
|
}
|
|
116
|
-
} else if (isString(arg) || isNumber(arg)) {
|
|
117
|
-
child = document.createTextNode(arg);
|
|
118
|
-
}
|
|
119
|
-
if (child != null) {
|
|
120
|
-
node.appendChild(child);
|
|
121
113
|
}
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
114
|
+
} else if (isString(arg) || isNumber(arg)) {
|
|
115
|
+
child = document.createTextNode(arg);
|
|
116
|
+
}
|
|
117
|
+
if (child != null) {
|
|
118
|
+
node.appendChild(child);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return node;
|
|
126
122
|
};
|
|
127
|
-
var h =
|
|
128
|
-
var s =
|
|
123
|
+
var h = _h.bind(null, document.createElement);
|
|
124
|
+
var s = _h.bind(null, document.createElementNS.bind(document, "http://www.w3.org/2000/svg"));
|
|
129
125
|
var svgUse = (id, ...args) => s("svg", ["use", { "xlink:href": "#" + id }], ...args);
|
|
130
126
|
|
|
131
127
|
// src/nnn/fixPlTypography.ts
|
package/package.json
CHANGED