@zumer/snapdom-plugins 3.0.0 → 4.0.1

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 (77) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +50 -16
  3. package/agent-map.d.ts +32 -0
  4. package/agent-map.js +5 -3
  5. package/ascii-export.d.ts +10 -0
  6. package/ascii-export.js +21 -6
  7. package/capture-frames.js +5 -5
  8. package/color-tint.js +4 -0
  9. package/context-export.d.ts +23 -0
  10. package/context-export.js +4 -1
  11. package/filter.js +1 -1
  12. package/gif-export.d.ts +6 -0
  13. package/gif-export.js +3 -3
  14. package/html-export.d.ts +8 -0
  15. package/html-export.js +6 -4
  16. package/index.d.ts +2 -1
  17. package/index.js +2 -1
  18. package/package.json +22 -6
  19. package/pdf/LICENSE +21 -0
  20. package/pdf/README.md +22 -0
  21. package/pdf/REFERENCE.md +520 -0
  22. package/pdf/src/frontmatter.js +200 -0
  23. package/pdf/src/furniture.js +398 -0
  24. package/pdf/src/index.js +2415 -0
  25. package/pdf/src/mega/README.md +47 -0
  26. package/pdf/src/mega/diag.js +148 -0
  27. package/pdf/src/mega/flow.js +56 -0
  28. package/pdf/src/mega/fonts.js +287 -0
  29. package/pdf/src/mega/forms.js +479 -0
  30. package/pdf/src/mega/labels.js +43 -0
  31. package/pdf/src/mega/meta.js +145 -0
  32. package/pdf/src/nav.js +357 -0
  33. package/pdf/src/paginate.js +583 -0
  34. package/pdf/src/tagged.js +355 -0
  35. package/pdf/src/text-layer.js +1771 -0
  36. package/pdf/src/writer/encrypt.js +218 -0
  37. package/pdf/src/writer/font.js +507 -0
  38. package/pdf/src/writer/index.js +1135 -0
  39. package/pdf/src/writer/subset.js +387 -0
  40. package/pdf.d.ts +294 -0
  41. package/pdf.js +1 -0
  42. package/redact-inputs.js +6 -6
  43. package/vector/CONTRACT.md +906 -0
  44. package/vector/LICENSE +21 -0
  45. package/vector/README.md +35 -0
  46. package/vector/src/adapters/snapdom.js +795 -0
  47. package/vector/src/collect/box.js +1676 -0
  48. package/vector/src/collect/font.js +487 -0
  49. package/vector/src/collect/image.js +1458 -0
  50. package/vector/src/collect/mathml.js +272 -0
  51. package/vector/src/collect/text.js +3027 -0
  52. package/vector/src/css/color.js +823 -0
  53. package/vector/src/css/gradient.js +1126 -0
  54. package/vector/src/css/matrix.js +398 -0
  55. package/vector/src/css/radius.js +124 -0
  56. package/vector/src/css/shadow.js +201 -0
  57. package/vector/src/emit/figma-json.js +1995 -0
  58. package/vector/src/emit/h2d-vector.js +215 -0
  59. package/vector/src/emit/h2d.js +1147 -0
  60. package/vector/src/emit/pdf.js +2571 -0
  61. package/vector/src/emit/svg-flat.js +4842 -0
  62. package/vector/src/exclusion.js +13 -0
  63. package/vector/src/index.js +2910 -0
  64. package/vector/src/paint.js +2908 -0
  65. package/vector/src/public.js +57 -0
  66. package/vector/src/writer/encrypt.js +227 -0
  67. package/vector/src/writer/font.js +507 -0
  68. package/vector/src/writer/index.js +1148 -0
  69. package/vector/src/writer/subset.js +387 -0
  70. package/vector/svd/index.js +72 -0
  71. package/vector/svd/schema.js +985 -0
  72. package/vector.d.ts +28 -0
  73. package/vector.js +1 -0
  74. package/video-export.d.ts +6 -0
  75. package/video-export.js +7 -7
  76. package/pdf-image.d.ts +0 -18
  77. package/pdf-image.js +0 -114
