@kubohiroya/turbowarp-plus-editor-project-folder 0.20.0 → 0.20.2
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.ja.md +0 -2
- package/dist/explorer.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/{shared-CeJrx6Ve.js → shared-DkIVN2xk.js} +0 -18
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/text-file-editor.ts +1 -22
package/README.ja.md
CHANGED
|
@@ -113,8 +113,6 @@ TurboWarp Plus Editor は、ブロックパレットの設定を画面状態(`
|
|
|
113
113
|
|
|
114
114
|
この OPFS 対応は、ローカル連携の URL から開いた Editor の保存領域が対象です。通常の配信サイトとローカル連携では OPFS の保存領域が異なるため、配信サイトで既に作業している OPFS を直接共有しません。通常の配信サイトを開いたまま外部編集するための別オリジン接続は、この実装には含みません。
|
|
115
115
|
|
|
116
|
-
通常表示で内容の高さが表示領域より小さいときは、スクロール領域の上に操作ボタンの高さに合わせた空欄を設け、先頭行がボタンに隠れないようにします。内容の編集、画面サイズの変更、タブの再表示に応じて再計算します。差分表示にも、操作ボタンが差分や表示範囲の切り替えに重ならない空欄を設けています。
|
|
117
|
-
|
|
118
116
|
編集画面の右下には、ファイル全体と現在の表示範囲を示すミニマップを表示します。クリック・ドラッグで移動でき、ミニマップにフォーカスすると矢印・Page Up/Page Down・Home/End キーでもスクロールできます。編集、スクロール、パネルのサイズ変更、タブの再表示に追従します。差分表示では編集用のミニマップを隠します。
|
|
119
117
|
|
|
120
118
|
切り戻す場合はこの UI 変更を revert し、パッケージと Editor を再ビルドします。ファイル形式の変更やデータ移行はありません。対象のヘッドレス検証は `node --test test/text-file.browser.js` で実行します。
|
package/dist/explorer.js
CHANGED
|
@@ -1463,7 +1463,7 @@ function createFilePreview(directory, documentId, { name, path }, locale, readBa
|
|
|
1463
1463
|
status.textContent = message.large;
|
|
1464
1464
|
return;
|
|
1465
1465
|
}
|
|
1466
|
-
const [bytes, { decodeText, mountTextFile }] = await Promise.all([file.arrayBuffer(), import("./shared-
|
|
1466
|
+
const [bytes, { decodeText, mountTextFile }] = await Promise.all([file.arrayBuffer(), import("./shared-DkIVN2xk.js")]);
|
|
1467
1467
|
if (disposed) return;
|
|
1468
1468
|
const content = decodeText(bytes);
|
|
1469
1469
|
if (content === null) {
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ export declare function mountProjectFolder({ vm, document, host, locale, autoRel
|
|
|
70
70
|
status: "saved" | "unchanged";
|
|
71
71
|
sourceRemoved: string[];
|
|
72
72
|
}>;
|
|
73
|
+
/** Leaves the saved resource intact when another project or a catalog operation replaces it. */
|
|
74
|
+
detach: () => void;
|
|
73
75
|
/** The folders kept in this browser, when they are offered, for a host that lists or exports them. */
|
|
74
76
|
browserProjects: BrowserProjects | null;
|
|
75
77
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2224,6 +2224,8 @@ function mountProjectFolder({ vm, document, host, locale = "en", autoReload = tr
|
|
|
2224
2224
|
readUnsavedFile: (path) => session.readUnsavedFile(path),
|
|
2225
2225
|
subscribeEdits: (listener) => session.subscribeEdits(listener),
|
|
2226
2226
|
save: () => withBrowserProject(session.directory, () => session.save()).finally(renderReload),
|
|
2227
|
+
/** Leaves the saved resource intact when another project or a catalog operation replaces it. */
|
|
2228
|
+
detach: () => session.detach(),
|
|
2227
2229
|
/** The folders kept in this browser, when they are offered, for a host that lists or exports them. */
|
|
2228
2230
|
browserProjects,
|
|
2229
2231
|
/**
|
|
@@ -30016,7 +30016,6 @@ max-height:40%;overflow:auto;border-radius:.3rem;background:var(--ui-primary,#ff
|
|
|
30016
30016
|
box-sizing:border-box;max-width:calc(100% - 2rem);margin:0;padding:.65rem 1rem;border-radius:.35rem;
|
|
30017
30017
|
background:#323232;color:#fff;font-size:.9em;box-shadow:0 2px 8px rgba(0,0,0,.3);pointer-events:none}
|
|
30018
30018
|
.twpf-file-edit,.twpf-file-diff{flex:1;min-height:0}
|
|
30019
|
-
.twpf-file-edit.twpf-file-short{padding-top:var(--twpf-toolbar-height,3.25rem)}
|
|
30020
30019
|
.twpf-file-diff{padding-top:var(--twpf-toolbar-height,3.25rem)}
|
|
30021
30020
|
.twpf-file-edit>.cm-editor{height:100%}
|
|
30022
30021
|
.twpf-text-file .cm-scroller{overflow:auto}
|
|
@@ -30293,10 +30292,8 @@ function mountTextFile(parent, options) {
|
|
|
30293
30292
|
parent.append(shell);
|
|
30294
30293
|
const toolbarObserver = browser && new browser.ResizeObserver(() => {
|
|
30295
30294
|
panel.style.setProperty("--twpf-toolbar-height", `calc(${toolbar.getBoundingClientRect().height}px + 1rem)`);
|
|
30296
|
-
measureToolbarSpace();
|
|
30297
30295
|
});
|
|
30298
30296
|
toolbarObserver === null || toolbarObserver === void 0 || toolbarObserver.observe(toolbar);
|
|
30299
|
-
toolbarObserver === null || toolbarObserver === void 0 || toolbarObserver.observe(editPane);
|
|
30300
30297
|
const editing = new Compartment();
|
|
30301
30298
|
const view = new EditorView({
|
|
30302
30299
|
parent: editPane,
|
|
@@ -30314,23 +30311,9 @@ function mountTextFile(parent, options) {
|
|
|
30314
30311
|
keymap.of([...defaultKeymap, ...historyKeymap]),
|
|
30315
30312
|
EditorView.updateListener.of((update) => {
|
|
30316
30313
|
if (update.docChanged) updateSaveState(void 0, true);
|
|
30317
|
-
if (update.docChanged || update.geometryChanged) measureToolbarSpace();
|
|
30318
30314
|
})
|
|
30319
30315
|
]
|
|
30320
30316
|
});
|
|
30321
|
-
function measureToolbarSpace() {
|
|
30322
|
-
if (disposed || comparison) return;
|
|
30323
|
-
view.requestMeasure({
|
|
30324
|
-
key: editPane,
|
|
30325
|
-
read: (view) => {
|
|
30326
|
-
const available = editPane.clientHeight;
|
|
30327
|
-
return available ? view.contentHeight < available : null;
|
|
30328
|
-
},
|
|
30329
|
-
write: (short) => {
|
|
30330
|
-
if (!disposed && !comparison && short !== null) editPane.classList.toggle("twpf-file-short", short);
|
|
30331
|
-
}
|
|
30332
|
-
});
|
|
30333
|
-
}
|
|
30334
30317
|
const dirty = () => !view.state.doc.eq(savedDoc);
|
|
30335
30318
|
const serialize = () => bom + (newline === "\n" ? view.state.doc.toString() : view.state.doc.toString().replace(/\n/gu, newline));
|
|
30336
30319
|
let wasDirty = false;
|
|
@@ -30508,7 +30491,6 @@ function mountTextFile(parent, options) {
|
|
|
30508
30491
|
++readVersion;
|
|
30509
30492
|
baselineLoading = false;
|
|
30510
30493
|
destroyDiff();
|
|
30511
|
-
measureToolbarSpace();
|
|
30512
30494
|
}
|
|
30513
30495
|
}
|
|
30514
30496
|
async function loadBaseline() {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -399,6 +399,8 @@ export function mountProjectFolder({vm, document, host, locale = 'en', autoReloa
|
|
|
399
399
|
readUnsavedFile: (path: string) => session.readUnsavedFile(path),
|
|
400
400
|
subscribeEdits: (listener: () => void) => session.subscribeEdits(listener),
|
|
401
401
|
save: () => withBrowserProject(session.directory, () => session.save()).finally(renderReload),
|
|
402
|
+
/** Leaves the saved resource intact when another project or a catalog operation replaces it. */
|
|
403
|
+
detach: () => session.detach(),
|
|
402
404
|
/** The folders kept in this browser, when they are offered, for a host that lists or exports them. */
|
|
403
405
|
browserProjects,
|
|
404
406
|
/**
|
package/src/text-file-editor.ts
CHANGED
|
@@ -95,7 +95,6 @@ max-height:40%;overflow:auto;border-radius:.3rem;background:var(--ui-primary,#ff
|
|
|
95
95
|
box-sizing:border-box;max-width:calc(100% - 2rem);margin:0;padding:.65rem 1rem;border-radius:.35rem;
|
|
96
96
|
background:#323232;color:#fff;font-size:.9em;box-shadow:0 2px 8px rgba(0,0,0,.3);pointer-events:none}
|
|
97
97
|
.twpf-file-edit,.twpf-file-diff{flex:1;min-height:0}
|
|
98
|
-
.twpf-file-edit.twpf-file-short{padding-top:var(--twpf-toolbar-height,3.25rem)}
|
|
99
98
|
.twpf-file-diff{padding-top:var(--twpf-toolbar-height,3.25rem)}
|
|
100
99
|
.twpf-file-edit>.cm-editor{height:100%}
|
|
101
100
|
.twpf-text-file .cm-scroller{overflow:auto}
|
|
@@ -329,10 +328,8 @@ export function mountTextFile(parent: HTMLElement, options: TextFileOptions) {
|
|
|
329
328
|
parent.append(shell);
|
|
330
329
|
const toolbarObserver = browser && new browser.ResizeObserver(() => {
|
|
331
330
|
panel.style.setProperty('--twpf-toolbar-height', `calc(${toolbar.getBoundingClientRect().height}px + 1rem)`);
|
|
332
|
-
measureToolbarSpace();
|
|
333
331
|
});
|
|
334
332
|
toolbarObserver?.observe(toolbar);
|
|
335
|
-
toolbarObserver?.observe(editPane);
|
|
336
333
|
|
|
337
334
|
const editing = new Compartment();
|
|
338
335
|
const view = new EditorView({
|
|
@@ -342,26 +339,9 @@ export function mountTextFile(parent: HTMLElement, options: TextFileOptions) {
|
|
|
342
339
|
highlightActiveLine(), textMinimap(message.minimap),
|
|
343
340
|
EditorView.contentAttributes.of({'aria-label': options.path}),
|
|
344
341
|
keymap.of([...defaultKeymap, ...historyKeymap]),
|
|
345
|
-
EditorView.updateListener.of(update => {
|
|
346
|
-
if (update.docChanged) updateSaveState(undefined, true);
|
|
347
|
-
if (update.docChanged || update.geometryChanged) measureToolbarSpace();
|
|
348
|
-
})
|
|
342
|
+
EditorView.updateListener.of(update => {if (update.docChanged) updateSaveState(undefined, true);})
|
|
349
343
|
]
|
|
350
344
|
});
|
|
351
|
-
function measureToolbarSpace() {
|
|
352
|
-
if (disposed || comparison) return;
|
|
353
|
-
view.requestMeasure({
|
|
354
|
-
key: editPane,
|
|
355
|
-
read: view => {
|
|
356
|
-
// Include the reserved space when comparing, so adding it cannot flip the decision back.
|
|
357
|
-
const available = editPane.clientHeight;
|
|
358
|
-
return available ? view.contentHeight < available : null;
|
|
359
|
-
},
|
|
360
|
-
write: short => {
|
|
361
|
-
if (!disposed && !comparison && short !== null) editPane.classList.toggle('twpf-file-short', short);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
345
|
const dirty = () => !view.state.doc.eq(savedDoc);
|
|
366
346
|
const serialize = () => bom + (newline === '\n' ? view.state.doc.toString() : view.state.doc.toString().replace(/\n/gu, newline));
|
|
367
347
|
|
|
@@ -544,7 +524,6 @@ export function mountTextFile(parent: HTMLElement, options: TextFileOptions) {
|
|
|
544
524
|
++readVersion;
|
|
545
525
|
baselineLoading = false;
|
|
546
526
|
destroyDiff();
|
|
547
|
-
measureToolbarSpace();
|
|
548
527
|
}
|
|
549
528
|
}
|
|
550
529
|
|