Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated examples dependencies #61

Merged
merged 3 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .vscode/import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@
"twind": "https://esm.sh/[email protected]",
"twind/": "https://esm.sh/[email protected]/",

"$std/": "https://deno.land/[email protected]/",

"react": "https://esm.sh/[email protected]/compat",
"react-dom": "https://esm.sh/[email protected]/compat",
"@emotion/styled": "https://esm.sh/@emotion/[email protected]",
"@emotion/react": "https://esm.sh/@emotion/[email protected]",
"$std/": "https://deno.land/[email protected]/",

"ldkit": "../mod.ts",
"ldkit/namespaces": "../namespaces.ts",
"ldkit/sparql": "../sparql.ts",
"ldkit/rdf": "../rdf.ts",

"n3": "https://esm.sh/n3"
"ldkit/rdf": "../rdf.ts"
}
}
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
"deno.importMap": ".vscode/import_map.json",
"deno.documentPreloadLimit": 0,
"editor.defaultFormatter": "denoland.vscode-deno",
"editor.formatOnSave": true
"editor.tabSize": 2,
"editor.formatOnSave": true,
"deno.disablePaths": [
"examples/react-bulletin-boards",
"examples/react-dbpedia-actors",
"examples/react-query-todo-app"
]
}
3 changes: 2 additions & 1 deletion examples/basic/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"importMap": "../import_map.json",
"tasks": {
"main": "deno run --allow-net --allow-env ./main.ts"
}
},
"lock": false
}
3 changes: 2 additions & 1 deletion examples/custom-query/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"importMap": "../import_map.json",
"tasks": {
"main": "deno run --allow-net --allow-env ./main.ts"
}
},
"lock": false
}
12 changes: 1 addition & 11 deletions examples/import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
"ldkit": "../mod.ts",
"ldkit/namespaces": "../namespaces.ts",
"ldkit/sparql": "../sparql.ts",
"ldkit/rdf": "../rdf.ts",

"react": "https://esm.sh/[email protected]",
"react-dom": "https://esm.sh/[email protected]",
"@emotion/styled": "https://esm.sh/@emotion/styled",
"@emotion/react": "https://esm.sh/@emotion/react",
"n3": "https://esm.sh/n3",

"$/": "./library/",
"https://esm.sh/v94/[email protected]/deno/web-streams-ponyfill.js": "https://esm.sh/v77/[email protected]/deno/web-streams-ponyfill.js",
"xxhttps://esm.sh/v92/@types/[email protected]/rdf-js": "https://esm.sh/v92/[email protected]"
"ldkit/rdf": "../rdf.ts"
}
}
26 changes: 13 additions & 13 deletions examples/react-bulletin-boards/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
"preview": "vite preview"
},
"dependencies": {
"@comunica/query-sparql": "^2.6.9",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.11.12",
"ldkit": "^0.8.0",
"@comunica/query-sparql": "^2.10.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.18",
"@mui/material": "^5.14.18",
"ldkit": "^1.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^3.1.4",
"react-router-dom": "^6.8.2"
"react-error-boundary": "^4.0.11",
"react-router-dom": "^6.19.0"
},
"devDependencies": {
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^4.9.3",
"vite": "^4.1.0"
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@vitejs/plugin-react": "^4.2.0",
"typescript": "^5.2.2",
"vite": "^4.5.0"
}
}
4 changes: 0 additions & 4 deletions examples/react-bulletin-boards/src/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { DEFAULT_BOARD_IRI } from "./store";
import { Button, Grid, TextField } from "@mui/material";
import { useSearchParams } from "react-router-dom";

type Inputs = {
iri: string;
};

