/** * Schema-driven element ordering (ECMA-376 5th edition Transitional). * * The #1 cause of Office repair prompts when INSERTING elements is wrong * child order. This module answers "where does this child go?" from * data-only tables generated from the official ECMA-376 XSDs * (`tools/codegen/generate.ts`; provenance pinned in * `tools/codegen/schemas.manifest.json`), instead of hand-coded * insert-before lists scattered through the lenses. * * Position semantics: each parent element maps to an ordered list of * allowed child (namespace URI, localName) pairs with a 0-based sequence * position. Children sharing a position come from one collapsed * xsd:choice/xsd:all group — mutually order-free ("same position, any of * these"). See src/schema/types.ts for the raw data format and the spec * repo's spec/07-codegen.md for the normative flattening algorithm. * * Preservation invariant: {@link insertInSchemaOrder} only ever INSERTS — * existing children (including unknown/extension elements the tables know * nothing about) are NEVER reordered or moved. */ import type { XmlElement } from '../xml/index.js'; export type { SchemaFamily } from './types.js'; export { wml } from './generated/wml.js'; export { sml } from './generated/sml.js'; export { pml } from './generated/pml.js'; export { dml } from './generated/dml.js'; export { shared } from './generated/shared.js'; export { NAMESPACE_PREFIXES } from './generated/namespaces.js'; /** * The schema position of (childNsUri, childLocalName) among the allowed * children of (parentNsUri, parentLocalName), or undefined when the parent * is unknown or the child is not an allowed child of it. * * Positions order the parent's flattened content model: a child with a * smaller position precedes one with a larger position. Children with * EQUAL positions come from one xsd:choice/xsd:all group and may appear * in any relative order. */ export declare function childOrderIndex(parentNsUri: string | null, parentLocalName: string, childNsUri: string | null, childLocalName: string): number | undefined; /** * The XSD-declared default value of an attribute on an element, or * undefined when none is declared. `attrNsUri === null` (or `''`) means an * unqualified attribute. */ export declare function attributeDefault(elementNsUri: string | null, elementLocalName: string, attrNsUri: string | null, attrLocalName: string): string | undefined; /** * Insert `child` into `parent` at the position the schema's content model * assigns it: after every existing child whose schema position is less * than or equal to `child`'s, and before the first existing child whose * schema position is greater. * * Rules (all load-bearing): * - Existing children are NEVER moved — unknown/extension elements, text, * and comments stay exactly where they are (preservation invariant). * Only the new node is placed. * - When the parent's content model is unknown, or `child` is not an * allowed child of it, `child` is appended at the end (matching plain * `appendChild` — degradation is always append, never reorder). * - Equal positions (one xsd:choice group) append after the existing * same-position children, preserving insertion order among peers. * - A detached `child` usually cannot resolve its own namespace yet; its * prefix is then resolved against `parent`'s in-scope declarations * (which is where it is about to live). * * Marking the affected part dirty remains the caller's responsibility, * exactly as with `appendChild`/`insertBefore` (CONTRACTS.md §0.1). */ export declare function insertInSchemaOrder(parent: XmlElement, child: XmlElement): void; //# sourceMappingURL=index.d.ts.map