@dimina-kit/devtools 0.4.0-dev.20260711141929 → 0.4.0-dev.20260716163758

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 (59) hide show
  1. package/dist/main/app/app.js +39 -10
  2. package/dist/main/app/native-overview.d.ts +1 -1
  3. package/dist/main/index.bundle.js +189 -172
  4. package/dist/main/services/simulator-appdata/index.js +1 -1
  5. package/dist/main/services/views/native-simulator-view.d.ts +6 -0
  6. package/dist/main/services/views/native-simulator-view.js +16 -0
  7. package/dist/main/services/views/refresh-styles.d.ts +10 -0
  8. package/dist/main/services/views/refresh-styles.js +57 -0
  9. package/dist/main/services/views/view-manager.d.ts +26 -1
  10. package/dist/main/services/views/view-manager.js +7 -0
  11. package/dist/main/services/views/workbench-view.d.ts +2 -0
  12. package/dist/main/services/views/workbench-view.js +87 -7
  13. package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
  14. package/dist/main/services/workspace/open-project-guards.js +42 -0
  15. package/dist/main/services/workspace/rebuild-status.d.ts +24 -0
  16. package/dist/main/services/workspace/rebuild-status.js +20 -0
  17. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +2 -0
  18. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +4 -0
  19. package/dist/main/services/workspace/workspace-service.js +21 -36
  20. package/dist/native-host/common/common.js +1 -1
  21. package/dist/native-host/render/render.js +49 -34
  22. package/dist/native-host/service/service.js +2 -2
  23. package/dist/preload/instrumentation/app-data.d.ts +2 -2
  24. package/dist/preload/instrumentation/app-data.js +1 -1
  25. package/dist/preload/windows/host-toolbar-runtime.cjs.map +1 -1
  26. package/dist/preload/windows/main.cjs +96 -0
  27. package/dist/preload/windows/main.cjs.map +2 -2
  28. package/dist/preload/windows/simulator.cjs +162 -140
  29. package/dist/preload/windows/simulator.cjs.map +3 -3
  30. package/dist/preload/windows/simulator.js +162 -140
  31. package/dist/render-host/render-inspect.js +15 -47
  32. package/dist/renderer/assets/index-DQnIsRhp.js +49 -0
  33. package/dist/renderer/assets/{input-COtRON-n.js → input-7P0WbXyg.js} +2 -2
  34. package/dist/renderer/assets/ipc-transport-BGtDnv6p.css +1 -0
  35. package/dist/renderer/assets/{ipc-transport-SuI2rOB_.js → ipc-transport-DTEmLpxx.js} +2 -2
  36. package/dist/renderer/assets/popover-DsOcyIS6.js +2 -0
  37. package/dist/renderer/assets/{select-Bwb8O0Mf.js → select-Bzbhbg9Z.js} +2 -2
  38. package/dist/renderer/assets/{settings-BispnvJU.js → settings-CR1TyBWu.js} +2 -2
  39. package/dist/renderer/assets/{settings-api-HIBz8BFz.js → settings-api-B1wVFAPB.js} +2 -2
  40. package/dist/renderer/assets/workbenchSettings-CFbToT4Q.js +8 -0
  41. package/dist/renderer/entries/main/index.html +6 -6
  42. package/dist/renderer/entries/popover/index.html +5 -5
  43. package/dist/renderer/entries/settings/index.html +5 -5
  44. package/dist/renderer/entries/workbench-settings/index.html +4 -4
  45. package/dist/shared/ipc-channels.d.ts +1 -0
  46. package/dist/shared/ipc-channels.js +7 -0
  47. package/dist/simulator/assets/device-shell-C-HZY3bL.css +1 -0
  48. package/dist/simulator/assets/device-shell-Cu1ZPLfe.js +2 -0
  49. package/dist/simulator/assets/{simulator-A1vGZVBM.js → simulator-Cy8c-eA2.js} +5 -5
  50. package/dist/simulator/simulator.html +1 -1
  51. package/package.json +7 -7
  52. package/dist/renderer/assets/index-WbvXdhWQ.js +0 -49
  53. package/dist/renderer/assets/ipc-transport-CNvORIEX.css +0 -1
  54. package/dist/renderer/assets/popover-B73T3z-m.js +0 -2
  55. package/dist/renderer/assets/workbenchSettings-CtRBr7gS.js +0 -8
  56. package/dist/shared/appdata-accumulator.d.ts +0 -95
  57. package/dist/shared/appdata-accumulator.js +0 -218
  58. package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
  59. package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
