@trops/dash-core 0.1.157 → 0.1.158

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/index.js CHANGED
@@ -654,6 +654,12 @@ var THEME_SAVE_ERROR = "theme-save-error";
654
654
  var THEME_DELETE = "theme-delete";
655
655
  var THEME_DELETE_COMPLETE = "theme-delete-complete";
656
656
  var THEME_DELETE_ERROR = "theme-delete-error";
657
+ var THEME_EXTRACT_FROM_URL = "theme-extract-from-url";
658
+ var THEME_EXTRACT_FROM_URL_COMPLETE = "theme-extract-from-url-complete";
659
+ var THEME_EXTRACT_FROM_URL_ERROR = "theme-extract-from-url-error";
660
+ var THEME_MAP_PALETTE = "theme-map-palette";
661
+ var THEME_MAP_PALETTE_COMPLETE = "theme-map-palette-complete";
662
+ var THEME_MAP_PALETTE_ERROR = "theme-map-palette-error";
657
663
 
658
664
  /**
659
665
  * Provider Events
@@ -846,9 +852,15 @@ var apiEvents = /*#__PURE__*/Object.freeze({
846
852
  THEME_DELETE: THEME_DELETE,
847
853
  THEME_DELETE_COMPLETE: THEME_DELETE_COMPLETE,
848
854
  THEME_DELETE_ERROR: THEME_DELETE_ERROR,
855
+ THEME_EXTRACT_FROM_URL: THEME_EXTRACT_FROM_URL,
856
+ THEME_EXTRACT_FROM_URL_COMPLETE: THEME_EXTRACT_FROM_URL_COMPLETE,
857
+ THEME_EXTRACT_FROM_URL_ERROR: THEME_EXTRACT_FROM_URL_ERROR,
849
858
  THEME_LIST: THEME_LIST,
850
859
  THEME_LIST_COMPLETE: THEME_LIST_COMPLETE,
851
860
  THEME_LIST_ERROR: THEME_LIST_ERROR,
861
+ THEME_MAP_PALETTE: THEME_MAP_PALETTE,
862
+ THEME_MAP_PALETTE_COMPLETE: THEME_MAP_PALETTE_COMPLETE,
863
+ THEME_MAP_PALETTE_ERROR: THEME_MAP_PALETTE_ERROR,
852
864
  THEME_SAVE: THEME_SAVE,
853
865
  THEME_SAVE_COMPLETE: THEME_SAVE_COMPLETE,
854
866
  THEME_SAVE_ERROR: THEME_SAVE_ERROR,
@@ -1128,17 +1140,59 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1128
1140
  return false;
1129
1141
  }
1130
1142
  }
