@wdprlib/ast 2.3.0 → 2.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/dist/index.cjs CHANGED
@@ -54,6 +54,7 @@ __export(exports_src, {
54
54
  container: () => container,
55
55
  bold: () => bold,
56
56
  STYLE_SLOT_PREFIX: () => STYLE_SLOT_PREFIX,
57
+ STYLE_ANCHOR_PREFIX: () => STYLE_ANCHOR_PREFIX,
57
58
  DEFAULT_SETTINGS: () => DEFAULT_SETTINGS,
58
59
  CSS_LENGTH_UNITS: () => CSS_LENGTH_UNITS
59
60
  });
@@ -254,6 +255,7 @@ function isParagraphSafe(element) {
254
255
  }
255
256
  // packages/ast/src/constants.ts
256
257
  var STYLE_SLOT_PREFIX = "\x00__IFTAGS_SLOT__";
258
+ var STYLE_ANCHOR_PREFIX = "\x00__STYLE_ANCHOR__";
257
259
  // packages/ast/src/css.ts
258
260
  var CSS_LENGTH_UNITS = [
259
261
  "cqmax",
package/dist/index.d.cts CHANGED
@@ -1233,6 +1233,13 @@ interface ParseResult {
1233
1233
  */
1234
1234
  declare const STYLE_SLOT_PREFIX = "\0__IFTAGS_SLOT__";
1235
1235
  /**
1236
+ * Sentinel prefix for invisible style-position anchors retained in the AST.
1237
+ *
1238
+ * The suffix is the previously collected CSS text. Renderers must not emit
1239
+ * these synthetic style elements.
1240
+ */
1241
+ declare const STYLE_ANCHOR_PREFIX = "\0__STYLE_ANCHOR__";
1242
+ /**
1236
1243
  * Context-dependent settings for the Wikidot parser and renderer.
1237
1244
  *
1238
1245
  * Wikidot content appears in several different contexts — full wiki pages,
@@ -1394,6 +1401,28 @@ declare function formatExprValue(n: number): string;
1394
1401
  * @returns A success result with a numeric value, or an error result with a message.
1395
1402
  */
1396
1403
  declare function evaluateExpression(expr: string): ExprResult;
1404
+ /** Attachment metadata used by page-contextual gallery rendering. */
1405
+ interface WikitextPageFile {
1406
+ name: string;
1407
+ createdAt?: number;
1408
+ }
1409
+ /**
1410
+ * Page data shared by high-level parser and renderer APIs.
1411
+ *
1412
+ * `fullName` is the category-qualified Wikidot page name. `unixName`, when
1413
+ * available, is the separately named URL-safe page identifier.
1414
+ */
1415
+ interface WikitextPageContext {
1416
+ fullName: string;
1417
+ unixName?: string;
1418
+ tags: string[];
1419
+ urlPath?: string;
1420
+ site?: string;
1421
+ domain?: string;
1422
+ siteDomains?: Record<string, string>;
1423
+ resolveSiteDomain?: (site: string) => string | null | undefined;
1424
+ files?: WikitextPageFile[];
1425
+ }
1397
1426
  /**
1398
1427
  * Identifies the source markup dialect.
1399
1428
  *
@@ -1403,4 +1432,4 @@ declare function evaluateExpression(expr: string): ExprResult;
1403
1432
  * @group Core
1404
1433
  */
1405
1434
  type Version = "wikidot";
1406
- export { text, paragraph, listItemSubList, listItemElements, list, link, lineBreak, italics, isTruthy, isStringContainerType, isParagraphSafe, isHeaderType, isContainerTypeParagraphSafe, isAlignType, horizontalRule, heading, formatExprValue, evaluateExpression, createSettings, createPosition, createPoint, container, bold, WikitextSettings, WikitextMode, Version, VariableMap, UserData, TocEntry, TableRow, TableOfContentsData, TableData, TableCell, TabData, SyntaxTree, StringContainerType, STYLE_SLOT_PREFIX, Position, Point, ParseResult, PageRef, Module, MathInlineData, MathData, ListType, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LinkData, IncludeData, ImageSource, ImageData, IframeData, IfTagsData, IfExprData, IfCondData, HtmlData, HeadingLevel, Heading, HeaderType, GallerySize, GalleryOrder, GalleryItem, GalleryData, GalleryContent, FootnoteBlockData, FloatAlignment, ExprResult, ExprData, EmbedBlockData, Embed, ElementOf, ElementName, ElementDataMap, ElementData, Element, DiagnosticSeverity, Diagnostic, DefinitionListItem, DateItem, DateData, DEFAULT_SETTINGS, CssLengthUnit, ContainerType, ContainerData, ColorData, CollapsibleData, CodeBlockData, ClearFloat, CSS_LENGTH_UNITS, BibliographyCiteData, BibliographyBlockData, AttributeMap, AnchorTarget, AnchorData, Alignment, AlignType };
1435
+ export { text, paragraph, listItemSubList, listItemElements, list, link, lineBreak, italics, isTruthy, isStringContainerType, isParagraphSafe, isHeaderType, isContainerTypeParagraphSafe, isAlignType, horizontalRule, heading, formatExprValue, evaluateExpression, createSettings, createPosition, createPoint, container, bold, WikitextSettings, WikitextPageFile, WikitextPageContext, WikitextMode, Version, VariableMap, UserData, TocEntry, TableRow, TableOfContentsData, TableData, TableCell, TabData, SyntaxTree, StringContainerType, STYLE_SLOT_PREFIX, STYLE_ANCHOR_PREFIX, Position, Point, ParseResult, PageRef, Module, MathInlineData, MathData, ListType, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LinkData, IncludeData, ImageSource, ImageData, IframeData, IfTagsData, IfExprData, IfCondData, HtmlData, HeadingLevel, Heading, HeaderType, GallerySize, GalleryOrder, GalleryItem, GalleryData, GalleryContent, FootnoteBlockData, FloatAlignment, ExprResult, ExprData, EmbedBlockData, Embed, ElementOf, ElementName, ElementDataMap, ElementData, Element, DiagnosticSeverity, Diagnostic, DefinitionListItem, DateItem, DateData, DEFAULT_SETTINGS, CssLengthUnit, ContainerType, ContainerData, ColorData, CollapsibleData, CodeBlockData, ClearFloat, CSS_LENGTH_UNITS, BibliographyCiteData, BibliographyBlockData, AttributeMap, AnchorTarget, AnchorData, Alignment, AlignType };
package/dist/index.d.ts CHANGED
@@ -1233,6 +1233,13 @@ interface ParseResult {
1233
1233
  */
1234
1234
  declare const STYLE_SLOT_PREFIX = "\0__IFTAGS_SLOT__";
1235
1235
  /**
1236
+ * Sentinel prefix for invisible style-position anchors retained in the AST.
1237
+ *
1238
+ * The suffix is the previously collected CSS text. Renderers must not emit
1239
+ * these synthetic style elements.
1240
+ */
1241
+ declare const STYLE_ANCHOR_PREFIX = "\0__STYLE_ANCHOR__";
1242
+ /**
1236
1243
  * Context-dependent settings for the Wikidot parser and renderer.
1237
1244
  *
1238
1245
  * Wikidot content appears in several different contexts — full wiki pages,
@@ -1394,6 +1401,28 @@ declare function formatExprValue(n: number): string;
1394
1401
  * @returns A success result with a numeric value, or an error result with a message.
1395
1402
  */
1396
1403
  declare function evaluateExpression(expr: string): ExprResult;
1404
+ /** Attachment metadata used by page-contextual gallery rendering. */
1405
+ interface WikitextPageFile {
1406
+ name: string;
1407
+ createdAt?: number;
1408
+ }
1409
+ /**
1410
+ * Page data shared by high-level parser and renderer APIs.
1411
+ *
1412
+ * `fullName` is the category-qualified Wikidot page name. `unixName`, when
1413
+ * available, is the separately named URL-safe page identifier.
1414
+ */
1415
+ interface WikitextPageContext {
1416
+ fullName: string;
1417
+ unixName?: string;
1418
+ tags: string[];
1419
+ urlPath?: string;
1420
+ site?: string;
1421
+ domain?: string;
1422
+ siteDomains?: Record<string, string>;
1423
+ resolveSiteDomain?: (site: string) => string | null | undefined;
1424
+ files?: WikitextPageFile[];
1425
+ }
1397
1426
  /**
1398
1427
  * Identifies the source markup dialect.
1399
1428
  *
@@ -1403,4 +1432,4 @@ declare function evaluateExpression(expr: string): ExprResult;
1403
1432
  * @group Core
1404
1433
  */
1405
1434
  type Version = "wikidot";
1406
- export { text, paragraph, listItemSubList, listItemElements, list, link, lineBreak, italics, isTruthy, isStringContainerType, isParagraphSafe, isHeaderType, isContainerTypeParagraphSafe, isAlignType, horizontalRule, heading, formatExprValue, evaluateExpression, createSettings, createPosition, createPoint, container, bold, WikitextSettings, WikitextMode, Version, VariableMap, UserData, TocEntry, TableRow, TableOfContentsData, TableData, TableCell, TabData, SyntaxTree, StringContainerType, STYLE_SLOT_PREFIX, Position, Point, ParseResult, PageRef, Module, MathInlineData, MathData, ListType, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LinkData, IncludeData, ImageSource, ImageData, IframeData, IfTagsData, IfExprData, IfCondData, HtmlData, HeadingLevel, Heading, HeaderType, GallerySize, GalleryOrder, GalleryItem, GalleryData, GalleryContent, FootnoteBlockData, FloatAlignment, ExprResult, ExprData, EmbedBlockData, Embed, ElementOf, ElementName, ElementDataMap, ElementData, Element, DiagnosticSeverity, Diagnostic, DefinitionListItem, DateItem, DateData, DEFAULT_SETTINGS, CssLengthUnit, ContainerType, ContainerData, ColorData, CollapsibleData, CodeBlockData, ClearFloat, CSS_LENGTH_UNITS, BibliographyCiteData, BibliographyBlockData, AttributeMap, AnchorTarget, AnchorData, Alignment, AlignType };
1435
+ export { text, paragraph, listItemSubList, listItemElements, list, link, lineBreak, italics, isTruthy, isStringContainerType, isParagraphSafe, isHeaderType, isContainerTypeParagraphSafe, isAlignType, horizontalRule, heading, formatExprValue, evaluateExpression, createSettings, createPosition, createPoint, container, bold, WikitextSettings, WikitextPageFile, WikitextPageContext, WikitextMode, Version, VariableMap, UserData, TocEntry, TableRow, TableOfContentsData, TableData, TableCell, TabData, SyntaxTree, StringContainerType, STYLE_SLOT_PREFIX, STYLE_ANCHOR_PREFIX, Position, Point, ParseResult, PageRef, Module, MathInlineData, MathData, ListType, ListItem, ListData, LinkType, LinkLocation, LinkLabel, LinkData, IncludeData, ImageSource, ImageData, IframeData, IfTagsData, IfExprData, IfCondData, HtmlData, HeadingLevel, Heading, HeaderType, GallerySize, GalleryOrder, GalleryItem, GalleryData, GalleryContent, FootnoteBlockData, FloatAlignment, ExprResult, ExprData, EmbedBlockData, Embed, ElementOf, ElementName, ElementDataMap, ElementData, Element, DiagnosticSeverity, Diagnostic, DefinitionListItem, DateItem, DateData, DEFAULT_SETTINGS, CssLengthUnit, ContainerType, ContainerData, ColorData, CollapsibleData, CodeBlockData, ClearFloat, CSS_LENGTH_UNITS, BibliographyCiteData, BibliographyBlockData, AttributeMap, AnchorTarget, AnchorData, Alignment, AlignType };
package/dist/index.js CHANGED
@@ -193,6 +193,7 @@ function isParagraphSafe(element) {
193
193
  }
194
194
  // packages/ast/src/constants.ts
195
195
  var STYLE_SLOT_PREFIX = "\x00__IFTAGS_SLOT__";
196
+ var STYLE_ANCHOR_PREFIX = "\x00__STYLE_ANCHOR__";
196
197
  // packages/ast/src/css.ts
197
198
  var CSS_LENGTH_UNITS = [
198
199
  "cqmax",
@@ -693,6 +694,7 @@ export {
693
694
  container,
694
695
  bold,
695
696
  STYLE_SLOT_PREFIX,
697
+ STYLE_ANCHOR_PREFIX,
696
698
  DEFAULT_SETTINGS,
697
699
  CSS_LENGTH_UNITS
698
700
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdprlib/ast",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "AST types for Wikidot markup",
5
5
  "keywords": [
6
6
  "ast",
package/src/constants.ts CHANGED
@@ -10,3 +10,11 @@
10
10
  * A null-byte prefix ensures no collision with valid CSS content.
11
11
  */
12
12
  export const STYLE_SLOT_PREFIX = "\0__IFTAGS_SLOT__";
13
+
14
+ /**
15
+ * Sentinel prefix for invisible style-position anchors retained in the AST.
16
+ *
17
+ * The suffix is the previously collected CSS text. Renderers must not emit
18
+ * these synthetic style elements.
19
+ */
20
+ export const STYLE_ANCHOR_PREFIX = "\0__STYLE_ANCHOR__";
package/src/index.ts CHANGED
@@ -113,7 +113,7 @@ export {
113
113
  export type { Diagnostic, DiagnosticSeverity, ParseResult } from "./diagnostic";
114
114
 
115
115
  // Constants
116
- export { STYLE_SLOT_PREFIX } from "./constants";
116
+ export { STYLE_ANCHOR_PREFIX, STYLE_SLOT_PREFIX } from "./constants";
117
117
 
118
118
  // CSS value definitions
119
119
  export type { CssLengthUnit } from "./css";
@@ -126,3 +126,6 @@ export type { WikitextMode, WikitextSettings } from "./settings";
126
126
  export { evaluateExpression, isTruthy, formatExprValue } from "./expr-eval";
127
127
  export type { ExprResult } from "./expr-eval";
128
128
  export { createSettings, DEFAULT_SETTINGS } from "./settings";
129
+
130
+ // Shared high-level pipeline page context
131
+ export type { WikitextPageContext, WikitextPageFile } from "./page-context";
@@ -0,0 +1,23 @@
1
+ /** Attachment metadata used by page-contextual gallery rendering. */
2
+ export interface WikitextPageFile {
3
+ name: string;
4
+ createdAt?: number;
5
+ }
6
+
7
+ /**
8
+ * Page data shared by high-level parser and renderer APIs.
9
+ *
10
+ * `fullName` is the category-qualified Wikidot page name. `unixName`, when
11
+ * available, is the separately named URL-safe page identifier.
12
+ */
13
+ export interface WikitextPageContext {
14
+ fullName: string;
15
+ unixName?: string;
16
+ tags: string[];
17
+ urlPath?: string;
18
+ site?: string;
19
+ domain?: string;
20
+ siteDomains?: Record<string, string>;
21
+ resolveSiteDomain?: (site: string) => string | null | undefined;
22
+ files?: WikitextPageFile[];
23
+ }