react-native-nitro-markdown 0.4.2 → 0.5.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 +605 -318
- package/android/src/main/java/com/margelo/nitro/com/nitromarkdown/HybridMarkdownSession.kt +27 -8
- package/cpp/bindings/HybridMarkdownParser.cpp +216 -66
- package/cpp/bindings/HybridMarkdownParser.hpp +2 -0
- package/ios/HybridMarkdownSession.swift +33 -7
- package/lib/commonjs/MarkdownContext.js +2 -1
- package/lib/commonjs/MarkdownContext.js.map +1 -1
- package/lib/commonjs/headless.js +41 -5
- package/lib/commonjs/headless.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/markdown-stream.js +109 -13
- package/lib/commonjs/markdown-stream.js.map +1 -1
- package/lib/commonjs/markdown.js +215 -44
- package/lib/commonjs/markdown.js.map +1 -1
- package/lib/commonjs/renderers/code.js +4 -3
- package/lib/commonjs/renderers/code.js.map +1 -1
- package/lib/commonjs/renderers/heading.js +1 -1
- package/lib/commonjs/renderers/heading.js.map +1 -1
- package/lib/commonjs/renderers/image.js +7 -5
- package/lib/commonjs/renderers/image.js.map +1 -1
- package/lib/commonjs/renderers/link.js +15 -3
- package/lib/commonjs/renderers/link.js.map +1 -1
- package/lib/commonjs/renderers/list.js +2 -2
- package/lib/commonjs/renderers/list.js.map +1 -1
- package/lib/commonjs/renderers/table.js +126 -21
- package/lib/commonjs/renderers/table.js.map +1 -1
- package/lib/commonjs/use-markdown-stream.js +16 -14
- package/lib/commonjs/use-markdown-stream.js.map +1 -1
- package/lib/commonjs/utils/incremental-ast.js +153 -0
- package/lib/commonjs/utils/incremental-ast.js.map +1 -0
- package/lib/commonjs/utils/link-security.js +21 -0
- package/lib/commonjs/utils/link-security.js.map +1 -0
- package/lib/commonjs/utils/stream-timeline.js +62 -0
- package/lib/commonjs/utils/stream-timeline.js.map +1 -0
- package/lib/module/MarkdownContext.js +2 -1
- package/lib/module/MarkdownContext.js.map +1 -1
- package/lib/module/headless.js +37 -4
- package/lib/module/headless.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/markdown-stream.js +110 -14
- package/lib/module/markdown-stream.js.map +1 -1
- package/lib/module/markdown.js +217 -46
- package/lib/module/markdown.js.map +1 -1
- package/lib/module/renderers/blockquote.js.map +1 -1
- package/lib/module/renderers/code.js +4 -3
- package/lib/module/renderers/code.js.map +1 -1
- package/lib/module/renderers/heading.js +1 -1
- package/lib/module/renderers/heading.js.map +1 -1
- package/lib/module/renderers/image.js +7 -5
- package/lib/module/renderers/image.js.map +1 -1
- package/lib/module/renderers/link.js +15 -3
- package/lib/module/renderers/link.js.map +1 -1
- package/lib/module/renderers/list.js +2 -2
- package/lib/module/renderers/list.js.map +1 -1
- package/lib/module/renderers/paragraph.js.map +1 -1
- package/lib/module/renderers/table.js +127 -22
- package/lib/module/renderers/table.js.map +1 -1
- package/lib/module/use-markdown-stream.js +16 -14
- package/lib/module/use-markdown-stream.js.map +1 -1
- package/lib/module/utils/incremental-ast.js +147 -0
- package/lib/module/utils/incremental-ast.js.map +1 -0
- package/lib/module/utils/link-security.js +15 -0
- package/lib/module/utils/link-security.js.map +1 -0
- package/lib/module/utils/stream-timeline.js +56 -0
- package/lib/module/utils/stream-timeline.js.map +1 -0
- package/lib/typescript/commonjs/Markdown.nitro.d.ts +5 -3
- package/lib/typescript/commonjs/Markdown.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/MarkdownContext.d.ts +26 -25
- package/lib/typescript/commonjs/MarkdownContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/headless.d.ts +15 -2
- package/lib/typescript/commonjs/headless.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/markdown-stream.d.ts +7 -2
- package/lib/typescript/commonjs/markdown-stream.d.ts.map +1 -1
- package/lib/typescript/commonjs/markdown.d.ts +62 -5
- package/lib/typescript/commonjs/markdown.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/blockquote.d.ts +3 -3
- package/lib/typescript/commonjs/renderers/blockquote.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/code.d.ts +5 -5
- package/lib/typescript/commonjs/renderers/code.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/heading.d.ts +3 -3
- package/lib/typescript/commonjs/renderers/heading.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts +2 -2
- package/lib/typescript/commonjs/renderers/horizontal-rule.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/image.d.ts +2 -2
- package/lib/typescript/commonjs/renderers/image.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/link.d.ts +3 -3
- package/lib/typescript/commonjs/renderers/link.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/list.d.ts +7 -7
- package/lib/typescript/commonjs/renderers/list.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/math.d.ts +4 -4
- package/lib/typescript/commonjs/renderers/math.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/paragraph.d.ts +3 -3
- package/lib/typescript/commonjs/renderers/paragraph.d.ts.map +1 -1
- package/lib/typescript/commonjs/renderers/table.d.ts +3 -3
- package/lib/typescript/commonjs/renderers/table.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/MarkdownSession.nitro.d.ts +5 -2
- package/lib/typescript/commonjs/specs/MarkdownSession.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme.d.ts +2 -2
- package/lib/typescript/commonjs/theme.d.ts.map +1 -1
- package/lib/typescript/commonjs/use-markdown-stream.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/incremental-ast.d.ts +12 -0
- package/lib/typescript/commonjs/utils/incremental-ast.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/link-security.d.ts +3 -0
- package/lib/typescript/commonjs/utils/link-security.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/stream-timeline.d.ts +11 -0
- package/lib/typescript/commonjs/utils/stream-timeline.d.ts.map +1 -0
- package/lib/typescript/module/Markdown.nitro.d.ts +5 -3
- package/lib/typescript/module/Markdown.nitro.d.ts.map +1 -1
- package/lib/typescript/module/MarkdownContext.d.ts +26 -25
- package/lib/typescript/module/MarkdownContext.d.ts.map +1 -1
- package/lib/typescript/module/headless.d.ts +15 -2
- package/lib/typescript/module/headless.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/markdown-stream.d.ts +7 -2
- package/lib/typescript/module/markdown-stream.d.ts.map +1 -1
- package/lib/typescript/module/markdown.d.ts +62 -5
- package/lib/typescript/module/markdown.d.ts.map +1 -1
- package/lib/typescript/module/renderers/blockquote.d.ts +3 -3
- package/lib/typescript/module/renderers/blockquote.d.ts.map +1 -1
- package/lib/typescript/module/renderers/code.d.ts +5 -5
- package/lib/typescript/module/renderers/code.d.ts.map +1 -1
- package/lib/typescript/module/renderers/heading.d.ts +3 -3
- package/lib/typescript/module/renderers/heading.d.ts.map +1 -1
- package/lib/typescript/module/renderers/horizontal-rule.d.ts +2 -2
- package/lib/typescript/module/renderers/horizontal-rule.d.ts.map +1 -1
- package/lib/typescript/module/renderers/image.d.ts +2 -2
- package/lib/typescript/module/renderers/image.d.ts.map +1 -1
- package/lib/typescript/module/renderers/link.d.ts +3 -3
- package/lib/typescript/module/renderers/link.d.ts.map +1 -1
- package/lib/typescript/module/renderers/list.d.ts +7 -7
- package/lib/typescript/module/renderers/list.d.ts.map +1 -1
- package/lib/typescript/module/renderers/math.d.ts +4 -4
- package/lib/typescript/module/renderers/math.d.ts.map +1 -1
- package/lib/typescript/module/renderers/paragraph.d.ts +3 -3
- package/lib/typescript/module/renderers/paragraph.d.ts.map +1 -1
- package/lib/typescript/module/renderers/table.d.ts +3 -3
- package/lib/typescript/module/renderers/table.d.ts.map +1 -1
- package/lib/typescript/module/specs/MarkdownSession.nitro.d.ts +5 -2
- package/lib/typescript/module/specs/MarkdownSession.nitro.d.ts.map +1 -1
- package/lib/typescript/module/theme.d.ts +2 -2
- package/lib/typescript/module/theme.d.ts.map +1 -1
- package/lib/typescript/module/use-markdown-stream.d.ts.map +1 -1
- package/lib/typescript/module/utils/incremental-ast.d.ts +12 -0
- package/lib/typescript/module/utils/incremental-ast.d.ts.map +1 -0
- package/lib/typescript/module/utils/link-security.d.ts +3 -0
- package/lib/typescript/module/utils/link-security.d.ts.map +1 -0
- package/lib/typescript/module/utils/stream-timeline.d.ts +11 -0
- package/lib/typescript/module/utils/stream-timeline.d.ts.map +1 -0
- package/nitrogen/generated/android/NitroMarkdownOnLoad.cpp +2 -0
- package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.cpp +18 -6
- package/nitrogen/generated/android/c++/JHybridMarkdownSessionSpec.hpp +4 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/Func_void_double_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/nitromarkdown/HybridMarkdownSessionSpec.kt +11 -3
- package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/NitroMarkdown-Swift-Cxx-Bridge.hpp +31 -0
- package/nitrogen/generated/ios/c++/HybridMarkdownSessionSpecSwift.hpp +20 -2
- package/nitrogen/generated/ios/swift/Func_void.swift +0 -1
- package/nitrogen/generated/ios/swift/Func_void_double_double.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridMarkdownSessionSpec.swift +4 -3
- package/nitrogen/generated/ios/swift/HybridMarkdownSessionSpec_cxx.swift +34 -10
- package/nitrogen/generated/shared/c++/HybridMarkdownParserSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridMarkdownParserSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridMarkdownSessionSpec.hpp +4 -2
- package/package.json +7 -5
- package/src/Markdown.nitro.ts +7 -3
- package/src/MarkdownContext.ts +31 -25
- package/src/headless.ts +44 -6
- package/src/index.ts +8 -0
- package/src/markdown-stream.tsx +159 -15
- package/src/markdown.tsx +406 -50
- package/src/renderers/blockquote.tsx +4 -4
- package/src/renderers/code.tsx +16 -10
- package/src/renderers/heading.tsx +4 -4
- package/src/renderers/horizontal-rule.tsx +3 -3
- package/src/renderers/image.tsx +11 -9
- package/src/renderers/link.tsx +25 -7
- package/src/renderers/list.tsx +9 -12
- package/src/renderers/math.tsx +4 -4
- package/src/renderers/paragraph.tsx +3 -3
- package/src/renderers/table.tsx +270 -98
- package/src/specs/MarkdownSession.nitro.ts +6 -2
- package/src/theme.ts +3 -3
- package/src/use-markdown-stream.ts +22 -16
- package/src/utils/incremental-ast.ts +224 -0
- package/src/utils/link-security.ts +22 -0
- package/src/utils/stream-timeline.ts +72 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type FC, type ReactNode } from "react";
|
|
2
2
|
import { type ViewStyle } from "react-native";
|
|
3
|
-
|
|
3
|
+
type ListProps = {
|
|
4
4
|
ordered: boolean;
|
|
5
5
|
start?: number;
|
|
6
6
|
depth: number;
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
style?: ViewStyle;
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
export declare const List: FC<ListProps>;
|
|
11
|
-
|
|
11
|
+
type ListItemProps = {
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
index: number;
|
|
14
14
|
ordered: boolean;
|
|
15
15
|
start: number;
|
|
16
16
|
style?: ViewStyle;
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
export declare const ListItem: FC<ListItemProps>;
|
|
19
|
-
|
|
19
|
+
type TaskListItemProps = {
|
|
20
20
|
children: ReactNode;
|
|
21
21
|
checked: boolean;
|
|
22
22
|
style?: ViewStyle;
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
export declare const TaskListItem: FC<TaskListItemProps>;
|
|
25
25
|
export {};
|
|
26
26
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/renderers/list.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/renderers/list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhF,KAAK,SAAS,GAAG;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAoB9B,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAwCtC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAqD9C,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type FC } from "react";
|
|
2
2
|
import { type ViewStyle } from "react-native";
|
|
3
|
-
|
|
3
|
+
type MathInlineProps = {
|
|
4
4
|
content?: string;
|
|
5
5
|
style?: ViewStyle;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
export declare const MathInline: FC<MathInlineProps>;
|
|
8
|
-
|
|
8
|
+
type MathBlockProps = {
|
|
9
9
|
content?: string;
|
|
10
10
|
style?: ViewStyle;
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
export declare const MathBlock: FC<MathBlockProps>;
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=math.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../../src/renderers/math.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAML,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAoBtB,
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../../src/renderers/math.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAML,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAoBtB,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAyDF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA2B1C,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA0BxC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type FC, type ReactNode } from "react";
|
|
2
2
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
-
|
|
3
|
+
type ParagraphProps = {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
inListItem?: boolean;
|
|
6
6
|
style?: StyleProp<ViewStyle>;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare const Paragraph: FC<ParagraphProps>;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=paragraph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../../src/renderers/paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../../src/renderers/paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhF,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAkCxC,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type FC, type ComponentType } from "react";
|
|
2
2
|
import { type ViewStyle } from "react-native";
|
|
3
|
-
import type
|
|
3
|
+
import { type MarkdownNode } from "../headless";
|
|
4
4
|
import { type NodeRendererProps } from "../MarkdownContext";
|
|
5
|
-
|
|
5
|
+
type TableRendererProps = {
|
|
6
6
|
node: MarkdownNode;
|
|
7
7
|
Renderer: ComponentType<NodeRendererProps>;
|
|
8
8
|
style?: ViewStyle;
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
export declare const TableRenderer: FC<TableRendererProps>;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/renderers/table.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/renderers/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACP,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AACf,OAAO,EAQL,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAwChF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAmFF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAyRhD,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { HybridObject } from "react-native-nitro-modules";
|
|
2
|
+
export type MarkdownSessionListener = (from: number, to: number) => void;
|
|
2
3
|
export interface MarkdownSession extends HybridObject<{
|
|
3
4
|
ios: "swift";
|
|
4
5
|
android: "kotlin";
|
|
5
6
|
}> {
|
|
6
|
-
append(chunk: string):
|
|
7
|
+
append(chunk: string): number;
|
|
7
8
|
clear(): void;
|
|
8
9
|
getAllText(): string;
|
|
10
|
+
getLength(): number;
|
|
11
|
+
getTextRange(from: number, to: number): string;
|
|
9
12
|
highlightPosition: number;
|
|
10
|
-
addListener(listener:
|
|
13
|
+
addListener(listener: MarkdownSessionListener): () => void;
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=MarkdownSession.nitro.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownSession.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/MarkdownSession.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,eAAgB,SAAQ,YAAY,CAAC;IACpD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IACA,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"MarkdownSession.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/MarkdownSession.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;AAEzE,MAAM,WAAW,eAAgB,SAAQ,YAAY,CAAC;IACpD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IACA,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,KAAK,IAAI,IAAI,CAAC;IACd,UAAU,IAAI,MAAM,CAAC;IACrB,SAAS,IAAI,MAAM,CAAC;IACpB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/C,iBAAiB,EAAE,MAAM,CAAC;IAE1B,WAAW,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,IAAI,CAAC;CAC5D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TextStyle, type ViewStyle } from "react-native";
|
|
2
2
|
import type { MarkdownNode } from "./headless";
|
|
3
|
-
export
|
|
3
|
+
export type MarkdownTheme = {
|
|
4
4
|
colors: {
|
|
5
5
|
text: string | undefined;
|
|
6
6
|
textMuted: string | undefined;
|
|
@@ -52,7 +52,7 @@ export interface MarkdownTheme {
|
|
|
52
52
|
l: number;
|
|
53
53
|
};
|
|
54
54
|
showCodeLanguage: boolean;
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
56
|
export declare const defaultMarkdownTheme: MarkdownTheme;
|
|
57
57
|
export type PartialMarkdownTheme = {
|
|
58
58
|
[K in keyof MarkdownTheme]?: K extends "showCodeLanguage" | "headingWeight" ? MarkdownTheme[K] : MarkdownTheme[K] extends object ? Partial<MarkdownTheme[K]> : MarkdownTheme[K];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/theme.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-markdown-stream.d.ts","sourceRoot":"","sources":["../../../src/use-markdown-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-markdown-stream.d.ts","sourceRoot":"","sources":["../../../src/use-markdown-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAO1D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEvE,wBAAgB,kBAAkB;;;;;;6BAyBY,MAAM;EAcnD;AAED,wBAAgB,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;0BAgBzC,MAAM;;;;;;6BAhCoB,MAAM;EAqDnD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type MarkdownNode } from "../headless";
|
|
2
|
+
import type { ParserOptions } from "../Markdown.nitro";
|
|
3
|
+
export type IncrementalAstInput = {
|
|
4
|
+
allowIncremental?: boolean;
|
|
5
|
+
nextText: string;
|
|
6
|
+
options?: ParserOptions;
|
|
7
|
+
previousAst: MarkdownNode;
|
|
8
|
+
previousText: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const getNextStreamAst: ({ allowIncremental, nextText, options, previousAst, previousText, }: IncrementalAstInput) => MarkdownNode;
|
|
11
|
+
export declare const parseMarkdownAst: (text: string, options?: ParserOptions) => MarkdownNode;
|
|
12
|
+
//# sourceMappingURL=incremental-ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incremental-ast.d.ts","sourceRoot":"","sources":["../../../../src/utils/incremental-ast.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAqJvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,WAAW,EAAE,YAAY,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,qEAM9B,mBAAmB,KAAG,YAgDxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,MAAM,MAAM,EACZ,UAAU,aAAa,KACtB,YAEF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-security.d.ts","sourceRoot":"","sources":["../../../../src/utils/link-security.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAGzD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAQ9D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TimestampEntry = {
|
|
2
|
+
index: number;
|
|
3
|
+
time: number;
|
|
4
|
+
};
|
|
5
|
+
export type TimestampTimeline = {
|
|
6
|
+
entries: TimestampEntry[];
|
|
7
|
+
monotonic: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const createTimestampTimeline: (timestamps?: Record<number, number>) => TimestampTimeline;
|
|
10
|
+
export declare const resolveHighlightPosition: (timeline: TimestampTimeline, currentTimeMs: number) => number;
|
|
11
|
+
//# sourceMappingURL=stream-timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-timeline.d.ts","sourceRoot":"","sources":["../../../../src/utils/stream-timeline.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,aAAa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAClC,iBAwBF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,UAAU,iBAAiB,EAC3B,eAAe,MAAM,KACpB,MA8BF,CAAC"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
#include "JHybridMarkdownSessionSpec.hpp"
|
|
19
19
|
#include "JFunc_void.hpp"
|
|
20
|
+
#include "JFunc_void_double_double.hpp"
|
|
20
21
|
#include "HybridMarkdownParser.hpp"
|
|
21
22
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
22
23
|
|
|
@@ -31,6 +32,7 @@ int initialize(JavaVM* vm) {
|
|
|
31
32
|
// Register native JNI methods
|
|
32
33
|
margelo::nitro::Markdown::JHybridMarkdownSessionSpec::registerNatives();
|
|
33
34
|
margelo::nitro::Markdown::JFunc_void_cxx::registerNatives();
|
|
35
|
+
margelo::nitro::Markdown::JFunc_void_double_double_cxx::registerNatives();
|
|
34
36
|
|
|
35
37
|
// Register Nitro Hybrid Objects
|
|
36
38
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_double_double.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::Markdown {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Java/Kotlin callback `(from: Double, to: Double) -> Unit`.
|
|
22
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
23
|
+
*/
|
|
24
|
+
struct JFunc_void_double_double: public jni::JavaClass<JFunc_void_double_double> {
|
|
25
|
+
public:
|
|
26
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/nitromarkdown/Func_void_double_double;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Invokes the function this `JFunc_void_double_double` instance holds through JNI.
|
|
31
|
+
*/
|
|
32
|
+
void invoke(double from, double to) const {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* from */, double /* to */)>("invoke");
|
|
34
|
+
method(self(), from, to);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An implementation of Func_void_double_double that is backed by a C++ implementation (using `std::function<...>`)
|
|
40
|
+
*/
|
|
41
|
+
class JFunc_void_double_double_cxx final: public jni::HybridClass<JFunc_void_double_double_cxx, JFunc_void_double_double> {
|
|
42
|
+
public:
|
|
43
|
+
static jni::local_ref<JFunc_void_double_double::javaobject> fromCpp(const std::function<void(double /* from */, double /* to */)>& func) {
|
|
44
|
+
return JFunc_void_double_double_cxx::newObjectCxxArgs(func);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_double_double_cxx` instance holds.
|
|
50
|
+
*/
|
|
51
|
+
void invoke_cxx(double from, double to) {
|
|
52
|
+
_func(from, to);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
[[nodiscard]]
|
|
57
|
+
inline const std::function<void(double /* from */, double /* to */)>& getFunction() const {
|
|
58
|
+
return _func;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/nitromarkdown/Func_void_double_double_cxx;";
|
|
63
|
+
static void registerNatives() {
|
|
64
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_double_double_cxx::invoke_cxx)});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
explicit JFunc_void_double_double_cxx(const std::function<void(double /* from */, double /* to */)>& func): _func(func) { }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
friend HybridBase;
|
|
72
|
+
std::function<void(double /* from */, double /* to */)> _func;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::Markdown
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#include <functional>
|
|
14
14
|
#include "JFunc_void.hpp"
|
|
15
15
|
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
#include "JFunc_void_double_double.hpp"
|
|
16
17
|
|
|
17
18
|
namespace margelo::nitro::Markdown {
|
|
18
19
|
|
|
@@ -61,9 +62,10 @@ namespace margelo::nitro::Markdown {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
// Methods
|
|
64
|
-
|
|
65
|
-
static const auto method = javaClassStatic()->getMethod<
|
|
66
|
-
method(_javaPart, jni::make_jstring(chunk));
|
|
65
|
+
double JHybridMarkdownSessionSpec::append(const std::string& chunk) {
|
|
66
|
+
static const auto method = javaClassStatic()->getMethod<double(jni::alias_ref<jni::JString> /* chunk */)>("append");
|
|
67
|
+
auto __result = method(_javaPart, jni::make_jstring(chunk));
|
|
68
|
+
return __result;
|
|
67
69
|
}
|
|
68
70
|
void JHybridMarkdownSessionSpec::clear() {
|
|
69
71
|
static const auto method = javaClassStatic()->getMethod<void()>("clear");
|
|
@@ -74,9 +76,19 @@ namespace margelo::nitro::Markdown {
|
|
|
74
76
|
auto __result = method(_javaPart);
|
|
75
77
|
return __result->toStdString();
|
|
76
78
|
}
|
|
77
|
-
|
|
78
|
-
static const auto method = javaClassStatic()->getMethod<
|
|
79
|
-
auto __result = method(_javaPart
|
|
79
|
+
double JHybridMarkdownSessionSpec::getLength() {
|
|
80
|
+
static const auto method = javaClassStatic()->getMethod<double()>("getLength");
|
|
81
|
+
auto __result = method(_javaPart);
|
|
82
|
+
return __result;
|
|
83
|
+
}
|
|
84
|
+
std::string JHybridMarkdownSessionSpec::getTextRange(double from, double to) {
|
|
85
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>(double /* from */, double /* to */)>("getTextRange");
|
|
86
|
+
auto __result = method(_javaPart, from, to);
|
|
87
|
+
return __result->toStdString();
|
|
88
|
+
}
|
|
89
|
+
std::function<void()> JHybridMarkdownSessionSpec::addListener(const std::function<void(double /* from */, double /* to */)>& listener) {
|
|
90
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>(jni::alias_ref<JFunc_void_double_double::javaobject> /* listener */)>("addListener_cxx");
|
|
91
|
+
auto __result = method(_javaPart, JFunc_void_double_double_cxx::fromCpp(listener));
|
|
80
92
|
return [&]() -> std::function<void()> {
|
|
81
93
|
if (__result->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
|
|
82
94
|
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(__result);
|
|
@@ -56,10 +56,12 @@ namespace margelo::nitro::Markdown {
|
|
|
56
56
|
|
|
57
57
|
public:
|
|
58
58
|
// Methods
|
|
59
|
-
|
|
59
|
+
double append(const std::string& chunk) override;
|
|
60
60
|
void clear() override;
|
|
61
61
|
std::string getAllText() override;
|
|
62
|
-
|
|
62
|
+
double getLength() override;
|
|
63
|
+
std::string getTextRange(double from, double to) override;
|
|
64
|
+
std::function<void()> addListener(const std::function<void(double /* from */, double /* to */)>& listener) override;
|
|
63
65
|
|
|
64
66
|
private:
|
|
65
67
|
friend HybridBase;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double_double.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.com.nitromarkdown
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(from: number, to: number) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_double_double: (Double, Double) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(from: Double, to: Double): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(from: number, to: number) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_double_double_cxx: Func_void_double_double {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(from: Double, to: Double): Unit
|
|
60
|
+
= invoke_cxx(from,to)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(from: Double, to: Double): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(from: number, to: number) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(Double, Double) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_double_double_java(private val function: (Double, Double) -> Unit): Func_void_double_double {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(from: Double, to: Double): Unit {
|
|
78
|
+
return this.function(from, to)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -51,7 +51,7 @@ abstract class HybridMarkdownSessionSpec: HybridObject() {
|
|
|
51
51
|
// Methods
|
|
52
52
|
@DoNotStrip
|
|
53
53
|
@Keep
|
|
54
|
-
abstract fun append(chunk: String):
|
|
54
|
+
abstract fun append(chunk: String): Double
|
|
55
55
|
|
|
56
56
|
@DoNotStrip
|
|
57
57
|
@Keep
|
|
@@ -61,11 +61,19 @@ abstract class HybridMarkdownSessionSpec: HybridObject() {
|
|
|
61
61
|
@Keep
|
|
62
62
|
abstract fun getAllText(): String
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
@DoNotStrip
|
|
65
|
+
@Keep
|
|
66
|
+
abstract fun getLength(): Double
|
|
67
|
+
|
|
68
|
+
@DoNotStrip
|
|
69
|
+
@Keep
|
|
70
|
+
abstract fun getTextRange(from: Double, to: Double): String
|
|
71
|
+
|
|
72
|
+
abstract fun addListener(listener: (from: Double, to: Double) -> Unit): () -> Unit
|
|
65
73
|
|
|
66
74
|
@DoNotStrip
|
|
67
75
|
@Keep
|
|
68
|
-
private fun addListener_cxx(listener:
|
|
76
|
+
private fun addListener_cxx(listener: Func_void_double_double): Func_void {
|
|
69
77
|
val __result = addListener(listener)
|
|
70
78
|
return Func_void_java(__result)
|
|
71
79
|
}
|
|
@@ -22,6 +22,14 @@ namespace margelo::nitro::Markdown::bridge::swift {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
// pragma MARK: std::function<void(double /* from */, double /* to */)>
|
|
26
|
+
Func_void_double_double create_Func_void_double_double(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = NitroMarkdown::Func_void_double_double::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](double from, double to) mutable -> void {
|
|
29
|
+
swiftClosure.call(from, to);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
// pragma MARK: std::shared_ptr<HybridMarkdownSessionSpec>
|
|
26
34
|
std::shared_ptr<HybridMarkdownSessionSpec> create_std__shared_ptr_HybridMarkdownSessionSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
27
35
|
NitroMarkdown::HybridMarkdownSessionSpec_cxx swiftPart = NitroMarkdown::HybridMarkdownSessionSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -51,6 +51,28 @@ namespace margelo::nitro::Markdown::bridge::swift {
|
|
|
51
51
|
return Func_void_Wrapper(std::move(value));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
// pragma MARK: std::function<void(double /* from */, double /* to */)>
|
|
55
|
+
/**
|
|
56
|
+
* Specialized version of `std::function<void(double, double)>`.
|
|
57
|
+
*/
|
|
58
|
+
using Func_void_double_double = std::function<void(double /* from */, double /* to */)>;
|
|
59
|
+
/**
|
|
60
|
+
* Wrapper class for a `std::function<void(double / * from * /, double / * to * /)>`, this can be used from Swift.
|
|
61
|
+
*/
|
|
62
|
+
class Func_void_double_double_Wrapper final {
|
|
63
|
+
public:
|
|
64
|
+
explicit Func_void_double_double_Wrapper(std::function<void(double /* from */, double /* to */)>&& func): _function(std::make_unique<std::function<void(double /* from */, double /* to */)>>(std::move(func))) {}
|
|
65
|
+
inline void call(double from, double to) const noexcept {
|
|
66
|
+
_function->operator()(from, to);
|
|
67
|
+
}
|
|
68
|
+
private:
|
|
69
|
+
std::unique_ptr<std::function<void(double /* from */, double /* to */)>> _function;
|
|
70
|
+
} SWIFT_NONCOPYABLE;
|
|
71
|
+
Func_void_double_double create_Func_void_double_double(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
72
|
+
inline Func_void_double_double_Wrapper wrap_Func_void_double_double(Func_void_double_double value) noexcept {
|
|
73
|
+
return Func_void_double_double_Wrapper(std::move(value));
|
|
74
|
+
}
|
|
75
|
+
|
|
54
76
|
// pragma MARK: std::shared_ptr<HybridMarkdownSessionSpec>
|
|
55
77
|
/**
|
|
56
78
|
* Specialized version of `std::shared_ptr<HybridMarkdownSessionSpec>`.
|
|
@@ -63,6 +85,15 @@ namespace margelo::nitro::Markdown::bridge::swift {
|
|
|
63
85
|
using std__weak_ptr_HybridMarkdownSessionSpec_ = std::weak_ptr<HybridMarkdownSessionSpec>;
|
|
64
86
|
inline std__weak_ptr_HybridMarkdownSessionSpec_ weakify_std__shared_ptr_HybridMarkdownSessionSpec_(const std::shared_ptr<HybridMarkdownSessionSpec>& strong) noexcept { return strong; }
|
|
65
87
|
|
|
88
|
+
// pragma MARK: Result<double>
|
|
89
|
+
using Result_double_ = Result<double>;
|
|
90
|
+
inline Result_double_ create_Result_double_(double value) noexcept {
|
|
91
|
+
return Result<double>::withValue(std::move(value));
|
|
92
|
+
}
|
|
93
|
+
inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
|
|
94
|
+
return Result<double>::withError(error);
|
|
95
|
+
}
|
|
96
|
+
|
|
66
97
|
// pragma MARK: Result<void>
|
|
67
98
|
using Result_void_ = Result<void>;
|
|
68
99
|
inline Result_void_ create_Result_void_() noexcept {
|
|
@@ -72,11 +72,13 @@ namespace margelo::nitro::Markdown {
|
|
|
72
72
|
|
|
73
73
|
public:
|
|
74
74
|
// Methods
|
|
75
|
-
inline
|
|
75
|
+
inline double append(const std::string& chunk) override {
|
|
76
76
|
auto __result = _swiftPart.append(chunk);
|
|
77
77
|
if (__result.hasError()) [[unlikely]] {
|
|
78
78
|
std::rethrow_exception(__result.error());
|
|
79
79
|
}
|
|
80
|
+
auto __value = std::move(__result.value());
|
|
81
|
+
return __value;
|
|
80
82
|
}
|
|
81
83
|
inline void clear() override {
|
|
82
84
|
auto __result = _swiftPart.clear();
|
|
@@ -92,7 +94,23 @@ namespace margelo::nitro::Markdown {
|
|
|
92
94
|
auto __value = std::move(__result.value());
|
|
93
95
|
return __value;
|
|
94
96
|
}
|
|
95
|
-
inline
|
|
97
|
+
inline double getLength() override {
|
|
98
|
+
auto __result = _swiftPart.getLength();
|
|
99
|
+
if (__result.hasError()) [[unlikely]] {
|
|
100
|
+
std::rethrow_exception(__result.error());
|
|
101
|
+
}
|
|
102
|
+
auto __value = std::move(__result.value());
|
|
103
|
+
return __value;
|
|
104
|
+
}
|
|
105
|
+
inline std::string getTextRange(double from, double to) override {
|
|
106
|
+
auto __result = _swiftPart.getTextRange(std::forward<decltype(from)>(from), std::forward<decltype(to)>(to));
|
|
107
|
+
if (__result.hasError()) [[unlikely]] {
|
|
108
|
+
std::rethrow_exception(__result.error());
|
|
109
|
+
}
|
|
110
|
+
auto __value = std::move(__result.value());
|
|
111
|
+
return __value;
|
|
112
|
+
}
|
|
113
|
+
inline std::function<void()> addListener(const std::function<void(double /* from */, double /* to */)>& listener) override {
|
|
96
114
|
auto __result = _swiftPart.addListener(listener);
|
|
97
115
|
if (__result.hasError()) [[unlikely]] {
|
|
98
116
|
std::rethrow_exception(__result.error());
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double_double.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ from: Double, _ to: Double) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_double_double {
|
|
15
|
+
public typealias bridge = margelo.nitro.Markdown.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ from: Double, _ to: Double) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ from: Double, _ to: Double) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(from: Double, to: Double) -> Void {
|
|
25
|
+
self.closure(from, to)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_double_double`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double_double>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double_double {
|
|
44
|
+
return Unmanaged<Func_void_double_double>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|