@trops/dash-core 0.1.389 → 0.1.391
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/electron/index.js +79 -7
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -29711,14 +29711,23 @@ async function searchThemes(query = "", filters = {}) {
|
|
|
29711
29711
|
* where the user is browsing registry widgets and wants to see them render
|
|
29712
29712
|
* inline before choosing to install or remix.
|
|
29713
29713
|
*
|
|
29714
|
+
* Multi-widget packages (e.g. @trops/clock contains Analog/Digital/Flip/Text
|
|
29715
|
+
* clocks) ship with one .js + .dash.js pair per widget. Pass `componentName`
|
|
29716
|
+
* to pick a specific widget — otherwise we return the alphabetically-first
|
|
29717
|
+
* widget found, which is almost never what the caller wants for UI previews.
|
|
29718
|
+
*
|
|
29714
29719
|
* @param {string} packageName - Any form accepted by getPackage()
|
|
29715
29720
|
* (bare name, scoped "scope/name", or displayName)
|
|
29721
|
+
* @param {string} [componentName] - Specific widget inside the package to
|
|
29722
|
+
* return. Matched against file names in `widgets/`. Accepts either a
|
|
29723
|
+
* bare name ("FlipClockWidget") or a dotted scoped id
|
|
29724
|
+
* ("trops.clock.FlipClockWidget") — the last dotted segment is used.
|
|
29716
29725
|
* @returns {Promise<Object>} {
|
|
29717
29726
|
* componentCode, configCode, bundleSource, widgetName,
|
|
29718
29727
|
* displayName, description, packageName, scope, downloadUrl
|
|
29719
29728
|
* }
|
|
29720
29729
|
*/
|
|
29721
|
-
async function fetchPackageSource(packageName) {
|
|
29730
|
+
async function fetchPackageSource(packageName, componentName = null) {
|
|
29722
29731
|
if (!packageName) {
|
|
29723
29732
|
throw new Error("fetchPackageSource: packageName is required");
|
|
29724
29733
|
}
|
|
@@ -29809,14 +29818,40 @@ async function fetchPackageSource(packageName) {
|
|
|
29809
29818
|
|
|
29810
29819
|
if (fs$5.existsSync(widgetsDir)) {
|
|
29811
29820
|
const files = fs$5.readdirSync(widgetsDir);
|
|
29812
|
-
const
|
|
29821
|
+
const dashFiles = files.filter((f) => f.endsWith(".dash.js"));
|
|
29822
|
+
const componentFiles = files.filter(
|
|
29823
|
+
(f) => f.endsWith(".js") && !f.endsWith(".dash.js") && f !== "index.js",
|
|
29824
|
+
);
|
|
29825
|
+
|
|
29826
|
+
// Normalize componentName hint: accept "FlipClockWidget" or the
|
|
29827
|
+
// dotted form "trops.clock.FlipClockWidget" (last segment wins).
|
|
29828
|
+
const bareHint =
|
|
29829
|
+
typeof componentName === "string" && componentName.length
|
|
29830
|
+
? componentName.split(".").pop()
|
|
29831
|
+
: null;
|
|
29832
|
+
|
|
29833
|
+
// Pick the .dash.js pair that matches the hint; fall back to the
|
|
29834
|
+
// first file so pre-hint callers still work.
|
|
29835
|
+
let configFile = null;
|
|
29836
|
+
if (bareHint) {
|
|
29837
|
+
configFile = dashFiles.find((f) => f === `${bareHint}.dash.js`);
|
|
29838
|
+
}
|
|
29839
|
+
if (!configFile) configFile = dashFiles[0];
|
|
29840
|
+
|
|
29813
29841
|
if (configFile) {
|
|
29814
29842
|
configCode = fs$5.readFileSync(path$9.join(widgetsDir, configFile), "utf8");
|
|
29815
29843
|
widgetName = configFile.replace(/\.dash\.js$/, "");
|
|
29816
29844
|
}
|
|
29817
|
-
|
|
29818
|
-
|
|
29819
|
-
)
|
|
29845
|
+
|
|
29846
|
+
let componentFile = null;
|
|
29847
|
+
if (widgetName) {
|
|
29848
|
+
componentFile = componentFiles.find((f) => f === `${widgetName}.js`);
|
|
29849
|
+
}
|
|
29850
|
+
if (!componentFile && bareHint) {
|
|
29851
|
+
componentFile = componentFiles.find((f) => f === `${bareHint}.js`);
|
|
29852
|
+
}
|
|
29853
|
+
if (!componentFile) componentFile = componentFiles[0];
|
|
29854
|
+
|
|
29820
29855
|
if (componentFile) {
|
|
29821
29856
|
componentCode = fs$5.readFileSync(
|
|
29822
29857
|
path$9.join(widgetsDir, componentFile),
|
|
@@ -51545,6 +51580,36 @@ const cliController$2 = {
|
|
|
51545
51580
|
sessions.set(widgetUuid, capturedSessionId);
|
|
51546
51581
|
}
|
|
51547
51582
|
|
|
51583
|
+
// Claude Code's stream-json emits complete-message envelopes
|
|
51584
|
+
// ({"type": "assistant", "message": {content: [...]}}) rather
|
|
51585
|
+
// than the granular content_block_start/delta/stop events used
|
|
51586
|
+
// by the raw Anthropic streaming API. We handle both shapes —
|
|
51587
|
+
// the complete-message path is the one that actually fires in
|
|
51588
|
+
// CLI mode today (the content_block_* branches remain in case a
|
|
51589
|
+
// future CLI version or --include-partial-messages flag brings
|
|
51590
|
+
// back the granular form).
|
|
51591
|
+
if (parsed.type === "assistant" && parsed.message?.content) {
|
|
51592
|
+
for (const block of parsed.message.content) {
|
|
51593
|
+
if (block?.type === "text" && block.text) {
|
|
51594
|
+
// Emit as a single delta so the renderer sees the text.
|
|
51595
|
+
// (Granular deltas aren't produced in this mode.)
|
|
51596
|
+
safeSend(win, LLM_STREAM_DELTA$2, {
|
|
51597
|
+
requestId,
|
|
51598
|
+
text: block.text,
|
|
51599
|
+
});
|
|
51600
|
+
} else if (block?.type === "tool_use" && block.id && block.name) {
|
|
51601
|
+
safeSend(win, LLM_STREAM_TOOL_CALL$2, {
|
|
51602
|
+
requestId,
|
|
51603
|
+
toolUseId: block.id,
|
|
51604
|
+
toolName: block.name,
|
|
51605
|
+
serverName: "Claude Code",
|
|
51606
|
+
input: block.input || {},
|
|
51607
|
+
});
|
|
51608
|
+
}
|
|
51609
|
+
}
|
|
51610
|
+
continue;
|
|
51611
|
+
}
|
|
51612
|
+
|
|
51548
51613
|
// Map CLI stream-json events to IPC events
|
|
51549
51614
|
if (parsed.type === "content_block_delta") {
|
|
51550
51615
|
if (parsed.delta?.type === "text_delta" && parsed.delta.text) {
|
|
@@ -74370,11 +74435,18 @@ const registryApi$2 = {
|
|
|
74370
74435
|
* Discover tab).
|
|
74371
74436
|
*
|
|
74372
74437
|
* @param {string} packageName - Name of the package (any form)
|
|
74438
|
+
* @param {string} [componentName] - Specific widget in a multi-widget
|
|
74439
|
+
* package. Accepts either a bare name ("FlipClockWidget") or a dotted
|
|
74440
|
+
* scoped id ("trops.clock.FlipClockWidget").
|
|
74373
74441
|
* @returns {Promise<Object>} { componentCode, configCode, bundleSource, widgetName, displayName, description, packageName, scope, downloadUrl }
|
|
74374
74442
|
*/
|
|
74375
|
-
previewFetch: async (packageName) => {
|
|
74443
|
+
previewFetch: async (packageName, componentName = null) => {
|
|
74376
74444
|
try {
|
|
74377
|
-
return await ipcRenderer$h.invoke(
|
|
74445
|
+
return await ipcRenderer$h.invoke(
|
|
74446
|
+
"registry:preview-fetch",
|
|
74447
|
+
packageName,
|
|
74448
|
+
componentName,
|
|
74449
|
+
);
|
|
74378
74450
|
} catch (error) {
|
|
74379
74451
|
console.error(
|
|
74380
74452
|
`[RegistryApi] Error fetching preview source for ${packageName}:`,
|