@zumer/snapdom-plugins 3.0.0 → 4.0.0
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/CHANGELOG.md +13 -0
- package/README.md +50 -16
- package/agent-map.d.ts +32 -0
- package/agent-map.js +5 -3
- package/ascii-export.d.ts +10 -0
- package/ascii-export.js +21 -6
- package/capture-frames.js +5 -5
- package/color-tint.js +4 -0
- package/context-export.d.ts +23 -0
- package/context-export.js +4 -1
- package/filter.js +1 -1
- package/gif-export.d.ts +6 -0
- package/gif-export.js +3 -3
- package/html-export.d.ts +8 -0
- package/html-export.js +6 -4
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/package.json +16 -5
- package/pdf/LICENSE +21 -0
- package/pdf/README.md +22 -0
- package/pdf/REFERENCE.md +520 -0
- package/pdf/src/frontmatter.js +200 -0
- package/pdf/src/furniture.js +398 -0
- package/pdf/src/index.js +2415 -0
- package/pdf/src/mega/README.md +47 -0
- package/pdf/src/mega/diag.js +148 -0
- package/pdf/src/mega/flow.js +56 -0
- package/pdf/src/mega/fonts.js +287 -0
- package/pdf/src/mega/forms.js +479 -0
- package/pdf/src/mega/labels.js +43 -0
- package/pdf/src/mega/meta.js +145 -0
- package/pdf/src/nav.js +357 -0
- package/pdf/src/paginate.js +583 -0
- package/pdf/src/tagged.js +355 -0
- package/pdf/src/text-layer.js +1771 -0
- package/pdf/src/writer/encrypt.js +218 -0
- package/pdf/src/writer/font.js +507 -0
- package/pdf/src/writer/index.js +1135 -0
- package/pdf/src/writer/subset.js +387 -0
- package/pdf.d.ts +294 -0
- package/pdf.js +1 -0
- package/redact-inputs.js +6 -6
- package/vector/CONTRACT.md +906 -0
- package/vector/LICENSE +21 -0
- package/vector/README.md +35 -0
- package/vector/src/adapters/snapdom.js +795 -0
- package/vector/src/collect/box.js +1676 -0
- package/vector/src/collect/font.js +487 -0
- package/vector/src/collect/image.js +1458 -0
- package/vector/src/collect/mathml.js +272 -0
- package/vector/src/collect/text.js +3027 -0
- package/vector/src/css/color.js +823 -0
- package/vector/src/css/gradient.js +1126 -0
- package/vector/src/css/matrix.js +398 -0
- package/vector/src/css/radius.js +124 -0
- package/vector/src/css/shadow.js +201 -0
- package/vector/src/emit/figma-json.js +1995 -0
- package/vector/src/emit/h2d-vector.js +215 -0
- package/vector/src/emit/h2d.js +1147 -0
- package/vector/src/emit/pdf.js +2571 -0
- package/vector/src/emit/svg-flat.js +4842 -0
- package/vector/src/exclusion.js +13 -0
- package/vector/src/index.js +2910 -0
- package/vector/src/paint.js +2908 -0
- package/vector/src/public.js +57 -0
- package/vector/src/writer/encrypt.js +227 -0
- package/vector/src/writer/font.js +507 -0
- package/vector/src/writer/index.js +1148 -0
- package/vector/src/writer/subset.js +387 -0
- package/vector/svd/index.js +72 -0
- package/vector/svd/schema.js +985 -0
- package/vector.d.ts +28 -0
- package/vector.js +1 -0
- package/video-export.d.ts +6 -0
- package/video-export.js +7 -7
- package/pdf-image.d.ts +0 -18
- 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('[
|
|
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('[
|
|
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('[
|
|
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(`[
|
|
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('[
|
|
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('[
|
|
130
|
+
throw new Error('[SnapDOM] redact-inputs: cannot remove the capture root; use excludeMode: "hide"');
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
},
|