@compact-design/core 0.2.0 → 0.3.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/dist/generated-schema.d.ts +598 -2
- package/dist/index.cjs +2266 -400
- package/dist/index.d.ts +32 -2
- package/dist/index.js +2234 -399
- package/dist/normalize.d.ts +7 -1
- package/dist/patch-definitions.d.ts +41 -0
- package/dist/patch-duplicate.d.ts +34 -0
- package/dist/patch-keys.d.ts +61 -0
- package/dist/patch-prototype.d.ts +39 -0
- package/dist/patch.d.ts +25 -1
- package/dist/types.d.ts +69 -3
- package/dist/validate.d.ts +15 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RepairIssue } from "./lint";
|
|
2
2
|
import { isPatchDocument } from "./normalize";
|
|
3
|
-
import { type PatchResult } from "./patch";
|
|
3
|
+
import { PatchError, type PatchResult } from "./patch";
|
|
4
4
|
import { schema } from "./schema";
|
|
5
5
|
import type { InternalDocument, InternalPatchDocument } from "./types";
|
|
6
6
|
export interface ValidationResult {
|
|
@@ -12,11 +12,41 @@ export interface ValidationResult {
|
|
|
12
12
|
export declare function parse(source: string): unknown;
|
|
13
13
|
export declare function normalize(value: unknown): InternalDocument;
|
|
14
14
|
export declare function normalizePatch(value: unknown): InternalPatchDocument;
|
|
15
|
+
/**
|
|
16
|
+
* Validate a full document or a patch document. Patch documents are checked
|
|
17
|
+
* against the schema ($defs.patchSet rejects unknown keys) and by core's
|
|
18
|
+
* patch normalizer (deferred keys, conflicting keys). Rules that depend on the
|
|
19
|
+
* target node run in validatePatch / applyPatch.
|
|
20
|
+
*/
|
|
15
21
|
export declare function validate(value: unknown): ValidationResult;
|
|
22
|
+
export interface PatchValidationResult {
|
|
23
|
+
valid: boolean;
|
|
24
|
+
issues: RepairIssue[];
|
|
25
|
+
patch?: InternalPatchDocument;
|
|
26
|
+
document?: InternalDocument;
|
|
27
|
+
affectedIds?: string[];
|
|
28
|
+
warnings?: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validate a raw patch against the document it will be applied to: schema,
|
|
32
|
+
* key rules, target-type rules, and validateDocument on the patched result
|
|
33
|
+
* (bindings, styleRefs, variants, sizes, ...). Only issues the patch
|
|
34
|
+
* introduces are reported; issues already in the input document never block.
|
|
35
|
+
* Returns the patched document when valid. Never throws.
|
|
36
|
+
*/
|
|
37
|
+
export declare function validatePatch(document: InternalDocument, patch: unknown): PatchValidationResult;
|
|
16
38
|
export declare function lint(value: InternalDocument): RepairIssue[];
|
|
39
|
+
/** Apply a normalized patch. Throws PatchError when an operation or the patched document is invalid. */
|
|
17
40
|
export declare function applyPatch(document: InternalDocument, patch: InternalPatchDocument): PatchResult;
|
|
18
|
-
export { isPatchDocument, schema };
|
|
41
|
+
export { isPatchDocument, schema, PatchError };
|
|
42
|
+
export { normalizePatchSet } from "./normalize";
|
|
43
|
+
export { corePatchContext, newDocumentIssues } from "./patch";
|
|
44
|
+
export { PATCH_SET_KEYS, PATCH_SET_EXCLUDED_NODE_KEYS, PATCH_SET_SEMANTICS, PATCH_SET_APPLIES_TO, PATCH_SET_DEFERRED_KEYS, PATCH_TEXT_STYLE_KEYS, isPatchSetKey, patchSetShapeIssues, patchSetTargetIssues, patchSetBindingFields } from "./patch-keys";
|
|
45
|
+
export type { PatchSetKey, PatchSetSemantics, PatchTargetContext } from "./patch-keys";
|
|
19
46
|
export { indexDocument } from "./references";
|
|
47
|
+
export { detectVariantRenames, variantAxesUncarriedOptions, type AxisRename, type OptionRename, type VariantAxisPatchEntry, type VariantAxesPatch } from "./patch-definitions";
|
|
48
|
+
export { buildDuplicateIdMap, buildDuplicateIdMapFromIds, collectSubtreeIds, cloneSubtreeWithIds, remapIssueKeyThroughDuplicate, remapDelimitedIds, subtreeContainsType } from "./patch-duplicate";
|
|
49
|
+
export { assertPrototypeSetDestinations, assertPrototypePatchRules, prototypeDestinationErrors, prototypePatchStrictErrors, forEachPrototypeDestination, isAfterTimeoutReaction, isTopLevelNodeId } from "./patch-prototype";
|
|
20
50
|
export type { DocumentIndex } from "./references";
|
|
21
51
|
export type { PatchResult, RepairIssue };
|
|
22
52
|
export type * from "./types";
|