@@ -56,6 +56,168 @@ function escapeForAttrSelector(value) {
56
56
  return value.replace(/[\\"]/g, "\\$&");
57
57
  }
58
58
 
59
+ // ../inspect/dist/appdata-accumulator.js
60
+ function parseMessagePayload(message) {
61
+ if (typeof message !== "string")
62
+ return message;
63
+ try {
64
+ return JSON.parse(message);
65
+ } catch {
66
+ return null;
67
+ }
68
+ }
69
+ function decodeUpdateBatchBody(rawBody) {
70
+ const body = rawBody;
71
+ if (!body || typeof body !== "object")
72
+ return null;
73
+ if (typeof body.bridgeId !== "string" || !Array.isArray(body.updates))
74
+ return null;
75
+ const out = [];
76
+ for (const u of body.updates) {
77
+ if (!u || typeof u.moduleId !== "string")
78
+ continue;
79
+ if (!u.moduleId.startsWith("page_"))
80
+ continue;
81
+ out.push({ mode: "patch", bridgeId: body.bridgeId, moduleId: u.moduleId, data: u.data });
82
+ }
83
+ return out.length > 0 ? out : null;
84
+ }
85
+ function decodePageInitBody(moduleId, rawBody) {
86
+ const body = rawBody;
87
+ if (!body || typeof body !== "object")
88
+ return null;
89
+ if (typeof body.bridgeId !== "string" || typeof body.path !== "string")
90
+ return null;
91
+ if (!body.data || typeof body.data !== "object")
92
+ return null;
93
+ return [{
94
+ mode: "init",
95
+ bridgeId: body.bridgeId,
96
+ moduleId,
97
+ componentPath: body.path,
98
+ data: body.data
99
+ }];
100
+ }
101
+ function decodeWorkerMessage(message) {
102
+ const payload = parseMessagePayload(message);
103
+ if (!payload || typeof payload !== "object")
104
+ return null;
105
+ const record = payload;
106
+ if (record.type === "ub")
107
+ return decodeUpdateBatchBody(record.body);
108
+ if (typeof record.type === "string" && record.type.startsWith("page_")) {
109
+ return decodePageInitBody(record.type, record.body);
110
+ }
111
+ return null;
112
+ }
113
+ function decodeOutgoingMessage(message) {
114
+ const payload = parseMessagePayload(message);
115
+ if (!payload || typeof payload !== "object")
116
+ return null;
117
+ const r = payload;
118
+ if (typeof r.type !== "string")
119
+ return null;
120
+ return {
121
+ type: r.type,
122
+ bridgeId: typeof r.body?.bridgeId === "string" ? r.body.bridgeId : void 0
123
+ };
124
+ }
125
+ var AppDataAccumulator = class {
126
+ cache = /* @__PURE__ */ new Map();
127
+ // Bridges in insertion order — drives the `bridges` array (stable tab order).
128
+ bridgeOrder = [];
129
+ // Page path per bridge: set from `page_*` init's body.path (the page route).
130
+ bridgePagePath = /* @__PURE__ */ new Map();
131
+ recordBridge(bridgeId) {
132
+ if (!this.bridgeOrder.includes(bridgeId))
133
+ this.bridgeOrder.push(bridgeId);
134
+ }
135
+ /**
136
+ * Apply one entry. Returns true if it was accepted (a mutation worth
137
+ * republishing), false if dropped (missing ids, or the init-gate).
138
+ */
139
+ apply(input) {
140
+ if (!input.bridgeId || !input.moduleId)
141
+ return false;
142
+ if (input.mode !== "init" && !this.bridgePagePath.has(input.bridgeId))
143
+ return false;
144
+ const key = `${input.bridgeId}/${input.moduleId}`;
145
+ const prev = this.cache.get(key);
146
+ const incoming = input.data && typeof input.data === "object" ? input.data : {};
147
+ const merged = input.mode === "init" ? { ...incoming } : { ...prev?.data ?? {}, ...incoming };
148
+ const componentPath = input.componentPath ?? prev?.componentPath;
149
+ const next = componentPath !== void 0 ? { componentPath, data: merged } : { data: merged };
150
+ this.cache.set(key, next);
151
+ this.recordBridge(input.bridgeId);
152
+ if (input.mode === "init" && input.moduleId.startsWith("page_") && input.componentPath) {
153
+ this.bridgePagePath.set(input.bridgeId, input.componentPath);
154
+ }
155
+ return true;
156
+ }
157
+ /** Evict every entry for a bridge (page teardown). */
158
+ clearBridge(bridgeId) {
159
+ const prefix = `${bridgeId}/`;
160
+ for (const key of [...this.cache.keys()]) {
161
+ if (key.startsWith(prefix))
162
+ this.cache.delete(key);
163
+ }
164
+ const idx = this.bridgeOrder.indexOf(bridgeId);
165
+ if (idx >= 0)
166
+ this.bridgeOrder.splice(idx, 1);
167
+ this.bridgePagePath.delete(bridgeId);
168
+ }
169
+ /** The full cumulative snapshot for the panel. */
170
+ snapshot() {
171
+ const bridges = [];
172
+ for (const id of this.bridgeOrder) {
173
+ bridges.push({ id, pagePath: this.bridgePagePath.get(id) ?? null });
174
+ }
175
+ const entries = {};
176
+ for (const [key, entry] of this.cache) {
177
+ const slash = key.indexOf("/");
178
+ if (slash < 0)
179
+ continue;
180
+ const bridgeId = key.slice(0, slash);
181
+ const moduleId = key.slice(slash + 1);
182
+ if (!entries[bridgeId])
183
+ entries[bridgeId] = {};
184
+ const displayKey = entry.componentPath ?? moduleId;
185
+ entries[bridgeId][displayKey] = entry.data;
186
+ }
187
+ return { bridges, entries };
188
+ }
189
+ /**
190
+ * The current reactive page state for a bridge: shallow-merge of `entry.data`
191
+ * across every cache entry whose key starts with `${bridgeId}/`, in insertion
192
+ * order (later entries win on key conflicts). `{}` when no entries match
193
+ * (unknown bridge / after clearBridge). Pure, no side effects.
194
+ */
195
+ pageData(bridgeId) {
196
+ const merged = {};
197
+ for (const [key, entry] of this.cache) {
198
+ const slash = key.indexOf("/");
199
+ if (slash < 0)
200
+ continue;
201
+ if (key.slice(0, slash) !== bridgeId)
202
+ continue;
203
+ Object.assign(merged, entry.data);
204
+ }
205
+ return merged;
206
+ }
207
+ /** Flat `key → data` map for the `__simulatorData.getAppdata()` mirror. */
208
+ flat() {
209
+ const data = {};
210
+ for (const [key, entry] of this.cache)
211
+ data[key] = entry.data;
212
+ return data;
213
+ }
214
+ clear() {
215
+ this.cache.clear();
216
+ this.bridgeOrder.length = 0;
217
+ this.bridgePagePath.clear();
218
+ }
219
+ };
220
+
59
221
  // src/preload/runtime/bridge.ts
60
222
  var state = {
61
223
  appdata: { gen: 0, ready: true, data: {} },
@@ -388,146 +550,6 @@ function installConsoleInstrumentation() {
388
550
  };
389
551
  }
390
552
 
391
- // src/shared/appdata-accumulator.ts
392
- function parseMessagePayload(message) {
393
- if (typeof message !== "string") return message;
394
- try {
395
- return JSON.parse(message);
396
- } catch {
397
- return null;
398
- }
399
- }
400
- function decodeUpdateBatchBody(rawBody) {
401
- const body = rawBody;
402
- if (!body || typeof body !== "object") return null;
403
- if (typeof body.bridgeId !== "string" || !Array.isArray(body.updates)) return null;
404
- const out = [];
405
- for (const u of body.updates) {
406
- if (!u || typeof u.moduleId !== "string") continue;
407
- if (!u.moduleId.startsWith("page_")) continue;
408
- out.push({ mode: "patch", bridgeId: body.bridgeId, moduleId: u.moduleId, data: u.data });
409
- }
410
- return out.length > 0 ? out : null;
411
- }
412
- function decodePageInitBody(moduleId, rawBody) {
413
- const body = rawBody;
414
- if (!body || typeof body !== "object") return null;
415
- if (typeof body.bridgeId !== "string" || typeof body.path !== "string") return null;
416
- if (!body.data || typeof body.data !== "object") return null;
417
- return [{
418
- mode: "init",
419
- bridgeId: body.bridgeId,
420
- moduleId,
421
- componentPath: body.path,
422
- data: body.data
423
- }];
424
- }
425
- function decodeWorkerMessage(message) {
426
- const payload = parseMessagePayload(message);
427
- if (!payload || typeof payload !== "object") return null;
428
- const record = payload;
429
- if (record.type === "ub") return decodeUpdateBatchBody(record.body);
430
- if (typeof record.type === "string" && record.type.startsWith("page_")) {
431
- return decodePageInitBody(record.type, record.body);
432
- }
433
- return null;
434
- }
435
- function decodeOutgoingMessage(message) {
436
- const payload = parseMessagePayload(message);
437
- if (!payload || typeof payload !== "object") return null;
438
- const r = payload;
439
- if (typeof r.type !== "string") return null;
440
- return {
441
- type: r.type,
442
- bridgeId: typeof r.body?.bridgeId === "string" ? r.body.bridgeId : void 0
443
- };
444
- }
445
- var AppDataAccumulator = class {
446
- cache = /* @__PURE__ */ new Map();
447
- // Bridges in insertion order — drives the `bridges` array (stable tab order).
448
- bridgeOrder = [];
449
- // Page path per bridge: set from `page_*` init's body.path (the page route).
450
- bridgePagePath = /* @__PURE__ */ new Map();
451
- recordBridge(bridgeId) {
452
- if (!this.bridgeOrder.includes(bridgeId)) this.bridgeOrder.push(bridgeId);
453
- }
454
- /**
455
- * Apply one entry. Returns true if it was accepted (a mutation worth
456
- * republishing), false if dropped (missing ids, or the init-gate).
457
- */
458
- apply(input) {
459
- if (!input.bridgeId || !input.moduleId) return false;
460
- if (input.mode !== "init" && !this.bridgePagePath.has(input.bridgeId)) return false;
461
- const key = `${input.bridgeId}/${input.moduleId}`;
462
- const prev = this.cache.get(key);
463
- const incoming = input.data && typeof input.data === "object" ? input.data : {};
464
- const merged = input.mode === "init" ? { ...incoming } : { ...prev?.data ?? {}, ...incoming };
465
- const componentPath = input.componentPath ?? prev?.componentPath;
466
- const next = componentPath !== void 0 ? { componentPath, data: merged } : { data: merged };
467
- this.cache.set(key, next);
468
- this.recordBridge(input.bridgeId);
469
- if (input.mode === "init" && input.moduleId.startsWith("page_") && input.componentPath) {
470
- this.bridgePagePath.set(input.bridgeId, input.componentPath);
471
- }
472
- return true;
473
- }
474
- /** Evict every entry for a bridge (page teardown). */
475
- clearBridge(bridgeId) {
476
- const prefix = `${bridgeId}/`;
477
- for (const key of [...this.cache.keys()]) {
478
- if (key.startsWith(prefix)) this.cache.delete(key);
479
- }
480
- const idx = this.bridgeOrder.indexOf(bridgeId);
481
- if (idx >= 0) this.bridgeOrder.splice(idx, 1);
482
- this.bridgePagePath.delete(bridgeId);
483
- }
484
- /** The full cumulative snapshot for the panel. */
485
- snapshot() {
486
- const bridges = [];
487
- for (const id of this.bridgeOrder) {
488
- bridges.push({ id, pagePath: this.bridgePagePath.get(id) ?? null });
489
- }
490
- const entries = {};
491
- for (const [key, entry] of this.cache) {
492
- const slash = key.indexOf("/");
493
- if (slash < 0) continue;
494
- const bridgeId = key.slice(0, slash);
495
- const moduleId = key.slice(slash + 1);
496
- if (!entries[bridgeId]) entries[bridgeId] = {};
497
- const displayKey = entry.componentPath ?? moduleId;
498
- entries[bridgeId][displayKey] = entry.data;
499
- }
500
- return { bridges, entries };
501
- }
502
- /**
503
- * The current reactive page state for a bridge: shallow-merge of `entry.data`
504
- * across every cache entry whose key starts with `${bridgeId}/`, in insertion
505
- * order (later entries win on key conflicts). `{}` when no entries match
506
- * (unknown bridge / after clearBridge). Pure, no side effects.
507
- */
508
- pageData(bridgeId) {
509
- const merged = {};
510
- for (const [key, entry] of this.cache) {
511
- const slash = key.indexOf("/");
512
- if (slash < 0) continue;
513
- if (key.slice(0, slash) !== bridgeId) continue;
514
- Object.assign(merged, entry.data);
515
- }
516
- return merged;
517
- }
518
- /** Flat `key → data` map for the `__simulatorData.getAppdata()` mirror. */
519
- flat() {
520
- const data = {};
521
- for (const [key, entry] of this.cache) data[key] = entry.data;
522
- return data;
523
- }
524
- clear() {
525
- this.cache.clear();
526
- this.bridgeOrder.length = 0;
527
- this.bridgePagePath.clear();
528
- }
529
- };
530
-
531
553
  // src/preload/instrumentation/app-data.ts
532
554
  function createAppDataSource() {
533
555
  const accumulator = new AppDataAccumulator();
@@ -75,37 +75,14 @@
75
75
  function pascalToKebab(name) {
76
76
  return name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
77
77
  }
78
- function resolvePagePath(instance) {
79
- const proxy = instance.proxy;
80
- if (proxy?.__page__ !== true)
81
- return null;
82
- const provides = instance.provides;
83
- const path = provides?.path;
84
- if (typeof path !== "string" || !path)
85
- return null;
86
- return path.startsWith("/") ? path.slice(1) : path;
87
- }
88
- function resolveComponentPath(instance) {
89
- const provides = instance.provides;
90
- const path = provides?.path;
91
- if (typeof path !== "string" || !path)
92
- return null;
93
- const parent = instance.parent;
94
- const parentProvides = parent?.provides;
95
- if (path === parentProvides?.path)
96
- return null;
97
- return path.startsWith("/") ? path.slice(1) : path;
98
- }
99
78
  function resolveTagName(instance) {
100
79
  const type = instance.type;
101
80
  if (!type)
102
81
  return "unknown";
103
- const pagePath = resolvePagePath(instance);
104
- if (pagePath)
105
- return pagePath;
106
- const componentPath = resolveComponentPath(instance);
107
- if (componentPath)
108
- return componentPath;
82
+ const nameId = type.name || type.__name;
83
+ if (nameId && nameId.includes("/")) {
84
+ return nameId.startsWith("/") ? nameId.slice(1) : nameId;
85
+ }
109
86
  if (typeof type.__tagName === "string")
110
87
  return type.__tagName;
111
88
  const name = type.__name || type.name;
@@ -176,11 +153,21 @@
176
153
  return sid;
177
154
  return registerSyntheticSid(el);
178
155
  }
156
+ function wrapperPathName(instance) {
157
+ for (const raw of [instance.props, instance.attrs]) {
158
+ const n = raw?.name;
159
+ if (typeof n === "string" && n.startsWith("/"))
160
+ return n;
161
+ }
162
+ return null;
163
+ }
179
164
  function isTransparentComponent(instance, tagName) {
180
165
  if (tagName === "unknown")
181
166
  return true;
182
167
  if (FRAMEWORK_TEMPLATE_RE.test(tagName))
183
168
  return true;
169
+ if (tagName === "wrapper" && wrapperPathName(instance))
170
+ return true;
184
171
  if (tagName === "template") {
185
172
  const props = instance.props;
186
173
  const is = props?.is;
@@ -273,25 +260,6 @@
273
260
  }
274
261
  return result;
275
262
  }
276
- function unwrapCustomComponent(node) {
277
- if (node.tagName !== "wrapper")
278
- return node;
279
- const path = node.attrs?.name;
280
- if (typeof path !== "string" || !path.startsWith("/"))
281
- return node;
282
- const stripped = path.replace(/^\//, "");
283
- const withoutIndex = stripped.endsWith("/index") ? stripped.slice(0, -"/index".length) : stripped;
284
- const recovered = withoutIndex || stripped;
285
- if (!recovered || recovered === "index")
286
- return node;
287
- const nextAttrs = {};
288
- for (const [k, v] of Object.entries(node.attrs)) {
289
- if (k === "name")
290
- continue;
291
- nextAttrs[k] = v;
292
- }
293
- return { ...node, tagName: recovered, attrs: nextAttrs };
294
- }
295
263
  function wrapInShadowRoot(node) {
296
264
  if (!node.tagName.includes("/"))
297
265
  return node;
@@ -315,7 +283,7 @@
315
283
  const sid = getElementSid(instance);
316
284
  if (sid)
317
285
  node.sid = sid;
318
- return wrapInShadowRoot(unwrapCustomComponent(node));
286
+ return wrapInShadowRoot(node);
319
287
  }
320
288
 
321
289
  // ../inspect/dist/inspector.js