@fileverse-dev/dsheet 4.1.1-edit-mode-15 → 4.1.1-edit-mode-16

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.
@@ -1,5 +1,5 @@
1
- import { E as a, S as n } from "./crypto-constants-ZTlAYRUf.js";
2
- const E = a, d = n, f = [
1
+ import { E as l, S as u } from "./crypto-constants-ZTlAYRUf.js";
2
+ const h = l, S = u, _ = [
3
3
  {
4
4
  id: "0",
5
5
  name: "Sheet1",
@@ -7,7 +7,7 @@ const E = a, d = n, f = [
7
7
  config: {},
8
8
  order: 0
9
9
  }
10
- ], m = [
10
+ ], g = [
11
11
  "undo",
12
12
  "redo",
13
13
  "format-painter",
@@ -45,7 +45,7 @@ const E = a, d = n, f = [
45
45
  "quick-formula",
46
46
  "dataVerification",
47
47
  "search"
48
- ], u = [
48
+ ], p = [
49
49
  "cut",
50
50
  "copy",
51
51
  "paste",
@@ -82,7 +82,7 @@ const E = a, d = n, f = [
82
82
  "freeze-row",
83
83
  "|",
84
84
  "clear-format"
85
- ], S = [
85
+ ], C = [
86
86
  "cut",
87
87
  "copy",
88
88
  "paste",
@@ -119,14 +119,14 @@ const E = a, d = n, f = [
119
119
  "freeze-column",
120
120
  "|",
121
121
  "clear-format"
122
- ], _ = {
122
+ ], w = {
123
123
  height: null,
124
124
  isShow: !1,
125
125
  left: null,
126
126
  top: null,
127
127
  value: "",
128
128
  width: null
129
- }, l = "#5298FF", r = [
129
+ }, a = "#9CA3AF", s = [
130
130
  "#30bced",
131
131
  "#6eeb83",
132
132
  "#fa69d1",
@@ -136,24 +136,81 @@ const E = a, d = n, f = [
136
136
  "#0ad7f2",
137
137
  "#1bff39"
138
138
  ];
139
- function c(e) {
140
- return r[e % r.length];
139
+ function A(o) {
140
+ const t = /* @__PURE__ */ new Map();
141
+ return o.forEach((r) => {
142
+ const i = r == null ? void 0 : r.socketId, e = r == null ? void 0 : r.user;
143
+ typeof i == "string" && e && t.set(i, {
144
+ name: e.name ?? "",
145
+ color: e.color ?? a,
146
+ isEns: e.isEns ?? ""
147
+ });
148
+ }), t;
141
149
  }
142
- function i() {
150
+ function L(o, t) {
151
+ const r = o.map((e) => {
152
+ const n = t.get(e);
153
+ return n ? {
154
+ clientId: e,
155
+ name: n.name,
156
+ color: n.color,
157
+ isEns: n.isEns,
158
+ isPlaceholder: !1
159
+ } : {
160
+ clientId: e,
161
+ name: "",
162
+ color: a,
163
+ isEns: "",
164
+ isPlaceholder: !0
165
+ };
166
+ });
167
+ r.sort((e, n) => !!e.isPlaceholder != !!n.isPlaceholder ? e.isPlaceholder ? 1 : -1 : String(e.clientId).localeCompare(String(n.clientId)));
168
+ const i = /* @__PURE__ */ new Set();
169
+ return r.filter((e) => e.isPlaceholder || !e.name ? !0 : i.has(e.name) ? !1 : (i.add(e.name), !0));
170
+ }
171
+ function R(o, t) {
172
+ const r = new Set(
173
+ o.filter(({ isPlaceholder: e, name: n }) => !e && n).map(({ name: e }) => e)
174
+ );
175
+ t.forEach((e, n) => {
176
+ r.has(n) || t.delete(n);
177
+ });
178
+ const i = /* @__PURE__ */ new Set();
179
+ return o.forEach((e) => {
180
+ if (e.isPlaceholder || !e.name) return;
181
+ let n = t.get(e.name);
182
+ (!n || i.has(n)) && (n = s.find((c) => !i.has(c)) ?? n ?? s[t.size % s.length], t.set(e.name, n)), i.add(n), e.color = n;
183
+ }), o;
184
+ }
185
+ function O(o, t) {
186
+ return o.slice().sort().map((r) => {
187
+ const i = t.get(r);
188
+ return i ? `${r}:${i.name}:${i.isEns}` : `${r}:?`;
189
+ }).join("|");
190
+ }
191
+ const d = "#5298FF";
192
+ function f(o) {
193
+ return s[o % s.length];
194
+ }
195
+ function E() {
143
196
  return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
144
197
  }
145
- function h(e, o, t) {
146
- return e ? l : o ?? (t != null ? c(t) : i());
198
+ function P(o, t, r) {
199
+ return t || (o ? d : r != null ? f(r) : E());
147
200
  }
148
201
  export {
149
- _ as C,
150
- f as D,
151
- E,
152
- S as H,
153
- d as S,
154
- m as T,
155
- r as a,
156
- u as b,
157
- l as c,
158
- h as p
202
+ w as C,
203
+ _ as D,
204
+ h as E,
205
+ C as H,
206
+ S,
207
+ g as T,
208
+ R as a,
209
+ A as b,
210
+ s as c,
211
+ p as d,
212
+ d as e,
213
+ O as i,
214
+ L as m,
215
+ P as p
159
216
  };
@@ -1,5 +1,5 @@
1
1
  export { ERROR_MESSAGES_FLAG, SERVICES_API_KEY, } from './editor/constants/shared-constants';
2
+ export { COLLAB_PRESENCE_COLORS } from './sync-local/presence';
2
3
  export declare const ENS_PRESENCE_COLOR = "#5298FF";
3
- export declare const COLLAB_PRESENCE_COLORS: readonly ["#30bced", "#6eeb83", "#fa69d1", "#ecd444", "#ee6352", "#db3041", "#0ad7f2", "#1bff39"];
4
- /** ENS brand color, else `color`, else palette by `clientId`, else random. */
4
+ /** Explicit awareness color, else ENS brand color, palette, or random fallback. */
5
5
  export declare function presenceColor(isEns: boolean | undefined, color?: string, clientId?: number): string;
package/dist/constants.js CHANGED
@@ -1,8 +1,8 @@
1
- import { a as R, c as _, E as C, S as a, p as s } from "./constants-CRFfbkoQ.js";
1
+ import { c as R, e as _, E as C, S as s, p as O } from "./constants-B3rfAvvz.js";
2
2
  export {
3
3
  R as COLLAB_PRESENCE_COLORS,
4
4
  _ as ENS_PRESENCE_COLOR,
5
5
  C as ERROR_MESSAGES_FLAG,
6
- a as SERVICES_API_KEY,
7
- s as presenceColor
6
+ s as SERVICES_API_KEY,
7
+ O as presenceColor
8
8
  };