From 04083d4d1e21706e4679549d8cc3b98c60ab096b Mon Sep 17 00:00:00 2001 From: SheetJS Date: Thu, 1 Jun 2023 04:25:44 -0400 Subject: [PATCH] idb --- docz/docs/03-demos/05-mobile/06-flutter.md | 4 +--- docz/docs/03-demos/07-data/index.md | 3 ++- .../03-indexeddb.md => 08-local/09-indexeddb.md} | 16 ++++++++-------- docz/docs/03-demos/11-bigdata/03-ml.mdx | 14 +++++++++----- docz/docs/03-demos/index.md | 2 +- docz/docusaurus.config.js | 1 + docz/static/tfjs/tf.min.js | 4 ++-- 7 files changed, 24 insertions(+), 20 deletions(-) rename docz/docs/03-demos/{07-data/03-indexeddb.md => 08-local/09-indexeddb.md} (93%) diff --git a/docz/docs/03-demos/05-mobile/06-flutter.md b/docz/docs/03-demos/05-mobile/06-flutter.md index 7b7adcb..4cf1b31 100644 --- a/docz/docs/03-demos/05-mobile/06-flutter.md +++ b/docz/docs/03-demos/05-mobile/06-flutter.md @@ -89,7 +89,7 @@ class SheetJSFlutterState extends State { #### Running SheetJS Scripts -Since fetching assets is asychronous, it is recommended to create a wrapper +Since fetching assets is asynchronous, it is recommended to create a wrapper `async` function and sequentially await each script: ```dart @@ -158,8 +158,6 @@ The iOS simulator runs iOS 16.2 on an iPhone 14 Pro Max. ::: -### Base Project - 1) Disable telemetry. ```bash diff --git a/docz/docs/03-demos/07-data/index.md b/docz/docs/03-demos/07-data/index.md index 07e9875..100d0e1 100644 --- a/docz/docs/03-demos/07-data/index.md +++ b/docz/docs/03-demos/07-data/index.md @@ -182,7 +182,8 @@ The following Web APIs are featured in separate demos: return (
  • {item.label}{item.customProps?.summary && (" - " + item.customProps.summary)}
  • ); -})} +})} +
  • IndexedDB API
  • ### SQL Databases diff --git a/docz/docs/03-demos/07-data/03-indexeddb.md b/docz/docs/03-demos/08-local/09-indexeddb.md similarity index 93% rename from docz/docs/03-demos/07-data/03-indexeddb.md rename to docz/docs/03-demos/08-local/09-indexeddb.md index 8a5fb25..db2f38e 100644 --- a/docz/docs/03-demos/07-data/03-indexeddb.md +++ b/docz/docs/03-demos/08-local/09-indexeddb.md @@ -3,12 +3,12 @@ title: IndexedDB API pagination_prev: demos/desktop/index pagination_next: demos/local/index sidebar_custom_props: - type: web + summary: Reading and writing data in browser storage --- - + :::warning @@ -20,6 +20,10 @@ in production applications. ::: +The IndexedDB API provides an in-browser sandboxed local data store for JSON +objects. Like the [Local Storage API](/docs/demos/data/storageapi), IndexedDB is +a popular choice for offline storage. + ## Wrapper Libraries A number of popular wrapper libraries seek to simplify IndexedDB operations. @@ -35,7 +39,7 @@ production sites. :::note -This demo was last tested on 2023 February 26 with `localForage` 1.10.0 +This demo was last tested on 2023 June 1 with `localForage` 1.10.0 ::: @@ -102,7 +106,7 @@ function SheetJSLocalForage() { :::note -This demo was last tested on 2023 February 26 with DexieJS 3.2.3 +This demo was last tested on 2023 June 1 with DexieJS 3.2.4 ::: @@ -227,7 +231,3 @@ function SheetJSDexieExport() { return (
    ); } ``` - -### AlaSQL - -[AlaSQL](/docs/demos/data/alasql) ships with an IndexedDB backend. \ No newline at end of file diff --git a/docz/docs/03-demos/11-bigdata/03-ml.mdx b/docz/docs/03-demos/11-bigdata/03-ml.mdx index 764421b..f0eb5d4 100644 --- a/docz/docs/03-demos/11-bigdata/03-ml.mdx +++ b/docz/docs/03-demos/11-bigdata/03-ml.mdx @@ -19,7 +19,7 @@ TensorFlow.js and other ML libraries. :::note -Live code blocks in this page load the standalone build from version `3.18.0`. +Live code blocks in this page load the standalone build from version `4.6.0`. For use in web frameworks, the `@tensorflow/tfjs` module should be used. @@ -46,11 +46,15 @@ function worksheet_to_csv_url(worksheet) { } ``` -[This demo mirrors `TFjs` docs](https://js.tensorflow.org/api/latest/#data.csv), -fetching [an XLSX export of the example dataset](https://sheetjs.com/data/bht.xlsx). -
    TF CSV Demo using XLSX files (click to show) +This demo shows a simple model fitting using the "Boston Housing" dataset. The +[sample XLSX file](https://sheetjs.com/data/bht.xlsx) contains the data. + +The demo first fetches the XLSX file and generates CSV text. A blob URL is +generated and fed to `tf.data.csv`. The rest of the demo follows the official +example in the TensorFlow documentation. + :::caution If the live demo shows a message @@ -96,7 +100,7 @@ function SheetJSToTFJSCSV() { }}}); model.summary(); }); - return (
    Original CSV demo

    + return (
         
         {output}
       
    ); diff --git a/docz/docs/03-demos/index.md b/docz/docs/03-demos/index.md index 54f0cf0..876a3ef 100644 --- a/docz/docs/03-demos/index.md +++ b/docz/docs/03-demos/index.md @@ -18,7 +18,7 @@ run in the web browser, demos will include interactive examples. - [`Local File Access`](/docs/demos/local/file) - [`LocalStorage and SessionStorage`](/docs/demos/data/storageapi) - [`Web SQL Database`](/docs/demos/data/websql) -- [`IndexedDB`](/docs/demos/data/indexeddb) +- [`IndexedDB`](/docs/demos/local/indexeddb) ### Web Frameworks diff --git a/docz/docusaurus.config.js b/docz/docusaurus.config.js index d651c23..8c484e4 100644 --- a/docz/docusaurus.config.js +++ b/docz/docusaurus.config.js @@ -216,6 +216,7 @@ const config = { /* local */ { from: '/docs/demos/clipboard', to: '/docs/demos/local/clipboard/' }, { from: '/docs/demos/localfile', to: '/docs/demos/local/file/' }, + { from: '/docs/demos/data/indexeddb', to: '/docs/demos/local/indexeddb/' }, /* desktop */ { from: '/docs/demos/cli', to: '/docs/demos/desktop/cli/' }, { from: '/docs/getting-started/demos/cli', to: '/docs/demos/desktop/cli/' }, diff --git a/docz/static/tfjs/tf.min.js b/docz/static/tfjs/tf.min.js index 1b510b4..971f4c8 100644 --- a/docz/static/tfjs/tf.min.js +++ b/docz/static/tfjs/tf.min.js @@ -1,6 +1,6 @@ /** * @license - * Copyright 2022 Google LLC. All Rights Reserved. + * Copyright 2023 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,5 +14,5 @@ * limitations under the License. * ============================================================================= */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).tf=e.tf||{})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,t){return e(t={exports:{}},t.exports),t.exports}var r=function(e){return e&&e.Math==Math&&e},a=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(e){return!0}},o=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s={}.propertyIsEnumerable,u=Object.getOwnPropertyDescriptor,l={f:u&&!s.call({1:2},1)?function(e){var t=u(this,e);return!!t&&t.enumerable}:s},c=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},p={}.toString,h=function(e){return p.call(e).slice(8,-1)},f="".split,d=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==h(e)?f.call(e,""):Object(e)}:Object,m=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},v=function(e){return d(m(e))},g=function(e){return"object"==typeof e?null!==e:"function"==typeof e},y=function(e,t){if(!g(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!g(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!g(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!g(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},b={}.hasOwnProperty,x=function(e,t){return b.call(e,t)},w=a.document,k=g(w)&&g(w.createElement),N=function(e){return k?w.createElement(e):{}},I=!o&&!i((function(){return 7!=Object.defineProperty(N("div"),"a",{get:function(){return 7}}).a})),S=Object.getOwnPropertyDescriptor,T={f:o?S:function(e,t){if(e=v(e),t=y(t,!0),I)try{return S(e,t)}catch(e){}if(x(e,t))return c(!l.f.call(e,t),e[t])}},E=function(e){if(!g(e))throw TypeError(String(e)+" is not an object");return e},C=Object.defineProperty,R={f:o?C:function(e,t,n){if(E(e),t=y(t,!0),E(n),I)try{return C(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},A=o?function(e,t,n){return R.f(e,t,c(1,n))}:function(e,t,n){return e[t]=n,e},_=function(e,t){try{A(a,e,t)}catch(n){a[e]=t}return t},F="__core-js_shared__",D=a[F]||_(F,{}),O=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(e){return O.call(e)});var M,L,z,P=D.inspectSource,B=a.WeakMap,W="function"==typeof B&&/native code/.test(P(B)),U=n((function(e){(e.exports=function(e,t){return D[e]||(D[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.9.1",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),V=0,G=Math.random(),j=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++V+G).toString(36)},H=U("keys"),q=function(e){return H[e]||(H[e]=j(e))},K={},X=a.WeakMap;if(W){var Y=D.state||(D.state=new X),J=Y.get,Z=Y.has,Q=Y.set;M=function(e,t){return t.facade=e,Q.call(Y,e,t),t},L=function(e){return J.call(Y,e)||{}},z=function(e){return Z.call(Y,e)}}else{var $=q("state");K[$]=!0,M=function(e,t){return t.facade=e,A(e,$,t),t},L=function(e){return x(e,$)?e[$]:{}},z=function(e){return x(e,$)}}var ee,te,ne={set:M,get:L,has:z,enforce:function(e){return z(e)?L(e):M(e,{})},getterFor:function(e){return function(t){var n;if(!g(t)||(n=L(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},re=n((function(e){var t=ne.get,n=ne.enforce,r=String(String).split("String");(e.exports=function(e,t,i,o){var s,u=!!o&&!!o.unsafe,l=!!o&&!!o.enumerable,c=!!o&&!!o.noTargetGet;"function"==typeof i&&("string"!=typeof t||x(i,"name")||A(i,"name",t),(s=n(i)).source||(s.source=r.join("string"==typeof t?t:""))),e!==a?(u?!c&&e[t]&&(l=!0):delete e[t],l?e[t]=i:A(e,t,i)):l?e[t]=i:_(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||P(this)}))})),ae=a,ie=function(e){return"function"==typeof e?e:void 0},oe=function(e,t){return arguments.length<2?ie(ae[e])||ie(a[e]):ae[e]&&ae[e][t]||a[e]&&a[e][t]},se=Math.ceil,ue=Math.floor,le=function(e){return isNaN(e=+e)?0:(e>0?ue:se)(e)},ce=Math.min,pe=function(e){return e>0?ce(le(e),9007199254740991):0},he=Math.max,fe=Math.min,de=function(e,t){var n=le(e);return n<0?he(n+t,0):fe(n,t)},me=function(e){return function(t,n,r){var a,i=v(t),o=pe(i.length),s=de(r,o);if(e&&n!=n){for(;o>s;)if((a=i[s++])!=a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return!e&&-1}},ve={includes:me(!0),indexOf:me(!1)},ge=ve.indexOf,ye=function(e,t){var n,r=v(e),a=0,i=[];for(n in r)!x(K,n)&&x(r,n)&&i.push(n);for(;t.length>a;)x(r,n=t[a++])&&(~ge(i,n)||i.push(n));return i},be=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],xe=be.concat("length","prototype"),we={f:Object.getOwnPropertyNames||function(e){return ye(e,xe)}},ke={f:Object.getOwnPropertySymbols},Ne=oe("Reflect","ownKeys")||function(e){var t=we.f(E(e)),n=ke.f;return n?t.concat(n(e)):t},Ie=function(e,t){for(var n=Ne(t),r=R.f,a=T.f,i=0;i=74)&&(ee=Me.match(/Chrome\/(\d+)/))&&(te=ee[1]);var Be,We=te&&+te,Ue=!!Object.getOwnPropertySymbols&&!i((function(){return!Symbol.sham&&(Oe?38===We:We>37&&We<41)})),Ve=Ue&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ge=Array.isArray||function(e){return"Array"==h(e)},je=function(e){return Object(m(e))},He=Object.keys||function(e){return ye(e,be)},qe=o?Object.defineProperties:function(e,t){E(e);for(var n,r=He(t),a=r.length,i=0;a>i;)R.f(e,n=r[i++],t[n]);return e},Ke=oe("document","documentElement"),Xe=q("IE_PROTO"),Ye=function(){},Je=function(e){return"