@_linked/react 1.3.1 → 1.4.0-next.20260706110130
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/CHANGELOG.md +16 -0
- package/lib/esm/package.d.ts +24 -24
- package/lib/esm/utils/LinkedComponent.js +2 -2
- package/lib/esm/utils/LinkedComponent.js.map +1 -1
- package/lib/esm/utils/LinkedComponentClass.d.ts +1 -1
- package/package.json +13 -13
- package/lib/cjs/index.d.ts +0 -7
- package/lib/cjs/index.js +0 -26
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/loaders/LinkedInfinityLoader.d.ts +0 -12
- package/lib/cjs/loaders/LinkedInfinityLoader.js +0 -22
- package/lib/cjs/loaders/LinkedInfinityLoader.js.map +0 -1
- package/lib/cjs/package.d.ts +0 -52
- package/lib/cjs/package.js +0 -38
- package/lib/cjs/package.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/utils/ClassNames.d.ts +0 -2
- package/lib/cjs/utils/ClassNames.js +0 -9
- package/lib/cjs/utils/ClassNames.js.map +0 -1
- package/lib/cjs/utils/Hooks.d.ts +0 -5
- package/lib/cjs/utils/Hooks.js +0 -54
- package/lib/cjs/utils/Hooks.js.map +0 -1
- package/lib/cjs/utils/LinkedComponent.d.ts +0 -116
- package/lib/cjs/utils/LinkedComponent.js +0 -518
- package/lib/cjs/utils/LinkedComponent.js.map +0 -1
- package/lib/cjs/utils/LinkedComponentClass.d.ts +0 -12
- package/lib/cjs/utils/LinkedComponentClass.js +0 -34
- package/lib/cjs/utils/LinkedComponentClass.js.map +0 -1
- package/lib/cjs/utils/useQueryContext.d.ts +0 -7
- package/lib/cjs/utils/useQueryContext.js +0 -18
- package/lib/cjs/utils/useQueryContext.js.map +0 -1
- package/lib/esm/package.json +0 -3
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
3
|
-
import { LinkedComponentProps } from './LinkedComponent.js';
|
|
4
|
-
/**
|
|
5
|
-
* Class component base for linked components.
|
|
6
|
-
*/
|
|
7
|
-
export declare class LinkedComponentClass<ShapeClass extends Shape, P = {}, S = any> extends React.Component<P & LinkedComponentProps<ShapeClass>, S> {
|
|
8
|
-
props: Readonly<P & LinkedComponentProps<ShapeClass>> & Readonly<React.PropsWithChildren>;
|
|
9
|
-
private _shape;
|
|
10
|
-
get sourceShape(): ShapeClass;
|
|
11
|
-
componentDidUpdate(prevProps: Readonly<P & LinkedComponentProps<ShapeClass>>): void;
|
|
12
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LinkedComponentClass = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
/**
|
|
9
|
-
* Class component base for linked components.
|
|
10
|
-
*/
|
|
11
|
-
class LinkedComponentClass extends react_1.default.Component {
|
|
12
|
-
get sourceShape() {
|
|
13
|
-
if (typeof this._shape === 'undefined') {
|
|
14
|
-
if (!this.props.source) {
|
|
15
|
-
this._shape = null;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
let shapeClass = this.constructor['shape'];
|
|
19
|
-
if (!shapeClass) {
|
|
20
|
-
throw new Error(`${this.constructor.name} is not linked to a shape`);
|
|
21
|
-
}
|
|
22
|
-
this._shape = new shapeClass(this.props.source);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return this._shape;
|
|
26
|
-
}
|
|
27
|
-
componentDidUpdate(prevProps) {
|
|
28
|
-
if (prevProps.source !== this.props.source) {
|
|
29
|
-
this._shape = undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.LinkedComponentClass = LinkedComponentClass;
|
|
34
|
-
//# sourceMappingURL=LinkedComponentClass.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LinkedComponentClass.js","sourceRoot":"","sources":["../../../src/utils/LinkedComponentClass.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B;;GAEG;AACH,MAAa,oBAIX,SAAQ,eAAK,CAAC,SAAkD;IAIhE,IAAI,WAAW;QACb,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,IAAI,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC3C,IAAI,CAAC,UAAU,EAAE,CAAC;oBAChB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,2BAA2B,CAAC,CAAC;gBACvE,CAAC;gBACD,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAe,CAAC;YAChE,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,kBAAkB,CAChB,SAAyD;QAEzD,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC3C,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,CAAC;IACH,CAAC;CACF;AA9BD,oDA8BC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Shape } from '@_linked/core/shapes/Shape';
|
|
2
|
-
/**
|
|
3
|
-
* React hook that registers a value in the global query context.
|
|
4
|
-
* Keeps the context in sync with the component's state — sets on
|
|
5
|
-
* mount / value change and clears on unmount.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useQueryContext(name: string, value: any, shapeType?: new (...args: any[]) => Shape): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useQueryContext = useQueryContext;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const QueryContext_1 = require("@_linked/core/queries/QueryContext");
|
|
6
|
-
/**
|
|
7
|
-
* React hook that registers a value in the global query context.
|
|
8
|
-
* Keeps the context in sync with the component's state — sets on
|
|
9
|
-
* mount / value change and clears on unmount.
|
|
10
|
-
*/
|
|
11
|
-
function useQueryContext(name, value, shapeType) {
|
|
12
|
-
(0, react_1.useEffect)(() => {
|
|
13
|
-
if (value) {
|
|
14
|
-
(0, QueryContext_1.setQueryContext)(name, value, shapeType);
|
|
15
|
-
}
|
|
16
|
-
}, [name, value, shapeType]);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=useQueryContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useQueryContext.js","sourceRoot":"","sources":["../../../src/utils/useQueryContext.ts"],"names":[],"mappings":";;AASA,0CAUC;AAnBD,iCAAgC;AAChC,qEAAmE;AAGnE;;;;GAIG;AACH,SAAgB,eAAe,CAC7B,IAAY,EACZ,KAAU,EACV,SAAyC;IAEzC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,KAAK,EAAE,CAAC;YACV,IAAA,8BAAe,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
package/lib/esm/package.json
DELETED