@windrun-huaiin/third-ui 31.3.3 → 31.3.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.
@@ -262,6 +262,13 @@ function applyHandDrawnStyle(svg) {
262
262
  target.setAttribute(attr, (_a = source.getAttribute(attr)) !== null && _a !== void 0 ? _a : '');
263
263
  }
264
264
  };
265
+ const shouldSkipHandDrawn = (element) => {
266
+ if (element.closest('defs'))
267
+ return true;
268
+ if (element.hasAttribute('marker-start') || element.hasAttribute('marker-end') || element.hasAttribute('marker-mid'))
269
+ return true;
270
+ return false;
271
+ };
265
272
  const createOptions = (element) => {
266
273
  var _a, _b;
267
274
  const stroke = (_a = getStyleValue(element, 'stroke')) !== null && _a !== void 0 ? _a : '#000';
@@ -294,6 +301,8 @@ function applyHandDrawnStyle(svg) {
294
301
  element.parentNode.replaceChild(node, element);
295
302
  };
296
303
  svgElement.querySelectorAll('rect').forEach((element) => {
304
+ if (shouldSkipHandDrawn(element))
305
+ return;
297
306
  const x = getNumber(element.getAttribute('x'));
298
307
  const y = getNumber(element.getAttribute('y'));
299
308
  const width = getNumber(element.getAttribute('width'));
@@ -315,11 +324,15 @@ function applyHandDrawnStyle(svg) {
315
324
  replaceShape(element, node);
316
325
  });
317
326
  svgElement.querySelectorAll('line').forEach((element) => {
327
+ if (shouldSkipHandDrawn(element))
328
+ return;
318
329
  const node = rc.line(getNumber(element.getAttribute('x1')), getNumber(element.getAttribute('y1')), getNumber(element.getAttribute('x2')), getNumber(element.getAttribute('y2')), createOptions(element));
319
330
  replaceShape(element, node);
320
331
  });
321
332
  svgElement.querySelectorAll('polyline').forEach((element) => {
322
333
  var _a;
334
+ if (shouldSkipHandDrawn(element))
335
+ return;
323
336
  const points = ((_a = element.getAttribute('points')) !== null && _a !== void 0 ? _a : '')
324
337
  .trim()
325
338
  .split(/\s+/)
@@ -332,6 +345,8 @@ function applyHandDrawnStyle(svg) {
332
345
  });
333
346
  svgElement.querySelectorAll('polygon').forEach((element) => {
334
347
  var _a;
348
+ if (shouldSkipHandDrawn(element))
349
+ return;
335
350
  const points = ((_a = element.getAttribute('points')) !== null && _a !== void 0 ? _a : '')
336
351
  .trim()
337
352
  .split(/\s+/)
@@ -343,6 +358,8 @@ function applyHandDrawnStyle(svg) {
343
358
  replaceShape(element, node);
344
359
  });
345
360
  svgElement.querySelectorAll('path').forEach((element) => {
361
+ if (shouldSkipHandDrawn(element))
362
+ return;
346
363
  const d = element.getAttribute('d');
347
364
  if (!d)
348
365
  return;
@@ -260,6 +260,13 @@ function applyHandDrawnStyle(svg) {
260
260
  target.setAttribute(attr, (_a = source.getAttribute(attr)) !== null && _a !== void 0 ? _a : '');
261
261
  }
262
262
  };
263
+ const shouldSkipHandDrawn = (element) => {
264
+ if (element.closest('defs'))
265
+ return true;
266
+ if (element.hasAttribute('marker-start') || element.hasAttribute('marker-end') || element.hasAttribute('marker-mid'))
267
+ return true;
268
+ return false;
269
+ };
263
270
  const createOptions = (element) => {
264
271
  var _a, _b;
265
272
  const stroke = (_a = getStyleValue(element, 'stroke')) !== null && _a !== void 0 ? _a : '#000';
@@ -292,6 +299,8 @@ function applyHandDrawnStyle(svg) {
292
299
  element.parentNode.replaceChild(node, element);
293
300
  };
294
301
  svgElement.querySelectorAll('rect').forEach((element) => {
302
+ if (shouldSkipHandDrawn(element))
303
+ return;
295
304
  const x = getNumber(element.getAttribute('x'));
296
305
  const y = getNumber(element.getAttribute('y'));
297
306
  const width = getNumber(element.getAttribute('width'));
@@ -313,11 +322,15 @@ function applyHandDrawnStyle(svg) {
313
322
  replaceShape(element, node);
314
323
  });
315
324
  svgElement.querySelectorAll('line').forEach((element) => {
325
+ if (shouldSkipHandDrawn(element))
326
+ return;
316
327
  const node = rc.line(getNumber(element.getAttribute('x1')), getNumber(element.getAttribute('y1')), getNumber(element.getAttribute('x2')), getNumber(element.getAttribute('y2')), createOptions(element));
317
328
  replaceShape(element, node);
318
329
  });
319
330
  svgElement.querySelectorAll('polyline').forEach((element) => {
320
331
  var _a;
332
+ if (shouldSkipHandDrawn(element))
333
+ return;
321
334
  const points = ((_a = element.getAttribute('points')) !== null && _a !== void 0 ? _a : '')
322
335
  .trim()
323
336
  .split(/\s+/)
@@ -330,6 +343,8 @@ function applyHandDrawnStyle(svg) {
330
343
  });
331
344
  svgElement.querySelectorAll('polygon').forEach((element) => {
332
345
  var _a;
346
+ if (shouldSkipHandDrawn(element))
347
+ return;
333
348
  const points = ((_a = element.getAttribute('points')) !== null && _a !== void 0 ? _a : '')
334
349
  .trim()
335
350
  .split(/\s+/)
@@ -341,6 +356,8 @@ function applyHandDrawnStyle(svg) {
341
356
  replaceShape(element, node);
342
357
  });
343
358
  svgElement.querySelectorAll('path').forEach((element) => {
359
+ if (shouldSkipHandDrawn(element))
360
+ return;
344
361
  const d = element.getAttribute('d');
345
362
  if (!d)
346
363
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/third-ui",
3
- "version": "31.3.3",
3
+ "version": "31.3.4",
4
4
  "description": "Third-party integrated UI components for windrun-huaiin projects",
5
5
  "exports": {
6
6
  "./clerk": {
@@ -439,6 +439,11 @@ function applyHandDrawnStyle(svg: string) {
439
439
  target.setAttribute(attr, source.getAttribute(attr) ?? '');
440
440
  }
441
441
  };
442
+ const shouldSkipHandDrawn = (element: Element) => {
443
+ if (element.closest('defs')) return true;
444
+ if (element.hasAttribute('marker-start') || element.hasAttribute('marker-end') || element.hasAttribute('marker-mid')) return true;
445
+ return false;
446
+ };
442
447
  const createOptions = (element: Element) => {
443
448
  const stroke = getStyleValue(element, 'stroke') ?? '#000';
444
449
  const fill = getStyleValue(element, 'fill') ?? 'none';
@@ -469,6 +474,7 @@ function applyHandDrawnStyle(svg: string) {
469
474
  };
470
475
 
471
476
  svgElement.querySelectorAll('rect').forEach((element) => {
477
+ if (shouldSkipHandDrawn(element)) return;
472
478
  const x = getNumber(element.getAttribute('x'));
473
479
  const y = getNumber(element.getAttribute('y'));
474
480
  const width = getNumber(element.getAttribute('width'));
@@ -500,6 +506,7 @@ function applyHandDrawnStyle(svg: string) {
500
506
  });
501
507
 
502
508
  svgElement.querySelectorAll('line').forEach((element) => {
509
+ if (shouldSkipHandDrawn(element)) return;
503
510
  const node = rc.line(
504
511
  getNumber(element.getAttribute('x1')),
505
512
  getNumber(element.getAttribute('y1')),
@@ -511,6 +518,7 @@ function applyHandDrawnStyle(svg: string) {
511
518
  });
512
519
 
513
520
  svgElement.querySelectorAll('polyline').forEach((element) => {
521
+ if (shouldSkipHandDrawn(element)) return;
514
522
  const points = (element.getAttribute('points') ?? '')
515
523
  .trim()
516
524
  .split(/\s+/)
@@ -522,6 +530,7 @@ function applyHandDrawnStyle(svg: string) {
522
530
  });
523
531
 
524
532
  svgElement.querySelectorAll('polygon').forEach((element) => {
533
+ if (shouldSkipHandDrawn(element)) return;
525
534
  const points = (element.getAttribute('points') ?? '')
526
535
  .trim()
527
536
  .split(/\s+/)
@@ -533,6 +542,7 @@ function applyHandDrawnStyle(svg: string) {
533
542
  });
534
543
 
535
544
  svgElement.querySelectorAll('path').forEach((element) => {
545
+ if (shouldSkipHandDrawn(element)) return;
536
546
  const d = element.getAttribute('d');
537
547
  if (!d) return;
538
548
  const node = rc.path(d, createOptions(element));