meticulous-ui 3.9.4 → 3.9.5
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/cjs/components/RootComponent/RootComponent.cjs +2 -3
- package/cjs/utils/fileToBase64.cjs +1 -0
- package/cjs/utils/getImageContentAsJson.cjs +1 -0
- package/components/RootComponent/RootComponent.js +8 -6
- package/package.json +1 -1
- package/utils/fileToBase64.js +7 -0
- package/utils/getImageContentAsJson.js +30 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),n=require("prop-types"),r=require("styled-components"),t=e=>e&&e.__esModule?e:{default:e},
|
|
2
|
-
font-size: 62.5%;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),n=require("prop-types"),r=require("react"),d=require("styled-components"),t=e=>e&&e.__esModule?e:{default:e},l=t(n),c=t(d),i=c.default.div`
|
|
3
2
|
-webkit-text-size-adjust: 100%;
|
|
4
|
-
`,o=({children:e,...s})=>u.jsx(i,{...s,children:e});o.propTypes={children:
|
|
3
|
+
`,o=({children:e,...s})=>(r.useMemo(()=>{document.documentElement.style.fontSize="62.5%"},[]),u.jsx(i,{...s,children:e}));o.propTypes={children:l.default.node};exports.default=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=r=>new Promise((o,t)=>{const e=new FileReader;e.onload=()=>o(e.result),e.onerror=a=>t(a),e.readAsDataURL(r)});exports.default=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=async(a,n)=>{const o=`https://vision.googleapis.com/v1/images:annotate?key=${n}`,r={requests:[{image:{content:a.replace(/^data:image\/(png|jpeg|jpg);base64,/,"")},features:[{type:"TEXT_DETECTION"}]}]};try{const t=await(await fetch(o,{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}})).json(),s=t.responses[0].fullTextAnnotation;return{success:!0,detectedLanguage:s.pages[0].property.detectedLanguages[0].languageCode,text:s.text,rawJson:t.responses[0]}}catch(e){return{success:!1,error:e.message}}};exports.default=c;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import r from "prop-types";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { useMemo as m } from "react";
|
|
4
|
+
import n from "styled-components";
|
|
5
|
+
const p = n.div`
|
|
6
6
|
-webkit-text-size-adjust: 100%;
|
|
7
|
-
`,
|
|
8
|
-
|
|
7
|
+
`, s = ({ children: o, ...t }) => (m(() => {
|
|
8
|
+
document.documentElement.style.fontSize = "62.5%";
|
|
9
|
+
}, []), /* @__PURE__ */ e(p, { ...t, children: o }));
|
|
10
|
+
s.propTypes = {
|
|
9
11
|
/** Content to render inside the root wrapper */
|
|
10
12
|
children: r.node
|
|
11
13
|
};
|
|
12
14
|
export {
|
|
13
|
-
|
|
15
|
+
s as default
|
|
14
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meticulous-ui",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.5",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"description": "A comprehensive React UI component library with a wide range of customizable components, icons, colors, and utilities for building modern web applications.",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const g = async (a, n) => {
|
|
2
|
+
const o = `https://vision.googleapis.com/v1/images:annotate?key=${n}`, r = {
|
|
3
|
+
requests: [
|
|
4
|
+
{
|
|
5
|
+
image: { content: a.replace(/^data:image\/(png|jpeg|jpg);base64,/, "") },
|
|
6
|
+
features: [{ type: "TEXT_DETECTION" }]
|
|
7
|
+
// Works for any language
|
|
8
|
+
}
|
|
9
|
+
]
|
|
10
|
+
};
|
|
11
|
+
try {
|
|
12
|
+
const t = await (await fetch(o, {
|
|
13
|
+
method: "POST",
|
|
14
|
+
body: JSON.stringify(r),
|
|
15
|
+
headers: { "Content-Type": "application/json" }
|
|
16
|
+
})).json(), s = t.responses[0].fullTextAnnotation;
|
|
17
|
+
return {
|
|
18
|
+
success: !0,
|
|
19
|
+
detectedLanguage: s.pages[0].property.detectedLanguages[0].languageCode,
|
|
20
|
+
text: s.text,
|
|
21
|
+
rawJson: t.responses[0]
|
|
22
|
+
// Full metadata including coordinates
|
|
23
|
+
};
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return { success: !1, error: e.message };
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
g as default
|
|
30
|
+
};
|