@hanzogui/start-transition 3.0.5 → 4.3.1
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/cjs/index.cjs +17 -11
- package/dist/cjs/index.native.js +19 -13
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/index.test.cjs +9 -6
- package/dist/cjs/index.test.native.js +9 -6
- package/dist/cjs/index.test.native.js.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +5 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +6 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/index.test.mjs +9 -6
- package/dist/esm/index.test.mjs.map +1 -1
- package/dist/esm/index.test.native.js +9 -6
- package/dist/esm/index.test.native.js.map +1 -1
- package/package.json +2 -2
- package/src/index.test.js +4 -4
- package/src/index.ts +1 -1
- package/types/index.d.ts.map +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var index_exports = {};
|
|
22
24
|
__export(index_exports, {
|
|
@@ -25,5 +27,9 @@ __export(index_exports, {
|
|
|
25
27
|
module.exports = __toCommonJS(index_exports);
|
|
26
28
|
var import_react = require("react");
|
|
27
29
|
const startTransition = callback => {
|
|
28
|
-
|
|
30
|
+
if (false) {
|
|
31
|
+
callback();
|
|
32
|
+
} else {
|
|
33
|
+
(0, import_react.startTransition)(callback);
|
|
34
|
+
}
|
|
29
35
|
};
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -5,28 +5,34 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
23
|
+
value: true
|
|
22
24
|
}), mod);
|
|
23
25
|
var index_exports = {};
|
|
24
26
|
__export(index_exports, {
|
|
25
27
|
startTransition: () => startTransition
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
var import_react = require("react")
|
|
29
|
-
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
var startTransition = function (callback) {
|
|
32
|
+
if (true) {
|
|
30
33
|
callback();
|
|
31
|
-
}
|
|
34
|
+
} else {
|
|
35
|
+
(0, import_react.startTransition)(callback);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
32
38
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","startTransition","module","exports","import_react","require","callback"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","startTransition","module","exports","import_react","require","callback"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAwD,CAAAK,aAAA;AAEjD,IAAAK,YAAM,GAAAC,OAAmB;AAC9B,IAAAJ,eAAsC,YAAAA,CAAAK,QAAA;EAEpC;IACFA,QAAO;EAEL;IACF,IAAAF,YAAA,CAAAH,eAAA,EAAAK,QAAA;EACF","ignoreList":[]}
|
package/dist/cjs/index.test.cjs
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
var import_index = require("./index.cjs");
|
|
2
2
|
describe("startTransition", () => {
|
|
3
|
-
it("should call the callback directly if
|
|
4
|
-
process.env.
|
|
3
|
+
it("should call the callback directly if GUI_TARGET is not web", () => {
|
|
4
|
+
process.env.GUI_TARGET = "native";
|
|
5
5
|
const callback = jest.fn();
|
|
6
|
-
(0, import_index.startTransition)(callback)
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
(0, import_index.startTransition)(callback);
|
|
7
|
+
expect(callback).toHaveBeenCalled();
|
|
8
|
+
});
|
|
9
|
+
it("should proxy to react.startTransition if GUI_TARGET is web", () => {
|
|
10
|
+
process.env.GUI_TARGET = "web";
|
|
9
11
|
const callback = jest.fn();
|
|
10
|
-
(0, import_index.startTransition)(callback)
|
|
12
|
+
(0, import_index.startTransition)(callback);
|
|
13
|
+
expect(callback).not.toHaveBeenCalled();
|
|
11
14
|
});
|
|
12
15
|
});
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var import_index = require("./index.native.js");
|
|
4
4
|
describe("startTransition", function () {
|
|
5
|
-
it("should call the callback directly if
|
|
6
|
-
process.env.
|
|
5
|
+
it("should call the callback directly if GUI_TARGET is not web", function () {
|
|
6
|
+
process.env.GUI_TARGET = "native";
|
|
7
7
|
var callback = jest.fn();
|
|
8
|
-
(0, import_index.startTransition)(callback)
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
(0, import_index.startTransition)(callback);
|
|
9
|
+
expect(callback).toHaveBeenCalled();
|
|
10
|
+
});
|
|
11
|
+
it("should proxy to react.startTransition if GUI_TARGET is web", function () {
|
|
12
|
+
process.env.GUI_TARGET = "web";
|
|
11
13
|
var callback = jest.fn();
|
|
12
|
-
(0, import_index.startTransition)(callback)
|
|
14
|
+
(0, import_index.startTransition)(callback);
|
|
15
|
+
expect(callback).not.toHaveBeenCalled();
|
|
13
16
|
});
|
|
14
17
|
});
|
|
15
18
|
//# sourceMappingURL=index.test.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["import_index","require","describe","it","process","env","
|
|
1
|
+
{"version":3,"names":["import_index","require","describe","it","process","env","GUI_TARGET","callback","jest","fn","startTransition","expect","toHaveBeenCalled","not"],"sources":["../../src/index.test.js"],"sourcesContent":[null],"mappings":"AAAA;;AAEA,IAAAA,YAAS,GAAAC,OAAA,oBAAyB;AAChCC,QAAG;EACDC,EAAA,6DAAyB;IACzBC,OAAM,CAAAC,GAAA,CAAAC,UAAgB,GAAG;IACzB,IAAAC,QAAA,GAAAC,IAAA,CAAAC,EAAA;IACA,IAAAT,YAAe,CAAEU,eAAA,EAAiBH,QAAA;IACnCI,MAAA,CAAAJ,QAAA,EAAAK,gBAAA;EAED;EACET,EAAA,6DAAyB;IACzBC,OAAM,CAAAC,GAAA,CAAAC,UAAgB,GAAG;IACzB,IAAAC,QAAA,GAAAC,IAAA,CAAAC,EAAA;IAEA,IAAAT,YAAe,CAAEU,eAAI,EAAAH,QAAiB;IACvCI,MAAA,CAAAJ,QAAA,EAAAM,GAAA,CAAAD,gBAAA;EACF","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { startTransition as reactStartTransition } from "react";
|
|
2
2
|
const startTransition = callback => {
|
|
3
|
-
|
|
3
|
+
if (false) {
|
|
4
|
+
callback();
|
|
5
|
+
} else {
|
|
6
|
+
reactStartTransition(callback);
|
|
7
|
+
}
|
|
4
8
|
};
|
|
5
9
|
export { startTransition };
|
|
6
10
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["startTransition","reactStartTransition","callback"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,IAAmBC,oBAAA,QAA4B;AAEjD,MAAMD,eAAA,GAAmBE,QAAA,IAA6C;
|
|
1
|
+
{"version":3,"names":["startTransition","reactStartTransition","callback"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,IAAmBC,oBAAA,QAA4B;AAEjD,MAAMD,eAAA,GAAmBE,QAAA,IAA6C;EAC3E,IAAI,OAAkC;IAEpCA,QAAA,CAAS;EACX,OAAO;IAELD,oBAAA,CAAqBC,QAAQ;EAC/B;AACF","ignoreList":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { startTransition as reactStartTransition } from "react";
|
|
2
2
|
const startTransition = callback => {
|
|
3
|
-
|
|
3
|
+
if (false) {
|
|
4
|
+
callback();
|
|
5
|
+
} else {
|
|
6
|
+
reactStartTransition(callback);
|
|
7
|
+
}
|
|
4
8
|
};
|
|
5
9
|
export { startTransition };
|
|
6
10
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["startTransition","reactStartTransition","callback"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,IAAmBC,oBAAA,QAA4B;AAEjD,MAAMD,eAAA,GAAmBE,QAAA,IAA6C;
|
|
1
|
+
{"version":3,"names":["startTransition","reactStartTransition","callback"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,IAAmBC,oBAAA,QAA4B;AAEjD,MAAMD,eAAA,GAAmBE,QAAA,IAA6C;EAC3E,IAAI,OAAkC;IAEpCA,QAAA,CAAS;EACX,OAAO;IAELD,oBAAA,CAAqBC,QAAQ;EAC/B;AACF","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { startTransition as reactStartTransition } from "react";
|
|
1
2
|
var startTransition = function (callback) {
|
|
2
|
-
|
|
3
|
+
if (true) {
|
|
4
|
+
callback();
|
|
5
|
+
} else {
|
|
6
|
+
reactStartTransition(callback);
|
|
7
|
+
}
|
|
3
8
|
};
|
|
4
9
|
export { startTransition };
|
|
5
10
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["startTransition","callback"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["startTransition","reactStartTransition","callback"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,IAAmBC,oBAAA,QAA4B;AAEjD,IAAAD,eAAM,YAAAA,CAAmBE,QAA6C;EAC3E,IAAI;IAEFA,QAAA,CAAS;EACX,OAAO;IAELD,oBAAA,CAAqBC,QAAQ;EAC/B;AACF","ignoreList":[]}
|
package/dist/esm/index.test.mjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { startTransition } from "./index.mjs";
|
|
2
2
|
describe("startTransition", () => {
|
|
3
|
-
it("should call the callback directly if
|
|
4
|
-
process.env.
|
|
3
|
+
it("should call the callback directly if GUI_TARGET is not web", () => {
|
|
4
|
+
process.env.GUI_TARGET = "native";
|
|
5
5
|
const callback = jest.fn();
|
|
6
|
-
startTransition(callback)
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
startTransition(callback);
|
|
7
|
+
expect(callback).toHaveBeenCalled();
|
|
8
|
+
});
|
|
9
|
+
it("should proxy to react.startTransition if GUI_TARGET is web", () => {
|
|
10
|
+
process.env.GUI_TARGET = "web";
|
|
9
11
|
const callback = jest.fn();
|
|
10
|
-
startTransition(callback)
|
|
12
|
+
startTransition(callback);
|
|
13
|
+
expect(callback).not.toHaveBeenCalled();
|
|
11
14
|
});
|
|
12
15
|
});
|
|
13
16
|
//# sourceMappingURL=index.test.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["startTransition","describe","it","process","env","
|
|
1
|
+
{"version":3,"names":["startTransition","describe","it","process","env","GUI_TARGET","callback","jest","fn","expect","toHaveBeenCalled","not"],"sources":["../../src/index.test.js"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAEhCC,QAAA,CAAS,mBAAmB,MAAM;EAChCC,EAAA,CAAG,8DAA8D,MAAM;IACrEC,OAAA,CAAQC,GAAA,CAAIC,UAAA,GAAa;IACzB,MAAMC,QAAA,GAAWC,IAAA,CAAKC,EAAA,CAAG;IACzBR,eAAA,CAAgBM,QAAQ;IACxBG,MAAA,CAAOH,QAAQ,EAAEI,gBAAA,CAAiB;EACpC,CAAC;EAEDR,EAAA,CAAG,8DAA8D,MAAM;IACrEC,OAAA,CAAQC,GAAA,CAAIC,UAAA,GAAa;IACzB,MAAMC,QAAA,GAAWC,IAAA,CAAKC,EAAA,CAAG;IACzBR,eAAA,CAAgBM,QAAQ;IAExBG,MAAA,CAAOH,QAAQ,EAAEK,GAAA,CAAID,gBAAA,CAAiB;EACxC,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { startTransition } from "./index.native.js";
|
|
2
2
|
describe("startTransition", function () {
|
|
3
|
-
it("should call the callback directly if
|
|
4
|
-
process.env.
|
|
3
|
+
it("should call the callback directly if GUI_TARGET is not web", function () {
|
|
4
|
+
process.env.GUI_TARGET = "native";
|
|
5
5
|
var callback = jest.fn();
|
|
6
|
-
startTransition(callback)
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
startTransition(callback);
|
|
7
|
+
expect(callback).toHaveBeenCalled();
|
|
8
|
+
});
|
|
9
|
+
it("should proxy to react.startTransition if GUI_TARGET is web", function () {
|
|
10
|
+
process.env.GUI_TARGET = "web";
|
|
9
11
|
var callback = jest.fn();
|
|
10
|
-
startTransition(callback)
|
|
12
|
+
startTransition(callback);
|
|
13
|
+
expect(callback).not.toHaveBeenCalled();
|
|
11
14
|
});
|
|
12
15
|
});
|
|
13
16
|
//# sourceMappingURL=index.test.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["startTransition","describe","it","process","env","
|
|
1
|
+
{"version":3,"names":["startTransition","describe","it","process","env","GUI_TARGET","callback","jest","fn","expect","toHaveBeenCalled","not"],"sources":["../../src/index.test.js"],"sourcesContent":[null],"mappings":"AAAA,SAASA,eAAA,QAAuB;AAEhCC,QAAA,CAAS,mBAAmB,YAAM;EAChCC,EAAA,CAAG,8DAA8D,YAAM;IACrEC,OAAA,CAAQC,GAAA,CAAIC,UAAA,GAAa;IACzB,IAAAC,QAAM,GAAAC,IAAW,CAAAC,EAAK;IACtBR,eAAA,CAAgBM,QAAQ;IACxBG,MAAA,CAAOH,QAAQ,EAAEI,gBAAA,CAAiB;EACpC,CAAC;EAEDR,EAAA,CAAG,8DAA8D,YAAM;IACrEC,OAAA,CAAQC,GAAA,CAAIC,UAAA,GAAa;IACzB,IAAAC,QAAM,GAAAC,IAAW,CAAAC,EAAK;IACtBR,eAAA,CAAgBM,QAAQ;IAExBG,MAAA,CAAOH,QAAQ,EAAEK,GAAA,CAAID,gBAAA,CAAiB;EACxC,CAAC;AACH,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/start-transition",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"clean:build": "hanzo-gui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@hanzogui/build": "3.0.
|
|
38
|
+
"@hanzogui/build": "3.0.6",
|
|
39
39
|
"react": ">=19"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
package/src/index.test.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { startTransition } from './index'
|
|
2
2
|
|
|
3
3
|
describe('startTransition', () => {
|
|
4
|
-
it('should call the callback directly if
|
|
5
|
-
process.env.
|
|
4
|
+
it('should call the callback directly if GUI_TARGET is not web', () => {
|
|
5
|
+
process.env.GUI_TARGET = 'native'
|
|
6
6
|
const callback = jest.fn()
|
|
7
7
|
startTransition(callback)
|
|
8
8
|
expect(callback).toHaveBeenCalled()
|
|
9
9
|
})
|
|
10
10
|
|
|
11
|
-
it('should proxy to react.startTransition if
|
|
12
|
-
process.env.
|
|
11
|
+
it('should proxy to react.startTransition if GUI_TARGET is web', () => {
|
|
12
|
+
process.env.GUI_TARGET = 'web'
|
|
13
13
|
const callback = jest.fn()
|
|
14
14
|
startTransition(callback)
|
|
15
15
|
// Assuming react.startTransition works as expected
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { startTransition as reactStartTransition } from 'react'
|
|
2
2
|
|
|
3
3
|
export const startTransition = (callback: React.TransitionFunction): void => {
|
|
4
|
-
if (process.env.
|
|
4
|
+
if (process.env.GUI_TARGET !== 'web') {
|
|
5
5
|
// Pass-through function
|
|
6
6
|
callback()
|
|
7
7
|
} else {
|
package/types/index.d.ts.map
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
],
|
|
7
7
|
"version": 3,
|
|
8
8
|
"sourcesContent": [
|
|
9
|
-
"import { startTransition as reactStartTransition } from 'react'\n\nexport const startTransition = (callback: React.TransitionFunction): void => {\n if (process.env.
|
|
9
|
+
"import { startTransition as reactStartTransition } from 'react'\n\nexport const startTransition = (callback: React.TransitionFunction): void => {\n if (process.env.GUI_TARGET !== 'web') {\n // Pass-through function\n callback()\n } else {\n // Proxy to react.startTransition\n reactStartTransition(callback)\n }\n}\n"
|
|
10
10
|
]
|
|
11
11
|
}
|