mirror of
https://github.com/Rolands-Laucis/Socio.git
synced 2026-05-15 06:05:53 -06:00
upd framework demo to v1.10
This commit is contained in:
parent
964e0a7a24
commit
cb1898e090
3 changed files with 27 additions and 23 deletions
30
demos/full-stack_framework/package-lock.json
generated
30
demos/full-stack_framework/package-lock.json
generated
|
|
@ -1499,12 +1499,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/micromatch": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
|
||||
"integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
||||
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"braces": "^3.0.2",
|
||||
"braces": "^3.0.3",
|
||||
"picomatch": "^2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -2072,10 +2073,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "3.29.4",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz",
|
||||
"integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==",
|
||||
"version": "3.29.5",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz",
|
||||
"integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
|
|
@ -2324,9 +2326,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/socio": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/socio/-/socio-1.8.1.tgz",
|
||||
"integrity": "sha512-PsbMUBz+vljRbh7cLX5YfyGIK7yEeQoWGsn1AXxuY7p4V7sS523NACKwqkpXETpzQcb3WGGxDr9hIaYboArMfQ==",
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/socio/-/socio-1.10.0.tgz",
|
||||
"integrity": "sha512-JjUBRAuU7uoYCAOXH4kKdcCMiUq87/jJ9ydA60IBFDoqfvfmnWchTM+Fg2hdM4lP4Ef3is3OFtWSREVYXKF0oQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"js-yaml": "^4.1.0",
|
||||
"magic-string": "^0.30.5",
|
||||
|
|
@ -2756,10 +2759,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "4.5.3",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz",
|
||||
"integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==",
|
||||
"version": "4.5.5",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz",
|
||||
"integrity": "sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.18.10",
|
||||
"postcss": "^8.4.27",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ try {
|
|||
return socserv.SetPropVal('color', new_val);
|
||||
}
|
||||
});
|
||||
socserv.RegisterProp('num', 0);
|
||||
socserv.RegisterProp('num', {num:0});
|
||||
|
||||
socserv.RegisterLifecycleHookHandler('file_upload', async (client: SocioSession, files: SocioFiles) => {
|
||||
return (await SaveFilesToDiskPath(['.', 'upload_files'], files)).result;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<script lang="ts">
|
||||
//imports
|
||||
import { SocioClient } from "socio/dist/core-client";
|
||||
import { ClientMessageKind, SocioClient } from "socio/dist/core-client";
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
import {socio} from 'socio/dist/utils';
|
||||
import {socio} from 'socio/dist/sql-parsing';
|
||||
|
||||
import { slide } from "svelte/transition";
|
||||
import toast from 'svelte-french-toast'; //https://github.com/kbrgl/svelte-french-toast
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
});
|
||||
|
||||
//setup toasts
|
||||
sc.lifecycle_hooks.msg = (name:string, client_id:string, kind:string, data:any) => {
|
||||
if(['UPD', 'PROP_UPD'].includes(kind))
|
||||
sc.lifecycle_hooks.msg = (client_id:SocioClient, kind:ClientMessageKind, data:any) => {
|
||||
if(['UPD', 'PROP_UPD'].includes(ClientMessageKind[kind]))
|
||||
toast('An update came in from the Socio Server.', {style:'background: #0D0D0E; color: #fff; padding:2px;',position: "bottom-center", duration:1000});
|
||||
// else if(kind == 'ERR')
|
||||
// toast.error(`An error arrived for a query or prop. MSG ID:${data.id}`,{position: "bottom-center", duration:500});
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
let ready = false;
|
||||
let user_count = 0, Users: { userid: number; name: string; num: number }[] = [];
|
||||
let insert_fields = { name: "Bob", num: 42 };
|
||||
let color_prop = "#ffffff", num = 0;
|
||||
let color_prop = "#ffffff", num = {num:0};
|
||||
let progress = writable(0);
|
||||
|
||||
onMount(async () => {
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
);
|
||||
|
||||
log(await sc.SubscribeProp("color", c => color_prop = c as string)); //can await the sub to get success status
|
||||
sc.SubscribeProp("num", n => num = n as number, {receive_initial_update:false}); //by default SubscribeProp will run this as soon as the sub is successful, but u can opt out of that like this
|
||||
num = await sc.Prop("num"); //returns a js Object Proxy, that manages the subscription for you, such that this obj is always synced for everyone
|
||||
});
|
||||
|
||||
//cleanup for dev server reloads.
|
||||
|
|
@ -148,9 +148,9 @@
|
|||
<hr>
|
||||
|
||||
<section>
|
||||
<Bloom style="--b:2px;--s:0.4;--s_h:2;--b_h:8px;--c:1;--c_h:2;"><Button on:click={() => sc.SetProp('num', --num)}>-</Button></Bloom>
|
||||
<input type="number" bind:value={num} on:change={() => sc.SetProp('num', num)}>
|
||||
<Bloom style="--b:2px;--s:0.4;--s_h:2;--b_h:8px;--c:1;--c_h:2;"><Button on:click={() => sc.SetProp('num', ++num)}>+</Button></Bloom>
|
||||
<Bloom style="--b:2px;--s:0.4;--s_h:2;--b_h:8px;--c:1;--c_h:2;"><Button on:click={() => num.num--}>-</Button></Bloom>
|
||||
<input type="number" bind:value={num.num}>
|
||||
<Bloom style="--b:2px;--s:0.4;--s_h:2;--b_h:8px;--c:1;--c_h:2;"><Button on:click={() => num.num++}>+</Button></Bloom>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue