@powerhousedao/connect 1.0.3-dev.0 → 1.0.4-dev.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.
Files changed (37) hide show
  1. package/LICENSE +661 -0
  2. package/dist/assets/{app-D9QJBr8i.css → app-CYjeY4R-.css} +113 -50
  3. package/dist/assets/{app-BYkaiTES.js → app-DRGUnpgP.js} +2098 -1018
  4. package/dist/assets/{app-loader-Bnp0H-wa.css → app-loader-DC8DXqh9.css} +129 -18
  5. package/dist/assets/{app-loader-Bkg_WUos.js → app-loader-q6UCPwaf.js} +210 -185
  6. package/dist/assets/{ccip-Dn5Ob09y.js → ccip-BMVv2Emt.js} +3 -3
  7. package/dist/assets/{content-DcF7YyCb.js → content-CVGL3ZO5.js} +36 -6
  8. package/dist/assets/{index-CBIcU4C0.js → index-Bn8-eDIz.js} +670 -519
  9. package/dist/assets/{index-B62Phyap.js → index-BsB1NVuP.js} +3 -3
  10. package/dist/assets/{index-zVQzC6z2.js → index-CR5B5rEB.js} +4 -4
  11. package/dist/assets/{main.CgKmK6gL.js → main.DL5ahUYG.js} +1 -1
  12. package/dist/assets/{style-D4JhTt_m.css → style-Ce3V83BE.css} +31 -36
  13. package/dist/hmr.js +1 -1
  14. package/dist/index.html +1 -1
  15. package/dist/modules/@powerhousedao/reactor-browser/{chunk-G6LMXRY5.js → chunk-2ONJ2PX4.js} +1 -1
  16. package/dist/modules/@powerhousedao/reactor-browser/{chunk-XXFOSD4A.js → chunk-6MBHOHAA.js} +1 -1
  17. package/dist/modules/@powerhousedao/reactor-browser/{chunk-FW7N6EJH.js → chunk-C7QRY43M.js} +3 -3
  18. package/dist/modules/@powerhousedao/reactor-browser/{chunk-45DCPCA7.js → chunk-CO2RVWYY.js} +1 -1
  19. package/dist/modules/@powerhousedao/reactor-browser/{chunk-YDERCA5J.js → chunk-IC6B3767.js} +1 -1
  20. package/dist/modules/@powerhousedao/reactor-browser/{chunk-A4GIWVYS.js → chunk-N5UNGAA6.js} +94 -74
  21. package/dist/modules/@powerhousedao/reactor-browser/{chunk-F3RCGUF6.js → chunk-NHD6VUCD.js} +2 -2
  22. package/dist/modules/@powerhousedao/reactor-browser/{chunk-UP4DC4D2.js → chunk-OYYVE7RP.js} +1 -1
  23. package/dist/modules/@powerhousedao/reactor-browser/{chunk-M2UUQ5LH.js → chunk-U34SEKEB.js} +2 -2
  24. package/dist/modules/@powerhousedao/reactor-browser/{chunk-PQ4UODLR.js → chunk-UDKYG6I4.js} +1 -1
  25. package/dist/modules/@powerhousedao/reactor-browser/context/index.js +2 -2
  26. package/dist/modules/@powerhousedao/reactor-browser/context/read-mode.js +2 -2
  27. package/dist/modules/@powerhousedao/reactor-browser/hooks/index.js +8 -8
  28. package/dist/modules/@powerhousedao/reactor-browser/hooks/useAddDebouncedOperations.js +3 -3
  29. package/dist/modules/@powerhousedao/reactor-browser/hooks/useConnectCrypto.js +2 -2
  30. package/dist/modules/@powerhousedao/reactor-browser/hooks/useDocumentDrives.js +2 -2
  31. package/dist/modules/@powerhousedao/reactor-browser/hooks/useDocumentEditor.js +5 -5
  32. package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveActions.js +2 -2
  33. package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveActionsWithUiNodes.js +3 -3
  34. package/dist/modules/@powerhousedao/reactor-browser/index.js +10 -10
  35. package/dist/modules/@powerhousedao/reactor-browser/reactor.js +2 -2
  36. package/dist/vite-envs.sh +1 -1
  37. package/package.json +9 -9
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-BYkaiTES.js","assets/main.CgKmK6gL.js","assets/app-D9QJBr8i.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-DRGUnpgP.js","assets/main.DL5ahUYG.js","assets/app-CYjeY4R-.css"])))=>i.map(i=>d[i]);
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -11,7 +11,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11
11
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
12
12
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
13
13
  var _tags, _levelString, _errorHandler, _ConsoleLogger_instances, levelValue_get, _getDocumentModelModule, _drives, _ReadModeService_instances, parseGraphQLErrors_fn, fetchDrive_fn, _a, _ServiceWorkerManager_instances, handleServiceWorkerMessage_fn, handleServiceWorker_fn;
14
- import { _ as __vitePreload } from "./main.CgKmK6gL.js";
14
+ import { _ as __vitePreload } from "./main.DL5ahUYG.js";
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
16
  import { useState, useEffect, Suspense, lazy } from "react";
