@ldo/svelte 1.0.0-alpha.32 → 1.0.0-alpha.36
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/_virtual/rolldown_runtime.cjs +30 -0
- package/dist/createLdoSvelteMethods.cjs +75 -0
- package/dist/{esm/createLdoSvelteMethods.js → createLdoSvelteMethods.d.cts} +19 -24
- package/dist/createLdoSvelteMethods.d.cts.map +1 -0
- package/dist/createLdoSvelteMethods.d.ts +66 -0
- package/dist/createLdoSvelteMethods.d.ts.map +1 -0
- package/dist/createLdoSvelteMethods.js +75 -0
- package/dist/createLdoSvelteMethods.js.map +1 -0
- package/dist/index.cjs +17 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/methods/useLdo.cjs +33 -0
- package/dist/methods/useLdo.d.cts +65 -0
- package/dist/methods/useLdo.d.cts.map +1 -0
- package/dist/methods/useLdo.d.ts +65 -0
- package/dist/methods/useLdo.d.ts.map +1 -0
- package/dist/methods/useLdo.js +33 -0
- package/dist/methods/useLdo.js.map +1 -0
- package/dist/methods/useLinkQuery.cjs +35 -0
- package/dist/methods/useLinkQuery.d.cts +18 -0
- package/dist/methods/useLinkQuery.d.cts.map +1 -0
- package/dist/methods/useLinkQuery.d.ts +18 -0
- package/dist/methods/useLinkQuery.d.ts.map +1 -0
- package/dist/methods/useLinkQuery.js +35 -0
- package/dist/methods/useLinkQuery.js.map +1 -0
- package/dist/methods/useMatchObject.cjs +23 -0
- package/dist/methods/useMatchObject.d.cts +18 -0
- package/dist/methods/useMatchObject.d.cts.map +1 -0
- package/dist/methods/useMatchObject.d.ts +18 -0
- package/dist/methods/useMatchObject.d.ts.map +1 -0
- package/dist/methods/useMatchObject.js +24 -0
- package/dist/methods/useMatchObject.js.map +1 -0
- package/dist/methods/useMatchSubject.cjs +23 -0
- package/dist/methods/useMatchSubject.d.cts +18 -0
- package/dist/methods/useMatchSubject.d.cts.map +1 -0
- package/dist/methods/useMatchSubject.d.ts +18 -0
- package/dist/methods/useMatchSubject.d.ts.map +1 -0
- package/dist/methods/useMatchSubject.js +24 -0
- package/dist/methods/useMatchSubject.js.map +1 -0
- package/dist/methods/useResource.cjs +37 -0
- package/dist/methods/useResource.d.cts +29 -0
- package/dist/methods/useResource.d.cts.map +1 -0
- package/dist/methods/useResource.d.ts +29 -0
- package/dist/methods/useResource.d.ts.map +1 -0
- package/dist/methods/useResource.js +37 -0
- package/dist/methods/useResource.js.map +1 -0
- package/dist/methods/useSubject.cjs +24 -0
- package/dist/methods/useSubject.d.cts +22 -0
- package/dist/methods/useSubject.d.cts.map +1 -0
- package/dist/methods/useSubject.d.ts +22 -0
- package/dist/methods/useSubject.d.ts.map +1 -0
- package/dist/methods/useSubject.js +25 -0
- package/dist/methods/useSubject.js.map +1 -0
- package/dist/methods/useSubscribeToResource.cjs +18 -0
- package/dist/methods/useSubscribeToResource.d.cts +15 -0
- package/dist/methods/useSubscribeToResource.d.cts.map +1 -0
- package/dist/methods/useSubscribeToResource.d.ts +15 -0
- package/dist/methods/useSubscribeToResource.d.ts.map +1 -0
- package/dist/methods/useSubscribeToResource.js +18 -0
- package/dist/methods/useSubscribeToResource.js.map +1 -0
- package/dist/util/useTrackingProxy.cjs +40 -0
- package/dist/util/useTrackingProxy.js +40 -0
- package/dist/util/useTrackingProxy.js.map +1 -0
- package/package.json +21 -23
- package/src/createLdoSvelteMethods.tsx +7 -7
- package/src/index.ts +8 -8
- package/src/methods/useLinkQuery.ts +1 -1
- package/src/methods/useMatchObject.ts +1 -1
- package/src/methods/useMatchSubject.ts +1 -1
- package/src/methods/useSubject.ts +1 -1
- package/dist/cjs/createLdoSvelteMethods.cjs +0 -74
- package/dist/cjs/createLdoSvelteMethods.js.map +0 -1
- package/dist/cjs/index.cjs +0 -25
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/methods/useLdo.cjs +0 -59
- package/dist/cjs/methods/useLdo.js.map +0 -1
- package/dist/cjs/methods/useLinkQuery.cjs +0 -36
- package/dist/cjs/methods/useLinkQuery.js.map +0 -1
- package/dist/cjs/methods/useMatchObject.cjs +0 -22
- package/dist/cjs/methods/useMatchObject.js.map +0 -1
- package/dist/cjs/methods/useMatchSubject.cjs +0 -22
- package/dist/cjs/methods/useMatchSubject.js.map +0 -1
- package/dist/cjs/methods/useResource.cjs +0 -51
- package/dist/cjs/methods/useResource.js.map +0 -1
- package/dist/cjs/methods/useSubject.cjs +0 -24
- package/dist/cjs/methods/useSubject.js.map +0 -1
- package/dist/cjs/methods/useSubscribeToResource.cjs +0 -17
- package/dist/cjs/methods/useSubscribeToResource.js.map +0 -1
- package/dist/cjs/util/useTrackingProxy.cjs +0 -37
- package/dist/cjs/util/useTrackingProxy.js.map +0 -1
- package/dist/esm/createLdoSvelteMethods.js.map +0 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/methods/useLdo.js +0 -56
- package/dist/esm/methods/useLdo.js.map +0 -1
- package/dist/esm/methods/useLinkQuery.js +0 -33
- package/dist/esm/methods/useLinkQuery.js.map +0 -1
- package/dist/esm/methods/useMatchObject.js +0 -19
- package/dist/esm/methods/useMatchObject.js.map +0 -1
- package/dist/esm/methods/useMatchSubject.js +0 -19
- package/dist/esm/methods/useMatchSubject.js.map +0 -1
- package/dist/esm/methods/useResource.js +0 -48
- package/dist/esm/methods/useResource.js.map +0 -1
- package/dist/esm/methods/useSubject.js +0 -21
- package/dist/esm/methods/useSubject.js.map +0 -1
- package/dist/esm/methods/useSubscribeToResource.js +0 -14
- package/dist/esm/methods/useSubscribeToResource.js.map +0 -1
- package/dist/esm/util/useTrackingProxy.js +0 -34
- package/dist/esm/util/useTrackingProxy.js.map +0 -1
- package/dist/types/createLdoSvelteMethods.d.ts +0 -59
- package/dist/types/createLdoSvelteMethods.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/methods/useLdo.d.ts +0 -59
- package/dist/types/methods/useLdo.d.ts.map +0 -1
- package/dist/types/methods/useLinkQuery.d.ts +0 -11
- package/dist/types/methods/useLinkQuery.d.ts.map +0 -1
- package/dist/types/methods/useMatchObject.d.ts +0 -11
- package/dist/types/methods/useMatchObject.d.ts.map +0 -1
- package/dist/types/methods/useMatchSubject.d.ts +0 -11
- package/dist/types/methods/useMatchSubject.d.ts.map +0 -1
- package/dist/types/methods/useResource.d.ts +0 -23
- package/dist/types/methods/useResource.d.ts.map +0 -1
- package/dist/types/methods/useSubject.d.ts +0 -17
- package/dist/types/methods/useSubject.d.ts.map +0 -1
- package/dist/types/methods/useSubscribeToResource.d.ts +0 -8
- package/dist/types/methods/useSubscribeToResource.d.ts.map +0 -1
- package/dist/types/util/useTrackingProxy.d.ts +0 -10
- package/dist/types/util/useTrackingProxy.d.ts.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const __ldo_connected = require_rolldown_runtime.__toESM(require("@ldo/connected"));
|
|
3
|
+
const svelte_store = require_rolldown_runtime.__toESM(require("svelte/store"));
|
|
4
|
+
const svelte = require_rolldown_runtime.__toESM(require("svelte"));
|
|
5
|
+
|
|
6
|
+
//#region src/util/useTrackingProxy.ts
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*
|
|
10
|
+
* A hook for tracking proxies
|
|
11
|
+
*/
|
|
12
|
+
function useTrackingProxy(shapeType, createLdo, dataset) {
|
|
13
|
+
const forceUpdateInfo = {};
|
|
14
|
+
const forceUpdate = () => {
|
|
15
|
+
dataset.removeListenerFromAllEvents(forceUpdate);
|
|
16
|
+
const builder = (0, __ldo_connected.createTrackingProxyBuilder)(dataset, shapeType, forceUpdate);
|
|
17
|
+
const linkedDataObject = createLdo(builder);
|
|
18
|
+
forceUpdateInfo.ldo = linkedDataObject;
|
|
19
|
+
if (forceUpdateInfo.set && forceUpdateInfo.ldo) forceUpdateInfo.set(forceUpdateInfo.ldo);
|
|
20
|
+
};
|
|
21
|
+
forceUpdate({}, "", [
|
|
22
|
+
void 0,
|
|
23
|
+
void 0,
|
|
24
|
+
void 0,
|
|
25
|
+
void 0
|
|
26
|
+
]);
|
|
27
|
+
const store = (0, svelte_store.writable)(forceUpdateInfo.ldo, (set) => {
|
|
28
|
+
forceUpdateInfo.set = set;
|
|
29
|
+
return () => {
|
|
30
|
+
dataset.removeListenerFromAllEvents(forceUpdate);
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
(0, svelte.onDestroy)(() => {
|
|
34
|
+
dataset.removeListenerFromAllEvents(forceUpdate);
|
|
35
|
+
});
|
|
36
|
+
return { subscribe: store.subscribe };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.useTrackingProxy = useTrackingProxy;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createTrackingProxyBuilder } from "@ldo/connected";
|
|
2
|
+
import { writable } from "svelte/store";
|
|
3
|
+
import { onDestroy } from "svelte";
|
|
4
|
+
|
|
5
|
+
//#region src/util/useTrackingProxy.ts
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*
|
|
9
|
+
* A hook for tracking proxies
|
|
10
|
+
*/
|
|
11
|
+
function useTrackingProxy(shapeType, createLdo, dataset) {
|
|
12
|
+
const forceUpdateInfo = {};
|
|
13
|
+
const forceUpdate = () => {
|
|
14
|
+
dataset.removeListenerFromAllEvents(forceUpdate);
|
|
15
|
+
const builder = createTrackingProxyBuilder(dataset, shapeType, forceUpdate);
|
|
16
|
+
const linkedDataObject = createLdo(builder);
|
|
17
|
+
forceUpdateInfo.ldo = linkedDataObject;
|
|
18
|
+
if (forceUpdateInfo.set && forceUpdateInfo.ldo) forceUpdateInfo.set(forceUpdateInfo.ldo);
|
|
19
|
+
};
|
|
20
|
+
forceUpdate({}, "", [
|
|
21
|
+
void 0,
|
|
22
|
+
void 0,
|
|
23
|
+
void 0,
|
|
24
|
+
void 0
|
|
25
|
+
]);
|
|
26
|
+
const store = writable(forceUpdateInfo.ldo, (set) => {
|
|
27
|
+
forceUpdateInfo.set = set;
|
|
28
|
+
return () => {
|
|
29
|
+
dataset.removeListenerFromAllEvents(forceUpdate);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
onDestroy(() => {
|
|
33
|
+
dataset.removeListenerFromAllEvents(forceUpdate);
|
|
34
|
+
});
|
|
35
|
+
return { subscribe: store.subscribe };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { useTrackingProxy };
|
|
40
|
+
//# sourceMappingURL=useTrackingProxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTrackingProxy.js","names":["shapeType: ShapeType<Type>","createLdo: (builder: LdoBuilder<Type>) => ReturnType","dataset: LdoDataset","forceUpdateInfo: {\n set?: (item: ReturnType) => void;\n ldo?: ReturnType;\n }","forceUpdate: nodeEventListener"],"sources":["../../src/util/useTrackingProxy.ts"],"sourcesContent":["import type { LdoBuilder } from \"@ldo/ldo\";\nimport type { LdoBase, LdoDataset, ShapeType } from \"@ldo/ldo\";\nimport { createTrackingProxyBuilder } from \"@ldo/connected\";\nimport { writable, type Readable } from \"svelte/store\";\nimport type { nodeEventListener } from \"@ldo/subscribable-dataset\";\nimport { onDestroy } from \"svelte\";\n\n/**\n * @internal\n *\n * A hook for tracking proxies\n */\nexport function useTrackingProxy<Type extends LdoBase, ReturnType>(\n shapeType: ShapeType<Type>,\n createLdo: (builder: LdoBuilder<Type>) => ReturnType,\n dataset: LdoDataset,\n): Readable<ReturnType> {\n const forceUpdateInfo: {\n set?: (item: ReturnType) => void;\n ldo?: ReturnType;\n } = {};\n\n const forceUpdate: nodeEventListener = () => {\n dataset.removeListenerFromAllEvents(forceUpdate);\n const builder = createTrackingProxyBuilder(dataset, shapeType, forceUpdate);\n const linkedDataObject = createLdo(builder);\n forceUpdateInfo.ldo = linkedDataObject;\n if (forceUpdateInfo.set && forceUpdateInfo.ldo)\n forceUpdateInfo.set(forceUpdateInfo.ldo);\n };\n forceUpdate({}, \"\", [undefined, undefined, undefined, undefined]);\n\n // The Svelte store\n const store = writable<ReturnType>(forceUpdateInfo.ldo, (set) => {\n forceUpdateInfo.set = set;\n\n return () => {\n dataset.removeListenerFromAllEvents(forceUpdate);\n };\n });\n\n onDestroy(() => {\n dataset.removeListenerFromAllEvents(forceUpdate);\n });\n\n return {\n subscribe: store.subscribe,\n };\n}\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,iBACdA,WACAC,WACAC,SACsB;CACtB,MAAMC,kBAGF,CAAE;CAEN,MAAMC,cAAiC,MAAM;AAC3C,UAAQ,4BAA4B,YAAY;EAChD,MAAM,UAAU,2BAA2B,SAAS,WAAW,YAAY;EAC3E,MAAM,mBAAmB,UAAU,QAAQ;AAC3C,kBAAgB,MAAM;AACtB,MAAI,gBAAgB,OAAO,gBAAgB,IACzC,iBAAgB,IAAI,gBAAgB,IAAI;CAC3C;AACD,aAAY,CAAE,GAAE,IAAI;;;;;CAA4C,EAAC;CAGjE,MAAM,QAAQ,SAAqB,gBAAgB,KAAK,CAAC,QAAQ;AAC/D,kBAAgB,MAAM;AAEtB,SAAO,MAAM;AACX,WAAQ,4BAA4B,YAAY;EACjD;CACF,EAAC;AAEF,WAAU,MAAM;AACd,UAAQ,4BAA4B,YAAY;CACjD,EAAC;AAEF,QAAO,EACL,WAAW,MAAM,UAClB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldo/svelte",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.36",
|
|
4
4
|
"description": "A Svelte library for LDO.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/
|
|
7
|
-
"module": "./dist/
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
8
|
"svelte": "src/index.ts",
|
|
9
|
-
"types": "./dist/
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
15
20
|
},
|
|
16
21
|
"./package.json": "./package.json"
|
|
17
22
|
},
|
|
@@ -19,10 +24,8 @@
|
|
|
19
24
|
"dev": "concurrently \"npm run dev:pod\" \"npm run dev:app\"",
|
|
20
25
|
"dev:pod": "vite-node ./example/test-server/runServer.ts",
|
|
21
26
|
"dev:app": "vite --config vite.config.example.ts",
|
|
22
|
-
"build": "rimraf dist &&
|
|
23
|
-
"
|
|
24
|
-
"build:esm": "tsc --project tsconfig.esm.json",
|
|
25
|
-
"test": "jest --coverage",
|
|
27
|
+
"build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 tsdown",
|
|
28
|
+
"test": "vitest run --coverage",
|
|
26
29
|
"lint": "eslint . --ext .js,.ts,.svelte --fix --no-error-on-unmatched-pattern",
|
|
27
30
|
"format": "prettier --write .",
|
|
28
31
|
"prepublishOnly": "npm run build",
|
|
@@ -39,22 +42,17 @@
|
|
|
39
42
|
},
|
|
40
43
|
"homepage": "https://github.com/o-development/ldo/tree/main/packages/svelte#readme",
|
|
41
44
|
"devDependencies": {
|
|
42
|
-
"@ldo/test-solid-server": "^1.0.0-alpha.
|
|
45
|
+
"@ldo/test-solid-server": "^1.0.0-alpha.36",
|
|
43
46
|
"@sveltejs/vite-plugin-svelte": "^2.5.3",
|
|
44
47
|
"@testing-library/jest-dom": "^6.6.3",
|
|
45
48
|
"@testing-library/svelte": "^5.2.7",
|
|
46
49
|
"@tsconfig/svelte": "^5.0.4",
|
|
47
|
-
"@types/jest": "^29.5.14",
|
|
48
50
|
"concurrently": "^9.1.2",
|
|
49
51
|
"eslint-plugin-svelte3": "^4.0.0",
|
|
50
52
|
"identity-obj-proxy": "^3.0.0",
|
|
51
|
-
"jest": "^29.7.0",
|
|
52
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
53
53
|
"rimraf": "^5.0.10",
|
|
54
54
|
"svelte": "^3.59.2",
|
|
55
|
-
"svelte-jester": "^5.0.0",
|
|
56
55
|
"svelte-preprocess": "^5.1.4",
|
|
57
|
-
"ts-jest": "^29.3.2",
|
|
58
56
|
"tslib": "^2.8.1",
|
|
59
57
|
"typescript": "^5.8.3",
|
|
60
58
|
"vite": "^4.5.0",
|
|
@@ -65,11 +63,11 @@
|
|
|
65
63
|
"svelte": "^3.50.0"
|
|
66
64
|
},
|
|
67
65
|
"dependencies": {
|
|
68
|
-
"@ldo/connected": "^1.0.0-alpha.
|
|
69
|
-
"@ldo/jsonld-dataset-proxy": "^1.0.0-alpha.
|
|
70
|
-
"@ldo/ldo": "^1.0.0-alpha.
|
|
71
|
-
"@ldo/rdf-utils": "^1.0.0-alpha.
|
|
72
|
-
"@ldo/subscribable-dataset": "^1.0.0-alpha.
|
|
66
|
+
"@ldo/connected": "^1.0.0-alpha.36",
|
|
67
|
+
"@ldo/jsonld-dataset-proxy": "^1.0.0-alpha.36",
|
|
68
|
+
"@ldo/ldo": "^1.0.0-alpha.36",
|
|
69
|
+
"@ldo/rdf-utils": "^1.0.0-alpha.36",
|
|
70
|
+
"@ldo/subscribable-dataset": "^1.0.0-alpha.36",
|
|
73
71
|
"tsx": "^4.19.4"
|
|
74
72
|
},
|
|
75
73
|
"files": [
|
|
@@ -79,5 +77,5 @@
|
|
|
79
77
|
"publishConfig": {
|
|
80
78
|
"access": "public"
|
|
81
79
|
},
|
|
82
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "e97a0f8b5fa7f609e5070e472b1b63ff8a9502a8"
|
|
83
81
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { createUseLdo } from "./methods/useLdo
|
|
2
|
+
import { createUseLdo } from "./methods/useLdo";
|
|
3
3
|
import {
|
|
4
4
|
createConnectedLdoDataset,
|
|
5
5
|
type ConnectedPlugin,
|
|
6
6
|
} from "@ldo/connected";
|
|
7
|
-
import { createUseMatchObject } from "./methods/useMatchObject
|
|
8
|
-
import { createUseMatchSubject } from "./methods/useMatchSubject
|
|
9
|
-
import { createUseResource } from "./methods/useResource
|
|
10
|
-
import { createUseSubject } from "./methods/useSubject
|
|
11
|
-
import { createUseSubscribeToResource } from "./methods/useSubscribeToResource
|
|
12
|
-
import { createUseLinkQuery } from "./methods/useLinkQuery
|
|
7
|
+
import { createUseMatchObject } from "./methods/useMatchObject";
|
|
8
|
+
import { createUseMatchSubject } from "./methods/useMatchSubject";
|
|
9
|
+
import { createUseResource } from "./methods/useResource";
|
|
10
|
+
import { createUseSubject } from "./methods/useSubject";
|
|
11
|
+
import { createUseSubscribeToResource } from "./methods/useSubscribeToResource";
|
|
12
|
+
import { createUseLinkQuery } from "./methods/useLinkQuery";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* A function that creates all common react functions given specific plugin.
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./createLdoSvelteMethods
|
|
1
|
+
export * from "./createLdoSvelteMethods";
|
|
2
2
|
|
|
3
|
-
export * from "./methods/useLdo
|
|
4
|
-
export * from "./methods/useMatchObject
|
|
5
|
-
export * from "./methods/useMatchSubject
|
|
6
|
-
export * from "./methods/useResource
|
|
7
|
-
export * from "./methods/useSubject
|
|
8
|
-
export * from "./methods/useSubscribeToResource
|
|
9
|
-
export * from "./methods/useLinkQuery
|
|
3
|
+
export * from "./methods/useLdo";
|
|
4
|
+
export * from "./methods/useMatchObject";
|
|
5
|
+
export * from "./methods/useMatchSubject";
|
|
6
|
+
export * from "./methods/useResource";
|
|
7
|
+
export * from "./methods/useSubject";
|
|
8
|
+
export * from "./methods/useSubscribeToResource";
|
|
9
|
+
export * from "./methods/useLinkQuery";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { type LdoBase, type LdoBuilder, type ShapeType } from "@ldo/ldo";
|
|
9
9
|
import type { SubjectNode } from "@ldo/rdf-utils";
|
|
10
10
|
import { type Readable } from "svelte/store";
|
|
11
|
-
import { useTrackingProxy } from "../util/useTrackingProxy
|
|
11
|
+
import { useTrackingProxy } from "../util/useTrackingProxy";
|
|
12
12
|
import { onDestroy } from "svelte";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -2,7 +2,7 @@ import type { LdoBase, LdoBuilder, LdSet, ShapeType } from "@ldo/ldo";
|
|
|
2
2
|
import type { QuadMatch } from "@ldo/rdf-utils";
|
|
3
3
|
import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
|
|
4
4
|
import type { Readable } from "svelte/store";
|
|
5
|
-
import { useTrackingProxy } from "../util/useTrackingProxy
|
|
5
|
+
import { useTrackingProxy } from "../util/useTrackingProxy";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LdoBase, LdoBuilder, LdSet, ShapeType } from "@ldo/ldo";
|
|
2
2
|
import type { QuadMatch } from "@ldo/rdf-utils";
|
|
3
3
|
import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
|
|
4
|
-
import { useTrackingProxy } from "../util/useTrackingProxy
|
|
4
|
+
import { useTrackingProxy } from "../util/useTrackingProxy";
|
|
5
5
|
import type { Readable } from "svelte/store";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -3,7 +3,7 @@ import type { ShapeType } from "@ldo/ldo";
|
|
|
3
3
|
import type { LdoBuilder } from "@ldo/ldo";
|
|
4
4
|
import type { LdoBase } from "@ldo/ldo";
|
|
5
5
|
|
|
6
|
-
import { useTrackingProxy } from "../util/useTrackingProxy
|
|
6
|
+
import { useTrackingProxy } from "../util/useTrackingProxy";
|
|
7
7
|
import type { ConnectedLdoDataset, ConnectedPlugin } from "@ldo/connected";
|
|
8
8
|
import type { Readable } from "svelte/store";
|
|
9
9
|
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createLdoSvelteMethods = createLdoSvelteMethods;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
const useLdo_js_1 = require("./methods/useLdo.js");
|
|
6
|
-
const connected_1 = require("@ldo/connected");
|
|
7
|
-
const useMatchObject_js_1 = require("./methods/useMatchObject.js");
|
|
8
|
-
const useMatchSubject_js_1 = require("./methods/useMatchSubject.js");
|
|
9
|
-
const useResource_js_1 = require("./methods/useResource.js");
|
|
10
|
-
const useSubject_js_1 = require("./methods/useSubject.js");
|
|
11
|
-
const useSubscribeToResource_js_1 = require("./methods/useSubscribeToResource.js");
|
|
12
|
-
const useLinkQuery_js_1 = require("./methods/useLinkQuery.js");
|
|
13
|
-
/**
|
|
14
|
-
* A function that creates all common react functions given specific plugin.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* `methods.ts`
|
|
18
|
-
* ```tyepscript
|
|
19
|
-
* import { solidConnectedPlugin } from "@ldo/connected-solid";
|
|
20
|
-
* import { nextGraphConnectedPlugin } from "@ldo/connected-nextgraph";
|
|
21
|
-
* import { createLdoReactMethods } from "@ldo/react";
|
|
22
|
-
*
|
|
23
|
-
* // Export the results to be used in the reset of the application
|
|
24
|
-
* export const {
|
|
25
|
-
* dataset,
|
|
26
|
-
* useLdo,
|
|
27
|
-
* useMatchObject,
|
|
28
|
-
* useMatchSubject,
|
|
29
|
-
* useResource,
|
|
30
|
-
* useSubject,
|
|
31
|
-
* useSubscribeToResource,
|
|
32
|
-
* useLinkQuery,
|
|
33
|
-
* } = createLdoReactMethods([
|
|
34
|
-
* solidConnectedPlugin,
|
|
35
|
-
* nextGraphConnectedPlugin
|
|
36
|
-
* ]);
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* `App.tsx`
|
|
40
|
-
* ```typescript
|
|
41
|
-
* import react, { FunctionComponent } from "react";
|
|
42
|
-
* import { PostShShapeType } from "./.ldo/posts.shapeType.ts";
|
|
43
|
-
* import { useResource, useSubject } from "./methods.ts";
|
|
44
|
-
*
|
|
45
|
-
* const UseSubjectTest: FunctionComponent = () => {
|
|
46
|
-
* const resource = useResource(SAMPLE_DATA_URI);
|
|
47
|
-
* const post = useSubject(PostShShapeType, `${SAMPLE_DATA_URI}#Post1`);
|
|
48
|
-
* if (resource.isLoading() || !post) return <p>loading</p>;
|
|
49
|
-
*
|
|
50
|
-
* return (
|
|
51
|
-
* <ul>
|
|
52
|
-
* {post.publisher.map((publisher) => {
|
|
53
|
-
* return <li key={publisher["@id"]}>{publisher["@id"]}</li>;
|
|
54
|
-
* })}
|
|
55
|
-
* </ul>
|
|
56
|
-
* );
|
|
57
|
-
* };
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
function createLdoSvelteMethods(plugins) {
|
|
61
|
-
const dataset = (0, connected_1.createConnectedLdoDataset)(plugins);
|
|
62
|
-
dataset.setMaxListeners(1000);
|
|
63
|
-
return {
|
|
64
|
-
dataset,
|
|
65
|
-
useLdo: (0, useLdo_js_1.createUseLdo)(dataset),
|
|
66
|
-
useMatchObject: (0, useMatchObject_js_1.createUseMatchObject)(dataset),
|
|
67
|
-
useMatchSubject: (0, useMatchSubject_js_1.createUseMatchSubject)(dataset),
|
|
68
|
-
useResource: (0, useResource_js_1.createUseResource)(dataset),
|
|
69
|
-
useSubject: (0, useSubject_js_1.createUseSubject)(dataset),
|
|
70
|
-
useSubscribeToResource: (0, useSubscribeToResource_js_1.createUseSubscribeToResource)(dataset),
|
|
71
|
-
useLinkQuery: (0, useLinkQuery_js_1.createUseLinkQuery)(dataset),
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=createLdoSvelteMethods.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createLdoSvelteMethods.js","sourceRoot":"","sources":["../../src/createLdoSvelteMethods.tsx"],"names":[],"mappings":";;AA4DA,wDAgBC;AA5ED,uDAAuD;AACvD,mDAAmD;AACnD,8CAGwB;AACxB,mEAAmE;AACnE,qEAAqE;AACrE,6DAA6D;AAC7D,2DAA2D;AAC3D,mFAAmF;AACnF,+DAA+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,SAAgB,sBAAsB,CAEpC,OAAgB;IAChB,MAAM,OAAO,GAAG,IAAA,qCAAyB,EAAC,OAAO,CAAC,CAAC;IACnD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAE9B,OAAO;QACL,OAAO;QACP,MAAM,EAAE,IAAA,wBAAY,EAAU,OAAO,CAAC;QACtC,cAAc,EAAE,IAAA,wCAAoB,EAAU,OAAO,CAAC;QACtD,eAAe,EAAE,IAAA,0CAAqB,EAAU,OAAO,CAAC;QACxD,WAAW,EAAE,IAAA,kCAAiB,EAAU,OAAO,CAAC;QAChD,UAAU,EAAE,IAAA,gCAAgB,EAAU,OAAO,CAAC;QAC9C,sBAAsB,EAAE,IAAA,wDAA4B,EAAU,OAAO,CAAC;QACtE,YAAY,EAAE,IAAA,oCAAkB,EAAU,OAAO,CAAC;KACnD,CAAC;AACJ,CAAC"}
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./createLdoSvelteMethods.js"), exports);
|
|
18
|
-
__exportStar(require("./methods/useLdo.js"), exports);
|
|
19
|
-
__exportStar(require("./methods/useMatchObject.js"), exports);
|
|
20
|
-
__exportStar(require("./methods/useMatchSubject.js"), exports);
|
|
21
|
-
__exportStar(require("./methods/useResource.js"), exports);
|
|
22
|
-
__exportStar(require("./methods/useSubject.js"), exports);
|
|
23
|
-
__exportStar(require("./methods/useSubscribeToResource.js"), exports);
|
|
24
|
-
__exportStar(require("./methods/useLinkQuery.js"), exports);
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAE5C,sDAAoC;AACpC,8DAA4C;AAC5C,+DAA6C;AAC7C,2DAAyC;AACzC,0DAAwC;AACxC,sEAAoD;AACpD,4DAA0C"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUseLdo = createUseLdo;
|
|
4
|
-
const connected_1 = require("@ldo/connected");
|
|
5
|
-
const ldo_1 = require("@ldo/ldo");
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
* Creates the useLdoHook
|
|
9
|
-
*/
|
|
10
|
-
function createUseLdo(dataset) {
|
|
11
|
-
const toReturn = {
|
|
12
|
-
dataset,
|
|
13
|
-
/**
|
|
14
|
-
* Gets a resource
|
|
15
|
-
*/
|
|
16
|
-
getResource: dataset.getResource.bind(dataset),
|
|
17
|
-
/**
|
|
18
|
-
* Set the context
|
|
19
|
-
*/
|
|
20
|
-
setContext: dataset.setContext.bind(dataset),
|
|
21
|
-
/**
|
|
22
|
-
* Returns a Linked Data Object for a subject
|
|
23
|
-
* @param shapeType The shape type for the data
|
|
24
|
-
* @param subject Subject Node
|
|
25
|
-
* @returns A Linked Data Object
|
|
26
|
-
*/
|
|
27
|
-
getSubject(shapeType, subject) {
|
|
28
|
-
return dataset.usingType(shapeType).fromSubject(subject);
|
|
29
|
-
},
|
|
30
|
-
/**
|
|
31
|
-
* Begins tracking changes to eventually commit for a new subject
|
|
32
|
-
* @param shapeType The shape type that defines the created data
|
|
33
|
-
* @param subject The RDF subject for a Linked Data Object
|
|
34
|
-
* @param resources Any number of resources to which this data should be written
|
|
35
|
-
* @returns A Linked Data Object to modify and commit
|
|
36
|
-
*/
|
|
37
|
-
createData(shapeType, subject, resource, ...additionalResources) {
|
|
38
|
-
return dataset.createData(shapeType, subject, resource, ...additionalResources);
|
|
39
|
-
},
|
|
40
|
-
/**
|
|
41
|
-
* Begins tracking changes to eventually commit
|
|
42
|
-
* @param input A linked data object to track changes on
|
|
43
|
-
* @param resources
|
|
44
|
-
*/
|
|
45
|
-
changeData: connected_1.changeData,
|
|
46
|
-
/**
|
|
47
|
-
* Commits the transaction to the global dataset, syncing all subscribing
|
|
48
|
-
* components and Solid Pods
|
|
49
|
-
*/
|
|
50
|
-
commitData(input) {
|
|
51
|
-
const inputDataset = (0, ldo_1.getDataset)(input);
|
|
52
|
-
return inputDataset.commitToRemote();
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
return function useLdo() {
|
|
56
|
-
return toReturn;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=useLdo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLdo.js","sourceRoot":"","sources":["../../../src/methods/useLdo.ts"],"names":[],"mappings":";;AA+EA,oCAmEC;AAlJD,8CAMwB;AACxB,kCAAoE;AAoEpE;;;GAGG;AACH,SAAgB,YAAY,CAC1B,OAAqC;IAErC,MAAM,QAAQ,GAAG;QACf,OAAO;QACP;;WAEG;QACH,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC;QAC9C;;WAEG;QACH,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;QAC5C;;;;;WAKG;QACH,UAAU,CACR,SAA0B,EAC1B,OAA6B;YAE7B,OAAO,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3D,CAAC;QACD;;;;;;WAMG;QACH,UAAU,CACR,SAA0B,EAC1B,OAA6B,EAC7B,QAA8C,EAC9C,GAAG,mBAA2D;YAE9D,OAAO,OAAO,CAAC,UAAU,CACvB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,mBAAmB,CACvB,CAAC;QACJ,CAAC;QACD;;;;WAIG;QACH,UAAU,EAAE,sBAAU;QACtB;;;WAGG;QACH,UAAU,CACR,KAAc;YAEd,MAAM,YAAY,GAAG,IAAA,gBAAU,EAC7B,KAAK,CACqC,CAAC;YAC7C,OAAO,YAAY,CAAC,cAAc,EAAE,CAAC;QACvC,CAAC;KACF,CAAC;IACF,OAAO,SAAS,MAAM;QACpB,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUseLinkQuery = createUseLinkQuery;
|
|
4
|
-
const useTrackingProxy_js_1 = require("../util/useTrackingProxy.js");
|
|
5
|
-
const svelte_1 = require("svelte");
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*
|
|
9
|
-
* Creates a useMatchSubject function.
|
|
10
|
-
*/
|
|
11
|
-
function createUseLinkQuery(dataset) {
|
|
12
|
-
/**
|
|
13
|
-
* Returns an array of matching linked data objects. Triggers a rerender if
|
|
14
|
-
* the data is updated.
|
|
15
|
-
*/
|
|
16
|
-
return function useQueryLink(shapeType, startingResource, startingSubject, linkQuery) {
|
|
17
|
-
const resource = dataset.getResource(startingResource);
|
|
18
|
-
console.log(resource);
|
|
19
|
-
const lq = dataset
|
|
20
|
-
.usingType(shapeType)
|
|
21
|
-
.startLinkQuery(resource, startingSubject, linkQuery);
|
|
22
|
-
console.log("Calling subscribe");
|
|
23
|
-
lq.subscribe();
|
|
24
|
-
console.log("After call subscribe");
|
|
25
|
-
(0, svelte_1.onDestroy)(() => {
|
|
26
|
-
lq.unsubscribeAll();
|
|
27
|
-
});
|
|
28
|
-
const fromSubject = (builder) => {
|
|
29
|
-
if (!startingSubject)
|
|
30
|
-
return;
|
|
31
|
-
return builder.fromSubject(startingSubject);
|
|
32
|
-
};
|
|
33
|
-
return (0, useTrackingProxy_js_1.useTrackingProxy)(shapeType, fromSubject, dataset);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=useLinkQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLinkQuery.js","sourceRoot":"","sources":["../../../src/methods/useLinkQuery.ts"],"names":[],"mappings":";;AAkBA,gDAwCC;AAhDD,qEAA+D;AAC/D,mCAAmC;AAEnC;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,OAAqC;IAErC;;;OAGG;IACH,OAAO,SAAS,YAAY,CAI1B,SAA0B,EAC1B,gBAAwB,EACxB,eAAqC,EACrC,SAAqB;QAErB,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,MAAM,EAAE,GAAG,OAAO;aACf,SAAS,CAAC,SAAS,CAAC;aACpB,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACjC,EAAE,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QAEpC,IAAA,kBAAS,EAAC,GAAG,EAAE;YACb,EAAE,CAAC,cAAc,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,CAAC,OAAyB,EAAE,EAAE;YAChD,IAAI,CAAC,eAAe;gBAAE,OAAO;YAC7B,OAAO,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,OAAO,IAAA,sCAAgB,EACrB,SAAS,EACT,WAAW,EACX,OAAO,CACuD,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUseMatchObject = createUseMatchObject;
|
|
4
|
-
const useTrackingProxy_js_1 = require("../util/useTrackingProxy.js");
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*
|
|
8
|
-
* Creates a useMatchObject function
|
|
9
|
-
*/
|
|
10
|
-
function createUseMatchObject(dataset) {
|
|
11
|
-
/**
|
|
12
|
-
* Returns an array of matching items and triggers a rerender when that data
|
|
13
|
-
* is updated.
|
|
14
|
-
*/
|
|
15
|
-
return function useMatchObject(shapeType, subject, predicate, graph) {
|
|
16
|
-
const matchObject = (builder) => {
|
|
17
|
-
return builder.matchObject(subject, predicate, graph);
|
|
18
|
-
};
|
|
19
|
-
return (0, useTrackingProxy_js_1.useTrackingProxy)(shapeType, matchObject, dataset);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=useMatchObject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMatchObject.js","sourceRoot":"","sources":["../../../src/methods/useMatchObject.ts"],"names":[],"mappings":";;AAWA,oDAmBC;AA1BD,qEAA+D;AAE/D;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,OAAqC;IAErC;;;OAGG;IACH,OAAO,SAAS,cAAc,CAC5B,SAA0B,EAC1B,OAA+B,EAC/B,SAAiC,EACjC,KAA6B;QAE7B,MAAM,WAAW,GAAG,CAAC,OAAyB,EAAE,EAAE;YAChD,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,IAAA,sCAAgB,EAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUseMatchSubject = createUseMatchSubject;
|
|
4
|
-
const useTrackingProxy_js_1 = require("../util/useTrackingProxy.js");
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*
|
|
8
|
-
* Creates a useMatchSubject function.
|
|
9
|
-
*/
|
|
10
|
-
function createUseMatchSubject(dataset) {
|
|
11
|
-
/**
|
|
12
|
-
* Returns an array of matching linked data objects. Triggers a rerender if
|
|
13
|
-
* the data is updated.
|
|
14
|
-
*/
|
|
15
|
-
return function useMatchSubject(shapeType, predicate, object, graph) {
|
|
16
|
-
const matchSubject = (builder) => {
|
|
17
|
-
return builder.matchSubject(predicate, object, graph);
|
|
18
|
-
};
|
|
19
|
-
return (0, useTrackingProxy_js_1.useTrackingProxy)(shapeType, matchSubject, dataset);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=useMatchSubject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMatchSubject.js","sourceRoot":"","sources":["../../../src/methods/useMatchSubject.ts"],"names":[],"mappings":";;AAWA,sDAmBC;AA3BD,qEAA+D;AAG/D;;;;GAIG;AACH,SAAgB,qBAAqB,CACnC,OAAqC;IAErC;;;OAGG;IACH,OAAO,SAAS,eAAe,CAC7B,SAA0B,EAC1B,SAAiC,EACjC,MAA8B,EAC9B,KAA6B;QAE7B,MAAM,YAAY,GAAG,CAAC,OAAyB,EAAE,EAAE;YACjD,OAAO,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,IAAA,sCAAgB,EAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUseResource = createUseResource;
|
|
4
|
-
const store_1 = require("svelte/store");
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*
|
|
8
|
-
* Creates a useResource function.
|
|
9
|
-
*/
|
|
10
|
-
function createUseResource(dataset) {
|
|
11
|
-
/**
|
|
12
|
-
* Returns a resource and triggers a rerender if that resource is updated.
|
|
13
|
-
*/
|
|
14
|
-
return function useResource(uri, options) {
|
|
15
|
-
let resource;
|
|
16
|
-
// Get the resource based on incoming data
|
|
17
|
-
if (uri) {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
resource = dataset.getResource(uri);
|
|
20
|
-
// Run read operations if necissary
|
|
21
|
-
if (!options?.suppressInitialRead) {
|
|
22
|
-
if (options?.reloadOnMount) {
|
|
23
|
-
resource.read();
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
resource.readIfUnfetched();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
resource = undefined;
|
|
32
|
-
}
|
|
33
|
-
// The Svelte store
|
|
34
|
-
const store = (0, store_1.writable)(resource, (set) => {
|
|
35
|
-
const onResourceUpdate = () => {
|
|
36
|
-
set(resource);
|
|
37
|
-
};
|
|
38
|
-
if (resource) {
|
|
39
|
-
resource.on("update", onResourceUpdate);
|
|
40
|
-
// TODO: handle subscriptions
|
|
41
|
-
return () => {
|
|
42
|
-
resource.off("update", onResourceUpdate);
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
subscribe: store.subscribe,
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=useResource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useResource.js","sourceRoot":"","sources":["../../../src/methods/useResource.ts"],"names":[],"mappings":";;AAsCA,8CAuDC;AAxFD,wCAAuD;AA4BvD;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,OAAqC;IAErC;;OAEG;IACH,OAAO,SAAS,WAAW,CAKzB,GAAa,EACb,OAAkC;QAElC,IAAI,QAA4D,CAAC;QACjE,0CAA0C;QAC1C,IAAI,GAAG,EAAE,CAAC;YACR,8DAA8D;YAC9D,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAQ,CAAC;YAC3C,mCAAmC;YACnC,IAAI,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC;gBAClC,IAAI,OAAO,EAAE,aAAa,EAAE,CAAC;oBAC3B,QAAS,CAAC,IAAI,EAAE,CAAC;gBACnB,CAAC;qBAAM,CAAC;oBACN,QAAS,CAAC,eAAe,EAAE,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC;QAED,mBAAmB;QACnB,MAAM,KAAK,GAAG,IAAA,gBAAQ,EACpB,QAAQ,EACR,CAAC,GAAG,EAAE,EAAE;YACN,MAAM,gBAAgB,GAAG,GAAG,EAAE;gBAC5B,GAAG,CAAC,QAAQ,CAAC,CAAC;YAChB,CAAC,CAAC;YAEF,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBAExC,6BAA6B;gBAE7B,OAAO,GAAG,EAAE;oBACV,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBAC3C,CAAC,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUseSubject = createUseSubject;
|
|
4
|
-
const useTrackingProxy_js_1 = require("../util/useTrackingProxy.js");
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*
|
|
8
|
-
* Creates a useSubject function.
|
|
9
|
-
*/
|
|
10
|
-
function createUseSubject(dataset) {
|
|
11
|
-
/**
|
|
12
|
-
* Returns a Linked Data Object based on the provided subject. Triggers a
|
|
13
|
-
* rerender if the data is udpated.
|
|
14
|
-
*/
|
|
15
|
-
return function useSubject(shapeType, subject) {
|
|
16
|
-
const fromSubject = (builder) => {
|
|
17
|
-
if (!subject)
|
|
18
|
-
return;
|
|
19
|
-
return builder.fromSubject(subject);
|
|
20
|
-
};
|
|
21
|
-
return (0, useTrackingProxy_js_1.useTrackingProxy)(shapeType, fromSubject, dataset);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=useSubject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSubject.js","sourceRoot":"","sources":["../../../src/methods/useSubject.ts"],"names":[],"mappings":";;AA6BA,4CAkBC;AA1CD,qEAA+D;AAmB/D;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,OAAqC;IAErC;;;OAGG;IACH,OAAO,SAAS,UAAU,CACxB,SAA0B,EAC1B,OAA8B;QAE9B,MAAM,WAAW,GAAG,CAAC,OAAyB,EAAE,EAAE;YAChD,IAAI,CAAC,OAAO;gBAAE,OAAO;YACrB,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC;QAEF,OAAO,IAAA,sCAAgB,EAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createUseSubscribeToResource = createUseSubscribeToResource;
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*
|
|
7
|
-
* Creates a useSubscribeToResource function.
|
|
8
|
-
*/
|
|
9
|
-
function createUseSubscribeToResource(dataset) {
|
|
10
|
-
/**
|
|
11
|
-
* Starts a subscription to a resource.
|
|
12
|
-
*/
|
|
13
|
-
return function useSubscribeToResource(...uris) {
|
|
14
|
-
throw new Error("Subscribe to Resource is Not Implemented for Svelte");
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=useSubscribeToResource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSubscribeToResource.js","sourceRoot":"","sources":["../../../src/methods/useSubscribeToResource.ts"],"names":[],"mappings":";;AAOA,oEASC;AAdD;;;;GAIG;AACH,SAAgB,4BAA4B,CAC1C,OAAqC;IAErC;;OAEG;IACH,OAAO,SAAS,sBAAsB,CAAC,GAAG,IAAc;QACtD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC"}
|