package/redact-inputs.js CHANGED
@@ -50,15 +50,15 @@ export function redactInputs(options = {}) {
50
50
  const blockInput = options.blocks ?? [];
51
51
  const blocks = typeof blockInput === 'string' ? [blockInput] : blockInput;
52
52
  if (!Array.isArray(blocks) || blocks.some(value => typeof value !== 'string' || !value.trim())) {
53
- throw new TypeError('[snapdom] redact-inputs: blocks must be a selector or an array of non-empty selectors');
53
+ throw new TypeError('[SnapDOM] redact-inputs: blocks must be a selector or an array of non-empty selectors');
54
54
  }
55
55
  const blockSelectors = [...new Set(blocks.map(value => value.trim()))];
56
56
  const attributeInput = options.attributes ?? [];
57
- if (!Array.isArray(attributeInput)) throw new TypeError('[snapdom] redact-inputs: attributes must be an array of rules');
57
+ if (!Array.isArray(attributeInput)) throw new TypeError('[SnapDOM] redact-inputs: attributes must be an array of rules');
58
58
  const attributes = attributeInput.map(rule => {
59
59
  if (!rule || typeof rule.selector !== 'string' || !rule.selector.trim() || !Array.isArray(rule.names) ||
60
60
  rule.names.some(name => typeof name !== 'string' || !/^[a-zA-Z_][\w:.-]*$/.test(name))) {
61
- throw new TypeError('[snapdom] redact-inputs: attribute rules need a selector and exact attribute names');
61
+ throw new TypeError('[SnapDOM] redact-inputs: attribute rules need a selector and exact attribute names');
62
62
  }
63
63
  return { selector: rule.selector.trim(), names: [...new Set(rule.names)] };
64
64
  }).filter(rule => rule.names.length);
@@ -69,7 +69,7 @@ export function redactInputs(options = {}) {
69
69
  const probe = doc.createElement('div');
70
70
  for (const value of [...blockSelectors, ...attributes.map(rule => rule.selector)]) {
71
71
  try { probe.matches(value); }
72
- catch { throw new TypeError(`[snapdom] redact-inputs: invalid privacy selector ${JSON.stringify(value)}`); }
72
+ catch { throw new TypeError(`[SnapDOM] redact-inputs: invalid privacy selector ${JSON.stringify(value)}`); }
73
73
  }
74
74
  validatedDocuments.add(doc);
75
75
  };
@@ -120,14 +120,14 @@ export function redactInputs(options = {}) {
120
120
  // createContext's compiled exclusion policy closes over this array. Extend it
121
121
  // in place so core and semantic exporters see the same policy before cloning.
122
122
  const exclude = ctx.exclude;
123
- if (!Array.isArray(exclude)) throw new Error('[snapdom] redact-inputs requires normalized capture exclusions');
123
+ if (!Array.isArray(exclude)) throw new Error('[SnapDOM] redact-inputs needs a newer @zumer/snapdom.');
124
124
  for (const value of blockSelectors) if (!exclude.includes(value)) exclude.push(value);
125
125
  // Capturing a child of a private region must not escape that region's policy.
126
126
  if (policy.isBlocked(ctx.element) && !exclude.includes('*')) exclude.push('*');
127
127
  const previous = ctx.shouldExclude;
128
128
  ctx.shouldExclude = (el) => policy.isBlocked(el) || previous(el);
129
129
  if (ctx.excludeMode === 'remove' && policy.isBlocked(ctx.element)) {
130
- throw new Error('[snapdom] redact-inputs: cannot remove the capture root; use excludeMode: "hide"');
130
+ throw new Error('[SnapDOM] redact-inputs: cannot remove the capture root; use excludeMode: "hide"');
131
131
  }
132
132
  }
133
133
  },