@kubohiroya/turbowarp-extension-security-dialog 0.8.8 → 0.9.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/NOTICE.md +26 -0
- package/README.ja.md +24 -1
- package/README.md +24 -1
- package/dist/build-info.json +2 -2
- package/dist/extension-row.d.ts +37 -0
- package/dist/index.cjs +2 -0
- package/dist/index.mjs +2 -0
- package/dist/inline-name.d.ts +5 -0
- package/dist/react.cjs +6427 -169
- package/dist/react.d.ts +2 -0
- package/dist/react.mjs +6427 -169
- package/dist/review.d.ts +2 -2
- package/dist/turbowarp.cjs +33 -4
- package/dist/turbowarp.d.ts +2 -0
- package/dist/turbowarp.mjs +33 -4
- package/package.json +3 -1
package/NOTICE.md
CHANGED
|
@@ -16,6 +16,32 @@ published package.
|
|
|
16
16
|
hat block with a warp swirl and a plus sign, drawn by the same author for the TurboWarp-Plus Editor)
|
|
17
17
|
with a green check over it. It is embedded into `dist` the same way.
|
|
18
18
|
|
|
19
|
+
## JavaScript parsing
|
|
20
|
+
|
|
21
|
+
The review bundles Acorn and Acorn Walk to read extension names without executing the source.
|
|
22
|
+
Both are distributed under the MIT license below.
|
|
23
|
+
|
|
24
|
+
Acorn copyright (C) 2012-2022 by various contributors (see [AUTHORS](https://github.com/acornjs/acorn/blob/master/acorn/AUTHORS)).
|
|
25
|
+
Acorn Walk copyright (C) 2012-2020 by various contributors (see [AUTHORS](https://github.com/acornjs/acorn/blob/master/acorn-walk/AUTHORS)).
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in
|
|
35
|
+
all copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
43
|
+
THE SOFTWARE.
|
|
44
|
+
|
|
19
45
|
## Build provenance
|
|
20
46
|
|
|
21
47
|
Published archives include `dist/build-info.json` with this package's name, version and full Git
|
package/README.ja.md
CHANGED
|
@@ -46,7 +46,7 @@ VM は機能拡張を1つずつ読み込み、そのたびに尋ねます。作
|
|
|
46
46
|
| import | 中身 |
|
|
47
47
|
| --- | --- |
|
|
48
48
|
| `.` | カタログの読み込み、拡張自身の申告の読み取り、依存の閉包、開く人の選択の記憶、取得待ちのダイアログ、文言 |
|
|
49
|
-
| `./react` | 画面そのもの `ExtensionReview` |
|
|
49
|
+
| `./react` | 画面そのもの `ExtensionReview` と、一覧の1行 `ExtensionRow` |
|
|
50
50
|
| `./turbowarp` | VM を包んで問いを先に出す `installBatchExtensionLoader` |
|
|
51
51
|
| `./styles.css`、`./webpack4.css` | 画面のスタイル。後者は CSS modules 向けにクラス名を `:global()` で包んだもの |
|
|
52
52
|
|
|
@@ -132,6 +132,29 @@ import '@kubohiroya/turbowarp-extension-security-dialog/styles.css';
|
|
|
132
132
|
**記録された答えは、いまも選択肢である場合だけ尊重します。** 作品が `remote-cacheable` から
|
|
133
133
|
埋め込みに変わった、行が信頼済みになった、といった場合に、もう提示しない答えを持ち込みません。
|
|
134
134
|
|
|
135
|
+
### 一覧の1行だけを使う
|
|
136
|
+
|
|
137
|
+
`ExtensionRow` は、画面の各行と同じ1行を描きます。拡張の名前(チェックボックス付きも可)、ID、信頼済みの印、版とリリースノートへのリンク、画像、概要、製作者と連絡先です。ほかの画面で機能拡張を並べるときにも、拡張が同じ見た目になります。TurboWarp Plus Editor では、ブロックパレットの表示を選ぶ画面が使います。
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
import {ExtensionRow} from '@kubohiroya/turbowarp-extension-security-dialog/react';
|
|
141
|
+
import '@kubohiroya/turbowarp-extension-security-dialog/styles.css';
|
|
142
|
+
|
|
143
|
+
<ul>
|
|
144
|
+
<ExtensionRow
|
|
145
|
+
metadata={{name: 'Pen Plus', author: 'Creator', version: '2.0.0'}}
|
|
146
|
+
ids={['penplus']}
|
|
147
|
+
locale="ja"
|
|
148
|
+
pick={{checked: shown, onToggle: () => setShown(!shown)}} // 省くとチェックボックスなし
|
|
149
|
+
itemProps={{'data-key': 'penplus'}}
|
|
150
|
+
>
|
|
151
|
+
{/* 製作者の下に、ホスト自身の内容を置く */}
|
|
152
|
+
</ExtensionRow>
|
|
153
|
+
</ul>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`details` は見出しと画像のあいだに置く内容で、確認画面は読み込み元とダイジェストをここに出します。`children` は製作者の下に置く内容で、確認画面は実行方法と読み込み元の選択をここに出します。行は `<li>` なので、`<ul>` か `<ol>` の中に置きます。`pick.disabled` のときは、チェックボックスも画像も選択を変えません。
|
|
157
|
+
|
|
135
158
|
### 読み込みに失敗したとき
|
|
136
159
|
|
|
137
160
|
```tsx
|
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ revisions, bundle integrity, image hashes and interaction checks, and the
|
|
|
44
44
|
| Import | What it is |
|
|
45
45
|
| --- | --- |
|
|
46
46
|
| `.` | Reading a catalog, reading an extension's own description, closing a selection over its dependencies, remembering what the opener chose, the wait dialog, wording |
|
|
47
|
-
| `./react` | `ExtensionReview`, the screen |
|
|
47
|
+
| `./react` | `ExtensionReview`, the screen, and `ExtensionRow`, one row of its list |
|
|
48
48
|
| `./turbowarp` | `installBatchExtensionLoader`, which wraps a VM so the question comes first |
|
|
49
49
|
| `./styles.css`, `./webpack4.css` | The screen's styles; the second has class names wrapped in `:global()` for a CSS-modules build |
|
|
50
50
|
|
|
@@ -123,6 +123,29 @@ GitHub versions link to their release notes. The description preserves line brea
|
|
|
123
123
|
HTTP(S) URLs and email addresses into links. The creator's contact appears next to their name
|
|
124
124
|
when supplied.
|
|
125
125
|
|
|
126
|
+
### Using one row of the list
|
|
127
|
+
|
|
128
|
+
`ExtensionRow` draws the same row the screen draws for each extension: its name (with a checkbox, if it can be chosen), IDs, trusted mark, version with a link to its release notes, picture, description, and creator with contact. Another screen that lists extensions shows them the same way. In TurboWarp Plus Editor, the screen that chooses which block palette groups to show uses it.
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import {ExtensionRow} from '@kubohiroya/turbowarp-extension-security-dialog/react';
|
|
132
|
+
import '@kubohiroya/turbowarp-extension-security-dialog/styles.css';
|
|
133
|
+
|
|
134
|
+
<ul>
|
|
135
|
+
<ExtensionRow
|
|
136
|
+
metadata={{name: 'Pen Plus', author: 'Creator', version: '2.0.0'}}
|
|
137
|
+
ids={['penplus']}
|
|
138
|
+
locale="en"
|
|
139
|
+
pick={{checked: shown, onToggle: () => setShown(!shown)}} // leave out for no checkbox
|
|
140
|
+
itemProps={{'data-key': 'penplus'}}
|
|
141
|
+
>
|
|
142
|
+
{/* the host's own content, after the creator */}
|
|
143
|
+
</ExtensionRow>
|
|
144
|
+
</ul>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`details` goes between the heading and the picture; the review screen puts the source and digest there. `children` goes after the creator; the review screen puts its execution and loading choices there. The row is an `<li>`, so put it in a `<ul>` or `<ol>`. When `pick.disabled` is set, neither the checkbox nor the picture changes the choice.
|
|
148
|
+
|
|
126
149
|
### When loading fails
|
|
127
150
|
|
|
128
151
|
```tsx
|
package/dist/build-info.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ExtensionMetadata } from './review-types.js';
|
|
3
|
+
import type { PreviewCache } from './storage.js';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export interface ExtensionRowPick {
|
|
6
|
+
/** Whether the row is chosen. */
|
|
7
|
+
checked: boolean;
|
|
8
|
+
/** A choice the person cannot change here, such as an extension another one needs. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onToggle(): void;
|
|
11
|
+
}
|
|
12
|
+
export interface ExtensionRowProps {
|
|
13
|
+
/** What the extension says about itself: name, description, creator, version and links. */
|
|
14
|
+
metadata: ExtensionMetadata;
|
|
15
|
+
/** The extension IDs; shown beside the name, or as the name when the extension has none. */
|
|
16
|
+
ids?: readonly string[];
|
|
17
|
+
locale?: string;
|
|
18
|
+
/** Marks the row as trusted by the host. */
|
|
19
|
+
trusted?: boolean;
|
|
20
|
+
/** Given, the row has a checkbox, and its picture chooses the same way. */
|
|
21
|
+
pick?: ExtensionRowPick;
|
|
22
|
+
/** Where pictures are kept between visits; null keeps nothing. */
|
|
23
|
+
previewCache?: PreviewCache | null;
|
|
24
|
+
/** Extra attributes for the list item, such as `data-key`. */
|
|
25
|
+
itemProps?: Record<string, string | undefined>;
|
|
26
|
+
/** Shown between the heading and the picture, such as where the extension loads from. */
|
|
27
|
+
details?: ReactNode;
|
|
28
|
+
/** Shown after the creator, such as the host's own choices for this extension. */
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One extension in a list: a heading with its name (and checkbox, when it can be chosen), its
|
|
33
|
+
* picture, what it says it does and who made it. The review screen and any other list of
|
|
34
|
+
* extensions draw the same row, so an extension looks the same wherever it is offered.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ExtensionRow: ({ metadata, ids, locale, trusted, pick, previewCache, itemProps, details, children }: ExtensionRowProps) => React.JSX.Element;
|
|
37
|
+
export default ExtensionRow;
|
package/dist/index.cjs
CHANGED
|
@@ -588,6 +588,7 @@ var messages = {
|
|
|
588
588
|
licenseUnknown: "Not stated",
|
|
589
589
|
version: "Version",
|
|
590
590
|
extensionPage: "Extension website",
|
|
591
|
+
extensionUnknown: "Unknown extension",
|
|
591
592
|
releaseNotes: "Release notes",
|
|
592
593
|
digest: "SHA-256",
|
|
593
594
|
failed: "Could not be loaded",
|
|
@@ -634,6 +635,7 @@ var messages = {
|
|
|
634
635
|
licenseUnknown: "\u8A18\u8F09\u306A\u3057",
|
|
635
636
|
version: "\u30D0\u30FC\u30B8\u30E7\u30F3",
|
|
636
637
|
extensionPage: "\u6A5F\u80FD\u62E1\u5F35\u306E\u7D39\u4ECB\u30DA\u30FC\u30B8",
|
|
638
|
+
extensionUnknown: "\u4E0D\u660E\u306A\u6A5F\u80FD\u62E1\u5F35",
|
|
637
639
|
releaseNotes: "\u30EA\u30EA\u30FC\u30B9\u30CE\u30FC\u30C8",
|
|
638
640
|
digest: "SHA-256",
|
|
639
641
|
failed: "\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F",
|
package/dist/index.mjs
CHANGED
|
@@ -543,6 +543,7 @@ var messages = {
|
|
|
543
543
|
licenseUnknown: "Not stated",
|
|
544
544
|
version: "Version",
|
|
545
545
|
extensionPage: "Extension website",
|
|
546
|
+
extensionUnknown: "Unknown extension",
|
|
546
547
|
releaseNotes: "Release notes",
|
|
547
548
|
digest: "SHA-256",
|
|
548
549
|
failed: "Could not be loaded",
|
|
@@ -589,6 +590,7 @@ var messages = {
|
|
|
589
590
|
licenseUnknown: "\u8A18\u8F09\u306A\u3057",
|
|
590
591
|
version: "\u30D0\u30FC\u30B8\u30E7\u30F3",
|
|
591
592
|
extensionPage: "\u6A5F\u80FD\u62E1\u5F35\u306E\u7D39\u4ECB\u30DA\u30FC\u30B8",
|
|
593
|
+
extensionUnknown: "\u4E0D\u660E\u306A\u6A5F\u80FD\u62E1\u5F35",
|
|
592
594
|
releaseNotes: "\u30EA\u30EA\u30FC\u30B9\u30CE\u30FC\u30C8",
|
|
593
595
|
digest: "SHA-256",
|
|
594
596
|
failed: "\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a single extension's literal getInfo name from source without calling it.
|
|
3
|
+
* Keep the parse bounded for untrusted bundles and leave dynamic or ambiguous names to the ID.
|
|
4
|
+
*/
|
|
5
|
+
export declare function readInlineExtensionName(source: string, ids: readonly string[]): string | undefined;
|