@dusted/anqst 1.5.1 → 1.6.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/README.md +45 -4
- package/dist/src/app.js +47 -15
- package/dist/src/emit.js +1463 -200
- package/dist/src/layout.js +9 -3
- package/dist/src/project.js +3 -3
- package/package.json +1 -1
- package/spec/AnQst-Spec-DSL.d.ts +22 -24
package/dist/src/layout.js
CHANGED
|
@@ -41,8 +41,12 @@ function anqstSettingsFileName(widgetName) {
|
|
|
41
41
|
function anqstSettingsRelativePath(widgetName) {
|
|
42
42
|
return `./${exports.ANQST_ROOT_DIRNAME}/${anqstSettingsFileName(widgetName)}`;
|
|
43
43
|
}
|
|
44
|
-
function generatedFrontendDirName(widgetName) {
|
|
45
|
-
|
|
44
|
+
function generatedFrontendDirName(widgetName, target) {
|
|
45
|
+
if (target === "AngularService")
|
|
46
|
+
return `${widgetName}_Angular`;
|
|
47
|
+
if (target === "VanillaTS")
|
|
48
|
+
return `${widgetName}_VanillaTS`;
|
|
49
|
+
return `${widgetName}_VanillaJS`;
|
|
46
50
|
}
|
|
47
51
|
function generatedNodeExpressDirName(widgetName) {
|
|
48
52
|
return `${widgetName}_anQst`;
|
|
@@ -56,7 +60,9 @@ function resolveGeneratedLayoutPaths(cwd, widgetName) {
|
|
|
56
60
|
const designerPluginRoot = node_path_1.default.join(cppQtWidgetRoot, "designerPlugin");
|
|
57
61
|
return {
|
|
58
62
|
generatedRoot,
|
|
59
|
-
|
|
63
|
+
angularFrontendRoot: node_path_1.default.join(generatedRoot, "frontend", generatedFrontendDirName(widgetName, "AngularService")),
|
|
64
|
+
vanillaTsFrontendRoot: node_path_1.default.join(generatedRoot, "frontend", generatedFrontendDirName(widgetName, "VanillaTS")),
|
|
65
|
+
vanillaJsFrontendRoot: node_path_1.default.join(generatedRoot, "frontend", generatedFrontendDirName(widgetName, "VanillaJS")),
|
|
60
66
|
nodeExpressRoot: node_path_1.default.join(generatedRoot, "backend", "node", "express", generatedNodeExpressDirName(widgetName)),
|
|
61
67
|
cppCmakeRoot: node_path_1.default.join(generatedRoot, "backend", "cpp", "cmake"),
|
|
62
68
|
cppQtWidgetRoot,
|
package/dist/src/project.js
CHANGED
|
@@ -16,7 +16,7 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
16
16
|
const node_path_1 = __importDefault(require("node:path"));
|
|
17
17
|
const errors_1 = require("./errors");
|
|
18
18
|
const layout_1 = require("./layout");
|
|
19
|
-
exports.DEFAULT_ANQST_GENERATE_TARGETS = ["QWidget", "AngularService", "node_express_ws"];
|
|
19
|
+
exports.DEFAULT_ANQST_GENERATE_TARGETS = ["QWidget", "AngularService", "VanillaTS", "VanillaJS", "node_express_ws"];
|
|
20
20
|
const ANQST_DSL_IMPORT_LINE = 'import type { AnQst } from "@dusted/anqst";';
|
|
21
21
|
const ANQST_BUILD_HOOK = "npx anqst build";
|
|
22
22
|
function readJsonFile(filePath) {
|
|
@@ -153,7 +153,7 @@ function updateTsConfig(cwd, widgetName) {
|
|
|
153
153
|
? {}
|
|
154
154
|
: ensureObject(compilerOptions.paths, "Invalid tsconfig.json: expected object at 'compilerOptions.paths'.");
|
|
155
155
|
compilerOptions.paths = pathsObject;
|
|
156
|
-
const generatedAliasPath = `AnQst/generated/frontend/${(0, layout_1.generatedFrontendDirName)(widgetName)}/*`;
|
|
156
|
+
const generatedAliasPath = `AnQst/generated/frontend/${(0, layout_1.generatedFrontendDirName)(widgetName, "AngularService")}/*`;
|
|
157
157
|
const existingAlias = pathsObject["anqst-generated/*"];
|
|
158
158
|
const aliasList = Array.isArray(existingAlias)
|
|
159
159
|
? existingAlias.filter((entry) => typeof entry === "string")
|
|
@@ -164,7 +164,7 @@ function updateTsConfig(cwd, widgetName) {
|
|
|
164
164
|
pathsObject["anqst-generated/*"] = [...new Set(aliasList)];
|
|
165
165
|
if (Array.isArray(tsConfig.include)) {
|
|
166
166
|
const includeList = tsConfig.include.filter((entry) => typeof entry === "string");
|
|
167
|
-
const generatedTypesPattern = `AnQst/generated/frontend/${(0, layout_1.generatedFrontendDirName)(widgetName)}/**/*.d.ts`;
|
|
167
|
+
const generatedTypesPattern = `AnQst/generated/frontend/${(0, layout_1.generatedFrontendDirName)(widgetName, "AngularService")}/**/*.d.ts`;
|
|
168
168
|
if (!includeList.includes(generatedTypesPattern)) {
|
|
169
169
|
includeList.push(generatedTypesPattern);
|
|
170
170
|
}
|
package/package.json
CHANGED
package/spec/AnQst-Spec-DSL.d.ts
CHANGED
|
@@ -31,13 +31,15 @@ export namespace AnQst {
|
|
|
31
31
|
interface Service { }
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Declare service `InterfaceName` as development-mode capable transport service.
|
|
34
|
+
* Declare service `InterfaceName` as development-mode capable browser transport service.
|
|
35
35
|
*
|
|
36
36
|
* @remarks
|
|
37
37
|
* - Extends the same method/property semantics as `AnQst.Service`.
|
|
38
|
-
* - Signals to the generator/runtime that this widget should emit dual-transport bridge support
|
|
38
|
+
* - Signals to the generator/runtime that this widget should emit dual-transport browser bridge support
|
|
39
39
|
* (Qt WebChannel + HTTP/WebSocket development bridge).
|
|
40
40
|
* - Existing generated service APIs remain unchanged.
|
|
41
|
+
* - The name is historical. The capability applies to browser frontend profiles generally,
|
|
42
|
+
* not only Angular-specific generation.
|
|
41
43
|
*
|
|
42
44
|
* @example
|
|
43
45
|
* export interface UserService extends AnQst.AngularHTTPBaseServerClass { }
|
|
@@ -63,7 +65,7 @@ export namespace AnQst {
|
|
|
63
65
|
* @example
|
|
64
66
|
* // AnQst spec:
|
|
65
67
|
* getUserById(userId: string): AnQst.Call<User>
|
|
66
|
-
* //
|
|
68
|
+
* //Browser app:
|
|
67
69
|
* const user: User = await this.userService.getUserById("abc");
|
|
68
70
|
*/
|
|
69
71
|
interface Call<T, Config extends CallConfig = {}> { dummy: T; config?: Config }
|
|
@@ -89,7 +91,7 @@ export namespace AnQst {
|
|
|
89
91
|
* @example
|
|
90
92
|
* // AnQst spec:
|
|
91
93
|
* getUsernameSubstring(from: number, to:number ): AnQst.Slot<string>
|
|
92
|
-
* //
|
|
94
|
+
* //Browser app:
|
|
93
95
|
* this.userService.onSlot.getUsername( provider );
|
|
94
96
|
* //Parent:
|
|
95
97
|
* auto currentFormUsername = userMgmt.getUsername();
|
|
@@ -111,7 +113,7 @@ export namespace AnQst {
|
|
|
111
113
|
* @example
|
|
112
114
|
* // AnQst spec:
|
|
113
115
|
* complain(whine: string): AnQst.Emitter;
|
|
114
|
-
* //
|
|
116
|
+
* //Browser app:
|
|
115
117
|
* this.userService.complain("Why won't you LISTEN!");
|
|
116
118
|
*/
|
|
117
119
|
interface Emitter { }
|
|
@@ -121,14 +123,14 @@ export namespace AnQst {
|
|
|
121
123
|
* Declare reactive `PropertyName`:`OutputType` and set.`PropertyName`(arg: `OutputType`)
|
|
122
124
|
* @remarks
|
|
123
125
|
* - **Parent** -> Widget
|
|
124
|
-
* True
|
|
126
|
+
* True frontend reactive semantics (Property updates, accessor reflects latest value, no return path, no registration requirement)
|
|
125
127
|
* - Flow:
|
|
126
128
|
* - Parent: Sets generated widget property `PropertyName`.
|
|
127
129
|
* - Widget: Service updates readonly property `PropertyName` and emits signal.
|
|
128
130
|
* @example
|
|
129
131
|
* // AnQst spec:
|
|
130
132
|
* activeUsers: AnQst.Output<number>;
|
|
131
|
-
* //
|
|
133
|
+
* //Browser app:
|
|
132
134
|
* <p>{{ userService.activeUsers() }}</p>
|
|
133
135
|
* //Parent:
|
|
134
136
|
* int users = userMgmt.activeUsers;
|
|
@@ -148,7 +150,7 @@ export namespace AnQst {
|
|
|
148
150
|
* @example
|
|
149
151
|
* // AnQst spec:
|
|
150
152
|
* currentUsername: AnQst.Input<string>;
|
|
151
|
-
* //
|
|
153
|
+
* //Browser app:
|
|
152
154
|
* <input type="text" placeholder="Your Name Here" (input)="userService.set.currentUsername(($event.target as HTMLInputElement).value)" />
|
|
153
155
|
* //Parent:
|
|
154
156
|
* QString userName = userMgmt.currentUsername;
|
|
@@ -160,15 +162,15 @@ export namespace AnQst {
|
|
|
160
162
|
* Declare drop-target `PropertyName`:`PayloadType`
|
|
161
163
|
* @remarks
|
|
162
164
|
* - **Parent** -> Widget (framework-mediated)
|
|
163
|
-
* - True
|
|
165
|
+
* - True frontend reactive semantics.
|
|
164
166
|
* - Flow:
|
|
165
167
|
* - External: A Qt widget initiates a QDrag carrying QMimeData.
|
|
166
168
|
* - Parent: AnQstWebHostBase intercepts the drop via event filter on the
|
|
167
169
|
* embedded QWebEngineView's rendering surface.
|
|
168
170
|
* - Parent: QMimeData for the accepted format is deserialized from a JSON
|
|
169
171
|
* array of normalized AnQst wire items and forwarded through the bridge.
|
|
170
|
-
* - Widget: Service updates
|
|
171
|
-
* payload and drop coordinates.
|
|
172
|
+
* - Widget: Service updates the generated accessor for `PropertyName` with the deserialized
|
|
173
|
+
* payload and drop coordinates. Browser application code reacts through the generated frontend API.
|
|
172
174
|
* - MIME type is convention-derived: `application/anqst-dragdropevent_<ServiceName>-<TypeName>`.
|
|
173
175
|
* - The source QWidget must serialize the generated AnQst wire payload as a
|
|
174
176
|
* JSON array under the same MIME type. Generated Qt widgets expose helper
|
|
@@ -178,11 +180,9 @@ export namespace AnQst {
|
|
|
178
180
|
* @example
|
|
179
181
|
* // AnQst spec:
|
|
180
182
|
* trackDropped: AnQst.DropTarget<Track>;
|
|
181
|
-
* //
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* if (drop !== null) { console.log(drop.payload, drop.x, drop.y); }
|
|
185
|
-
* });
|
|
183
|
+
* // Browser app:
|
|
184
|
+
* const drop = frontend.services.DragService.trackDropped();
|
|
185
|
+
* if (drop !== null) { console.log(drop.payload, drop.x, drop.y); }
|
|
186
186
|
*/
|
|
187
187
|
interface DropTarget<T> { dummy: T }
|
|
188
188
|
|
|
@@ -191,7 +191,7 @@ export namespace AnQst {
|
|
|
191
191
|
* Declare hover-target `PropertyName`:`PayloadType`
|
|
192
192
|
* @remarks
|
|
193
193
|
* - **Parent** -> Widget (framework-mediated)
|
|
194
|
-
* - True
|
|
194
|
+
* - True frontend reactive semantics.
|
|
195
195
|
* - Flow:
|
|
196
196
|
* - External: A Qt widget initiates a QDrag carrying QMimeData.
|
|
197
197
|
* - Parent: AnQstWebHostBase intercepts drag-move events via event filter on the
|
|
@@ -199,8 +199,8 @@ export namespace AnQst {
|
|
|
199
199
|
* - Parent: Payload is deserialized once on DragEnter from a JSON array of
|
|
200
200
|
* normalized AnQst wire items; subsequent DragMove events forward only
|
|
201
201
|
* the updated position.
|
|
202
|
-
* - Widget: Service updates
|
|
203
|
-
* coordinates.
|
|
202
|
+
* - Widget: Service updates the generated accessor for `PropertyName` with the payload and current
|
|
203
|
+
* coordinates. The accessor becomes null on DragLeave.
|
|
204
204
|
* - Shares the same MIME type convention as DropTarget: `application/anqst-dragdropevent_<ServiceName>-<TypeName>`.
|
|
205
205
|
* - A HoverTarget without a corresponding DropTarget means "show previews but reject the drop".
|
|
206
206
|
* - Optional config supports throttle tuning:
|
|
@@ -217,11 +217,9 @@ export namespace AnQst {
|
|
|
217
217
|
* trackHovering: AnQst.HoverTarget<Track, { maxRateHz: 10 }>;
|
|
218
218
|
* // AnQst spec (no throttling):
|
|
219
219
|
* trackHovering: AnQst.HoverTarget<Track, { maxRateHz: 0 }>;
|
|
220
|
-
* //
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* if (hover !== null) { highlight(document.elementFromPoint(hover.x, hover.y)); }
|
|
224
|
-
* });
|
|
220
|
+
* // Browser app:
|
|
221
|
+
* const hover = frontend.services.DragService.trackHovering();
|
|
222
|
+
* if (hover !== null) { highlight(document.elementFromPoint(hover.x, hover.y)); }
|
|
225
223
|
*/
|
|
226
224
|
|
|
227
225
|
/**
|