export const Form: React.FC = () => {
const [searchParams, setSearchParams] = useSearchParams();
const inputRef = useRef<HTMLInputElement>();
Expand Down
4 changes: 2 additions & 2 deletions examples/react-bulletin-boards/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
type Context,
createLens,
createNamespace,
createResource,
type SchemaInterface,
} from "ldkit";
import { dcterms, schema, xsd } from "ldkit/namespaces";
Expand Down Expand Up @@ -82,5 +82,5 @@ export const createInfosResource = (iri: string) => {
value: iri,
}],
};
return createResource(InformationSchema, context, engine);
return createLens(InformationSchema, context, engine);
};
20 changes: 10 additions & 10 deletions examples/react-dbpedia-actors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@mui/material": "^5.11.12",
"ldkit": "^0.8.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.14.18",
"ldkit": "^1.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^4.9.3",
"vite": "^4.1.0",
"vite-plugin-node-polyfills": "^0.7.0"
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@vitejs/plugin-react": "^4.2.0",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite-plugin-node-polyfills": "0.16.0"
}
}
4 changes: 2 additions & 2 deletions examples/react-dbpedia-actors/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Context, createResource, type SchemaInterface } from "ldkit";
import { type Context, createLens, type SchemaInterface } from "ldkit";
import { dbo, rdfs, xsd } from "ldkit/namespaces";

const ActorSchema = {
Expand All @@ -21,7 +21,7 @@ export const createLanguageContext = (language: string) => ({
export type ActorInterface = SchemaInterface<typeof ActorSchema>;

export const createLocalizedActorResource = (language: string) =>
createResource(ActorSchema, createLanguageContext(language));
createLens(ActorSchema, createLanguageContext(language));

export const favouriteActors = [
"http://dbpedia.org/resource/Brad_Pitt",
Expand Down
8 changes: 4 additions & 4 deletions examples/react-dbpedia-actors/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { nodePolyfills } from "vite-plugin-node-polyfills";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), nodePolyfills()],
})
});
24 changes: 12 additions & 12 deletions examples/react-query-todo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
"preview": "vite preview"
},
"dependencies": {
"@comunica/query-sparql-rdfjs": "^2.6.10",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@tanstack/react-query": "^4.26.1",
"ldkit": "^0.8.0",
"n3": "^1.16.3",
"@comunica/query-sparql-rdfjs": "^2.10.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@tanstack/react-query": "^5.8.4",
"ldkit": "^1.1.0",
"n3": "^1.17.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^4.9.3",
"vite": "^4.1.0",
"vite-plugin-node-polyfills": "^0.7.0"
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@vitejs/plugin-react": "^4.2.0",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite-plugin-node-polyfills": "^0.16.0"
}
}
11 changes: 7 additions & 4 deletions examples/react-query-todo-app/src/components/Items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Item: React.FC<ItemProps> = ({ item }) => {
const queryClient = useQueryClient();
const handleDeleteClicked = useCallback(() => {
Todos.delete(item).then(() => {
queryClient.invalidateQueries(["todos"]);
queryClient.invalidateQueries({ queryKey: ["todos"] });
});
}, [item, queryClient]);

Expand All @@ -33,7 +33,7 @@ const Item: React.FC<ItemProps> = ({ item }) => {
$id: item.$id,
done: !item.done,
}).then(() => {
queryClient.invalidateQueries(["todos"]);
queryClient.invalidateQueries({ queryKey: ["todos"] });
});
}, [item, queryClient]);

Expand All @@ -57,7 +57,10 @@ const Item: React.FC<ItemProps> = ({ item }) => {
};

export const Items: React.FC = () => {
const { isLoading, isError, data } = useQuery(["todos"], () => Todos.find());
const { isLoading, isError, data } = useQuery({
queryKey: ["todos"],
queryFn: () => Todos.find(),
});

if (isLoading) {
return <List>Loading...</List>;
Expand All @@ -69,7 +72,7 @@ export const Items: React.FC = () => {

return (
<List>
{data.map((item, index) => <Item item={item} key={index} />)}
{data!.map((item, index) => <Item item={item} key={index} />)}
</List>
);
};
4 changes: 2 additions & 2 deletions examples/react-query-todo-app/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
type Context,
createLens,
createNamespace,
createResource,
type SchemaInterface,
} from "ldkit";
import { xsd } from "ldkit/namespaces";
Expand Down Expand Up @@ -36,7 +36,7 @@ const engine = new Comunica();

export type TodoInterface = SchemaInterface<typeof TodoSchema>;

export const Todos = createResource(TodoSchema, context, engine);
export const Todos = createLens(TodoSchema, context, engine);

export const getRandomId = () =>
`https://todos/${1000 + Math.floor(Math.random() * 1000)}`;
Loading