@gringow/gringow-react 0.2.2 → 0.2.3
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.mts +0 -1
- package/dist/index.mjs +6 -26
- package/dist/{g.mjs → nextjs.mjs} +1 -1
- package/dist/vite.d.mts +5 -0
- package/dist/vite.mjs +12 -0
- package/package.json +11 -1
- /package/dist/{g.d.mts → nextjs.d.mts} +0 -0
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -11,42 +11,22 @@ function changeLanguage(lang) {
|
|
|
11
11
|
window.dispatchEvent(LanguageChangeEvent.create(lang));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
var isServer = typeof window === "undefined";
|
|
15
|
-
function moduleName(isServer3) {
|
|
16
|
-
return !isServer3 ? "./browser.mjs" : ".";
|
|
17
|
-
}
|
|
18
|
-
import(
|
|
19
|
-
/* @vite-ignore */
|
|
20
|
-
moduleName(isServer)
|
|
21
|
-
);
|
|
22
|
-
function g(strings, ...replacements) {
|
|
23
|
-
const flatten = flatTemplateString(strings, replacements);
|
|
24
|
-
const cacheId = createCacheId(flatten);
|
|
25
|
-
const reactId = cacheId;
|
|
26
|
-
if (!isServer) {
|
|
27
|
-
return /* @__PURE__ */ jsx("g-gringow", { id: reactId, "data-cache-id": cacheId, "data-flatten": flatten, children: !GringowStore.cache ? flatten : null }, reactId);
|
|
28
|
-
} else {
|
|
29
|
-
return GringowStore.getCacheItem(cacheId).then((cache) => {
|
|
30
|
-
return /* @__PURE__ */ jsx("g-gringow", { id: reactId, "data-cache-id": cacheId, "data-flatten": flatten, children: GringowStore.cache ? cache : flatten ?? null }, reactId);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
14
|
function gid(strings, ...replacements) {
|
|
35
15
|
const flatten = flatTemplateString(strings, replacements);
|
|
36
16
|
const cacheId = createCacheId(flatten);
|
|
37
17
|
return cacheId;
|
|
38
18
|
}
|
|
39
|
-
var
|
|
40
|
-
function
|
|
41
|
-
return !
|
|
19
|
+
var isServer = typeof window === "undefined";
|
|
20
|
+
function moduleName(isServer2) {
|
|
21
|
+
return !isServer2 ? "./browser.mjs" : ".";
|
|
42
22
|
}
|
|
43
23
|
import(
|
|
44
24
|
/* @vite-ignore */
|
|
45
|
-
|
|
25
|
+
moduleName(isServer)
|
|
46
26
|
);
|
|
47
27
|
function Gringow({ cacheId, flatten }) {
|
|
48
28
|
const reactId = cacheId;
|
|
49
|
-
if (!
|
|
29
|
+
if (!isServer) {
|
|
50
30
|
return /* @__PURE__ */ jsx("g-gringow", { id: reactId, "data-cache-id": cacheId, "data-flatten": flatten || cacheId, children: !GringowStore.cache ? "" : null }, reactId);
|
|
51
31
|
} else {
|
|
52
32
|
return GringowStore.getCacheItem(cacheId).then((cache) => {
|
|
@@ -55,4 +35,4 @@ function Gringow({ cacheId, flatten }) {
|
|
|
55
35
|
}
|
|
56
36
|
}
|
|
57
37
|
|
|
58
|
-
export { Gringow, changeLanguage,
|
|
38
|
+
export { Gringow, changeLanguage, gid };
|
|
@@ -2,7 +2,7 @@ import { flatTemplateString, createCacheId } from '@gringow/gringow/browser';
|
|
|
2
2
|
import { GringowStore } from '@gringow/gringow-shadow/store';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
|
-
// src/
|
|
5
|
+
// src/nextjs.tsx
|
|
6
6
|
var isServer = typeof window === "undefined";
|
|
7
7
|
function moduleName(isServer2) {
|
|
8
8
|
return !isServer2 ? "./browser.mjs" : ".";
|
package/dist/vite.d.mts
ADDED
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { flatTemplateString, createCacheId } from '@gringow/gringow/browser';
|
|
2
|
+
import { GringowStore } from '@gringow/gringow-shadow/store';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/vite.tsx
|
|
6
|
+
function g(strings, ...replacements) {
|
|
7
|
+
const flatten = flatTemplateString(strings, replacements);
|
|
8
|
+
const cacheId = createCacheId(flatten);
|
|
9
|
+
return /* @__PURE__ */ jsx("g-gringow", { id: cacheId, "data-cache-id": cacheId, "data-flatten": flatten, children: !GringowStore.cache ? flatten : null }, cacheId);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { g };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gringow/gringow-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "React bindings for Gringow AI-powered translation tool",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,6 +15,16 @@
|
|
|
15
15
|
"import": "./dist/index.mjs",
|
|
16
16
|
"require": "./dist/index.mjs"
|
|
17
17
|
},
|
|
18
|
+
"./vite": {
|
|
19
|
+
"types": "./dist/vite.d.mts",
|
|
20
|
+
"import": "./dist/vite.mjs",
|
|
21
|
+
"require": "./dist/vite.mjs"
|
|
22
|
+
},
|
|
23
|
+
"./nextjs": {
|
|
24
|
+
"types": "./dist/nextjs.d.mts",
|
|
25
|
+
"import": "./dist/nextjs.mjs",
|
|
26
|
+
"require": "./dist/nextjs.mjs"
|
|
27
|
+
},
|
|
18
28
|
"./store": {
|
|
19
29
|
"types": "./dist/store.d.mts",
|
|
20
30
|
"import": "./dist/store.mjs",
|
|
File without changes
|