From efc929ca69e34ca5b9fb353e60e45ba0d37463fe Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 12 Jul 2017 11:38:53 +0100 Subject: [PATCH] vuetify 0.13.1 --- src/vue-poc/components/core.js | 92 +--- src/vue-poc/components/nav-list.vue | 11 +- src/vue-poc/features/about.vue | 28 + .../features/collection/collections.xqm | 125 +++-- src/vue-poc/features/collection/files.vue | 73 +-- src/vue-poc/features/collection/history.vue | 15 +- src/vue-poc/features/collection/history.xml | 13 + src/vue-poc/features/edit/edit.vue | 34 +- src/vue-poc/features/edit/edit.xqm | 3 +- src/vue-poc/features/eval/eval.vue | 28 +- src/vue-poc/features/home.vue | 2 +- src/vue-poc/features/images/images.vue | 76 +++ src/vue-poc/features/images/images.xqm | 51 ++ src/vue-poc/features/options.vue | 49 -- src/vue-poc/features/people.vue | 29 +- src/vue-poc/features/puzzle.vue | 2 +- src/vue-poc/lib/dice.xqm | 128 +++++ src/vue-poc/models/thumbnail.xml | 22 + src/vue-poc/static/app-gen.js | 493 +++++++++++------- src/vue-poc/static/app.html | 4 +- src/vue-poc/static/resources/task.xsd | 262 ++++++++++ src/vue-poc/tasks/createthumbs.xq | 16 +- src/vue-poc/tasks/scanpics.xq | 13 +- tools/compile.xq | 8 +- 24 files changed, 1128 insertions(+), 449 deletions(-) create mode 100644 src/vue-poc/features/about.vue create mode 100644 src/vue-poc/features/collection/history.xml create mode 100644 src/vue-poc/features/images/images.vue create mode 100644 src/vue-poc/features/images/images.xqm delete mode 100644 src/vue-poc/features/options.vue create mode 100644 src/vue-poc/lib/dice.xqm create mode 100644 src/vue-poc/models/thumbnail.xml create mode 100644 src/vue-poc/static/resources/task.xsd diff --git a/src/vue-poc/components/core.js b/src/vue-poc/components/core.js index b07943d..2eb0d2c 100644 --- a/src/vue-poc/components/core.js +++ b/src/vue-poc/components/core.js @@ -27,84 +27,7 @@ Vue.config.errorHandler = function (err, vm, info) { alert("vue error"); }; -Vue.component('my-component', { - - props: ['href'], - template: ' {{href}}link', - created:function(){ - console.log("my-component"); - }, -}); -Vue.component('nav-list', { - - props: ['items'], - template:` - - -`, - created:function(){ - console.log("my-component"); - } - }); var Events = new Vue({}); @@ -115,15 +38,15 @@ const router = new VueRouter({ routes: [ { path: '/', component: Home,meta:{title:"Home"} }, { path: '/people', component: People ,meta:{title:"People"}}, - { path: '/options', component: Options,meta:{title:"Options"} }, + { path: '/images', component: Images,meta:{title:"Images"} }, { path: '/select', component: Select,meta:{title:"Select"} }, { path: '/search', component: Search,meta:{title:"Search"} }, { path: '/tabs', component: Tabs,meta:{title:"tab test",requiresAuth: true} }, { path: '/login', component: Login,meta:{title:"login"} }, { path: '/edit', component: Edit,meta:{title:"Ace editor"} }, { path: '/thumbnail', component: Thumbnail,meta:{title:"Thumbnail generator"} }, - { path: '/files', component: Files,meta:{title:"File system"} }, - { path: '/files', component: Files,meta:{title:"File system"} }, + { path: '/files', component: Files,meta:{title:"File system"},props:{protocol:"webfile"} }, + { path: '/database', component: Files,meta:{title:"Databases"},props:{protocol:"basexdb"} }, { path: '/ping', component: Ping,meta:{title:"Ping"} }, { path: '/settings', component: Settings,meta:{title:"Settings"} }, { path: '/history', component: History,meta:{title:"File History"} }, @@ -171,7 +94,8 @@ const app = new Vue({ text: 'Collections' , model: false, children: [ - {href: 'files', text: 'File system',icon: 'folder' }, + {href: 'database', text: 'Databases',icon: 'account_balance' }, + {href: 'files', text: 'File system',icon: 'folder' }, {href: 'edit',text: 'edit',icon: 'mode_edit'}, {href: 'history',text: 'history',icon: 'history'}, {href: 'logs',text: 'Server logs',icon: 'dns'} @@ -181,8 +105,8 @@ const app = new Vue({ text: 'Actions' , model: false, children: [ - {href: 'eval',text: 'Evaluate',icon: 'play_circle_outline'}, - {href: 'jobs',text: 'Jobs',icon: 'dashboard'}, + {href: 'eval',text: 'Query',icon: 'play_circle_outline'}, + {href: 'jobs',text: 'Running jobs',icon: 'dashboard'}, {href: 'tasks',text: 'Tasks',icon: 'history'}, ]}, { @@ -193,7 +117,7 @@ const app = new Vue({ {href: 'people',text: 'People',icon: 'person'}, {href: 'select',text: 'select',icon: 'extension'}, {href: 'puzzle',text: 'Puzzle',icon: 'extension'}, - {href: 'options',text: 'options',icon: 'domain'}, + {href: 'images',text: 'Images',icon: 'camera_roll'}, {href: 'tabs',text: 'tabs',icon: 'switch_camera'}, {href: 'ping',text: 'ping',icon: 'update'}, {href: 'thumbnail',text: 'thumbnail',icon: 'touch_app'} diff --git a/src/vue-poc/components/nav-list.vue b/src/vue-poc/components/nav-list.vue index 5361d1a..edb16fd 100644 --- a/src/vue-poc/components/nav-list.vue +++ b/src/vue-poc/components/nav-list.vue @@ -19,7 +19,7 @@ - + {{ item.icon }} @@ -34,11 +34,8 @@ - diff --git a/src/vue-poc/features/images/images.xqm b/src/vue-poc/features/images/images.xqm new file mode 100644 index 0000000..dfb38cd --- /dev/null +++ b/src/vue-poc/features/images/images.xqm @@ -0,0 +1,51 @@ +(:~ + : vue-poc thumbnail api. + : + : @author Andy Bunce may-2017 + :) +module namespace vue-api = 'quodatum:vue.api.images'; +import module namespace thb="expkg-zone58:image.thumbnailator"; +import module namespace rest = "http://exquery.org/ns/restxq"; +import module namespace fw="quodatum:file.walker"; +declare namespace c="http://www.w3.org/ns/xproc-step"; + +declare variable $vue-api:PICS:="c:\tmp\"; + +(:~ + : do a thumbnail + :) +declare +%rest:GET %rest:path("/vue-poc/api/images/list") +%rest:produces("application/json") +%rest:query-param("page", "{$page}",0) +%output:method("json") +function vue-api:list( $page as xs:integer) +{ + let $rowsPerPage:=24 + let $opt:=map{"include-filter":".*\.jpg", + "max-depth":-1, + "include-info":true()} +let $d:= fw:directory-list($vue-api:PICS,$opt) +let $f:=$d//c:file/@name/resolve-uri(encode-for-uri(.),base-uri(.)) +let $images:=subsequence($f,1+$rowsPerPage*$page,$rowsPerPage) + return + { + for $f in $images + return <_ type="object"> + {vue-api:get-image($f)} + + } + +}; + + +declare function vue-api:get-image($f as xs:string) +as element(*)* +{ + {$f} + ,{fetch:binary($f)} + ,{fetch:content-type($f)} +}; + + + diff --git a/src/vue-poc/features/options.vue b/src/vue-poc/features/options.vue deleted file mode 100644 index 20273dd..0000000 --- a/src/vue-poc/features/options.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - - diff --git a/src/vue-poc/features/people.vue b/src/vue-poc/features/people.vue index 0eef1cc..1136896 100644 --- a/src/vue-poc/features/people.vue +++ b/src/vue-poc/features/people.vue @@ -5,6 +5,24 @@ Reverse Message

{{ message }}

logout + @@ -20,6 +38,8 @@ + + @@ -27,8 +47,12 @@ data: function(){ return { message: 'Hello Vue.js!', + fieldValue:"", + list:[], + search:"", + data:[], img:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" - } + } }, methods: { reverseMessage() { @@ -36,6 +60,9 @@ }, logout(){ alert("TODU") + }, + handleSelected(){ + } } } diff --git a/src/vue-poc/features/puzzle.vue b/src/vue-poc/features/puzzle.vue index 8107c15..8557ccc 100644 --- a/src/vue-poc/features/puzzle.vue +++ b/src/vue-poc/features/puzzle.vue @@ -1,7 +1,6 @@ diff --git a/src/vue-poc/lib/dice.xqm b/src/vue-poc/lib/dice.xqm new file mode 100644 index 0000000..4070b8c --- /dev/null +++ b/src/vue-poc/lib/dice.xqm @@ -0,0 +1,128 @@ +(:~ +: dice utils - sort, filter, and serialize as json. +: can read parameters from request: sort,start,limit. +: @requires basex 8.6 for map:merge +: @author andy bunce +: @since mar 2013 +:) + +module namespace dice = 'quodatum.web.dice/v4'; +declare default function namespace 'quodatum.web.dice/v4'; +declare namespace restxq = 'http://exquery.org/ns/restxq'; + +declare variable $dice:default:=map{ + "start" : 1, (: start index :) + "limit" : 30, (: max items :) + "sort" : "" +}; + + +(:~ + : sort items + : @param sort field name to sort on optional leading +/- + : @return sorted items + :) +declare function sort($items as item()* + ,$fmap as map(*) + ,$sort as xs:string?) +as item()*{ + let $sort:=fn:normalize-space($sort)=>fn:trace("dice:sort") + let $ascending:=fn:not(fn:starts-with($sort,"-")) + let $fld:=fn:substring($sort,if(fn:substring($sort,1,1)=("+","-")) then 2 else 1) + return if(fn:not(map:contains($fmap, $fld))) then + $items + else if ($ascending) then + for $i in $items + (: let $i:=fn:trace($i,"feld " || $fld ) :) + order by $fmap($fld)($i) ascending collation "http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive" + return $i + else + for $i in $items + order by $fmap($fld)($i) descending collation "http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive" + return $i +}; + +(:~ generate item xml for all fields in map :) +declare function json-flds($item,$fldmap) +as element(_){ + json-flds($item,$fldmap,map:keys($fldmap)) +}; + +(:~ generate item xml for some fields in map :) +declare function json-flds($item as element(), + $fldmap as map(*), + $keys as xs:string*) +as element(_){ + <_> + {for $key in $keys + return + try{ + $fldmap($key)($item) + }catch * { + element {$key}{$err:description } + } } + +}; + + +(:~ + : sort, slice, return json using request parameters + : @param $items sequence of source items + : @param $opts sort and slice values + :) +declare function response($items, + $entity as map(*), + $opts as map(*)) + { + let $total:=fn:count($items) + let $opts:=map:merge(($opts,$dice:default)) + let $items:= dice:sort($items,$entity?access,$opts?sort) + let $jsonf:= $entity?json + let $fields:=if ($opts?fields) then fn:tokenize($opts?fields) else map:keys($jsonf) + let $slice:= fn:subsequence($items,$opts?start,$opts?limit) + return + + {$total} + {$opts?start}-{$opts?start+fn:count($slice)-1}/{$total} + {$entity?name} + + {for $item in $slice + return <_ >{$fields!$jsonf(.)($item)}} + + +}; + +(:~ + : get data + :) +declare function get($entity as map(*),$name as xs:string) +as element(*){ + let $results:=$entity("data")() + return $results[$name=$entity?access?name(.)] +}; + +(:~ + : sort, slice, return json + :) +declare function response($items,$entity as map(*)){ + response($items,$entity,map{}) +}; +(:~ + : @return json for item + :) +declare function one($item,$entity as map(*)) +{ + one($item,$entity,map{}) +}; +(:~ + : @return json for item + :) +declare function one($item,$entity as map(*),$opts as map(*)) +{ + let $jsonf:= map:get($entity,"json") + let $fields:=if ($opts?fields) then fn:tokenize($opts?fields) else map:keys($jsonf)=>fn:trace("FF") + + return + {$fields!$jsonf(.)($item)} + +}; diff --git a/src/vue-poc/models/thumbnail.xml b/src/vue-poc/models/thumbnail.xml new file mode 100644 index 0000000..532b6fe --- /dev/null +++ b/src/vue-poc/models/thumbnail.xml @@ -0,0 +1,22 @@ + + an image. + + + + + File name. + @name + + + file size. + @size + + + + + name + + fa fa-file + doc("/vue-poc/pics.xml")//c:file + + \ No newline at end of file diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js index 8108e78..20a4ecc 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,5 +1,83 @@ -// generated 2017-07-05T23:03:36.134+01:00 - /** +// generated 2017-07-12T11:37:10.722+01:00 + Vue.component('my-component',{template:` + {{href}}link + `, + + props: ['href'], + created:function(){ + console.log("my-component"); + } +} + + ); + Vue.component('nav-list',{template:` + + + + `, + + props: ['items'], + + created:function(){ + console.log("nav-lst"); + } +} + + ); + /** * vue filters */ @@ -53,6 +131,27 @@ Vue.filter('round', function(value, decimals) { } } + ); + const Home=Vue.extend({template:` +
VUE-POC
+v0.0.2
+

+ This is a experiment in using + vue.js + . +

+ +
add REPLACED
`, + + } + ); const Files=Vue.extend({template:` @@ -60,13 +159,11 @@ Vue.filter('round', function(value, decimals) { - folder + {{icon}} - {{ url }} @@ -80,12 +177,11 @@ Vue.filter('round', function(value, decimals) { Folders - - Files - + - -Some info here {{selected}} blah blah + + + + {{selected}} + + highlight_off + + blah blah protocol: {{protocol}} + `, + + props:["protocol"], data: function(){ return { crumbs:[], @@ -131,25 +234,22 @@ Some info here {{selected}} blah blah { - console.log(r) this.folders=r.data.folders this.files=r.data.files this.busy=false @@ -164,22 +264,15 @@ Some info here {{selected}} blah blah blah blah a.length>0) } + }, + icon(){ + return (this.protocol=="basexdb")?"account_balance":"folder" + } + }, + watch:{ + url(v){ + this.$router.push({ query: { url: this.url }}) + }, + $route(v){ + var url=this.$route.query.url + this.url=url?url:"/"; + this.load(this.url) } }, created:function(){ var url=this.$route.query.url this.url=url?url:"/"; - console.log("files: ",this.$route.query.url) this.load(this.url) } } @@ -204,16 +309,13 @@ Some info here {{selected}} blah blah - + - star + Example Chip - + - - - @@ -233,9 +335,9 @@ Some info here {{selected}} blah blah blah blah folder - + + {{ item }} + @@ -280,31 +384,31 @@ Some info here {{selected}} blah blah navigate_next - + star - + vertical_align_center - + wrap_text - + file_upload - + format_align_center - + delete - + help @@ -324,7 +428,7 @@ Some info here {{selected}} blah blah - + more_vert @@ -367,6 +471,7 @@ Some info here {{selected}} blah blah blah blah { //console.log(r) this.mimetype=r.data.mimetype this.mode=this.acetype(r.data.mimetype) this.contentA=r.data.data - var a=url.split("/") - this.url=url - this.name=a.pop() - this.path=a + this.busy=false this.dirty=false //alert(mode) @@ -438,6 +544,7 @@ Some info here {{selected}} blah blah blah blah blah blah - - + - - + Run play_circle_outline Submit - - + + + play_circle_outline + Imports + + + {{font}} + arrow_drop_down + + + + + + + + @@ -557,6 +677,7 @@ Some info here {{selected}} blah blah blah blah blah blah + const About=Vue.extend({template:`
VUE-POC
v0.0.2

@@ -659,6 +783,77 @@ v0.0.2 } + ); + const Images=Vue.extend({template:` + + + + next + {{page}} + back + + + + + + + + + + + + favorite + + + + bookmark + + + share + + + + + + + + + `, + + data: () => ({ + images:[], + page:0 + }), + methods:{ + src(item){ + //return "https://unsplash.it/150/300?image="+Math.floor(Math.random() * 100) + 1 + return "data:image/jpeg;base64,"+item.data + }, + getImages(){ + HTTP.get("images/list?page="+this.page) + .then(r=>{ + this.images=r.data.items + }) + + }, + selected(){ + alert("not yet") + } + }, + watch:{ + page(v){ + this.$router.push({ query: { page: this.page }}) + }, + $route(v){ + this.getImages() + } + }, + created:function(){ + this.page=this.$route.query.page || this.page + this.getImages() + } + } + ); const Job=Vue.extend({template:` @@ -820,51 +1015,6 @@ v0.0.2 } } - ); - const Options=Vue.extend({template:` - - - - - Featured Event:
- May 24, 2016
- 7-11pm -
- - Add to
Calendar
- - - event - -
-
-
- - - - - - - - Show Snackbar - Snackbar? - - - Hello, I'm a snackbar - - highlight_off - - -
- `, - - data: function(){ - return { - snackbar:false - } - } - } - ); const People=Vue.extend({template:` @@ -872,6 +1022,24 @@ v0.0.2
Reverse Message

{{ message }}

logout +
@@ -887,14 +1055,20 @@ v0.0.2
+ + `, data: function(){ return { message: 'Hello Vue.js!', + fieldValue:"", + list:[], + search:"", + data:[], img:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" - } + } }, methods: { reverseMessage() { @@ -902,6 +1076,9 @@ v0.0.2
}, logout(){ alert("TODU") + }, + handleSelected(){ + } } } @@ -1037,7 +1214,6 @@ v0.0.2
); const Puzzle=Vue.extend({template:` - demo @@ -1058,6 +1234,7 @@ v0.0.2
+ Loosely inspired by demo
`, @@ -1429,84 +1606,7 @@ Vue.config.errorHandler = function (err, vm, info) { alert("vue error"); }; -Vue.component('my-component', { - - props: ['href'], - template: ' {{href}}link', - created:function(){ - console.log("my-component"); - }, -}); -Vue.component('nav-list', { - - props: ['items'], - template:` - - -`, - created:function(){ - console.log("my-component"); - } - }); var Events = new Vue({}); @@ -1517,15 +1617,15 @@ const router = new VueRouter({ routes: [ { path: '/', component: Home,meta:{title:"Home"} }, { path: '/people', component: People ,meta:{title:"People"}}, - { path: '/options', component: Options,meta:{title:"Options"} }, + { path: '/images', component: Images,meta:{title:"Images"} }, { path: '/select', component: Select,meta:{title:"Select"} }, { path: '/search', component: Search,meta:{title:"Search"} }, { path: '/tabs', component: Tabs,meta:{title:"tab test",requiresAuth: true} }, { path: '/login', component: Login,meta:{title:"login"} }, { path: '/edit', component: Edit,meta:{title:"Ace editor"} }, { path: '/thumbnail', component: Thumbnail,meta:{title:"Thumbnail generator"} }, - { path: '/files', component: Files,meta:{title:"File system"} }, - { path: '/files', component: Files,meta:{title:"File system"} }, + { path: '/files', component: Files,meta:{title:"File system"},props:{protocol:"webfile"} }, + { path: '/database', component: Files,meta:{title:"Databases"},props:{protocol:"basexdb"} }, { path: '/ping', component: Ping,meta:{title:"Ping"} }, { path: '/settings', component: Settings,meta:{title:"Settings"} }, { path: '/history', component: History,meta:{title:"File History"} }, @@ -1573,7 +1673,8 @@ const app = new Vue({ text: 'Collections' , model: false, children: [ - {href: 'files', text: 'File system',icon: 'folder' }, + {href: 'database', text: 'Databases',icon: 'account_balance' }, + {href: 'files', text: 'File system',icon: 'folder' }, {href: 'edit',text: 'edit',icon: 'mode_edit'}, {href: 'history',text: 'history',icon: 'history'}, {href: 'logs',text: 'Server logs',icon: 'dns'} @@ -1583,8 +1684,8 @@ const app = new Vue({ text: 'Actions' , model: false, children: [ - {href: 'eval',text: 'Evaluate',icon: 'play_circle_outline'}, - {href: 'jobs',text: 'Jobs',icon: 'dashboard'}, + {href: 'eval',text: 'Query',icon: 'play_circle_outline'}, + {href: 'jobs',text: 'Running jobs',icon: 'dashboard'}, {href: 'tasks',text: 'Tasks',icon: 'history'}, ]}, { @@ -1595,7 +1696,7 @@ const app = new Vue({ {href: 'people',text: 'People',icon: 'person'}, {href: 'select',text: 'select',icon: 'extension'}, {href: 'puzzle',text: 'Puzzle',icon: 'extension'}, - {href: 'options',text: 'options',icon: 'domain'}, + {href: 'images',text: 'Images',icon: 'camera_roll'}, {href: 'tabs',text: 'tabs',icon: 'switch_camera'}, {href: 'ping',text: 'ping',icon: 'update'}, {href: 'thumbnail',text: 'thumbnail',icon: 'touch_app'} diff --git a/src/vue-poc/static/app.html b/src/vue-poc/static/app.html index 2ad3afc..72a6dc7 100644 --- a/src/vue-poc/static/app.html +++ b/src/vue-poc/static/app.html @@ -9,7 +9,7 @@ Vue Router Test - + @@ -19,7 +19,7 @@ - + diff --git a/src/vue-poc/static/resources/task.xsd b/src/vue-poc/static/resources/task.xsd new file mode 100644 index 0000000..895464f --- /dev/null +++ b/src/vue-poc/static/resources/task.xsd @@ -0,0 +1,262 @@ + + + + + + Root container + + + + + + + + + + + + + + + + + + + size of thumbnail to create + + + + + + + + + + scale thumbnail from source size + + + + + + + + + + region of source image to use for thumbnail. + default all + + + + + + + + + + + + + + contain for filters to be applied to thumbnail + + + + + + + + + + + + + + + + + create a filled enclosing background for thumbnail + + + + + + + + + + + + + tint thumbnail + + + + + + + + + + add text to thumbnail + + + + + + + + + + + + + + + + + + flip thumbnail horizontally or vertically. + **Ignored if exif-orientation is true ** + + + + + + + + + + rotate the thumbnail + + + + + + + + + Add image to thumbnail as a watermark + + + + + + + + + + + + + Axis of flip + + + + + + + + + + Region of image to use + + + + + + + + + + + + + + + + + + + A size in pixels + + + + + + + + + + + + + + + Transparency alpha value + + + + + + + + + + constraints on thumbnail + + + + + true if the Exif metadata should be used to + determine the orientation of the thumbnail, + false otherwise. + + + + + + + fit - true if the thumbnail should be sized to + fit within the specified dimensions, + if the thumbnail is going to + exceed those dimensions. + + + + + + + keep aspect ratio + + + + + + + + Java colour name e.g. "red" + or Color.decode(value) + decimal, octal, or hexidecimal integer e.g + "#FF0096" + + + + + + + + Serialization details for output + + + + + Output image format (JPEG, PNG, GIF, BMP and + WBMP). defaults to source format + + + + + \ No newline at end of file diff --git a/src/vue-poc/tasks/createthumbs.xq b/src/vue-poc/tasks/createthumbs.xq index f70d7bb..e79ade4 100644 --- a/src/vue-poc/tasks/createthumbs.xq +++ b/src/vue-poc/tasks/createthumbs.xq @@ -1 +1,15 @@ -42 \ No newline at end of file +(:~ update image meta data docs :) +import module namespace imgmeta = "expkg-zone58:image.metadata" ; +declare namespace c="http://www.w3.org/ns/xproc-step"; +declare variable $DB:="vue-poc"; +let $done:=uri-collection("vue-poc/Pictures") +let $files:= doc("/vue-poc/pics.xml")//c:file[ends-with(lower-case(@name),".jpg")] + +let $relpath:= $files!( ancestor-or-self::*/@name=>string-join("/")) + +let $todo:= $relpath[not("/vue-poc/" || .|| "/meta.xml"=$done)] +return ((for $f in subsequence($todo,1, 1000) +let $spath:="P:/pictures/" || $f +let $dbpath:=$f || "/meta.xml" +let $meta:=imgmeta:read($spath) +return db:replace($DB,$dbpath,$meta)),db:output($todo=>count())) \ No newline at end of file diff --git a/src/vue-poc/tasks/scanpics.xq b/src/vue-poc/tasks/scanpics.xq index 03e0e60..62762ff 100644 --- a/src/vue-poc/tasks/scanpics.xq +++ b/src/vue-poc/tasks/scanpics.xq @@ -2,7 +2,12 @@ :) import module namespace fw="quodatum:file.walker"; declare namespace c="http://www.w3.org/ns/xproc-step"; -let $opt:=map{"include-filter":".*\.xsd", - "max-depth":-1, - "include-info":true()} -return fw:directory-list("/",$opt) \ No newline at end of file +declare variable $SRC:="P:/pictures/Pictures/"; +(: declare variable $DEST:="c:\tmp\pics2.xml"; :) +declare variable $DEST:="/pics.xml"; +declare %updating function local:put($data,$path){ +db:replace("vue-poc",$path,$data) +}; +let $opt:=map{"include-info":true()} +let $files:=fw:directory-list($SRC,$opt) +return $files=>local:put($DEST) \ No newline at end of file diff --git a/tools/compile.xq b/tools/compile.xq index 6155126..c652ec4 100644 --- a/tools/compile.xq +++ b/tools/compile.xq @@ -26,7 +26,12 @@ let $script:= $p?script=>substring-after("{") return if(empty($p?id)) then () - else + else if($isComp) then + ``[Vue.component('`{$p?id}`',{template:` `{$p?template}` `, + `{$script}` + ); + ]`` + else ``[const `{functx:capitalize-first($p?id)}`=Vue.extend({template:` `{$p?template}` `, `{$script}` ); @@ -61,6 +66,7 @@ let $comps:=$files!(fetch:text(.)=>html5:doc()=>local:feature(true())) let $comment:="// generated " || current-dateTime() || " " return file:write-text($DEST,string-join(($comment, + $comps, fetch:text($FILTERS), $feats, fetch:text($CORE)))) \ No newline at end of file