17
17
  function _mergeNamespaces(n, m) {
@@ -22786,6 +22786,187 @@ __publicField(_PullResponderTransmitter, "staticLogger", childLogger([
22786
22786
  "static"
22787
22787
  ]));
22788
22788
  let PullResponderTransmitter = _PullResponderTransmitter;
22789
+ var defaults;
22790
+ var hasRequiredDefaults;
22791
+ function requireDefaults() {
22792
+ if (hasRequiredDefaults) return defaults;
22793
+ hasRequiredDefaults = 1;
22794
+ defaults = {
22795
+ space: "",
22796
+ cycles: false,
22797
+ replacer: (k, v) => v,
22798
+ stringify: JSON.stringify
22799
+ };
22800
+ return defaults;
22801
+ }
22802
+ var util;
22803
+ var hasRequiredUtil;
22804
+ function requireUtil() {
22805
+ if (hasRequiredUtil) return util;
22806
+ hasRequiredUtil = 1;
22807
+ util = {
22808
+ isArray: Array.isArray,
22809
+ assign: Object.assign,
22810
+ isObject: (v) => typeof v === "object",
22811
+ isFunction: (v) => typeof v === "function",
22812
+ isBoolean: (v) => typeof v === "boolean",
22813
+ isRegex: (v) => v instanceof RegExp,
22814
+ keys: Object.keys
22815
+ };
22816
+ return util;
22817
+ }
22818
+ var lib;
22819
+ var hasRequiredLib;
22820
+ function requireLib() {
22821
+ if (hasRequiredLib) return lib;
22822
+ hasRequiredLib = 1;
22823
+ const DEFAULTS = requireDefaults();
22824
+ const isFunction = requireUtil().isFunction;
22825
+ const isBoolean = requireUtil().isBoolean;
22826
+ const isObject = requireUtil().isObject;
22827
+ const isArray = requireUtil().isArray;
22828
+ const isRegex = requireUtil().isRegex;
22829
+ const assign = requireUtil().assign;
22830
+ const keys = requireUtil().keys;
22831
+ function serialize(obj) {
22832
+ if (obj === null || obj === void 0) return obj;
22833
+ if (isRegex(obj)) return obj.toString();
22834
+ return obj.toJSON ? obj.toJSON() : obj;
22835
+ }
22836
+ function stringifyDeterministic(obj, opts) {
22837
+ opts = opts || assign({}, DEFAULTS);
22838
+ if (isFunction(opts)) opts = { compare: opts };
22839
+ const space = opts.space || DEFAULTS.space;
22840
+ const cycles = isBoolean(opts.cycles) ? opts.cycles : DEFAULTS.cycles;
22841
+ const replacer = opts.replacer || DEFAULTS.replacer;
22842
+ const stringify2 = opts.stringify || DEFAULTS.stringify;
22843
+ const compare = opts.compare && /* @__PURE__ */ function(f) {
22844
+ return function(node) {
22845
+ return function(a, b) {
22846
+ const aobj = { key: a, value: node[a] };
22847
+ const bobj = { key: b, value: node[b] };
22848
+ return f(aobj, bobj);
22849
+ };
22850
+ };
22851
+ }(opts.compare);
22852
+ if (!cycles) stringify2(obj);
22853
+ const seen = [];
22854
+ return function _deterministic(parent, key, node, level) {
22855
+ const indent2 = space ? "\n" + new Array(level + 1).join(space) : "";
22856
+ const colonSeparator = space ? ": " : ":";
22857
+ node = serialize(node);
22858
+ node = replacer.call(parent, key, node);
22859
+ if (node === void 0) return;
22860
+ if (!isObject(node) || node === null) return stringify2(node);
22861
+ if (isArray(node)) {
22862
+ const out = [];
22863
+ for (let i = 0; i < node.length; i++) {
22864
+ const item = _deterministic(node, i, node[i], level + 1) || stringify2(null);
22865
+ out.push(indent2 + space + item);
22866
+ }
22867
+ return "[" + out.join(",") + indent2 + "]";
22868
+ } else {
22869
+ if (cycles) {
22870
+ if (seen.indexOf(node) !== -1) {
22871
+ return stringify2("[Circular]");
22872
+ } else {
22873
+ seen.push(node);
22874
+ }
22875
+ }
22876
+ const nodeKeys = keys(node).sort(compare && compare(node));
22877
+ const out = [];
22878
+ for (let i = 0; i < nodeKeys.length; i++) {
22879
+ const key2 = nodeKeys[i];
22880
+ const value = _deterministic(node, key2, node[key2], level + 1);
22881
+ if (!value) continue;
22882
+ const keyValue = stringify2(key2) + colonSeparator + value;
22883
+ out.push(indent2 + space + keyValue);
22884
+ }
22885
+ seen.splice(seen.indexOf(node), 1);
22886
+ return "{" + out.join(",") + indent2 + "}";
22887
+ }
22888
+ }({ "": obj }, "", obj, 0);
22889
+ }
22890
+ lib = stringifyDeterministic;
22891
+ return lib;
22892
+ }
22893
+ var libExports = requireLib();
22894
+ const stringify = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
22895
+ const SYNC_OPS_BATCH_LIMIT = 10;
22896
+ class SwitchboardPushTransmitter {
22897
+ constructor(targetURL) {
22898
+ __publicField(this, "targetURL");
22899
+ __publicField(this, "logger", childLogger([
22900
+ "SwitchboardPushTransmitter",
22901
+ Math.floor(Math.random() * 999).toString()
22902
+ ]));
22903
+ this.targetURL = targetURL;
22904
+ }
22905
+ async transmit(strands, source) {
22906
+ var _a2;
22907
+ if (source.type === "trigger" && ((_a2 = source.trigger.data) == null ? void 0 : _a2.url) === this.targetURL) {
22908
+ this.logger.verbose(`Cutting trigger loop from ${this.targetURL}.`);
22909
+ return strands.map((strand) => {
22910
+ var _a3;
22911
+ return {
22912
+ driveId: strand.driveId,
22913
+ documentId: strand.documentId,
22914
+ scope: strand.scope,
22915
+ branch: strand.branch,
22916
+ status: "SUCCESS",
22917
+ revision: ((_a3 = strand.operations.at(-1)) == null ? void 0 : _a3.index) ?? -1
22918
+ };
22919
+ });
22920
+ }
22921
+ const culledStrands = [];
22922
+ let opsCounter = 0;
22923
+ for (let s = 0; opsCounter <= SYNC_OPS_BATCH_LIMIT && s < strands.length; s++) {
22924
+ const currentStrand = strands.at(s);
22925
+ if (!currentStrand) {
22926
+ break;
22927
+ }
22928
+ const newOps = Math.min(SYNC_OPS_BATCH_LIMIT - opsCounter, currentStrand.operations.length);
22929
+ culledStrands.push({
22930
+ ...currentStrand,
22931
+ operations: currentStrand.operations.slice(0, newOps)
22932
+ });
22933
+ opsCounter += newOps;
22934
+ }
22935
+ this.logger.verbose(` Total update: [${strands.map((s) => s.operations.length).join(", ")}] operations`);
22936
+ this.logger.verbose(`Culled update: [${culledStrands.map((s) => s.operations.length).join(", ")}] operations`);
22937
+ try {
22938
+ const { pushUpdates } = await requestGraphql(this.targetURL, gql`
22939
+ mutation pushUpdates($strands: [InputStrandUpdate!]) {
22940
+ pushUpdates(strands: $strands) {
22941
+ driveId
22942
+ documentId
22943
+ scope
22944
+ branch
22945
+ status
22946
+ revision
22947
+ error
22948
+ }
22949
+ }
22950
+ `, {
22951
+ strands: culledStrands.map((strand) => ({
22952
+ ...strand,
22953
+ operations: strand.operations.map((op) => ({
22954
+ ...op,
22955
+ input: stringify(op.input)
22956
+ }))
22957
+ }))
22958
+ });
22959
+ if (!pushUpdates) {
22960
+ throw new Error("Couldn't update listener revision");
22961
+ }
22962
+ return pushUpdates;
22963
+ } catch (e) {
22964
+ this.logger.error(e);
22965
+ throw e;
22966
+ }
22967
+ return [];
22968
+ }
22969
+ }
22789
22970
  var TransmitterType;
22790
22971
  (function(TransmitterType2) {
22791
22972
  TransmitterType2[TransmitterType2["Internal"] = 0] = "Internal";
@@ -23019,11 +23200,32 @@ class BaseDocumentDriveServer {
23019
23200
  return this.triggerMap.delete(driveId);
23020
23201
  }
23021
23202
  async _initializeDrive(driveId) {
23203
+ var _a2, _b, _c, _d, _e, _f;
23022
23204
  const drive = await this.getDrive(driveId);
23023
23205
  await this.synchronizationManager.initializeDriveSyncStatus(driveId, drive);
23024
23206
  if (this.shouldSyncRemoteDrive(drive)) {
23025
23207
  await this.startSyncRemoteDrive(driveId);
23026
23208
  }
23209
+ for (const zodListener of drive.state.local.listeners) {
23210
+ if (((_a2 = zodListener.callInfo) == null ? void 0 : _a2.transmitterType) === "SwitchboardPush") {
23211
+ const transmitter = new SwitchboardPushTransmitter(((_b = zodListener.callInfo) == null ? void 0 : _b.data) ?? "");
23212
+ this.listenerManager.setListener(driveId, {
23213
+ block: zodListener.block,
23214
+ driveId: drive.state.global.id,
23215
+ filter: {
23216
+ branch: ((_c = zodListener.filter) == null ? void 0 : _c.branch) ?? [],
23217
+ documentId: ((_d = zodListener.filter) == null ? void 0 : _d.documentId) ?? [],
23218
+ documentType: ((_e = zodListener.filter) == null ? void 0 : _e.documentType) ?? [],
23219
+ scope: ((_f = zodListener.filter) == null ? void 0 : _f.scope) ?? []
23220
+ },
23221
+ listenerId: zodListener.listenerId,
23222
+ callInfo: zodListener.callInfo,
23223
+ system: zodListener.system,
23224
+ label: zodListener.label ?? "",
23225
+ transmitter
23226
+ });
23227
+ }
23228
+ }
23027
23229
  }
23028
23230
  // Delegate synchronization methods to synchronizationManager
23029
23231
  getSynchronizationUnits(driveId, documentId, scope, branch, documentType2) {
@@ -24413,187 +24615,6 @@ const _ListenerManager = class _ListenerManager {
24413
24615
  };
24414
24616
  __publicField(_ListenerManager, "LISTENER_UPDATE_DELAY", 250);
24415
24617
  let ListenerManager = _ListenerManager;
24416
- var defaults;
24417
- var hasRequiredDefaults;
24418
- function requireDefaults() {
24419
- if (hasRequiredDefaults) return defaults;
24420
- hasRequiredDefaults = 1;
24421
- defaults = {
24422
- space: "",
24423
- cycles: false,
24424
- replacer: (k, v) => v,
24425
- stringify: JSON.stringify
24426
- };
24427
- return defaults;
24428
- }
24429
- var util;
24430
- var hasRequiredUtil;
24431
- function requireUtil() {
24432
- if (hasRequiredUtil) return util;
24433
- hasRequiredUtil = 1;
24434
- util = {
24435
- isArray: Array.isArray,
24436
- assign: Object.assign,
24437
- isObject: (v) => typeof v === "object",
24438
- isFunction: (v) => typeof v === "function",
24439
- isBoolean: (v) => typeof v === "boolean",
24440
- isRegex: (v) => v instanceof RegExp,
24441
- keys: Object.keys
24442
- };
24443
- return util;
24444
- }
24445
- var lib;
24446
- var hasRequiredLib;
24447
- function requireLib() {
24448
- if (hasRequiredLib) return lib;
24449
- hasRequiredLib = 1;
24450
- const DEFAULTS = requireDefaults();
24451
- const isFunction = requireUtil().isFunction;
24452
- const isBoolean = requireUtil().isBoolean;
24453
- const isObject = requireUtil().isObject;
24454
- const isArray = requireUtil().isArray;
24455
- const isRegex = requireUtil().isRegex;
24456
- const assign = requireUtil().assign;
24457
- const keys = requireUtil().keys;
24458
- function serialize(obj) {
24459
- if (obj === null || obj === void 0) return obj;
24460
- if (isRegex(obj)) return obj.toString();
24461
- return obj.toJSON ? obj.toJSON() : obj;
24462
- }
24463
- function stringifyDeterministic(obj, opts) {
24464
- opts = opts || assign({}, DEFAULTS);
24465
- if (isFunction(opts)) opts = { compare: opts };
24466
- const space = opts.space || DEFAULTS.space;
24467
- const cycles = isBoolean(opts.cycles) ? opts.cycles : DEFAULTS.cycles;
24468
- const replacer = opts.replacer || DEFAULTS.replacer;
24469
- const stringify2 = opts.stringify || DEFAULTS.stringify;
24470
- const compare = opts.compare && /* @__PURE__ */ function(f) {
24471
- return function(node) {
24472
- return function(a, b) {
24473
- const aobj = { key: a, value: node[a] };
24474
- const bobj = { key: b, value: node[b] };
24475
- return f(aobj, bobj);
24476
- };
24477
- };
24478
- }(opts.compare);
24479
- if (!cycles) stringify2(obj);
24480
- const seen = [];
24481
- return function _deterministic(parent, key, node, level) {
24482
- const indent2 = space ? "\n" + new Array(level + 1).join(space) : "";
24483
- const colonSeparator = space ? ": " : ":";
24484
- node = serialize(node);
24485
- node = replacer.call(parent, key, node);
24486
- if (node === void 0) return;
24487
- if (!isObject(node) || node === null) return stringify2(node);
24488
- if (isArray(node)) {
24489
- const out = [];
24490
- for (let i = 0; i < node.length; i++) {
24491
- const item = _deterministic(node, i, node[i], level + 1) || stringify2(null);
24492
- out.push(indent2 + space + item);
24493
- }
24494
- return "[" + out.join(",") + indent2 + "]";
24495
- } else {
24496
- if (cycles) {
24497
- if (seen.indexOf(node) !== -1) {
24498
- return stringify2("[Circular]");
24499
- } else {
24500
- seen.push(node);
24501
- }
24502
- }
24503
- const nodeKeys = keys(node).sort(compare && compare(node));
24504
- const out = [];
24505
- for (let i = 0; i < nodeKeys.length; i++) {
24506
- const key2 = nodeKeys[i];
24507
- const value = _deterministic(node, key2, node[key2], level + 1);
24508
- if (!value) continue;
24509
- const keyValue = stringify2(key2) + colonSeparator + value;
24510
- out.push(indent2 + space + keyValue);
24511
- }
24512
- seen.splice(seen.indexOf(node), 1);
24513
- return "{" + out.join(",") + indent2 + "}";
24514
- }
24515
- }({ "": obj }, "", obj, 0);
24516
- }
24517
- lib = stringifyDeterministic;
24518
- return lib;
24519
- }
24520
- var libExports = requireLib();
24521
- const stringify = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
24522
- const SYNC_OPS_BATCH_LIMIT = 10;
24523
- class SwitchboardPushTransmitter {
24524
- constructor(targetURL) {
24525
- __publicField(this, "targetURL");
24526
- __publicField(this, "logger", childLogger([
24527
- "SwitchboardPushTransmitter",
24528
- Math.floor(Math.random() * 999).toString()
24529
- ]));
24530
- this.targetURL = targetURL;
24531
- }
24532
- async transmit(strands, source) {
24533
- var _a2;
24534
- if (source.type === "trigger" && ((_a2 = source.trigger.data) == null ? void 0 : _a2.url) === this.targetURL) {
24535
- this.logger.verbose(`Cutting trigger loop from ${this.targetURL}.`);
24536
- return strands.map((strand) => {
24537
- var _a3;
24538
- return {
24539
- driveId: strand.driveId,
24540
- documentId: strand.documentId,
24541
- scope: strand.scope,
24542
- branch: strand.branch,
24543
- status: "SUCCESS",
24544
- revision: ((_a3 = strand.operations.at(-1)) == null ? void 0 : _a3.index) ?? -1
24545
- };
24546
- });
24547
- }
24548
- const culledStrands = [];
24549
- let opsCounter = 0;
24550
- for (let s = 0; opsCounter <= SYNC_OPS_BATCH_LIMIT && s < strands.length; s++) {
24551
- const currentStrand = strands.at(s);
24552
- if (!currentStrand) {
24553
- break;
24554
- }
24555
- const newOps = Math.min(SYNC_OPS_BATCH_LIMIT - opsCounter, currentStrand.operations.length);
24556
- culledStrands.push({
24557
- ...currentStrand,
24558
- operations: currentStrand.operations.slice(0, newOps)
24559
- });
24560
- opsCounter += newOps;
24561
- }
24562
- this.logger.verbose(` Total update: [${strands.map((s) => s.operations.length).join(", ")}] operations`);
24563
- this.logger.verbose(`Culled update: [${culledStrands.map((s) => s.operations.length).join(", ")}] operations`);
24564
- try {
24565
- const { pushUpdates } = await requestGraphql(this.targetURL, gql`
24566
- mutation pushUpdates($strands: [InputStrandUpdate!]) {
24567
- pushUpdates(strands: $strands) {
24568
- driveId
24569
- documentId
24570
- scope
24571
- branch
24572
- status
24573
- revision
24574
- error
24575
- }
24576
- }
24577
- `, {
24578
- strands: culledStrands.map((strand) => ({
24579
- ...strand,
24580
- operations: strand.operations.map((op) => ({
24581
- ...op,
24582
- input: stringify(op.input)
24583
- }))
24584
- }))
24585
- });
24586
- if (!pushUpdates) {
24587
- throw new Error("Couldn't update listener revision");
24588
- }
24589
- return pushUpdates;
24590
- } catch (e) {
24591
- this.logger.error(e);
24592
- throw e;
24593
- }
24594
- return [];
24595
- }
24596
- }
24597
24618
  class TransmitterFactory {
24598
24619
  constructor(listenerManager) {
24599
24620
  __publicField(this, "listenerManager");
@@ -25230,6 +25251,9 @@ function Modified(props) {
25230
25251
  function Moved(props) {
25231
25252
  return jsxs("svg", { ...props, width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M7.07143 1.96429C7.07143 2.2207 6.86356 2.42857 6.60714 2.42857H5.21429C3.67578 2.42857 2.42857 3.67578 2.42857 5.21429V10.7857C2.42857 12.3242 3.67578 13.5714 5.21429 13.5714H10.7857C12.3242 13.5714 13.5714 12.3242 13.5714 10.7857V9.39286C13.5714 9.13644 13.7793 8.92857 14.0357 8.92857C14.2921 8.92857 14.5 9.13644 14.5 9.39286V10.7857C14.5 12.8371 12.8371 14.5 10.7857 14.5H5.21429C3.16294 14.5 1.5 12.8371 1.5 10.7857V5.21429C1.5 3.16294 3.16294 1.5 5.21429 1.5H6.60714C6.86356 1.5 7.07143 1.70787 7.07143 1.96429Z", fill: "currentcolor" }), jsx("path", { d: "M14 6.5V2.5C14 2.22386 13.7761 2 13.5 2H9.5", stroke: "currentcolor", strokeLinecap: "round" }), jsx("path", { d: "M7 10L7.28346 9.29136C8.39378 6.51556 10.4269 4.20728 13.0403 2.75539L13.5 2.5", stroke: "currentcolor", strokeLinecap: "round" })] });
25232
25253
  }
25254
+ function Npm(props) {
25255
+ return jsx("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 128 128", children: jsx("path", { fill: "#cb3837", d: "M2 38.5h124v43.71H64v7.29H36.44v-7.29H2zm6.89 36.43h13.78V53.07h6.89v21.86h6.89V45.79H8.89zm34.44-29.14v36.42h13.78v-7.28h13.78V45.79zm13.78 7.29H64v14.56h-6.89zm20.67-7.29v29.14h13.78V53.07h6.89v21.86h6.89V53.07h6.89v21.86h6.89V45.79z" }) });
25256
+ }
25233
25257
  function PackageManager(props) {
25234
25258
  return jsx("svg", { ...props, width: "12", height: "12", viewBox: "0 0 12 12", fill: "currentcolor", children: jsx("path", { d: "M1.22323 -0.00109863C0.549226 -0.00109863 -0.00610352 0.533576 -0.00610352 1.20691V2.79089C-0.00610352 3.46423 0.549226 3.9989 1.22323 3.9989H4.0979C4.7719 3.9989 5.32723 3.46423 5.32723 2.79089V1.20691C5.32723 0.533576 4.7719 -0.00109863 4.0979 -0.00109863H1.22323ZM7.9939 -0.00109863C7.25723 -0.00109863 6.66056 0.595568 6.66056 1.33223V5.33223C6.66056 6.0689 7.25723 6.66557 7.9939 6.66557H10.6606C11.3972 6.66557 11.9939 6.0689 11.9939 5.33223V1.33223C11.9939 0.595568 11.3972 -0.00109863 10.6606 -0.00109863H7.9939ZM1.32723 5.33223C0.590563 5.33223 -0.00610352 5.9289 -0.00610352 6.66557V10.6656C-0.00610352 11.4022 0.590563 11.9989 1.32723 11.9989H3.9939C4.73056 11.9989 5.32723 11.4022 5.32723 10.6656V6.66557C5.32723 5.9289 4.73056 5.33223 3.9939 5.33223H1.32723ZM7.88989 7.9989C7.21589 7.9989 6.66056 8.53358 6.66056 9.20691V10.7909C6.66056 11.4642 7.21589 11.9989 7.88989 11.9989H10.7646C11.4386 11.9989 11.9939 11.4642 11.9939 10.7909V9.20691C11.9939 8.53358 11.4386 7.9989 10.7646 7.9989H7.88989Z" }) });
25235
25259
  }
@@ -25418,6 +25442,7 @@ const iconComponents = {
25418
25442
  M,
25419
25443
  Modified,
25420
25444
  Moved,
25445
+ Npm,
25421
25446
  PackageManager,
25422
25447
  Pencil,
25423
25448
  PeopleFill,
@@ -25595,7 +25620,7 @@ const nodeOptionsMap = {
25595
25620
  };
25596
25621
  const name = "@powerhousedao/connect";
25597
25622
  const productName = "Powerhouse-Connect";
25598
- const version$1 = "1.0.3-dev.0";
25623
+ const version$1 = "1.0.4-dev.0";
25599
25624
  const description = "Powerhouse Connect";
25600
25625
  const main = "./dist/index.html";
25601
25626
  const type = "module";
@@ -31235,7 +31260,7 @@ if (window.__VITE_ENVS.MODE === "development") {
31235
31260
  } else {
31236
31261
  serviceWorkerManager.registerServiceWorker(false);
31237
31262
  }
31238
- const App = lazy(() => __vitePreload(() => import("./app-BYkaiTES.js").then((n) => n.aN), true ? __vite__mapDeps([0,1,2]) : void 0));
31263
+ const App = lazy(() => __vitePreload(() => import("./app-DRGUnpgP.js").then((n) => n.aN), true ? __vite__mapDeps([0,1,2]) : void 0));
31239
31264
  const AppLoader = /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(App, {}) });
31240
31265
  const appLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31241
31266
  __proto__: null,
@@ -1,7 +1,7 @@
1
- import { aD as BaseError, aE as getUrl, aF as stringify, aG as decodeErrorResult, aH as isAddressEqual, aI as call, aJ as concat, aK as encodeAbiParameters, aL as HttpRequestError, aM as isHex } from "./app-BYkaiTES.js";
2
- import "./main.CgKmK6gL.js";
1
+ import { aD as BaseError, aE as getUrl, aF as stringify, aG as decodeErrorResult, aH as isAddressEqual, aI as call, aJ as concat, aK as encodeAbiParameters, aL as HttpRequestError, aM as isHex } from "./app-DRGUnpgP.js";
2
+ import "./main.DL5ahUYG.js";
3
3
  import "react/jsx-runtime";
4
- import "./app-loader-Bkg_WUos.js";
4
+ import "./app-loader-q6UCPwaf.js";
5
5
  import "react";
6
6
  import "@powerhousedao/reactor-browser";
7
7
  import "react-dom";
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
- import { t as twMerge, B as Button, m as mergeClassNameProps, E as ERROR, M as MISSING, C as CONFLICT, S as SUCCESS, h as SYNCING, I as INITIAL_SYNC, i as ConnectDropdownMenu, u as useOnClickOutside, j as useEventListener, k as useCopyToClipboard, l as Select, n as ENSAvatar, P as Provider, o as Root3, T as Trigger, p as Portal, q as Content2, v as validateInitialState, w as validateStateSchemaName, x as validateModules, y as useUnwrappedReactor, z as useConnectDid, A as useConnectCrypto, D as useTranslation, F as useModal, G as useAtomValue, H as themeAtom, J as useUser, K as useUserPermissions, L as useUiNodes, N as exportFile, O as useGetDocumentModelModule, Q as addActionContext, U as signOperation, V as useDocumentDriveServer, W as useHotkeys, X as useGetEditor, Y as isSameDocument, Z as useNavigate, _ as ErrorBoundary, $ as DriveLayout, a0 as SearchBar, a1 as useAsyncReactor, a2 as useFilteredDocumentModels, a3 as useDriveEditor, a4 as useDocumentDriveById } from "./app-BYkaiTES.js";
2
+ import { t as twMerge, B as Button, m as mergeClassNameProps, E as ERROR, M as MISSING, C as CONFLICT, S as SUCCESS, h as SYNCING, I as INITIAL_SYNC, i as ConnectDropdownMenu, u as useOnClickOutside, j as useEventListener, k as useCopyToClipboard, l as Select, n as ENSAvatar, P as Provider, o as Root3, T as Trigger, p as Portal, q as Content2, v as validateInitialState, w as validateStateSchemaName, x as validateModules, y as useUnwrappedReactor, z as useConnectDid, A as useConnectCrypto, D as useTranslation, F as useModal, G as useAtomValue, H as themeAtom, J as useUser, K as useUserPermissions, L as useUiNodes, N as exportFile, O as useGetDocumentModelModule, Q as addActionContext, U as signOperation, V as useDocumentDriveServer, W as useHotkeys, X as useGetEditor, Y as isSameDocument, Z as useNavigate, _ as ErrorBoundary, $ as DriveLayout, a0 as SearchBar, a1 as useAsyncReactor, a2 as useFilteredDocumentModels, a3 as useDriveEditor, a4 as useDocumentDriveById } from "./app-DRGUnpgP.js";
3
3
  import * as React from "react";
4
4
  import React__default, { useState, useCallback, useMemo, useEffect, Fragment, useRef, useLayoutEffect, memo as memo$1, createElement, useSyncExternalStore, Suspense } from "react";
5
- import { _ as Icon, aX as getDimensions, aY as READ, aZ as nodeOptionsMap, a_ as defaultFileOptions, a$ as DELETE, b0 as RENAME, b1 as WRITE, b2 as DUPLICATE, b3 as defaultFolderOptions, b4 as garbageCollect, b5 as sortOperations, b6 as UI_NODE, aO as DRIVE, ay as FILE, b7 as undo, b8 as redo, ac as logger, b9 as useDocumentDispatch, aP as FOLDER, ak as driveDocumentModelModule } from "./app-loader-Bkg_WUos.js";
5
+ import { _ as Icon, aX as getDimensions, aY as READ, aZ as nodeOptionsMap, a_ as defaultFileOptions, a$ as DELETE, b0 as RENAME, b1 as WRITE, b2 as DUPLICATE, b3 as defaultFolderOptions, b4 as garbageCollect, b5 as sortOperations, b6 as UI_NODE, aO as DRIVE, ay as FILE, b7 as undo, b8 as redo, ac as logger, b9 as useDocumentDispatch, aP as FOLDER, ak as driveDocumentModelModule } from "./app-loader-q6UCPwaf.js";
6
6
  import { useDocument, useDocumentEditorProps } from "@powerhousedao/reactor-browser";
7
7
  import { useUiNodesContext, FILE as FILE$1 } from "@powerhousedao/reactor-browser/hooks/useUiNodesContext";
8
8
  import { useDriveActionsWithUiNodes } from "@powerhousedao/reactor-browser/hooks/useDriveActionsWithUiNodes";
@@ -10,7 +10,7 @@ import { useDriveContext, DriveContextProvider } from "@powerhousedao/reactor-br
10
10
  import "@powerhousedao/reactor-browser/uiNodes/constants";
11
11
  import { makeDriveDocumentStateHook } from "@powerhousedao/reactor-browser/hooks/document-state";
12
12
  import { flushSync } from "react-dom";
13
- import "./main.CgKmK6gL.js";
13
+ import "./main.DL5ahUYG.js";
14
14
  const PaginationButton = ({ active = false, ...props }) => {
15
15
  const className = twMerge("h-8 min-w-8 border border-solid border-gray-300 bg-white px-3 py-1 text-xs text-gray-900 hover:bg-gray-100", !active && "border-0");
16
16
  return jsx(Button, { color: "light", size: "small", ...mergeClassNameProps(props, className), children: props.children });
@@ -238,7 +238,7 @@ function FolderItem(props) {
238
238
  const { uiNode, isAllowedToCreateDocuments, className, onRenameNode, onDuplicateNode, onDeleteNode, onSelectNode, onAddFile, onCopyNode, onMoveNode } = props;
239
239
  const [mode, setMode] = useState(READ);
240
240
  const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
241
- const { dragProps } = useDrag(props);
241
+ const { dragProps } = useDrag({ ...props, uiNode });
242
242
  const { isDropTarget, dropProps } = useDrop({
243
243
  uiNode,
244
244
  onAddFile,
@@ -251,6 +251,7 @@ function FolderItem(props) {
251
251
  }
252
252
  function onSubmit(name) {
253
253
  onRenameNode(name, uiNode);
254
+ setMode(READ);
254
255
  }
255
256
  function onClick() {
256
257
  onSelectNode(uiNode);
@@ -2577,6 +2578,12 @@ function calculateRange({
2577
2578
  }) {
2578
2579
  const lastIndex = measurements.length - 1;
2579
2580
  const getOffset = (index) => measurements[index].start;
2581
+ if (measurements.length <= lanes) {
2582
+ return {
2583
+ startIndex: 0,
2584
+ endIndex: lastIndex
2585
+ };
2586
+ }
2580
2587
  let startIndex = findNearestBinarySearch(
2581
2588
  0,
2582
2589
  lastIndex,
@@ -3710,13 +3717,36 @@ function FolderView(props) {
3710
3717
  const { t } = useTranslation();
3711
3718
  const folderNodes = node.children.filter((node2) => node2.kind === FOLDER).sort(sortUiNodesByName);
3712
3719
  const fileNodes = node.children.filter((node2) => node2.kind === FILE).sort(sortUiNodesByName);
3720
+ const folderCallbacks = {
3721
+ onSelectNode: (node2) => nodeProps.onSelectNode(node2),
3722
+ onRenameNode: (name, node2) => nodeProps.onRenameNode(name, node2),
3723
+ onDuplicateNode: (node2) => nodeProps.onDuplicateNode(node2),
3724
+ onDeleteNode: (node2) => nodeProps.onDeleteNode(node2)
3725
+ };
3726
+ const fileCallbacks = {
3727
+ onSelectNode: (node2) => nodeProps.onSelectNode(node2),
3728
+ onRenameNode: (name, node2) => nodeProps.onRenameNode(name, node2),
3729
+ onDuplicateNode: (node2) => nodeProps.onDuplicateNode(node2),
3730
+ onDeleteNode: (node2) => nodeProps.onDeleteNode(node2)
3731
+ };
3732
+ const baseNodeCallbacks = {
3733
+ onAddFile: async (file, parentNode) => {
3734
+ await nodeProps.onAddFile(file, parentNode);
3735
+ },
3736
+ onCopyNode: async (uiNode, targetNode) => {
3737
+ await nodeProps.onCopyNode(uiNode, targetNode);
3738
+ },
3739
+ onMoveNode: async (uiNode, targetNode) => {
3740
+ await nodeProps.onMoveNode(uiNode, targetNode);
3741
+ }
3742
+ };
3713
3743
  return jsxs("div", { className: twMerge("rounded-md border-2 border-transparent p-2", isDropTarget && "border-dashed border-blue-100", className), ...containerProps, children: [jsx(DriveLayout.ContentSection, { title: t("folderView.sections.folders.title", {
3714
3744
  defaultValue: "Folders"
3715
- }), className: "mb-4", children: folderNodes.length > 0 ? folderNodes.map((folderNode) => jsx(FolderItem, { uiNode: folderNode, onAddFile: nodeProps.onAddFile, onCopyNode: nodeProps.onCopyNode, onMoveNode: nodeProps.onMoveNode, onSelectNode: nodeProps.onSelectNode, onRenameNode: nodeProps.onRenameNode, onDuplicateNode: nodeProps.onDuplicateNode, onDeleteNode: nodeProps.onDeleteNode, isAllowedToCreateDocuments: nodeProps.isAllowedToCreateDocuments }, folderNode.id)) : jsx("div", { className: "mb-8 text-sm text-gray-400", children: t("folderView.sections.folders.empty", {
3745
+ }), className: "mb-4", children: folderNodes.length > 0 ? folderNodes.map((folderNode) => jsx(FolderItem, { uiNode: folderNode, ...baseNodeCallbacks, ...folderCallbacks, isAllowedToCreateDocuments: nodeProps.isAllowedToCreateDocuments }, folderNode.id)) : jsx("div", { className: "mb-8 text-sm text-gray-400", children: t("folderView.sections.folders.empty", {
3716
3746
  defaultValue: "No documents or files 📄"
3717
3747
  }) }) }), jsx(DriveLayout.ContentSection, { title: t("folderView.sections.documents.title", {
3718
3748
  defaultValue: "Documents and files"
3719
- }), children: jsx("div", { className: twMerge("w-full", fileNodes.length > 0 ? "min-h-[400px]" : "min-h-14"), children: jsx(FileContentView, { fileNodes, onSelectNode: nodeProps.onSelectNode, onRenameNode: nodeProps.onRenameNode, onDuplicateNode: nodeProps.onDuplicateNode, onDeleteNode: nodeProps.onDeleteNode, isAllowedToCreateDocuments: nodeProps.isAllowedToCreateDocuments }) }) })] });
3749
+ }), children: jsx("div", { className: twMerge("w-full", fileNodes.length > 0 ? "min-h-[400px]" : "min-h-14"), children: jsx(FileContentView, { fileNodes, ...fileCallbacks, isAllowedToCreateDocuments: nodeProps.isAllowedToCreateDocuments }) }) })] });
3720
3750
  }
3721
3751
  function Editor(props) {
3722
3752
  const { document: document2, dispatch, className, children } = props;