@kubohiroya/turbowarp-extension-data-editor 0.8.2 → 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/dist/build-info.json +3 -3
- package/dist/fixed-input-view.js +12 -1
- package/dist/session.d.ts +5 -0
- package/dist/session.js +17 -0
- package/dist/types.d.ts +5 -0
- package/dist/view.js +4 -0
- package/dist/webpack4/index.js +1 -1
- package/dist/webpack4/metafile.json +15 -15
- package/dist/webpack4/rjsf.js +12 -2
- package/dist/webpack4/rjsf.js.map +3 -3
- package/dist/webpack4/{shared-FW4MRLXW.js → shared-S623S2PV.js} +21 -1
- package/dist/webpack4/shared-S623S2PV.js.map +7 -0
- package/dist/webpack4/turbowarp.js +1 -1
- package/docs/fixed-input-contracts.md +1 -1
- package/package.json +1 -1
- package/dist/webpack4/shared-FW4MRLXW.js.map +0 -7
package/dist/build-info.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-extension-data-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"repository": "https://github.com/kubohiroya/turbowarp-extension-data-editor",
|
|
5
|
-
"revision": "
|
|
5
|
+
"revision": "2b78007136ce053b643ba36cad8526b9abb457a0",
|
|
6
6
|
"sourceState": "commit",
|
|
7
|
-
"sourceSha256": "
|
|
7
|
+
"sourceSha256": "5f500faea5d2ced27b0386d6ff550638f8ef78e2aac24a3ba0ec37c3c0afbc0d",
|
|
8
8
|
"capabilities": {
|
|
9
9
|
"preparedSource": 1
|
|
10
10
|
}
|
package/dist/fixed-input-view.js
CHANGED
|
@@ -52,6 +52,17 @@ function describe(context) {
|
|
|
52
52
|
throw new TypeError('A fixed form requires a fixed session.');
|
|
53
53
|
return result;
|
|
54
54
|
}
|
|
55
|
+
/** Presentation issues plus the save-time check, so Save is disabled as soon as the draft would be rejected. */
|
|
56
|
+
function liveIssues(context) {
|
|
57
|
+
var _a;
|
|
58
|
+
const issues = [...describe(context).issues];
|
|
59
|
+
const checked = typeof context.checkFixedInput === 'function' ? (_a = context.checkFixedInput()) !== null && _a !== void 0 ? _a : [] : [];
|
|
60
|
+
for (const issue of checked) {
|
|
61
|
+
if (!issues.some(item => item.message === issue.message && item.path === issue.path))
|
|
62
|
+
issues.push(issue);
|
|
63
|
+
}
|
|
64
|
+
return issues;
|
|
65
|
+
}
|
|
55
66
|
let nextFixedViewId = 0;
|
|
56
67
|
/** The session owns every buffer, including controls temporarily absent from the DOM. */
|
|
57
68
|
function FixedInputView({ context, messages }) {
|
|
@@ -87,7 +98,7 @@ function FixedInputView({ context, messages }) {
|
|
|
87
98
|
entry.repair = true;
|
|
88
99
|
Object.defineProperty(next.inputs, argument, { value: entry, enumerable: true, configurable: true, writable: true });
|
|
89
100
|
context.setDraft(next);
|
|
90
|
-
context.setValidationIssues(
|
|
101
|
+
context.setValidationIssues(liveIssues(context));
|
|
91
102
|
};
|
|
92
103
|
const hasInactiveEdits = Object.entries(description.inputs).some(([argument, input]) => input.state === 'hidden' && record(inputs[argument]) && inputs[argument].changed === true);
|
|
93
104
|
return React.createElement("div", { className: "block-editor-fixed-inputs" },
|
package/dist/session.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export declare class EditorSession implements EditorViewContext {
|
|
|
8
8
|
get reference(): BlockReference;
|
|
9
9
|
getDraft(): JsonObject;
|
|
10
10
|
getFixedInputView(): FixedInputViewDescription | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Run the same synchronous check as save, without committing, so a fixed form can disable Save
|
|
13
|
+
* while the draft is invalid. Owner text is reduced to the editor's coded diagnostics, as on save.
|
|
14
|
+
*/
|
|
15
|
+
checkFixedInput(): readonly ValidationIssue[] | undefined;
|
|
11
16
|
setDraft(draft: JsonObject): void;
|
|
12
17
|
setValidationIssues(issues: readonly ValidationIssue[]): void;
|
|
13
18
|
getState(): SessionState;
|
package/dist/session.js
CHANGED
|
@@ -133,6 +133,23 @@ export class EditorSession {
|
|
|
133
133
|
throw new TypeError('Invalid fixed input presentation.');
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Run the same synchronous check as save, without committing, so a fixed form can disable Save
|
|
138
|
+
* while the draft is invalid. Owner text is reduced to the editor's coded diagnostics, as on save.
|
|
139
|
+
*/
|
|
140
|
+
checkFixedInput() {
|
|
141
|
+
__classPrivateFieldGet(this, _EditorSession_instances, "m", _EditorSession_assertOpen).call(this);
|
|
142
|
+
const definition = __classPrivateFieldGet(this, _EditorSession_definition, "f");
|
|
143
|
+
if (!isFixedInputEditor(definition))
|
|
144
|
+
return undefined;
|
|
145
|
+
try {
|
|
146
|
+
const prepared = captureFixedPreparedSave(definition, __classPrivateFieldGet(this, _EditorSession_instances, "m", _EditorSession_copyDraft).call(this, __classPrivateFieldGet(this, _EditorSession_draft, "f")), __classPrivateFieldGet(this, _EditorSession_snapshot, "f"));
|
|
147
|
+
return prepared.kind === 'invalid' ? __classPrivateFieldGet(this, _EditorSession_instances, "m", _EditorSession_copyIssues).call(this, prepared.issues) : Object.freeze([]);
|
|
148
|
+
}
|
|
149
|
+
catch (_a) {
|
|
150
|
+
return Object.freeze([Object.freeze({ message: 'Fixed input validation failed: fixed-check-unavailable.' })]);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
136
153
|
setDraft(draft) {
|
|
137
154
|
if (__classPrivateFieldGet(this, _EditorSession_status, "f") !== 'editing')
|
|
138
155
|
throw new Error('The session is not editable.');
|
package/dist/types.d.ts
CHANGED
|
@@ -58,6 +58,11 @@ export interface EditorViewContext {
|
|
|
58
58
|
getDraft(): JsonObject;
|
|
59
59
|
/** Fixed views obtain only safe presentation data, never live host objects. */
|
|
60
60
|
getFixedInputView?(): FixedInputViewDescription | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Run the save-time fixed check (encode, schema and owner validateCandidate) on the current draft.
|
|
63
|
+
* Unlike getFixedInputView, this calls owner callbacks, so views call it per edit, not per render.
|
|
64
|
+
*/
|
|
65
|
+
checkFixedInput?(): readonly ValidationIssue[] | undefined;
|
|
61
66
|
/** Updates are rejected after this view unmounts, even when its session stays open. */
|
|
62
67
|
setDraft(draft: JsonObject): void;
|
|
63
68
|
/** Report live UI validation; save() always independently validates again. */
|
package/dist/view.js
CHANGED
|
@@ -41,6 +41,10 @@ export class EditorView {
|
|
|
41
41
|
assertMounted();
|
|
42
42
|
return owner.getFixedInputView();
|
|
43
43
|
} } : {}),
|
|
44
|
+
...(owner.checkFixedInput ? { checkFixedInput: () => {
|
|
45
|
+
assertMounted();
|
|
46
|
+
return owner.checkFixedInput();
|
|
47
|
+
} } : {}),
|
|
44
48
|
setDraft: (draft) => { assertMounted(); owner.setDraft(draft); },
|
|
45
49
|
setValidationIssues: (issues) => {
|
|
46
50
|
assertMounted();
|
package/dist/webpack4/index.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"format": "esm"
|
|
17
17
|
},
|
|
18
18
|
"dist/view.js": {
|
|
19
|
-
"bytes":
|
|
19
|
+
"bytes": 4513,
|
|
20
20
|
"imports": [],
|
|
21
21
|
"format": "esm"
|
|
22
22
|
},
|
|
@@ -1873,7 +1873,7 @@
|
|
|
1873
1873
|
"format": "esm"
|
|
1874
1874
|
},
|
|
1875
1875
|
"dist/session.js": {
|
|
1876
|
-
"bytes":
|
|
1876
|
+
"bytes": 30322,
|
|
1877
1877
|
"imports": [
|
|
1878
1878
|
{
|
|
1879
1879
|
"path": "dist/data.js",
|
|
@@ -3864,7 +3864,7 @@
|
|
|
3864
3864
|
"format": "esm"
|
|
3865
3865
|
},
|
|
3866
3866
|
"dist/fixed-input-view.js": {
|
|
3867
|
-
"bytes":
|
|
3867
|
+
"bytes": 12003,
|
|
3868
3868
|
"imports": [
|
|
3869
3869
|
{
|
|
3870
3870
|
"path": "react",
|
|
@@ -14381,7 +14381,7 @@
|
|
|
14381
14381
|
"kind": "import-statement"
|
|
14382
14382
|
},
|
|
14383
14383
|
{
|
|
14384
|
-
"path": "dist/webpack4/shared-
|
|
14384
|
+
"path": "dist/webpack4/shared-S623S2PV.js",
|
|
14385
14385
|
"kind": "import-statement"
|
|
14386
14386
|
},
|
|
14387
14387
|
{
|
|
@@ -14425,12 +14425,12 @@
|
|
|
14425
14425
|
"imports": [],
|
|
14426
14426
|
"exports": [],
|
|
14427
14427
|
"inputs": {},
|
|
14428
|
-
"bytes":
|
|
14428
|
+
"bytes": 1930792
|
|
14429
14429
|
},
|
|
14430
14430
|
"dist/webpack4/rjsf.js": {
|
|
14431
14431
|
"imports": [
|
|
14432
14432
|
{
|
|
14433
|
-
"path": "dist/webpack4/shared-
|
|
14433
|
+
"path": "dist/webpack4/shared-S623S2PV.js",
|
|
14434
14434
|
"kind": "import-statement"
|
|
14435
14435
|
},
|
|
14436
14436
|
{
|
|
@@ -15749,7 +15749,7 @@
|
|
|
15749
15749
|
"bytesInOutput": 11809
|
|
15750
15750
|
},
|
|
15751
15751
|
"dist/fixed-input-view.js": {
|
|
15752
|
-
"bytesInOutput":
|
|
15752
|
+
"bytesInOutput": 10884
|
|
15753
15753
|
},
|
|
15754
15754
|
"node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/index.js": {
|
|
15755
15755
|
"bytesInOutput": 183
|
|
@@ -16829,7 +16829,7 @@
|
|
|
16829
16829
|
"bytesInOutput": 11025
|
|
16830
16830
|
}
|
|
16831
16831
|
},
|
|
16832
|
-
"bytes":
|
|
16832
|
+
"bytes": 898255
|
|
16833
16833
|
},
|
|
16834
16834
|
"dist/webpack4/react.js.map": {
|
|
16835
16835
|
"imports": [],
|
|
@@ -16884,7 +16884,7 @@
|
|
|
16884
16884
|
"kind": "import-statement"
|
|
16885
16885
|
},
|
|
16886
16886
|
{
|
|
16887
|
-
"path": "dist/webpack4/shared-
|
|
16887
|
+
"path": "dist/webpack4/shared-S623S2PV.js",
|
|
16888
16888
|
"kind": "import-statement"
|
|
16889
16889
|
},
|
|
16890
16890
|
{
|
|
@@ -16956,13 +16956,13 @@
|
|
|
16956
16956
|
},
|
|
16957
16957
|
"bytes": 44
|
|
16958
16958
|
},
|
|
16959
|
-
"dist/webpack4/shared-
|
|
16959
|
+
"dist/webpack4/shared-S623S2PV.js.map": {
|
|
16960
16960
|
"imports": [],
|
|
16961
16961
|
"exports": [],
|
|
16962
16962
|
"inputs": {},
|
|
16963
|
-
"bytes":
|
|
16963
|
+
"bytes": 218331
|
|
16964
16964
|
},
|
|
16965
|
-
"dist/webpack4/shared-
|
|
16965
|
+
"dist/webpack4/shared-S623S2PV.js": {
|
|
16966
16966
|
"imports": [
|
|
16967
16967
|
{
|
|
16968
16968
|
"path": "dist/webpack4/shared-BKTRZUZH.js",
|
|
@@ -17004,13 +17004,13 @@
|
|
|
17004
17004
|
"bytesInOutput": 795
|
|
17005
17005
|
},
|
|
17006
17006
|
"dist/view.js": {
|
|
17007
|
-
"bytesInOutput":
|
|
17007
|
+
"bytesInOutput": 4035
|
|
17008
17008
|
},
|
|
17009
17009
|
"dist/prepared-save.js": {
|
|
17010
17010
|
"bytesInOutput": 1886
|
|
17011
17011
|
},
|
|
17012
17012
|
"dist/session.js": {
|
|
17013
|
-
"bytesInOutput":
|
|
17013
|
+
"bytesInOutput": 27855
|
|
17014
17014
|
},
|
|
17015
17015
|
"dist/subtree.js": {
|
|
17016
17016
|
"bytesInOutput": 4426
|
|
@@ -17025,7 +17025,7 @@
|
|
|
17025
17025
|
"bytesInOutput": 10668
|
|
17026
17026
|
}
|
|
17027
17027
|
},
|
|
17028
|
-
"bytes":
|
|
17028
|
+
"bytes": 124033
|
|
17029
17029
|
},
|
|
17030
17030
|
"dist/webpack4/shared-BKTRZUZH.js.map": {
|
|
17031
17031
|
"imports": [],
|
package/dist/webpack4/rjsf.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
EditorRegistry,
|
|
3
3
|
cloneJson,
|
|
4
4
|
createFixedInputEditor
|
|
5
|
-
} from "./shared-
|
|
5
|
+
} from "./shared-S623S2PV.js";
|
|
6
6
|
import {
|
|
7
7
|
EDITOR_API_VERSION
|
|
8
8
|
} from "./shared-BKTRZUZH.js";
|
|
@@ -13036,6 +13036,16 @@ function describe(context) {
|
|
|
13036
13036
|
throw new TypeError("A fixed form requires a fixed session.");
|
|
13037
13037
|
return result;
|
|
13038
13038
|
}
|
|
13039
|
+
function liveIssues2(context) {
|
|
13040
|
+
var _a;
|
|
13041
|
+
const issues = [...describe(context).issues];
|
|
13042
|
+
const checked = typeof context.checkFixedInput === "function" ? (_a = context.checkFixedInput()) !== null && _a !== void 0 ? _a : [] : [];
|
|
13043
|
+
for (const issue2 of checked) {
|
|
13044
|
+
if (!issues.some((item) => item.message === issue2.message && item.path === issue2.path))
|
|
13045
|
+
issues.push(issue2);
|
|
13046
|
+
}
|
|
13047
|
+
return issues;
|
|
13048
|
+
}
|
|
13039
13049
|
var nextFixedViewId = 0;
|
|
13040
13050
|
function FixedInputView({ context, messages }) {
|
|
13041
13051
|
const [, redraw] = React4.useState(0);
|
|
@@ -13070,7 +13080,7 @@ function FixedInputView({ context, messages }) {
|
|
|
13070
13080
|
entry.repair = true;
|
|
13071
13081
|
Object.defineProperty(next.inputs, argument, { value: entry, enumerable: true, configurable: true, writable: true });
|
|
13072
13082
|
context.setDraft(next);
|
|
13073
|
-
context.setValidationIssues(
|
|
13083
|
+
context.setValidationIssues(liveIssues2(context));
|
|
13074
13084
|
};
|
|
13075
13085
|
const hasInactiveEdits = Object.entries(description.inputs).some(([argument, input]) => input.state === "hidden" && record4(inputs[argument]) && inputs[argument].changed === true);
|
|
13076
13086
|
return React4.createElement(
|