@goodware/svelte-kanban
Advanced tools
Comparing version 1.1.18 to 1.1.20
@@ -1,2 +0,2 @@ | ||
export declare const useCrdt = false; | ||
export declare const useCrdt = true; | ||
import type { Writable } from 'svelte/store'; | ||
@@ -3,0 +3,0 @@ type Board = { |
// https://dev.to/jdgamble555/the-correct-way-to-use-stores-in-sveltekit-3h6i | ||
// ==================== | ||
// When not using CRDT: | ||
// /* | ||
// ====================================== | ||
// When using CRDT comment out this block | ||
/* | ||
export const useCrdt = false; | ||
import { writable } from 'svelte/store'; | ||
// */ | ||
*/ | ||
// ==================================== | ||
// When using CRDT: | ||
/* | ||
// Also add the following dependencies: | ||
// When using CRDT uncomment this block | ||
// and add the following dependencies: | ||
// "@syncedstore/core": "0.6.0-alpha.0", | ||
// "@syncedstore/svelte": "0.6.0-alpha.0", | ||
// "y-webrtc": "^10.2.5" | ||
// /* | ||
export const useCrdt = true; | ||
@@ -19,3 +19,3 @@ import { syncedStore, getYjsDoc } from '@syncedstore/core'; | ||
import { WebrtcProvider } from 'y-webrtc'; | ||
*/ | ||
// */ | ||
import { getContext, setContext } from 'svelte'; | ||
@@ -26,16 +26,16 @@ export function getBoard() { | ||
return obj; | ||
// ==================== | ||
// When not using CRDT: | ||
// /* | ||
if (useCrdt) | ||
throw new Error('useCrdt should be false'); | ||
// ====================================== | ||
// When using CRDT comment out this block | ||
/* | ||
if (useCrdt) throw new Error('useCrdt should be false'); | ||
obj = writable({ columns: [] }); | ||
// */ | ||
// ================ | ||
// When using CRDT: | ||
/* | ||
*/ | ||
// ==================================================================== | ||
// When using CRDT uncomment this block | ||
// To enable the webrtc provider, run: PORT=4444 npx y-webrtc server.js | ||
if (!useCrdt) throw new Error('useCrdt should be true'); | ||
// /* | ||
if (!useCrdt) | ||
throw new Error('useCrdt should be true'); | ||
const store = syncedStore({ columns: [] }); | ||
obj = svelteSyncedStore(store) as unknown as Writable<Board>; | ||
obj = svelteSyncedStore(store); | ||
const rtc = new WebrtcProvider('svelte-kanban', getYjsDoc(store), { | ||
@@ -46,5 +46,5 @@ signaling: ['ws://localhost:4444'] | ||
setContext('web-rtc', rtc); | ||
*/ | ||
// */ | ||
setContext('board', obj); | ||
return obj; | ||
} |
{ | ||
"name": "@goodware/svelte-kanban", | ||
"version": "1.1.18", | ||
"version": "1.1.20", | ||
"scripts": { | ||
@@ -47,7 +47,9 @@ "build": "npm run build-vite && npm run package", | ||
"@sveltejs/package": "^2.2.2", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@typescript-eslint/parser": "^6.7.0", | ||
"@syncedstore/core": "0.6.0-alpha.0", | ||
"@syncedstore/svelte": "0.6.0-alpha.0", | ||
"@typescript-eslint/eslint-plugin": "^6.7.2", | ||
"@typescript-eslint/parser": "^6.7.2", | ||
"eslint": "^8.49.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-svelte": "^2.33.1", | ||
"eslint-plugin-svelte": "^2.33.2", | ||
"prettier": "^3.0.3", | ||
@@ -57,8 +59,9 @@ "prettier-plugin-svelte": "^3.0.3", | ||
"sass": "^1.67.0", | ||
"svelte": "^4.2.0", | ||
"svelte-check": "^3.5.1", | ||
"svelte": "^4.2.1", | ||
"svelte-check": "^3.5.2", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.2.2", | ||
"vite": "^4.4.9", | ||
"vitest": "^0.34.4" | ||
"vitest": "^0.34.4", | ||
"y-webrtc": "^10.2.5" | ||
}, | ||
@@ -65,0 +68,0 @@ "svelte": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
57241
22