web-signature 0.2.3 → 0.2.4
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/dist/Signature.js +11 -2
- package/dist/d/html.d.ts +4 -0
- package/dist/d/index.d.ts +1 -1
- package/dist/html.js +3 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/Signature.ts +17 -12
- package/src/html.ts +4 -0
- package/src/index.ts +1 -1
package/dist/Signature.js
CHANGED
|
@@ -220,7 +220,15 @@ export default class Signature {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
for (const node of marks) {
|
|
223
|
-
|
|
223
|
+
const value = template.values[Number((node.nodeValue ?? "").match(/si-mark-(\d+)/m)[1])];
|
|
224
|
+
if (typeof value === "object" && value.type === "unsafeHTML") {
|
|
225
|
+
let obj = document.createElement("div");
|
|
226
|
+
obj.innerHTML = value.value;
|
|
227
|
+
node.replaceWith(obj.firstChild);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
node.replaceWith(document.createTextNode(String(value)));
|
|
231
|
+
}
|
|
224
232
|
}
|
|
225
233
|
})();
|
|
226
234
|
// Processing si-mark attributes
|
|
@@ -232,7 +240,8 @@ export default class Signature {
|
|
|
232
240
|
if (/<!--si-mark-\d+-->/gm.test(attr.value)) {
|
|
233
241
|
const match = attr.value.match(/si-mark-(\d+)/m);
|
|
234
242
|
if (match) {
|
|
235
|
-
|
|
243
|
+
const value = template.values[Number(match[1])];
|
|
244
|
+
node.setAttribute(attr.name, String(value));
|
|
236
245
|
}
|
|
237
246
|
}
|
|
238
247
|
}
|
package/dist/d/html.d.ts
CHANGED
package/dist/d/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export { default as Signature } from './Signature.js';
|
|
|
4
4
|
export { default as Component } from './Component.js';
|
|
5
5
|
export { default as Prop } from './Prop.js';
|
|
6
6
|
export { default as Library } from './Library.js';
|
|
7
|
-
export { default as html } from './html.js';
|
|
7
|
+
export { default as html, unsafeHTML } from './html.js';
|
package/dist/html.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,4 +6,4 @@ export { default as Signature } from './Signature.js';
|
|
|
6
6
|
export { default as Component } from './Component.js';
|
|
7
7
|
export { default as Prop } from './Prop.js';
|
|
8
8
|
export { default as Library } from './Library.js';
|
|
9
|
-
export { default as html } from './html.js';
|
|
9
|
+
export { default as html, unsafeHTML } from './html.js';
|
package/package.json
CHANGED
package/src/Signature.ts
CHANGED
|
@@ -279,17 +279,20 @@ export default class Signature {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
for (const node of marks) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
282
|
+
const value = template.values[Number(
|
|
283
|
+
(
|
|
284
|
+
(node.nodeValue ?? "").match(/si-mark-(\d+)/m) as string[]
|
|
285
|
+
)[1]
|
|
286
|
+
)];
|
|
287
|
+
|
|
288
|
+
if (typeof value === "object" && value.type === "unsafeHTML") {
|
|
289
|
+
let obj = document.createElement("div");
|
|
290
|
+
obj.innerHTML = value.value;
|
|
291
|
+
|
|
292
|
+
node.replaceWith(obj.firstChild as ChildNode);
|
|
293
|
+
} else {
|
|
294
|
+
node.replaceWith(document.createTextNode(String(value)));
|
|
295
|
+
}
|
|
293
296
|
}
|
|
294
297
|
})();
|
|
295
298
|
|
|
@@ -305,7 +308,9 @@ export default class Signature {
|
|
|
305
308
|
const match: RegExpMatchArray = attr.value.match(/si-mark-(\d+)/m) as RegExpMatchArray;
|
|
306
309
|
|
|
307
310
|
if (match) {
|
|
308
|
-
|
|
311
|
+
const value = template.values[Number(match[1])];
|
|
312
|
+
|
|
313
|
+
node.setAttribute(attr.name, String(value));
|
|
309
314
|
}
|
|
310
315
|
}
|
|
311
316
|
}
|
package/src/html.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,4 +8,4 @@ export {default as Signature} from './Signature.js';
|
|
|
8
8
|
export {default as Component} from './Component.js';
|
|
9
9
|
export {default as Prop} from './Prop.js';
|
|
10
10
|
export {default as Library} from './Library.js';
|
|
11
|
-
export {default as html} from './html.js';
|
|
11
|
+
export {default as html, unsafeHTML} from './html.js';
|