@mnaoumov/obsidian-lib 10.4.1 → 10.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/codemirror/incremental-parse-state-field/package.json +6 -0
- package/codemirror/markdown-editor-views/package.json +6 -0
- package/codemirror/range-set/package.json +6 -0
- package/command-handlers/open-bug-report-command-handler/package.json +6 -0
- package/components/embeddable-markdown-editor-component/package.json +6 -0
- package/components/reconfigurable-editor-extension-component/package.json +6 -0
- package/dist/lib/cjs/__merged.cjs +46 -1
- package/dist/lib/cjs/__merged.d.cts +11 -0
- package/dist/lib/cjs/attachment-path.cjs +3 -2
- package/dist/lib/cjs/bug-report.cjs +241 -0
- package/dist/lib/cjs/bug-report.d.cts +161 -0
- package/dist/lib/cjs/codemirror/incremental-parse-state-field.cjs +162 -0
- package/dist/lib/cjs/codemirror/incremental-parse-state-field.d.cts +37 -0
- package/dist/lib/cjs/codemirror/index.cjs +10 -1
- package/dist/lib/cjs/codemirror/index.d.cts +3 -0
- package/dist/lib/cjs/codemirror/markdown-editor-views.cjs +142 -0
- package/dist/lib/cjs/codemirror/markdown-editor-views.d.cts +34 -0
- package/dist/lib/cjs/codemirror/range-set.cjs +106 -0
- package/dist/lib/cjs/codemirror/range-set.d.cts +35 -0
- package/dist/lib/cjs/command-handlers/index.cjs +4 -1
- package/dist/lib/cjs/command-handlers/index.d.cts +1 -0
- package/dist/lib/cjs/command-handlers/open-bug-report-command-handler.cjs +139 -0
- package/dist/lib/cjs/command-handlers/open-bug-report-command-handler.d.cts +53 -0
- package/dist/lib/cjs/command-handlers/open-settings-command-handler.cjs +6 -3
- package/dist/lib/cjs/components/embeddable-markdown-editor-component.cjs +374 -0
- package/dist/lib/cjs/components/embeddable-markdown-editor-component.d.cts +221 -0
- package/dist/lib/cjs/components/index.cjs +7 -1
- package/dist/lib/cjs/components/index.d.cts +2 -0
- package/dist/lib/cjs/components/plugin-gate-component.cjs +6 -3
- package/dist/lib/cjs/components/reconfigurable-editor-extension-component.cjs +200 -0
- package/dist/lib/cjs/components/reconfigurable-editor-extension-component.d.cts +96 -0
- package/dist/lib/cjs/desktop-operating-system.cjs +101 -0
- package/dist/lib/cjs/desktop-operating-system.d.cts +15 -0
- package/dist/lib/cjs/generated-during-build.cjs +1 -1
- package/dist/lib/cjs/index.cjs +16 -1
- package/dist/lib/cjs/index.d.cts +5 -0
- package/dist/lib/cjs/menu.cjs +118 -0
- package/dist/lib/cjs/menu.d.cts +65 -0
- package/dist/lib/cjs/mobile-app-info.cjs +167 -0
- package/dist/lib/cjs/mobile-app-info.d.cts +32 -0
- package/dist/lib/cjs/obsidian-settings.cjs +2 -2
- package/dist/lib/cjs/settings-modal.cjs +103 -0
- package/dist/lib/cjs/settings-modal.d.cts +33 -0
- package/dist/lib/esm/__merged.d.mts +11 -0
- package/dist/lib/esm/__merged.mjs +39 -1
- package/dist/lib/esm/attachment-path.mjs +3 -2
- package/dist/lib/esm/bug-report.d.mts +161 -0
- package/dist/lib/esm/bug-report.mjs +141 -0
- package/dist/lib/esm/codemirror/incremental-parse-state-field.d.mts +37 -0
- package/dist/lib/esm/codemirror/incremental-parse-state-field.mjs +74 -0
- package/dist/lib/esm/codemirror/index.d.mts +3 -0
- package/dist/lib/esm/codemirror/index.mjs +7 -1
- package/dist/lib/esm/codemirror/markdown-editor-views.d.mts +34 -0
- package/dist/lib/esm/codemirror/markdown-editor-views.mjs +53 -0
- package/dist/lib/esm/codemirror/range-set.d.mts +35 -0
- package/dist/lib/esm/codemirror/range-set.mjs +18 -0
- package/dist/lib/esm/command-handlers/index.d.mts +1 -0
- package/dist/lib/esm/command-handlers/index.mjs +3 -1
- package/dist/lib/esm/command-handlers/open-bug-report-command-handler.d.mts +53 -0
- package/dist/lib/esm/command-handlers/open-bug-report-command-handler.mjs +51 -0
- package/dist/lib/esm/command-handlers/open-settings-command-handler.mjs +6 -3
- package/dist/lib/esm/components/embeddable-markdown-editor-component.d.mts +221 -0
- package/dist/lib/esm/components/embeddable-markdown-editor-component.mjs +293 -0
- package/dist/lib/esm/components/index.d.mts +2 -0
- package/dist/lib/esm/components/index.mjs +5 -1
- package/dist/lib/esm/components/plugin-gate-component.mjs +6 -3
- package/dist/lib/esm/components/reconfigurable-editor-extension-component.d.mts +96 -0
- package/dist/lib/esm/components/reconfigurable-editor-extension-component.mjs +112 -0
- package/dist/lib/esm/desktop-operating-system.d.mts +15 -0
- package/dist/lib/esm/desktop-operating-system.mjs +16 -0
- package/dist/lib/esm/generated-during-build.mjs +1 -1
- package/dist/lib/esm/index.d.mts +5 -0
- package/dist/lib/esm/index.mjs +11 -1
- package/dist/lib/esm/menu.d.mts +65 -0
- package/dist/lib/esm/menu.mjs +30 -0
- package/dist/lib/esm/mobile-app-info.d.mts +32 -0
- package/dist/lib/esm/mobile-app-info.mjs +84 -0
- package/dist/lib/esm/obsidian-settings.mjs +6 -3
- package/dist/lib/esm/settings-modal.d.mts +33 -0
- package/dist/lib/esm/settings-modal.mjs +15 -0
- package/package.json +7 -6
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/// <reference path="./library-references.d.cts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Helpers for a plugin's bug reports: the environment a report needs, and a link to a GitHub issue form
|
|
6
|
+
* prefilled with it.
|
|
7
|
+
*
|
|
8
|
+
* Cross-platform-loadable: the desktop operating-system lookup reads `node:os`, so it is imported
|
|
9
|
+
* dynamically, on desktop only.
|
|
10
|
+
*
|
|
11
|
+
* The desktop installer version is `Platform.build`, which no public typing declares: Obsidian's desktop
|
|
12
|
+
* startup sets it from Electron's `app.getVersion()` (read from Obsidian `1.15.0`), so it is read
|
|
13
|
+
* structurally here, and reads as `unknown` if a later version drops it.
|
|
14
|
+
*/
|
|
15
|
+
import type { App } from 'obsidian' with { 'resolution-mode': 'import' };
|
|
16
|
+
/**
|
|
17
|
+
* The ids of the bug-report issue form's fields that {@link getBugReportIssueFormUrl} prefills. GitHub
|
|
18
|
+
* prefills a field from a query parameter named after the field's `id`, so a form must give its fields
|
|
19
|
+
* these ids for them to be filled.
|
|
20
|
+
*/
|
|
21
|
+
export declare enum BugReportIssueFormFieldId {
|
|
22
|
+
/**
|
|
23
|
+
* The whole environment, as {@link formatBugReportEnvironment} renders it.
|
|
24
|
+
*/
|
|
25
|
+
Environment = "environment",
|
|
26
|
+
/**
|
|
27
|
+
* The Obsidian version.
|
|
28
|
+
*/
|
|
29
|
+
ObsidianVersion = "obsidian-version",
|
|
30
|
+
/**
|
|
31
|
+
* The operating system.
|
|
32
|
+
*/
|
|
33
|
+
OperatingSystem = "operating-system",
|
|
34
|
+
/**
|
|
35
|
+
* The reporting plugin's version.
|
|
36
|
+
*/
|
|
37
|
+
PluginVersion = "plugin-version"
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The file name of the bug-report issue form, under `.github/ISSUE_TEMPLATE`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const BUG_REPORT_ISSUE_FORM_TEMPLATE = "bug_report.yml";
|
|
43
|
+
/**
|
|
44
|
+
* The environment a bug report needs.
|
|
45
|
+
*/
|
|
46
|
+
export interface BugReportEnvironment {
|
|
47
|
+
/**
|
|
48
|
+
* The other enabled plugins, sorted by id.
|
|
49
|
+
*/
|
|
50
|
+
readonly enabledPlugins: readonly BugReportPluginInfo[];
|
|
51
|
+
/**
|
|
52
|
+
* The installed app's version, which can lag behind {@link obsidianVersion}.
|
|
53
|
+
*/
|
|
54
|
+
readonly installerVersion: string;
|
|
55
|
+
/**
|
|
56
|
+
* The Obsidian version.
|
|
57
|
+
*/
|
|
58
|
+
readonly obsidianVersion: string;
|
|
59
|
+
/**
|
|
60
|
+
* The operating system's name and version.
|
|
61
|
+
*/
|
|
62
|
+
readonly operatingSystem: string;
|
|
63
|
+
/**
|
|
64
|
+
* The platform: `Android`, `iOS`, `macOS`, `Windows`, `Linux` or `unknown`.
|
|
65
|
+
*/
|
|
66
|
+
readonly platform: string;
|
|
67
|
+
/**
|
|
68
|
+
* The reporting plugin.
|
|
69
|
+
*/
|
|
70
|
+
readonly plugin: BugReportPluginInfo;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A plugin, as a bug report names it.
|
|
74
|
+
*/
|
|
75
|
+
export interface BugReportPluginInfo {
|
|
76
|
+
/**
|
|
77
|
+
* The plugin's id.
|
|
78
|
+
*/
|
|
79
|
+
readonly id: string;
|
|
80
|
+
/**
|
|
81
|
+
* The plugin's installed version, or `null` when its manifest is not known.
|
|
82
|
+
*/
|
|
83
|
+
readonly version: null | string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Parameters for {@link getBugReportEnvironment}.
|
|
87
|
+
*/
|
|
88
|
+
export interface GetBugReportEnvironmentParams {
|
|
89
|
+
/**
|
|
90
|
+
* The Obsidian app instance.
|
|
91
|
+
*/
|
|
92
|
+
readonly app: App;
|
|
93
|
+
/**
|
|
94
|
+
* The id of the reporting plugin.
|
|
95
|
+
*/
|
|
96
|
+
readonly pluginId: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Parameters for {@link getBugReportIssueFormUrl}.
|
|
100
|
+
*/
|
|
101
|
+
export interface GetBugReportIssueFormUrlParams extends GetBugReportEnvironmentParams {
|
|
102
|
+
/**
|
|
103
|
+
* The plugin's GitHub repository, as `owner/name`.
|
|
104
|
+
*/
|
|
105
|
+
readonly gitHubRepo: string;
|
|
106
|
+
/**
|
|
107
|
+
* The issue's title. Leave it out to keep the form's own default title.
|
|
108
|
+
*/
|
|
109
|
+
readonly title?: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Parameters for {@link getGitHubIssueFormUrl}.
|
|
113
|
+
*/
|
|
114
|
+
export interface GetGitHubIssueFormUrlParams {
|
|
115
|
+
/**
|
|
116
|
+
* The values to prefill, keyed by field `id`.
|
|
117
|
+
*/
|
|
118
|
+
readonly fields?: Readonly<Record<string, string>>;
|
|
119
|
+
/**
|
|
120
|
+
* The GitHub repository, as `owner/name`.
|
|
121
|
+
*/
|
|
122
|
+
readonly gitHubRepo: string;
|
|
123
|
+
/**
|
|
124
|
+
* The form's file name, under `.github/ISSUE_TEMPLATE`.
|
|
125
|
+
*/
|
|
126
|
+
readonly template: string;
|
|
127
|
+
/**
|
|
128
|
+
* The issue's title. Leave it out to keep the form's own default title.
|
|
129
|
+
*/
|
|
130
|
+
readonly title?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Renders a bug report's environment as a Markdown list.
|
|
134
|
+
*
|
|
135
|
+
* @param environment - The environment.
|
|
136
|
+
* @returns The Markdown.
|
|
137
|
+
*/
|
|
138
|
+
export declare function formatBugReportEnvironment(environment: BugReportEnvironment): string;
|
|
139
|
+
/**
|
|
140
|
+
* Gets the environment a bug report needs: the plugin's version, the other enabled plugins, the
|
|
141
|
+
* Obsidian and installer versions, the platform and the operating system.
|
|
142
|
+
*
|
|
143
|
+
* @param params - The parameters.
|
|
144
|
+
* @returns The environment.
|
|
145
|
+
*/
|
|
146
|
+
export declare function getBugReportEnvironment(params: GetBugReportEnvironmentParams): Promise<BugReportEnvironment>;
|
|
147
|
+
/**
|
|
148
|
+
* Gets a link to a plugin's bug-report issue form ({@link BUG_REPORT_ISSUE_FORM_TEMPLATE}), prefilled with
|
|
149
|
+
* the environment, in the fields {@link BugReportIssueFormFieldId} names.
|
|
150
|
+
*
|
|
151
|
+
* @param params - The parameters.
|
|
152
|
+
* @returns The link.
|
|
153
|
+
*/
|
|
154
|
+
export declare function getBugReportIssueFormUrl(params: GetBugReportIssueFormUrlParams): Promise<string>;
|
|
155
|
+
/**
|
|
156
|
+
* Gets a link that opens a GitHub issue form with fields prefilled.
|
|
157
|
+
*
|
|
158
|
+
* @param params - The parameters.
|
|
159
|
+
* @returns The link.
|
|
160
|
+
*/
|
|
161
|
+
export declare function getGitHubIssueFormUrl(params: GetGitHubIssueFormUrlParams): string;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
(function () {
|
|
6
|
+
function ensureBrowserProcess() {
|
|
7
|
+
const browserProcess = {
|
|
8
|
+
browser: true,
|
|
9
|
+
cwd() {
|
|
10
|
+
return "/";
|
|
11
|
+
},
|
|
12
|
+
env: {},
|
|
13
|
+
platform: "android"
|
|
14
|
+
};
|
|
15
|
+
const existingProcess = globalThis.process;
|
|
16
|
+
if (!existingProcess) {
|
|
17
|
+
globalThis.process = browserProcess;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (existingProcess.versions?.node) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const existingProcessRecord = existingProcess;
|
|
24
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
25
|
+
existingProcessRecord[key] ??= value;
|
|
26
|
+
}
|
|
27
|
+
existingProcessRecord["browser"] = true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ensureBrowserProcess();
|
|
31
|
+
})();
|
|
32
|
+
(function patchObsidianRequire() {
|
|
33
|
+
const originalRequire = require;
|
|
34
|
+
if (!originalRequire || originalRequire.__isPatched) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
require = Object.assign(
|
|
38
|
+
(id) => requirePatched(id),
|
|
39
|
+
originalRequire,
|
|
40
|
+
{
|
|
41
|
+
__isPatched: true
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
function extractDefault($module) {
|
|
45
|
+
return $module && $module.__esModule && "default" in $module ? $module.default : $module;
|
|
46
|
+
}
|
|
47
|
+
const OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
48
|
+
"@codemirror/autocomplete",
|
|
49
|
+
"@codemirror/collab",
|
|
50
|
+
"@codemirror/commands",
|
|
51
|
+
"@codemirror/language",
|
|
52
|
+
"@codemirror/lint",
|
|
53
|
+
"@codemirror/search",
|
|
54
|
+
"@codemirror/state",
|
|
55
|
+
"@codemirror/text",
|
|
56
|
+
"@codemirror/view",
|
|
57
|
+
"@lezer/common",
|
|
58
|
+
"@lezer/highlight",
|
|
59
|
+
"@lezer/lr",
|
|
60
|
+
"obsidian"
|
|
61
|
+
]);
|
|
62
|
+
const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
63
|
+
"@codemirror/closebrackets",
|
|
64
|
+
"@codemirror/comment",
|
|
65
|
+
"@codemirror/fold",
|
|
66
|
+
"@codemirror/gutter",
|
|
67
|
+
"@codemirror/highlight",
|
|
68
|
+
"@codemirror/history",
|
|
69
|
+
"@codemirror/matchbrackets",
|
|
70
|
+
"@codemirror/panel",
|
|
71
|
+
"@codemirror/rangeset",
|
|
72
|
+
"@codemirror/rectangular-selection",
|
|
73
|
+
"@codemirror/stream-parser",
|
|
74
|
+
"@codemirror/tooltip"
|
|
75
|
+
]);
|
|
76
|
+
function requirePatched(id) {
|
|
77
|
+
if (OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id)) {
|
|
78
|
+
return originalRequire?.(id);
|
|
79
|
+
}
|
|
80
|
+
const app = globalThis.app;
|
|
81
|
+
if (app?.isMobile) {
|
|
82
|
+
if (id === "process" || id === "node:process") {
|
|
83
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
|
|
84
|
+
return process;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
const $module = originalRequire?.(id);
|
|
88
|
+
if ($module) {
|
|
89
|
+
return extractDefault($module);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
})();
|
|
96
|
+
|
|
97
|
+
"use strict";
|
|
98
|
+
var __defProp = Object.defineProperty;
|
|
99
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
100
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
101
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
102
|
+
var __export = (target, all) => {
|
|
103
|
+
for (var name in all)
|
|
104
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
105
|
+
};
|
|
106
|
+
var __copyProps = (to, from, except, desc) => {
|
|
107
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
108
|
+
for (let key of __getOwnPropNames(from))
|
|
109
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
110
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
111
|
+
}
|
|
112
|
+
return to;
|
|
113
|
+
};
|
|
114
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
115
|
+
var incremental_parse_state_field_exports = {};
|
|
116
|
+
__export(incremental_parse_state_field_exports, {
|
|
117
|
+
createIncrementalParseStateField: () => createIncrementalParseStateField
|
|
118
|
+
});
|
|
119
|
+
module.exports = __toCommonJS(incremental_parse_state_field_exports);
|
|
120
|
+
var import_state = require('@codemirror/state');
|
|
121
|
+
var import_common = require('@lezer/common');
|
|
122
|
+
function createIncrementalParseStateField(parser) {
|
|
123
|
+
return import_state.StateField.define({
|
|
124
|
+
create(state) {
|
|
125
|
+
const tree = parser.parse(createTextInput(state.doc));
|
|
126
|
+
return { fragments: import_common.TreeFragment.addTree(tree), tree };
|
|
127
|
+
},
|
|
128
|
+
update(value, transaction) {
|
|
129
|
+
if (!transaction.docChanged) {
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
const changedRanges = [];
|
|
133
|
+
transaction.changes.iterChangedRanges((fromA, toA, fromB, toB) => {
|
|
134
|
+
changedRanges.push({ fromA, fromB, toA, toB });
|
|
135
|
+
});
|
|
136
|
+
const reusableFragments = import_common.TreeFragment.applyChanges(value.fragments, changedRanges);
|
|
137
|
+
const tree = parser.parse(createTextInput(transaction.newDoc), reusableFragments);
|
|
138
|
+
return { fragments: import_common.TreeFragment.addTree(tree, reusableFragments), tree };
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function createTextInput(text) {
|
|
143
|
+
return {
|
|
144
|
+
chunk(from) {
|
|
145
|
+
const line = text.lineAt(from);
|
|
146
|
+
if (from < line.to) {
|
|
147
|
+
return text.sliceString(from, line.to);
|
|
148
|
+
}
|
|
149
|
+
return line.number < text.lines ? "\n" : "";
|
|
150
|
+
},
|
|
151
|
+
length: text.length,
|
|
152
|
+
lineChunks: true,
|
|
153
|
+
read(from, to) {
|
|
154
|
+
return text.sliceString(from, to);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
159
|
+
0 && (module.exports = {
|
|
160
|
+
createIncrementalParseStateField
|
|
161
|
+
});
|
|
162
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb2RlbWlycm9yL2luY3JlbWVudGFsLXBhcnNlLXN0YXRlLWZpZWxkLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQGZpbGVcbiAqXG4gKiBBIHtAbGluayBTdGF0ZUZpZWxkfSBob2xkaW5nIGEgTGV6ZXIgc3ludGF4IHRyZWUgb2YgdGhlIHdob2xlIGRvY3VtZW50LCBwYXJzZWQgYWdhaW4gaW5jcmVtZW50YWxseSBvbiBldmVyeSBjaGFuZ2UuXG4gKlxuICogRWFjaCBjaGFuZ2UgbWFwcyB0aGUgcHJldmlvdXMgcGFyc2UncyB7QGxpbmsgVHJlZUZyYWdtZW50fXMgdGhyb3VnaCB0aGUgY2hhbmdlZCByYW5nZXMgYW5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FBQ3JDLGFBQU8sS0FBSyxZQUFZLE1BQU0sRUFBRTtBQUFBLElBQ2xDO0FBQUEsRUFDRjtBQUNGOyIsIm5hbWVzIjpbXX0=
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference path="../library-references.d.cts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* A {@link StateField} holding a Lezer syntax tree of the whole document, parsed again incrementally on every change.
|
|
6
|
+
*
|
|
7
|
+
* Each change maps the previous parse's {@link TreeFragment}s through the changed ranges and hands them to the
|
|
8
|
+
* parser, which reuses every fragment the change did not touch. The parse is synchronous and runs to the end of
|
|
9
|
+
* the document, so it suits a grammar a plugin owns (a markup extension, a small DSL) rather than a full language
|
|
10
|
+
* on a large document, where `@codemirror/language`'s time-sliced parser is the better tool.
|
|
11
|
+
*
|
|
12
|
+
* `@lezer/common` is in the module map Obsidian hands to plugins, so this costs a consuming plugin no bundle.
|
|
13
|
+
*/
|
|
14
|
+
import type { Parser, Tree } from '@lezer/common' with { 'resolution-mode': 'import' };
|
|
15
|
+
import { StateField } from '@codemirror/state';
|
|
16
|
+
import { TreeFragment } from '@lezer/common';
|
|
17
|
+
/**
|
|
18
|
+
* The value of an incremental parse state field.
|
|
19
|
+
*/
|
|
20
|
+
export interface IncrementalParse {
|
|
21
|
+
/**
|
|
22
|
+
* The fragments of {@link IncrementalParse.tree} that the next parse may reuse.
|
|
23
|
+
*/
|
|
24
|
+
readonly fragments: readonly TreeFragment[];
|
|
25
|
+
/**
|
|
26
|
+
* The syntax tree of the whole document.
|
|
27
|
+
*/
|
|
28
|
+
readonly tree: Tree;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates a state field that parses the document with the given parser when the state is created, and parses it again
|
|
32
|
+
* incrementally on every document change, reusing the fragments the change left intact.
|
|
33
|
+
*
|
|
34
|
+
* @param parser - The Lezer parser to parse the document with.
|
|
35
|
+
* @returns The state field. Add it to the editor's extensions and read it with `state.field(field).tree`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createIncrementalParseStateField(parser: Parser): StateField<IncrementalParse>;
|
|
@@ -97,12 +97,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
97
97
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
98
98
|
var codemirror_exports = {};
|
|
99
99
|
__export(codemirror_exports, {
|
|
100
|
+
"incremental-parse-state-field": () => incremental_parse_state_field,
|
|
101
|
+
"markdown-editor-views": () => markdown_editor_views,
|
|
102
|
+
"range-set": () => range_set,
|
|
100
103
|
"state-field-spec": () => state_field_spec
|
|
101
104
|
});
|
|
102
105
|
module.exports = __toCommonJS(codemirror_exports);
|
|
106
|
+
var incremental_parse_state_field = __toESM(((module) => module && module.__esModule && 'default' in module ? module.default : module)(require('./incremental-parse-state-field.cjs')), 1);
|
|
107
|
+
var markdown_editor_views = __toESM(((module) => module && module.__esModule && 'default' in module ? module.default : module)(require('./markdown-editor-views.cjs')), 1);
|
|
108
|
+
var range_set = __toESM(((module) => module && module.__esModule && 'default' in module ? module.default : module)(require('./range-set.cjs')), 1);
|
|
103
109
|
var state_field_spec = __toESM(((module) => module && module.__esModule && 'default' in module ? module.default : module)(require('./state-field-spec.cjs')), 1);
|
|
104
110
|
// Annotate the CommonJS export names for ESM import in node:
|
|
105
111
|
0 && (module.exports = {
|
|
112
|
+
"incremental-parse-state-field": null,
|
|
113
|
+
"markdown-editor-views": null,
|
|
114
|
+
"range-set": null,
|
|
106
115
|
"state-field-spec": null
|
|
107
116
|
});
|
|
108
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
117
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb2RlbWlycm9yL2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qIFRISVMgSVMgQSBHRU5FUkFURUQvQlVORExFRCBGSUxFIEJZIEJVSUxEIFNDUklQVCAqL1xuXG5leHBvcnQgKiBhcyAnaW5jcmVtZW50YWwtcGFyc2Utc3RhdGUtZmllbGQnIGZyb20gJy4vaW5jcmVtZW50YWwtcGFyc2Utc3RhdGUtZmllbGQudHMnO1xuZXhwb3J0ICogYXMgJ21hcmtkb3duLWVkaXRvci12aWV3cycgZnJvbSAnLi9tYXJrZG93bi1lZGl0b3Itdmlld3MudHMnO1xuZXhwb3J0ICogYXMgJ3JhbmdlLXNldCcgZnJvbSAnLi9yYW5nZS1zZXQudHMnO1xuZXhwb3J0ICogYXMgJ3N0YXRlLWZpZWxkLXNwZWMnIGZyb20gJy4vc3RhdGUtZmllbGQtc3BlYy50cyc7XG4iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTtBQUFBO0FBQUEseUNBQUFBO0FBQUEsRUFBQSwrQkFBQUM7QUFBQSxFQUFBLG1CQUFBQztBQUFBLEVBQUEsMEJBQUFDO0FBQUE7QUFBQTtBQUVBLElBQUFILGdDQUFpRDtBQUNqRCxJQUFBQyx3QkFBeUM7QUFDekMsSUFBQUMsWUFBNkI7QUFDN0IsSUFBQUMsbUJBQW9DOyIsIm5hbWVzIjpbImluY3JlbWVudGFsLXBhcnNlLXN0YXRlLWZpZWxkIiwibWFya2Rvd24tZWRpdG9yLXZpZXdzIiwicmFuZ2Utc2V0Iiwic3RhdGUtZmllbGQtc3BlYyJdfQ==
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
/// <reference path="../library-references.d.cts" />
|
|
2
|
+
export * as 'incremental-parse-state-field' from './incremental-parse-state-field.cjs';
|
|
3
|
+
export * as 'markdown-editor-views' from './markdown-editor-views.cjs';
|
|
4
|
+
export * as 'range-set' from './range-set.cjs';
|
|
2
5
|
export * as 'state-field-spec' from './state-field-spec.cjs';
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
(function () {
|
|
6
|
+
function ensureBrowserProcess() {
|
|
7
|
+
const browserProcess = {
|
|
8
|
+
browser: true,
|
|
9
|
+
cwd() {
|
|
10
|
+
return "/";
|
|
11
|
+
},
|
|
12
|
+
env: {},
|
|
13
|
+
platform: "android"
|
|
14
|
+
};
|
|
15
|
+
const existingProcess = globalThis.process;
|
|
16
|
+
if (!existingProcess) {
|
|
17
|
+
globalThis.process = browserProcess;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (existingProcess.versions?.node) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const existingProcessRecord = existingProcess;
|
|
24
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
25
|
+
existingProcessRecord[key] ??= value;
|
|
26
|
+
}
|
|
27
|
+
existingProcessRecord["browser"] = true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ensureBrowserProcess();
|
|
31
|
+
})();
|
|
32
|
+
(function patchObsidianRequire() {
|
|
33
|
+
const originalRequire = require;
|
|
34
|
+
if (!originalRequire || originalRequire.__isPatched) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
require = Object.assign(
|
|
38
|
+
(id) => requirePatched(id),
|
|
39
|
+
originalRequire,
|
|
40
|
+
{
|
|
41
|
+
__isPatched: true
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
function extractDefault($module) {
|
|
45
|
+
return $module && $module.__esModule && "default" in $module ? $module.default : $module;
|
|
46
|
+
}
|
|
47
|
+
const OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
48
|
+
"@codemirror/autocomplete",
|
|
49
|
+
"@codemirror/collab",
|
|
50
|
+
"@codemirror/commands",
|
|
51
|
+
"@codemirror/language",
|
|
52
|
+
"@codemirror/lint",
|
|
53
|
+
"@codemirror/search",
|
|
54
|
+
"@codemirror/state",
|
|
55
|
+
"@codemirror/text",
|
|
56
|
+
"@codemirror/view",
|
|
57
|
+
"@lezer/common",
|
|
58
|
+
"@lezer/highlight",
|
|
59
|
+
"@lezer/lr",
|
|
60
|
+
"obsidian"
|
|
61
|
+
]);
|
|
62
|
+
const DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
63
|
+
"@codemirror/closebrackets",
|
|
64
|
+
"@codemirror/comment",
|
|
65
|
+
"@codemirror/fold",
|
|
66
|
+
"@codemirror/gutter",
|
|
67
|
+
"@codemirror/highlight",
|
|
68
|
+
"@codemirror/history",
|
|
69
|
+
"@codemirror/matchbrackets",
|
|
70
|
+
"@codemirror/panel",
|
|
71
|
+
"@codemirror/rangeset",
|
|
72
|
+
"@codemirror/rectangular-selection",
|
|
73
|
+
"@codemirror/stream-parser",
|
|
74
|
+
"@codemirror/tooltip"
|
|
75
|
+
]);
|
|
76
|
+
function requirePatched(id) {
|
|
77
|
+
if (OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id) || DEPRECATED_OBSIDIAN_BUILT_IN_MODULE_NAMES.has(id)) {
|
|
78
|
+
return originalRequire?.(id);
|
|
79
|
+
}
|
|
80
|
+
const app = globalThis.app;
|
|
81
|
+
if (app?.isMobile) {
|
|
82
|
+
if (id === "process" || id === "node:process") {
|
|
83
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Fake process object is returned instead.`);
|
|
84
|
+
return process;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
const $module = originalRequire?.(id);
|
|
88
|
+
if ($module) {
|
|
89
|
+
return extractDefault($module);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
console.debug(`The most likely you can safely ignore this error. Module not found: ${id}. Empty object is returned instead.`);
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
})();
|
|
96
|
+
|
|
97
|
+
"use strict";
|
|
98
|
+
var __defProp = Object.defineProperty;
|
|
99
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
100
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
101
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
102
|
+
var __export = (target, all) => {
|
|
103
|
+
for (var name in all)
|
|
104
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
105
|
+
};
|
|
106
|
+
var __copyProps = (to, from, except, desc) => {
|
|
107
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
108
|
+
for (let key of __getOwnPropNames(from))
|
|
109
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
110
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
111
|
+
}
|
|
112
|
+
return to;
|
|
113
|
+
};
|
|
114
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
115
|
+
var markdown_editor_views_exports = {};
|
|
116
|
+
__export(markdown_editor_views_exports, {
|
|
117
|
+
dispatchToAllMarkdownEditorViews: () => dispatchToAllMarkdownEditorViews,
|
|
118
|
+
getAllMarkdownEditorViews: () => getAllMarkdownEditorViews
|
|
119
|
+
});
|
|
120
|
+
module.exports = __toCommonJS(markdown_editor_views_exports);
|
|
121
|
+
var import_implementations = require('@obsidian-typings/obsidian-public-latest/implementations');
|
|
122
|
+
var import_obsidian = require('obsidian');
|
|
123
|
+
function dispatchToAllMarkdownEditorViews(app, ...specs) {
|
|
124
|
+
for (const editorView of getAllMarkdownEditorViews(app)) {
|
|
125
|
+
editorView.dispatch(...specs);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function getAllMarkdownEditorViews(app) {
|
|
129
|
+
const editorViews = [];
|
|
130
|
+
for (const leaf of app.workspace.getLeavesOfType(import_implementations.ViewType.Markdown)) {
|
|
131
|
+
if (leaf.view instanceof import_obsidian.MarkdownView) {
|
|
132
|
+
editorViews.push(leaf.view.editor.cm);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return editorViews;
|
|
136
|
+
}
|
|
137
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
138
|
+
0 && (module.exports = {
|
|
139
|
+
dispatchToAllMarkdownEditorViews,
|
|
140
|
+
getAllMarkdownEditorViews
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb2RlbWlycm9yL21hcmtkb3duLWVkaXRvci12aWV3cy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBmaWxlXG4gKlxuICogUmVhY2hlcyB0aGUgQ29kZU1pcnJvciB7QGxpbmsgRWRpdG9yVmlld30gb2YgZXZlcnkgb3BlbiBNYXJrZG93biB2aWV3LCBpbiBldmVyeSB3aW5kb3cuXG4gKlxuICogQSBNYXJrZG93biB2aWV3IGluIFJlYWRpbmcgbW9kZSBpcyBpbmNsdWRlZCBvbiBwdXJwb3NlOiBpdCBrZWVwcyBpdHMgc291cmNlIGVkaXRvciBhbGl2ZSB3aGlsZSBoaWRkZW4sIGFuZCBhXG4gKiByZWNvbmZpZ3VyZSBvciBzdGF0ZSBjaGFuZ2UgdGhhdCBza2lwcGVkIGl0IHdvdWxkIGxlYXZlIHRoYXQgZWRpdG9yIHN0YWxlIHdoZW4gdGhlIHVzZXIgc3dpdGNoZXMgYmFjay5cbiAqXG4gKiBPbmx5IGVkaXRvcnMgdGhhdCBsaXZlIGluIGEgd29ya3NwYWNlIGxlYWYgYXJlIHJlYWNoZWQuIEFuIGVkaXRvciBPYnNpZGlhbiBidWlsZHMgZWxzZXdoZXJlIChhIGN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AgIH1cbiAgfVxuICByZXR1cm4gZWRpdG9yVmlld3M7XG59XG4iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQWlCQSw2QkFBeUI7QUFDekIsc0JBQTZCO0FBWXRCLFNBQVMsaUNBQWlDLFFBQWEsT0FBZ0M7QUFDNUYsYUFBVyxjQUFjLDBCQUEwQixHQUFHLEdBQUc7QUFDdkQsZUFBVyxTQUFTLEdBQUcsS0FBSztBQUFBLEVBQzlCO0FBQ0Y7QUFRTyxTQUFTLDBCQUEwQixLQUF3QjtBQUNoRSxRQUFNLGNBQTRCLENBQUM7QUFDbkMsYUFBVyxRQUFRLElBQUksVUFBVSxnQkFBZ0IsZ0NBQVMsUUFBUSxHQUFHO0FBQ25FLFFBQUksS0FBSyxnQkFBZ0IsOEJBQWM7QUFDckMsa0JBQVksS0FBSyxLQUFLLEtBQUssT0FBTyxFQUFFO0FBQUEsSUFDdEM7QUFBQSxFQUNGO0FBQ0EsU0FBTztBQUNUOyIsIm5hbWVzIjpbXX0=
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference path="../library-references.d.cts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Reaches the CodeMirror {@link EditorView} of every open Markdown view, in every window.
|
|
6
|
+
*
|
|
7
|
+
* A Markdown view in Reading mode is included on purpose: it keeps its source editor alive while hidden, and a
|
|
8
|
+
* reconfigure or state change that skipped it would leave that editor stale when the user switches back.
|
|
9
|
+
*
|
|
10
|
+
* Only editors that live in a workspace leaf are reached. An editor Obsidian builds elsewhere (a canvas card, an
|
|
11
|
+
* editable embed, a hover popover) has no leaf, so it picks up registered extensions when it is created rather
|
|
12
|
+
* than through these helpers.
|
|
13
|
+
*/
|
|
14
|
+
import type { TransactionSpec } from '@codemirror/state' with { 'resolution-mode': 'import' };
|
|
15
|
+
import type { EditorView } from '@codemirror/view' with { 'resolution-mode': 'import' };
|
|
16
|
+
import type { App } from 'obsidian' with { 'resolution-mode': 'import' };
|
|
17
|
+
/**
|
|
18
|
+
* Dispatches the given transaction specs to the editor of every open Markdown view, in every window.
|
|
19
|
+
*
|
|
20
|
+
* Each editor receives its own transaction built from the same specs, so a spec must not carry positions that
|
|
21
|
+
* only make sense in one document. Annotations and state effects (such as a compartment reconfigure) are the
|
|
22
|
+
* intended payload.
|
|
23
|
+
*
|
|
24
|
+
* @param app - The Obsidian app instance.
|
|
25
|
+
* @param specs - The transaction specs to dispatch to every editor.
|
|
26
|
+
*/
|
|
27
|
+
export declare function dispatchToAllMarkdownEditorViews(app: App, ...specs: TransactionSpec[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the editor of every open Markdown view, in every window, Reading mode included.
|
|
30
|
+
*
|
|
31
|
+
* @param app - The Obsidian app instance.
|
|
32
|
+
* @returns The CodeMirror editor views.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getAllMarkdownEditorViews(app: App): EditorView[];
|