deepsea-components 5.7.6 → 5.7.7

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.
@@ -23,6 +23,7 @@ __export(Title_exports, {
23
23
  Title: () => Title
24
24
  });
25
25
  module.exports = __toCommonJS(Title_exports);
26
+ var import_deepsea_tools = require("deepsea-tools");
26
27
  var import_react = require("react");
27
28
  var import_react_dom = require("react-dom");
28
29
  var import_getReactVersion = require("../utils/getReactVersion");
@@ -38,7 +39,7 @@ var Title = (0, import_react.forwardRef)((props, ref) => {
38
39
  return;
39
40
  document.head.insertBefore(ele.current, title);
40
41
  }, []);
41
- return (0, import_react_dom.createPortal)(/* @__PURE__ */ React.createElement("title", { ref: ele, ...props }), document.head);
42
+ return import_deepsea_tools.isBrowser && (0, import_react_dom.createPortal)(/* @__PURE__ */ React.createElement("title", { ref: ele, ...props }), document.head);
42
43
  });
43
44
  // Annotate the CommonJS export names for ESM import in node:
44
45
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Title.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport { ComponentPropsWithoutRef, forwardRef, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\nimport { createPortal } from \"react-dom\"\n\nimport { getReactVersion } from \"../utils/getReactVersion\"\n\nexport type TitleProps = ComponentPropsWithoutRef<\"title\">\n\nconst [major] = getReactVersion()\n\nexport const Title = forwardRef<HTMLTitleElement, TitleProps>((props, ref) => {\n if (major >= 19) return <title ref={ref} {...props} />\n\n const ele = useRef<HTMLTitleElement>(null)\n\n useImperativeHandle(ref, () => ele.current as HTMLTitleElement, [ele.current])\n\n useLayoutEffect(() => {\n const title = document.head.querySelector(\"title\")\n if (title === ele.current) return\n document.head.insertBefore(ele.current as HTMLTitleElement, title)\n }, [])\n\n return createPortal(<title ref={ele} {...props} />, document.head)\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAmG;AACnG,uBAA6B;AAE7B,6BAAgC;AAIhC,IAAM,CAAC,KAAK,QAAI,wCAAgB;AAEzB,IAAM,YAAQ,yBAAyC,CAAC,OAAO,QAAQ;AAC1E,MAAI,SAAS;AAAI,WAAO,oCAAC,WAAM,KAAW,GAAG,OAAO;AAEpD,QAAM,UAAM,qBAAyB,IAAI;AAEzC,wCAAoB,KAAK,MAAM,IAAI,SAA6B,CAAC,IAAI,OAAO,CAAC;AAE7E,oCAAgB,MAAM;AAClB,UAAM,QAAQ,SAAS,KAAK,cAAc,OAAO;AACjD,QAAI,UAAU,IAAI;AAAS;AAC3B,aAAS,KAAK,aAAa,IAAI,SAA6B,KAAK;AAAA,EACrE,GAAG,CAAC,CAAC;AAEL,aAAO,+BAAa,oCAAC,WAAM,KAAK,KAAM,GAAG,OAAO,GAAI,SAAS,IAAI;AACrE,CAAC;",
4
+ "sourcesContent": ["\"use client\"\n\nimport { isBrowser } from \"deepsea-tools\"\nimport { ComponentPropsWithoutRef, forwardRef, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\nimport { createPortal } from \"react-dom\"\n\nimport { getReactVersion } from \"../utils/getReactVersion\"\n\nexport type TitleProps = ComponentPropsWithoutRef<\"title\">\n\nconst [major] = getReactVersion()\n\nexport const Title = forwardRef<HTMLTitleElement, TitleProps>((props, ref) => {\n if (major >= 19) return <title ref={ref} {...props} />\n\n const ele = useRef<HTMLTitleElement>(null)\n\n useImperativeHandle(ref, () => ele.current as HTMLTitleElement, [ele.current])\n\n useLayoutEffect(() => {\n const title = document.head.querySelector(\"title\")\n if (title === ele.current) return\n document.head.insertBefore(ele.current as HTMLTitleElement, title)\n }, [])\n\n return isBrowser && createPortal(<title ref={ele} {...props} />, document.head)\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,2BAA0B;AAC1B,mBAAmG;AACnG,uBAA6B;AAE7B,6BAAgC;AAIhC,IAAM,CAAC,KAAK,QAAI,wCAAgB;AAEzB,IAAM,YAAQ,yBAAyC,CAAC,OAAO,QAAQ;AAC1E,MAAI,SAAS;AAAI,WAAO,oCAAC,WAAM,KAAW,GAAG,OAAO;AAEpD,QAAM,UAAM,qBAAyB,IAAI;AAEzC,wCAAoB,KAAK,MAAM,IAAI,SAA6B,CAAC,IAAI,OAAO,CAAC;AAE7E,oCAAgB,MAAM;AAClB,UAAM,QAAQ,SAAS,KAAK,cAAc,OAAO;AACjD,QAAI,UAAU,IAAI;AAAS;AAC3B,aAAS,KAAK,aAAa,IAAI,SAA6B,KAAK;AAAA,EACrE,GAAG,CAAC,CAAC;AAEL,SAAO,sCAAa,+BAAa,oCAAC,WAAM,KAAK,KAAM,GAAG,OAAO,GAAI,SAAS,IAAI;AAClF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
 
3
+ import { isBrowser } from "deepsea-tools";
3
4
  import { forwardRef, useImperativeHandle, useLayoutEffect, useRef } from "react";
4
5
  import { createPortal } from "react-dom";
5
6
  import { getReactVersion } from "../utils/getReactVersion";
@@ -17,7 +18,7 @@ export const Title = /*#__PURE__*/forwardRef((props, ref) => {
17
18
  if (title === ele.current) return;
18
19
  document.head.insertBefore(ele.current, title);
19
20
  }, []);
20
- return /*#__PURE__*/createPortal( /*#__PURE__*/_jsx("title", {
21
+ return isBrowser && /*#__PURE__*/createPortal( /*#__PURE__*/_jsx("title", {
21
22
  ref: ele,
22
23
  ...props
23
24
  }), document.head);
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","useImperativeHandle","useLayoutEffect","useRef","createPortal","getReactVersion","jsx","_jsx","major","Title","props","ref","ele","current","title","document","head","querySelector","insertBefore"],"sources":["../../../src/components/Title.tsx"],"sourcesContent":["\"use client\"\n\nimport { ComponentPropsWithoutRef, forwardRef, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\nimport { createPortal } from \"react-dom\"\n\nimport { getReactVersion } from \"../utils/getReactVersion\"\n\nexport type TitleProps = ComponentPropsWithoutRef<\"title\">\n\nconst [major] = getReactVersion()\n\nexport const Title = forwardRef<HTMLTitleElement, TitleProps>((props, ref) => {\n if (major >= 19) return <title ref={ref} {...props} />\n\n const ele = useRef<HTMLTitleElement>(null)\n\n useImperativeHandle(ref, () => ele.current as HTMLTitleElement, [ele.current])\n\n useLayoutEffect(() => {\n const title = document.head.querySelector(\"title\")\n if (title === ele.current) return\n document.head.insertBefore(ele.current as HTMLTitleElement, title)\n }, [])\n\n return createPortal(<title ref={ele} {...props} />, document.head)\n})\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAmCA,UAAU,EAAEC,mBAAmB,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAC1G,SAASC,YAAY,QAAQ,WAAW;AAExC,SAASC,eAAe;AAAkC,SAAAC,GAAA,IAAAC,IAAA;AAI1D,MAAM,CAACC,KAAK,CAAC,GAAGH,eAAe,CAAC,CAAC;AAEjC,OAAO,MAAMI,KAAK,gBAAGT,UAAU,CAA+B,CAACU,KAAK,EAAEC,GAAG,KAAK;EAC1E,IAAIH,KAAK,IAAI,EAAE,EAAE,oBAAOD,IAAA;IAAOI,GAAG,EAAEA,GAAI;IAAA,GAAKD;EAAK,CAAG,CAAC;EAEtD,MAAME,GAAG,GAAGT,MAAM,CAAmB,IAAI,CAAC;EAE1CF,mBAAmB,CAACU,GAAG,EAAE,MAAMC,GAAG,CAACC,OAA2B,EAAE,CAACD,GAAG,CAACC,OAAO,CAAC,CAAC;EAE9EX,eAAe,CAAC,MAAM;IAClB,MAAMY,KAAK,GAAGC,QAAQ,CAACC,IAAI,CAACC,aAAa,CAAC,OAAO,CAAC;IAClD,IAAIH,KAAK,KAAKF,GAAG,CAACC,OAAO,EAAE;IAC3BE,QAAQ,CAACC,IAAI,CAACE,YAAY,CAACN,GAAG,CAACC,OAAO,EAAsBC,KAAK,CAAC;EACtE,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOV,YAAY,eAACG,IAAA;IAAOI,GAAG,EAAEC,GAAI;IAAA,GAAKF;EAAK,CAAG,CAAC,EAAEK,QAAQ,CAACC,IAAI,CAAC;AACtE,CAAC,CAAC"}
1
+ {"version":3,"names":["isBrowser","forwardRef","useImperativeHandle","useLayoutEffect","useRef","createPortal","getReactVersion","jsx","_jsx","major","Title","props","ref","ele","current","title","document","head","querySelector","insertBefore"],"sources":["../../../src/components/Title.tsx"],"sourcesContent":["\"use client\"\n\nimport { isBrowser } from \"deepsea-tools\"\nimport { ComponentPropsWithoutRef, forwardRef, useImperativeHandle, useLayoutEffect, useRef } from \"react\"\nimport { createPortal } from \"react-dom\"\n\nimport { getReactVersion } from \"../utils/getReactVersion\"\n\nexport type TitleProps = ComponentPropsWithoutRef<\"title\">\n\nconst [major] = getReactVersion()\n\nexport const Title = forwardRef<HTMLTitleElement, TitleProps>((props, ref) => {\n if (major >= 19) return <title ref={ref} {...props} />\n\n const ele = useRef<HTMLTitleElement>(null)\n\n useImperativeHandle(ref, () => ele.current as HTMLTitleElement, [ele.current])\n\n useLayoutEffect(() => {\n const title = document.head.querySelector(\"title\")\n if (title === ele.current) return\n document.head.insertBefore(ele.current as HTMLTitleElement, title)\n }, [])\n\n return isBrowser && createPortal(<title ref={ele} {...props} />, document.head)\n})\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,SAAS,QAAQ,eAAe;AACzC,SAAmCC,UAAU,EAAEC,mBAAmB,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AAC1G,SAASC,YAAY,QAAQ,WAAW;AAExC,SAASC,eAAe;AAAkC,SAAAC,GAAA,IAAAC,IAAA;AAI1D,MAAM,CAACC,KAAK,CAAC,GAAGH,eAAe,CAAC,CAAC;AAEjC,OAAO,MAAMI,KAAK,gBAAGT,UAAU,CAA+B,CAACU,KAAK,EAAEC,GAAG,KAAK;EAC1E,IAAIH,KAAK,IAAI,EAAE,EAAE,oBAAOD,IAAA;IAAOI,GAAG,EAAEA,GAAI;IAAA,GAAKD;EAAK,CAAG,CAAC;EAEtD,MAAME,GAAG,GAAGT,MAAM,CAAmB,IAAI,CAAC;EAE1CF,mBAAmB,CAACU,GAAG,EAAE,MAAMC,GAAG,CAACC,OAA2B,EAAE,CAACD,GAAG,CAACC,OAAO,CAAC,CAAC;EAE9EX,eAAe,CAAC,MAAM;IAClB,MAAMY,KAAK,GAAGC,QAAQ,CAACC,IAAI,CAACC,aAAa,CAAC,OAAO,CAAC;IAClD,IAAIH,KAAK,KAAKF,GAAG,CAACC,OAAO,EAAE;IAC3BE,QAAQ,CAACC,IAAI,CAACE,YAAY,CAACN,GAAG,CAACC,OAAO,EAAsBC,KAAK,CAAC;EACtE,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOf,SAAS,iBAAIK,YAAY,eAACG,IAAA;IAAOI,GAAG,EAAEC,GAAI;IAAA,GAAKF;EAAK,CAAG,CAAC,EAAEK,QAAQ,CAACC,IAAI,CAAC;AACnF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepsea-components",
3
- "version": "5.7.6",
3
+ "version": "5.7.7",
4
4
  "description": "格数科技自用组件库",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -32,7 +32,7 @@
32
32
  "hls.js": "^1.5.17",
33
33
  "smooth-scrollbar": "^8.8.4",
34
34
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
35
- "deepsea-tools": "5.15.0"
35
+ "deepsea-tools": "5.15.1"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@types/react": "^18.3.1",
@@ -1,5 +1,6 @@
1
1
  "use client"
2
2
 
3
+ import { isBrowser } from "deepsea-tools"
3
4
  import { ComponentPropsWithoutRef, forwardRef, useImperativeHandle, useLayoutEffect, useRef } from "react"
4
5
  import { createPortal } from "react-dom"
5
6
 
@@ -22,5 +23,5 @@ export const Title = forwardRef<HTMLTitleElement, TitleProps>((props, ref) => {
22
23
  document.head.insertBefore(ele.current as HTMLTitleElement, title)
23
24
  }, [])
24
25
 
25
- return createPortal(<title ref={ele} {...props} />, document.head)
26
+ return isBrowser && createPortal(<title ref={ele} {...props} />, document.head)
26
27
  })