@basictech/react 0.2.0-beta.1 → 0.2.0-beta.2
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/.turbo/turbo-build.log +10 -10
- package/changelog.md +6 -0
- package/dist/index.js +3 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -80
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @basictech/react@
|
|
3
|
+
> @basictech/react@0.2.0-beta.1 build
|
|
4
4
|
> tsup
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m319.29 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m681.95 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 98ms
|
|
17
|
+
[32mCJS[39m [1mdist/index.js [22m[32m320.14 KB[39m
|
|
18
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m681.99 KB[39m
|
|
19
|
+
[32mCJS[39m ⚡️ Build success in 100ms
|
|
20
20
|
[34mDTS[39m Build start
|
|
21
|
-
[32mDTS[39m ⚡️ Build success in
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
23
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
21
|
+
[32mDTS[39m ⚡️ Build success in 1093ms
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m975.00 B[39m
|
|
23
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m975.00 B[39m
|
package/changelog.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -5950,7 +5950,7 @@ var src_exports = {};
|
|
|
5950
5950
|
__export(src_exports, {
|
|
5951
5951
|
BasicProvider: () => BasicProvider,
|
|
5952
5952
|
useBasic: () => useBasic,
|
|
5953
|
-
useQuery: () => useLiveQuery
|
|
5953
|
+
useQuery: () => import_dexie_react_hooks.useLiveQuery
|
|
5954
5954
|
});
|
|
5955
5955
|
module.exports = __toCommonJS(src_exports);
|
|
5956
5956
|
|
|
@@ -8264,85 +8264,8 @@ function useBasic() {
|
|
|
8264
8264
|
return (0, import_react.useContext)(BasicContext);
|
|
8265
8265
|
}
|
|
8266
8266
|
|
|
8267
|
-
//
|
|
8268
|
-
var
|
|
8269
|
-
function useObservable(observableFactory, arg2, arg3) {
|
|
8270
|
-
var deps;
|
|
8271
|
-
var defaultResult;
|
|
8272
|
-
if (typeof observableFactory === "function") {
|
|
8273
|
-
deps = arg2 || [];
|
|
8274
|
-
defaultResult = arg3;
|
|
8275
|
-
} else {
|
|
8276
|
-
deps = [];
|
|
8277
|
-
defaultResult = arg2;
|
|
8278
|
-
}
|
|
8279
|
-
var monitor = import_react2.default.useRef({
|
|
8280
|
-
hasResult: false,
|
|
8281
|
-
result: defaultResult,
|
|
8282
|
-
error: null
|
|
8283
|
-
});
|
|
8284
|
-
var _a = import_react2.default.useReducer(function(x) {
|
|
8285
|
-
return x + 1;
|
|
8286
|
-
}, 0);
|
|
8287
|
-
_a[0];
|
|
8288
|
-
var triggerUpdate = _a[1];
|
|
8289
|
-
var observable = import_react2.default.useMemo(function() {
|
|
8290
|
-
var observable2 = typeof observableFactory === "function" ? observableFactory() : observableFactory;
|
|
8291
|
-
if (!observable2 || typeof observable2.subscribe !== "function") {
|
|
8292
|
-
if (observableFactory === observable2) {
|
|
8293
|
-
throw new TypeError("Given argument to useObservable() was neither a valid observable nor a function.");
|
|
8294
|
-
} else {
|
|
8295
|
-
throw new TypeError("Observable factory given to useObservable() did not return a valid observable.");
|
|
8296
|
-
}
|
|
8297
|
-
}
|
|
8298
|
-
if (!monitor.current.hasResult && typeof window !== "undefined") {
|
|
8299
|
-
if (typeof observable2.hasValue !== "function" || observable2.hasValue()) {
|
|
8300
|
-
if (typeof observable2.getValue === "function") {
|
|
8301
|
-
monitor.current.result = observable2.getValue();
|
|
8302
|
-
monitor.current.hasResult = true;
|
|
8303
|
-
} else {
|
|
8304
|
-
var subscription = observable2.subscribe(function(val) {
|
|
8305
|
-
monitor.current.result = val;
|
|
8306
|
-
monitor.current.hasResult = true;
|
|
8307
|
-
});
|
|
8308
|
-
if (typeof subscription === "function") {
|
|
8309
|
-
subscription();
|
|
8310
|
-
} else {
|
|
8311
|
-
subscription.unsubscribe();
|
|
8312
|
-
}
|
|
8313
|
-
}
|
|
8314
|
-
}
|
|
8315
|
-
}
|
|
8316
|
-
return observable2;
|
|
8317
|
-
}, deps);
|
|
8318
|
-
import_react2.default.useDebugValue(monitor.current.result);
|
|
8319
|
-
import_react2.default.useEffect(function() {
|
|
8320
|
-
var subscription = observable.subscribe(function(val) {
|
|
8321
|
-
var current = monitor.current;
|
|
8322
|
-
if (current.error !== null || current.result !== val) {
|
|
8323
|
-
current.error = null;
|
|
8324
|
-
current.result = val;
|
|
8325
|
-
current.hasResult = true;
|
|
8326
|
-
triggerUpdate();
|
|
8327
|
-
}
|
|
8328
|
-
}, function(err) {
|
|
8329
|
-
var current = monitor.current;
|
|
8330
|
-
if (current.error !== err) {
|
|
8331
|
-
current.error = err;
|
|
8332
|
-
triggerUpdate();
|
|
8333
|
-
}
|
|
8334
|
-
});
|
|
8335
|
-
return typeof subscription === "function" ? subscription : subscription.unsubscribe.bind(subscription);
|
|
8336
|
-
}, deps);
|
|
8337
|
-
if (monitor.current.error)
|
|
8338
|
-
throw monitor.current.error;
|
|
8339
|
-
return monitor.current.result;
|
|
8340
|
-
}
|
|
8341
|
-
function useLiveQuery(querier, deps, defaultResult) {
|
|
8342
|
-
return useObservable(function() {
|
|
8343
|
-
return liveQuery(querier);
|
|
8344
|
-
}, deps || [], defaultResult);
|
|
8345
|
-
}
|
|
8267
|
+
// src/index.ts
|
|
8268
|
+
var import_dexie_react_hooks = require("dexie-react-hooks");
|
|
8346
8269
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8347
8270
|
0 && (module.exports = {
|
|
8348
8271
|
BasicProvider,
|