@oxide/react-asciidoc 0.2.8 → 0.2.9--canary.c5bf581.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.
@@ -0,0 +1,142 @@
1
+ import type * as AdocTypes from '@asciidoctor/core';
2
+ type NodeType = 'audio' | 'admonition' | 'colist' | 'cell' | 'dlist' | 'document' | 'embedded' | 'example' | 'floating_title' | 'image' | 'inline_anchor' | 'inline_break' | 'inline_button' | 'inline_callout' | 'inline_footnote' | 'inline_image' | 'inline_kbd' | 'inline_menu' | 'inline_quoted' | 'listing' | 'list_item' | 'literal' | 'olist' | 'open' | 'outline' | 'page_break' | 'paragraph' | 'pass' | 'preamble' | 'quote' | 'section' | 'sidebar' | 'stem' | 'table' | 'table_cell' | 'thematic_break' | 'toc' | 'ulist' | 'verse' | 'video';
3
+ type ContentModel = 'compound' | 'simple' | 'verbatim' | 'raw' | 'empty';
4
+ export type BaseBlock = {
5
+ id: string;
6
+ type: NodeType;
7
+ blocks: Block[];
8
+ content: string | undefined;
9
+ attributes: Record<string, string>;
10
+ contentModel: ContentModel | undefined;
11
+ lineNumber: number | undefined;
12
+ style: string | undefined;
13
+ role: string | undefined;
14
+ title: string | undefined;
15
+ level: number;
16
+ };
17
+ export type Block = BaseBlock | ParagraphBlock | AdmonitionBlock | CoListBlock | ImageBlock | LiteralBlock | SectionBlock | TableBlock;
18
+ export type DocumentSection = {
19
+ id: string;
20
+ title: string;
21
+ level: number;
22
+ num: string;
23
+ sections: DocumentSection[];
24
+ };
25
+ export type DocumentBlock = {
26
+ type: 'document';
27
+ title: string;
28
+ hasHeader: boolean;
29
+ noHeader: boolean;
30
+ attributes: Record<string, string>;
31
+ blocks: Block[];
32
+ contentModel: ContentModel | undefined;
33
+ footnotes: {
34
+ text: string | undefined;
35
+ index: number | undefined;
36
+ }[];
37
+ sections: DocumentSection[];
38
+ authors: {
39
+ name: string | undefined;
40
+ email: string | undefined;
41
+ }[];
42
+ };
43
+ export interface ParagraphBlock extends BaseBlock {
44
+ type: 'paragraph';
45
+ }
46
+ export interface AdmonitionBlock extends BaseBlock {
47
+ type: 'admonition';
48
+ iconUri: string;
49
+ }
50
+ export interface AudioBlock extends BaseBlock {
51
+ type: 'audio';
52
+ mediaUri: string;
53
+ autoplay: boolean;
54
+ noControls: boolean;
55
+ loop: boolean;
56
+ }
57
+ export interface ImageBlock extends BaseBlock {
58
+ type: 'image';
59
+ imageUri: string;
60
+ }
61
+ export interface ListItemBlock extends BaseBlock {
62
+ text: string | undefined;
63
+ }
64
+ export interface ListBlock extends BaseBlock {
65
+ items: ListItemBlock[];
66
+ }
67
+ export interface CoListBlock extends ListBlock {
68
+ type: 'colist';
69
+ }
70
+ export interface DListBlock extends BaseBlock {
71
+ type: 'dlist';
72
+ items: (ListItemBlock | ListItemBlock[])[][];
73
+ }
74
+ export interface LiteralBlock extends BaseBlock {
75
+ type: 'listing';
76
+ source: string;
77
+ language: string | undefined;
78
+ }
79
+ export interface SectionBlock extends BaseBlock {
80
+ type: 'section';
81
+ level: number;
82
+ numbered: boolean;
83
+ title: string;
84
+ num: string;
85
+ name: string;
86
+ }
87
+ export interface TableBlock extends BaseBlock {
88
+ caption: string;
89
+ columns: Column[];
90
+ rows: Row;
91
+ headRows: Cell[][];
92
+ bodyRows: Cell[][];
93
+ footRows: Cell[][];
94
+ hasHeader: boolean;
95
+ hasFooter: boolean;
96
+ hasAutowidth: boolean;
97
+ }
98
+ export type Column = {
99
+ attributes: Record<string, string>;
100
+ columnNumber: number;
101
+ width: string | undefined;
102
+ horizontalAlign: string | undefined;
103
+ verticalAlign: string | undefined;
104
+ style: string | undefined;
105
+ };
106
+ export type Row = {
107
+ head: Cell[][];
108
+ body: Cell[][];
109
+ foot: Cell[][];
110
+ };
111
+ export interface Cell extends BaseBlock {
112
+ type: NodeType;
113
+ attributes: Record<string, string>;
114
+ columnSpan: number | undefined;
115
+ rowSpan: number | undefined;
116
+ content: string | undefined;
117
+ text: string;
118
+ source: string;
119
+ lines: string[];
120
+ lineNumber: number | undefined;
121
+ style: string | undefined;
122
+ column: Column | undefined;
123
+ width: string | undefined;
124
+ columnPercentageWidth: string | undefined;
125
+ }
126
+ /**
127
+ * A convenience method to check if the specified option attribute is enabled on the current node.
128
+ * Check if the option is enabled. This method simply checks to see if the <name>-option attribute is defined on the current node.
129
+ */
130
+ export declare const isOption: (attrs: Record<string, string>, option: string) => boolean;
131
+ /**
132
+ * Get the value of the specified attribute.
133
+ * If the attribute is not found on this node, fallback_name is set, and this node is not the Document node, get the value of the specified attribute from the Document node.
134
+ *
135
+ * Look for the specified attribute in the attributes on this node and return the value of the attribute, if found.
136
+ * Otherwise, if fallback_name is set (default: same as name) and documentAttrs is included, look for that attribute on the Document node and return its value, if found.
137
+ * Otherwise, return the default value (default: undefined).
138
+ */
139
+ export declare const getAttribute: (attrs: Record<string, string>, name: string, defaultValue?: any, fallbackName?: string, documentAttrs?: Record<string, string>) => any;
140
+ export declare const hasAttribute: (attrs: Record<string, string>, name: string) => boolean;
141
+ export declare const prepareDocument: (document: AdocTypes.Document) => DocumentBlock;
142
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxide/react-asciidoc",
3
- "version": "0.2.8",
3
+ "version": "0.2.9--canary.c5bf581.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -33,7 +33,6 @@
33
33
  "author": "Oxide Computer Company <bots@oxidecomputer.com>",
34
34
  "license": "MPL 2.0",
35
35
  "dependencies": {
36
- "@asciidoctor/core": "^3.0.2",
37
36
  "classnames": "^2.3.2",
38
37
  "highlight.js": "^11.6.0",
39
38
  "html-react-parser": "^4.2.2",
@@ -41,6 +40,7 @@
41
40
  "vitest": "^0.24.3"
42
41
  },
43
42
  "devDependencies": {
43
+ "@asciidoctor/core": "^3.0.2",
44
44
  "@playwright/test": "^1.27.1",
45
45
  "@trivago/prettier-plugin-sort-imports": "^3.3.0",
46
46
  "@types/node": "^18.15.11",