1143
+ }, {
1144
+ key: "extractThemeFromUrl",
1145
+ value: function extractThemeFromUrl(url, onSuccess, onError) {
1146
+ var _this10 = this;
1147
+ if (this.api !== null) {
1148
+ try {
1149
+ this.api.themeFromUrl.extractFromUrl(url).then(function (result) {
1150
+ onSuccess(_this10.events.THEME_EXTRACT_FROM_URL_COMPLETE, result);
1151
+ })["catch"](function (error) {
1152
+ onError(_this10.events.THEME_EXTRACT_FROM_URL_ERROR, error);
1153
+ });
1154
+ return true;
1155
+ } catch (e) {
1156
+ onError(this.events.THEME_EXTRACT_FROM_URL_ERROR, e);
1157
+ return false;
1158
+ }
1159
+ } else {
1160
+ onError(this.events.THEME_EXTRACT_FROM_URL_ERROR, new Error("No Api found"));
1161
+ return false;
1162
+ }
1163
+ }
1164
+ }, {
1165
+ key: "mapPaletteToTheme",
1166
+ value: function mapPaletteToTheme(palette, overrides, onSuccess, onError) {
1167
+ var _this11 = this;
1168
+ if (this.api !== null) {
1169
+ try {
1170
+ this.api.themeFromUrl.mapPaletteToTheme(palette, overrides).then(function (result) {
1171
+ onSuccess(_this11.events.THEME_MAP_PALETTE_COMPLETE, result);
1172
+ })["catch"](function (error) {
1173
+ onError(_this11.events.THEME_MAP_PALETTE_ERROR, error);
1174
+ });
1175
+ return true;
1176
+ } catch (e) {
1177
+ onError(this.events.THEME_MAP_PALETTE_ERROR, e);
1178
+ return false;
1179
+ }
1180
+ } else {
1181
+ onError(this.events.THEME_MAP_PALETTE_ERROR, new Error("No Api found"));
1182
+ return false;
1183
+ }
1184
+ }
1131
1185
  }, {
1132
1186
  key: "listProviders",
1133
1187
  value: function listProviders(appId, onSuccess, onError) {
1134
- var _this10 = this;
1188
+ var _this12 = this;
1135
1189
  if (this.api !== null) {
1136
1190
  try {
1137
1191
  // Handle the promise returned by the IPC call
1138
1192
  this.api.providers.listProviders(appId).then(function (result) {
1139
- onSuccess(_this10.events.PROVIDER_LIST_COMPLETE, result);
1193
+ onSuccess(_this12.events.PROVIDER_LIST_COMPLETE, result);
1140
1194
  })["catch"](function (error) {
1141
- onError(_this10.events.PROVIDER_LIST_ERROR, error);
1195
+ onError(_this12.events.PROVIDER_LIST_ERROR, error);
1142
1196
  });
1143
1197
  return true;
1144
1198
  } catch (e) {
@@ -1153,14 +1207,14 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1153
1207
  }, {
1154
1208
  key: "getProvider",
1155
1209
  value: function getProvider(appId, providerName, onSuccess, onError) {
1156
- var _this11 = this;
1210
+ var _this13 = this;
1157
1211
  if (this.api !== null) {
1158
1212
  try {
1159
1213
  // Handle the promise returned by the IPC call
1160
1214
  this.api.providers.getProvider(appId, providerName).then(function (result) {
1161
- onSuccess(_this11.events.PROVIDER_GET_COMPLETE, result);
1215
+ onSuccess(_this13.events.PROVIDER_GET_COMPLETE, result);
1162
1216
  })["catch"](function (error) {
1163
- onError(_this11.events.PROVIDER_GET_ERROR, error);
1217
+ onError(_this13.events.PROVIDER_GET_ERROR, error);
1164
1218
  });
1165
1219
  return true;
1166
1220
  } catch (e) {
@@ -1175,7 +1229,7 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1175
1229
  }, {
1176
1230
  key: "saveProvider",
1177
1231
  value: function saveProvider(appId, providerName, providerData, onSuccess, onError) {
1178
- var _this12 = this;
1232
+ var _this14 = this;
1179
1233
  if (this.api !== null) {
1180
1234
  try {
1181
1235
  // Handle the promise returned by the IPC call
@@ -1186,9 +1240,9 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1186
1240
  mcpConfig = providerData.mcpConfig,
1187
1241
  allowedTools = providerData.allowedTools;
1188
1242
  this.api.providers.saveProvider(appId, providerName, providerType, credentials, providerClass, mcpConfig, allowedTools).then(function (result) {
1189
- onSuccess(_this12.events.PROVIDER_SAVE_COMPLETE, result);
1243
+ onSuccess(_this14.events.PROVIDER_SAVE_COMPLETE, result);
1190
1244
  })["catch"](function (error) {
1191
- onError(_this12.events.PROVIDER_SAVE_ERROR, error);
1245
+ onError(_this14.events.PROVIDER_SAVE_ERROR, error);
1192
1246
  });
1193
1247
  return true;
1194
1248
  } catch (e) {
@@ -1203,13 +1257,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1203
1257
  }, {
1204
1258
  key: "deleteWorkspace",
1205
1259
  value: function deleteWorkspace(appId, workspaceId, onSuccess, onError) {
1206
- var _this13 = this;
1260
+ var _this15 = this;
1207
1261
  if (this.api !== null) {
1208
1262
  try {
1209
1263
  this.api.workspace.deleteWorkspaceForApplication(appId, workspaceId).then(function (result) {
1210
- onSuccess(_this13.events.WORKSPACE_DELETE_COMPLETE, result);
1264
+ onSuccess(_this15.events.WORKSPACE_DELETE_COMPLETE, result);
1211
1265
  })["catch"](function (error) {
1212
- onError(_this13.events.WORKSPACE_DELETE_ERROR, error);
1266
+ onError(_this15.events.WORKSPACE_DELETE_ERROR, error);
1213
1267
  });
1214
1268
  return true;
1215
1269
  } catch (e) {
@@ -1224,13 +1278,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1224
1278
  }, {
1225
1279
  key: "deleteMenuItem",
1226
1280
  value: function deleteMenuItem(appId, menuItemId, onSuccess, onError) {
1227
- var _this14 = this;
1281
+ var _this16 = this;
1228
1282
  if (this.api !== null) {
1229
1283
  try {
1230
1284
  this.api.menuItems.deleteMenuItem(appId, menuItemId).then(function (result) {
1231
- onSuccess(_this14.events.MENU_ITEMS_DELETE_COMPLETE, result);
1285
+ onSuccess(_this16.events.MENU_ITEMS_DELETE_COMPLETE, result);
1232
1286
  })["catch"](function (error) {
1233
- onError(_this14.events.MENU_ITEMS_DELETE_ERROR, error);
1287
+ onError(_this16.events.MENU_ITEMS_DELETE_ERROR, error);
1234
1288
  });
1235
1289
  return true;
1236
1290
  } catch (e) {
@@ -1245,13 +1299,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1245
1299
  }, {
1246
1300
  key: "deleteTheme",
1247
1301
  value: function deleteTheme(appId, themeKey, onSuccess, onError) {
1248
- var _this15 = this;
1302
+ var _this17 = this;
1249
1303
  if (this.api !== null) {
1250
1304
  try {
1251
1305
  this.api.themes.deleteThemeForApplication(appId, themeKey).then(function (result) {
1252
- onSuccess(_this15.events.THEME_DELETE_COMPLETE, result);
1306
+ onSuccess(_this17.events.THEME_DELETE_COMPLETE, result);
1253
1307
  })["catch"](function (error) {
1254
- onError(_this15.events.THEME_DELETE_ERROR, error);
1308
+ onError(_this17.events.THEME_DELETE_ERROR, error);
1255
1309
  });
1256
1310
  return true;
1257
1311
  } catch (e) {
@@ -1286,13 +1340,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1286
1340
  }, {
1287
1341
  key: "openDataDirectory",
1288
1342
  value: function openDataDirectory(onSuccess, onError) {
1289
- var _this16 = this;
1343
+ var _this18 = this;
1290
1344
  if (this.api !== null) {
1291
1345
  try {
1292
1346
  this.api.settings.getDataDirectory().then(function (result) {
1293
1347
  var dir = (result === null || result === void 0 ? void 0 : result.dataDirectory) || result;
1294
- if (dir && _this16.api.shell) {
1295
- _this16.api.shell.openPath(dir);
1348
+ if (dir && _this18.api.shell) {
1349
+ _this18.api.shell.openPath(dir);
1296
1350
  }
1297
1351
  onSuccess(null, result);
1298
1352
  })["catch"](function (error) {
@@ -1311,14 +1365,14 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1311
1365
  }, {
1312
1366
  key: "deleteProvider",
1313
1367
  value: function deleteProvider(appId, providerName, onSuccess, onError) {
1314
- var _this17 = this;
1368
+ var _this19 = this;
1315
1369
  if (this.api !== null) {
1316
1370
  try {
1317
1371
  // Handle the promise returned by the IPC call
1318
1372
  this.api.providers.deleteProvider(appId, providerName).then(function (result) {
1319
- onSuccess(_this17.events.PROVIDER_DELETE_COMPLETE, result);
1373
+ onSuccess(_this19.events.PROVIDER_DELETE_COMPLETE, result);
1320
1374
  })["catch"](function (error) {
1321
- onError(_this17.events.PROVIDER_DELETE_ERROR, error);
1375
+ onError(_this19.events.PROVIDER_DELETE_ERROR, error);
1322
1376
  });
1323
1377
  return true;
1324
1378
  } catch (e) {
@@ -1336,13 +1390,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1336
1390
  }, {
1337
1391
  key: "mcpStartServer",
1338
1392
  value: function mcpStartServer(serverName, mcpConfig, credentials, onSuccess, onError) {
1339
- var _this18 = this;
1393
+ var _this20 = this;
1340
1394
  if (this.api !== null) {
1341
1395
  try {
1342
1396
  this.api.mcp.startServer(serverName, mcpConfig, credentials).then(function (result) {
1343
- onSuccess(_this18.events.MCP_START_SERVER_COMPLETE, result);
1397
+ onSuccess(_this20.events.MCP_START_SERVER_COMPLETE, result);
1344
1398
  })["catch"](function (error) {
1345
- onError(_this18.events.MCP_START_SERVER_ERROR, error);
1399
+ onError(_this20.events.MCP_START_SERVER_ERROR, error);
1346
1400
  });
1347
1401
  return true;
1348
1402
  } catch (e) {
@@ -1357,13 +1411,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1357
1411
  }, {
1358
1412
  key: "mcpStopServer",
1359
1413
  value: function mcpStopServer(serverName, onSuccess, onError) {
1360
- var _this19 = this;
1414
+ var _this21 = this;
1361
1415
  if (this.api !== null) {
1362
1416
  try {
1363
1417
  this.api.mcp.stopServer(serverName).then(function (result) {
1364
- onSuccess(_this19.events.MCP_STOP_SERVER_COMPLETE, result);
1418
+ onSuccess(_this21.events.MCP_STOP_SERVER_COMPLETE, result);
1365
1419
  })["catch"](function (error) {
1366
- onError(_this19.events.MCP_STOP_SERVER_ERROR, error);
1420
+ onError(_this21.events.MCP_STOP_SERVER_ERROR, error);
1367
1421
  });
1368
1422
  return true;
1369
1423
  } catch (e) {
@@ -1378,13 +1432,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1378
1432
  }, {
1379
1433
  key: "mcpCallTool",
1380
1434
  value: function mcpCallTool(serverName, toolName, args, allowedTools, onSuccess, onError) {
1381
- var _this20 = this;
1435
+ var _this22 = this;
1382
1436
  if (this.api !== null) {
1383
1437
  try {
1384
1438
  this.api.mcp.callTool(serverName, toolName, args, allowedTools).then(function (result) {
1385
- onSuccess(_this20.events.MCP_CALL_TOOL_COMPLETE, result);
1439
+ onSuccess(_this22.events.MCP_CALL_TOOL_COMPLETE, result);
1386
1440
  })["catch"](function (error) {
1387
- onError(_this20.events.MCP_CALL_TOOL_ERROR, error);
1441
+ onError(_this22.events.MCP_CALL_TOOL_ERROR, error);
1388
1442
  });
1389
1443
  return true;
1390
1444
  } catch (e) {
@@ -1399,13 +1453,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1399
1453
  }, {
1400
1454
  key: "mcpListTools",
1401
1455
  value: function mcpListTools(serverName, onSuccess, onError) {
1402
- var _this21 = this;
1456
+ var _this23 = this;
1403
1457
  if (this.api !== null) {
1404
1458
  try {
1405
1459
  this.api.mcp.listTools(serverName).then(function (result) {
1406
- onSuccess(_this21.events.MCP_LIST_TOOLS_COMPLETE, result);
1460
+ onSuccess(_this23.events.MCP_LIST_TOOLS_COMPLETE, result);
1407
1461
  })["catch"](function (error) {
1408
- onError(_this21.events.MCP_LIST_TOOLS_ERROR, error);
1462
+ onError(_this23.events.MCP_LIST_TOOLS_ERROR, error);
1409
1463
  });
1410
1464
  return true;
1411
1465
  } catch (e) {
@@ -1420,13 +1474,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1420
1474
  }, {
1421
1475
  key: "mcpListResources",
1422
1476
  value: function mcpListResources(serverName, onSuccess, onError) {
1423
- var _this22 = this;
1477
+ var _this24 = this;
1424
1478
  if (this.api !== null) {
1425
1479
  try {
1426
1480
  this.api.mcp.listResources(serverName).then(function (result) {
1427
- onSuccess(_this22.events.MCP_LIST_RESOURCES_COMPLETE, result);
1481
+ onSuccess(_this24.events.MCP_LIST_RESOURCES_COMPLETE, result);
1428
1482
  })["catch"](function (error) {
1429
- onError(_this22.events.MCP_LIST_RESOURCES_ERROR, error);
1483
+ onError(_this24.events.MCP_LIST_RESOURCES_ERROR, error);
1430
1484
  });
1431
1485
  return true;
1432
1486
  } catch (e) {
@@ -1441,13 +1495,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1441
1495
  }, {
1442
1496
  key: "mcpReadResource",
1443
1497
  value: function mcpReadResource(serverName, uri, onSuccess, onError) {
1444
- var _this23 = this;
1498
+ var _this25 = this;
1445
1499
  if (this.api !== null) {
1446
1500
  try {
1447
1501
  this.api.mcp.readResource(serverName, uri).then(function (result) {
1448
- onSuccess(_this23.events.MCP_READ_RESOURCE_COMPLETE, result);
1502
+ onSuccess(_this25.events.MCP_READ_RESOURCE_COMPLETE, result);
1449
1503
  })["catch"](function (error) {
1450
- onError(_this23.events.MCP_READ_RESOURCE_ERROR, error);
1504
+ onError(_this25.events.MCP_READ_RESOURCE_ERROR, error);
1451
1505
  });
1452
1506
  return true;
1453
1507
  } catch (e) {
@@ -1462,13 +1516,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1462
1516
  }, {
1463
1517
  key: "mcpGetServerStatus",
1464
1518
  value: function mcpGetServerStatus(serverName, onSuccess, onError) {
1465
- var _this24 = this;
1519
+ var _this26 = this;
1466
1520
  if (this.api !== null) {
1467
1521
  try {
1468
1522
  this.api.mcp.getServerStatus(serverName).then(function (result) {
1469
- onSuccess(_this24.events.MCP_SERVER_STATUS_COMPLETE, result);
1523
+ onSuccess(_this26.events.MCP_SERVER_STATUS_COMPLETE, result);
1470
1524
  })["catch"](function (error) {
1471
- onError(_this24.events.MCP_SERVER_STATUS_ERROR, error);
1525
+ onError(_this26.events.MCP_SERVER_STATUS_ERROR, error);
1472
1526
  });
1473
1527
  return true;
1474
1528
  } catch (e) {
@@ -1483,13 +1537,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1483
1537
  }, {
1484
1538
  key: "mcpGetCatalog",
1485
1539
  value: function mcpGetCatalog(onSuccess, onError) {
1486
- var _this25 = this;
1540
+ var _this27 = this;
1487
1541
  if (this.api !== null) {
1488
1542
  try {
1489
1543
  this.api.mcp.getCatalog().then(function (result) {
1490
- onSuccess(_this25.events.MCP_GET_CATALOG_COMPLETE, result);
1544
+ onSuccess(_this27.events.MCP_GET_CATALOG_COMPLETE, result);
1491
1545
  })["catch"](function (error) {
1492
- onError(_this25.events.MCP_GET_CATALOG_ERROR, error);
1546
+ onError(_this27.events.MCP_GET_CATALOG_ERROR, error);
1493
1547
  });
1494
1548
  return true;
1495
1549
  } catch (e) {
@@ -1504,13 +1558,13 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
1504
1558
  }, {
1505
1559
  key: "mcpRunAuth",
1506
1560
  value: function mcpRunAuth(mcpConfig, credentials, authCommand, onSuccess, onError) {
1507
- var _this26 = this;
1561
+ var _this28 = this;
1508
1562
  if (this.api !== null) {
1509
1563
  try {
1510
1564
  this.api.mcp.runAuth(mcpConfig, credentials, authCommand).then(function (result) {
1511
- onSuccess(_this26.events.MCP_RUN_AUTH_COMPLETE, result);
1565
+ onSuccess(_this28.events.MCP_RUN_AUTH_COMPLETE, result);
1512
1566
  })["catch"](function (error) {
1513
- onError(_this26.events.MCP_RUN_AUTH_ERROR, error);
1567
+ onError(_this28.events.MCP_RUN_AUTH_ERROR, error);
1514
1568
  });
1515
1569
  return true;
1516
1570
  } catch (e) {
@@ -32139,7 +32193,8 @@ var GENERATE_MODES = {
32139
32193
  PRESETS: "presets",
32140
32194
  COLOR: "color",
32141
32195
  WIZARD: "wizard",
32142
- CHOOSER: "chooser"
32196
+ CHOOSER: "chooser",
32197
+ FROM_URL: "from-url"
32143
32198
  };
32144
32199
 
32145
32200
  // ─── Preset Gallery ──────────────────────────────────────────────────────
@@ -32404,7 +32459,11 @@ var ThemeQuickCreate = function ThemeQuickCreate(_ref8) {
32404
32459
  setWizardMethod = _ref8.setWizardMethod,
32405
32460
  wizardTheme = _ref8.wizardTheme,
32406
32461
  setWizardTheme = _ref8.setWizardTheme,
32407
- onComplete = _ref8.onComplete;
32462
+ onComplete = _ref8.onComplete,
32463
+ _ref8$onExtract = _ref8.onExtract,
32464
+ onExtract = _ref8$onExtract === void 0 ? null : _ref8$onExtract,
32465
+ _ref8$onMapToTheme = _ref8.onMapToTheme,
32466
+ onMapToTheme = _ref8$onMapToTheme === void 0 ? null : _ref8$onMapToTheme;
32408
32467
  var canCreate = wizardName.trim().length > 0 && wizardTheme !== null;
32409
32468
  function handleMethodSelect(method) {
32410
32469
  setWizardMethod(method);
@@ -32458,6 +32517,14 @@ var ThemeQuickCreate = function ThemeQuickCreate(_ref8) {
32458
32517
  onClick: function onClick() {
32459
32518
  return handleMethodSelect("color");
32460
32519
  }
32520
+ }), onExtract && /*#__PURE__*/jsxRuntime.jsx(MethodCard, {
32521
+ icon: "globe",
32522
+ title: "From Website",
32523
+ subtitle: "Extract colors from any URL",
32524
+ selected: wizardMethod === "from-url",
32525
+ onClick: function onClick() {
32526
+ return handleMethodSelect("from-url");
32527
+ }
32461
32528
  })]
32462
32529
  })]
32463
32530
  }), wizardMethod === "presets" && /*#__PURE__*/jsxRuntime.jsx(PresetGallery, {
@@ -32476,6 +32543,13 @@ var ThemeQuickCreate = function ThemeQuickCreate(_ref8) {
32476
32543
  return setWizardTheme(theme);
32477
32544
  },
32478
32545
  inline: true
32546
+ }), wizardMethod === "from-url" && onExtract && /*#__PURE__*/jsxRuntime.jsx(DashReact.ThemeFromUrlPane, {
32547
+ onExtract: onExtract,
32548
+ onMapToTheme: onMapToTheme,
32549
+ onGenerate: function onGenerate(theme) {
32550
+ return setWizardTheme(theme);
32551
+ },
32552
+ inline: true
32479
32553
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
32480
32554
  title: "Create Theme",
32481
32555
  onClick: onComplete,
@@ -32510,7 +32584,9 @@ var ChooserCard = function ChooserCard(_ref) {
32510
32584
  };
32511
32585
  var ThemeNewChooser = function ThemeNewChooser(_ref2) {
32512
32586
  var onSearchThemes = _ref2.onSearchThemes,
32513
- onCreateNew = _ref2.onCreateNew;
32587
+ onCreateNew = _ref2.onCreateNew,
32588
+ _ref2$onCreateFromUrl = _ref2.onCreateFromUrl,
32589
+ onCreateFromUrl = _ref2$onCreateFromUrl === void 0 ? null : _ref2$onCreateFromUrl;
32514
32590
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
32515
32591
  className: "flex flex-col gap-6 p-6 overflow-y-auto flex-1 min-h-0",
32516
32592
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
@@ -32528,6 +32604,11 @@ var ThemeNewChooser = function ThemeNewChooser(_ref2) {
32528
32604
  title: "Create New",
32529
32605
  subtitle: "Build from presets, random palettes, or color harmony rules",
32530
32606
  onClick: onCreateNew
32607
+ }), onCreateFromUrl && /*#__PURE__*/jsxRuntime.jsx(ChooserCard, {
32608
+ icon: "globe",
32609
+ title: "From Website",
32610
+ subtitle: "Extract colors from any URL to create a theme",
32611
+ onClick: onCreateFromUrl
32531
32612
  })]
32532
32613
  })]
32533
32614
  });
@@ -33215,18 +33296,22 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
33215
33296
  _useState12 = _slicedToArray(_useState11, 2),
33216
33297
  isSearching = _useState12[0],
33217
33298
  setIsSearching = _useState12[1];
33218
- var _useState13 = React.useState(""),
33299
+ var _useState13 = React.useState(false),
33219
33300
  _useState14 = _slicedToArray(_useState13, 2),
33220
- wizardName = _useState14[0],
33221
- setWizardName = _useState14[1];
33222
- var _useState15 = React.useState(null),
33301
+ isFromUrl = _useState14[0],
33302
+ setIsFromUrl = _useState14[1];
33303
+ var _useState15 = React.useState(""),
33223
33304
  _useState16 = _slicedToArray(_useState15, 2),
33224
- wizardMethod = _useState16[0],
33225
- setWizardMethod = _useState16[1];
33305
+ wizardName = _useState16[0],
33306
+ setWizardName = _useState16[1];
33226
33307
  var _useState17 = React.useState(null),
33227
33308
  _useState18 = _slicedToArray(_useState17, 2),
33228
- wizardTheme = _useState18[0],
33229
- setWizardTheme = _useState18[1];
33309
+ wizardMethod = _useState18[0],
33310
+ setWizardMethod = _useState18[1];
33311
+ var _useState19 = React.useState(null),
33312
+ _useState20 = _slicedToArray(_useState19, 2),
33313
+ wizardTheme = _useState20[0],
33314
+ setWizardTheme = _useState20[1];
33230
33315
  var _React$useState = React.useState(),
33231
33316
  _React$useState2 = _slicedToArray(_React$useState, 2),
33232
33317
  updateState = _React$useState2[1];
@@ -33242,6 +33327,7 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
33242
33327
  setIsCreating(false);
33243
33328
  setIsChoosingMode(false);
33244
33329
  setIsSearching(false);
33330
+ setIsFromUrl(false);
33245
33331
  } else {
33246
33332
  if (themeKeySelected === null && themes) {
33247
33333
  var themeKeyTemp = settings && "theme" in settings ? settings["theme"] in themes ? settings["theme"] : Object.keys(themes)[0] : Object.keys(themes)[0];
@@ -33296,10 +33382,86 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
33296
33382
  setIsChoosingMode(false);
33297
33383
  setIsSearching(true);
33298
33384
  }
33385
+ function handleChooseFromUrl() {
33386
+ setIsChoosingMode(false);
33387
+ setIsFromUrl(true);
33388
+ }
33299
33389
  function handleBackFromSearch() {
33300
33390
  setIsSearching(false);
33301
33391
  setIsChoosingMode(true);
33302
33392
  }
33393
+ function handleUrlExtract(_x) {
33394
+ return _handleUrlExtract.apply(this, arguments);
33395
+ }
33396
+ function _handleUrlExtract() {
33397
+ _handleUrlExtract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
33398
+ return _regeneratorRuntime.wrap(function (_context) {
33399
+ while (1) switch (_context.prev = _context.next) {
33400
+ case 0:
33401
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
33402
+ dashApi.extractThemeFromUrl(url, function (e, result) {
33403
+ return resolve(result);
33404
+ }, function (e, err) {
33405
+ return reject(err);
33406
+ });
33407
+ }));
33408
+ case 1:
33409
+ case "end":
33410
+ return _context.stop();
33411
+ }
33412
+ }, _callee);
33413
+ }));
33414
+ return _handleUrlExtract.apply(this, arguments);
33415
+ }
33416
+ function handleUrlMapToTheme(_x2, _x3) {
33417
+ return _handleUrlMapToTheme.apply(this, arguments);
33418
+ }
33419
+ function _handleUrlMapToTheme() {
33420
+ _handleUrlMapToTheme = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(palette, roleAssignments) {
33421
+ var overrides, _i, _Object$entries, _Object$entries$_i, role, index;
33422
+ return _regeneratorRuntime.wrap(function (_context2) {
33423
+ while (1) switch (_context2.prev = _context2.next) {
33424
+ case 0:
33425
+ overrides = {};
33426
+ for (_i = 0, _Object$entries = Object.entries(roleAssignments); _i < _Object$entries.length; _i++) {
33427
+ _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), role = _Object$entries$_i[0], index = _Object$entries$_i[1];
33428
+ if (palette[index]) {
33429
+ overrides[role] = palette[index].hex;
33430
+ }
33431
+ }
33432
+ return _context2.abrupt("return", new Promise(function (resolve, reject) {
33433
+ dashApi.mapPaletteToTheme(palette, overrides, function (e, result) {
33434
+ return resolve((result === null || result === void 0 ? void 0 : result.theme) || result);
33435
+ }, function (e, err) {
33436
+ return reject(err);
33437
+ });
33438
+ }));
33439
+ case 1:
33440
+ case "end":
33441
+ return _context2.stop();
33442
+ }
33443
+ }, _callee2);
33444
+ }));
33445
+ return _handleUrlMapToTheme.apply(this, arguments);
33446
+ }
33447
+ function handleUrlThemeGenerated(theme) {
33448
+ var key = theme.id || "theme-".concat(Date.now());
33449
+ var finalTheme = _objectSpread$b(_objectSpread$b({}, theme), {}, {
33450
+ id: key
33451
+ });
33452
+ if (dashApi) {
33453
+ dashApi.saveTheme(credentials.appId, key, finalTheme, function (e, message) {
33454
+ changeThemesForApplication(message["themes"]);
33455
+ setIsFromUrl(false);
33456
+ var newThemes = message["themes"];
33457
+ if (newThemes && newThemes[key]) {
33458
+ setThemeKeySelected(key);
33459
+ setThemeSelected(newThemes[key]);
33460
+ setRawThemeSelected(finalTheme);
33461
+ }
33462
+ }, handleSaveThemeError);
33463
+ }
33464
+ }
33303
33465
  function handleWizardComplete() {
33304
33466
  if (!wizardTheme || !wizardName.trim()) return;
33305
33467
  var key = wizardTheme.id || "theme-".concat(Date.now());
@@ -33325,6 +33487,7 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
33325
33487
  setIsCreating(false);
33326
33488
  setIsChoosingMode(false);
33327
33489
  setIsSearching(false);
33490
+ setIsFromUrl(false);
33328
33491
  }
33329
33492
  function handleSaveTheme() {
33330
33493
  if (themeKeySelected !== null && rawThemeSelected !== null) {
@@ -33403,7 +33566,8 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
33403
33566
  rawTheme: rawThemeSelected,
33404
33567
  wizardContent: isChoosingMode ? /*#__PURE__*/jsxRuntime.jsx(ThemeNewChooser, {
33405
33568
  onSearchThemes: handleChooseSearch,
33406
- onCreateNew: handleChooseCreate
33569
+ onCreateNew: handleChooseCreate,
33570
+ onCreateFromUrl: handleChooseFromUrl
33407
33571
  }) : isSearching ? /*#__PURE__*/jsxRuntime.jsx(DiscoverThemesDetail, {
33408
33572
  onBack: handleBackFromSearch,
33409
33573
  appId: credentials === null || credentials === void 0 ? void 0 : credentials.appId,
@@ -33423,7 +33587,13 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
33423
33587
  setWizardMethod: setWizardMethod,
33424
33588
  wizardTheme: wizardTheme,
33425
33589
  setWizardTheme: setWizardTheme,
33426
- onComplete: handleWizardComplete
33590
+ onComplete: handleWizardComplete,
33591
+ onExtract: handleUrlExtract,
33592
+ onMapToTheme: handleUrlMapToTheme
33593
+ }) : isFromUrl ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ThemeFromUrlPane, {
33594
+ onExtract: handleUrlExtract,
33595
+ onMapToTheme: handleUrlMapToTheme,
33596
+ onGenerate: handleUrlThemeGenerated
33427
33597
  }) : null
33428
33598
  }), !isCreating && themeSelected && isEditing === true && /*#__PURE__*/jsxRuntime.jsx(PanelTheme, {
33429
33599
  theme: themeSelected,
@@ -33444,13 +33614,13 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
33444
33614
  children: themeKeySelected
33445
33615
  })]
33446
33616
  })
33447
- }), (isCreating || isChoosingMode || isSearching) && /*#__PURE__*/jsxRuntime.jsx("div", {
33617
+ }), (isCreating || isChoosingMode || isSearching || isFromUrl) && /*#__PURE__*/jsxRuntime.jsx("div", {
33448
33618
  className: "flex flex-row space-x-2",
33449
33619
  children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
33450
33620
  onClick: handleCancelCreate,
33451
33621
  title: "Cancel"
33452
33622
  })
33453
- }), !isCreating && !isChoosingMode && !isSearching && isEditing === false && /*#__PURE__*/jsxRuntime.jsxs("div", {
33623
+ }), !isCreating && !isChoosingMode && !isSearching && !isFromUrl && isEditing === false && /*#__PURE__*/jsxRuntime.jsxs("div", {
33454
33624
  className: "flex flex-row space-x-2",
33455
33625
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
33456
33626
  onClick: function onClick() {
@@ -33469,7 +33639,7 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
33469
33639
  onClick: handleActivateTheme,
33470
33640
  title: "Activate"
33471
33641
  })]
33472
- }), !isCreating && !isChoosingMode && !isSearching && isEditing === true && /*#__PURE__*/jsxRuntime.jsxs("div", {
33642
+ }), !isCreating && !isChoosingMode && !isSearching && !isFromUrl && isEditing === true && /*#__PURE__*/jsxRuntime.jsxs("div", {
33473
33643
  className: "flex flex-row space-x-2",
33474
33644
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
33475
33645
  onClick: function onClick() {
@@ -38953,6 +39123,68 @@ var ThemesSection = function ThemesSection(_ref) {
38953
39123
  function handleEdit() {
38954
39124
  if (onOpenThemeEditor) onOpenThemeEditor();
38955
39125
  }
39126
+ function handleUrlExtract(_x) {
39127
+ return _handleUrlExtract.apply(this, arguments);
39128
+ }
39129
+ function _handleUrlExtract() {
39130
+ _handleUrlExtract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
39131
+ return _regeneratorRuntime.wrap(function (_context) {
39132
+ while (1) switch (_context.prev = _context.next) {
39133
+ case 0:
39134
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
39135
+ dashApi.extractThemeFromUrl(url, function (e, result) {
39136
+ return resolve(result);
39137
+ }, function (e, err) {
39138
+ return reject(err);
39139
+ });
39140
+ }));
39141
+ case 1:
39142
+ case "end":
39143
+ return _context.stop();
39144
+ }
39145
+ }, _callee);
39146
+ }));
39147
+ return _handleUrlExtract.apply(this, arguments);
39148
+ }
39149
+ function handleUrlMapToTheme(_x2, _x3) {
39150
+ return _handleUrlMapToTheme.apply(this, arguments);
39151
+ }
39152
+ function _handleUrlMapToTheme() {
39153
+ _handleUrlMapToTheme = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(palette, roleAssignments) {
39154
+ var overrides, _i, _Object$entries, _Object$entries$_i, role, index;
39155
+ return _regeneratorRuntime.wrap(function (_context2) {
39156
+ while (1) switch (_context2.prev = _context2.next) {
39157
+ case 0:
39158
+ overrides = {};
39159
+ for (_i = 0, _Object$entries = Object.entries(roleAssignments); _i < _Object$entries.length; _i++) {
39160
+ _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), role = _Object$entries$_i[0], index = _Object$entries$_i[1];
39161
+ if (palette[index]) {
39162
+ overrides[role] = palette[index].hex;
39163
+ }
39164
+ }
39165
+ return _context2.abrupt("return", new Promise(function (resolve, reject) {
39166
+ dashApi.mapPaletteToTheme(palette, overrides, function (e, result) {
39167
+ return resolve((result === null || result === void 0 ? void 0 : result.theme) || result);
39168
+ }, function (e, err) {
39169
+ return reject(err);
39170
+ });
39171
+ }));
39172
+ case 1:
39173
+ case "end":
39174
+ return _context2.stop();
39175
+ }
39176
+ }, _callee2);
39177
+ }));
39178
+ return _handleUrlMapToTheme.apply(this, arguments);
39179
+ }
39180
+ function handleUrlThemeGenerated(theme) {
39181
+ if (!dashApi || !appId) return;
39182
+ var key = theme.id || "theme-".concat(Date.now());
39183
+ var finalTheme = _objectSpread$5(_objectSpread$5({}, theme), {}, {
39184
+ id: key
39185
+ });
39186
+ saveAndSelectTheme(key, finalTheme);
39187
+ }
38956
39188
  var listContent = /*#__PURE__*/jsxRuntime.jsxs("div", {
38957
39189
  className: "flex flex-col h-full",
38958
39190
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -39045,6 +39277,9 @@ var ThemesSection = function ThemesSection(_ref) {
39045
39277
  },
39046
39278
  onCreateNew: function onCreateNew() {
39047
39279
  setGenerateMode(GENERATE_MODES.WIZARD);
39280
+ },
39281
+ onCreateFromUrl: function onCreateFromUrl() {
39282
+ setGenerateMode(GENERATE_MODES.FROM_URL);
39048
39283
  }
39049
39284
  });
39050
39285
  } else if (generateMode === GENERATE_MODES.WIZARD) {
@@ -39055,12 +39290,20 @@ var ThemesSection = function ThemesSection(_ref) {
39055
39290
  setWizardMethod: setWizardMethod,
39056
39291
  wizardTheme: wizardTheme,
39057
39292
  setWizardTheme: setWizardTheme,
39058
- onComplete: handleWizardComplete
39293
+ onComplete: handleWizardComplete,
39294
+ onExtract: handleUrlExtract,
39295
+ onMapToTheme: handleUrlMapToTheme
39059
39296
  });
39060
39297
  } else if (generateMode === GENERATE_MODES.PRESETS) {
39061
39298
  detailContent = /*#__PURE__*/jsxRuntime.jsx(PresetGallery, {
39062
39299
  onSelect: handleCreateFromPreset
39063
39300
  });
39301
+ } else if (generateMode === GENERATE_MODES.FROM_URL) {
39302
+ detailContent = /*#__PURE__*/jsxRuntime.jsx(DashReact.ThemeFromUrlPane, {
39303
+ onExtract: handleUrlExtract,
39304
+ onMapToTheme: handleUrlMapToTheme,
39305
+ onGenerate: handleUrlThemeGenerated
39306
+ });
39064
39307
  } else if (generateMode === GENERATE_MODES.COLOR) {
39065
39308
  detailContent = /*#__PURE__*/jsxRuntime.jsx(ColorHarmonyPicker, {
39066
39309
  onGenerate: handleCreateFromHarmony
@@ -46205,9 +46448,15 @@ exports.SplitCellModal = SplitCellModal;
46205
46448
  exports.THEME_DELETE = THEME_DELETE;
46206
46449
  exports.THEME_DELETE_COMPLETE = THEME_DELETE_COMPLETE;
46207
46450
  exports.THEME_DELETE_ERROR = THEME_DELETE_ERROR;
46451
+ exports.THEME_EXTRACT_FROM_URL = THEME_EXTRACT_FROM_URL;
46452
+ exports.THEME_EXTRACT_FROM_URL_COMPLETE = THEME_EXTRACT_FROM_URL_COMPLETE;
46453
+ exports.THEME_EXTRACT_FROM_URL_ERROR = THEME_EXTRACT_FROM_URL_ERROR;
46208
46454
  exports.THEME_LIST = THEME_LIST;
46209
46455
  exports.THEME_LIST_COMPLETE = THEME_LIST_COMPLETE;
46210
46456
  exports.THEME_LIST_ERROR = THEME_LIST_ERROR;
46457
+ exports.THEME_MAP_PALETTE = THEME_MAP_PALETTE;
46458
+ exports.THEME_MAP_PALETTE_COMPLETE = THEME_MAP_PALETTE_COMPLETE;
46459
+ exports.THEME_MAP_PALETTE_ERROR = THEME_MAP_PALETTE_ERROR;
46211
46460
  exports.THEME_SAVE = THEME_SAVE;
46212
46461
  exports.THEME_SAVE_COMPLETE = THEME_SAVE_COMPLETE;
46213
46462
  exports.THEME_SAVE_ERROR = THEME_SAVE_ERROR;