@ingcreators/annot-core 0.3.1 → 0.4.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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @ingcreators/annot-core
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Ship the metadata-unification surface to npm. The published 0.3.1
8
+ dist predates the whole track, so registry consumers were missing:
9
+ - XMP schema 2.0 — `buildXmp` restructured to an options object
10
+ (**breaking** for direct callers) with first-class provenance
11
+ fields (`sourceUrl` / `createdAt` / `producer` / `dpr`,
12
+ `XmpProvenance`), `ANNOT_XMP_VERSION = "2.0"`, XML-escaped
13
+ free-text fields, and `AnnotMetadata` gaining `version` +
14
+ provenance on the read side.
15
+ - `ELEMENT_TREE_ATTR_WHITELIST` in `/element-tree` — the canonical
16
+ attribute whitelist `@ingcreators/annot-product-docs@0.5.0`
17
+ imports (its registry install crashed with "does not provide an
18
+ export named 'ELEMENT_TREE_ATTR_WHITELIST'" until this release).
19
+ - SVG provenance helpers in `/editor/svg-format`
20
+ (`writeSvgProvenanceAttrs` / `readSvgProvenanceAttrs` /
21
+ `SVG_PROVENANCE_ATTRS`).
22
+
3
23
  ## 0.3.1
4
24
 
5
25
  ### Patch Changes
@@ -2,7 +2,7 @@ export { createHistoryCore, DEFAULT_HISTORY_DEPTH, type HistoryCore, type Histor
2
2
  export type { OverlayRegionPickDetail } from './overlay-pick-types.js';
3
3
  export { CATEGORY_CONTROL_SHAPE, classifyPropertyElement, classifyPropertySelection, PROPERTY_CONTROL_IDS, PROPERTY_CONTROLS, PROPERTY_EFFECT_IDS, type PropertyCategory, type PropertyControlDef, type PropertyControlId, type PropertyControlOption, type PropertyControlType, type PropertyEffectId, } from './property-schema.js';
4
4
  export { computeSnap, cursorForAngle, type Rect, rotateAround, type SnapGuide, type SnapInput, type SnapResult, } from './selection-geometry.js';
5
- export { ANNOT_SVG_VERSION, ANNOT_SVG_VERSION_ATTR, ANNOT_SVG_VERSION_UNSTAMPED, getAnnotVersionFromString, readAnnotVersion, stampAnnotVersion, } from './svg-format.js';
5
+ export { ANNOT_SVG_VERSION, ANNOT_SVG_VERSION_ATTR, ANNOT_SVG_VERSION_UNSTAMPED, getAnnotVersionFromString, readAnnotVersion, readSvgProvenanceAttrs, SVG_PROVENANCE_ATTRS, type SvgProvenance, stampAnnotVersion, writeSvgProvenanceAttrs, } from './svg-format.js';
6
6
  export { svgAnnotationsToShapes, svgElementToAnnotationShape, transformOf, translateOf, } from './svg-to-annotation-shapes.js';
7
7
  export { createMockToolSurface, type MockToolSurface, type ToolDOMSurface, } from './tool-lifecycle.js';
8
8
  export { selectionDefMetadata, TOOL_PANEL_ADAPTER_IDS, TOOL_PANEL_ADAPTERS, type ToolPanelAdapter, type ToolPanelAdapterId, type ToolPanelAdapterMetadata, } from './tool-panel-adapter.js';
@@ -66,3 +66,31 @@ export declare function readAnnotVersion(svgRoot: Element): string;
66
66
  * emits the attribute on the root well before any content).
67
67
  */
68
68
  export declare function getAnnotVersionFromString(svgString: string): string;
69
+ /** Root-attribute names for the four provenance fields. */
70
+ export declare const SVG_PROVENANCE_ATTRS: {
71
+ readonly sourceUrl: "data-annot-source-url";
72
+ readonly createdAt: "data-annot-created-at";
73
+ readonly producer: "data-annot-producer";
74
+ readonly dpr: "data-annot-dpr";
75
+ };
76
+ /** Provenance shape mirrored from `XmpProvenance` (annot-core/xmp). */
77
+ export interface SvgProvenance {
78
+ sourceUrl?: string;
79
+ createdAt?: string;
80
+ producer?: string;
81
+ dpr?: number;
82
+ }
83
+ /**
84
+ * Write the provenance fields onto an SVG root element. Unset
85
+ * fields REMOVE their attribute so a re-save never leaves stale
86
+ * values behind. Call right before serializing a standalone
87
+ * `.annot.svg` — records embedded inside a raster's XMP packet
88
+ * don't need it (the packet itself is the carrier there).
89
+ */
90
+ export declare function writeSvgProvenanceAttrs(root: Element, prov: SvgProvenance): void;
91
+ /**
92
+ * Read the provenance fields back from an SVG root element.
93
+ * Missing attributes default to `""` / `0`, matching
94
+ * `AnnotMetadata`'s defensive-reader contract.
95
+ */
96
+ export declare function readSvgProvenanceAttrs(root: Element): Required<SvgProvenance>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Canonical HTML-attribute whitelist for `ElementNode.attributes` —
3
+ * Phase 7 of `docs/plans/metadata-unification.md`.
4
+ *
5
+ * Every ElementTree producer captures the SAME attribute set:
6
+ * the extension's MAIN-world walker, the Playwright
7
+ * `attachAttributes` adapter, and the product-docs fixture /
8
+ * migrator all derive from this constant (the walker's copy is
9
+ * inlined — `executeScript({func})` cannot import — and guarded by
10
+ * a behavioural symmetry test in `element-tree-walker.test.ts`).
11
+ *
12
+ * Selection principle: **`attributes` carries element shape (HTML
13
+ * attributes), `states` carries element state (ARIA / dynamic)** —
14
+ * aria-* never appears in `attributes`; producers encode those as
15
+ * `states` tokens instead.
16
+ *
17
+ * - Identity / locator hooks: `id`, `data-testid`, `data-test-id`,
18
+ * `name` — `data-testid` is the i18n-stable match key the
19
+ * living-spec roadmap designates; locator-building consumers
20
+ * (MCP `resolve-locator`, future codegen) resolve against it at
21
+ * use time. There is deliberately NO persisted `locator` field
22
+ * on `ElementNode` (see the plan's Phase 7 decision log).
23
+ * - Navigation: `href`.
24
+ * - Form shape: `type`, `placeholder`, `value`, `required`,
25
+ * `disabled`, `readonly`, `checked`, `maxlength`, `minlength`,
26
+ * `pattern`, `min`, `max`, `step` — what a screen-specification
27
+ * table documents per control.
28
+ */
29
+ export declare const ELEMENT_TREE_ATTR_WHITELIST: readonly string[];
@@ -1,3 +1,4 @@
1
+ export { ELEMENT_TREE_ATTR_WHITELIST } from './attr-whitelist.js';
1
2
  export { parseElementTreeFromJson, serializeElementTreeToJson, validateElementTree, } from './json.js';
2
3
  export { type BBox, type ElementNode, type ElementTree, type ElementTreeSource, type ElementTreeViewport, isElementTreeShape, } from './types.js';
3
4
  export { type ElementMatch, type ElementTreeVisitor, findByMatch, findByRef, flattenTree, walkTree, } from './walk.js';