@startside/swa 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -6
- package/README.md +15 -4
- package/bin/swa.mjs +10 -10
- package/package.json +2 -2
- package/swa/1.0/agents.md +166 -8
- package/swa/1.0/frame.css +245 -0
- package/swa/1.0/frame.js +4 -0
- package/swa/1.0/host.md +126 -0
- package/swa/1.0/quickstart.md +13 -2
- package/swa/1.0/runtime.js +3 -3
- package/swa/1.0/spec.md +429 -46
- package/swa/1.0/swa.d.ts +148 -6
package/swa/1.0/frame.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/* SWA 1.0, the runtime a host runs in a widget's frame (host.md) */
|
|
2
|
+
(function(){(function(){"use strict";(function(){var e=window.__UWA_CONFIG__,t;function n(e){t=e}function r(e,t){for(var n in t)e[n]=t[n];return e}var i=typeof WeakMap==`function`?/* @__PURE__ */ new WeakMap:null,a={reset:`↺`,refresh:`↻`,undo:`↶`,redo:`↷`,copy:`⧉`,download:`⇩`,upload:`⇧`,share:`↗`,add:`+`,remove:`×`,clear:`⌫`,edit:`✎`,search:`⌕`,print:`⎙`,play:`▶`,pause:`⏸`,stop:`■`,check:`✓`,star:`★`,info:`ⓘ`,settings:`⚙`},o={".cook":[`text/plain`],".txt":[`text/plain`],".md":[`text/markdown`,`text/plain`],".csv":[`text/csv`,`text/plain`],".json":[`application/json`,`text/plain`],".ics":[`text/calendar`,`text/plain`],".opml":[`text/x-opml`,`application/xml`,`text/xml`,`text/plain`],".gpx":[`application/gpx+xml`,`application/xml`,`text/xml`,`text/plain`]},s=8388608,c=function(e){return Object.prototype.hasOwnProperty.call(o,e)};function l(e){var t=[];return typeof e==`string`&&e.trim().split(/\s+/).forEach(function(e){var n=e.toLowerCase();/^\.[a-z0-9]{1,10}$/.test(n)&&c(n)&&t.indexOf(n)===-1&&t.push(n)}),t}function u(e,t){if(typeof e!=`string`||e.length>1024)return null;var n=e.split(/[/\\]/).pop().replace(/[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069\ufeff]/g,``).replace(/[:*?"<>|]/g,`-`).replace(/\s+/g,` `).replace(/[. ]+$/,``),r=/^(.*)(\.[A-Za-z0-9]{1,10})$/.exec(n);if(!r)return null;var i=r[2].toLowerCase();if(t.indexOf(i)===-1||!c(i))return null;var a=r[1].replace(/^[. ]+/,``).replace(/[. ]+$/,``).replace(/\.([A-Za-z0-9]{1,10})$/,`-$1`);return a=Array.from(a).slice(0,120).join(``).replace(/[. ]+$/,``),/^(con|prn|aux|nul|(com|lpt)[1-9\u00b9\u00b2\u00b3])(\.|$)/i.test(a)&&(a=`_`+a),{name:(a||`download`)+i,ext:i}}function d(e,t){if(!c(e)||typeof t!=`string`||t.length>255)return null;var n=t.split(`;`)[0].trim().toLowerCase(),r=n?o[e].indexOf(n)===-1?null:n:o[e][0];return r&&r+`;charset=utf-8`}function f(e,t,n){return{setActionStates:function(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`setActionStates takes an object: { id: { disabled, hidden, label } }`);var t=this.__declaredActions();if(!t)this.__earlyStates.push(e);else{var n=Object.create(null);Object.keys(e).forEach(function(r){if(!t.some(function(e){return e.id===r}))throw TypeError(`setActionStates: the file declares no action "`+r+`" (<menu id="actions">)`);var i=e[r];if(!i||typeof i!=`object`)throw TypeError(`setActionStates: "`+r+`" takes { disabled, hidden, label }`);var a={};if(i.disabled!==void 0&&(a.disabled=i.disabled===null?null:i.disabled===!0),i.hidden!==void 0&&(a.hidden=i.hidden===null?null:i.hidden===!0),i.label===null)a.label=null;else if(i.label!==void 0){var o=String(i.label).replace(/\s+/g,` `).trim();if(!o||o.length>40)throw TypeError(`setActionStates: a label is 1 to 40 characters ("`+r+`")`);a.label=o}n[r]=a});var r=this.__actionStates;Object.keys(n).forEach(function(e){var t={};for(var i in r[e]||{})t[i]=r[e][i];for(var a in n[e])n[e][a]===null?delete t[a]:t[a]=n[e][a];r[e]=t}),this.__tellActions()}},saveFile:function(e,t){var r=function(e,t){return Promise.reject(typeof DOMException==`function`?new DOMException(t,e):Error(t))};if(!e||typeof e!=`object`||typeof e.name!=`string`||typeof e.type!=`string`)return Promise.reject(/* @__PURE__ */ TypeError(`saveFile takes { name, type, data }`));var a=e.data,o=typeof Blob==`function`&&a instanceof Blob,s=a instanceof ArrayBuffer;if(typeof a!=`string`&&!o&&!s)return Promise.reject(/* @__PURE__ */ TypeError(`saveFile: data is a string, a Blob or an ArrayBuffer`));var c=t&&t.action,l=c&&i?i.get(c):null;if(!l)return r(`NotAllowedError`,`saveFile answers a choice of an action that declares data-save: saveFile(file, { action: event })`);if(i.delete(c),(o?a.size:s?a.byteLength:a.length>8388608?a.length:new Blob([a]).size)>8388608)return r(`QuotaExceededError`,`a saved file is 8 MiB at most`);if(!n.saveFile)return r(`NotSupportedError`,`this host saves no file`);var u=function(t){return n.saveFile({token:l,name:e.name,type:e.type,data:t})};return o?a.arrayBuffer().then(u):u(s?a.slice(0):a)},__save:{extensions:l,name:u,type:d,max:s},__actionStates:Object.create(null),__actionsReady:!1,__actionsTold:``,__earlyStates:[],__declaredActions:function(){return!Array.isArray(t.actions)&&typeof t.readActions==`function`&&t.readActions(),Array.isArray(t.actions)?t.actions:typeof t.readActions==`function`?null:[]},__lateActions:function(){for(var e=this.__earlyStates.splice(0),t=0;t<e.length;t++)try{this.setActionStates(e[t])}catch(e){window.console&&console.error(e)}},__tellActions:function(){var e=JSON.stringify(this.__actionStates);this.__actionsReady&&e===this.__actionsTold||(this.__actionsReady=!0,this.__actionsTold=e,n.setActionStates&&n.setActionStates(JSON.parse(e)))},__askActions:function(){this.__actionsReady&&(this.__actionsTold=``,this.__actionsReady=!1,this.__tellActions())},__shownActions:function(){var e=this.__actionStates,t=this.__actionsReady;return(this.__declaredActions()||[]).filter(function(t){var n=e[t.id]||{};return t.album!==!0&&!(`hidden`in n?n.hidden:t.hidden===!0)}).map(function(n){var r=e[n.id]||{};return{id:n.id,label:r.label||n.label,icon:n.icon,confirm:n.confirm,save:n.save||[],disabled:!t||(`disabled`in r?r.disabled:n.disabled===!0)}})},__actionGlyph:function(e){var t=String(e||``).trim();if(!t||t.length>16)return``;if(Object.prototype.hasOwnProperty.call(a,t.toLowerCase()))return a[t.toLowerCase()];var n=!1;try{n=RegExp(`\\p{Extended_Pictographic}`,`u`).test(t)}catch{}return n&&(typeof Intl==`object`&&Intl.Segmenter?Array.from(new Intl.Segmenter().segment(t)).length===1:Array.from(t).length<=2)?t:``},__runAction:function(e,t){var n=this.__shownActions().filter(function(t){return t.id===e})[0];if(this.__actionsReady&&n&&!n.disabled){this.__actionToken=typeof t==`string`&&t?t:null;try{this.__fire(`__action`,{id:n.id})}finally{this.__actionToken=null}}}}}var p=[`version`,`title`,`home_page_url`,`feed_url`,`description`,`user_comment`,`next_url`,`icon`,`favicon`,`authors`,`language`,`expired`,`items`],m=[`id`,`url`,`external_url`,`title`,`content_html`,`content_text`,`summary`,`image`,`banner_image`,`date_published`,`date_modified`,`authors`,`tags`,`language`,`attachments`],h={VERSION:`https://jsonfeed.org/version/1.1`,feed:function(e){e||={};var t=g(e,p);return t.version=h.VERSION,t.items=(Array.isArray(e.items)?e.items:[]).map(h.item).filter(Boolean),t},item:function(e){if(!e||typeof e!=`object`)return null;var t=g(e,m);return(t.id==null||t.id===``)&&(t.id=t.url),t.id==null||t.id===``?null:(t.id=String(t.id),[`date_published`,`date_modified`].forEach(function(e){if(t[e]!=null){var n=new Date(t[e]);isNaN(n.getTime())?delete t[e]:t[e]=n.toISOString()}}),typeof t.authors==`string`&&(t.authors=[{name:t.authors}]),t)},author:function(e){var t=e&&e.authors&&e.authors[0];return t&&t.name||``},ext:function(e){return e&&e._myvibes||{}}};function g(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==void 0&&(t.indexOf(r)>=0||/^_[a-zA-Z]/.test(r))&&(n[r]=e[r]);return n}function _(e){if(!/<a\b/i.test(e))return null;for(var t=new DOMParser().parseFromString(`<body>`+e+`</body>`,`text/html`).body,n=[],r=t.firstChild;r&&n.length<8;r=r.nextSibling){var i=(r.textContent||``).slice(0,100);if(i){var a=r.nodeType===1&&r.tagName===`A`&&r.getAttribute(`href`)||``;n.push(/^https?:\/\//i.test(a)?{text:i,href:a}:{text:i})}}return n.some(function(e){return e.href})?n:null}function v(e,t,n){function r(t,n){return e.request(t,String(n))}var i=null;function a(e){return e.reason===void 0?new DOMException(`The operation was aborted.`,`AbortError`):e.reason}function o(e,n,i){return new Promise(function(o,s){if(i&&i.aborted)return s(a(i));var c=function(){s(a(i))};i&&i.addEventListener(`abort`,c,{once:!0}),r(e,n).then(function(e){if(i&&i.removeEventListener(`abort`,c),t.__destroyed)return s(new DOMException(`The widget is gone.`,`AbortError`));o(e)},function(e){i&&i.removeEventListener(`abort`,c),s(e)})})}function s(e,t){if(!e)return``;if(typeof e.get==`function`)return e.get(t)||``;for(var n=Array.isArray(e)?e:Object.keys(e).map(function(t){return[t,e[t]]}),r=0;r<n.length;r++)if(String(n[r][0]).toLowerCase()===t)return String(n[r][1]);return``}t.fetch=function(e,t){t||={};var n=e&&typeof e==`object`&&`url`in e?e.url:e,r=String(t.method||e&&e.method||`GET`).toUpperCase();if(r!==`GET`)return Promise.reject(/* @__PURE__ */ TypeError(`widget.fetch sends GET requests only (`+r+`)`));var i=s(t.headers||e&&e.headers,`accept`),a=t.signal||e&&typeof e==`object`&&e.signal||null;return o(/json/i.test(i)?`json`:`text`,String(n),a).then(function(e){return new Response(e,{status:200})},function(e){if(a&&a.aborted)throw a.reason===void 0?e:a.reason;if(e&&e.name===`AbortError`)throw e;var t=/HTTP (\d{3})/.exec(String(e&&e.message)),n=t?Number(t[1]):0;if(n>=400&&n<=599)return new Response(null,{status:n,statusText:String(e.message).slice(0,200)});throw TypeError(String(e&&e.message||`Failed to fetch`))})};var c={};function l(e,n,r){return o(`jsonfeed`,e,n).then(function(n){if(!n)throw Error(`Could not read the feed `+e);return t.__keepContent(e,h.feed(n))},function(e){throw r||e&&e.name===`AbortError`||t.__keepsContent()||t.__retryLoad(),e instanceof Error?e:Error(String(e))})}t.fetchFeed=function(e,n){n||={},e=String(e);var r=n.signal||null;if(r&&r.aborted)return Promise.reject(a(r));var i=n.fresh?null:t.__keptContent(e);return i?(!(Date.now()-i._myvibes.fetched<3e5)&&!c[e]&&(c[e]=!0,setTimeout(function(){l(e,null,!0).then(function(){delete c[e],t.__destroyed||t.__fire(t.__listens(`onRefresh`)?`onRefresh`:`onLoad`)},function(){delete c[e]})})),Promise.resolve(i)):l(e,r,!1)};var u=/* @__PURE__ */ new Map,d=400;return t.fetchImage=function(t,n){n||={};var r=n.signal||null;if(r&&r.aborted)return Promise.reject(a(r));var i=String(t),o=u.get(i);if(!o&&(o=e.request(`image`,i).then(function(e){return!e||typeof e!=`object`||!e.bytes?typeof e==`string`?e:i:URL.createObjectURL(new Blob([e.bytes],{type:String(e.type||``)}))},function(e){throw u.delete(i),TypeError(String(e&&e.message||`The picture could not be fetched`))}),u.set(i,o),u.size>d)){var s=u.keys().next().value,c=u.get(s);u.delete(s),c.then(function(e){/^blob:/.test(e)&&URL.revokeObjectURL(e)},function(){})}return r?new Promise(function(e,t){var n=function(){t(a(r))};r.addEventListener(`abort`,n,{once:!0}),o.then(function(t){r.removeEventListener(`abort`,n),e(t)},function(e){r.removeEventListener(`abort`,n),t(e)})}):o},i}function y(e,t){return{setTitle:function(e){this.__title=String(e);var n=_(this.__title);t.setTitle(n?n.map(function(e){return e.text}).join(``):this.__title.replace(/<[^>]*>/g,``)),t.setTitleLinks&&t.setTitleLinks(n)},getTitle:function(){return String(this.title).replace(/<[^>]*>/g,``)},setBody:function(e){this.__destroyed||(q.setContent.call(this.body,e),t.bodyChanged&&t.bodyChanged(),t.loading&&t.loading(!1),this.__fire(`onUpdateBody`))},addBody:function(e){this.__destroyed||(q.addContent.call(this.body,e),t.bodyChanged&&t.bodyChanged(),t.loading&&t.loading(!1),this.__fire(`onUpdateBody`))},createElement:function(e,t){return X(e,t)},setIcon:function(e){t.setIcon&&t.setIcon(e==null?null:String(e))},setStyle:function(e){if(t.addStyle)return t.addStyle(String(e));var n=document.createElement(`style`),r=String(e).replace(/#moduleContent|#container/g,``);n.textContent=document.documentElement.hasAttribute(`data-css-layers`)?`@layer widget{`+r+`
|
|
3
|
+
}`:r,document.head.appendChild(n)},log:function(){this.__debug&&console.log.apply(console,[`[UWA]`].concat([].slice.call(arguments)))}}}function b(e,t){return{__fullSize:!1,canFullSize:!!t.openFull,openFull:function(){t.openFull&&t.openFull()},closeFull:function(){t.closeFull&&t.closeFull()},setFullScreen:function(e){t.setScreen&&t.setScreen(!!e)},__fullScreen:!1,__setFullScreen:function(e,t){if(this.environment&&this.environment.inline||document.documentElement.classList.toggle(`uwa-full-window`,!!t),this.__fullScreen!==!!e){this.__fullScreen=!!e;var n=this;requestAnimationFrame(function(){n.__listens(`onFullScreen`)&&n.__fire(`onFullScreen`,n.fullScreen)})}},__grows:[],__held:{},__fullFits:[],__setRoom:function(e,t){if(e=Number(e),t=Number(t),this.fullSize&&isFinite(e)){this.__grows.forEach(function(n){n(e,t>0?t:void 0)});var n=!1;this.__fullFits.forEach(function(r){r.box.isConnected&&r(e,t>0?t:void 0)&&(n=!0)}),n||this.__fitDone()}},__fitDone:function(){!this.__fitted&&this.fullSize&&(this.__fitted=!0,requestAnimationFrame(function(){requestAnimationFrame(function(){t.fitted&&t.fitted()})}))},__setFullSize:function(e){if(this.__fullSize!==!!e){this.__fullSize=!!e;var t=this;if(this.environment&&this.environment.inline||document.documentElement.classList.toggle(`uwa-full-size`,this.fullSize),e){this.__fitted=!1;var n=function(e){return e.box?e.box.isConnected:e.scroller.isConnected};!this.__fullFits.some(n)&&!this.__grows.some(n)?this.__fitDone():setTimeout(function(){t.__fitDone()},1200)}if(e&&!this.__fullEsc?(this.__fullEsc=function(e){e.key===`Escape`&&t.fullSize&&!e.defaultPrevented&&t.closeFull()},document.addEventListener(`keydown`,this.__fullEsc)):!e&&this.__fullEsc&&(document.removeEventListener(`keydown`,this.__fullEsc),this.__fullEsc=null),!e){this.__grows.forEach(function(e){e(null)});var r=!1;this.__fullFits.forEach(function(e){e.box.isConnected&&!e.restore()&&(r=!0)});var i=this.__held;this.__held={};for(var a=Object.keys(i),o=0;o<a.length;o++)this.__data[a[o]]=i[a[o]];r&&this.__fire(`onLoad`)}requestAnimationFrame(function(){t.__listens(`onFullSize`)&&t.__fire(`onFullSize`,t.fullSize)})}}}}function x(e,t,n){var r=`http://www.w3.org/2000/svg`,i=document.createElement(`div`);i.className=`count-grip`,i.setAttribute(`role`,`separator`),i.setAttribute(`aria-orientation`,`horizontal`),i.setAttribute(`aria-label`,t),i.title=n,i.tabIndex=0;var a=i.appendChild(document.createElementNS(r,`svg`));a.setAttribute(`viewBox`,`0 0 10 10`),a.setAttribute(`aria-hidden`,`true`);var o=a.appendChild(document.createElementNS(r,`path`));o.setAttribute(`d`,`M9 3L3 9M9 6L6 9`),o.setAttribute(`stroke`,`currentColor`),o.setAttribute(`stroke-width`,`1.2`),o.setAttribute(`stroke-linecap`,`round`);var s=getComputedStyle(e).position;return s&&s!==`static`||(e.style.position=`relative`),e.appendChild(i),i}function S(e,t,n,r,i){e.setAttribute(`aria-valuemin`,String(n)),e.setAttribute(`aria-valuemax`,String(Math.max(n,r,t))),e.setAttribute(`aria-valuenow`,String(t)),e.setAttribute(`aria-valuetext`,i)}function C(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey?null:{ArrowDown:1,ArrowUp:-1,Home:`least`,End:`most`}[e.key]||null}function w(){return!!(window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)}function T(e,t){return{__gripTemp:!1,__fitted:!0,__fitCache:{},__gripFollower:function(e,t,n){var r=function(){return e.getBoundingClientRect().top},i=t-r(),a=1,o={h:n,g:r()};return{want:function(e){return o.h+(e-i-r())/a},took:function(e){var t=r();if(Math.abs(e-o.h)>=2){var n=(t-o.g)/(e-o.h);n>.3&&n<1.3&&(a=n)}o={h:e,g:t}}}},__relayGrip:function(e){this.__grip=e,t.gripDrag&&t.gripDrag(!!e)},countGrip:function(e,n,r){r||={};var i=r.min||1,a=null,o=160,s=x(e,`Items shown`,`Drag to show more or fewer items`),c=function(){return Array.prototype.slice.call(e.querySelectorAll(n))},l=this,u=0,d=function(){var e=c().length;u=Math.max(u,e),S(s,e,i,u,u>e?e+` of `+u+` items`:e+(e===1?` item`:` items`))};d(),s.addEventListener(`focus`,d);var f=function(e,t){l.__gripTemp=t;try{r.onDone(e)}finally{l.__gripTemp=!1}},p=function(n,a){if(!r.onDone||!e.isConnected||(p.px=n,p.from=a,p.ran))return!1;p.ran=!0;var o=l.environment&&l.environment.inline?l.body:document.documentElement,s=(a||o.getBoundingClientRect().height)+n,u=Math.round(o.getBoundingClientRect().width);p.before===void 0&&(p.before=c().length);var d=function(e){var t=0;return e.forEach(function(e){t=Math.max(t,e.getBoundingClientRect().bottom)}),t-o.getBoundingClientRect().top},m=0,h=function(){var t=o.getBoundingClientRect().top,n=c();m=n.length?Math.max(0,e.getBoundingClientRect().bottom-t-d(n)):0;var r=n.filter(function(e){return e.getBoundingClientRect().bottom-t+m<=s}).length;return{n:Math.max(i,r),all:n.length}},g=c().length;if(r.onStart){l.__gripTemp=!0;try{r.onStart()}finally{l.__gripTemp=!1}}var _=c().length===g&&(!t.inFlight||t.inFlight()>0),v=parseInt(l.__getValue(`__maxCount`),10);if(v>0)return f(v,!0),!1;var y=Math.round(s)+`x`+u,b=l.__fitCache[y],x=h();if(b&&x.all>=b)return f(b,!0),!1;var S=function(e,t){if(f(e,!0),c().length===e)for(;e<t;){f(e+1,!0);var n=c();if(n.length!==e+1||d(n)+m>s){f(e,!0);break}e++}l.__fitCache[y]=e};if(x.n<x.all||!_)return S(x.n,x.all),!1;var C=new MutationObserver(function(){var e=h();e.n<e.all&&(C.disconnect(),clearTimeout(w),S(e.n,e.all),l.__fitDone())});C.observe(e,{childList:!0,subtree:!0});var w=setTimeout(function(){C.disconnect();var e=h();S(e.n,e.all),l.__fitDone()},1e3);return!0};p.restore=function(){var t=p.before;if(p.before=void 0,p.ran=!1,t===void 0||!e.isConnected)return!0;if(c().length<t)return!1;if(r.onStart){l.__gripTemp=!0;try{r.onStart()}finally{l.__gripTemp=!1}}return f(t,!0),!0},p.box=e,this.__fullFits=this.__fullFits.filter(function(e){return e.box.isConnected}).concat(p);var m=0,h=function(){clearTimeout(m),m=0},g=function(t){if(h(),e.style.height=``,w())e.style.overflow=``,e.style.boxSizing=``;else{var n=e.getBoundingClientRect().height;e.style.height=t+`px`,e.offsetHeight,e.style.transition=`height `+o+`ms ease-out`,e.style.height=n+`px`,m=setTimeout(function(){m=0,e.style.transition=``,e.style.height=``,e.style.overflow=``,e.style.boxSizing=``},o+30)}};s.addEventListener(`dblclick`,function(){if(l.fullSize)l.__deleteValue(`__maxCount`),p.ran=!1,setTimeout(function(){p.px!==void 0&&l.fullSize&&p(p.px,p.from)},o+60);else{var t=r.setting||(l.getPreference(`count`)?`count`:l.getPreference(`limit`)?`limit`:null),n=t?l.getPreference(t):null,a=n?parseInt(n.defaultValue,10):NaN;if(!(a>0)||!r.onDone)return;var s=e.getBoundingClientRect().height;r.onStart&&r.onStart(),f(Math.max(i,a),!1),g(s),d()}});var _=function(){var t=a;if(a=null,document.body.classList.remove(`count-grip-dragging`),l.__relayGrip(null),t){var n=e.getBoundingClientRect().bottom-t.below,o=Math.max(i,c().filter(function(e){var t=e.getBoundingClientRect();return t.top+t.height/2<n}).length),s=e.getBoundingClientRect().height;r.onDone&&(u=Math.max(u,c().length),f(o,l.fullSize),l.fullSize&&l.__setValue(`__maxCount`,String(o))),g(s),d()}},v=null,y=null,b=function(n){v&&v();var o=c().length;if(!a&&o&&r.onDone&&!((n===-1||n===`least`)&&o<=i)){h();var p=e.getBoundingClientRect().height;e.style.boxSizing=`border-box`,e.style.height=p+`px`,e.style.overflow=`hidden`,e.style.transition=``,r.onStart&&r.onStart();var m=c().length;u=Math.max(u,m);var _=n===`least`?i:n===`most`?m:o+n,b=null,x=0,S=0,C=!1,w=function(){C=!0,v=null,y=null,b&&b.disconnect(),clearTimeout(x),clearTimeout(S)},T=function(){if(!C&&(w(),s.isConnected)){var e=c().length;u=Math.max(u,e);var t=Math.max(i,Math.min(_,e)),n=document.activeElement===s;if(f(t,l.fullSize),l.fullSize&&l.__setValue(`__maxCount`,String(t)),g(p),d(),n&&!s.isConnected){var r=l.body&&l.body.querySelector(`.count-grip`);r&&r.focus()}}};if(_<=m)return T();v=T,y=w,S=setTimeout(function(){if(!C){if(c().length>=_||t.inFlight&&t.inFlight()===0)return T();b=new MutationObserver(function(){c().length>=_&&T()}),b.observe(e,{childList:!0,subtree:!0}),x=setTimeout(T,2e3)}},0)}};s.addEventListener(`keydown`,function(e){var t=C(e);t&&(e.preventDefault(),b(t))}),s.addEventListener(`pointerdown`,function(t){v&&t.button===0&&v();var n=c(),i=n[n.length-1];if(i&&t.button===0){h(),t.preventDefault();try{s.setPointerCapture(t.pointerId)}catch{}var o=e.getBoundingClientRect();a={startY:t.clientY,startHeight:o.height,below:o.bottom-i.getBoundingClientRect().bottom,follow:l.__gripFollower(s,t.clientY,o.height)},l.fullSize&&p.before===void 0&&(p.before=n.length),e.style.boxSizing=`border-box`,e.style.height=o.height+`px`,e.style.overflow=`hidden`,e.style.transition=``,document.body.classList.add(`count-grip-dragging`),l.__relayGrip({move:T,end:_}),r.onStart&&r.onStart()}});var T=function(t){if(a){var n=c()[0],r=(n?n.getBoundingClientRect().bottom-e.getBoundingClientRect().top:0)+a.below;e.style.height=Math.max(r,a.follow.want(t))+`px`,a.follow.took(e.getBoundingClientRect().height)}};return s.addEventListener(`pointermove`,function(e){T(e.clientY)}),s.addEventListener(`pointerup`,_),s.addEventListener(`pointercancel`,_),s.release=function(){y&&y(),h(),a&&_(),s.remove()},s},heightGrip:function(e,n,r){r||={};var i=this,a=r.min||80,o=null,s=null,c=null;n.style.overflowY=`auto`;var l=function(e,t){if(e===null){if(c===null)return;n.style.height=c,c=null,s&&(s.style.display=``)}else if(n.isConnected&&(c===null&&(c=n.style.height),s&&(s.style.display=`none`),t>0&&(e=t+e-document.documentElement.getBoundingClientRect().height),!(Math.abs(e)<2))){var r=n.getBoundingClientRect().height+e,i=n.lastElementChild,o=i?Math.ceil(i.getBoundingClientRect().bottom-n.getBoundingClientRect().top+n.scrollTop):0;n.style.height=Math.max(a,Math.min(Math.max(n.scrollHeight,o),r))+`px`}};this.__grows=this.__grows.filter(function(e){return e.scroller.isConnected}).concat(l),l.scroller=n,this.fullSize&&t.askRoom&&setTimeout(function(){t.askRoom()},0);var u=160,d=function(){if(!r.items)return[];var e=n.getBoundingClientRect().top-n.scrollTop;return Array.prototype.slice.call(n.querySelectorAll(r.items)).map(function(t){var n=t.getBoundingClientRect();return{top:n.top-e,bottom:n.bottom-e,heading:/^H[1-6]$/.test(t.tagName)}})},f=function(e,t){var n=d(),r=-1;if(t||=0,!n.length)return Math.max(a,e);for(var i=0;i<n.length;i++)n[i].bottom>t&&(r<0||(n[i].top+n[i].bottom)/2<t+e)&&(r=i);if(r<0)return Math.max(a,e);for(;r>0&&n[r].heading&&n[r-1].bottom>t;)r--;return Math.max(a,Math.round(n[r].bottom-t))};r.height>0&&(n.style.height=f(Math.max(a,r.height))+`px`),s=x(e,`List height`,`Drag to make the list taller or shorter`);var p=function(){var e=Math.round(n.getBoundingClientRect().height),t=Math.max(a,n.scrollHeight),r=d(),i=n.scrollTop,o=r.filter(function(t){return!t.heading&&t.bottom>i&&(t.top+t.bottom)/2<i+e}).length,c=r.filter(function(e){return!e.heading}).length;S(s,e,a,t,c?o+` of `+c+` items`:e+` pixels`)};p(),s.addEventListener(`focus`,p),s.addEventListener(`keydown`,function(e){var t=C(e);if(t&&(e.preventDefault(),!o)){var i=n.getBoundingClientRect().height,s=n.scrollTop,c=Math.max(a,n.scrollHeight),l=i;if(t===`least`)l=f(a,s);else if(t===`most`)l=c;else{for(var d=r.items?8:20;d<=400&&(l-i)*t<1;d+=8)l=f(Math.min(c,Math.max(a,i+t*d)),s);if((l-i)*t<1)return}if(l=Math.min(c,Math.max(a,l)),!(Math.abs(l-i)<1)){var m=!w();n.style.transition=m?`height `+u+`ms ease-out`:``,n.style.height=l+`px`,setTimeout(function(){n.style.transition=``,p(),r.onDone&&r.onDone(l)},m?u+30:0)}}});var m=function(){i.__relayGrip(null);var e=o;if(o=null,document.body.classList.remove(`count-grip-dragging`),e){var t=d(),a=t.length?t[0].top:0,s=0;t.forEach(function(e){Math.abs(e.top-a-n.scrollTop)<Math.abs(s-n.scrollTop)&&(s=e.top-a)}),n.scrollTop=s;var c=f(n.getBoundingClientRect().height,n.scrollTop),l=!w();n.style.transition=l?`height `+u+`ms ease-out`:``,n.style.height=c+`px`,setTimeout(function(){n.style.transition=``,p(),r.onDone&&r.onDone(c)},l?u+30:0)}};s.addEventListener(`pointerdown`,function(e){if(e.button===0){e.preventDefault();try{s.setPointerCapture(e.pointerId)}catch{}var t=n.getBoundingClientRect().height;o={startY:e.clientY,startHeight:t,follow:i.__gripFollower(s,e.clientY,t)},document.body.classList.add(`count-grip-dragging`),i.__relayGrip({move:h,end:m})}});var h=function(e){if(o){var t=Math.max(a,n.scrollHeight);n.style.height=Math.min(t,Math.max(a,o.follow.want(e)))+`px`,o.follow.took(n.getBoundingClientRect().height)}};return s.addEventListener(`pointermove`,function(e){h(e.clientY)}),s.addEventListener(`pointerup`,m),s.addEventListener(`pointercancel`,m),s}}}function E(e){if(e.__standaloneAudio)return e.__standaloneAudio;var t=new Audio;t.preload=`none`;var n=function(t){var n=e.audioState;e.__setAudioState({url:`url`in t?t.url:n.url,playing:`playing`in t?t.playing:n.playing,loading:`loading`in t?t.loading:n.loading,error:`error`in t?t.error:n.error})};t.addEventListener(`playing`,function(){n({playing:!0,loading:!1,error:null})}),t.addEventListener(`waiting`,function(){n({loading:!0})});var r=[];return t.addEventListener(`pause`,function(){var i=t.ended?r.shift():void 0;i?e.__standaloneAudio.play({url:i.url,live:!1,next:r}):(r=[],n({playing:!1,loading:!1}))}),t.addEventListener(`error`,function(){t.getAttribute(`src`)&&n({playing:!1,loading:!1,error:`failed`})}),e.__standaloneAudio={play:function(e){return/^https:\/\//.test(e.url)?(r=e.live===!1&&Array.isArray(e.next)?e.next.filter(function(e){return/^https:\/\//.test(e.url)}).slice(0,100):[],n({url:e.url,loading:!0,error:null}),t.src=e.url,t.play().catch(function(e){e.name!==`AbortError`&&n({playing:!1,loading:!1,error:e.name===`NotAllowedError`?`blocked`:`failed`})}),!0):!1},pause:function(){t.pause(),t.removeAttribute(`src`),t.load()}},e.__standaloneAudio}function D(e,t){return{audioStarted:function(e,n){if(typeof e!=`function`)throw Error(`widget.audioStarted needs a function that stops the sound`);t.audioStarted&&t.audioStarted(e,n||{})},audioStopped:function(){t.audioStopped&&t.audioStopped()},__audioState:{url:null,playing:!1,loading:!1,error:null,away:!1},playAudio:function(e){var n=e||{},r={url:String(n.url||``),relay:!!n.relay,live:n.live!==!1};return!r.live&&Array.isArray(n.next)&&(r.next=n.next.map(function(e){var t=e||{};return{url:String(t.url||``),relay:!!t.relay,title:t.title?String(t.title):void 0,artist:t.artist?String(t.artist):void 0}})),t.playAudio?t.playAudio(r):E(this).play(r)},pauseAudio:function(){return t.pauseAudio?t.pauseAudio():E(this).pause()},seekAudio:function(e){if(t.seekAudio)return t.seekAudio(Number(e));var n=E(this);n.seek&&n.seek(Number(e))},__setAudioState:function(e){var t=e||{};this.__audioState={url:t.url||null,playing:!!t.playing,loading:!!t.loading,error:t.error||null,away:!!t.away,time:typeof t.time==`number`?t.time:null,duration:typeof t.duration==`number`?t.duration:null,elsewhere:t.elsewhere&&t.elsewhere.url?{url:String(t.elsewhere.url),playing:!!t.elsewhere.playing,loading:!!t.elsewhere.loading,time:typeof t.elsewhere.time==`number`?t.elsewhere.time:null,duration:typeof t.elsewhere.duration==`number`?t.elsewhere.duration:null,source:t.elsewhere.source?String(t.elsewhere.source):null}:null},this.__listens(`onAudioState`)&&this.__fire(`onAudioState`,this.audioState)},__videoState:null,__setVideoState:function(e){var t=e&&typeof e==`object`?e:null;this.__videoState=t?{provider:String(t.provider||``),id:String(t.id||``),list:t.list?String(t.list):void 0,playing:!!t.playing}:null,this.__listens(`onVideoState`)&&this.__fire(`onVideoState`,this.videoState)},audioInfo:function(e){t.audioInfo&&e&&t.audioInfo({source:e.source?String(e.source):void 0,title:e.title?String(e.title):void 0,artist:e.artist?String(e.artist):void 0,artwork:e.artwork?String(e.artwork):void 0,artworkType:e.artworkType?String(e.artworkType):void 0,artworkSizes:e.artworkSizes?String(e.artworkSizes):void 0})},playVideo:function(e){if(t.playVideo)return t.playVideo(e);var n=e||{};n.provider===`youtube`&&/^[A-Za-z0-9_-]{11}$/.test(n.id)?window.open(`https://www.youtube.com/watch?v=`+n.id+(/^[A-Za-z0-9_-]{10,64}$/.test(n.list||``)?`&list=`+n.list:``),`_blank`,`noopener`):n.provider===`vimeo`&&/^\d{1,12}$/.test(n.id)?window.open(`https://vimeo.com/`+n.id,`_blank`,`noopener`):n.provider===`arte`&&/^(\d{6}-\d{3}-[A-Z]|RC-\d{6})$/.test(n.id)&&window.open(`https://www.arte.tv/`+(/^(fr|de|en|es|pl|it)$/.test(n.lang||``)?n.lang:`fr`)+`/videos/`+n.id+`/`,`_blank`,`noopener`)},__resumeAudio:function(){this.__resumeQueued=!this.__launched,this.__launched&&this.__fire(`onAudioResume`)}}}function O(e,t,n){return{recall:function(e){return this.__memory[String(e)]},remember:function(e,n){e=String(e),n===void 0?delete this.__memory[e]:this.__memory[e]=n,t.remember&&t.remember(e,n)},getStored:function(e){if(e=String(e),t.getStored)return t.getStored(e);var n=this.__stored[e];return n===void 0?void 0:JSON.parse(JSON.stringify(n))},setStored:function(e,n){e=String(e),n===void 0?delete this.__stored[e]:this.__stored[e]=JSON.parse(JSON.stringify(n)),t.setStored&&t.setStored(e,n)},keptContent:function(e){var t=this.__recall(`content`),n=t&&t[String(e)],r=n&&n._myvibes&&n._myvibes.fetched;return n&&Array.isArray(n.items)&&typeof r==`number`?n:null},keepContent:function(e,t,n){e=String(e);var i=Date.now(),a=this.__recall(`content`)||{},o={},s={};for(var c in t)s[c]=t[c];var l=t._myvibes&&t._myvibes.fetched;s._myvibes=r(r({},t._myvibes||{}),{source:e,fetched:n&&typeof l==`number`?l:i});var u=Object.keys(a).filter(function(t){var n=a[t];return t!==e&&n&&n._myvibes&&i-n._myvibes.fetched<2592e6});return u.sort(function(e,t){return a[t]._myvibes.fetched-a[e]._myvibes.fetched}),u.slice(0,5).forEach(function(e){o[e]=a[e]}),o[e]=s,this.__remember(`content`,o),s},__keepsContent:function(){return this.__refreshAfterError||!(Date.now()<(this.__refreshUntil||0))||!this.body?!1:this.body.children.length>0&&!this.body.querySelector(`.loading`)}}}function k(e,t,n){return{__prepareGoogle:function(){n.prepareGoogle&&n.prepareGoogle()},__connectGoogle:function(e){return n.connectGoogle?n.connectGoogle(e):Promise.reject(/* @__PURE__ */ Error(`Connecting a Google account works from your page, not from this widget alone.`))},setChromeColor:function(e,t){var r=t||{};n.setChromeColor&&n.setChromeColor(e||null,r.background||null)},openPhoto:function(e){if(n.openPhoto)return n.openPhoto(e);e&&e.src&&window.open(String(e.src),`_blank`,`noopener`)},addWidget:function(e){return n.addWidget?n.addWidget(e):!1},dragWidget:function(e,t){return!n.dragWidget||!e?!1:(e.setAttribute(`draggable`,`true`),e.addEventListener(`dragstart`,function(e){var r=typeof t==`function`?t(e):t;r&&n.dragWidget(e,r)||e.preventDefault()}),!0)},openURL:function(e){n.openURL?n.openURL(String(e)):window.open(e,`_blank`,`noopener`)},openPreferences:function(){n.openPreferences&&n.openPreferences()},withPreferencesLink:function(e){var t=this,n=document.createElement(`span`);return String(e).split(/(\[\[[^\]]*\]\])/).forEach(function(e){var r=/^\[\[([^\]]*)\]\]$/.exec(e);if(!r)e&&n.appendChild(document.createTextNode(e));else{var i=document.createElement(`a`);i.href=`#`,i.className=`uwa-prefs-link`,i.textContent=r[1],i.addEventListener(`click`,function(e){e.preventDefault(),t.openPreferences()}),n.appendChild(i)}}),n},shareUrl:function(){var e=t.dashboard||(t.inline?location.origin:``),n=/^(https?:\/\/[^/]+)\/xwa\/([a-z0-9-]+(?:\.[rsu]wa)?)\.x?html$/.exec(String(t.url||``).split(/[?#]/)[0]);return n&&e&&n[1]===e?e+`/add/`+n[2]:null},share:function(e){var t={text:String(e&&e.text||``).slice(0,2e3),url:e&&e.url?String(e.url):``};if(n.share)return n.share(t);var r=t.url?t.text+`
|
|
4
|
+
`+t.url:t.text;if(navigator.share)return navigator.share(t.url?{text:t.text,url:t.url}:{text:t.text}).catch(function(){});navigator.clipboard&&navigator.clipboard.writeText(r)},sendTo:function(){n.sendTo&&this.environment&&this.environment.people&&n.sendTo()},openItems:function(e,t,r){if(n.openItems)return n.openItems(e,t,r||{});var i=e&&e[t];i&&i.url&&window.open(i.url,`_blank`,`noopener`)}}}function A(e,t){return{setSearchResultCount:function(e){this.__searchResultCount=Number(e)||0},isRead:function(e){return Object.prototype.hasOwnProperty.call(this.__read,String(e))},setRead:function(e,n){for(var r=(Array.isArray(e)?e:[e]).map(String).filter(function(e){return e&&e.length<=2e3}).slice(0,500),i=n!==!1,a=0;a<r.length;a++)i?this.__read[r[a]]=!0:delete this.__read[r[a]];r.length&&t.setRead&&t.setRead(r,i)},__setReadKeys:function(e){var t={};(Array.isArray(e)?e:[]).forEach(function(e){typeof e==`string`&&(t[e]=!0)}),this.__read=t,this.__paintRead&&this.__paintRead()},setUnreadCount:function(e){this.__unreadCount=Math.max(0,Math.floor(Number(e))||0),t.setUnreadCount&&t.setUnreadCount(this.__unreadCount)},setMaxValue:function(e,n){var r=Math.floor(Number(n));t.setMaxValue&&e&&r>=0&&t.setMaxValue(String(e),r)},readItems:function(e,t,n){n||={};var r=this,i=function(e){if(n.key)return String(n.key(e)||``);var t=e.querySelector(`a.ext-link[href]`)||e.querySelector(`a[href]`);return t?t.href:``},a=function(){return Array.prototype.slice.call(e.querySelectorAll(t))},o=function(){var e=0;a().forEach(function(t){var n=i(t),a=!!n&&r.isRead(n);t.classList.toggle(`uwa-read`,a),n&&!a&&e++}),document.body.classList.contains(`count-grip-dragging`)||r.setUnreadCount(e)},s=function(n){if(n.type!==`auxclick`||n.button===1){var a=n.target.closest&&n.target.closest(`a[href]`),s=a&&a.closest(t);if(s&&e.contains(s)){var c=i(s);c&&!r.isRead(c)&&(r.setRead(c),o())}}};e.addEventListener(`click`,s,!0),e.addEventListener(`auxclick`,s,!0);var c=null,l=new MutationObserver(function(){clearTimeout(c),c=setTimeout(o,50)});l.observe(e,{childList:!0,subtree:!0}),this.__paintRead=o,this.onReadAll||(this.__readAllItems=function(){var e=a().map(i).filter(Boolean);e.length&&r.setRead(e),o()}),o();var u=this.__readAllItems;return{paint:o,stop:function(){e.removeEventListener(`click`,s,!0),e.removeEventListener(`auxclick`,s,!0),l.disconnect(),clearTimeout(c),r.__paintRead===o&&(r.__paintRead=null),r.__readAllItems===u&&(r.__readAllItems=null)}}},__readAll:function(e){if(e===!1){var t=Object.keys(this.__read);t.length&&this.setRead(t,!1),this.__paintRead&&this.__paintRead()}else{var n=this.__uwaApi&&(typeof this.onReadAll==`function`||typeof this.callbacks.onReadAll==`function`);this.__fire(`onReadAll`)&&!n&&this.__readAllItems&&this.__readAllItems()}}}}function j(){var e=!0,t=/* @__PURE__ */ new Set,n;return{__setShown:function(r){if(r=r!==!1,r!==e){var i=!e||document.hidden;if(e=r,i!==(!e||document.hidden)){var a=new Event(`visibilitychange`);Array.from(t).forEach(function(e){try{typeof e==`function`?e.call(n,a):e&&typeof e.handleEvent==`function`&&e.handleEvent(a)}catch(e){console.error(`[UWA]`,e)}})}}},__document:function(){return n||(n=new Proxy(document,{get:function(n,r){if(r===`hidden`)return!e||n.hidden;if(r===`visibilityState`)return e?n.visibilityState:`hidden`;if(r===`addEventListener`||r===`removeEventListener`)return function(e,i,a){return e===`visibilitychange`&&(r===`addEventListener`?t.add(i):t.delete(i)),n[r](e,i,a)};var i=Reflect.get(n,r,n);return typeof i==`function`?i.bind(n):i},set:function(e,t,n){return Reflect.set(e,t,n,e)}}),n)}}}function M(e,t){return{setPeriodical:function(e,t,n,r){this.clearPeriodical(e);var i=this;this.__periodicals[e]=setInterval(function(){t.call(i)},n),r&&t.call(this)},clearPeriodical:function(e){this.__periodicals[e]&&clearInterval(this.__periodicals[e]),delete this.__periodicals[e]},setAutoRefresh:function(e){if(e=Number(e)||0,this.__listens(`onRefresh`)||(e=0),t.autoRefresh)return t.autoRefresh(e);if(e<=0)return this.clearPeriodical(`autoRefresh`);this.setPeriodical(`autoRefresh`,function(){this.__fire(`onRefresh`)},e*6e4+Math.floor(Math.random()*1e4))}}}function N(e,t,n){return{getPreference:function(e){for(var t=0;t<this.preferences.length;t++)if(this.preferences[t].name===e)return this.preferences[t];return null},__initPreferences:function(){for(var e=0;e<this.preferences.length;e++){var t=this.preferences[e];t.name&&this.__getValue(t.name)==null&&t.defaultValue&&(this.__data[t.name]=String(t.defaultValue))}},getValue:function(e){if(this.__data[e]!==void 0)return this.__data[e];var n=Object.prototype.hasOwnProperty.call(t.values,e)?t.values[e]:void 0;return n===`null`&&(n=null),n!==void 0&&(this.__data[e]=n),n},getInt:function(e){var t=this.__getValue(e);return t===`true`||t===!0?1:(t=parseInt(t,10),isNaN(t)?0:t)},getBool:function(e){return!!this.__getInt(e)},setValue:function(e,t){return this.__data[e]===t||(this.__gripTemp&&!Object.prototype.hasOwnProperty.call(this.__held,e)&&(this.__held[e]=this.__getValue(e)),this.__data[e]=t,this.__gripTemp)||n.setValue(String(e),t==null?``:String(t)),t},deleteValue:function(e){e=String(e),delete this.__data[e],t.values&&delete t.values[e];var r=this.getPreference(e);r&&r.defaultValue!==void 0&&(this.__data[e]=r.defaultValue),n.deleteValue?n.deleteValue(e):n.setValue(e,``)}}}var P={onLoad:`load`,onLoadComplete:`loadcomplete`,onRefresh:`refresh`,onResize:`resize`,onUpdateBody:`updatebody`,onUpdatePreferences:`updatepreferences`,onHideEdit:`hideedit`,onReadAll:`readall`,onAudioState:`audiostate`,onAudioResume:`audioresume`,onVideoState:`videostate`,onFullSize:`fullsize`,onFullScreen:`fullscreen`,__settingsChange:`settingschange`,__action:`action`,__photoDelete:`photodelete`,__filesChange:`fileschange`},F={readall:!0,settingschange:!0},I=typeof Event==`function`?(function(){function e(t,n){var r=Reflect.construct(Event,[t,n||{}],new.target||e);return Object.defineProperty(r,"__detail",{value:n&&`detail`in n?n.detail:null}),Object.defineProperty(r,"__promises",{value:null,writable:!0}),Object.defineProperty(r,"__signal",{value:n&&n.signal?n.signal:null}),r}return e.prototype=Object.create(Event.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.setPrototypeOf(e,Event),Object.defineProperty(e.prototype,"detail",{get:function(){return this.__detail},configurable:!0}),Object.defineProperty(e.prototype,"signal",{get:function(){return this.__signal},configurable:!0}),e.prototype.waitUntil=function(e){if(!this.__promises)throw new DOMException(`waitUntil is only for a load being dispatched (load, refresh)`,`InvalidStateError`);this.__promises.push(Promise.resolve(e))},e})():null;function L(e,t,n,r){try{var i={detail:Object.assign({widget:t},n||{})};typeof r==`number`&&(i.startTime=r),performance.mark(`xwa:`+e,i)}catch{}}function R(e,t){return e}function z(e){return e&&typeof e==`object`&&(Object.keys(e).forEach(function(t){z(e[t])}),Object.freeze(e)),e}function B(e,t,n){var r=e.__uwaApi,i=function(t,n,i){Object.defineProperty(e,t,{get:n,set:r?i:void 0,enumerable:!0,configurable:!0})},a=function(t){Object.defineProperty(e,t,{value:e[t],writable:!!r,enumerable:!0,configurable:!0})};i(`title`,function(){return e.__title},function(t){e.__title=t}),i(`body`,function(){return e.__body},function(t){e.__body=t}),i(`fullSize`,function(){return e.__fullSize},function(t){e.__fullSize=t}),i(`fullScreen`,function(){return e.__fullScreen},function(t){e.__fullScreen=t}),i(`audioState`,function(){return r?e.__audioState:Object.freeze(e.__audioState)},function(t){e.__audioState=t}),i(`videoState`,function(){return r||!e.__videoState?e.__videoState:Object.freeze(e.__videoState)},function(t){e.__videoState=t});var o=null,s=null;i(`preferences`,function(){return r?e.__preferences:(o!==e.__preferences&&(o=e.__preferences,s=z(JSON.parse(JSON.stringify(o||[])))),s)},function(t){e.__preferences=t}),r?(e.data=e.__data,e.periodicals=e.__periodicals,e.launch=e.__launch,e.endEdit=e.__endEdit,e.initPreferences=e.__initPreferences,i(`debugMode`,function(){return e.__debug},function(t){e.__debug=t}),i(`unreadCount`,function(){return e.__unreadCount},function(t){e.__unreadCount=t}),i(`searchResultCount`,function(){return e.__searchResultCount},function(t){e.__searchResultCount=t})):(i(`metas`,n),e.environment=Object.freeze(e.environment),[`id`,`uwaUrl`,`lang`,`locale`,`environment`,`canFullSize`,`settings`,`storage`].forEach(a))}function V(e,t,n){t=R(t,e.instance);var a=e.metas||{},o=a.debugMode===`true`,s=null,c={id:e.instance,__title:e.title,__body:null,__data:{},callbacks:{},__preferences:e.preferences||[],metas:a,__debug:o,elements:{},__periodicals:{},apiVersion:`1.2`,lang:(e.lang||`en-US`).replace(`-`,`_`),locale:(e.lang||`en-US`).split(`-`)[1]?(e.lang||`en-US`).split(`-`)[1].toLowerCase():`us`,dir:`ltr`,readOnly:!1,isNew:!1,uwaUrl:e.url,__searchResultCount:0,__unreadCount:0,__memory:e.memory||{},__stored:e.stored||{},__read:(e.read||[]).reduce(function(e,t){return typeof t==`string`&&(e[t]=!0),e},{}),environment:{name:`myvibes`,standalone:!!e.standalone,inline:!!e.inline,style:e.theme?String(e.theme):``,people:e.people&&typeof e.people.me==`string`?Object.freeze({me:e.people.me,from:e.people.from||null,to:e.people.to||null}):null},__fire:function(e,n,r){var a=e===`onLoad`||e===`onRefresh`;(e===`onLoad`||e===`onRefresh`)&&t.loading&&t.loading(!0),(e===`onRefresh`||e===`onLoad`&&this.__retrying)&&(this.__afterEdit||(this.__refreshUntil=Date.now()+3e4),this.__refreshAfterError=this.__errorBoxes().length>0,this.__refreshAfterError||(this.__retries=0),this.__errorBoxes().forEach(function(e){e.remove()}));for(var o=[],s=this.__uwaApi?[this[e],this.callbacks[e]]:[],c=0;c<s.length;c++)if(typeof s[c]==`function`)try{var u=s[c].call(r||this,n);a&&u&&typeof u.then==`function`&&o.push(u)}catch(e){l(e)}var d=!0,f=P[e];if(f&&this.__dispatch){var p=null;a&&typeof AbortController==`function`&&(this.__loadAbort&&this.__loadAbort.abort(),this.__loadAbort=new AbortController,p=this.__loadAbort.signal);var m=new I(f,{detail:n===void 0?null:n,cancelable:!!F[f],signal:p});a&&(m.__promises=[]),e===`__action`&&this.__actionToken&&i&&i.set(m,this.__actionToken),d=this.__dispatch(m),a&&(m.__promises.forEach(function(e){o.push(e.catch(l))}),m.__promises=null)}return o.length&&t.loading?Promise.allSettled(o).then(function(){t.loading(!1),t.bodyChanged&&t.bodyChanged()}):a&&!this.__uwaApi&&(t.loading&&t.loading(!1),t.bodyChanged&&t.bodyChanged()),e===`onLoad`&&!this.__actionsReady&&(this.__declaredActions()||[]).length&&this.__tellActions(),d},__listens:function(e){return this.__uwaApi&&(typeof this[e]==`function`||typeof this.callbacks[e]==`function`)||(this.__listening?this.__listening(P[e]):!1)},__attach:function(e){this.__body=e,this.elements&&(this.elements.body=e)},__launch:function(){if(e.preferences&&(this.__preferences=e.preferences),r(a,e.metas||{}),s=null,this.__debug=a.debugMode===`true`,this.environment&&this.environment.inline||document.documentElement.classList.toggle(`uwa-cover`,/(^|[,;\s])viewport-fit\s*=\s*cover\b/i.test(a.viewport||``)),e.title&&(this.__title=e.title),this.__initPreferences(),a.autoRefresh&&this.setAutoRefresh(a.autoRefresh),this.__starting=!0,L(`load`,e.instance),this.__fire(`onLoad`),this.__starting=!1,t&&t.__marksLaunched&&t.__marksLaunched(),this.__staleFeeds){var n=this;setTimeout(function(){n.__staleFeeds=!1,n.__listens(`onRefresh`)?n.__fire(`onRefresh`):n.__fire(`onLoad`)},0)}this.__fire(`onLoadComplete`),this.__launched=!0,this.__resumeQueued&&this.__resumeAudio()},__endEdit:function(e){var t=Array.isArray(e)?e.slice():[];if(!t.length||this.__fire(`__settingsChange`,{names:t})){this.__afterEdit=!0,this.__refreshUntil=0;try{this.__listens(`onRefresh`)?this.__fire(`onRefresh`):this.__fire(`onLoad`)}finally{this.__afterEdit=!1}}this.__fire(`onHideEdit`)},__applySettings:function(e){var t=[];for(var n in e)String(this.__getValue(n))!==String(e[n])&&t.push(n),this.__data[n]=e[n];this.__endEdit(t)},__errorBoxes:function(){var e=this.body&&this.body.parentNode;return Array.prototype.slice.call(e?e.querySelectorAll(`:scope > .uwa-error`):document.querySelectorAll(`.uwa-error`))},__retryLoad:function(){if(!(this.__retryTimer||this.__destroyed)){var e=this,t=[15,30,60,120,300],n=t[Math.min(this.__retries||0,t.length-1)]*1e3;this.__retries=(this.__retries||0)+1,this.__retryTimer=setTimeout(function(){if(e.__retryTimer=null,e.__destroyed||!e.__errorBoxes().length)e.__errorBoxes().length||(e.__retries=0);else{e.log(`trying again after a failed load`),e.__retrying=!0;try{e.__fire(e.__listens(`onRefresh`)?`onRefresh`:`onLoad`)}finally{e.__retrying=!1}}},n)}},__destroy:function(){for(var e in this.__loadAbort&&this.__loadAbort.abort(),this.__destroyed=!0,this.__unwatchAudio&&this.__unwatchAudio(),this.__unwatchVideo&&this.__unwatchVideo(),this.__unwatchFiles&&this.__unwatchFiles(),this.__unwatchFull&&this.__unwatchFull(),this.__unwatchScreen&&this.__unwatchScreen(),this.__unwatchRoom&&this.__unwatchRoom(),clearTimeout(this.__retryTimer),this.__periodicals)this.clearPeriodical(e)}};Object.assign(c,y(c,t),N(c,e,t),D(c,t),b(c,t),M(c,t),f(c,e,t),O(c,t,n),A(c,t),k(c,e,t),T(c,t),j());function l(e){t.loading&&t.loading(!1),console.error(`[UWA]`,e);var n=document.createElement(`div`);n.className=`uwa-error`,n.textContent=typeof e==`string`?e:`Widget error: `+(e&&e.message?e.message:String(e));var r=c.body;r&&r.parentNode?r.parentNode.insertBefore(n,r):document.body.insertBefore(n,document.body.firstChild)}c.__showError=l,c.__uwaApi=J(e),c.__keptContent=c.keptContent,c.__keepContent=c.keepContent,c.__recall=c.recall,c.__remember=c.remember,c.__getStored=c.getStored,c.__setStored=c.setStored,c.__getValue=c.getValue,c.__getInt=c.getInt,c.__getBool=c.getBool,c.__setValue=c.setValue,c.__deleteValue=c.deleteValue;var u=function(e,t){var n=c.getPreference(String(e));if(!n&&t)throw TypeError(`widget.settings.`+t+`: no setting "`+e+`" in the widget's form`);return n},d=function(e){return String(e)===`title`&&!c.getPreference(`title`)};c.settings=Object.freeze({get:function(e){if(d(e))return c.getTitle();var t=u(e);if(t){var n=c.__getValue(t.name);if(n??=t.defaultValue,t.type===`boolean`)return n===!0||n===`true`;if(t.type===`range`||t.type===`number`){var r=n===``||n==null?NaN:Number(n);return isFinite(r)?r:null}return n==null?``:String(n)}},set:function(e,t){var n=u(e,`set`);if(n.type===`boolean`){if(typeof t!=`boolean`)throw TypeError(`widget.settings.set: "`+n.name+`" is a checkbox: true or false`);t=t?`true`:`false`}else if(n.type===`range`||n.type===`number`){if(typeof t!=`number`||!isFinite(t))throw TypeError(`widget.settings.set: "`+n.name+`" is a number`);t=String(t)}else t=t==null?``:String(t);c.__setValue(n.name,t)},reset:function(e){c.__deleteValue(u(e,`reset`).name)}}),c.refresh=function(){c.__destroyed||(c.__listens(`onRefresh`)?c.__fire(`onRefresh`):c.__fire(`onLoad`))};var p={content:!0,"uwa-feeds":!0},m=function(e,t,n){var r=function(e){if(e=String(e),n&&Object.prototype.hasOwnProperty.call(p,e))throw TypeError(`"`+e+`" is the runtime's own key`);return e},i=function(e){var t=JSON.stringify(e);if(t===void 0)throw TypeError(`A stored value must be JSON (not undefined or a function)`);return JSON.parse(t)};return Object.freeze({get:function(t){return new Promise(function(n){var a=e(r(t));n(a===void 0?void 0:i(a))})},set:function(e,n){return new Promise(function(a){t(r(e),i(n)),a()})},delete:function(e){return new Promise(function(n){t(r(e),void 0),n()})}})},g=function(e,n,r,i){return t.files?t.files(e,n,r,i):Promise.reject(new DOMException(`widget.storage.files: not here`,`NotSupportedError`))};if(c.storage=Object.freeze({memory:m(function(e){return c.__recall(e)},function(e,t){c.__remember(e,t)},!0),local:m(function(e){return c.__getStored(e)},function(e,t){c.__setStored(e,t)},!1),files:Object.freeze({list:function(){return g(`list`)},get:function(e){return g(`get`,String(e))},add:function(e,t){return typeof Blob==`function`&&e instanceof Blob?g(`add`,void 0,e,t):Promise.reject(/* @__PURE__ */ TypeError(`widget.storage.files.add: a Blob is needed`))},delete:function(e){return g(`delete`,String(e)).then(function(){})}})}),c.__uwaApi||(delete c.callback,delete c.setCallback,delete c.callbacks,delete c.loadContent,delete c.keptContent,delete c.keepContent,delete c.getValue,delete c.getInt,delete c.getBool,delete c.setValue,delete c.deleteValue,delete c.remember,delete c.recall,delete c.getStored,delete c.setStored,[`addPreference`,`apiVersion`,`data`,`debugMode`,`dir`,`elements`,`endEdit`,`initPreferences`,`isNew`,`launch`,`periodicals`,`readOnly`,`saveValues`,`searchResultCount`,`setCSS`,`setDebugMode`,`setMetas`,`setPreferences`,`unreadCount`].forEach(function(e){delete c[e]})),B(c,e,function(){return s||=z(JSON.parse(JSON.stringify(a)))}),I&&typeof EventTarget==`function`){var _=new EventTarget;Object.setPrototypeOf(c,EventTarget.prototype);var x={},S=function(e,t,n){for(var r=x[e]||[],i=0;i<r.length;i++)if(r[i].fn===t&&r[i].capture===n)return r[i];return null},C=function(e,t){var n=x[e]||[],r=n.indexOf(t);r>=0&&n.splice(r,1),_.removeEventListener(e,t.wrapped,t.capture)};c.addEventListener=function(e,t,n){if(!(!t||typeof t!=`function`&&typeof t.handleEvent!=`function`)){e=String(e);var r=typeof n==`boolean`?n:!!(n&&n.capture),i=n&&typeof n==`object`?n.signal:null,a=!!(n&&typeof n==`object`&&n.once),o=!!(n&&typeof n==`object`&&n.passive);if(!(i&&i.aborted||S(e,t,r))){var s={fn:t,capture:r};s.wrapped=function(n){a&&C(e,s);try{typeof t==`function`?t.call(c,n):t.handleEvent(n)}catch(e){l(e)}},(x[e]||(x[e]=[])).push(s),_.addEventListener(e,s.wrapped,{capture:r,passive:o}),i&&i.addEventListener(`abort`,function(){C(e,s)},{once:!0})}}},c.removeEventListener=function(e,t,n){var r=typeof n==`boolean`?n:!!(n&&n.capture),i=S(String(e),t,r);i&&C(String(e),i)},c.dispatchEvent=function(e){return _.dispatchEvent(e)},c.__dispatch=function(e){return _.dispatchEvent(e)},c.__listening=function(e){return!!(e&&x[e]&&x[e].length)}}return t.watchAudio&&(c.__unwatchAudio=t.watchAudio(function(e){c.__setAudioState(e)})),t.watchFiles&&(c.__unwatchFiles=t.watchFiles(function(){c.__fire(`__filesChange`)})),t.watchVideo&&(c.__unwatchVideo=t.watchVideo(function(e){c.__setVideoState(e)})),t.watchFull&&(c.__unwatchFull=t.watchFull(function(e){c.__setFullSize(e)})),t.watchScreen&&(c.__unwatchScreen=t.watchScreen(function(e,t){c.__setFullScreen(e,t)})),t.watchRoom&&(c.__unwatchRoom=t.watchRoom(function(e,t){c.__setRoom(e,t)})),n.Feeds={},n.Data=v(t,c,n),n.Content=h,t.addWidget||delete c.addWidget,c}var H;function U(){H=window.UWA={}}function W(e){this.module=e.module||window.widget,this.limit=Math.max(1,Number(e.limit)||10),this.offset=Math.max(0,Number(e.offset)||0),this.total=e.dataArray?e.dataArray.length:Number(e.total)||0,this.onChange=e.onChange||null}W.prototype.go=function(e){this.offset=e,this.onChange&&this.onChange.call(this,e)},W.prototype.getContent=function(){var e=this,t=Math.floor(this.offset/this.limit),n=Math.max(1,Math.ceil(this.total/this.limit)),r=X(`div`,{class:`nv-pager`});function i(t,n,r){var i=X(`a`,{href:`#`,class:r});return q.setText.call(i,t),i.addEventListener(`click`,function(t){t.preventDefault(),e.go(n)}),i}t>0&&r.appendChild(i(`« Previous`,(t-1)*this.limit,`prev`));var a=X(`span`,{class:`status`});return q.setText.call(a,t+1+` / `+n),r.appendChild(a),t+1<n&&r.appendChild(i(`Next »`,(t+1)*this.limit,`next`)),r};function G(e,t){window.widget=e,K(e)}function K(e){window.addEventListener(`error`,function(t){if(!/ResizeObserver loop/.test(String(t.message||``))){if(!t.error&&!t.filename&&!t.lineno)return console.warn(`[UWA] an error from a script not the widget’s:`,t.message);e.__showError(t.error||t.message)}}),window.addEventListener(`unhandledrejection`,function(t){e.__showError(t.reason)})}var q={addContent:function(e){var t=e;if((typeof e==`string`||typeof e==`number`)&&(t=document.createElement(`div`),t.innerHTML=String(e)),Array.isArray(e)){for(var n=0;n<e.length;n++)q.addContent.call(this,e[n]);return this}return t&&this.appendChild(t),Y(t)},setContent:function(e){return typeof e==`string`||typeof e==`number`?this.innerHTML=String(e):(q.empty.call(this),e!=null&&q.addContent.call(this,e)),this},empty:function(){for(;this.firstChild;)this.removeChild(this.firstChild);return this}};function J(e){return!1}function Y(e){return typeof e==`string`&&(e=document.getElementById(e)),e||null}function X(e,t){var n=document.createElement(e);if(!t||typeof t!=`object`)return n;for(var r in t){var i=t[r];r===`styles`?q.setStyles.call(n,i):r===`attributes`?q.setAttributes.call(n,i):r===`id`?n.id=i:r===`class`||r===`className`?n.className=i:r===`events`?q.addEvents.call(n,i):n.setAttribute(r,i)}return n}function Z(e){var t=e.faces;if(t&&t.length){delete e.faces;for(var n=0;n<t.length;n++){var r=t[n];try{for(var i=atob(r.data),a=new Uint8Array(i.length),o=0;o<i.length;o++)a[o]=i.charCodeAt(o);var s=new FontFace(r.family,a.buffer,r.descriptors||{});document.fonts.add(s)}catch{}}}}function Q(){var n={},r={},i=0;function a(t){t.uwa=e.instance,parent.postMessage(t,`*`)}var o=!0,s=Object.getOwnPropertyDescriptor(Document.prototype,`hidden`),c=Object.getOwnPropertyDescriptor(Document.prototype,`visibilityState`);if(s&&s.get&&c&&c.get){var l=s.get,u=c.get;Object.defineProperty(document,"hidden",{configurable:!0,get:function(){return!o||l.call(document)}}),Object.defineProperty(document,"visibilityState",{configurable:!0,get:function(){return o?u.call(document):`hidden`}})}function d(e){e!==o&&(o=e,document.dispatchEvent(new Event(`visibilitychange`)))}var f=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable=""], [contenteditable="true"], audio[controls], video[controls]`;function p(e){if(!e.matches(f)||e.disabled||e.tabIndex<0||e.getAttribute(`type`)===`hidden`)return!1;var t=e.getBoundingClientRect();return t.width>0&&t.height>0&&getComputedStyle(e).visibility!==`hidden`}function m(){var e=function(e){for(var t=e.querySelectorAll(f),n=0;n<t.length;n++)if(p(t[n]))return t[n];return null},t=document.querySelector(`[data-autofocus], [autofocus]`);if(t){if(p(t))return t;var n=e(t);if(n)return n}return e(document.body)}var h=null;document.addEventListener(`focusin`,function(e){e.target&&e.target.nodeType===1&&e.target!==document.body&&(h=e.target)});var g=`input, textarea, select, [contenteditable=""], [contenteditable="true"], audio, video, [role="slider"], [role="spinbutton"], [role="listbox"], [role="combobox"], [role="menu"], [role="menubar"], [role="tablist"], [role="radiogroup"], [role="tree"], [role="grid"], [role="application"]`;function _(e,t){for(var n=t===`ArrowDown`,r=t===`ArrowUp`,i=t===`ArrowRight`,a=e;a&&a.nodeType===1;a=a.parentElement){var o=a===document.documentElement,s=getComputedStyle(a);if(r||n){if((o||/auto|scroll/.test(s.overflowY))&&a.scrollHeight-a.clientHeight>1&&(n?a.scrollTop+a.clientHeight<a.scrollHeight-1:a.scrollTop>0))return!0}else if((o||/auto|scroll/.test(s.overflowX))&&a.scrollWidth-a.clientWidth>1&&(i?a.scrollLeft+a.clientWidth<a.scrollWidth-1:a.scrollLeft>0))return!0}return!1}var v=!1,y=function(){v=!1};window.addEventListener(`pointerdown`,y,!0),window.addEventListener(`pointermove`,y,!0),window.addEventListener(`keydown`,function(e){if(!(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.isComposing||t.__fullScreen)){var n=e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`;if((n||e.key===`Escape`||e.key===`Tab`)&&(v||(v=!0,a({type:`keys`})),e.key!==`Tab`)){var r=e.target&&e.target.nodeType===1?e.target:document.body,i=n&&(r.closest(g)||_(r,e.key)),o=t.fullSize;setTimeout(function(){e.defaultPrevented||i||(n?a({type:`arrow`,key:e.key}):o||a({type:`escape`}))},0)}}});var b=function(e){return!!e.dataTransfer&&Array.prototype.indexOf.call(e.dataTransfer.types||[],`Files`)!==-1};window.addEventListener(`dragover`,function(e){!e.defaultPrevented&&b(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`none`)}),window.addEventListener(`drop`,function(e){!e.defaultPrevented&&b(e)&&e.preventDefault()}),window.addEventListener(`message`,function(i){if(i.source===parent){var o=i.data;if(o&&o.uwa===e.instance){if(o.type===`saveFileResult`){var s=r[o.reqId];if(!s)return;delete r[o.reqId],o.ok?s.resolve():s.reject(new DOMException(`saveFile: `+String(o.error),/^(NotAllowed|NotSupported|QuotaExceeded|Abort)Error$/.test(o.error)?o.error:`NotSupportedError`))}else if(o.type===`dashboardResponse`){var c=r[o.reqId];if(!c)return;delete r[o.reqId],o.ok?c.resolve(o.answer):c.reject(TypeError(o.error||`Failed to fetch`))}else if(o.type===`response`){var l=n[o.reqId];if(!l)return;delete n[o.reqId],o.ok?l.resolve(o.data):l.reject(Error(o.error))}else if(o.type===`key`){if(/^(Arrow(Up|Down|Left|Right)|Enter|Escape)$/.test(o.key)&&document.hasFocus()){var u=document.activeElement||document.body,f=u.dispatchEvent(new KeyboardEvent(o.down?`keydown`:`keyup`,{key:o.key,code:o.key,bubbles:!0,cancelable:!0,composed:!0}));o.down&&o.key===`Enter`&&f&&u.matches(`button, a[href], summary, [role="button"], input[type="button"], input[type="submit"]`)&&!u.disabled&&u.click()}}else if(o.type===`focusBack`){var g=document.activeElement;if(h&&document.hasFocus()&&(!g||g===document.body||g===document.documentElement)){var _=h.isConnected&&p(h)?h:m();_&&_.focus({focusVisible:!0})}}else if(o.type===`focus`){var v=m();v&&v.focus({focusVisible:!0})}else if(o.type===`tabShown`)d(o.shown!==!1);else if(o.type===`refresh`)t.__listens(`onRefresh`)?t.__fire(`onRefresh`):t.__fire(`onLoad`);else if(o.type===`valueRefused`)console.warn(`settings.set("`+o.name+`"): not saved by the host, `+o.why+`. The widget keeps it until it reloads.`);else if(o.type===`prefsSaved`)t.__applySettings(o.values||{});else if(o.type===`gripMove`)t.__grip&&typeof o.y==`number`&&t.__grip.move(o.y);else if(o.type===`gripEnd`)t.__grip&&t.__grip.end();else if(o.type===`resize`)t.__fire(`onResize`);else if(o.type===`audioResumeAfterLoad`)t.__resumeAudio();else if(o.type===`audioState`)t.__setAudioState(o.state);else if(o.type===`filesResult`){var y=r[o.reqId];if(!y)return;if(delete r[o.reqId],o.ok)y.resolve(o.value);else{var b=o.error||{},w=String(b.message||`widget.storage.files: refused`);y.reject(b.name===`TypeError`?TypeError(w):b.name===`RangeError`?RangeError(w):new DOMException(w,/^(NotFound|Network|NotSupported|QuotaExceeded)Error$/.test(b.name)?b.name:`UnknownError`))}}else if(o.type===`filesChanged`)t.__fire(`__filesChange`);else if(o.type===`videoState`)t.__setVideoState(o.state);else if(o.type===`fullSize`)t.__setFullSize(o.on);else if(o.type===`fullScreen`)t.__setFullScreen(o.on,o.whole);else if(o.type===`fullRoom`)t.__setRoom(o.px,o.from);else if(o.type===`measure`){var T=o.seq,E=!1,D=function(){E||(E=!0,a({type:`measured`,seq:T,height:document.documentElement.getBoundingClientRect().height,width:window.innerWidth}))};requestAnimationFrame(function(){requestAnimationFrame(D)}),setTimeout(D,100)}else if(o.type===`itemOpened`){if(typeof S==`function`)try{S(Number(o.index))}catch(e){t.__showError(e)}}else if(o.type===`readKeys`)t.__setReadKeys(o.keys);else if(o.type===`readAll`)t.__readAll(o.read!==!1);else if(o.type===`action`)t.__runAction(String(o.id),o.token);else if(o.type===`photoDelete`)t.__fire(`__photoDelete`,{id:String(o.id)});else if(o.type===`stored`&&typeof o.key==`string`)o.value===void 0?delete t.__stored[o.key]:t.__stored[o.key]=o.value,t.__dispatch(new CustomEvent(`storagechange`,{detail:{key:o.key}}));else if(o.type===`askActions`)t.__askActions();else if(o.type===`accent`)[`--accent`,`--accent-ink`,`--accent-glow`].forEach(function(e){var t=o.vars&&o.vars[e];typeof t==`string`&&/^#[\da-f]{3,8}$/i.test(t)&&document.documentElement.style.setProperty(e,t)});else if(o.type===`look`){var O=document.documentElement;O.classList.toggle(`uwa-neutral`,!!o.neutral),[`--module-color`,`--module-paper`,`--module-accent`].forEach(function(e){var t=o.vars&&o.vars[e];typeof t==`string`?O.style.setProperty(e,t):O.style.removeProperty(e)})}else if(/^audio(Stop|Resume|Volume|Next|Previous)$/.test(o.type)){var k={audioStop:x,audioResume:C.resume,audioVolume:C.setVolume,audioNext:C.next,audioPrevious:C.previous}[o.type];if(typeof k==`function`)try{k(Number(o.volume))}catch(e){t.__showError(e)}}}}});var x=null,S=null,C={},w=0;function T(){var e=Math.round(document.documentElement.getBoundingClientRect().height*100)/100;e!==w&&(w=e,a({type:`height`,height:e}))}var E=0;function D(){E||=setTimeout(function(){E=0,T()},250)}return window.addEventListener(`load`,T),window.addEventListener(`resize`,D),document.addEventListener(`load`,D,!0),document.addEventListener(`visibilitychange`,function(){document.hidden||T()}),document.fonts&&document.fonts.addEventListener&&document.fonts.addEventListener(`loadingdone`,D),document.addEventListener(`DOMContentLoaded`,function(){new ResizeObserver(T).observe(document.documentElement),new MutationObserver(D).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),typeof IntersectionObserver==`function`&&new IntersectionObserver(function(e){e.some(function(e){return e.isIntersecting})&&T()}).observe(document.documentElement),T()}),{bodyChanged:function(){setTimeout(T,0)},inFlight:function(){return Object.keys(n).length+Object.keys(r).length},request:function(e,t){return new Promise(function(r,o){var s=++i;n[s]={resolve:r,reject:o},a({type:`request`,reqId:s,kind:e,url:t})})},setTitle:function(e){a({type:`setTitle`,title:e})},setTitleLinks:function(e){a({type:`setTitleLinks`,parts:e})},setValue:function(e,t){a({type:`setValue`,name:e,value:t})},deleteValue:function(e){a({type:`deleteValue`,name:e})},addWidget:e.noAdd?void 0:function(e){var t=e||{};return a({type:`addWidget`,spec:{file:String(t.file||``),title:t.title==null?void 0:String(t.title),values:t.values&&typeof t.values==`object`?JSON.parse(JSON.stringify(t.values)):void 0}}),!0},playVideo:function(e){var t=e||{};a({type:`playVideo`,video:{provider:String(t.provider||``),id:String(t.id||``),title:t.title==null?void 0:String(t.title),list:t.list==null?void 0:String(t.list),lang:t.lang==null?void 0:String(t.lang)}})},openURL:function(e){a({type:`openURL`,url:e})},openPreferences:function(){a({type:`openPreferences`})},gripDrag:function(e){a({type:`gripDrag`,on:!!e})},sendTo:function(){a({type:`sendTo`})},share:function(e){a({type:`share`,text:String(e&&e.text||``).slice(0,2e3),url:e&&e.url?String(e.url):``})},openItems:function(e,t,n){n||={},S=typeof n.onOpen==`function`?n.onOpen:null;var r=(Array.isArray(e)?e:[]).map(function(e){return e||={},{url:String(e.url||``),link:typeof e.link==`string`?e.link:void 0,title:String(e.title||``),content:typeof e.content==`string`?e.content:void 0,prefer:typeof e.prefer==`string`?e.prefer:void 0,truncated:e.truncated===!0||void 0,date:typeof e.date==`string`?e.date:void 0,summary:typeof e.summary==`string`?e.summary:void 0,read:e.read===!0||void 0,author:typeof e.author==`string`?e.author:void 0,excerpt:e.excerpt===!0||void 0,image:typeof e.image==`string`?e.image:void 0}}),i=Array.isArray(n.frameable)?n.frameable.map(String):void 0;a({type:`openItems`,items:r,index:Number(t),options:{prefer:n.prefer?String(n.prefer):void 0,frameable:i,onOpen:!!S}})},audioStarted:function(e,t){x=e,C=t||{},a({type:`audioStarted`,resume:!!C.resume,volume:!!C.setVolume,next:!!C.next,previous:!!C.previous,elsewhere:!!C.elsewhere})},audioStopped:function(){a({type:`audioStopped`})},playAudio:function(e){return a({type:`playAudio`,spec:e}),!0},pauseAudio:function(){a({type:`pauseAudio`})},seekAudio:function(e){a({type:`seekAudio`,seconds:e})},setChromeColor:function(e,t){a({type:`setChromeColor`,color:e,background:t})},openPhoto:function(e){a({type:`openPhoto`,spec:e&&{src:e.src,alt:e.alt,title:e.title,preview:e.preview,zoom:e.zoom,width:e.width,height:e.height,credit:e.credit,deletable:e.deletable,id:e.id,file:e.file,files:Array.isArray(e.files)?e.files.slice(0,5e3):void 0}})},openFull:function(){a({type:`openFull`})},closeFull:function(){a({type:`closeFull`})},askRoom:function(){a({type:`askRoom`})},fitted:function(){a({type:`fitted`,height:document.documentElement.getBoundingClientRect().height})},setScreen:function(e){a({type:`setScreen`,on:e})},setIcon:function(e){a({type:`setIcon`,url:e})},audioInfo:function(e){a({type:`audioInfo`,info:e})},setRead:function(e,t){a({type:`setRead`,keys:e,read:t})},remember:function(e,t){a({type:`remember`,key:e,value:t})},setStored:function(e,t){a({type:`setStored`,key:e,value:t})},dashboardFetch:function(e){return new Promise(function(t,n){var o=++i;r[o]={resolve:t,reject:n},a({type:`dashboardFetch`,reqId:o,url:e.url,method:e.method,body:e.body,contentType:e.contentType})})},openPopup:function(e,t,n){a({type:`openPopup`,url:e,name:t,features:n})},prepareGoogle:function(){a({type:`prepareGoogle`})},connectGoogle:function(e){return new Promise(function(t,n){var o=++i;r[o]={resolve:t,reject:n},a({type:`connectGoogle`,reqId:o,scope:e&&e.scope,account:e&&e.account})})},autoRefresh:function(e){a({type:`autoRefresh`,minutes:e})},loading:function(e){a({type:`loading`,on:!!e})},setUnreadCount:function(e){a({type:`setUnreadCount`,count:e})},saveFile:function(e){return new Promise(function(t,n){var o=++i;r[o]={resolve:t,reject:n},a({type:`saveFile`,reqId:o,token:e.token,name:e.name,mime:e.type,data:e.data})})},setActionStates:function(e){a({type:`setActionStates`,states:e})},files:function(e,t,n,o){return new Promise(function(s,c){var l=++i;r[l]={resolve:s,reject:c};try{a({type:`files`,reqId:l,op:e,id:t,file:n,meta:o})}catch{delete r[l],c(/* @__PURE__ */ TypeError(`widget.storage.files.add: the meta must be a JSON value`))}})},setMaxValue:function(e,t){a({type:`setMaxValue`,name:e,max:t})}}}function $(t){var n=window.fetch?window.fetch.bind(window):null,r=window.open,i=e.dashboard;function a(e){if(!i)return null;try{var t=new URL(String(e),document.baseURI);return t.origin===i?t:null}catch{return null}}window.fetch=function(e,r){var i=a(e&&typeof e==`object`&&`url`in e?e.url:e);if(!i)return n(e,r);r||={};var o=new Headers(r.headers||e&&e.headers||{}),s=r.body;s!=null&&typeof s!=`string`&&(s=s instanceof URLSearchParams?s.toString():String(s));var c=o.get(`Content-Type`)||(r.body instanceof URLSearchParams?`application/x-www-form-urlencoded`:s==null?``:`text/plain`);return t.dashboardFetch({url:i.href,method:r.method||`GET`,body:s,contentType:c}).then(function(e){var t=Number(e.status)||500;return new Response(t===204||t===205||t===304?null:e.body,{status:t<200||t>599?500:t,headers:{"Content-Type":e.contentType||`text/plain`}})})},window.open=function(e,n,i){var o=a(e);return o?(t.openPopup(o.href,n?String(n):``,i?String(i):``),{closed:!1,close:function(){},focus:function(){}}):r.apply(window,arguments)}}window.__startside||window.UWA&&window.UWA.__createInline||ee();function ee(){if(I&&!window.WidgetEvent&&(window.WidgetEvent=I),U(),e){if(Z(e),!window.__UWA_HOST__)var r=R(Q(),e.instance);r&&$(r),n(V(e,window.__UWA_HOST__||r,H)),Object.defineProperty(window,"__startside",{value:Object.freeze({attachBody:function(){t.__attach(document.getElementById(`moduleContent`))},start:function(){t.__launch()}})}),delete window.UWA,G(t,!1)}}})()})()})();
|
package/swa/1.0/host.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Running SWA widgets in your own page
|
|
2
|
+
|
|
3
|
+
How a host page runs an SWA 1.0 widget file in a sandboxed frame, with this package's `swa/1.0/frame.js` (the runtime
|
|
4
|
+
the frame runs) and `swa/1.0/frame.css` (its base styles). It is what Startside's dashboard does, reduced to what a
|
|
5
|
+
widget needs to run. The specification says what a host must do (section 6, the processing model, and 10.1, framed);
|
|
6
|
+
this page says how this runtime expects to be given a widget.
|
|
7
|
+
|
|
8
|
+
The messages below are this runtime's, release by release: a host serving `frame.js` from one release of the package
|
|
9
|
+
speaks that release's messages. Pin the version you tested.
|
|
10
|
+
|
|
11
|
+
`runtime.js` is not for a host: it is the runtime a widget file loads to run on its own page, and a host skips it (4.3).
|
|
12
|
+
RWA files (`.rwa.html`) need RWA's runtime, which this package doesn't carry.
|
|
13
|
+
|
|
14
|
+
## The frame
|
|
15
|
+
|
|
16
|
+
One frame per widget, sandboxed with `allow-scripts` and never `allow-same-origin`: the widget's origin is opaque, it
|
|
17
|
+
reaches neither your page, its storage, nor your cookies (10.1). Add `allow-forms`, and `allow-popups
|
|
18
|
+
allow-popups-to-escape-sandbox` for links the widget opens. Give it its document with `srcdoc`.
|
|
19
|
+
|
|
20
|
+
Never serve a widget from your own origin, or give its frame `allow-same-origin` with a document from your origin: its
|
|
21
|
+
scripts would be your page's.
|
|
22
|
+
|
|
23
|
+
## The frame's document
|
|
24
|
+
|
|
25
|
+
Read the widget file first (section 6.2): its title, its metadata, its settings form, its styles and stylesheet links,
|
|
26
|
+
its scripts, its body. Then write, in this order:
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<!doctype html>
|
|
30
|
+
<html lang="en" data-color-scheme="light">
|
|
31
|
+
<head>
|
|
32
|
+
<meta charset="utf-8">
|
|
33
|
+
<meta http-equiv="Content-Security-Policy" content="connect-src https:">
|
|
34
|
+
<base href="WIDGET_FILE_URL" target="_blank">
|
|
35
|
+
<style>@layer host, widget; @layer host { /* frame.css, and the variables below */ }</style>
|
|
36
|
+
<style>@layer widget { /* the file's own styles */ }</style>
|
|
37
|
+
<script>window.__UWA_CONFIG__ = { /* the config, below */ };</script>
|
|
38
|
+
<script>/* frame.js */</script>
|
|
39
|
+
</head>
|
|
40
|
+
<body>
|
|
41
|
+
<div id="moduleContent" class="moduleContent"><!-- the file's body --></div>
|
|
42
|
+
<script>__startside.attachBody();</script>
|
|
43
|
+
<!-- the file's scripts: those with a src first, in order, then its inline ones, in order -->
|
|
44
|
+
<script>__startside.start();</script>
|
|
45
|
+
</body>
|
|
46
|
+
</html>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- The file's own runtime script (`/swa/1.0/runtime.js`, or `data-runtime="swa/1.0"`) is left out.
|
|
50
|
+
- **The runtime's text written in**, as above, is simplest. Its text never holds `<script`, `</script` or `<!--`. A JSON
|
|
51
|
+
config written into a script needs its `<` escaped (`<`).
|
|
52
|
+
- **Loaded by its address** instead (`<script src="…/frame.js" crossorigin="anonymous">`): the server must send
|
|
53
|
+
`Access-Control-Allow-Origin` (jsDelivr and unpkg do), and the tag needs `crossorigin`. Otherwise the browser hides
|
|
54
|
+
every error from the frame's scripts as "Script error.", the widget's own included, since the frame's origin is
|
|
55
|
+
opaque and every script is cross-origin to it. The same goes for the file's scripts loaded by address.
|
|
56
|
+
- `frame.css` uses these variables, each with a fallback: `--text`, `--muted`, `--link`, `--border`, `--font-body`. The
|
|
57
|
+
specification lists what a widget may read (4.7): `--text`, `--muted`, `--link`, `--link-visited`, `--bg`,
|
|
58
|
+
`--widget-bg`, `--border`, `--hover`, `--font-body`, `--accent`. Set the ones your page has on `:root`, in the host
|
|
59
|
+
layer.
|
|
60
|
+
- Light or dark: `data-color-scheme` on the root, `light` or `dark`, and `color-scheme` the same in the host layer
|
|
61
|
+
(4.7). A widget reads its mode from them.
|
|
62
|
+
|
|
63
|
+
## The config
|
|
64
|
+
|
|
65
|
+
`window.__UWA_CONFIG__`, set before `frame.js` runs.
|
|
66
|
+
|
|
67
|
+
| Field | | What it is |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `instance` | required | A string unique to this load of this widget. Every message carries it, both ways. A new one at each reload. |
|
|
70
|
+
| `title` | required | The file's title (4.4). |
|
|
71
|
+
| `url` | required | The widget file's absolute address: relative addresses in its requests resolve against it. |
|
|
72
|
+
| `format` | required | `"swa"`. |
|
|
73
|
+
| `preferences` | required | The settings form as read (5): `[{ name, type, label, defaultValue, options: [{ value, label }], min?, max?, step? }]`. A password's `defaultValue` is `""` (5.2). |
|
|
74
|
+
| `values` | required | The settings' saved values, by name, as strings. `{}` the first time. |
|
|
75
|
+
| `metas` | required | The file's metadata (4.5), by name. |
|
|
76
|
+
| `lang` | | The page's language, `en-US` by default. |
|
|
77
|
+
| `actions` | | The file's declared actions (7.13), `[]` if it has none. |
|
|
78
|
+
| `memory` | | What the widget remembered in its last load (`widget.remember`), by key. |
|
|
79
|
+
| `stored` | | What it stored (`widget.setStored`), by key: the frame has no storage of its own. |
|
|
80
|
+
| `read` | | The keys of the items it marked read. |
|
|
81
|
+
| `noAdd` | | `true`: `widget.addWidget` is absent. |
|
|
82
|
+
|
|
83
|
+
Startside's other fields (`dashboard`, `theme`, `mode`, `accent`, `neutral`, `moduleVars`, `faces`, `people`) are its own:
|
|
84
|
+
leave them out. Without `dashboard`, the frame's `fetch` goes to the network directly, never to your page.
|
|
85
|
+
|
|
86
|
+
## Messages
|
|
87
|
+
|
|
88
|
+
Both ways, with `postMessage`, each an object with a `type` and `uwa`, the config's `instance`. The frame posts to
|
|
89
|
+
`parent` with the target `'*'` (its origin is opaque). Accept a message only when `event.source` is that frame's
|
|
90
|
+
`contentWindow` and `uwa` is its instance, and check each field's type and size before using it (10.1).
|
|
91
|
+
|
|
92
|
+
### Requests: answer each one
|
|
93
|
+
|
|
94
|
+
A request carries a `reqId`. Its promise in the widget waits until you answer with the same `reqId`: a request left
|
|
95
|
+
unanswered leaves the widget waiting forever. Refuse what you don't offer.
|
|
96
|
+
|
|
97
|
+
| The frame sends | You answer |
|
|
98
|
+
|---|---|
|
|
99
|
+
| `{ type: 'request', reqId, kind, url }`: `widget.fetch` (`kind` `text`, or `json` when it asked with a JSON `Accept`), `widget.fetchFeed` (`jsonfeed`), `widget.fetchImage` (`image`) | `{ type: 'response', reqId, ok: true, data }` or `{ …, ok: false, error }`. `text`, `json`: the body as a string. `jsonfeed`: the feed as JSON Feed 1.1 (8.3). `image`: `{ type, bytes }`, an `ArrayBuffer`, or the address itself as a string. An error `"HTTP 404"` becomes a response with that status in the widget; any other, a failed fetch. Another `kind`: refuse it. |
|
|
100
|
+
| `{ type: 'files', reqId, op, … }`: `widget.storage.files` (7.8) | `{ type: 'filesResult', reqId, ok: false, error: { name: 'NotSupportedError', message } }` unless you keep files. |
|
|
101
|
+
| `{ type: 'saveFile', reqId, … }`: `widget.saveFile` (7.13) | `{ type: 'saveFileResult', reqId, ok: false, error: 'NotSupportedError' }` unless you offer it. |
|
|
102
|
+
| `{ type: 'connectGoogle', reqId, … }`: Startside's own | `{ type: 'dashboardResponse', reqId, ok: false, error }`. |
|
|
103
|
+
|
|
104
|
+
The proxy behind `request` is yours: a widget's requests go to any site, so it must refuse local and private network
|
|
105
|
+
addresses at every redirect, and limit sizes and time (12).
|
|
106
|
+
|
|
107
|
+
### What the frame tells you: use what you need
|
|
108
|
+
|
|
109
|
+
- `height` `{ height }`: the document's height in CSS pixels, as it changes. Size the frame to it.
|
|
110
|
+
- `setTitle` `{ title }`, `setIcon` `{ url }`, `setUnreadCount` `{ count }`, `loading` `{ on }`.
|
|
111
|
+
- `setValue` `{ name, value }`, `deleteValue` `{ name }`: save the setting; give it back in `values` at the next load.
|
|
112
|
+
- `remember` `{ key, value }`, `setStored` `{ key, value }`, `setRead` `{ keys, read }`: keep them for the next load's
|
|
113
|
+
`memory`, `stored` and `read`.
|
|
114
|
+
- `openURL` `{ url }`: open it, in a new tab if you have nothing better. Only after a click in the widget (6.7).
|
|
115
|
+
- `openPreferences`: show its settings form; once saved, send `prefsSaved`.
|
|
116
|
+
|
|
117
|
+
Any other type can be ignored: the feature it serves then does nothing (2: a host may implement part of section 7).
|
|
118
|
+
|
|
119
|
+
### What you can send
|
|
120
|
+
|
|
121
|
+
- `{ type: 'prefsSaved', uwa, values }`: the settings changed; the widget applies them (6.5).
|
|
122
|
+
- `{ type: 'refresh', uwa }`: the refresh button (6.6).
|
|
123
|
+
- `{ type: 'resize', uwa }`: the frame's width changed.
|
|
124
|
+
- `{ type: 'focus', uwa }`: the keyboard comes into the widget (6.8).
|
|
125
|
+
- `{ type: 'tabShown', uwa, shown }`: your page hides or shows the widget without unloading it; it reads as hidden
|
|
126
|
+
meanwhile.
|
package/swa/1.0/quickstart.md
CHANGED
|
@@ -114,29 +114,40 @@ What it shows, in order:
|
|
|
114
114
|
| SHOULD NOT | Put fetched or typed text into markup (`innerHTML`, a `setBody` string) | 7.3 |
|
|
115
115
|
| SHOULD | Keep a game in progress or the person's data in a hidden setting, read defensively, and under the host's limit if it grows (Startside: 20,000 characters a setting) | 7.5, 7.8 |
|
|
116
116
|
| SHOULD | Let the host set the width; the height is the content's; never `100vh` | 7.3.2 |
|
|
117
|
+
| SHOULD | While it loads, show a placeholder at the size of what's coming (a skeleton of its rows, its picture's box), not a one-line "Loading…": the widget doesn't change size as its content arrives | 7.3.1 |
|
|
117
118
|
| SHOULD | Make a board, a grid or a list moved through with the arrow keys one Tab stop, the keys heard on the widget's own element; a list of plain links, as above, keeps its links in the Tab order | 7.3.1, 14 |
|
|
119
|
+
| SHOULD | Mark where the keyboard lands when the host moves the focus into the widget, when that isn't its first control: `autofocus` on a game's board (`<div class="board" tabindex="0" autofocus>`). Call `preventDefault()` on the Escape and arrow keys it uses itself: left uncancelled, a host may use Escape to leave the widget and an arrow to go to the next | 6.8 |
|
|
118
120
|
| SHOULD | Announce results and errors in a `role="status"` element present from the start, nothing as it first draws; keep the focus through updates | 14 |
|
|
119
121
|
| SHOULD | Write colors with `light-dark()`, other dark-mode changes under `:root[data-color-scheme="dark"]`, not `prefers-color-scheme` | 4.7 |
|
|
120
122
|
| SHOULD | Scope every rule under the widget's root class (`.news li`); give each host property a fallback, `var(--text, #222)`; avoid the host's class names (`loading`, `spinner`) | 4.7 |
|
|
121
123
|
| SHOULD | Do nothing at rest: an animation that draws the eye plays a few times; timers only for what changes on screen | 7.3.1 |
|
|
122
124
|
| SHOULD | Follow its width with a `ResizeObserver` on its own element when its layout depends on it | 7.3.2 |
|
|
123
125
|
| SHOULD | Meet WCAG 2.2 AA: keyboard alone, names on controls, 4.5:1 text, `prefers-reduced-motion` | 14 |
|
|
126
|
+
| MUST | Show only pictures it may show (public domain, or a licence or permission that allows it), their required credits kept; a picture opened large carries its own: `widget.openPhoto({ src, alt, credit })` | 7.12 |
|
|
127
|
+
| MAY | Read an API that wants the person's own key: `<input type="password" name="key" data-key-for="https://api.example">` in the settings, then `widget.fetch` to that origin. The host keeps the key and adds `Authorization: Bearer`; the widget never sees it (`widget.settings.get('key')` is `''`), and a 401 or 403 means no key yet: say to add one in the settings | 5.3, 8.2 |
|
|
128
|
+
| MAY | Declare actions of its own for its options menu, in the file: `<menu id="actions" hidden>` with one `<button type="button" name="reset">Reset</button>` each, five at most (`disabled` or `hidden` as it starts, `data-confirm="…?"` for a question the host asks first). Answer the `action` event (`event.detail.id`), and change their state as the widget's does with `widget.setActionStates({ reset: { disabled: false } })` | 7.13 |
|
|
129
|
+
| MAY | Hand the person a file it makes, from one of those actions only: `data-save=".cook"` on its button, then `widget.saveFile({ name, type, data }, { action: event })` in its `action` listener | 7.13 |
|
|
130
|
+
| MAY | Take a file dragged from the computer onto it: `<meta name="acceptFiles" content=".gpx">` (the extensions it takes), then its own `dragover` (`preventDefault()`) and `drop` listeners; a file it doesn't take, left uncancelled, is refused, never opened. A file input (`<input type="file" accept=".gpx">`) beside it, for the keyboard and a phone | 4.5, 10.1 |
|
|
124
131
|
| MAY | Carry its icon in the file: `<link rel="icon" href="data:image/svg+xml,…">`, kept when the file is shared by itself (best: an SVG drawn for 16 pixels, or a 64 × 64 PNG) | 4.6 |
|
|
125
132
|
|
|
126
133
|
## Checklist
|
|
127
134
|
|
|
135
|
+
- [ ] `npx @startside/swa validate name.swa.html` reports no error (Appendix F): it reads the file without running it.
|
|
128
136
|
- [ ] It opens in a browser, from disk and from a server, with no error in the widget or the console.
|
|
129
137
|
- [ ] Each setting changed in the menu (▾) applies, and Refresh keeps what it should.
|
|
130
138
|
- [ ] It reads well light and dark, narrow (300 pixels) and wide, maximized: open it as
|
|
131
139
|
`name.swa.html#mode=dark&width=300`, then light and wider.
|
|
132
|
-
- [ ] Everything works with the keyboard alone; the focus is visible and never lost.
|
|
140
|
+
- [ ] Everything works with the keyboard alone; the focus is visible and never lost. A game plays with its keys once the
|
|
141
|
+
focus is on it, and the keys it doesn't use are left uncancelled.
|
|
133
142
|
- [ ] Saved data from an older version, or edited by hand, doesn't break it.
|
|
134
143
|
- [ ] Nothing moves or runs when nobody uses it.
|
|
135
144
|
|
|
136
145
|
## Next
|
|
137
146
|
|
|
138
147
|
- The types, for an editor: `https://startside.app/swa/1.0/swa.d.ts` (Appendix F).
|
|
139
|
-
-
|
|
148
|
+
- The tools: the npm package `@startside/swa`, its `validate` and `inline` commands (Appendix F).
|
|
149
|
+
- More examples: a blog (Example 4), a game (Example 6), a to-do list with an action of its own in the options menu
|
|
150
|
+
(Example 7), in Appendix A of the specification.
|
|
140
151
|
|
|
141
152
|
---
|
|
142
153
|
|