efficient-shell 4.134.0 → 4.137.1
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/LICENSE +6 -17
- package/README.md +84 -8
- package/dist/Browser-ZX5OTOKK.js +43 -0
- package/dist/Calculator-4SQGOQFQ.js +29 -0
- package/dist/ConfirmDialog-NPKW2XHM.js +1 -0
- package/dist/CurrencyConverter-2KOM7L6V.js +21 -0
- package/dist/Documents-IZTIQYPG.js +52 -0
- package/dist/Files-B63KKXGZ.js +89 -0
- package/dist/Notepad-WA77V45J.js +25 -0
- package/dist/PdfViewer-RBRGEKWF.js +1 -0
- package/dist/PomodoroTimer-SDUBKXUS.js +99 -0
- package/dist/Preview-D4KOA4OI.js +187 -0
- package/dist/Sidebar-Y57LYXXI.js +23 -0
- package/dist/Spreadsheet-JX5E6WH6.js +37 -0
- package/dist/Stock-XAQ5WMUZ.js +16 -0
- package/dist/Weather-HLAGJ5LV.js +60 -0
- package/dist/WorldClock-IRI4VCTA.js +32 -0
- package/dist/apps/index.js +1 -151
- package/dist/brand.css +1 -1
- package/dist/chunk-3A46NCXK.js +29 -0
- package/dist/chunk-44UO7FYU.js +11 -0
- package/dist/chunk-466CM2TJ.js +1 -0
- package/dist/chunk-57MIENLJ.js +1 -0
- package/dist/chunk-5CRAF2AD.js +2 -0
- package/dist/chunk-A2OQLLYK.js +6 -0
- package/dist/chunk-B43AGQET.js +4 -0
- package/dist/chunk-BR22X7E5.js +1 -0
- package/dist/chunk-BUTSU7FO.js +1 -0
- package/dist/chunk-D65T4H6J.js +1 -0
- package/dist/chunk-ESL5TDNA.js +1 -0
- package/dist/chunk-FBDZGO3V.js +1 -0
- package/dist/chunk-FHTLC7HH.js +1 -0
- package/dist/chunk-FQLMX3IE.js +948 -0
- package/dist/chunk-H562R4GX.js +34 -0
- package/dist/chunk-JN4WXTWJ.js +106 -0
- package/dist/chunk-LVDRBRYU.js +1 -0
- package/dist/chunk-LWLCNQY7.js +1 -0
- package/dist/chunk-MAIHBBWT.js +1 -0
- package/dist/chunk-NPJH5MD7.js +13 -0
- package/dist/chunk-OCSOMMY2.js +1 -0
- package/dist/chunk-OQDWLHZI.js +1 -0
- package/dist/chunk-OWSAMA3I.js +23 -0
- package/dist/chunk-PH3PRIFP.js +5 -0
- package/dist/chunk-TAWKWSPN.js +9 -0
- package/dist/chunk-U4GTZPXP.js +1 -0
- package/dist/chunk-UB4JIOLD.js +2 -0
- package/dist/chunk-UZAJ5BF6.js +9 -0
- package/dist/chunk-VEGMDXT4.js +1 -0
- package/dist/chunk-VTVSMRFX.js +1 -0
- package/dist/chunk-VVAGSKW7.js +1 -0
- package/dist/chunk-XO43FJRM.js +19 -0
- package/dist/chunk-Y7BOLDRM.js +69 -0
- package/dist/file-intake/index.js +1 -4
- package/dist/{index-DZ7E7bCl.d.ts → index-DVI9DMSu.d.ts} +189 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +639 -7473
- package/dist/map/index.js +20 -540
- package/dist/markdown/index.js +6 -184
- package/dist/markup/index.js +1 -135
- package/dist/page-tabs/index.js +21 -709
- package/dist/sounds-OMHXVVQ4.js +1 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -19
- package/dist/ui.css +78 -10
- package/package.json +4 -3
- package/dist/Browser-O3QZGUF2.js +0 -482
- package/dist/Browser-O3QZGUF2.js.map +0 -1
- package/dist/Calculator-L6N5X3KU.js +0 -192
- package/dist/Calculator-L6N5X3KU.js.map +0 -1
- package/dist/ConfirmDialog-LYSSZSUD.js +0 -4
- package/dist/ConfirmDialog-LYSSZSUD.js.map +0 -1
- package/dist/CurrencyConverter-64MKXB3D.js +0 -236
- package/dist/CurrencyConverter-64MKXB3D.js.map +0 -1
- package/dist/Documents-5WXXYCLI.js +0 -441
- package/dist/Documents-5WXXYCLI.js.map +0 -1
- package/dist/Files-AUURUUDN.js +0 -805
- package/dist/Files-AUURUUDN.js.map +0 -1
- package/dist/Notepad-GPXJVPB7.js +0 -410
- package/dist/Notepad-GPXJVPB7.js.map +0 -1
- package/dist/PdfViewer-HKO6P4SR.js +0 -5
- package/dist/PdfViewer-HKO6P4SR.js.map +0 -1
- package/dist/PomodoroTimer-4TQBWLP2.js +0 -633
- package/dist/PomodoroTimer-4TQBWLP2.js.map +0 -1
- package/dist/Preview-FOZYPKM2.js +0 -2959
- package/dist/Preview-FOZYPKM2.js.map +0 -1
- package/dist/Sidebar-BPU7RCZP.js +0 -291
- package/dist/Sidebar-BPU7RCZP.js.map +0 -1
- package/dist/Spreadsheet-3C66BBBF.js +0 -519
- package/dist/Spreadsheet-3C66BBBF.js.map +0 -1
- package/dist/Stock-IF4IHYLU.js +0 -158
- package/dist/Stock-IF4IHYLU.js.map +0 -1
- package/dist/Weather-725PFR7T.js +0 -431
- package/dist/Weather-725PFR7T.js.map +0 -1
- package/dist/WorldClock-UU4NZIQ7.js +0 -202
- package/dist/WorldClock-UU4NZIQ7.js.map +0 -1
- package/dist/apps/index.js.map +0 -1
- package/dist/chunk-2TPTHAKI.js +0 -316
- package/dist/chunk-2TPTHAKI.js.map +0 -1
- package/dist/chunk-4P44JXDS.js +0 -195
- package/dist/chunk-4P44JXDS.js.map +0 -1
- package/dist/chunk-5O42JXQE.js +0 -26
- package/dist/chunk-5O42JXQE.js.map +0 -1
- package/dist/chunk-72CQWN7O.js +0 -547
- package/dist/chunk-72CQWN7O.js.map +0 -1
- package/dist/chunk-7CCHEEYC.js +0 -94
- package/dist/chunk-7CCHEEYC.js.map +0 -1
- package/dist/chunk-BE7FZOFU.js +0 -17
- package/dist/chunk-BE7FZOFU.js.map +0 -1
- package/dist/chunk-D276EMXS.js +0 -57
- package/dist/chunk-D276EMXS.js.map +0 -1
- package/dist/chunk-D7PYW2QS.js +0 -265
- package/dist/chunk-D7PYW2QS.js.map +0 -1
- package/dist/chunk-DVZWYWSD.js +0 -26
- package/dist/chunk-DVZWYWSD.js.map +0 -1
- package/dist/chunk-ET6ID4LP.js +0 -102
- package/dist/chunk-ET6ID4LP.js.map +0 -1
- package/dist/chunk-GA35NEND.js +0 -56
- package/dist/chunk-GA35NEND.js.map +0 -1
- package/dist/chunk-GIGV2ZRW.js +0 -70
- package/dist/chunk-GIGV2ZRW.js.map +0 -1
- package/dist/chunk-IPXN646P.js +0 -14
- package/dist/chunk-IPXN646P.js.map +0 -1
- package/dist/chunk-IRWSRJ4K.js +0 -48
- package/dist/chunk-IRWSRJ4K.js.map +0 -1
- package/dist/chunk-IULP5BCD.js +0 -79
- package/dist/chunk-IULP5BCD.js.map +0 -1
- package/dist/chunk-MGGY74RY.js +0 -14
- package/dist/chunk-MGGY74RY.js.map +0 -1
- package/dist/chunk-OLJDJYSU.js +0 -13678
- package/dist/chunk-OLJDJYSU.js.map +0 -1
- package/dist/chunk-PIGDNN5F.js +0 -46
- package/dist/chunk-PIGDNN5F.js.map +0 -1
- package/dist/chunk-Q2MJVSJT.js +0 -7
- package/dist/chunk-Q2MJVSJT.js.map +0 -1
- package/dist/chunk-Q3LT745N.js +0 -3710
- package/dist/chunk-Q3LT745N.js.map +0 -1
- package/dist/chunk-QAGQRNKI.js +0 -145
- package/dist/chunk-QAGQRNKI.js.map +0 -1
- package/dist/chunk-QRL64J5F.js +0 -503
- package/dist/chunk-QRL64J5F.js.map +0 -1
- package/dist/chunk-QSKCQUZE.js +0 -1103
- package/dist/chunk-QSKCQUZE.js.map +0 -1
- package/dist/chunk-R4OQIQYX.js +0 -153
- package/dist/chunk-R4OQIQYX.js.map +0 -1
- package/dist/chunk-RT6DSB5Y.js +0 -143
- package/dist/chunk-RT6DSB5Y.js.map +0 -1
- package/dist/chunk-SHQM5CK3.js +0 -549
- package/dist/chunk-SHQM5CK3.js.map +0 -1
- package/dist/chunk-T4VQHMG4.js +0 -822
- package/dist/chunk-T4VQHMG4.js.map +0 -1
- package/dist/chunk-TRCWINHF.js +0 -105
- package/dist/chunk-TRCWINHF.js.map +0 -1
- package/dist/chunk-TW7LPMVR.js +0 -16
- package/dist/chunk-TW7LPMVR.js.map +0 -1
- package/dist/chunk-W622KQTD.js +0 -465
- package/dist/chunk-W622KQTD.js.map +0 -1
- package/dist/chunk-X4Q6G253.js +0 -416
- package/dist/chunk-X4Q6G253.js.map +0 -1
- package/dist/chunk-YNKK7NE3.js +0 -171
- package/dist/chunk-YNKK7NE3.js.map +0 -1
- package/dist/chunk-YPO6RDMX.js +0 -20
- package/dist/chunk-YPO6RDMX.js.map +0 -1
- package/dist/file-intake/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/map/index.js.map +0 -1
- package/dist/markdown/index.js.map +0 -1
- package/dist/markup/index.js.map +0 -1
- package/dist/page-tabs/index.js.map +0 -1
- package/dist/sounds-NT4DEZGD.js +0 -3
- package/dist/sounds-NT4DEZGD.js.map +0 -1
- package/dist/ui/index.js.map +0 -1
package/dist/chunk-D7PYW2QS.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
// src/utils/sounds.ts
|
|
2
|
-
var audioCtx = null;
|
|
3
|
-
function getCtx() {
|
|
4
|
-
if (!audioCtx) audioCtx = new AudioContext();
|
|
5
|
-
return audioCtx;
|
|
6
|
-
}
|
|
7
|
-
function tone(freq, dur, type = "sine", vol = 0.15) {
|
|
8
|
-
try {
|
|
9
|
-
const ctx = getCtx();
|
|
10
|
-
const osc = ctx.createOscillator();
|
|
11
|
-
const gain = ctx.createGain();
|
|
12
|
-
osc.type = type;
|
|
13
|
-
osc.frequency.value = freq;
|
|
14
|
-
gain.gain.value = vol;
|
|
15
|
-
gain.gain.exponentialRampToValueAtTime(1e-3, ctx.currentTime + dur);
|
|
16
|
-
osc.connect(gain);
|
|
17
|
-
gain.connect(ctx.destination);
|
|
18
|
-
osc.start();
|
|
19
|
-
osc.stop(ctx.currentTime + dur);
|
|
20
|
-
} catch {
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
var classic = {
|
|
24
|
-
label: "Classic",
|
|
25
|
-
success: () => {
|
|
26
|
-
tone(523, 0.1, "sine", 0.1);
|
|
27
|
-
setTimeout(() => tone(659, 0.1, "sine", 0.1), 100);
|
|
28
|
-
setTimeout(() => tone(784, 0.15, "sine", 0.1), 200);
|
|
29
|
-
},
|
|
30
|
-
error: () => {
|
|
31
|
-
tone(200, 0.15, "sawtooth", 0.08);
|
|
32
|
-
setTimeout(() => tone(180, 0.15, "sawtooth", 0.08), 150);
|
|
33
|
-
},
|
|
34
|
-
notification: () => {
|
|
35
|
-
tone(880, 0.08, "sine", 0.12);
|
|
36
|
-
setTimeout(() => tone(1100, 0.12, "sine", 0.1), 100);
|
|
37
|
-
},
|
|
38
|
-
startup: () => {
|
|
39
|
-
tone(392, 0.15, "sine", 0.08);
|
|
40
|
-
setTimeout(() => tone(523, 0.15, "sine", 0.08), 150);
|
|
41
|
-
setTimeout(() => tone(659, 0.15, "sine", 0.08), 300);
|
|
42
|
-
setTimeout(() => tone(784, 0.25, "sine", 0.1), 450);
|
|
43
|
-
},
|
|
44
|
-
logout: () => {
|
|
45
|
-
tone(784, 0.15, "sine", 0.08);
|
|
46
|
-
setTimeout(() => tone(659, 0.15, "sine", 0.08), 150);
|
|
47
|
-
setTimeout(() => tone(523, 0.15, "sine", 0.08), 300);
|
|
48
|
-
setTimeout(() => tone(392, 0.25, "sine", 0.06), 450);
|
|
49
|
-
},
|
|
50
|
-
click: () => {
|
|
51
|
-
tone(800, 0.05, "square", 0.05);
|
|
52
|
-
},
|
|
53
|
-
timerDone: () => {
|
|
54
|
-
for (let i = 0; i < 3; i++) {
|
|
55
|
-
setTimeout(() => tone(1e3, 0.15, "sine", 0.12), i * 300);
|
|
56
|
-
setTimeout(() => tone(800, 0.15, "sine", 0.1), i * 300 + 150);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var minimal = {
|
|
61
|
-
label: "Minimal",
|
|
62
|
-
success: () => {
|
|
63
|
-
tone(1200, 0.06, "sine", 0.08);
|
|
64
|
-
},
|
|
65
|
-
error: () => {
|
|
66
|
-
tone(300, 0.1, "triangle", 0.06);
|
|
67
|
-
},
|
|
68
|
-
notification: () => {
|
|
69
|
-
tone(900, 0.06, "sine", 0.08);
|
|
70
|
-
},
|
|
71
|
-
startup: () => {
|
|
72
|
-
tone(600, 0.12, "sine", 0.06);
|
|
73
|
-
setTimeout(() => tone(900, 0.15, "sine", 0.06), 120);
|
|
74
|
-
},
|
|
75
|
-
click: () => {
|
|
76
|
-
tone(1e3, 0.03, "sine", 0.03);
|
|
77
|
-
},
|
|
78
|
-
timerDone: () => {
|
|
79
|
-
tone(1e3, 0.2, "sine", 0.1);
|
|
80
|
-
setTimeout(() => tone(1e3, 0.2, "sine", 0.1), 400);
|
|
81
|
-
},
|
|
82
|
-
logout: () => {
|
|
83
|
-
tone(900, 0.1, "sine", 0.06);
|
|
84
|
-
setTimeout(() => tone(600, 0.15, "sine", 0.05), 120);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
var retro = {
|
|
88
|
-
label: "Retro",
|
|
89
|
-
success: () => {
|
|
90
|
-
tone(440, 0.08, "square", 0.08);
|
|
91
|
-
setTimeout(() => tone(550, 0.08, "square", 0.08), 80);
|
|
92
|
-
setTimeout(() => tone(660, 0.08, "square", 0.08), 160);
|
|
93
|
-
setTimeout(() => tone(880, 0.12, "square", 0.1), 240);
|
|
94
|
-
},
|
|
95
|
-
error: () => {
|
|
96
|
-
tone(150, 0.2, "square", 0.06);
|
|
97
|
-
setTimeout(() => tone(100, 0.3, "square", 0.06), 200);
|
|
98
|
-
},
|
|
99
|
-
notification: () => {
|
|
100
|
-
tone(660, 0.06, "square", 0.08);
|
|
101
|
-
setTimeout(() => tone(880, 0.06, "square", 0.08), 80);
|
|
102
|
-
setTimeout(() => tone(660, 0.06, "square", 0.08), 160);
|
|
103
|
-
},
|
|
104
|
-
startup: () => {
|
|
105
|
-
[262, 330, 392, 523].forEach((f, i) => setTimeout(() => tone(f, 0.1, "square", 0.07), i * 100));
|
|
106
|
-
},
|
|
107
|
-
click: () => {
|
|
108
|
-
tone(600, 0.03, "square", 0.06);
|
|
109
|
-
},
|
|
110
|
-
timerDone: () => {
|
|
111
|
-
for (let i = 0; i < 4; i++) setTimeout(() => tone(880, 0.1, "square", 0.1), i * 200);
|
|
112
|
-
},
|
|
113
|
-
logout: () => {
|
|
114
|
-
[523, 392, 330, 262].forEach((f, i) => setTimeout(() => tone(f, 0.1, "square", 0.07), i * 100));
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
var soft = {
|
|
118
|
-
label: "Soft",
|
|
119
|
-
success: () => {
|
|
120
|
-
tone(700, 0.2, "sine", 0.06);
|
|
121
|
-
setTimeout(() => tone(900, 0.25, "sine", 0.06), 200);
|
|
122
|
-
},
|
|
123
|
-
error: () => {
|
|
124
|
-
tone(250, 0.2, "sine", 0.05);
|
|
125
|
-
},
|
|
126
|
-
notification: () => {
|
|
127
|
-
tone(600, 0.15, "triangle", 0.06);
|
|
128
|
-
setTimeout(() => tone(800, 0.2, "triangle", 0.05), 180);
|
|
129
|
-
},
|
|
130
|
-
startup: () => {
|
|
131
|
-
tone(400, 0.3, "sine", 0.05);
|
|
132
|
-
setTimeout(() => tone(500, 0.3, "sine", 0.05), 300);
|
|
133
|
-
setTimeout(() => tone(600, 0.4, "sine", 0.06), 600);
|
|
134
|
-
},
|
|
135
|
-
click: () => {
|
|
136
|
-
tone(500, 0.04, "triangle", 0.03);
|
|
137
|
-
},
|
|
138
|
-
timerDone: () => {
|
|
139
|
-
tone(700, 0.3, "triangle", 0.08);
|
|
140
|
-
setTimeout(() => tone(700, 0.3, "triangle", 0.08), 500);
|
|
141
|
-
setTimeout(() => tone(900, 0.4, "triangle", 0.08), 1e3);
|
|
142
|
-
},
|
|
143
|
-
logout: () => {
|
|
144
|
-
tone(600, 0.3, "sine", 0.05);
|
|
145
|
-
setTimeout(() => tone(400, 0.4, "sine", 0.04), 300);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
var arcade = {
|
|
149
|
-
label: "Arcade",
|
|
150
|
-
success: () => {
|
|
151
|
-
[523, 659, 784, 1047].forEach((f, i) => setTimeout(() => tone(f, 0.06, "square", 0.07), i * 60));
|
|
152
|
-
},
|
|
153
|
-
error: () => {
|
|
154
|
-
tone(100, 0.3, "sawtooth", 0.06);
|
|
155
|
-
setTimeout(() => tone(80, 0.4, "sawtooth", 0.05), 200);
|
|
156
|
-
},
|
|
157
|
-
notification: () => {
|
|
158
|
-
tone(1047, 0.05, "square", 0.08);
|
|
159
|
-
setTimeout(() => tone(784, 0.05, "square", 0.08), 60);
|
|
160
|
-
setTimeout(() => tone(1047, 0.08, "square", 0.1), 120);
|
|
161
|
-
},
|
|
162
|
-
startup: () => {
|
|
163
|
-
[262, 330, 392, 523, 659, 784].forEach((f, i) => setTimeout(() => tone(f, 0.08, "square", 0.06), i * 80));
|
|
164
|
-
},
|
|
165
|
-
click: () => {
|
|
166
|
-
tone(1200, 0.02, "square", 0.05);
|
|
167
|
-
},
|
|
168
|
-
timerDone: () => {
|
|
169
|
-
for (let i = 0; i < 5; i++) setTimeout(() => tone(1200, 0.05, "square", 0.1), i * 120);
|
|
170
|
-
},
|
|
171
|
-
logout: () => {
|
|
172
|
-
[784, 659, 523, 392, 262].forEach((f, i) => setTimeout(() => tone(f, 0.06, "square", 0.06), i * 60));
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
var silent = {
|
|
176
|
-
label: "Silent",
|
|
177
|
-
success: () => {
|
|
178
|
-
},
|
|
179
|
-
error: () => {
|
|
180
|
-
},
|
|
181
|
-
notification: () => {
|
|
182
|
-
},
|
|
183
|
-
startup: () => {
|
|
184
|
-
},
|
|
185
|
-
click: () => {
|
|
186
|
-
},
|
|
187
|
-
timerDone: () => {
|
|
188
|
-
},
|
|
189
|
-
logout: () => {
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
var SOUND_PACKS = { classic, minimal, retro, soft, arcade, silent };
|
|
193
|
-
var SOUND_PACK_KEYS = Object.keys(SOUND_PACKS);
|
|
194
|
-
var SOUND_TYPES = ["click", "success", "error", "notification", "startup", "timerDone", "logout"];
|
|
195
|
-
var SOUND_TYPE_LABELS = {
|
|
196
|
-
click: "Click",
|
|
197
|
-
success: "Success",
|
|
198
|
-
error: "Error",
|
|
199
|
-
notification: "Notification",
|
|
200
|
-
startup: "Startup",
|
|
201
|
-
timerDone: "Timer",
|
|
202
|
-
logout: "Logout"
|
|
203
|
-
};
|
|
204
|
-
var STORAGE_KEY = "erp_sound_config";
|
|
205
|
-
function soundsEnabled() {
|
|
206
|
-
return localStorage.getItem("erp_sounds") !== "false";
|
|
207
|
-
}
|
|
208
|
-
function toggleSounds() {
|
|
209
|
-
const next = !soundsEnabled();
|
|
210
|
-
localStorage.setItem("erp_sounds", String(next));
|
|
211
|
-
return next;
|
|
212
|
-
}
|
|
213
|
-
function getSoundConfig() {
|
|
214
|
-
try {
|
|
215
|
-
const stored = JSON.parse(localStorage.getItem(STORAGE_KEY) || "");
|
|
216
|
-
if (stored && typeof stored === "object") return { click: "classic", success: "classic", error: "classic", notification: "classic", startup: "classic", timerDone: "classic", logout: "classic", ...stored };
|
|
217
|
-
} catch {
|
|
218
|
-
}
|
|
219
|
-
return { click: "classic", success: "classic", error: "classic", notification: "classic", startup: "classic", timerDone: "classic", logout: "classic" };
|
|
220
|
-
}
|
|
221
|
-
function setSoundForType(soundType, packKey) {
|
|
222
|
-
const config = getSoundConfig();
|
|
223
|
-
config[soundType] = packKey;
|
|
224
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
|
|
225
|
-
}
|
|
226
|
-
function setAllSounds(packKey) {
|
|
227
|
-
const config = {};
|
|
228
|
-
SOUND_TYPES.forEach((t) => {
|
|
229
|
-
config[t] = packKey;
|
|
230
|
-
});
|
|
231
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
|
|
232
|
-
}
|
|
233
|
-
function getPackForType(soundType) {
|
|
234
|
-
const config = getSoundConfig();
|
|
235
|
-
return SOUND_PACKS[config[soundType]] || classic;
|
|
236
|
-
}
|
|
237
|
-
function playClick() {
|
|
238
|
-
if (soundsEnabled()) getPackForType("click").click();
|
|
239
|
-
}
|
|
240
|
-
function playSuccess() {
|
|
241
|
-
if (soundsEnabled()) getPackForType("success").success();
|
|
242
|
-
}
|
|
243
|
-
function playError() {
|
|
244
|
-
if (soundsEnabled()) getPackForType("error").error();
|
|
245
|
-
}
|
|
246
|
-
function playNotification() {
|
|
247
|
-
if (soundsEnabled()) getPackForType("notification").notification();
|
|
248
|
-
}
|
|
249
|
-
function playStartup() {
|
|
250
|
-
if (soundsEnabled()) getPackForType("startup").startup();
|
|
251
|
-
}
|
|
252
|
-
function playTimerDone() {
|
|
253
|
-
if (soundsEnabled()) getPackForType("timerDone").timerDone();
|
|
254
|
-
}
|
|
255
|
-
function playLogout() {
|
|
256
|
-
if (soundsEnabled()) getPackForType("logout").logout();
|
|
257
|
-
}
|
|
258
|
-
function previewSound(packKey, sound) {
|
|
259
|
-
const pack = SOUND_PACKS[packKey];
|
|
260
|
-
if (pack && typeof pack[sound] === "function") pack[sound]();
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
export { SOUND_PACKS, SOUND_PACK_KEYS, SOUND_TYPES, SOUND_TYPE_LABELS, getSoundConfig, playClick, playError, playLogout, playNotification, playStartup, playSuccess, playTimerDone, previewSound, setAllSounds, setSoundForType, soundsEnabled, toggleSounds };
|
|
264
|
-
//# sourceMappingURL=chunk-D7PYW2QS.js.map
|
|
265
|
-
//# sourceMappingURL=chunk-D7PYW2QS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/sounds.ts"],"names":[],"mappings":";AAKA,IAAI,QAAA,GAAgC,IAAA;AAEpC,SAAS,MAAA,GAAuB;AAC9B,EAAA,IAAI,CAAC,QAAA,EAAU,QAAA,GAAW,IAAI,YAAA,EAAa;AAC3C,EAAA,OAAO,QAAA;AACT;AAEA,SAAS,KAAK,IAAA,EAAc,GAAA,EAAa,IAAA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,IAAA,CAAK,KAAK,CAAA,EAAiB;AAC7E","file":"chunk-D7PYW2QS.js","sourcesContent":["/**\n * Custom sound effects using Web Audio API.\n * Multiple sound packs — user can choose in Customization > Desktop.\n */\n\nlet audioCtx: AudioContext | null = null;\n\nfunction getCtx(): AudioContext {\n if (!audioCtx) audioCtx = new AudioContext();\n return audioCtx;\n}\n\nfunction tone(freq: number, dur: number, type: OscillatorType = 'sine', vol = 0.15) {\n try {\n const ctx = getCtx();\n const osc = ctx.createOscillator();\n const gain = ctx.createGain();\n osc.type = type;\n osc.frequency.value = freq;\n gain.gain.value = vol;\n gain.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + dur);\n osc.connect(gain);\n gain.connect(ctx.destination);\n osc.start();\n osc.stop(ctx.currentTime + dur);\n } catch { /* Audio not available */ }\n}\n\nfunction delay(ms: number) { return new Promise(r => setTimeout(r, ms)); }\n\n// ── Sound Pack Definitions ──\n\ninterface SoundPack {\n label: string;\n success: () => void;\n error: () => void;\n notification: () => void;\n startup: () => void;\n click: () => void;\n timerDone: () => void;\n logout: () => void;\n}\n\nconst classic: SoundPack = {\n label: 'Classic',\n success: () => { tone(523, 0.1, 'sine', 0.1); setTimeout(() => tone(659, 0.1, 'sine', 0.1), 100); setTimeout(() => tone(784, 0.15, 'sine', 0.1), 200); },\n error: () => { tone(200, 0.15, 'sawtooth', 0.08); setTimeout(() => tone(180, 0.15, 'sawtooth', 0.08), 150); },\n notification: () => { tone(880, 0.08, 'sine', 0.12); setTimeout(() => tone(1100, 0.12, 'sine', 0.1), 100); },\n startup: () => { tone(392, 0.15, 'sine', 0.08); setTimeout(() => tone(523, 0.15, 'sine', 0.08), 150); setTimeout(() => tone(659, 0.15, 'sine', 0.08), 300); setTimeout(() => tone(784, 0.25, 'sine', 0.1), 450); },\n logout: () => { tone(784, 0.15, 'sine', 0.08); setTimeout(() => tone(659, 0.15, 'sine', 0.08), 150); setTimeout(() => tone(523, 0.15, 'sine', 0.08), 300); setTimeout(() => tone(392, 0.25, 'sine', 0.06), 450); },\n click: () => { tone(800, 0.05, 'square', 0.05); },\n timerDone: () => { for (let i = 0; i < 3; i++) { setTimeout(() => tone(1000, 0.15, 'sine', 0.12), i * 300); setTimeout(() => tone(800, 0.15, 'sine', 0.1), i * 300 + 150); } },\n};\n\nconst minimal: SoundPack = {\n label: 'Minimal',\n success: () => { tone(1200, 0.06, 'sine', 0.08); },\n error: () => { tone(300, 0.1, 'triangle', 0.06); },\n notification: () => { tone(900, 0.06, 'sine', 0.08); },\n startup: () => { tone(600, 0.12, 'sine', 0.06); setTimeout(() => tone(900, 0.15, 'sine', 0.06), 120); },\n click: () => { tone(1000, 0.03, 'sine', 0.03); },\n timerDone: () => { tone(1000, 0.2, 'sine', 0.1); setTimeout(() => tone(1000, 0.2, 'sine', 0.1), 400); },\n logout: () => { tone(900, 0.1, 'sine', 0.06); setTimeout(() => tone(600, 0.15, 'sine', 0.05), 120); },\n};\n\nconst retro: SoundPack = {\n label: 'Retro',\n success: () => { tone(440, 0.08, 'square', 0.08); setTimeout(() => tone(550, 0.08, 'square', 0.08), 80); setTimeout(() => tone(660, 0.08, 'square', 0.08), 160); setTimeout(() => tone(880, 0.12, 'square', 0.1), 240); },\n error: () => { tone(150, 0.2, 'square', 0.06); setTimeout(() => tone(100, 0.3, 'square', 0.06), 200); },\n notification: () => { tone(660, 0.06, 'square', 0.08); setTimeout(() => tone(880, 0.06, 'square', 0.08), 80); setTimeout(() => tone(660, 0.06, 'square', 0.08), 160); },\n startup: () => { [262, 330, 392, 523].forEach((f, i) => setTimeout(() => tone(f, 0.1, 'square', 0.07), i * 100)); },\n click: () => { tone(600, 0.03, 'square', 0.06); },\n timerDone: () => { for (let i = 0; i < 4; i++) setTimeout(() => tone(880, 0.1, 'square', 0.1), i * 200); },\n logout: () => { [523, 392, 330, 262].forEach((f, i) => setTimeout(() => tone(f, 0.1, 'square', 0.07), i * 100)); },\n};\n\nconst soft: SoundPack = {\n label: 'Soft',\n success: () => { tone(700, 0.2, 'sine', 0.06); setTimeout(() => tone(900, 0.25, 'sine', 0.06), 200); },\n error: () => { tone(250, 0.2, 'sine', 0.05); },\n notification: () => { tone(600, 0.15, 'triangle', 0.06); setTimeout(() => tone(800, 0.2, 'triangle', 0.05), 180); },\n startup: () => { tone(400, 0.3, 'sine', 0.05); setTimeout(() => tone(500, 0.3, 'sine', 0.05), 300); setTimeout(() => tone(600, 0.4, 'sine', 0.06), 600); },\n click: () => { tone(500, 0.04, 'triangle', 0.03); },\n timerDone: () => { tone(700, 0.3, 'triangle', 0.08); setTimeout(() => tone(700, 0.3, 'triangle', 0.08), 500); setTimeout(() => tone(900, 0.4, 'triangle', 0.08), 1000); },\n logout: () => { tone(600, 0.3, 'sine', 0.05); setTimeout(() => tone(400, 0.4, 'sine', 0.04), 300); },\n};\n\nconst arcade: SoundPack = {\n label: 'Arcade',\n success: () => { [523, 659, 784, 1047].forEach((f, i) => setTimeout(() => tone(f, 0.06, 'square', 0.07), i * 60)); },\n error: () => { tone(100, 0.3, 'sawtooth', 0.06); setTimeout(() => tone(80, 0.4, 'sawtooth', 0.05), 200); },\n notification: () => { tone(1047, 0.05, 'square', 0.08); setTimeout(() => tone(784, 0.05, 'square', 0.08), 60); setTimeout(() => tone(1047, 0.08, 'square', 0.1), 120); },\n startup: () => { [262, 330, 392, 523, 659, 784].forEach((f, i) => setTimeout(() => tone(f, 0.08, 'square', 0.06), i * 80)); },\n click: () => { tone(1200, 0.02, 'square', 0.05); },\n timerDone: () => { for (let i = 0; i < 5; i++) setTimeout(() => tone(1200, 0.05, 'square', 0.1), i * 120); },\n logout: () => { [784, 659, 523, 392, 262].forEach((f, i) => setTimeout(() => tone(f, 0.06, 'square', 0.06), i * 60)); },\n};\n\nconst silent: SoundPack = {\n label: 'Silent',\n success: () => {}, error: () => {}, notification: () => {},\n startup: () => {}, click: () => {}, timerDone: () => {}, logout: () => {},\n};\n\nexport const SOUND_PACKS: Record<string, SoundPack> = { classic, minimal, retro, soft, arcade, silent };\n\n/** All pack keys including silent */\nexport const SOUND_PACK_KEYS = Object.keys(SOUND_PACKS) as string[];\n\n// ── Sound types ──\nexport const SOUND_TYPES = ['click', 'success', 'error', 'notification', 'startup', 'timerDone', 'logout'] as const;\nexport type SoundType = typeof SOUND_TYPES[number];\n\nexport const SOUND_TYPE_LABELS: Record<SoundType, string> = {\n click: 'Click', success: 'Success', error: 'Error',\n notification: 'Notification', startup: 'Startup', timerDone: 'Timer', logout: 'Logout',\n};\n\n// ── State: per-sound pack selection ──\n\nconst STORAGE_KEY = 'erp_sound_config';\n\nexport function soundsEnabled(): boolean {\n return localStorage.getItem('erp_sounds') !== 'false';\n}\n\nexport function toggleSounds(): boolean {\n const next = !soundsEnabled();\n localStorage.setItem('erp_sounds', String(next));\n return next;\n}\n\n/** Get the per-sound configuration: { click: 'classic', success: 'retro', ... } */\nexport function getSoundConfig(): Record<SoundType, string> {\n try {\n const stored = JSON.parse(localStorage.getItem(STORAGE_KEY) || '');\n if (stored && typeof stored === 'object') return { click: 'classic', success: 'classic', error: 'classic', notification: 'classic', startup: 'classic', timerDone: 'classic', logout: 'classic', ...stored };\n } catch {}\n return { click: 'classic', success: 'classic', error: 'classic', notification: 'classic', startup: 'classic', timerDone: 'classic', logout: 'classic' };\n}\n\n/** Set the pack for a specific sound type */\nexport function setSoundForType(soundType: SoundType, packKey: string) {\n const config = getSoundConfig();\n config[soundType] = packKey;\n localStorage.setItem(STORAGE_KEY, JSON.stringify(config));\n}\n\n/** Set all sounds to a specific pack */\nexport function setAllSounds(packKey: string) {\n const config: Record<string, string> = {};\n SOUND_TYPES.forEach(t => { config[t] = packKey; });\n localStorage.setItem(STORAGE_KEY, JSON.stringify(config));\n}\n\nfunction getPackForType(soundType: SoundType): SoundPack {\n const config = getSoundConfig();\n return SOUND_PACKS[config[soundType]] || classic;\n}\n\n// ── Public API ──\n\nexport function playClick() { if (soundsEnabled()) getPackForType('click').click(); }\nexport function playSuccess() { if (soundsEnabled()) getPackForType('success').success(); }\nexport function playError() { if (soundsEnabled()) getPackForType('error').error(); }\nexport function playNotification() { if (soundsEnabled()) getPackForType('notification').notification(); }\nexport function playStartup() { if (soundsEnabled()) getPackForType('startup').startup(); }\nexport function playTimerDone() { if (soundsEnabled()) getPackForType('timerDone').timerDone(); }\nexport function playLogout() { if (soundsEnabled()) getPackForType('logout').logout(); }\n\n/** Preview a specific sound from a specific pack (ignores enabled state) */\nexport function previewSound(packKey: string, sound: SoundType) {\n const pack = SOUND_PACKS[packKey];\n if (pack && typeof pack[sound] === 'function') (pack[sound] as () => void)();\n}\n"]}
|
package/dist/chunk-DVZWYWSD.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/apps/_previewStage.ts
|
|
2
|
-
var PDF_PREVIEW_UPDATE_EVENT = "react-os-shell:pdf-preview-update";
|
|
3
|
-
var pending = null;
|
|
4
|
-
var nextToken = 0;
|
|
5
|
-
function setPdfPreview(data) {
|
|
6
|
-
const token = ++nextToken;
|
|
7
|
-
const stage = { token, data };
|
|
8
|
-
pending = stage;
|
|
9
|
-
return {
|
|
10
|
-
update(next) {
|
|
11
|
-
if (pending === stage) stage.data = next;
|
|
12
|
-
if (typeof window === "undefined") return;
|
|
13
|
-
window.dispatchEvent(new CustomEvent(PDF_PREVIEW_UPDATE_EVENT, { detail: { token, data: next } }));
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function peekPdfPreviewStage() {
|
|
18
|
-
return pending;
|
|
19
|
-
}
|
|
20
|
-
function claimPdfPreviewStage(stage) {
|
|
21
|
-
if (pending === stage) pending = null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { PDF_PREVIEW_UPDATE_EVENT, claimPdfPreviewStage, peekPdfPreviewStage, setPdfPreview };
|
|
25
|
-
//# sourceMappingURL=chunk-DVZWYWSD.js.map
|
|
26
|
-
//# sourceMappingURL=chunk-DVZWYWSD.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/_previewStage.ts"],"names":[],"mappings":";AA+CO,IAAM,wBAAA,GAA2B;AAaxC,IAAI,OAAA,GAAkC,IAAA;AACtC,IAAI,SAAA,GAAY,CAAA;AAKT,SAAS,cAAc,IAAA,EAAwC;AACpE,EAAA,MAAM,QAAQ,EAAE,SAAA;AAChB,EAAA,MAAM,KAAA,GAAyB,EAAE,KAAA,EAAO,IAAA,EAAK;AAC7C,EAAA,OAAA,GAAU,KAAA;AACV,EAAA,OAAO;AAAA,IACL,OAAO,IAAA,EAAsB;AAY3B,MAAA,IAAI,OAAA,KAAY,KAAA,EAAO,KAAA,CAAM,IAAA,GAAO,IAAA;AACpC,MAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,MAAA,MAAA,CAAO,aAAA,CAAc,IAAI,WAAA,CAAY,wBAAA,EAA0B,EAAE,MAAA,EAAQ,EAAE,KAAA,EAAO,IAAA,EAAM,IAAA,EAAK,EAAG,CAAC,CAAA;AAAA,IACnG;AAAA,GACF;AACF;AAGO,SAAS,mBAAA,GAA8C;AAC5D,EAAA,OAAO,OAAA;AACT;AAKO,SAAS,qBAAqB,KAAA,EAA8B;AACjE,EAAA,IAAI,OAAA,KAAY,OAAO,OAAA,GAAU,IAAA;AACnC","file":"chunk-DVZWYWSD.js","sourcesContent":["/**\n * PDF Preview staging — the tiny consumer-facing surface of the Preview app.\n *\n * Lives apart from Preview.tsx so importing `setPdfPreview` (from\n * `efficient-shell/apps` or shell internals like PdfActionButton /\n * openPreviewFile) never drags the viewer implementation — and its static\n * pdfjs-dist import — into a host's startup bundle. The Preview window\n * component stays behind its React.lazy dynamic import and drains the stage\n * on mount via the @internal peek/claim helpers below.\n */\n\nexport interface PdfPreviewData {\n /** Object URL or remote URL of the PDF. Blob URLs are revoked when the window unmounts.\n * Leave blank when staging a `converting: true` placeholder; call `handle.update({...})`\n * on the handle returned by `setPdfPreview` once conversion finishes. */\n url?: string;\n /** Display name (and download filename). */\n filename: string;\n /** Renderer to use. Defaults to `'pdf'`. `'dxf'` requires the consumer to\n * have `dxf-viewer` installed (it's an optional peer dep). `'image'`\n * renders an `<img>` for raster screenshots / photos. `'3d'` covers\n * STEP / STL / OBJ / GLTF / 3MF / IGES via the optional\n * `online-3d-viewer` peer dep. */\n kind?: 'pdf' | 'dxf' | 'image' | '3d';\n /** Optional download handler — replaces the built-in \"save URL as filename\" if supplied. */\n onDownload?: () => void;\n /** Optional email handler — only shown when supplied. */\n onEmail?: () => void;\n /** Show a progress placeholder while the consumer fetches/converts the file. */\n converting?: boolean;\n /** Headline shown on the converting placeholder (e.g. \"CONVERTING DWG FILE\"). */\n convertingMessage?: string;\n}\n\n/** Handle returned by `setPdfPreview`. Holds the identity of the staged\n * payload so a later `.update()` only targets the window that picked it up\n * (not every open Preview, which would clobber unrelated windows). */\nexport interface PdfPreviewHandle {\n /** Replace the data shown in the window that consumed this staging. Safe to\n * call before that window exists — an update that lands while the payload\n * is still staged replaces the staged payload, so the window opens on the\n * resolved file instead of the placeholder it was staged with.\n * No-op only once the window that consumed the staging has been closed. */\n update(next: PdfPreviewData): void;\n}\n\n/** @internal Event carrying `.update()` payloads to the claiming window. */\nexport const PDF_PREVIEW_UPDATE_EVENT = 'react-os-shell:pdf-preview-update';\n\n/** @internal Staged payload awaiting the next Preview window mount.\n *\n * `data` is MUTABLE and deliberately so: `update()` rewrites it in place\n * while the stage is still unclaimed. Restaging a fresh object instead would\n * break the identity that `claimPdfPreviewStage` and the claimant's own\n * `consumedRef` are holding. */\nexport interface PendingPdfStage {\n token: number;\n data: PdfPreviewData;\n}\n\nlet pending: PendingPdfStage | null = null;\nlet nextToken = 0;\n\n/** Stage a PDF for the next Preview window mount. The returned handle's\n * `update()` method swaps content in *that* specific window only — use it\n * to replace a `converting: true` placeholder with the resolved file. */\nexport function setPdfPreview(data: PdfPreviewData): PdfPreviewHandle {\n const token = ++nextToken;\n const stage: PendingPdfStage = { token, data };\n pending = stage;\n return {\n update(next: PdfPreviewData) {\n // The window is opened by `openPage('/preview')` and Preview is a lazy\n // chunk, so a consumer that resolves quickly — a cached PDF, a fast\n // endpoint, a second preview in the same session — can call this before\n // any window has mounted to listen. The event is fire-and-forget, so on\n // its own it would be dropped and the window would open on the\n // placeholder and sit there for ever. Rewrite the stage as well while it\n // is still ours: whoever drains it next gets the current payload.\n //\n // `pending === stage` is exactly \"no window has claimed this yet\".\n // Claiming and binding the listener happen in the same commit (see\n // Preview.tsx), so there is no third state where both paths miss.\n if (pending === stage) stage.data = next;\n if (typeof window === 'undefined') return;\n window.dispatchEvent(new CustomEvent(PDF_PREVIEW_UPDATE_EVENT, { detail: { token, data: next } }));\n },\n };\n}\n\n/** @internal Render-phase peek — see Preview.tsx for the drain protocol. */\nexport function peekPdfPreviewStage(): PendingPdfStage | null {\n return pending;\n}\n\n/** @internal Commit-phase claim. The identity check keeps a payload staged\n * *after* the claimant's render-phase peek available for the window it\n * belongs to. */\nexport function claimPdfPreviewStage(stage: PendingPdfStage): void {\n if (pending === stage) pending = null;\n}\n"]}
|
package/dist/chunk-ET6ID4LP.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { useShellStrings } from './chunk-72CQWN7O.js';
|
|
2
|
-
import { useBrowserState } from './chunk-IRWSRJ4K.js';
|
|
3
|
-
import { useRef, useCallback, useEffect } from 'react';
|
|
4
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
var clamp = (n, lo, hi) => Math.min(Math.max(n, lo), hi);
|
|
7
|
-
function SidebarLayout({
|
|
8
|
-
sidebar,
|
|
9
|
-
sidebarTop,
|
|
10
|
-
sidebarBottom,
|
|
11
|
-
children,
|
|
12
|
-
side = "left",
|
|
13
|
-
storageKey,
|
|
14
|
-
defaultWidth = 256,
|
|
15
|
-
minWidth = 180,
|
|
16
|
-
maxWidth = 480,
|
|
17
|
-
className = "",
|
|
18
|
-
sidebarClassName = side === "right" ? "border-l border-gray-200 bg-gray-50" : "border-r border-gray-200 bg-gray-50",
|
|
19
|
-
contentClassName = "bg-white"
|
|
20
|
-
}) {
|
|
21
|
-
const sideRight = side === "right";
|
|
22
|
-
const strings = useShellStrings().sidebar;
|
|
23
|
-
const [width, setWidth] = useBrowserState(() => {
|
|
24
|
-
if (storageKey) {
|
|
25
|
-
let saved = null;
|
|
26
|
-
try {
|
|
27
|
-
saved = window.localStorage.getItem(storageKey);
|
|
28
|
-
} catch {
|
|
29
|
-
}
|
|
30
|
-
const n = saved ? parseInt(saved, 10) : NaN;
|
|
31
|
-
if (!Number.isNaN(n)) return clamp(n, minWidth, maxWidth);
|
|
32
|
-
}
|
|
33
|
-
return clamp(defaultWidth, minWidth, maxWidth);
|
|
34
|
-
}, clamp(defaultWidth, minWidth, maxWidth));
|
|
35
|
-
const dragRef = useRef(null);
|
|
36
|
-
const onMove = useCallback((e) => {
|
|
37
|
-
const d = dragRef.current;
|
|
38
|
-
if (!d) return;
|
|
39
|
-
const delta = (e.clientX - d.startX) * (sideRight ? -1 : 1);
|
|
40
|
-
setWidth(clamp(d.startWidth + delta, minWidth, maxWidth));
|
|
41
|
-
}, [minWidth, maxWidth, sideRight]);
|
|
42
|
-
const onUp = useCallback(() => {
|
|
43
|
-
dragRef.current = null;
|
|
44
|
-
window.removeEventListener("pointermove", onMove);
|
|
45
|
-
window.removeEventListener("pointerup", onUp);
|
|
46
|
-
document.body.style.removeProperty("cursor");
|
|
47
|
-
document.body.style.removeProperty("user-select");
|
|
48
|
-
}, [onMove]);
|
|
49
|
-
const startDrag = useCallback((e) => {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
dragRef.current = { startX: e.clientX, startWidth: width };
|
|
52
|
-
window.addEventListener("pointermove", onMove);
|
|
53
|
-
window.addEventListener("pointerup", onUp);
|
|
54
|
-
document.body.style.cursor = "col-resize";
|
|
55
|
-
document.body.style.userSelect = "none";
|
|
56
|
-
}, [width, onMove, onUp]);
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (!storageKey) return;
|
|
59
|
-
const id = window.setTimeout(() => {
|
|
60
|
-
try {
|
|
61
|
-
window.localStorage.setItem(storageKey, String(Math.round(width)));
|
|
62
|
-
} catch {
|
|
63
|
-
}
|
|
64
|
-
}, 200);
|
|
65
|
-
return () => window.clearTimeout(id);
|
|
66
|
-
}, [width, storageKey]);
|
|
67
|
-
useEffect(() => () => {
|
|
68
|
-
window.removeEventListener("pointermove", onMove);
|
|
69
|
-
window.removeEventListener("pointerup", onUp);
|
|
70
|
-
}, [onMove, onUp]);
|
|
71
|
-
const edge = sideRight ? "left-0" : "right-0";
|
|
72
|
-
const hasSlots = sidebarTop != null || sidebarBottom != null;
|
|
73
|
-
const sidebarPane = /* @__PURE__ */ jsxs("div", { className: "relative flex h-full shrink-0 flex-col", style: { width }, children: [
|
|
74
|
-
/* @__PURE__ */ jsxs("div", { className: `flex h-full flex-col ${hasSlots ? "overflow-hidden" : "overflow-y-auto"} ${sidebarClassName}`, children: [
|
|
75
|
-
sidebarTop != null && /* @__PURE__ */ jsx("div", { className: "shrink-0 px-2 pt-3 pb-2", children: sidebarTop }),
|
|
76
|
-
hasSlots ? /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: sidebar }) : sidebar,
|
|
77
|
-
sidebarBottom != null && /* @__PURE__ */ jsx("div", { className: "mt-auto shrink-0 border-t border-gray-200 px-2 py-3", children: sidebarBottom })
|
|
78
|
-
] }),
|
|
79
|
-
/* @__PURE__ */ jsx(
|
|
80
|
-
"div",
|
|
81
|
-
{
|
|
82
|
-
onPointerDown: startDrag,
|
|
83
|
-
onDoubleClick: () => setWidth(clamp(defaultWidth, minWidth, maxWidth)),
|
|
84
|
-
title: strings.resize,
|
|
85
|
-
className: `group/resize absolute inset-y-0 ${edge} z-10 w-2 cursor-col-resize`,
|
|
86
|
-
children: /* @__PURE__ */ jsx("div", { className: `absolute inset-y-0 ${edge} w-px bg-transparent transition-colors group-hover/resize:bg-[var(--accent-500,var(--rosh-resize-handle))]` })
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
] });
|
|
90
|
-
const contentPane = /* @__PURE__ */ jsx("div", { className: `flex min-w-0 flex-1 flex-col ${contentClassName}`, children });
|
|
91
|
-
return /* @__PURE__ */ jsx("div", { className: `flex h-full w-full overflow-hidden ${className}`, children: sideRight ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
92
|
-
contentPane,
|
|
93
|
-
sidebarPane
|
|
94
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
95
|
-
sidebarPane,
|
|
96
|
-
contentPane
|
|
97
|
-
] }) });
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export { SidebarLayout };
|
|
101
|
-
//# sourceMappingURL=chunk-ET6ID4LP.js.map
|
|
102
|
-
//# sourceMappingURL=chunk-ET6ID4LP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shell/SidebarLayout.tsx"],"names":[],"mappings":";;;;;AAyDA,IAAM,KAAA,GAAQ,CAAC,CAAA,EAAW,EAAA,EAAY,EAAA,KAAe,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,EAAE,CAAA,EAAG,EAAE,CAAA;AAElE,SAAR,aAAA,CAA+B;AAAA,EACpC,OAAA;AAAA,EACA,UAAA;AAAA,EACA,aAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA,GAAO,MAAA;AAAA,EACP,UAAA;AAAA,EACA,YAAA,GAAe,GAAA;AAAA,EACf,QAAA,GAAW,GAAA;AAAA,EACX,QAAA,GAAW,GAAA;AAAA,EACX,SAAA,GAAY,EAAA;AAAA,EACZ,gBAAA,GAAmB,IAAA,KAAS,OAAA,GACxB,qCAAA,GACA,qCAAA;AAAA,EACJ,gBAAA,GAAmB;AACrB,CAAA,EAAuB;AACrB,EAAA,MAAM,YAAY,IAAA,KAAS,OAAA;AAC3B,EAAA,MAAM,OAAA,GAAU,iBAAgB,CAAE,OAAA;AAKlC,E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,EAAA,EAAI,SAAA,EAAW,CAAA,mBAAA,EAAsB,IAAI,CAAA,0GAAA,CAAA,EAA8G;AAAA;AAAA;AAC1J,GAAA,EACF,CAAA;AAEF,EAAA,MAAM,8BACJ,GAAA,CAAC,KAAA,EAAA,EAAI,WAAW,CAAA,6BAAA,EAAgC,gBAAgB,IAC7D,QAAA,EACH,CAAA;AAGF,EAAA,2BACG,KAAA,EAAA,EAAI,SAAA,EAAW,sCAAsC,SAAS,CAAA,CAAA,EAC5D,sCACC,IAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA;AAAA,IAAA,WAAA;AAAA,IAAa;AAAA,GAAA,EAAY,oBAE5B,IAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA;AAAA,IAAA,WAAA;AAAA,IAAa;AAAA,GAAA,EAAY,CAAA,EAEhC,CAAA;AAEJ","file":"chunk-ET6ID4LP.js","sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport type { ReactNode, PointerEvent as ReactPointerEvent } from 'react';\nimport { useBrowserState } from './hydration';\nimport { useShellStrings } from './strings';\n\n/**\n * Two-pane layout with a drag-to-resize sidebar (left or right).\n *\n * Renders flush (`h-full w-full`) — pair it with a `flushBody` window so the\n * sidebar runs from just under the title bar to the very bottom with no\n * surrounding padding. The user can drag the sidebar's inner edge to resize\n * it; pass `storageKey` to persist that width across reopens, or double-click\n * the handle to reset to `defaultWidth`. Set `side=\"right\"` to put the sidebar\n * on the right (e.g. a detail-panel layout).\n *\n * @example\n * <SidebarLayout sidebar={<MyNav />} storageKey=\"todo.sidebarWidth\">\n * <MyContent />\n * </SidebarLayout>\n */\nexport interface SidebarLayoutProps {\n /** Content of the left sidebar pane. When `sidebarTop`/`sidebarBottom` are\n * set this is the scrolling middle region (the filter nav); otherwise it is\n * the whole pane. */\n sidebar: ReactNode;\n /** Optional node pinned at the TOP of the sidebar, above `sidebar`, in a\n * padded non-scrolling region (e.g. a primary \"New X\" `SidebarActionButton`).\n * The list-window convention: primary create action lives here. */\n sidebarTop?: ReactNode;\n /** Optional node pinned at the BOTTOM of the sidebar, below `sidebar`, in a\n * padded, top-bordered non-scrolling region (e.g. an \"Export CSV\" button).\n * The middle `sidebar` grows to fill, so this stays flush to the bottom. */\n sidebarBottom?: ReactNode;\n /** Content of the main pane (opposite the sidebar). */\n children: ReactNode;\n /** Which side the sidebar sits on. Default `'left'`. When `'right'`, the\n * sidebar renders on the right with the resize handle on its left edge. */\n side?: 'left' | 'right';\n /** localStorage key to persist the sidebar width across reopens. When set,\n * the last dragged width is restored on mount. Omit for session-only width. */\n storageKey?: string;\n /** Initial sidebar width in px (used when nothing is persisted). Default 256. */\n defaultWidth?: number;\n /** Minimum sidebar width in px. Default 180. */\n minWidth?: number;\n /** Maximum sidebar width in px. Default 480. */\n maxWidth?: number;\n /** Extra classes for the outer flex row. */\n className?: string;\n /** Classes for the sidebar pane (background, border, …). The pane is a flex\n * column that scrolls its own overflow. Defaults to a light-grey,\n * right-bordered sidebar. */\n sidebarClassName?: string;\n /** Classes for the main content pane. Defaults to a white background. */\n contentClassName?: string;\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(Math.max(n, lo), hi);\n\nexport default function SidebarLayout({\n sidebar,\n sidebarTop,\n sidebarBottom,\n children,\n side = 'left',\n storageKey,\n defaultWidth = 256,\n minWidth = 180,\n maxWidth = 480,\n className = '',\n sidebarClassName = side === 'right'\n ? 'border-l border-gray-200 bg-gray-50'\n : 'border-r border-gray-200 bg-gray-50',\n contentClassName = 'bg-white',\n}: SidebarLayoutProps) {\n const sideRight = side === 'right';\n const strings = useShellStrings().sidebar;\n // The saved width is the READER's, and a server has no reader: it draws\n // `defaultWidth`, hydration agrees with it, and the saved width replaces it\n // in a layout effect the moment hydration ends. A page that was never\n // server-rendered reads storage on its first render, as this always did.\n const [width, setWidth] = useBrowserState<number>(() => {\n if (storageKey) {\n let saved: string | null = null;\n // Guarded: a sandboxed frame or a locked-down profile throws on access.\n try { saved = window.localStorage.getItem(storageKey); } catch { /* treat as unsaved */ }\n const n = saved ? parseInt(saved, 10) : NaN;\n if (!Number.isNaN(n)) return clamp(n, minWidth, maxWidth);\n }\n return clamp(defaultWidth, minWidth, maxWidth);\n }, clamp(defaultWidth, minWidth, maxWidth));\n\n const dragRef = useRef<{ startX: number; startWidth: number } | null>(null);\n\n const onMove = useCallback((e: PointerEvent) => {\n const d = dragRef.current;\n if (!d) return;\n // Right-side sidebar grows as the handle is dragged left → invert the delta.\n const delta = (e.clientX - d.startX) * (sideRight ? -1 : 1);\n setWidth(clamp(d.startWidth + delta, minWidth, maxWidth));\n }, [minWidth, maxWidth, sideRight]);\n\n const onUp = useCallback(() => {\n dragRef.current = null;\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n document.body.style.removeProperty('cursor');\n document.body.style.removeProperty('user-select');\n }, [onMove]);\n\n const startDrag = useCallback((e: ReactPointerEvent<HTMLDivElement>) => {\n e.preventDefault();\n dragRef.current = { startX: e.clientX, startWidth: width };\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n document.body.style.cursor = 'col-resize';\n document.body.style.userSelect = 'none';\n }, [width, onMove, onUp]);\n\n // Persist (debounced) once the width settles.\n useEffect(() => {\n if (!storageKey) return;\n const id = window.setTimeout(() => {\n try { window.localStorage.setItem(storageKey, String(Math.round(width))); } catch { /* ignore quota / privacy mode */ }\n }, 200);\n return () => window.clearTimeout(id);\n }, [width, storageKey]);\n\n // Drop listeners if we unmount mid-drag.\n useEffect(() => () => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n }, [onMove, onUp]);\n\n const edge = sideRight ? 'left-0' : 'right-0';\n // With a top/bottom slot the pane becomes a 3-region flex column: a padded\n // pinned header, the scrolling middle (`sidebar`, grows to fill), and a\n // padded, top-bordered pinned footer. Without slots it renders exactly as\n // before (the whole pane scrolls) so existing consumers are unaffected.\n const hasSlots = sidebarTop != null || sidebarBottom != null;\n const sidebarPane = (\n <div className=\"relative flex h-full shrink-0 flex-col\" style={{ width }}>\n <div className={`flex h-full flex-col ${hasSlots ? 'overflow-hidden' : 'overflow-y-auto'} ${sidebarClassName}`}>\n {sidebarTop != null && (\n <div className=\"shrink-0 px-2 pt-3 pb-2\">{sidebarTop}</div>\n )}\n {hasSlots ? (\n <div className=\"min-h-0 flex-1 overflow-y-auto\">{sidebar}</div>\n ) : (\n sidebar\n )}\n {sidebarBottom != null && (\n <div className=\"mt-auto shrink-0 border-t border-gray-200 px-2 py-3\">{sidebarBottom}</div>\n )}\n </div>\n {/* Resize handle — pinned to the sidebar's inner edge, fixed while it scrolls. */}\n <div\n onPointerDown={startDrag}\n onDoubleClick={() => setWidth(clamp(defaultWidth, minWidth, maxWidth))}\n title={strings.resize}\n className={`group/resize absolute inset-y-0 ${edge} z-10 w-2 cursor-col-resize`}\n >\n <div className={`absolute inset-y-0 ${edge} w-px bg-transparent transition-colors group-hover/resize:bg-[var(--accent-500,var(--rosh-resize-handle))]`} />\n </div>\n </div>\n );\n const contentPane = (\n <div className={`flex min-w-0 flex-1 flex-col ${contentClassName}`}>\n {children}\n </div>\n );\n\n return (\n <div className={`flex h-full w-full overflow-hidden ${className}`}>\n {sideRight ? (\n <>{contentPane}{sidebarPane}</>\n ) : (\n <>{sidebarPane}{contentPane}</>\n )}\n </div>\n );\n}\n"]}
|
package/dist/chunk-GA35NEND.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
// src/shell/nav-types.ts
|
|
5
|
-
function isSection(item) {
|
|
6
|
-
return "items" in item;
|
|
7
|
-
}
|
|
8
|
-
function navVisible(entry, hasAnyPerm) {
|
|
9
|
-
if (entry.perms?.length && !hasAnyPerm(entry.perms)) return false;
|
|
10
|
-
if (entry.allPerms?.length && !entry.allPerms.every((p) => hasAnyPerm([p]))) return false;
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
function visibleChildren(item, hasAnyPerm) {
|
|
14
|
-
return (item.children ?? []).filter((c) => navVisible(c, hasAnyPerm));
|
|
15
|
-
}
|
|
16
|
-
function isReachable(item, hasAnyPerm) {
|
|
17
|
-
if (!item.children?.length) return true;
|
|
18
|
-
return visibleChildren(item, hasAnyPerm).some((child) => isReachable(child, hasAnyPerm));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/shell-config/nav.tsx
|
|
22
|
-
var _navIcons = {};
|
|
23
|
-
var navIcons = new Proxy(_navIcons, {
|
|
24
|
-
get(_t, k) {
|
|
25
|
-
return _navIcons[k];
|
|
26
|
-
},
|
|
27
|
-
has(_t, k) {
|
|
28
|
-
return k in _navIcons;
|
|
29
|
-
},
|
|
30
|
-
ownKeys() {
|
|
31
|
-
return Object.keys(_navIcons);
|
|
32
|
-
},
|
|
33
|
-
getOwnPropertyDescriptor(_t, k) {
|
|
34
|
-
if (k in _navIcons) return { configurable: true, enumerable: true, value: _navIcons[k] };
|
|
35
|
-
return void 0;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
function setShellNavIcons(icons) {
|
|
39
|
-
for (const k of Object.keys(_navIcons)) delete _navIcons[k];
|
|
40
|
-
Object.assign(_navIcons, icons);
|
|
41
|
-
}
|
|
42
|
-
var sectionIcons = {};
|
|
43
|
-
var navSections = [];
|
|
44
|
-
var startMenuCategories = { erp: [], system: [], virtual: [], footer: [] };
|
|
45
|
-
var DEFAULT = { hasAnyPerm: () => true };
|
|
46
|
-
var ShellAuthContext = createContext(DEFAULT);
|
|
47
|
-
function ShellAuthProvider({ value, children }) {
|
|
48
|
-
return /* @__PURE__ */ jsx(ShellAuthContext.Provider, { value, children });
|
|
49
|
-
}
|
|
50
|
-
function useShellAuth() {
|
|
51
|
-
return useContext(ShellAuthContext);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { ShellAuthProvider, isReachable, isSection, navIcons, navSections, navVisible, sectionIcons, setShellNavIcons, startMenuCategories, useShellAuth, visibleChildren };
|
|
55
|
-
//# sourceMappingURL=chunk-GA35NEND.js.map
|
|
56
|
-
//# sourceMappingURL=chunk-GA35NEND.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shell/nav-types.ts","../src/shell-config/nav.tsx","../src/shell/ShellAuth.tsx"],"names":[],"mappings":";;;;AA6EO,SAAS,UAAU,IAAA,EAAgD;AACxE,EAAA,OAAO,OAAA,IAAW,IAAA;AACpB;AAoBO,SAAS,UAAA,CACd,OACA,UAAA,EACS;AACT,EAAA,IAAI,KAAA,CAAM,OAAO,MAAA,IAAU,CAAC,WAAW,KAAA,CAAM,KAAK,GAAG,OAAO,KAAA;AAC5D,EAAA,IAAI,KAAA,CAAM,QAAA,EAAU,MAAA,IAAU,CAAC,MAAM,QAAA,CAAS,KAAA,CAAM,CAAA,CAAA,KAAK,UAAA,CAAW,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,KAAA;AAClF,EAAA,OAAO,IAAA;AACT;AAWO,SAAS,eAAA,CAAgB,MAAe,UAAA,EAAmC;AAChF,EAAA,OAAA,CAAQ,IAAA,CAAK,YAAY,EAAC,EAAG,OAAO,CAAA,CAAA,KAAK,UAAA,CAAW,CAAA,EAAG,UAAU,CAAC,CAAA;AACpE;AAcO,SAAS,WAAA,CAAY,MAAe,UAAA,EAAiC;AAC1E,EAAA,IAAI,CAAC,IAAA,CAAK,QAAA,EAAU,MAAA,EAAQ,OAAO,IAAA;AACnC,EAAA,OAAO,eAAA,CAAgB,MAAM,UAAU,CAAA,CAAE,KAAK,CAAA,KAAA,KAAS,WAAA,CAAY,KAAA,EAAO,UAAU,CAAC,CAAA;AACvF;;;ACxHA,IAAM,YAAuC,EAAC;AACvC,IAAM,QAAA,GAAsC,IAAI,KAAA,CAAM,SAAA,EAAW;AAAA,EACtE,GAAA,CAAI,IAAI,CAAA,EAAW;AAAE,IAAA,OAAO,UAAU,CAAC,CAAA;AAAA,EAAG,CAAA;AAAA,EAC1C,GAAA,CAAI,IAAI,CAAA,EAAW;AAAE,IAAA,OAAO,CAAA,IAAK,SAAA;AAAA,EAAW,CAAA;AAAA,EAC5C,OAAA,GAAU;AAAE,IAAA,OAAO,MAAA,CAAO,KAAK,SAAS,CAAA;AAAA,EAAG,CAAA;AAAA,EAC3C,wBAAA,CAAyB,IAAI,CAAA,EAAW;AACtC,IAAA,IAAI,CAAA,IAAK,SAAA,EAAW,OAAO,EAAE,YAAA,EAAc,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,KAAA,EAAO,SAAA,CAAU,CAAC,CAAA,EAAE;AACvF,IAAA,OAAO,MAAA;AAAA,EACT;AACF,CAAC;AACM,SAAS,iBAAiB,KAAA,EAAwC;AACvE,EAAA,KAAA,MAAW,KAAK,MAAA,CAAO,IAAA,CAAK,SAAS,CAAA,EAAG,OAAO,UAAU,CAAC,CAAA;AAC1D,EAAA,MAAA,CAAO,MAAA,CAAO,WAAW,KAAK,CAAA;AAChC;AAEO,IAAM,eAA0C;AAChD,IAAM,cAAwC;AAC9C,IAAM,mBAAA,GAA2C,EAAE,GAAA,EAAK,EAAC,EAAG,MAAA,EAAQ,EAAC,EAAG,OAAA,EAAS,EAAC,EAAG,MAAA,EAAQ,EAAC;ACZrG,IAAM,OAAA,GAAqB,EAAE,UAAA,EAAY,MAAM,IAAA,EAAK;AAEpD,IAAM,gBAAA,GAAmB,cAAyB,OAAO,CAAA;AAElD,SAAS,iBAAA,CAAkB,EAAE,KAAA,EAAO,QAAA,EAAS,EAA8C;AAChG,EAAA,uBAAO,GAAA,CAAC,gBAAA,CAAiB,QAAA,EAAjB,EAA0B,OAAe,QAAA,EAAS,CAAA;AAC5D;AAEO,SAAS,YAAA,GAA0B;AACxC,EAAA,OAAO,WAAW,gBAAgB,CAAA;AACpC","file":"chunk-GA35NEND.js","sourcesContent":["/**\n * Nav data types used by <Layout> + <StartMenu>. The actual sections, icons,\n * and categories are consumer-supplied via Layout props — the package never\n * ships nav DATA, only the shape it expects.\n */\nimport type { ReactNode } from 'react';\n\nexport interface NavItem {\n to: string;\n label: string;\n /** Optional compact wording used only inside navigation menus. Keep `label`\n * as the full semantic name for windows, search and assistive technology. */\n menuLabel?: string;\n perms?: string[];\n /** Permissions the user must hold EVERY one of, unlike `perms` which needs\n * only one. For an entry whose page is gated on a narrower permission than\n * the one that puts it in the menu: listing both in `perms` would widen the\n * audience (it's an OR), so the extra one goes here instead. */\n allPerms?: string[];\n dividerAfter?: boolean;\n /** An action instead of a destination. When set, choosing the row calls this\n * and opens no window — `to` is then only the row's key (and its `navIcons`\n * lookup), so give it one no page uses. The menu closes as it would after\n * opening a page. For rows whose target is not a window: signing in to\n * another tenant, say, which Sign Out is the built-in precedent for. */\n onSelect?: () => void;\n /** Optional sub-items, to any depth — a child may have children of its own.\n * Hovering the parent in <StartMenu> opens a nested flyout; in <Sidebar>\n * the parent becomes an inline sub-accordion. */\n children?: NavItem[];\n}\n\nexport interface NavSection {\n label: string;\n /** Optional compact wording used only inside navigation menus. */\n menuLabel?: string;\n items: NavItem[];\n perms?: string[];\n /** Same all-of rule as `NavItem.allPerms`, for a whole section. */\n allPerms?: string[];\n /** Optional landing route for clicks on the section title itself\n * (e.g. R&D's `/rd` dashboard). */\n to?: string;\n /** Draw a divider under this section's row, so a consumer can split one\n * flat group into visual bands (e.g. an operator console pinned above the\n * ERP sections). Same knob as `NavItem.dividerAfter`, and drawn INSIDE the\n * section's wrapper so it stays below the row in the `flex-col-reverse`\n * Start menu a side/top taskbar renders. */\n dividerAfter?: boolean;\n}\n\nexport interface VirtualSection {\n label: string;\n /** Optional compact wording used only inside navigation menus. */\n menuLabel?: string;\n items: NavItem[];\n icon?: ReactNode;\n}\n\nexport interface StartMenuCategories {\n /** Section labels rendered in the \"ERP\" group (bold, with section icon). */\n erp: string[];\n /** Section labels rendered in the \"system\" group. */\n system: string[];\n /** Optional virtual flyouts (e.g. a \"Utilities\" tray). */\n virtual?: VirtualSection[];\n /** Optional section labels pinned to the bottom of the menu, next to the user\n * profile, separated from the ERP group by a divider. */\n footer?: string[];\n /** Optional flat top-level items pinned to the bottom of the menu, next to\n * the user profile, separated from the ERP group by a divider. Unlike\n * `footer` (section labels rendered as flyouts), these render as direct\n * clickable rows — use for standalone destinations like System Preferences\n * or a bug-report link. */\n footerItems?: NavItem[];\n}\n\nexport function isSection(item: NavSection | NavItem): item is NavSection {\n return 'items' in item;\n}\n\n/** The host app's permission predicate — `useAuth().hasAnyPerm`. */\ntype HasAnyPerm = (perms: string[]) => boolean;\n\n/**\n * Whether this user may see a nav entry, honouring BOTH permission rules.\n *\n * Every visibility test in the shell goes through here. It used to be an inline\n * `!x.perms || hasAnyPerm(x.perms)` repeated at nine call sites, which made the\n * all-of rule impossible to add without missing one — and a missed site shows a\n * row that refuses on click (SG#00214: a price-blind supplier role kept the\n * Price Sheets entry, because the entry is gated on the permission that lists\n * price sheets while the page is gated on the narrower one that reveals prices).\n *\n * `perms` keeps its any-of meaning, so existing nav data is untouched.\n * `allPerms` requires every entry, and is tested one permission at a time\n * because `hasAnyPerm` is the only predicate a host supplies — asking for all\n * of them in one call would be an OR and quietly grant the row.\n */\nexport function navVisible(\n entry: { perms?: string[]; allPerms?: string[] },\n hasAnyPerm: HasAnyPerm,\n): boolean {\n if (entry.perms?.length && !hasAnyPerm(entry.perms)) return false;\n if (entry.allPerms?.length && !entry.allPerms.every(p => hasAnyPerm([p]))) return false;\n return true;\n}\n\n/**\n * The sub-items of `item` this user may actually see.\n *\n * Every affordance for a nested group has to be derived from THIS list — the\n * chevron that advertises it, the hover handler that opens it, and the flyout\n * itself. Reading the raw `item.children` for the chevron while filtering only\n * for the flyout put an arrow on groups whose children were all\n * permission-hidden: hovering one highlighted the row and opened nothing.\n */\nexport function visibleChildren(item: NavItem, hasAnyPerm: HasAnyPerm): NavItem[] {\n return (item.children ?? []).filter(c => navVisible(c, hasAnyPerm));\n}\n\n/**\n * Whether a nav row leads anywhere for this user: either it's a plain\n * destination, or it's a group with at least one child that itself leads\n * somewhere. A group whose children are all hidden has nothing to open — and\n * by convention a group's `to` is a synthetic key that never navigates, so\n * there is nothing to fall back to either. Such a row is dropped rather than\n * rendered inert.\n *\n * The test recurses because nesting does: a group holding one sub-group whose\n * own children are all permission-hidden is just as inert as a group holding\n * nothing, and at four levels deep that shape is easy to build by accident.\n */\nexport function isReachable(item: NavItem, hasAnyPerm: HasAnyPerm): boolean {\n if (!item.children?.length) return true;\n return visibleChildren(item, hasAnyPerm).some(child => isReachable(child, hasAnyPerm));\n}\n","/**\n * INTERNAL stub — package-side compatibility for files that legacy-imported\n * default nav data from `shell-config/nav`. The package never ships nav\n * DATA; consumers always supply `navSections` / `navIcons` / `sectionIcons` /\n * `categories` as Layout props.\n *\n * Empty defaults exported here so the copied files compile during the\n * extraction transition. Each consumer-facing field is also re-exported as\n * a TYPE alias for code that only needed the shape.\n */\nimport type { ReactNode } from 'react';\nimport type { NavItem, NavSection, StartMenuCategories, VirtualSection } from '../shell/nav-types';\n\n// Live proxy: WindowManager reads window-title icons from this module-level\n// map. Consumers register their full icon set once at app startup so the\n// title bars show the same glyphs as the start menu.\nconst _navIcons: Record<string, ReactNode> = {};\nexport const navIcons: Record<string, ReactNode> = new Proxy(_navIcons, {\n get(_t, k: string) { return _navIcons[k]; },\n has(_t, k: string) { return k in _navIcons; },\n ownKeys() { return Object.keys(_navIcons); },\n getOwnPropertyDescriptor(_t, k: string) {\n if (k in _navIcons) return { configurable: true, enumerable: true, value: _navIcons[k] };\n return undefined;\n },\n});\nexport function setShellNavIcons(icons: Record<string, ReactNode>): void {\n for (const k of Object.keys(_navIcons)) delete _navIcons[k];\n Object.assign(_navIcons, icons);\n}\n\nexport const sectionIcons: Record<string, ReactNode> = {};\nexport const navSections: (NavSection | NavItem)[] = [];\nexport const startMenuCategories: StartMenuCategories = { erp: [], system: [], virtual: [], footer: [] };\n\nexport { isSection } from '../shell/nav-types';\nexport type { NavItem, NavSection, StartMenuCategories, VirtualSection };\n","/**\n * Shell-side auth surface — JUST permission checking. The shell never\n * authenticates anyone or holds tokens; it only asks \"is the current user\n * allowed to see this nav item?\".\n *\n * Consumer wraps the app:\n *\n * <ShellAuthProvider value={{ hasAnyPerm: (perms) => myAuth.has(...perms) }}>\n * <Layout ... />\n * </ShellAuthProvider>\n *\n * When no provider is mounted, every permission check returns true — useful\n * for demos and consumers that don't gate their UI.\n */\nimport { createContext, useContext, type ReactNode } from 'react';\n\nexport interface ShellAuth {\n /** Returns true if the current user has any of the listed permission codes. */\n hasAnyPerm: (perms: string[]) => boolean;\n}\n\nconst DEFAULT: ShellAuth = { hasAnyPerm: () => true };\n\nconst ShellAuthContext = createContext<ShellAuth>(DEFAULT);\n\nexport function ShellAuthProvider({ value, children }: { value: ShellAuth; children: ReactNode }) {\n return <ShellAuthContext.Provider value={value}>{children}</ShellAuthContext.Provider>;\n}\n\nexport function useShellAuth(): ShellAuth {\n return useContext(ShellAuthContext);\n}\n"]}
|
package/dist/chunk-GIGV2ZRW.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useShellStrings } from './chunk-72CQWN7O.js';
|
|
2
|
-
import { Fragment } from 'react';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
var DEFAULT_SEPARATOR = /* @__PURE__ */ jsx("svg", { className: "h-3.5 w-3.5 shrink-0 text-gray-300", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx(
|
|
6
|
-
"path",
|
|
7
|
-
{
|
|
8
|
-
fillRule: "evenodd",
|
|
9
|
-
d: "M7.21 14.77a.75.75 0 0 1 .02-1.06L11.168 10 7.23 6.29a.75.75 0 1 1 1.04-1.08l4.5 4.25a.75.75 0 0 1 0 1.08l-4.5 4.25a.75.75 0 0 1-1.06-.02Z",
|
|
10
|
-
clipRule: "evenodd"
|
|
11
|
-
}
|
|
12
|
-
) });
|
|
13
|
-
var CRUMB_LINK = "inline-flex min-w-0 items-center gap-1 truncate rounded px-1 -mx-1 text-gray-500 transition-colors hover:text-gray-900 hover:underline rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]";
|
|
14
|
-
function Breadcrumbs({ items, separator, maxItems = 0, className }) {
|
|
15
|
-
const strings = useShellStrings().breadcrumbs;
|
|
16
|
-
if (items.length === 0) return null;
|
|
17
|
-
const sep = separator ?? DEFAULT_SEPARATOR;
|
|
18
|
-
const crumbs = [];
|
|
19
|
-
const lastIndex = items.length - 1;
|
|
20
|
-
if (maxItems > 0 && items.length > maxItems && maxItems >= 2) {
|
|
21
|
-
const tailCount = Math.max(1, maxItems - 1);
|
|
22
|
-
crumbs.push({ kind: "item", item: items[0], isLast: false });
|
|
23
|
-
crumbs.push({ kind: "ellipsis" });
|
|
24
|
-
for (let i = items.length - tailCount; i <= lastIndex; i++) {
|
|
25
|
-
crumbs.push({ kind: "item", item: items[i], isLast: i === lastIndex });
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
items.forEach((item, i) => crumbs.push({ kind: "item", item, isLast: i === lastIndex }));
|
|
29
|
-
}
|
|
30
|
-
return /* @__PURE__ */ jsx("nav", { "aria-label": strings.label, className: `min-w-0 ${className ?? ""}`, children: /* @__PURE__ */ jsx("ol", { className: "flex items-center gap-1.5 text-sm", children: crumbs.map((crumb, i) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
|
-
i > 0 && /* @__PURE__ */ jsx("li", { "aria-hidden": true, className: "flex items-center", children: sep }),
|
|
32
|
-
/* @__PURE__ */ jsx("li", { className: "flex min-w-0 items-center", children: crumb.kind === "ellipsis" ? /* @__PURE__ */ jsx("span", { className: "px-0.5 text-gray-400 select-none", "aria-label": strings.hidden, children: "\u2026" }) : crumb.isLast || !(crumb.item.href || crumb.item.onClick) ? /* @__PURE__ */ jsxs(
|
|
33
|
-
"span",
|
|
34
|
-
{
|
|
35
|
-
"aria-current": crumb.isLast ? "page" : void 0,
|
|
36
|
-
className: `inline-flex min-w-0 items-center gap-1 truncate ${crumb.isLast ? "font-medium text-gray-900" : "text-gray-500"}`,
|
|
37
|
-
children: [
|
|
38
|
-
crumb.item.icon,
|
|
39
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: crumb.item.label })
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
) : crumb.item.href ? /* @__PURE__ */ jsxs(
|
|
43
|
-
"a",
|
|
44
|
-
{
|
|
45
|
-
href: crumb.item.href,
|
|
46
|
-
onClick: crumb.item.onClick,
|
|
47
|
-
className: CRUMB_LINK,
|
|
48
|
-
children: [
|
|
49
|
-
crumb.item.icon,
|
|
50
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: crumb.item.label })
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
) : /* @__PURE__ */ jsxs(
|
|
54
|
-
"button",
|
|
55
|
-
{
|
|
56
|
-
type: "button",
|
|
57
|
-
onClick: crumb.item.onClick,
|
|
58
|
-
className: CRUMB_LINK,
|
|
59
|
-
children: [
|
|
60
|
-
crumb.item.icon,
|
|
61
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: crumb.item.label })
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
) })
|
|
65
|
-
] }, i)) }) });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { Breadcrumbs };
|
|
69
|
-
//# sourceMappingURL=chunk-GIGV2ZRW.js.map
|
|
70
|
-
//# sourceMappingURL=chunk-GIGV2ZRW.js.map
|