From 5b34876f88cf4c59370a8e286123716ec0b6d69a Mon Sep 17 00:00:00 2001 From: tmelliott Date: Fri, 7 Feb 2025 00:48:42 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20tmelliot?= =?UTF-8?q?t/ts@8f62f4d85f2fc7d3427b960f47e18aaaf7477ea8=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- articles/simple-react-app.html | 6 +++--- authors.html | 4 ++-- index.html | 4 ++-- pkgdown.yml | 2 +- reference/ts_logical.html | 11 +++++++++++ search.json | 2 +- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/articles/simple-react-app.html b/articles/simple-react-app.html index 815bc95..55c534f 100644 --- a/articles/simple-react-app.html +++ b/articles/simple-react-app.html @@ -121,9 +121,9 @@ server code and Typescript schema for the app.

Create the React app

-

I’m using Vite to create the app, -but you could use any framework. Whatever you use, you’ll need to be -able to bundle the code (including libraries such as zod).

+

I’m using Vite to create the app, but +you could use any framework. Whatever you use, you’ll need to be able to +bundle the code (including libraries such as zod).

pnpm create vite faithful-demo --template vanilla-ts
 cd faithful-demo
 pnpm install
diff --git a/authors.html b/authors.html
index 43adda2..5713f60 100644
--- a/authors.html
+++ b/authors.html
@@ -48,11 +48,11 @@
       

Elliott T (2025). -ts: Helper functions for writing type safe functions for rserve-ts. +ts: Helper Functions for Writing Type-safe Functions for rserve-ts. R package version 0.1.0, http://tomelliott.co.nz/ts/.

@Manual{,
-  title = {ts: Helper functions for writing type safe functions for rserve-ts},
+  title = {ts: Helper Functions for Writing Type-safe Functions for rserve-ts},
   author = {Tom Elliott},
   year = {2025},
   note = {R package version 0.1.0},
diff --git a/index.html b/index.html
index b29cae5..6d0bffb 100644
--- a/index.html
+++ b/index.html
@@ -5,12 +5,12 @@
 
 
 
-Helper functions for writing type safe functions for rserve-ts • ts
+Helper Functions for Writing Type-safe Functions for rserve-ts • ts
 
 
 
 
-
+
 
 
 
diff --git a/pkgdown.yml b/pkgdown.yml
index 17dbe8c..4870ef9 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -3,7 +3,7 @@ pkgdown: 2.1.1
 pkgdown_sha: ~
 articles:
   simple-react-app: simple-react-app.html
-last_built: 2025-02-07T00:21Z
+last_built: 2025-02-07T00:48Z
 urls:
   reference: http://tomelliott.co.nz/ts/reference
   article: http://tomelliott.co.nz/ts/articles
diff --git a/reference/ts_logical.html b/reference/ts_logical.html
index c563605..ce55356 100644
--- a/reference/ts_logical.html
+++ b/reference/ts_logical.html
@@ -61,6 +61,17 @@ or a typed Uint8Array (z.instanceof(Uint8Array)).

A ts object that accepts logical scalars or vectors of length n.

+
+

Examples

+
x <- ts_logical(1)
+x$check(TRUE)
+#> [1] TRUE
+
+if (FALSE) { # \dontrun{
+x$check(5)
+} # }
+
+
diff --git a/search.json b/search.json index cdae957..778145a 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"http://tomelliott.co.nz/ts/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Tom Elliott Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"http://tomelliott.co.nz/ts/articles/simple-react-app.html","id":"install-the-ts-package","dir":"Articles","previous_headings":"","what":"Install the ts package","title":"Build a simple ReactJS app","text":"","code":"devtools::install_github('tmelliott/ts')"},{"path":"http://tomelliott.co.nz/ts/articles/simple-react-app.html","id":"write-the-r-code","dir":"Articles","previous_headings":"","what":"Write the R code","title":"Build a simple ReactJS app","text":"code saved file called faithful-app.R, can preview results calling functions: ’s ! ’ll use ts_compile() later create server code Typescript schema app.","code":"cat(readLines('faithful-app.R'), sep = '\\n') #> library(ts) #> #> get_hist <- ts_function( #> function(bins = ts_integer(1)) { #> h <- hist(faithful$waiting, breaks = bins, plot = FALSE) #> data.frame(x = h$mids, y = h$density) #> }, #> result = ts_dataframe(x = ts_numeric(0), y = ts_numeric(0)) #> ) #> get_smoother <- ts_function( #> function(bandwidth = ts_numeric(1)) { #> d <- density(faithful$waiting, bw = bandwidth) #> data.frame(x = d$x, y = d$y) #> }, #> result = ts_dataframe(x = ts_numeric(0), y = ts_numeric(0)) #> ) source('faithful-app.R') get_hist$call(10) #> x y #> 1 42.5 0.0029411765 #> 2 47.5 0.0161764706 #> 3 52.5 0.0242647059 #> 4 57.5 0.0176470588 #> 5 62.5 0.0102941176 #> 6 67.5 0.0073529412 #> 7 72.5 0.0198529412 #> 8 77.5 0.0397058824 #> 9 82.5 0.0404411765 #> 10 87.5 0.0169117647 #> 11 92.5 0.0036764706 #> 12 97.5 0.0007352941"},{"path":"http://tomelliott.co.nz/ts/articles/simple-react-app.html","id":"create-the-react-app","dir":"Articles","previous_headings":"","what":"Create the React app","title":"Build a simple ReactJS app","text":"’m using Vite create app, use framework. Whatever use, ’ll need able bundle code (including libraries zod). now able see default Vite app running http://localhost:5173 (similar, see console output). Now install rserve-ts zod packages:","code":"pnpm create vite faithful-demo --template vanilla-ts cd faithful-demo pnpm install pnpm run dev pnpm install rserve-ts zod"},{"path":"http://tomelliott.co.nz/ts/articles/simple-react-app.html","id":"create-the-server-code","dir":"Articles","previous_headings":"Create the React app","what":"Create the server code","title":"Build a simple ReactJS app","text":"now use ts_compile() function create two files: faithful-app.rserve.R file start Rserve instance apps functions available. faithful-app.rserve.ts contains TypeScript schema (using zod) let use R functions directly app like typescript function! ’ll send straight faithful-demo/src directory.","code":"ts_compile('faithful-app.R', filename = 'faithful-demo/src/faithful-app.rserve')"},{"path":"http://tomelliott.co.nz/ts/articles/simple-react-app.html","id":"write-the-app","dir":"Articles","previous_headings":"Create the React app","what":"Write the app","title":"Build a simple ReactJS app","text":"rest process simply requires writing TypeScript code. won’t go detail since ’s focus vignette, can see code written basic comments. Copy paste get app running.","code":"// main.ts import \"./style.css\"; import RserveClient from \"rserve-ts\"; import faithfulApp from \"./faithful-app.rserve\"; import { z } from \"zod\"; document.querySelector(\"#app\")!.innerHTML = `

Rserve and TypeScript<\/h1>
Number of bins: