@netless/telebox-insider 0.2.28 → 0.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +837 -6
- package/dist/telebox-insider.cjs.js +0 -150
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +1 -146
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +77 -78
- package/src/index.ts +1 -1
- package/dist/TeleBox/constants.d.ts +0 -44
- package/dist/TeleBox/index.d.ts +0 -171
- package/dist/TeleBox/typings.d.ts +0 -133
- package/dist/TeleBoxCollector/TeleBoxCollector.stories.d.ts +0 -5
- package/dist/TeleBoxCollector/index.d.ts +0 -39
- package/dist/TeleBoxManager/MaxTitleBar/MaxTitleBar.stories.d.ts +0 -7
- package/dist/TeleBoxManager/MaxTitleBar/MaxTitleBarReact.d.ts +0 -4
- package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +0 -29
- package/dist/TeleBoxManager/constants.d.ts +0 -17
- package/dist/TeleBoxManager/index.d.ts +0 -60
- package/dist/TeleBoxManager/typings.d.ts +0 -42
- package/dist/TeleBoxReact/TeleBox.stories.d.ts +0 -9
- package/dist/TeleBoxReact/index.d.ts +0 -17
- package/dist/TeleBoxReact/utils.d.ts +0 -2
- package/dist/TeleTitleBar/DefaultTitleBar/DefaultTitleBar.stories.d.ts +0 -4
- package/dist/TeleTitleBar/DefaultTitleBar/index.d.ts +0 -46
- package/dist/TeleTitleBar/index.d.ts +0 -2
- package/dist/TeleTitleBar/typings.d.ts +0 -23
- package/dist/typings.d.ts +0 -3
- package/dist/utils.d.ts +0 -9
|
@@ -17,7 +17,6 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import React, { useRef, useEffect, useState } from "react";
|
|
21
20
|
var fancyScrollbar = ".tele-fancy-scrollbar {\n overscroll-behavior: contain;\n overflow: auto;\n overflow-y: scroll;\n overflow-y: overlay;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n scrollbar-width: auto;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar {\n height: 8px;\n width: 8px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-track {\n background-color: transparent;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n background-color: transparent;\n border-radius: 4px;\n transition: background-color 0.4s;\n}\n.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical {\n min-height: 50px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal {\n min-width: 50px;\n}";
|
|
22
21
|
var style$3 = '.telebox-box {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 100;\n transition: width 0.4s cubic-bezier(0.4, 0.9, 0.71, 1.02), height 0.4s cubic-bezier(0.55, 0.82, 0.63, 0.95), opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0), transform 0.4s ease;\n}\n\n.telebox-box-main {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: #f9f9fc;\n box-shadow: 0px 4px 10px 0px rgba(47, 65, 146, 0.15);\n border-radius: 6px;\n border: 1px solid #e3e3ec;\n}\n\n.telebox-titlebar-wrap {\n flex-shrink: 0;\n position: relative;\n z-index: 1;\n}\n\n.telebox-content-wrap {\n flex: 1;\n width: 100%;\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.telebox-content {\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.telebox-footer-wrap {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n}\n\n.telebox-footer-wrap::before {\n content: "";\n display: block;\n flex: 1;\n}\n\n.telebox-resize-handle {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n position: absolute;\n z-index: 2147483647;\n}\n\n.telebox-n {\n width: 100%;\n height: 5px;\n left: 0;\n top: -5px;\n cursor: n-resize;\n}\n\n.telebox-s {\n width: 100%;\n height: 5px;\n left: 0;\n bottom: -5px;\n cursor: s-resize;\n}\n\n.telebox-w {\n width: 5px;\n height: 100%;\n left: -5px;\n top: 0;\n cursor: w-resize;\n}\n\n.telebox-e {\n width: 5px;\n height: 100%;\n right: -5px;\n top: 0;\n cursor: e-resize;\n}\n\n.telebox-nw {\n width: 15px;\n height: 15px;\n top: -5px;\n left: -5px;\n cursor: nw-resize;\n}\n\n.telebox-ne {\n width: 15px;\n height: 15px;\n top: -5px;\n right: -5px;\n cursor: ne-resize;\n}\n\n.telebox-se {\n width: 15px;\n height: 15px;\n bottom: -5px;\n right: -5px;\n cursor: se-resize;\n}\n\n.telebox-sw {\n width: 15px;\n height: 15px;\n bottom: -5px;\n left: -5px;\n cursor: sw-resize;\n}\n\n.telebox-track-mask {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 2147483647;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.0001);\n cursor: move;\n}\n\n.telebox-cursor-n {\n cursor: n-resize;\n}\n\n.telebox-cursor-s {\n cursor: s-resize;\n}\n\n.telebox-cursor-w {\n cursor: w-resize;\n}\n\n.telebox-cursor-e {\n cursor: e-resize;\n}\n\n.telebox-cursor-nw {\n cursor: nw-resize;\n}\n\n.telebox-cursor-ne {\n cursor: ne-resize;\n}\n\n.telebox-cursor-se {\n cursor: se-resize;\n}\n\n.telebox-cursor-sw {\n cursor: sw-resize;\n}\n\n.telebox-maximized .telebox-resize-handles,\n.telebox-no-resize .telebox-resize-handles {\n display: none;\n}\n\n.telebox-maximized {\n box-shadow: none;\n transition: none;\n}\n\n.telebox-minimized {\n transition: width 0.05s cubic-bezier(0.4, 0.9, 0.71, 1.02), height 0.05s cubic-bezier(0.55, 0.82, 0.63, 0.95), opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0), transform 0.6s ease;\n opacity: 0;\n pointer-events: none;\n user-select: none;\n}\n\n.telebox-transforming {\n will-change: transform;\n transition: opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0);\n}\n\n.telebox-readonly .telebox-resize-handle {\n cursor: initial !important;\n pointer-events: none !important;\n}\n\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n\n.telebox-color-scheme-dark .telebox-box-main {\n color: #e9e9e9;\n background: #212126;\n border-color: #43434d;\n}';
|
|
23
22
|
var eventemitter3 = { exports: {} };
|
|
@@ -2203,150 +2202,6 @@ class TeleBox {
|
|
|
2203
2202
|
function noop() {
|
|
2204
2203
|
return;
|
|
2205
2204
|
}
|
|
2206
|
-
const useUpdateEffect = (effect, deps) => {
|
|
2207
|
-
const isFirst = useRef(true);
|
|
2208
|
-
useEffect(() => {
|
|
2209
|
-
if (isFirst.current) {
|
|
2210
|
-
isFirst.current = false;
|
|
2211
|
-
return;
|
|
2212
|
-
}
|
|
2213
|
-
return effect();
|
|
2214
|
-
}, deps);
|
|
2215
|
-
};
|
|
2216
|
-
const TeleBoxReact = (props) => {
|
|
2217
|
-
const [teleBox] = useState(() => new TeleBox(props));
|
|
2218
|
-
useUpdateEffect(() => {
|
|
2219
|
-
if (props.prefersColorScheme != null) {
|
|
2220
|
-
teleBox.setPrefersColorScheme(props.prefersColorScheme);
|
|
2221
|
-
}
|
|
2222
|
-
}, [teleBox, props.prefersColorScheme]);
|
|
2223
|
-
useUpdateEffect(() => {
|
|
2224
|
-
if (props.minWidth != null) {
|
|
2225
|
-
teleBox.setMinWidth(props.minWidth);
|
|
2226
|
-
}
|
|
2227
|
-
}, [teleBox, props.minWidth]);
|
|
2228
|
-
useUpdateEffect(() => {
|
|
2229
|
-
if (props.minHeight != null) {
|
|
2230
|
-
teleBox.setMinHeight(props.minHeight);
|
|
2231
|
-
}
|
|
2232
|
-
}, [teleBox, props.minHeight]);
|
|
2233
|
-
useUpdateEffect(() => {
|
|
2234
|
-
var _a, _b;
|
|
2235
|
-
teleBox.resize((_a = props.width) != null ? _a : teleBox.width, (_b = props.height) != null ? _b : teleBox.height, true);
|
|
2236
|
-
}, [teleBox, props.width, props.height]);
|
|
2237
|
-
useUpdateEffect(() => {
|
|
2238
|
-
var _a, _b;
|
|
2239
|
-
teleBox.move((_a = props.x) != null ? _a : teleBox.x, (_b = props.y) != null ? _b : teleBox.y, true);
|
|
2240
|
-
}, [teleBox, props.x, props.y]);
|
|
2241
|
-
useUpdateEffect(() => {
|
|
2242
|
-
if (props.title != null) {
|
|
2243
|
-
teleBox.setTitle(props.title);
|
|
2244
|
-
}
|
|
2245
|
-
}, [teleBox, props.title]);
|
|
2246
|
-
useUpdateEffect(() => {
|
|
2247
|
-
if (props.visible != null) {
|
|
2248
|
-
teleBox.setVisible(props.visible);
|
|
2249
|
-
}
|
|
2250
|
-
}, [teleBox, props.visible]);
|
|
2251
|
-
useUpdateEffect(() => {
|
|
2252
|
-
if (props.minimized != null) {
|
|
2253
|
-
teleBox.setMinimized(props.minimized, true);
|
|
2254
|
-
}
|
|
2255
|
-
}, [teleBox, props.minimized]);
|
|
2256
|
-
useUpdateEffect(() => {
|
|
2257
|
-
if (props.maximized != null) {
|
|
2258
|
-
teleBox.setMaximized(props.maximized, true);
|
|
2259
|
-
}
|
|
2260
|
-
}, [teleBox, props.maximized]);
|
|
2261
|
-
useUpdateEffect(() => {
|
|
2262
|
-
if (props.state != null) {
|
|
2263
|
-
teleBox.setState(props.state, true);
|
|
2264
|
-
}
|
|
2265
|
-
}, [teleBox, props.state]);
|
|
2266
|
-
useUpdateEffect(() => {
|
|
2267
|
-
if (props.draggable != null) {
|
|
2268
|
-
teleBox.setDraggable(props.draggable);
|
|
2269
|
-
}
|
|
2270
|
-
}, [teleBox, props.draggable]);
|
|
2271
|
-
useUpdateEffect(() => {
|
|
2272
|
-
if (props.resizable != null) {
|
|
2273
|
-
teleBox.setResizable(props.resizable);
|
|
2274
|
-
}
|
|
2275
|
-
}, [teleBox, props.resizable]);
|
|
2276
|
-
useUpdateEffect(() => {
|
|
2277
|
-
if (props.fence != null) {
|
|
2278
|
-
teleBox.setFence(props.fence);
|
|
2279
|
-
}
|
|
2280
|
-
}, [teleBox, props.fence]);
|
|
2281
|
-
useUpdateEffect(() => {
|
|
2282
|
-
if (props.containerRect != null) {
|
|
2283
|
-
teleBox.setContainerRect(props.containerRect);
|
|
2284
|
-
}
|
|
2285
|
-
}, [teleBox, props.containerRect]);
|
|
2286
|
-
useUpdateEffect(() => {
|
|
2287
|
-
if (props.fixRatio != null) {
|
|
2288
|
-
teleBox.setFixRatio(props.fixRatio);
|
|
2289
|
-
}
|
|
2290
|
-
}, [teleBox, props.fixRatio]);
|
|
2291
|
-
useEffect(() => {
|
|
2292
|
-
if (props.onResize) {
|
|
2293
|
-
teleBox.events.on(TELE_BOX_EVENT.Resize, props.onResize);
|
|
2294
|
-
return () => {
|
|
2295
|
-
teleBox.events.off(TELE_BOX_EVENT.Resize, props.onResize);
|
|
2296
|
-
};
|
|
2297
|
-
}
|
|
2298
|
-
return;
|
|
2299
|
-
}, [teleBox, props.onResize]);
|
|
2300
|
-
useEffect(() => {
|
|
2301
|
-
if (props.onMove) {
|
|
2302
|
-
teleBox.events.on(TELE_BOX_EVENT.Move, props.onMove);
|
|
2303
|
-
return () => {
|
|
2304
|
-
teleBox.events.off(TELE_BOX_EVENT.Move, props.onMove);
|
|
2305
|
-
};
|
|
2306
|
-
}
|
|
2307
|
-
return;
|
|
2308
|
-
}, [teleBox, props.onMove]);
|
|
2309
|
-
useEffect(() => {
|
|
2310
|
-
if (props.onClose) {
|
|
2311
|
-
teleBox.events.on(TELE_BOX_EVENT.Close, props.onClose);
|
|
2312
|
-
return () => {
|
|
2313
|
-
teleBox.events.off(TELE_BOX_EVENT.Close, props.onClose);
|
|
2314
|
-
};
|
|
2315
|
-
}
|
|
2316
|
-
return;
|
|
2317
|
-
}, [teleBox, props.onClose]);
|
|
2318
|
-
useEffect(() => {
|
|
2319
|
-
if (props.onFocus) {
|
|
2320
|
-
teleBox.events.on(TELE_BOX_EVENT.Focus, props.onFocus);
|
|
2321
|
-
return () => {
|
|
2322
|
-
teleBox.events.off(TELE_BOX_EVENT.Focus, props.onFocus);
|
|
2323
|
-
};
|
|
2324
|
-
}
|
|
2325
|
-
return;
|
|
2326
|
-
}, [teleBox, props.onFocus]);
|
|
2327
|
-
useEffect(() => {
|
|
2328
|
-
if (props.onBlur) {
|
|
2329
|
-
teleBox.events.on(TELE_BOX_EVENT.Blur, props.onBlur);
|
|
2330
|
-
return () => {
|
|
2331
|
-
teleBox.events.off(TELE_BOX_EVENT.Blur, props.onBlur);
|
|
2332
|
-
};
|
|
2333
|
-
}
|
|
2334
|
-
return;
|
|
2335
|
-
}, [teleBox, props.onBlur]);
|
|
2336
|
-
useEffect(() => {
|
|
2337
|
-
if (props.onStateChanged) {
|
|
2338
|
-
teleBox.events.on(TELE_BOX_EVENT.State, props.onStateChanged);
|
|
2339
|
-
return () => {
|
|
2340
|
-
teleBox.events.off(TELE_BOX_EVENT.State, props.onStateChanged);
|
|
2341
|
-
};
|
|
2342
|
-
}
|
|
2343
|
-
return;
|
|
2344
|
-
}, [teleBox, props.onStateChanged]);
|
|
2345
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
2346
|
-
ref: (node) => node && teleBox.render(node),
|
|
2347
|
-
className: teleBox.wrapClassName("box")
|
|
2348
|
-
});
|
|
2349
|
-
};
|
|
2350
2205
|
var style$1 = ".telebox-collector {\n user-select: none;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n visibility: hidden;\n display: block;\n position: absolute;\n z-index: 200;\n width: 40px;\n height: 40px;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n font-size: 0;\n border-radius: 50%;\n background: #fff;\n box-shadow: 0px 2px 6px 0px rgba(47, 65, 146, 0.15);\n cursor: pointer;\n user-select: none;\n pointer-events: none;\n background-repeat: no-repeat;\n background-size: 18px 16px;\n background-position: center;\n -webkit-tap-highlight-color: transparent;\n}\n\n.telebox-collector-visible {\n visibility: visible;\n pointer-events: initial;\n}\n\n.telebox-collector-readonly {\n cursor: not-allowed;\n}\n\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n\n.telebox-color-scheme-dark.telebox-collector {\n background-color: #43434d;\n}";
|
|
2351
2206
|
var collectorSVG = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";
|
|
2352
2207
|
class TeleBoxCollector {
|
|
@@ -3119,5 +2974,5 @@ class TeleBoxManager {
|
|
|
3119
2974
|
return typeof boxOrID === "string" ? this.boxes.find((box) => box.id === boxOrID) : boxOrID;
|
|
3120
2975
|
}
|
|
3121
2976
|
}
|
|
3122
|
-
export { DefaultTitleBar, TELE_BOX_COLOR_SCHEME, TELE_BOX_DELEGATE_EVENT, TELE_BOX_EVENT, TELE_BOX_MANAGER_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TeleBox, TeleBoxCollector, TeleBoxDragHandleType, TeleBoxManager
|
|
2977
|
+
export { DefaultTitleBar, TELE_BOX_COLOR_SCHEME, TELE_BOX_DELEGATE_EVENT, TELE_BOX_EVENT, TELE_BOX_MANAGER_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TeleBox, TeleBoxCollector, TeleBoxDragHandleType, TeleBoxManager };
|
|
3123
2978
|
//# sourceMappingURL=telebox-insider.es.js.map
|