@reformer/builder-plugin-api 1.0.0-beta.1

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.
Files changed (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +206 -0
  3. package/dist/index.d.ts +147 -0
  4. package/dist/index.js +76 -0
  5. package/dist/internal.d.ts +78 -0
  6. package/dist/internal.js +289 -0
  7. package/dist/permissions-BWlsUVPs.js +551 -0
  8. package/dist/plugin/bundled-modules.d.ts +25 -0
  9. package/dist/plugin/layout.d.ts +27 -0
  10. package/dist/plugin/manifest-parser.d.ts +54 -0
  11. package/dist/plugin/manifest.d.ts +320 -0
  12. package/dist/plugin/messages-bundle.d.ts +24 -0
  13. package/dist/plugin/permissions.d.ts +48 -0
  14. package/dist/plugin/plugin-exports.d.ts +10 -0
  15. package/dist/plugin/runtime-modules.d.ts +20 -0
  16. package/dist/plugin/storage.d.ts +70 -0
  17. package/dist/plugin/types.d.ts +136 -0
  18. package/dist/primitives/capability.d.ts +72 -0
  19. package/dist/primitives/command.d.ts +262 -0
  20. package/dist/primitives/disposable.d.ts +23 -0
  21. package/dist/primitives/event.d.ts +38 -0
  22. package/dist/primitives/extension-point.d.ts +53 -0
  23. package/dist/primitives/module-path.d.ts +21 -0
  24. package/dist/primitives/resource.d.ts +159 -0
  25. package/dist/primitives/semver.d.ts +93 -0
  26. package/dist/primitives/service.d.ts +68 -0
  27. package/dist/primitives/when-context.d.ts +69 -0
  28. package/dist/primitives/when-expr.d.ts +177 -0
  29. package/dist/resource-clipboard-Bdk_Is5N.js +381 -0
  30. package/dist/runtime-modules-CiUDFMIn.js +597 -0
  31. package/dist/services/context-keys.d.ts +52 -0
  32. package/dist/services/diagnostics/fixes.d.ts +40 -0
  33. package/dist/services/diagnostics/service.d.ts +34 -0
  34. package/dist/services/diagnostics/types.d.ts +148 -0
  35. package/dist/services/document-models.d.ts +20 -0
  36. package/dist/services/documents.d.ts +94 -0
  37. package/dist/services/host-messages.d.ts +10 -0
  38. package/dist/services/i18n.d.ts +43 -0
  39. package/dist/services/modules.d.ts +49 -0
  40. package/dist/services/notifications.d.ts +56 -0
  41. package/dist/services/plugin-settings.d.ts +10 -0
  42. package/dist/services/plugins-catalog.d.ts +58 -0
  43. package/dist/services/preview.d.ts +163 -0
  44. package/dist/services/prompt.d.ts +111 -0
  45. package/dist/services/resource-clipboard.d.ts +28 -0
  46. package/dist/services/selection.d.ts +46 -0
  47. package/dist/services/settings.d.ts +44 -0
  48. package/dist/services/theme.d.ts +15 -0
  49. package/dist/services/validation/types.d.ts +98 -0
  50. package/dist/services/workspace-files.d.ts +84 -0
  51. package/dist/services/workspace-resources.d.ts +41 -0
  52. package/dist/services/workspace-save.d.ts +18 -0
  53. package/dist/tooling.d.ts +28 -0
  54. package/dist/tooling.js +35 -0
  55. package/dist/ui/contributions/decorations.d.ts +55 -0
  56. package/dist/ui/contributions/editors.d.ts +58 -0
  57. package/dist/ui/contributions/plugin-settings.d.ts +54 -0
  58. package/dist/ui/keyboard/keybinding-rules.d.ts +48 -0
  59. package/dist/ui/keyboard/keybindings.d.ts +55 -0
  60. package/dist/ui/keyboard/keymap.d.ts +81 -0
  61. package/dist/ui/keyboard/scope.d.ts +38 -0
  62. package/dist/ui/menu/editor-menu.d.ts +25 -0
  63. package/dist/ui/menu/menu.d.ts +228 -0
  64. package/dist/ui/menu/palette.d.ts +36 -0
  65. package/dist/ui/menu/resource-menu.d.ts +45 -0
  66. package/dist/ui/slots.d.ts +113 -0
  67. package/dist/ui/useActiveDocument.d.ts +5 -0
  68. package/dist/ui/useLocale.d.ts +9 -0
  69. package/dist/ui/useTranslate.d.ts +4 -0
  70. package/dist/workspace/document.d.ts +42 -0
  71. package/dist/workspace/model/editor-view-states.d.ts +29 -0
  72. package/dist/workspace/model/model-document.d.ts +86 -0
  73. package/dist/workspace/model/provider.d.ts +140 -0
  74. package/dist/workspace/model/text-editor-focus.d.ts +22 -0
  75. package/dist/workspace/resource-names.d.ts +92 -0
  76. package/dist/workspace/write-options.d.ts +36 -0
  77. package/package.json +69 -0
@@ -0,0 +1,381 @@
1
+ import { useCallback as l, useSyncExternalStore as p, useMemo as S } from "react";
2
+ import { a as h, b as m, g as b, s as E } from "./permissions-BWlsUVPs.js";
3
+ function G(e) {
4
+ if (e.id.trim() === "")
5
+ throw new Error("definePlugin: идентификатор плагина не может быть пустым");
6
+ return Object.freeze(e);
7
+ }
8
+ function w(e) {
9
+ const t = l(
10
+ (n) => {
11
+ const o = e.onDidChangeLocale(n);
12
+ return () => {
13
+ o.dispose();
14
+ };
15
+ },
16
+ [e]
17
+ ), r = l(() => e.locale, [e]);
18
+ return p(t, r, r);
19
+ }
20
+ function Q(e) {
21
+ const t = w(e);
22
+ return S(() => (r, n) => e.t(r, n), [e, t]);
23
+ }
24
+ const f = ":";
25
+ function C(e, t) {
26
+ return `${e}${f}${t}`;
27
+ }
28
+ function T(e) {
29
+ const t = e.indexOf(f);
30
+ return t <= 0 ? { pluginId: null, key: e } : { pluginId: e.slice(0, t), key: e.slice(t + f.length) };
31
+ }
32
+ const y = 255, O = /[\\/:*?"<>|]/, k = /[\u0000-\u001f\u007f]/, R = /* @__PURE__ */ new Set([
33
+ "con",
34
+ "prn",
35
+ "aux",
36
+ "nul",
37
+ "com1",
38
+ "com2",
39
+ "com3",
40
+ "com4",
41
+ "com5",
42
+ "com6",
43
+ "com7",
44
+ "com8",
45
+ "com9",
46
+ "lpt1",
47
+ "lpt2",
48
+ "lpt3",
49
+ "lpt4",
50
+ "lpt5",
51
+ "lpt6",
52
+ "lpt7",
53
+ "lpt8",
54
+ "lpt9"
55
+ ]);
56
+ function J(e) {
57
+ if (e.trim() === "") return "empty";
58
+ if (e.includes("/")) return "separator";
59
+ if (e === "." || e === "..") return "dots";
60
+ if (k.test(e) || O.test(e)) return "forbidden-character";
61
+ if (e.endsWith(".") || e.endsWith(" ")) return "trailing";
62
+ if (e.length > y) return "too-long";
63
+ const t = e.split(".")[0] ?? "";
64
+ return R.has(t.toLowerCase()) ? "reserved" : null;
65
+ }
66
+ function P(e) {
67
+ const t = e.lastIndexOf(".");
68
+ return t <= 0 ? { stem: e, ext: "" } : { stem: e.slice(0, t), ext: e.slice(t) };
69
+ }
70
+ function Z(e, t, r = "copy") {
71
+ const n = /* @__PURE__ */ new Set();
72
+ for (const i of e) n.add(i.toLowerCase());
73
+ if (!n.has(t.toLowerCase())) return t;
74
+ const { stem: o, ext: s } = P(t);
75
+ for (let i = 2; i <= x; i++) {
76
+ const d = `${o}-${i}${s}`;
77
+ if (!n.has(d.toLowerCase())) return d;
78
+ }
79
+ return `${o}-${r}${s}`;
80
+ }
81
+ const x = 999;
82
+ function ee(e, t) {
83
+ return t === "" ? !0 : e === t || e.startsWith(`${t}/`);
84
+ }
85
+ const I = Object.freeze([]);
86
+ function D(e, t, r = {}) {
87
+ const n = e.fixes;
88
+ if (n === void 0 || n.length === 0) return I;
89
+ let o = !1;
90
+ const s = [];
91
+ for (const i of n) {
92
+ if (t(i.commandId)) {
93
+ s.push(i);
94
+ continue;
95
+ }
96
+ o = !0, r.onUnavailable?.(i, e);
97
+ }
98
+ return o ? s : n;
99
+ }
100
+ function _(e) {
101
+ const t = { ...e };
102
+ return delete t.fixes, t;
103
+ }
104
+ function te(e, t, r = {}) {
105
+ let n = !1;
106
+ const o = [];
107
+ for (const s of e) {
108
+ const i = D(s, t, r);
109
+ if (i === s.fixes || i.length === 0 && s.fixes === void 0) {
110
+ o.push(s);
111
+ continue;
112
+ }
113
+ n = !0, o.push(i.length === 0 ? _(s) : { ...s, fixes: i });
114
+ }
115
+ return n ? o : e;
116
+ }
117
+ function u(e) {
118
+ if (e.trim() === "")
119
+ throw new Error("defineExtensionPoint: идентификатор точки расширения не может быть пустым");
120
+ return Object.freeze({ id: e });
121
+ }
122
+ const re = u("validator"), A = "#async";
123
+ function ne(e) {
124
+ return e;
125
+ }
126
+ function oe(e) {
127
+ return `${e}${A}`;
128
+ }
129
+ const N = Object.freeze([
130
+ "rail.left",
131
+ "panel.left",
132
+ "panel.right",
133
+ "panel.bottom",
134
+ "toolbar",
135
+ "statusbar",
136
+ "editor.main"
137
+ ]);
138
+ function se(e) {
139
+ return typeof e == "string" && N.includes(e);
140
+ }
141
+ const ie = u("panel"), ae = u("editor"), ce = u("resource.decoration"), ue = u("palette.items"), le = u("catalog-plugin.settings");
142
+ function fe(e) {
143
+ if (e.trim() === "")
144
+ throw new Error("pluginSettingsKey: идентификатор плагина не может быть пустым");
145
+ return `workspace.plugin.${e}.settings`;
146
+ }
147
+ function c(e) {
148
+ if (e.trim() === "")
149
+ throw new Error("defineService: идентификатор сервиса не может быть пустым");
150
+ return Object.freeze({ id: e });
151
+ }
152
+ const de = c("reformer.scopes"), pe = "dialog", me = c("reformer.keymap");
153
+ function ge(e, t) {
154
+ return e.all().find((r) => r.commandId === t)?.chord;
155
+ }
156
+ function ve(e) {
157
+ const t = typeof navigator > "u" ? null : navigator, r = e ?? t?.platform ?? t?.userAgent ?? "";
158
+ return /mac|iphone|ipad|ipod/i.test(r) ? "meta" : "ctrl";
159
+ }
160
+ function $(e, t) {
161
+ const r = h(e);
162
+ if (!r.startsWith("mod+")) return r;
163
+ const n = r.slice(4);
164
+ if (t === "ctrl") return n.startsWith("ctrl+") ? n : `ctrl+${n}`;
165
+ if (n.startsWith("ctrl+")) {
166
+ const o = n.slice(5);
167
+ return o.startsWith("meta+") ? n : `ctrl+meta+${o}`;
168
+ }
169
+ return n.startsWith("meta+") ? n : `meta+${n}`;
170
+ }
171
+ const M = [
172
+ ["ctrl", "Ctrl"],
173
+ ["meta", "Cmd"],
174
+ ["alt", "Alt"],
175
+ ["shift", "Shift"]
176
+ ], L = {
177
+ escape: "Esc",
178
+ arrowleft: "←",
179
+ arrowright: "→",
180
+ arrowup: "↑",
181
+ arrowdown: "↓",
182
+ space: "Space",
183
+ enter: "Enter",
184
+ backspace: "Backspace",
185
+ delete: "Delete",
186
+ tab: "Tab"
187
+ };
188
+ function j(e) {
189
+ const t = L[e];
190
+ return t !== void 0 ? t : e.length === 1 ? e.toUpperCase() : e.charAt(0).toUpperCase() + e.slice(1);
191
+ }
192
+ function W(e, t) {
193
+ let r;
194
+ try {
195
+ r = $(e, t);
196
+ } catch {
197
+ return e;
198
+ }
199
+ const n = [];
200
+ for (const [o, s] of M)
201
+ r.startsWith(`${o}+`) && (n.push(s), r = r.slice(o.length + 1));
202
+ return n.push(j(r)), n.join("+");
203
+ }
204
+ const U = " ";
205
+ function Se(e, t) {
206
+ return e.map((r) => W(r, t)).join(U);
207
+ }
208
+ const he = c("reformer.context-keys");
209
+ function a(e) {
210
+ if (e.id.trim() === "")
211
+ throw new Error("defineCapability: идентификатор возможности не может быть пустым");
212
+ if (m(e.version) === void 0)
213
+ throw new Error(
214
+ `defineCapability: «${e.id}» объявляет версию «${e.version}», а нужна версия вида «1.0.0». Диапазон здесь недопустим: это объявление того, что есть, а не требование к чужому, а пререлизы утилита версий не поддерживает (см. ./semver)`
215
+ );
216
+ return Object.freeze({ id: e.id.trim(), version: e.version.trim() });
217
+ }
218
+ function be(e, t) {
219
+ if (e.id !== t.id) return !1;
220
+ const r = m(e.version), n = b(t.range);
221
+ return r === void 0 || n === void 0 ? !1 : E(r, n);
222
+ }
223
+ const Ee = c("reformer.settings"), we = c("reformer.theme"), Ce = c("reformer.notifications"), Te = c("reformer.diagnostics"), F = a(
224
+ { id: "reformer.workspace", version: "1.0.0" }
225
+ ), ye = F, K = a({ id: "reformer.workspace.files", version: "1.1.0" }), Oe = K, z = a({ id: "reformer.plugins.catalog", version: "1.0.0" }), ke = z, V = a({
226
+ id: "reformer.workspace.resources",
227
+ version: "1.0.0"
228
+ }), Re = V, X = a({ id: "reformer.workspace.save", version: "1.0.0" }), Pe = X;
229
+ function xe(e) {
230
+ const t = l(
231
+ (n) => {
232
+ const o = e.onDidChange(n);
233
+ return () => {
234
+ o.dispose();
235
+ };
236
+ },
237
+ [e]
238
+ ), r = l(() => e.activeResource(), [e]);
239
+ return p(t, r, r);
240
+ }
241
+ const B = a({
242
+ id: "reformer.editor.focus",
243
+ version: "1.0.0"
244
+ }), Ie = B, H = a({ id: "reformer.editor.view-state", version: "1.0.0" }), De = H, _e = c("reformer.selection"), Ae = u("preview.surface"), Ne = a({ id: "reformer.preview.live", version: "1.0.0" }), $e = u("document.model"), Me = a({ id: "reformer.workspace.models", version: "1.0.0" }), Le = a({ id: "reformer.modules", version: "1.0.0" }), je = a({ id: "reformer.host.messages", version: "1.0.0" }), We = Object.freeze({
245
+ error: 3,
246
+ warning: 2,
247
+ info: 1
248
+ });
249
+ function Ue(e, t) {
250
+ return C(e, t);
251
+ }
252
+ function Fe(e) {
253
+ const t = T(e);
254
+ return { pluginId: t.pluginId, code: t.key };
255
+ }
256
+ const Ke = Object.freeze(["file", "help"]), ze = Object.freeze([
257
+ "resource/context",
258
+ "editor/title"
259
+ ]), Ve = u("menu"), Xe = "resource/context";
260
+ function g(e) {
261
+ if (typeof e != "object" || e === null) return null;
262
+ const t = e;
263
+ return typeof t.dir != "string" || !Array.isArray(t.selection) || t.ref !== null && typeof t.ref != "object" ? null : t;
264
+ }
265
+ function Be(e) {
266
+ return (t, r) => {
267
+ const n = g(r);
268
+ return n !== null && e(n, t);
269
+ };
270
+ }
271
+ function He(e) {
272
+ return (t) => {
273
+ const r = g(t);
274
+ return r === null ? void 0 : e(r);
275
+ };
276
+ }
277
+ function Ye(e) {
278
+ return e.selection.map((t) => t.id);
279
+ }
280
+ const qe = "editor/title";
281
+ function v(e) {
282
+ if (typeof e != "object" || e === null) return null;
283
+ const t = e;
284
+ return typeof t.documentId != "string" || typeof t.ref != "object" || t.ref === null ? null : t;
285
+ }
286
+ function Ge(e) {
287
+ return (t, r) => {
288
+ const n = v(r);
289
+ return n !== null && e(n, t);
290
+ };
291
+ }
292
+ function Qe(e) {
293
+ return (t) => {
294
+ const r = v(t);
295
+ return r === null ? void 0 : e(r);
296
+ };
297
+ }
298
+ const Je = c("reformer.prompt"), Ze = c("reformer.clipboard");
299
+ export {
300
+ ze as $,
301
+ X as A,
302
+ xe as B,
303
+ le as C,
304
+ pe as D,
305
+ ae as E,
306
+ Ie as F,
307
+ De as G,
308
+ _e as H,
309
+ Ae as I,
310
+ Ne as J,
311
+ me as K,
312
+ $e as L,
313
+ Me as M,
314
+ Ce as N,
315
+ Le as O,
316
+ ie as P,
317
+ je as Q,
318
+ ce as R,
319
+ de as S,
320
+ we as T,
321
+ We as U,
322
+ re as V,
323
+ Oe as W,
324
+ Ue as X,
325
+ Fe as Y,
326
+ Ve as Z,
327
+ Ke as _,
328
+ P as a,
329
+ Xe as a0,
330
+ He as a1,
331
+ g as a2,
332
+ Ye as a3,
333
+ Be as a4,
334
+ qe as a5,
335
+ Qe as a6,
336
+ Ge as a7,
337
+ Je as a8,
338
+ Ze as a9,
339
+ be as aa,
340
+ u as ab,
341
+ F as ac,
342
+ A as ad,
343
+ ne as ae,
344
+ oe as af,
345
+ $ as ag,
346
+ v as ah,
347
+ N as ai,
348
+ se as aj,
349
+ w as ak,
350
+ H as al,
351
+ B as am,
352
+ y as an,
353
+ Z as ao,
354
+ x as ap,
355
+ ee as aq,
356
+ D as b,
357
+ ue as c,
358
+ G as d,
359
+ fe as e,
360
+ ge as f,
361
+ ve as g,
362
+ Se as h,
363
+ W as i,
364
+ he as j,
365
+ c as k,
366
+ a as l,
367
+ Ee as m,
368
+ Te as n,
369
+ ye as o,
370
+ C as p,
371
+ K as q,
372
+ ke as r,
373
+ T as s,
374
+ z as t,
375
+ Q as u,
376
+ J as v,
377
+ te as w,
378
+ Re as x,
379
+ V as y,
380
+ Pe as z
381
+ };