react-semaphor 0.1.209 → 0.1.211
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/chunks/{dashboard-controls-BNTI4r0_.js → dashboard-controls-7KpXzAWL.js} +662 -607
- package/dist/chunks/dashboard-controls-CnDq9Uh_.js +42 -0
- package/dist/chunks/{dashboard-json-BjOqpGbW.js → dashboard-json-dqey5VK0.js} +1 -1
- package/dist/chunks/{dashboard-json-kIoBtmBF.js → dashboard-json-stWvjp2O.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CO1SwHHD.js → dashboard-summary-settings-dialog-DPEe6XBC.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-BoX18wiA.js → dashboard-summary-settings-dialog-DuxhidK1.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DG4VLoJF.js → edit-dashboard-visual-CQAk_UsI.js} +3416 -3531
- package/dist/chunks/edit-dashboard-visual-D_XPr8f8.js +164 -0
- package/dist/chunks/editor-action-buttons-CH7W6KdH.js +21 -0
- package/dist/chunks/editor-action-buttons-D34_GSZu.js +404 -0
- package/dist/chunks/{index-D0TdW88i.js → index-BDS2sWhv.js} +26669 -26443
- package/dist/chunks/index-BfiIPyeS.js +1109 -0
- package/dist/chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js +1 -0
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
- package/dist/chunks/notification-bell-Cu3qDd9V.js +837 -0
- package/dist/chunks/notification-bell-hijGST9g.js +6 -0
- package/dist/chunks/{resource-management-panel-DS_WEv1x.js → resource-management-panel-BvHqslqC.js} +346 -335
- package/dist/chunks/resource-management-panel-gK3a6OEj.js +6 -0
- package/dist/chunks/{use-role-aware-display-preferences-D8j5_cnK.js → use-role-aware-display-preferences-BlR29aKQ.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-DfihB5pN.js → use-role-aware-display-preferences-a5FH9Y0k.js} +1 -1
- package/dist/chunks/{use-visual-utils-CzcVz3zB.js → use-visual-utils-B11AA2fd.js} +1 -1
- package/dist/chunks/{use-visual-utils-BfLXO_vi.js → use-visual-utils-ptPsQ3nC.js} +23 -23
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +253 -214
- package/dist/shared/index.cjs +1 -0
- package/dist/shared/index.js +6 -0
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/main.d.ts +88 -1
- package/dist/types/shared.d.ts +1762 -0
- package/package.json +6 -1
- package/dist/chunks/dashboard-controls-Dcpx9_an.js +0 -42
- package/dist/chunks/edit-dashboard-visual-B9HuGExj.js +0 -179
- package/dist/chunks/editor-action-buttons-CDTIx_Jc.js +0 -11
- package/dist/chunks/editor-action-buttons-CszdZ4Fw.js +0 -345
- package/dist/chunks/index-DSA80lEg.js +0 -1104
- package/dist/chunks/notification-bell-D2V1-ARa.js +0 -11
- package/dist/chunks/notification-bell-DFiRaeJQ.js +0 -862
- package/dist/chunks/resource-management-panel-BhiWNPcw.js +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("react"),N=n=>JSON.stringify(n,(r,e)=>!e||typeof e!="object"||Array.isArray(e)?e:Object.keys(e).sort().reduce((t,i)=>(t[i]=e[i],t),{}));function p(n,r,e=300,t=1e3,i){const[z,a]=o.useState(!1),[C,l]=o.useState(!1),m=o.useRef(null),u=o.useRef(0),D=o.useRef(n),k=o.useRef(r),f=i||N;o.useEffect(()=>{u.current+=1;const y=u.current,T=D.current!==n,I=k.current!==r;if(D.current=n,k.current=r,r===null){const s=window.setTimeout(()=>{y===u.current&&(a(!1),l(!1))},0);return()=>clearTimeout(s)}if(I&&!T){const s=window.setTimeout(()=>{if(y===u.current){const c=f(n),d=f(r);a(c!==d),l(!1)}},0);return()=>clearTimeout(s)}const g=T?window.setTimeout(()=>{y===u.current&&l(!0)},0):null,h=setTimeout(()=>{const s=window.requestIdleCallback||(c=>window.setTimeout(()=>c({didTimeout:!1,timeRemaining:()=>50}),1));m.current=s(c=>{if(c.timeRemaining()>0||c.didTimeout){if(y!==u.current)return;const d=f(n),A=f(r);a(d!==A),l(!1)}},{timeout:t})},e);return()=>{g!==null&&clearTimeout(g),clearTimeout(h),m.current!==null&&((window.cancelIdleCallback||window.clearTimeout)(m.current),m.current=null)}},[n,r,e,t,f]);const R=o.useCallback(()=>{a(!1),l(!1)},[]);return{isDirty:r===null?!1:z,isDirtyPending:r===null?!1:C,resetDirty:R}}const L=["i","x","y","w","h","minW","minH","maxW","maxH","static","isResizable","isDraggable"];function O(n,r,e){n[r]=e}function P(n){const r={};for(const e of L){const t=n[e];t!==void 0&&((e==="isResizable"||e==="isDraggable")&&t===!0||O(r,e,t))}return r}function b(n){return n?n.map(P).sort((r,e)=>{const t=String(r.i??""),i=String(e.i??"");return t!==i?t.localeCompare(i):Number(r.y??0)-Number(e.y??0)||Number(r.x??0)-Number(e.x??0)||Number(r.h??0)-Number(e.h??0)||Number(r.w??0)-Number(e.w??0)}):[]}function w(n){if(!n)return;const r={};for(const e of Object.keys(n).sort()){const t=n[e];t&&(r[e]=b(t))}return r}function j(n){var r;return n?{...n,sheets:(r=n.sheets)==null?void 0:r.map(e=>{if(!e)return e;const t={...e};return e.layout&&(t.layout=b(e.layout)),e.layouts&&(t.layouts=w(e.layouts)),t})}:null}function x(n){return JSON.stringify(n??null,function(r,e){return r==="layout"&&Array.isArray(e)?b(e):r==="layouts"&&e&&typeof e=="object"&&!Array.isArray(e)?w(e):!e||typeof e!="object"||Array.isArray(e)?e:Object.keys(e).sort().reduce((t,i)=>(t[i]=e[i],t),{})})}exports.normalizeDashboardForDirtyCheck=j;exports.serializeDashboardForDirtyCheck=x;exports.useDebouncedDirtyCheck=p;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { useState as D, useRef as y, useEffect as h, useCallback as x } from "react";
|
|
2
|
+
const L = (n) => JSON.stringify(n, (e, r) => !r || typeof r != "object" || Array.isArray(r) ? r : Object.keys(r).sort().reduce((t, i) => (t[i] = r[i], t), {}));
|
|
3
|
+
function F(n, e, r = 300, t = 1e3, i) {
|
|
4
|
+
const [C, f] = D(!1), [I, c] = D(!1), a = y(null), o = y(0), T = y(n), g = y(e), l = i || L;
|
|
5
|
+
h(() => {
|
|
6
|
+
o.current += 1;
|
|
7
|
+
const m = o.current, w = T.current !== n, N = g.current !== e;
|
|
8
|
+
if (T.current = n, g.current = e, e === null) {
|
|
9
|
+
const u = window.setTimeout(() => {
|
|
10
|
+
m === o.current && (f(!1), c(!1));
|
|
11
|
+
}, 0);
|
|
12
|
+
return () => clearTimeout(u);
|
|
13
|
+
}
|
|
14
|
+
if (N && !w) {
|
|
15
|
+
const u = window.setTimeout(() => {
|
|
16
|
+
if (m === o.current) {
|
|
17
|
+
const s = l(n), d = l(e);
|
|
18
|
+
f(s !== d), c(!1);
|
|
19
|
+
}
|
|
20
|
+
}, 0);
|
|
21
|
+
return () => clearTimeout(u);
|
|
22
|
+
}
|
|
23
|
+
const k = w ? window.setTimeout(() => {
|
|
24
|
+
m === o.current && c(!0);
|
|
25
|
+
}, 0) : null, R = setTimeout(() => {
|
|
26
|
+
const u = window.requestIdleCallback || ((s) => window.setTimeout(
|
|
27
|
+
() => s({
|
|
28
|
+
didTimeout: !1,
|
|
29
|
+
timeRemaining: () => 50
|
|
30
|
+
}),
|
|
31
|
+
1
|
|
32
|
+
));
|
|
33
|
+
a.current = u(
|
|
34
|
+
(s) => {
|
|
35
|
+
if (s.timeRemaining() > 0 || s.didTimeout) {
|
|
36
|
+
if (m !== o.current) return;
|
|
37
|
+
const d = l(n), p = l(e);
|
|
38
|
+
f(d !== p), c(!1);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{ timeout: t }
|
|
42
|
+
);
|
|
43
|
+
}, r);
|
|
44
|
+
return () => {
|
|
45
|
+
k !== null && clearTimeout(k), clearTimeout(R), a.current !== null && ((window.cancelIdleCallback || window.clearTimeout)(a.current), a.current = null);
|
|
46
|
+
};
|
|
47
|
+
}, [n, e, r, t, l]);
|
|
48
|
+
const A = x(() => {
|
|
49
|
+
f(!1), c(!1);
|
|
50
|
+
}, []);
|
|
51
|
+
return {
|
|
52
|
+
isDirty: e === null ? !1 : C,
|
|
53
|
+
isDirtyPending: e === null ? !1 : I,
|
|
54
|
+
resetDirty: A
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const O = [
|
|
58
|
+
"i",
|
|
59
|
+
"x",
|
|
60
|
+
"y",
|
|
61
|
+
"w",
|
|
62
|
+
"h",
|
|
63
|
+
"minW",
|
|
64
|
+
"minH",
|
|
65
|
+
"maxW",
|
|
66
|
+
"maxH",
|
|
67
|
+
"static",
|
|
68
|
+
"isResizable",
|
|
69
|
+
"isDraggable"
|
|
70
|
+
];
|
|
71
|
+
function P(n, e, r) {
|
|
72
|
+
n[e] = r;
|
|
73
|
+
}
|
|
74
|
+
function j(n) {
|
|
75
|
+
const e = {};
|
|
76
|
+
for (const r of O) {
|
|
77
|
+
const t = n[r];
|
|
78
|
+
t !== void 0 && ((r === "isResizable" || r === "isDraggable") && t === !0 || P(e, r, t));
|
|
79
|
+
}
|
|
80
|
+
return e;
|
|
81
|
+
}
|
|
82
|
+
function b(n) {
|
|
83
|
+
return n ? n.map(j).sort((e, r) => {
|
|
84
|
+
const t = String(e.i ?? ""), i = String(r.i ?? "");
|
|
85
|
+
return t !== i ? t.localeCompare(i) : Number(e.y ?? 0) - Number(r.y ?? 0) || Number(e.x ?? 0) - Number(r.x ?? 0) || Number(e.h ?? 0) - Number(r.h ?? 0) || Number(e.w ?? 0) - Number(r.w ?? 0);
|
|
86
|
+
}) : [];
|
|
87
|
+
}
|
|
88
|
+
function z(n) {
|
|
89
|
+
if (!n) return;
|
|
90
|
+
const e = {};
|
|
91
|
+
for (const r of Object.keys(n).sort()) {
|
|
92
|
+
const t = n[r];
|
|
93
|
+
t && (e[r] = b(t));
|
|
94
|
+
}
|
|
95
|
+
return e;
|
|
96
|
+
}
|
|
97
|
+
function S(n) {
|
|
98
|
+
var e;
|
|
99
|
+
return n ? {
|
|
100
|
+
...n,
|
|
101
|
+
sheets: (e = n.sheets) == null ? void 0 : e.map((r) => {
|
|
102
|
+
if (!r) return r;
|
|
103
|
+
const t = {
|
|
104
|
+
...r
|
|
105
|
+
};
|
|
106
|
+
return r.layout && (t.layout = b(r.layout)), r.layouts && (t.layouts = z(r.layouts)), t;
|
|
107
|
+
})
|
|
108
|
+
} : null;
|
|
109
|
+
}
|
|
110
|
+
function _(n) {
|
|
111
|
+
return JSON.stringify(n ?? null, function(e, r) {
|
|
112
|
+
return e === "layout" && Array.isArray(r) ? b(r) : e === "layouts" && r && typeof r == "object" && !Array.isArray(r) ? z(r) : !r || typeof r != "object" || Array.isArray(r) ? r : Object.keys(r).sort().reduce((t, i) => (t[i] = r[i], t), {});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
S as n,
|
|
117
|
+
_ as s,
|
|
118
|
+
F as u
|
|
119
|
+
};
|