@netless/telebox-insider 0.2.29 → 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.
@@ -20,11 +20,6 @@ var __spreadValues = (a, b) => {
20
20
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports[Symbol.toStringTag] = "Module";
23
- var React = require("react");
24
- function _interopDefaultLegacy(e2) {
25
- return e2 && typeof e2 === "object" && "default" in e2 ? e2 : { "default": e2 };
26
- }
27
- var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
28
23
  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}";
29
24
  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}';
30
25
  var eventemitter3 = { exports: {} };
@@ -2210,150 +2205,6 @@ class TeleBox {
2210
2205
  function noop() {
2211
2206
  return;
2212
2207
  }
2213
- const useUpdateEffect = (effect, deps) => {
2214
- const isFirst = React.useRef(true);
2215
- React.useEffect(() => {
2216
- if (isFirst.current) {
2217
- isFirst.current = false;
2218
- return;
2219
- }
2220
- return effect();
2221
- }, deps);
2222
- };
2223
- const TeleBoxReact = (props) => {
2224
- const [teleBox] = React.useState(() => new TeleBox(props));
2225
- useUpdateEffect(() => {
2226
- if (props.prefersColorScheme != null) {
2227
- teleBox.setPrefersColorScheme(props.prefersColorScheme);
2228
- }
2229
- }, [teleBox, props.prefersColorScheme]);
2230
- useUpdateEffect(() => {
2231
- if (props.minWidth != null) {
2232
- teleBox.setMinWidth(props.minWidth);
2233
- }
2234
- }, [teleBox, props.minWidth]);
2235
- useUpdateEffect(() => {
2236
- if (props.minHeight != null) {
2237
- teleBox.setMinHeight(props.minHeight);
2238
- }
2239
- }, [teleBox, props.minHeight]);
2240
- useUpdateEffect(() => {
2241
- var _a, _b;
2242
- teleBox.resize((_a = props.width) != null ? _a : teleBox.width, (_b = props.height) != null ? _b : teleBox.height, true);
2243
- }, [teleBox, props.width, props.height]);
2244
- useUpdateEffect(() => {
2245
- var _a, _b;
2246
- teleBox.move((_a = props.x) != null ? _a : teleBox.x, (_b = props.y) != null ? _b : teleBox.y, true);
2247
- }, [teleBox, props.x, props.y]);
2248
- useUpdateEffect(() => {
2249
- if (props.title != null) {
2250
- teleBox.setTitle(props.title);
2251
- }
2252
- }, [teleBox, props.title]);
2253
- useUpdateEffect(() => {
2254
- if (props.visible != null) {
2255
- teleBox.setVisible(props.visible);
2256
- }
2257
- }, [teleBox, props.visible]);
2258
- useUpdateEffect(() => {
2259
- if (props.minimized != null) {
2260
- teleBox.setMinimized(props.minimized, true);
2261
- }
2262
- }, [teleBox, props.minimized]);
2263
- useUpdateEffect(() => {
2264
- if (props.maximized != null) {
2265
- teleBox.setMaximized(props.maximized, true);
2266
- }
2267
- }, [teleBox, props.maximized]);
2268
- useUpdateEffect(() => {
2269
- if (props.state != null) {
2270
- teleBox.setState(props.state, true);
2271
- }
2272
- }, [teleBox, props.state]);
2273
- useUpdateEffect(() => {
2274
- if (props.draggable != null) {
2275
- teleBox.setDraggable(props.draggable);
2276
- }
2277
- }, [teleBox, props.draggable]);
2278
- useUpdateEffect(() => {
2279
- if (props.resizable != null) {
2280
- teleBox.setResizable(props.resizable);
2281
- }
2282
- }, [teleBox, props.resizable]);
2283
- useUpdateEffect(() => {
2284
- if (props.fence != null) {
2285
- teleBox.setFence(props.fence);
2286
- }
2287
- }, [teleBox, props.fence]);
2288
- useUpdateEffect(() => {
2289
- if (props.containerRect != null) {
2290
- teleBox.setContainerRect(props.containerRect);
2291
- }
2292
- }, [teleBox, props.containerRect]);
2293
- useUpdateEffect(() => {
2294
- if (props.fixRatio != null) {
2295
- teleBox.setFixRatio(props.fixRatio);
2296
- }
2297
- }, [teleBox, props.fixRatio]);
2298
- React.useEffect(() => {
2299
- if (props.onResize) {
2300
- teleBox.events.on(exports.TELE_BOX_EVENT.Resize, props.onResize);
2301
- return () => {
2302
- teleBox.events.off(exports.TELE_BOX_EVENT.Resize, props.onResize);
2303
- };
2304
- }
2305
- return;
2306
- }, [teleBox, props.onResize]);
2307
- React.useEffect(() => {
2308
- if (props.onMove) {
2309
- teleBox.events.on(exports.TELE_BOX_EVENT.Move, props.onMove);
2310
- return () => {
2311
- teleBox.events.off(exports.TELE_BOX_EVENT.Move, props.onMove);
2312
- };
2313
- }
2314
- return;
2315
- }, [teleBox, props.onMove]);
2316
- React.useEffect(() => {
2317
- if (props.onClose) {
2318
- teleBox.events.on(exports.TELE_BOX_EVENT.Close, props.onClose);
2319
- return () => {
2320
- teleBox.events.off(exports.TELE_BOX_EVENT.Close, props.onClose);
2321
- };
2322
- }
2323
- return;
2324
- }, [teleBox, props.onClose]);
2325
- React.useEffect(() => {
2326
- if (props.onFocus) {
2327
- teleBox.events.on(exports.TELE_BOX_EVENT.Focus, props.onFocus);
2328
- return () => {
2329
- teleBox.events.off(exports.TELE_BOX_EVENT.Focus, props.onFocus);
2330
- };
2331
- }
2332
- return;
2333
- }, [teleBox, props.onFocus]);
2334
- React.useEffect(() => {
2335
- if (props.onBlur) {
2336
- teleBox.events.on(exports.TELE_BOX_EVENT.Blur, props.onBlur);
2337
- return () => {
2338
- teleBox.events.off(exports.TELE_BOX_EVENT.Blur, props.onBlur);
2339
- };
2340
- }
2341
- return;
2342
- }, [teleBox, props.onBlur]);
2343
- React.useEffect(() => {
2344
- if (props.onStateChanged) {
2345
- teleBox.events.on(exports.TELE_BOX_EVENT.State, props.onStateChanged);
2346
- return () => {
2347
- teleBox.events.off(exports.TELE_BOX_EVENT.State, props.onStateChanged);
2348
- };
2349
- }
2350
- return;
2351
- }, [teleBox, props.onStateChanged]);
2352
- return /* @__PURE__ */ React__default["default"].createElement("div", {
2353
- ref: (node) => node && teleBox.render(node),
2354
- className: teleBox.wrapClassName("box")
2355
- });
2356
- };
2357
2208
  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}";
2358
2209
  var collectorSVG = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";
2359
2210
  class TeleBoxCollector {
@@ -3131,5 +2982,4 @@ exports.TeleBox = TeleBox;
3131
2982
  exports.TeleBoxCollector = TeleBoxCollector;
3132
2983
  exports.TeleBoxDragHandleType = TeleBoxDragHandleType;
3133
2984
  exports.TeleBoxManager = TeleBoxManager;
3134
- exports.TeleBoxReact = TeleBoxReact;
3135
2985
  //# sourceMappingURL=telebox-insider.cjs.js.map