@crypto512/jicon-mcp 0.7.1 → 1.0.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/README.md +128 -395
- package/TOOL_LIST.md +810 -120
- package/dist/config/constants.d.ts +1 -0
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +1 -0
- package/dist/config/constants.js.map +1 -1
- package/dist/config/loader.d.ts +1 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +27 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/types.d.ts +8 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -1
- package/dist/confluence/client.d.ts +38 -0
- package/dist/confluence/client.d.ts.map +1 -1
- package/dist/confluence/client.js +117 -0
- package/dist/confluence/client.js.map +1 -1
- package/dist/confluence/tools.d.ts +102 -75
- package/dist/confluence/tools.d.ts.map +1 -1
- package/dist/confluence/tools.js +510 -151
- package/dist/confluence/tools.js.map +1 -1
- package/dist/confluence/types.d.ts +55 -1
- package/dist/confluence/types.d.ts.map +1 -1
- package/dist/index.js +88 -2
- package/dist/index.js.map +1 -1
- package/dist/jira/tools.d.ts +0 -5
- package/dist/jira/tools.d.ts.map +1 -1
- package/dist/jira/tools.js +40 -87
- package/dist/jira/tools.js.map +1 -1
- package/dist/permissions/filter.d.ts +5 -0
- package/dist/permissions/filter.d.ts.map +1 -1
- package/dist/permissions/filter.js +29 -12
- package/dist/permissions/filter.js.map +1 -1
- package/dist/permissions/tool-registry.d.ts +23 -25
- package/dist/permissions/tool-registry.d.ts.map +1 -1
- package/dist/permissions/tool-registry.js +41 -45
- package/dist/permissions/tool-registry.js.map +1 -1
- package/dist/permissions/write-home-validator.d.ts +35 -0
- package/dist/permissions/write-home-validator.d.ts.map +1 -0
- package/dist/permissions/write-home-validator.js +140 -0
- package/dist/permissions/write-home-validator.js.map +1 -0
- package/dist/tempo/tools.d.ts.map +1 -1
- package/dist/tempo/tools.js +43 -44
- package/dist/tempo/tools.js.map +1 -1
- package/dist/utils/buffer-tools.d.ts +119 -1
- package/dist/utils/buffer-tools.d.ts.map +1 -1
- package/dist/utils/buffer-tools.js +610 -3
- package/dist/utils/buffer-tools.js.map +1 -1
- package/dist/utils/content-buffer.d.ts +34 -0
- package/dist/utils/content-buffer.d.ts.map +1 -1
- package/dist/utils/content-buffer.js +79 -0
- package/dist/utils/content-buffer.js.map +1 -1
- package/dist/utils/http-client.d.ts.map +1 -1
- package/dist/utils/http-client.js +4 -4
- package/dist/utils/http-client.js.map +1 -1
- package/dist/utils/jicon-help.d.ts +29 -0
- package/dist/utils/jicon-help.d.ts.map +1 -0
- package/dist/utils/jicon-help.js +873 -0
- package/dist/utils/jicon-help.js.map +1 -0
- package/dist/utils/plantuml/client.d.ts +40 -0
- package/dist/utils/plantuml/client.d.ts.map +1 -0
- package/dist/utils/plantuml/client.js +306 -0
- package/dist/utils/plantuml/client.js.map +1 -0
- package/dist/utils/plantuml/docker-manager.d.ts +35 -0
- package/dist/utils/plantuml/docker-manager.d.ts.map +1 -0
- package/dist/utils/plantuml/docker-manager.js +280 -0
- package/dist/utils/plantuml/docker-manager.js.map +1 -0
- package/dist/utils/plantuml/index.d.ts +11 -0
- package/dist/utils/plantuml/index.d.ts.map +1 -0
- package/dist/utils/plantuml/index.js +16 -0
- package/dist/utils/plantuml/index.js.map +1 -0
- package/dist/utils/plantuml/service.d.ts +46 -0
- package/dist/utils/plantuml/service.d.ts.map +1 -0
- package/dist/utils/plantuml/service.js +96 -0
- package/dist/utils/plantuml/service.js.map +1 -0
- package/dist/utils/plantuml/tools.d.ts +65 -0
- package/dist/utils/plantuml/tools.d.ts.map +1 -0
- package/dist/utils/plantuml/tools.js +272 -0
- package/dist/utils/plantuml/tools.js.map +1 -0
- package/dist/utils/plantuml/types.d.ts +130 -0
- package/dist/utils/plantuml/types.d.ts.map +1 -0
- package/dist/utils/plantuml/types.js +66 -0
- package/dist/utils/plantuml/types.js.map +1 -0
- package/dist/utils/response-formatter.d.ts +14 -0
- package/dist/utils/response-formatter.d.ts.map +1 -1
- package/dist/utils/response-formatter.js +84 -1
- package/dist/utils/response-formatter.js.map +1 -1
- package/dist/utils/url-tools.d.ts +49 -0
- package/dist/utils/url-tools.d.ts.map +1 -0
- package/dist/utils/url-tools.js +141 -0
- package/dist/utils/url-tools.js.map +1 -0
- package/dist/utils/xhtml/confluence-schema.d.ts +55 -0
- package/dist/utils/xhtml/confluence-schema.d.ts.map +1 -0
- package/dist/utils/xhtml/confluence-schema.js +215 -0
- package/dist/utils/xhtml/confluence-schema.js.map +1 -0
- package/dist/utils/xhtml/index.d.ts +17 -0
- package/dist/utils/xhtml/index.d.ts.map +1 -0
- package/dist/utils/xhtml/index.js +21 -0
- package/dist/utils/xhtml/index.js.map +1 -0
- package/dist/utils/xhtml/operations.d.ts +100 -0
- package/dist/utils/xhtml/operations.d.ts.map +1 -0
- package/dist/utils/xhtml/operations.js +596 -0
- package/dist/utils/xhtml/operations.js.map +1 -0
- package/dist/utils/xhtml/parser.d.ts +64 -0
- package/dist/utils/xhtml/parser.d.ts.map +1 -0
- package/dist/utils/xhtml/parser.js +180 -0
- package/dist/utils/xhtml/parser.js.map +1 -0
- package/dist/utils/xhtml/plantuml.d.ts +112 -0
- package/dist/utils/xhtml/plantuml.d.ts.map +1 -0
- package/dist/utils/xhtml/plantuml.js +251 -0
- package/dist/utils/xhtml/plantuml.js.map +1 -0
- package/dist/utils/xhtml/selector.d.ts +35 -0
- package/dist/utils/xhtml/selector.d.ts.map +1 -0
- package/dist/utils/xhtml/selector.js +358 -0
- package/dist/utils/xhtml/selector.js.map +1 -0
- package/dist/utils/xhtml/serializer.d.ts +26 -0
- package/dist/utils/xhtml/serializer.d.ts.map +1 -0
- package/dist/utils/xhtml/serializer.js +170 -0
- package/dist/utils/xhtml/serializer.js.map +1 -0
- package/dist/utils/xhtml/types.d.ts +134 -0
- package/dist/utils/xhtml/types.d.ts.map +1 -0
- package/dist/utils/xhtml/types.js +65 -0
- package/dist/utils/xhtml/types.js.map +1 -0
- package/dist/utils/xhtml/validator.d.ts +67 -0
- package/dist/utils/xhtml/validator.d.ts.map +1 -0
- package/dist/utils/xhtml/validator.js +300 -0
- package/dist/utils/xhtml/validator.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL construction utility tools for MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Provides tools to convert Jira issue keys, Confluence page IDs,
|
|
5
|
+
* or relative paths into full URLs. Pure URL construction - no API calls.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
9
|
+
type InputType = "jira_issue" | "confluence_page_id" | "confluence_path" | "full_url" | "unknown";
|
|
10
|
+
export interface UrlConfig {
|
|
11
|
+
jiraUrl?: string;
|
|
12
|
+
confluenceUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Detect the type of input provided
|
|
16
|
+
* Exported for internal use by other tools
|
|
17
|
+
*/
|
|
18
|
+
export declare function detectInputType(input: string): InputType;
|
|
19
|
+
/**
|
|
20
|
+
* Build full URL from input
|
|
21
|
+
* Exported for internal use by other tools (e.g., draft tools)
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildUrl(input: string, type: InputType, config: UrlConfig): {
|
|
24
|
+
url: string;
|
|
25
|
+
service: string;
|
|
26
|
+
} | {
|
|
27
|
+
error: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Create URL tools with access to configuration
|
|
31
|
+
*/
|
|
32
|
+
export declare function createUrlTools(config: UrlConfig): {
|
|
33
|
+
fullurl: {
|
|
34
|
+
description: string;
|
|
35
|
+
inputSchema: z.ZodObject<{
|
|
36
|
+
input: z.ZodString;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
input: string;
|
|
39
|
+
}, {
|
|
40
|
+
input: string;
|
|
41
|
+
}>;
|
|
42
|
+
handler: (args: {
|
|
43
|
+
input: string;
|
|
44
|
+
}) => Promise<CallToolResult>;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare const URL_TOOLS: readonly ["fullurl"];
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=url-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-tools.d.ts","sourceRoot":"","sources":["../../src/utils/url-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAIzE,KAAK,SAAS,GACV,YAAY,GACZ,oBAAoB,GACpB,iBAAiB,GACjB,UAAU,GACV,SAAS,CAAC;AAGd,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAyBxD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,SAAS,GAChB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAuDtD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS;;;;;;;;;;wBAmBpB;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,KAAG,OAAO,CAAC,cAAc,CAAC;;EAoCtE;AAGD,eAAO,MAAM,SAAS,sBAAuB,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL construction utility tools for MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Provides tools to convert Jira issue keys, Confluence page IDs,
|
|
5
|
+
* or relative paths into full URLs. Pure URL construction - no API calls.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { formatSuccess, formatError } from "./response-formatter.js";
|
|
9
|
+
/**
|
|
10
|
+
* Detect the type of input provided
|
|
11
|
+
* Exported for internal use by other tools
|
|
12
|
+
*/
|
|
13
|
+
export function detectInputType(input) {
|
|
14
|
+
const trimmed = input.trim();
|
|
15
|
+
// Already a full URL
|
|
16
|
+
if (/^https?:\/\//i.test(trimmed)) {
|
|
17
|
+
return "full_url";
|
|
18
|
+
}
|
|
19
|
+
// Jira issue key: PROJECT-NUMBER (e.g., "PROJ-123", "ABC-1", "A2B-456")
|
|
20
|
+
// Project key: 2+ alphanumeric starting with letter, followed by dash and numbers
|
|
21
|
+
if (/^[A-Z][A-Z0-9]+-\d+$/i.test(trimmed)) {
|
|
22
|
+
return "jira_issue";
|
|
23
|
+
}
|
|
24
|
+
// Confluence relative path: starts with "/"
|
|
25
|
+
if (trimmed.startsWith("/")) {
|
|
26
|
+
return "confluence_path";
|
|
27
|
+
}
|
|
28
|
+
// Confluence page ID: pure numeric
|
|
29
|
+
if (/^\d+$/.test(trimmed)) {
|
|
30
|
+
return "confluence_page_id";
|
|
31
|
+
}
|
|
32
|
+
return "unknown";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build full URL from input
|
|
36
|
+
* Exported for internal use by other tools (e.g., draft tools)
|
|
37
|
+
*/
|
|
38
|
+
export function buildUrl(input, type, config) {
|
|
39
|
+
const trimmed = input.trim();
|
|
40
|
+
switch (type) {
|
|
41
|
+
case "full_url":
|
|
42
|
+
return { url: trimmed, service: "passthrough" };
|
|
43
|
+
case "jira_issue":
|
|
44
|
+
if (!config.jiraUrl) {
|
|
45
|
+
return { error: "Jira is not configured. Cannot construct Jira URLs." };
|
|
46
|
+
}
|
|
47
|
+
// Normalize to uppercase
|
|
48
|
+
const issueKey = trimmed.toUpperCase();
|
|
49
|
+
const jiraBase = config.jiraUrl.replace(/\/$/, "");
|
|
50
|
+
return {
|
|
51
|
+
url: `${jiraBase}/browse/${issueKey}`,
|
|
52
|
+
service: "jira",
|
|
53
|
+
};
|
|
54
|
+
case "confluence_page_id":
|
|
55
|
+
if (!config.confluenceUrl) {
|
|
56
|
+
return {
|
|
57
|
+
error: "Confluence is not configured. Cannot construct Confluence URLs.",
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const confBaseId = config.confluenceUrl.replace(/\/$/, "");
|
|
61
|
+
return {
|
|
62
|
+
url: `${confBaseId}/pages/viewpage.action?pageId=${trimmed}`,
|
|
63
|
+
service: "confluence",
|
|
64
|
+
};
|
|
65
|
+
case "confluence_path":
|
|
66
|
+
if (!config.confluenceUrl) {
|
|
67
|
+
return {
|
|
68
|
+
error: "Confluence is not configured. Cannot construct Confluence URLs.",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// Ensure path starts with / but base URL doesn't end with /
|
|
72
|
+
const confBase = config.confluenceUrl.replace(/\/$/, "");
|
|
73
|
+
const path = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
74
|
+
return {
|
|
75
|
+
url: `${confBase}${path}`,
|
|
76
|
+
service: "confluence",
|
|
77
|
+
};
|
|
78
|
+
case "unknown":
|
|
79
|
+
default:
|
|
80
|
+
return {
|
|
81
|
+
error: `Unable to detect input type for: "${trimmed}". Expected formats:\n` +
|
|
82
|
+
`- Jira issue key: PROJ-123\n` +
|
|
83
|
+
`- Confluence page ID: 123456\n` +
|
|
84
|
+
`- Confluence path: /display/SPACE/Page`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create URL tools with access to configuration
|
|
90
|
+
*/
|
|
91
|
+
export function createUrlTools(config) {
|
|
92
|
+
return {
|
|
93
|
+
fullurl: {
|
|
94
|
+
description: `Generate clickable URLs for user to view content in browser.
|
|
95
|
+
|
|
96
|
+
USE FOR: Displaying links to users so they can click and view Jira issues or Confluence pages.
|
|
97
|
+
DO NOT USE FOR: Writing links inside Confluence pages or Jira descriptions - use relative links instead.
|
|
98
|
+
|
|
99
|
+
USAGE (parameter name is 'input'):
|
|
100
|
+
fullurl(input="PROJ-123") -> Jira issue URL
|
|
101
|
+
fullurl(input="123456") -> Confluence page URL
|
|
102
|
+
fullurl(input="/display/DOCS/Home") -> Confluence path URL`,
|
|
103
|
+
inputSchema: z.object({
|
|
104
|
+
input: z
|
|
105
|
+
.string()
|
|
106
|
+
.describe('Jira issue key (e.g., "PROJ-123"), Confluence page ID (numeric), or Confluence relative path (starts with "/")'),
|
|
107
|
+
}),
|
|
108
|
+
handler: async (args) => {
|
|
109
|
+
const { input } = args;
|
|
110
|
+
// Validate input
|
|
111
|
+
if (!input || input.trim() === "") {
|
|
112
|
+
return formatError({
|
|
113
|
+
error: true,
|
|
114
|
+
message: "Input is required. Provide a Jira issue key, Confluence page ID, or relative path.",
|
|
115
|
+
statusCode: 400,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
// Detect type
|
|
119
|
+
const inputType = detectInputType(input);
|
|
120
|
+
// Build URL
|
|
121
|
+
const result = buildUrl(input, inputType, config);
|
|
122
|
+
if ("error" in result) {
|
|
123
|
+
return formatError({
|
|
124
|
+
error: true,
|
|
125
|
+
message: result.error,
|
|
126
|
+
statusCode: 400,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return formatSuccess({
|
|
130
|
+
input: input.trim(),
|
|
131
|
+
detectedType: inputType,
|
|
132
|
+
service: result.service,
|
|
133
|
+
url: result.url,
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// Tool names for registry
|
|
140
|
+
export const URL_TOOLS = ["fullurl"];
|
|
141
|
+
//# sourceMappingURL=url-tools.js.map
|
|
@@ -0,0 +1 @@
|
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Storage Format Schema
|
|
3
|
+
*
|
|
4
|
+
* Defines known Confluence elements, macros, and their validation rules.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Element definition with required and optional attributes
|
|
8
|
+
*/
|
|
9
|
+
export interface ElementDef {
|
|
10
|
+
required?: string[];
|
|
11
|
+
optional?: string[];
|
|
12
|
+
children?: string[];
|
|
13
|
+
validValues?: Record<string, string[]>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Known Confluence elements (ac: namespace)
|
|
17
|
+
*/
|
|
18
|
+
export declare const CONFLUENCE_ELEMENTS: Record<string, ElementDef>;
|
|
19
|
+
/**
|
|
20
|
+
* Known Resource Identifiers (ri: namespace)
|
|
21
|
+
*/
|
|
22
|
+
export declare const RESOURCE_IDENTIFIERS: Record<string, ElementDef>;
|
|
23
|
+
/**
|
|
24
|
+
* Known macro names for ac:structured-macro
|
|
25
|
+
*/
|
|
26
|
+
export declare const KNOWN_MACROS: Set<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Standard HTML elements allowed in Confluence storage format
|
|
29
|
+
*/
|
|
30
|
+
export declare const STANDARD_HTML_ELEMENTS: Set<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Check if an element is a known Confluence element
|
|
33
|
+
*/
|
|
34
|
+
export declare function isConfluenceElement(tagName: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Check if an element is a standard HTML element
|
|
37
|
+
*/
|
|
38
|
+
export declare function isStandardHtmlElement(tagName: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a macro name is known
|
|
41
|
+
*/
|
|
42
|
+
export declare function isKnownMacro(macroName: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Get the definition for a Confluence element
|
|
45
|
+
*/
|
|
46
|
+
export declare function getElementDef(tagName: string): ElementDef | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Get required attributes for an element
|
|
49
|
+
*/
|
|
50
|
+
export declare function getRequiredAttributes(tagName: string): string[];
|
|
51
|
+
/**
|
|
52
|
+
* Get valid values for an attribute
|
|
53
|
+
*/
|
|
54
|
+
export declare function getValidAttributeValues(tagName: string, attrName: string): string[] | undefined;
|
|
55
|
+
//# sourceMappingURL=confluence-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confluence-schema.d.ts","sourceRoot":"","sources":["../../../src/utils/xhtml/confluence-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAsE1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA0B3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,aAsDvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB,aAsBjC,CAAC;AAEH;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG5D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAGrE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAG/D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAG/F"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Confluence Storage Format Schema
|
|
3
|
+
*
|
|
4
|
+
* Defines known Confluence elements, macros, and their validation rules.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Known Confluence elements (ac: namespace)
|
|
8
|
+
*/
|
|
9
|
+
export const CONFLUENCE_ELEMENTS = {
|
|
10
|
+
// Structured macros
|
|
11
|
+
"ac:structured-macro": {
|
|
12
|
+
required: ["ac:name"],
|
|
13
|
+
optional: ["ac:schema-version", "ac:macro-id"],
|
|
14
|
+
},
|
|
15
|
+
"ac:parameter": {
|
|
16
|
+
required: ["ac:name"],
|
|
17
|
+
},
|
|
18
|
+
"ac:plain-text-body": {},
|
|
19
|
+
"ac:rich-text-body": {},
|
|
20
|
+
// Layouts
|
|
21
|
+
"ac:layout": {
|
|
22
|
+
children: ["ac:layout-section"],
|
|
23
|
+
},
|
|
24
|
+
"ac:layout-section": {
|
|
25
|
+
required: ["ac:type"],
|
|
26
|
+
validValues: {
|
|
27
|
+
"ac:type": [
|
|
28
|
+
"single",
|
|
29
|
+
"two_equal",
|
|
30
|
+
"two_left_sidebar",
|
|
31
|
+
"two_right_sidebar",
|
|
32
|
+
"three_equal",
|
|
33
|
+
"three_with_sidebars",
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
children: ["ac:layout-cell"],
|
|
37
|
+
},
|
|
38
|
+
"ac:layout-cell": {},
|
|
39
|
+
// Task lists
|
|
40
|
+
"ac:task-list": {
|
|
41
|
+
children: ["ac:task"],
|
|
42
|
+
},
|
|
43
|
+
"ac:task": {
|
|
44
|
+
children: ["ac:task-status", "ac:task-body"],
|
|
45
|
+
},
|
|
46
|
+
"ac:task-status": {
|
|
47
|
+
validValues: {
|
|
48
|
+
_text: ["incomplete", "complete"],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
"ac:task-body": {},
|
|
52
|
+
// Links
|
|
53
|
+
"ac:link": {
|
|
54
|
+
optional: ["ac:anchor", "ac:card-appearance"],
|
|
55
|
+
},
|
|
56
|
+
"ac:plain-text-link-body": {},
|
|
57
|
+
// Images
|
|
58
|
+
"ac:image": {
|
|
59
|
+
optional: ["ac:align", "ac:width", "ac:height", "ac:border", "ac:thumbnail", "ac:alt", "ac:title"],
|
|
60
|
+
},
|
|
61
|
+
// Emoticons
|
|
62
|
+
"ac:emoticon": {
|
|
63
|
+
required: ["ac:name"],
|
|
64
|
+
validValues: {
|
|
65
|
+
"ac:name": [
|
|
66
|
+
"smile", "sad", "cheeky", "laugh", "wink",
|
|
67
|
+
"thumbs-up", "thumbs-down", "tick", "cross",
|
|
68
|
+
"warning", "information", "plus", "minus",
|
|
69
|
+
"question", "light-on", "light-off", "yellow-star",
|
|
70
|
+
"red-star", "green-star", "blue-star",
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Known Resource Identifiers (ri: namespace)
|
|
77
|
+
*/
|
|
78
|
+
export const RESOURCE_IDENTIFIERS = {
|
|
79
|
+
"ri:page": {
|
|
80
|
+
required: ["ri:content-title"],
|
|
81
|
+
optional: ["ri:space-key"],
|
|
82
|
+
},
|
|
83
|
+
"ri:attachment": {
|
|
84
|
+
required: ["ri:filename"],
|
|
85
|
+
optional: ["ri:space-key", "ri:content-title"],
|
|
86
|
+
},
|
|
87
|
+
"ri:blog-post": {
|
|
88
|
+
required: ["ri:content-title", "ri:posting-day"],
|
|
89
|
+
optional: ["ri:space-key"],
|
|
90
|
+
},
|
|
91
|
+
"ri:user": {
|
|
92
|
+
optional: ["ri:userkey", "ri:username"],
|
|
93
|
+
},
|
|
94
|
+
"ri:url": {
|
|
95
|
+
required: ["ri:value"],
|
|
96
|
+
},
|
|
97
|
+
"ri:shortcut": {
|
|
98
|
+
required: ["ri:key"],
|
|
99
|
+
optional: ["ri:parameter"],
|
|
100
|
+
},
|
|
101
|
+
"ri:space": {
|
|
102
|
+
required: ["ri:space-key"],
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Known macro names for ac:structured-macro
|
|
107
|
+
*/
|
|
108
|
+
export const KNOWN_MACROS = new Set([
|
|
109
|
+
// Diagrams
|
|
110
|
+
"plantuml",
|
|
111
|
+
"drawio",
|
|
112
|
+
"gliffy",
|
|
113
|
+
"lucidchart",
|
|
114
|
+
// Code
|
|
115
|
+
"code",
|
|
116
|
+
"noformat",
|
|
117
|
+
// Info boxes
|
|
118
|
+
"info",
|
|
119
|
+
"warning",
|
|
120
|
+
"note",
|
|
121
|
+
"tip",
|
|
122
|
+
"expand",
|
|
123
|
+
"panel",
|
|
124
|
+
// Navigation
|
|
125
|
+
"toc",
|
|
126
|
+
"toc-zone",
|
|
127
|
+
"anchor",
|
|
128
|
+
"children",
|
|
129
|
+
"pagetree",
|
|
130
|
+
"pagetreesearch",
|
|
131
|
+
// Content
|
|
132
|
+
"excerpt",
|
|
133
|
+
"excerpt-include",
|
|
134
|
+
"include",
|
|
135
|
+
"recently-updated",
|
|
136
|
+
"content-by-label",
|
|
137
|
+
// Media
|
|
138
|
+
"gallery",
|
|
139
|
+
"viewfile",
|
|
140
|
+
"widget",
|
|
141
|
+
// Layout
|
|
142
|
+
"section",
|
|
143
|
+
"column",
|
|
144
|
+
// User
|
|
145
|
+
"profile",
|
|
146
|
+
"profile-picture",
|
|
147
|
+
"user-list",
|
|
148
|
+
// Other
|
|
149
|
+
"jira",
|
|
150
|
+
"status",
|
|
151
|
+
"divider",
|
|
152
|
+
"html",
|
|
153
|
+
"cheese", // For testing
|
|
154
|
+
]);
|
|
155
|
+
/**
|
|
156
|
+
* Standard HTML elements allowed in Confluence storage format
|
|
157
|
+
*/
|
|
158
|
+
export const STANDARD_HTML_ELEMENTS = new Set([
|
|
159
|
+
// Structure
|
|
160
|
+
"p", "div", "span", "br", "hr",
|
|
161
|
+
// Headings
|
|
162
|
+
"h1", "h2", "h3", "h4", "h5", "h6",
|
|
163
|
+
// Text formatting
|
|
164
|
+
"strong", "b", "em", "i", "u", "s", "strike", "del",
|
|
165
|
+
"sub", "sup", "code", "pre", "blockquote",
|
|
166
|
+
// Lists
|
|
167
|
+
"ul", "ol", "li",
|
|
168
|
+
// Tables
|
|
169
|
+
"table", "tbody", "thead", "tfoot", "tr", "th", "td",
|
|
170
|
+
// Links and media
|
|
171
|
+
"a", "img",
|
|
172
|
+
// Other
|
|
173
|
+
"time",
|
|
174
|
+
]);
|
|
175
|
+
/**
|
|
176
|
+
* Check if an element is a known Confluence element
|
|
177
|
+
*/
|
|
178
|
+
export function isConfluenceElement(tagName) {
|
|
179
|
+
const lower = tagName.toLowerCase();
|
|
180
|
+
return lower in CONFLUENCE_ELEMENTS || lower in RESOURCE_IDENTIFIERS;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Check if an element is a standard HTML element
|
|
184
|
+
*/
|
|
185
|
+
export function isStandardHtmlElement(tagName) {
|
|
186
|
+
return STANDARD_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Check if a macro name is known
|
|
190
|
+
*/
|
|
191
|
+
export function isKnownMacro(macroName) {
|
|
192
|
+
return KNOWN_MACROS.has(macroName.toLowerCase());
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get the definition for a Confluence element
|
|
196
|
+
*/
|
|
197
|
+
export function getElementDef(tagName) {
|
|
198
|
+
const lower = tagName.toLowerCase();
|
|
199
|
+
return CONFLUENCE_ELEMENTS[lower] || RESOURCE_IDENTIFIERS[lower];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get required attributes for an element
|
|
203
|
+
*/
|
|
204
|
+
export function getRequiredAttributes(tagName) {
|
|
205
|
+
const def = getElementDef(tagName);
|
|
206
|
+
return def?.required || [];
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Get valid values for an attribute
|
|
210
|
+
*/
|
|
211
|
+
export function getValidAttributeValues(tagName, attrName) {
|
|
212
|
+
const def = getElementDef(tagName);
|
|
213
|
+
return def?.validValues?.[attrName];
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=confluence-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confluence-schema.js","sourceRoot":"","sources":["../../../src/utils/xhtml/confluence-schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA+B;IAC7D,oBAAoB;IACpB,qBAAqB,EAAE;QACrB,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,QAAQ,EAAE,CAAC,mBAAmB,EAAE,aAAa,CAAC;KAC/C;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;IACD,oBAAoB,EAAE,EAAE;IACxB,mBAAmB,EAAE,EAAE;IAEvB,UAAU;IACV,WAAW,EAAE;QACX,QAAQ,EAAE,CAAC,mBAAmB,CAAC;KAChC;IACD,mBAAmB,EAAE;QACnB,QAAQ,EAAE,CAAC,SAAS,CAAC;QACrB,WAAW,EAAE;YACX,SAAS,EAAE;gBACT,QAAQ;gBACR,WAAW;gBACX,kBAAkB;gBAClB,mBAAmB;gBACnB,aAAa;gBACb,qBAAqB;aACtB;SACF;QACD,QAAQ,EAAE,CAAC,gBAAgB,CAAC;KAC7B;IACD,gBAAgB,EAAE,EAAE;IAEpB,aAAa;IACb,cAAc,EAAE;QACd,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,CAAC,gBAAgB,EAAE,cAAc,CAAC;KAC7C;IACD,gBAAgB,EAAE;QAChB,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,YAAY,EAAE,UAAU,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4
|
+
* Provides structure-aware manipulation of Confluence storage format content.
|
|
5
|
+
*/
|
|
6
|
+
export type { Position, Operation, SemanticPosition, BufferEditXhtmlArgs, ValidationError, ValidationWarning, ValidationResult, XhtmlEditSuccess, XhtmlEditError, XhtmlEditResult, PlantUmlValidationResult, ParseResult, SelectorMatch, SelectorResult, } from "./types.js";
|
|
7
|
+
export { PositionSchema, OperationSchema, SemanticPositionSchema, BufferEditXhtmlSchema, } from "./types.js";
|
|
8
|
+
export { parseXhtml, getContentRoot, isValidXhtml, wrapWithNamespaces, CONFLUENCE_NAMESPACES, } from "./parser.js";
|
|
9
|
+
export { serializeXhtml, serializeFragment, prettyPrint, } from "./serializer.js";
|
|
10
|
+
export { querySelector, isValidSelector, describeSelector, findUnsupportedPseudo, } from "./selector.js";
|
|
11
|
+
export { executeOperation, executeInsert, executeUpdate, executeRemove, executeMoveOperation, executeWrap, resolveSemanticPosition, } from "./operations.js";
|
|
12
|
+
export { validateXhtml, validateXhtmlAsync, isValid, formatValidationErrors, formatValidationWarnings, getValidationReport, } from "./validator.js";
|
|
13
|
+
export type { AsyncValidationResult, PlantUmlValidationInfo } from "./validator.js";
|
|
14
|
+
export { CONFLUENCE_ELEMENTS, RESOURCE_IDENTIFIERS, KNOWN_MACROS, STANDARD_HTML_ELEMENTS, isConfluenceElement, isStandardHtmlElement, isKnownMacro, getElementDef, getRequiredAttributes, getValidAttributeValues, } from "./confluence-schema.js";
|
|
15
|
+
export { validatePlantUml, normalizePlantUml, extractDiagramContent, buildPlantUmlMacro, validateAndBuildPlantUmlMacro, generateMacroId, extractPlantUmlFromMacro, extractPlantUmlFromMacroWithError, updatePlantUmlInMacro, } from "./plantuml.js";
|
|
16
|
+
export type { PlantUmlExtractionResult } from "./plantuml.js";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/xhtml/index.ts"],"names":[],"mappings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AY,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XHTML Buffer Editing Module
|
|
3
|
+
*
|
|
4
|
+
* Provides structure-aware manipulation of Confluence storage format content.
|
|
5
|
+
*/
|
|
6
|
+
export { PositionSchema, OperationSchema, SemanticPositionSchema, BufferEditXhtmlSchema, } from "./types.js";
|
|
7
|
+
// Parser
|
|
8
|
+
export { parseXhtml, getContentRoot, isValidXhtml, wrapWithNamespaces, CONFLUENCE_NAMESPACES, } from "./parser.js";
|
|
9
|
+
// Serializer
|
|
10
|
+
export { serializeXhtml, serializeFragment, prettyPrint, } from "./serializer.js";
|
|
11
|
+
// Selector
|
|
12
|
+
export { querySelector, isValidSelector, describeSelector, findUnsupportedPseudo, } from "./selector.js";
|
|
13
|
+
// Operations
|
|
14
|
+
export { executeOperation, executeInsert, executeUpdate, executeRemove, executeMoveOperation, executeWrap, resolveSemanticPosition, } from "./operations.js";
|
|
15
|
+
// Validator
|
|
16
|
+
export { validateXhtml, validateXhtmlAsync, isValid, formatValidationErrors, formatValidationWarnings, getValidationReport, } from "./validator.js";
|
|
17
|
+
// Confluence Schema
|
|
18
|
+
export { CONFLUENCE_ELEMENTS, RESOURCE_IDENTIFIERS, KNOWN_MACROS, STANDARD_HTML_ELEMENTS, isConfluenceElement, isStandardHtmlElement, isKnownMacro, getElementDef, getRequiredAttributes, getValidAttributeValues, } from "./confluence-schema.js";
|
|
19
|
+
// PlantUML
|
|
20
|
+
export { validatePlantUml, normalizePlantUml, extractDiagramContent, buildPlantUmlMacro, validateAndBuildPlantUmlMacro, generateMacroId, extractPlantUmlFromMacro, extractPlantUmlFromMacroWithError, updatePlantUmlInMacro, } from "./plantuml.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/xhtml/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoBH,OAAO,EACL,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,SAAS;AACT,OAAO,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,aAAa;AACb,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAEzB,WAAW;AACX,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,aAAa;AACb,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,YAAY;AACZ,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,OAAO,EACP,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAGxB,oBAAoB;AACpB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,WAAW;AACX,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,wBAAwB,EACxB,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XHTML DOM Operations
|
|
3
|
+
*
|
|
4
|
+
* Implements insert, update, remove, move, and wrap operations
|
|
5
|
+
* for Confluence storage format manipulation.
|
|
6
|
+
*/
|
|
7
|
+
import type { Document, Element } from "linkedom";
|
|
8
|
+
import type { Position, Operation, SemanticPosition, XhtmlEditSuccess, XhtmlEditError, SelectorMatch } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a semantic position to a selector and position
|
|
11
|
+
*
|
|
12
|
+
* @param document - The parsed XHTML document
|
|
13
|
+
* @param semanticPosition - The semantic position to resolve
|
|
14
|
+
* @returns Resolved selector and position, or null if not found
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveSemanticPosition(document: Document, semanticPosition: SemanticPosition): {
|
|
17
|
+
selector: string;
|
|
18
|
+
position: Position;
|
|
19
|
+
element: Element;
|
|
20
|
+
} | null;
|
|
21
|
+
/**
|
|
22
|
+
* Operation context
|
|
23
|
+
*/
|
|
24
|
+
interface OperationContext {
|
|
25
|
+
document: Document;
|
|
26
|
+
matches: SelectorMatch[];
|
|
27
|
+
matchIndex?: number;
|
|
28
|
+
matchAll?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Execute an insert operation
|
|
32
|
+
*/
|
|
33
|
+
export declare function executeInsert(context: OperationContext, position: Position, content: string): XhtmlEditSuccess | XhtmlEditError;
|
|
34
|
+
/**
|
|
35
|
+
* Execute an update operation
|
|
36
|
+
*/
|
|
37
|
+
export declare function executeUpdate(context: OperationContext, content?: string, attributes?: Record<string, string>): XhtmlEditSuccess | XhtmlEditError;
|
|
38
|
+
/**
|
|
39
|
+
* Execute a remove operation
|
|
40
|
+
*/
|
|
41
|
+
export declare function executeRemove(context: OperationContext): XhtmlEditSuccess | XhtmlEditError;
|
|
42
|
+
/**
|
|
43
|
+
* Execute a move operation
|
|
44
|
+
*/
|
|
45
|
+
export declare function executeMoveOperation(context: OperationContext, targetSelector: string, position: Position): XhtmlEditSuccess | XhtmlEditError;
|
|
46
|
+
/**
|
|
47
|
+
* Execute a wrap operation
|
|
48
|
+
*/
|
|
49
|
+
export declare function executeWrap(context: OperationContext, wrapperContent: string): XhtmlEditSuccess | XhtmlEditError;
|
|
50
|
+
/**
|
|
51
|
+
* Convenience wrapper: Insert element
|
|
52
|
+
*/
|
|
53
|
+
export declare function insertElement(document: Document, selector: string, position: Position, content: string, options?: {
|
|
54
|
+
matchIndex?: number;
|
|
55
|
+
matchAll?: boolean;
|
|
56
|
+
}): XhtmlEditSuccess | XhtmlEditError;
|
|
57
|
+
/**
|
|
58
|
+
* Convenience wrapper: Update element
|
|
59
|
+
*/
|
|
60
|
+
export declare function updateElement(document: Document, selector: string, updates: {
|
|
61
|
+
content?: string;
|
|
62
|
+
attributes?: Record<string, string>;
|
|
63
|
+
}, options?: {
|
|
64
|
+
matchIndex?: number;
|
|
65
|
+
matchAll?: boolean;
|
|
66
|
+
}): XhtmlEditSuccess | XhtmlEditError;
|
|
67
|
+
/**
|
|
68
|
+
* Convenience wrapper: Remove element
|
|
69
|
+
*/
|
|
70
|
+
export declare function removeElement(document: Document, selector: string, options?: {
|
|
71
|
+
matchIndex?: number;
|
|
72
|
+
matchAll?: boolean;
|
|
73
|
+
}): XhtmlEditSuccess | XhtmlEditError;
|
|
74
|
+
/**
|
|
75
|
+
* Convenience wrapper: Move element
|
|
76
|
+
*/
|
|
77
|
+
export declare function moveElement(document: Document, selector: string, targetSelector: string, position: Position, options?: {
|
|
78
|
+
matchIndex?: number;
|
|
79
|
+
matchAll?: boolean;
|
|
80
|
+
}): XhtmlEditSuccess | XhtmlEditError;
|
|
81
|
+
/**
|
|
82
|
+
* Convenience wrapper: Wrap element
|
|
83
|
+
*/
|
|
84
|
+
export declare function wrapElement(document: Document, selector: string, wrapperContent: string, options?: {
|
|
85
|
+
matchIndex?: number;
|
|
86
|
+
matchAll?: boolean;
|
|
87
|
+
}): XhtmlEditSuccess | XhtmlEditError;
|
|
88
|
+
/**
|
|
89
|
+
* Execute an XHTML edit operation
|
|
90
|
+
*/
|
|
91
|
+
export declare function executeOperation(document: Document, operation: Operation, selector: string, options: {
|
|
92
|
+
position?: Position;
|
|
93
|
+
content?: string;
|
|
94
|
+
attributes?: Record<string, string>;
|
|
95
|
+
targetSelector?: string;
|
|
96
|
+
matchIndex?: number;
|
|
97
|
+
matchAll?: boolean;
|
|
98
|
+
}): XhtmlEditSuccess | XhtmlEditError;
|
|
99
|
+
export {};
|
|
100
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/utils/xhtml/operations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAQ,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAmBzH;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,GACjC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAiGnE;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAwHD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GACd,gBAAgB,GAAG,cAAc,CAoCnC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,gBAAgB,GAAG,cAAc,CA+CnC;AAED;;GAEG;AACH,wBAA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