@htmlbricks/hb-stylus-notebook 0.16.58 → 0.16.60

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@htmlbricks/hb-stylus-notebook",
3
3
  "displayName": "Svelte-Bootstrap stylus-notebook",
4
4
  "description": "Svelte-Bootstrap stylus-notebook",
5
- "version": "0.16.58",
5
+ "version": "0.16.60",
6
6
  "main": "release/release.js",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -30,7 +30,7 @@
30
30
  "prepublish": "npm run build:release"
31
31
  },
32
32
  "devDependencies": {
33
- "@htmlbricks/hb-jsutils": "^0.16.58",
33
+ "@htmlbricks/hb-jsutils": "^0.16.60",
34
34
  "@htmlbricks/manifester": "^0.0.22",
35
35
  "@rollup/plugin-alias": "^3.1.2",
36
36
  "@rollup/plugin-commonjs": "^18.0.0",
@@ -75,10 +75,10 @@
75
75
  "webcomponents"
76
76
  ],
77
77
  "contributors": [],
78
- "gitHead": "4cbd811147709de3947d98c70a2d19792e9d5742",
78
+ "gitHead": "b1f99b0ca7d1405034ef99a2ff23ab32f4037d04",
79
79
  "dependencies": {
80
- "@htmlbricks/hb-input-file": "^0.16.58",
81
- "@htmlbricks/hb-stylus-paper": "^0.16.58",
80
+ "@htmlbricks/hb-input-file": "^0.16.60",
81
+ "@htmlbricks/hb-stylus-paper": "^0.16.60",
82
82
  "style-to-object": "^0.3.0"
83
83
  }
84
84
  }
@@ -250,5 +250,5 @@
250
250
  },
251
251
  "iifePath": "release/release.js",
252
252
  "repoName": "@htmlbricks/hb-stylus-notebook",
253
- "version": "0.16.58"
253
+ "version": "0.16.60"
254
254
  }
@@ -1,2 +1,2 @@
1
- var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function l(t,e,n){t.insertBefore(e,n||null)}function s(t){t.parentNode.removeChild(t)}function c(t){return document.createElement(t)}function u(t){return document.createTextNode(t)}function d(){return u(" ")}function f(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function p(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function h(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:p(t,e,n)}function g(t){const e={};for(const n of t)e[n.name]=n.value;return e}let m;function v(t){m=t}function y(){if(!m)throw new Error("Function called outside component initialization");return m}function b(){const t=y();return(e,n,{cancelable:o=!1}={})=>{const r=t.$$.callbacks[e];if(r){const i=function(t,e,{bubbles:n=!1,cancelable:o=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(t,n,o,e),r}(e,n,{cancelable:o});return r.slice().forEach((e=>{e.call(t,i)})),!i.defaultPrevented}return!0}}const $=[],w=[],x=[],k=[],E=Promise.resolve();let _=!1;function C(t){x.push(t)}const T=new Set;let A=0;function L(){const t=m;do{for(;A<$.length;){const t=$[A];A++,v(t),N(t.$$)}for(v(null),$.length=0,A=0;w.length;)w.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];T.has(e)||(T.add(e),e())}x.length=0}while($.length);for(;k.length;)k.pop()();_=!1,T.clear(),v(t)}function N(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(C)}}const S=new Set;function O(t,e){-1===t.$$.dirty[0]&&($.push(t),_||(_=!0,E.then(L)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function j(i,a,l,c,u,d,f,p=[-1]){const h=m;v(i);const g=i.$$={fragment:null,ctx:null,props:d,update:t,not_equal:u,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(h?h.$$.context:[])),callbacks:n(),dirty:p,skip_bound:!1,root:a.target||h.$$.root};f&&f(g.root);let y=!1;if(g.ctx=l?l(i,a.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return g.ctx&&u(g.ctx[t],g.ctx[t]=o)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](o),y&&O(i,t)),e})):[],g.update(),y=!0,o(g.before_update),g.fragment=!!c&&c(g.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);g.fragment&&g.fragment.l(t),t.forEach(s)}else g.fragment&&g.fragment.c();a.intro&&((b=i.$$.fragment)&&b.i&&(S.delete(b),b.i($))),function(t,n,i,a){const{fragment:l,on_mount:s,on_destroy:c,after_update:u}=t.$$;l&&l.m(n,i),a||C((()=>{const n=s.map(e).filter(r);c?c.push(...n):o(n),t.$$.on_mount=[]})),u.forEach(C)}(i,a.target,a.anchor,a.customElement),L()}var b,$;v(h)}let D;"function"==typeof HTMLElement&&(D=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(r);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var P="0.16.58",V=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,F=/^\s*/,I=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,M=/^:\s*/,J=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,B=/^[;\s]*/,H=/^\s+|\s+$/g,U="";function W(t){return t?t.replace(H,U):U}var z=function(t,e){var n,o=null;if(!t||"string"!=typeof t)return o;for(var r,i,a=function(t,e){if("string"!=typeof t)throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,o=1;function r(t){var e=t.match(R);e&&(n+=e.length);var r=t.lastIndexOf("\n");o=~r?t.length-r:o+t.length}function i(){var t={line:n,column:o};return function(e){return e.position=new a(t),c(),e}}function a(t){this.start=t,this.end={line:n,column:o},this.source=e.source}function l(r){var i=new Error(e.source+":"+n+":"+o+": "+r);if(i.reason=r,i.filename=e.source,i.line=n,i.column=o,i.source=t,!e.silent)throw i}function s(e){var n=e.exec(t);if(n){var o=n[0];return r(o),t=t.slice(o.length),n}}function c(){s(F)}function u(t){var e;for(t=t||[];e=d();)!1!==e&&t.push(e);return t}function d(){var e=i();if("/"==t.charAt(0)&&"*"==t.charAt(1)){for(var n=2;U!=t.charAt(n)&&("*"!=t.charAt(n)||"/"!=t.charAt(n+1));)++n;if(n+=2,U===t.charAt(n-1))return l("End of comment missing");var a=t.slice(2,n-2);return o+=2,r(a),t=t.slice(n),o+=2,e({type:"comment",comment:a})}}function f(){var t=i(),e=s(I);if(e){if(d(),!s(M))return l("property missing ':'");var n=s(J),o=t({type:"declaration",property:W(e[0].replace(V,U)),value:n?W(n[0].replace(V,U)):U});return s(B),o}}return a.prototype.content=t,c(),function(){var t,e=[];for(u(e);t=f();)!1!==t&&(e.push(t),u(e));return e}()}(t),l="function"==typeof e,s=0,c=a.length;s<c;s++)r=(n=a[s]).property,i=n.value,l?e(r,i,n):i&&(o||(o={}),o[r]=i);return o};var q,K=(function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=e.getChildStyleToPass=void 0,e.getChildStyleToPass=function(t,e){var n,o,r="";if(t&&(null==e?void 0:e.length)&&(null===(n=Object.keys(t))||void 0===n?void 0:n.length)&&(null===(o=null==e?void 0:e.filter((function(e){return Object.keys(t).includes(e.name)})))||void 0===o?void 0:o.length))for(var i=function(n){(null==e?void 0:e.filter((function(e){return e.name===n&&e.defaultValue!==t[n]})))&&(r+="".concat(n,":").concat(t[n],";"))},a=0,l=Object.keys(t);a<l.length;a++)i(l[a]);return r},e.addComponent=function(t){var e,n=(null===(e=null==t?void 0:t.repoName.split("/"))||void 0===e?void 0:e[1])||(null==t?void 0:t.repoName);if(!n)throw new Error("wrong componentPath "+(null==t?void 0:t.repoName));if(!(null==t?void 0:t.version))throw new Error("wrong version "+(null==t?void 0:t.version));var o=(null==t?void 0:t.iifePath)||"release/release.js";if(!document.getElementById(n+"-script"))try{var r=document.createElement("script");r.id=n+"-script",r.src="https://cdn.jsdelivr.net/npm/".concat(t.repoName,"@").concat(t.version,"/").concat(o),(null==t?void 0:t.local)&&location.href.includes("localhost")&&(r.src="".concat(t.local)),document.head.appendChild(r)}catch(t){console.warn(t)}};var n=function(){function t(t){if(!(null==t?void 0:t.dictionary))throw new Error("no dictionary provided");this.dictionary=t.dictionary,this.setLang(null==t?void 0:t.lang)}return t.prototype.setLang=function(e){e||(e=t.getDefaultLang()),this.lang=e},t.prototype.translateWord=function(e,n){return t.getDictionaryWord(e,this.dictionary,n||this.lang)},t.prototype.translateDate=function(e,n,o){return t.formatDate(e,n,o||this.lang)},t.getDefaultLang=function(){var t,e,n,o,r,i="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(e=null===(t=navigator.languages[0])||void 0===t?void 0:t.split("-")[0])||void 0===e?void 0:e.toLowerCase())||void 0===n?void 0:n.length)&&(i=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),i},t.getDictionaryWord=function(e,n,o){var r;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[e]))return n[o][e];var i="",a=t.getDefaultLang();if(!o||a!==o){var l=null==n?void 0:n[a];(null==l?void 0:l[e])&&(i=l[e])}return i},t.formatDate=function(e,n,o){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n}(q={exports:{}},q.exports),q.exports),G={vars:[],parts:[]},Q={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[{name:"invalid-feedback",description:""}]};function X(e){let n,r,i,g,m,v,y,b,$,w,x,k,E,_,C,T,A,L,N,S,O,j,D,P,V,R,F,I,M,J,B,H,U,W,z,q,K,G,Q,X;return{c(){var o,a,l,s;n=c("div"),r=c("button"),r.textContent="clear",i=d(),g=c("button"),g.textContent="select",m=d(),v=c("button"),v.textContent="draw",y=d(),b=c("button"),$=u("undo"),x=d(),k=c("button"),E=u("redo"),C=d(),T=c("button"),T.textContent="load",A=d(),L=c("button"),N=u("save"),O=d(),j=c("button"),D=u("move"),V=d(),R=c("button"),F=u("brush"),M=d(),J=c("br"),B=u("load:"),H=c("hb-input-file"),U=u("\n\tinsert:"),W=c("hb-input-file"),z=d(),q=c("div"),K=c("hb-stylus-paper"),this.c=t,b.disabled=w=!e[4],k.disabled=_=!e[5],L.disabled=S=!e[4],j.disabled=P=!e[4],R.disabled=I="draw"!==e[1],h(H,"id","loadfile"),h(H,"style",e[3]),h(H,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"})),h(W,"id","insertfile"),h(W,"style",e[3]),h(W,"schemaentry",JSON.stringify({label:"ciao"})),p(n,"part","controller"),p(n,"id","controller"),h(K,"id","stylus-paper"),h(K,"goto",e[0]),h(K,"style",e[2]),h(K,"background_color","green"),h(K,"mode",e[1]),h(K,"save_as",G=JSON.stringify(e[6])),h(K,"load_draw",e[7]),p(q,"part","paper-container"),p(q,"id","paper-container"),o=q,a="position",null===(l="relative")?o.style.removeProperty(a):o.style.setProperty(a,l,s?"important":"")},m(t,o){l(t,n,o),a(n,r),a(n,i),a(n,g),a(n,m),a(n,v),a(n,y),a(n,b),a(b,$),a(n,x),a(n,k),a(k,E),a(n,C),a(n,T),a(n,A),a(n,L),a(L,N),a(n,O),a(n,j),a(j,D),a(n,V),a(n,R),a(R,F),a(n,M),a(n,J),a(n,B),a(n,H),a(n,U),a(n,W),l(t,z,o),l(t,q,o),a(q,K),Q||(X=[f(r,"click",e[20]),f(g,"click",e[21]),f(v,"click",e[22]),f(b,"click",e[23]),f(k,"click",e[24]),f(T,"click",e[25]),f(L,"click",e[26]),f(j,"click",e[27]),f(H,"setValue",e[28]),f(W,"setValue",e[29]),f(K,"historyIndex",e[30]),f(K,"save",e[31])],Q=!0)},p(t,e){16&e[0]&&w!==(w=!t[4])&&(b.disabled=w),32&e[0]&&_!==(_=!t[5])&&(k.disabled=_),16&e[0]&&S!==(S=!t[4])&&(L.disabled=S),16&e[0]&&P!==(P=!t[4])&&(j.disabled=P),2&e[0]&&I!==(I="draw"!==t[1])&&(R.disabled=I),8&e[0]&&h(H,"style",t[3]),8&e[0]&&h(W,"style",t[3]),1&e[0]&&h(K,"goto",t[0]),4&e[0]&&h(K,"style",t[2]),2&e[0]&&h(K,"mode",t[1]),64&e[0]&&G!==(G=JSON.stringify(t[6]))&&h(K,"save_as",G),128&e[0]&&h(K,"load_draw",t[7])},i:t,o:t,d(t){t&&s(n),t&&s(z),t&&s(q),Q=!1,o(X)}}}function Y(t,e,n){const o=y();b();let r,i,a,l,s,c,{id:u}=e,{style:d}=e,f="draw",p="",h="",g=!1,m=!1;function v(t){n(1,f=t)}function $(){console.log("ch",i,a),i>=0&&(!a||a>-1)&&(n(0,a=a||0===a?a-1:i-1),console.log("undo",i,a))}function w(){console.log(i,a),(a||0===a)&&a<=i&&(n(0,a++,a),console.log("redo",i,a))}function x(t){m||n(19,m=!0),console.log("h",t),n(18,i=t.index-1),n(0,a=null)}function k(){n(6,s={name:"test",type:"json"})}function E(t){var e,o,r,i;console.log("save",t),n(6,s=null),e=t,o=t.name+".json",r="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e)),(i=document.createElement("a")).setAttribute("href",r),i.setAttribute("download",o),document.body.appendChild(i),i.click(),i.remove()}function _(t){if(console.log("file",t),t.value.name){const e=new FileReader;e.readAsText(t.value,"UTF-8"),e.onload=function(t){try{n(7,c=t.target.result.toString())}catch(t){console.error("error loading file")}},e.onerror=function(t){console.error("error reading file")}}}K.addComponent({repoName:"@htmlbricks/hb-stylus-paper",version:P}),K.addComponent({repoName:"@htmlbricks/hb-input-file",version:P}),function(t){y().$$.on_mount.push(t)}((()=>{console.log(o.shadowRoot.getElementById("skeletontest"))}));return t.$$set=t=>{"id"in t&&n(15,u=t.id),"style"in t&&n(16,d=t.style)},t.$$.update=()=>{1015809&t.$$.dirty[0]&&(u||n(15,u=""),d&&(n(17,r=z(d)),n(2,p=K.getChildStyleToPass(r,null==G?void 0:G.vars)),n(3,h=K.getChildStyleToPass(r,null==Q?void 0:Q.vars))),i||0===i||n(18,i=0),n(5,l=!(0!==a&&!a||!(a<i))),n(4,g=!(!i&&0!==i||!m||a&&-1===a)))},[a,f,p,h,g,l,s,c,v,$,w,x,k,E,_,u,d,r,i,m,()=>v("eraser"),()=>v("select"),()=>v("draw"),()=>$(),()=>w(),()=>{},()=>k(),()=>{},t=>_(t.detail),t=>function(t){if(t.value.name){const e=new FileReader;e.readAsText(t.value,"UTF-8"),e.onload=function(t){console.log(t.target.result);try{console.log("insert file")}catch(t){console.error("error loading file")}},e.onerror=function(t){console.error("error reading file")}}}(t.detail),t=>x(t.detail),t=>E(t.detail)]}class Z extends D{constructor(t){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host{font-family:"Roboto", sans-serif;position:absolute;width:100%;height:100%;display:block;display:grid;grid-template-areas:"header" "paper";grid-template-columns:1fr;grid-template-rows:auto 1fr}#controller{grid-area:header}#paper-container{grid-area:paper;background:green}</style>',j(this,{target:this.shadowRoot,props:g(this.attributes),customElement:!0},Y,X,i,{id:15,style:16},null,[-1,-1]),t&&(t.target&&l(t.target,this,t.anchor),t.props&&(this.$set(t.props),L()))}static get observedAttributes(){return["id","style"]}get id(){return this.$$.ctx[15]}set id(t){this.$$set({id:t}),L()}get style(){return this.$$.ctx[16]}set style(t){this.$$set({style:t}),L()}}return customElements.define("hb-stylus-notebook",Z),Z}();
1
+ var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function l(t,e,n){t.insertBefore(e,n||null)}function s(t){t.parentNode.removeChild(t)}function c(t){return document.createElement(t)}function u(t){return document.createTextNode(t)}function d(){return u(" ")}function f(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function p(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function h(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:p(t,e,n)}function g(t){const e={};for(const n of t)e[n.name]=n.value;return e}let m;function v(t){m=t}function y(){if(!m)throw new Error("Function called outside component initialization");return m}function b(){const t=y();return(e,n,{cancelable:o=!1}={})=>{const r=t.$$.callbacks[e];if(r){const i=function(t,e,{bubbles:n=!1,cancelable:o=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(t,n,o,e),r}(e,n,{cancelable:o});return r.slice().forEach((e=>{e.call(t,i)})),!i.defaultPrevented}return!0}}const $=[],w=[],x=[],k=[],E=Promise.resolve();let _=!1;function C(t){x.push(t)}const T=new Set;let A=0;function L(){const t=m;do{for(;A<$.length;){const t=$[A];A++,v(t),N(t.$$)}for(v(null),$.length=0,A=0;w.length;)w.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];T.has(e)||(T.add(e),e())}x.length=0}while($.length);for(;k.length;)k.pop()();_=!1,T.clear(),v(t)}function N(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(C)}}const S=new Set;function O(t,e){-1===t.$$.dirty[0]&&($.push(t),_||(_=!0,E.then(L)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function j(i,a,l,c,u,d,f,p=[-1]){const h=m;v(i);const g=i.$$={fragment:null,ctx:null,props:d,update:t,not_equal:u,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(h?h.$$.context:[])),callbacks:n(),dirty:p,skip_bound:!1,root:a.target||h.$$.root};f&&f(g.root);let y=!1;if(g.ctx=l?l(i,a.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return g.ctx&&u(g.ctx[t],g.ctx[t]=o)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](o),y&&O(i,t)),e})):[],g.update(),y=!0,o(g.before_update),g.fragment=!!c&&c(g.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);g.fragment&&g.fragment.l(t),t.forEach(s)}else g.fragment&&g.fragment.c();a.intro&&((b=i.$$.fragment)&&b.i&&(S.delete(b),b.i($))),function(t,n,i,a){const{fragment:l,on_mount:s,on_destroy:c,after_update:u}=t.$$;l&&l.m(n,i),a||C((()=>{const n=s.map(e).filter(r);c?c.push(...n):o(n),t.$$.on_mount=[]})),u.forEach(C)}(i,a.target,a.anchor,a.customElement),L()}var b,$;v(h)}let D;"function"==typeof HTMLElement&&(D=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(r);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var P="0.16.60",V=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,F=/^\s*/,I=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,M=/^:\s*/,J=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,B=/^[;\s]*/,H=/^\s+|\s+$/g,U="";function W(t){return t?t.replace(H,U):U}var z=function(t,e){var n,o=null;if(!t||"string"!=typeof t)return o;for(var r,i,a=function(t,e){if("string"!=typeof t)throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,o=1;function r(t){var e=t.match(R);e&&(n+=e.length);var r=t.lastIndexOf("\n");o=~r?t.length-r:o+t.length}function i(){var t={line:n,column:o};return function(e){return e.position=new a(t),c(),e}}function a(t){this.start=t,this.end={line:n,column:o},this.source=e.source}function l(r){var i=new Error(e.source+":"+n+":"+o+": "+r);if(i.reason=r,i.filename=e.source,i.line=n,i.column=o,i.source=t,!e.silent)throw i}function s(e){var n=e.exec(t);if(n){var o=n[0];return r(o),t=t.slice(o.length),n}}function c(){s(F)}function u(t){var e;for(t=t||[];e=d();)!1!==e&&t.push(e);return t}function d(){var e=i();if("/"==t.charAt(0)&&"*"==t.charAt(1)){for(var n=2;U!=t.charAt(n)&&("*"!=t.charAt(n)||"/"!=t.charAt(n+1));)++n;if(n+=2,U===t.charAt(n-1))return l("End of comment missing");var a=t.slice(2,n-2);return o+=2,r(a),t=t.slice(n),o+=2,e({type:"comment",comment:a})}}function f(){var t=i(),e=s(I);if(e){if(d(),!s(M))return l("property missing ':'");var n=s(J),o=t({type:"declaration",property:W(e[0].replace(V,U)),value:n?W(n[0].replace(V,U)):U});return s(B),o}}return a.prototype.content=t,c(),function(){var t,e=[];for(u(e);t=f();)!1!==t&&(e.push(t),u(e));return e}()}(t),l="function"==typeof e,s=0,c=a.length;s<c;s++)r=(n=a[s]).property,i=n.value,l?e(r,i,n):i&&(o||(o={}),o[r]=i);return o};var q,K=(function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=e.getChildStyleToPass=void 0,e.getChildStyleToPass=function(t,e){var n,o,r="";if(t&&(null==e?void 0:e.length)&&(null===(n=Object.keys(t))||void 0===n?void 0:n.length)&&(null===(o=null==e?void 0:e.filter((function(e){return Object.keys(t).includes(e.name)})))||void 0===o?void 0:o.length))for(var i=function(n){(null==e?void 0:e.filter((function(e){return e.name===n&&e.defaultValue!==t[n]})))&&(r+="".concat(n,":").concat(t[n],";"))},a=0,l=Object.keys(t);a<l.length;a++)i(l[a]);return r},e.addComponent=function(t){var e,n=(null===(e=null==t?void 0:t.repoName.split("/"))||void 0===e?void 0:e[1])||(null==t?void 0:t.repoName);if(!n)throw new Error("wrong componentPath "+(null==t?void 0:t.repoName));if(!(null==t?void 0:t.version))throw new Error("wrong version "+(null==t?void 0:t.version));var o=(null==t?void 0:t.iifePath)||"release/release.js";if(!document.getElementById(n+"-script"))try{var r=document.createElement("script");r.id=n+"-script",r.src="https://cdn.jsdelivr.net/npm/".concat(t.repoName,"@").concat(t.version,"/").concat(o),(null==t?void 0:t.local)&&location.href.includes("localhost")&&(r.src="".concat(t.local)),document.head.appendChild(r)}catch(t){console.warn(t)}};var n=function(){function t(t){if(!(null==t?void 0:t.dictionary))throw new Error("no dictionary provided");this.dictionary=t.dictionary,this.setLang(null==t?void 0:t.lang)}return t.prototype.setLang=function(e){e||(e=t.getDefaultLang()),this.lang=e},t.prototype.translateWord=function(e,n){return t.getDictionaryWord(e,this.dictionary,n||this.lang)},t.prototype.translateDate=function(e,n,o){return t.formatDate(e,n,o||this.lang)},t.getDefaultLang=function(){var t,e,n,o,r,i="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(e=null===(t=navigator.languages[0])||void 0===t?void 0:t.split("-")[0])||void 0===e?void 0:e.toLowerCase())||void 0===n?void 0:n.length)&&(i=null===(r=null===(o=navigator.languages[0])||void 0===o?void 0:o.split("-")[0])||void 0===r?void 0:r.toLowerCase()),i},t.getDictionaryWord=function(e,n,o){var r;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(o&&(null===(r=n[o])||void 0===r?void 0:r[e]))return n[o][e];var i="",a=t.getDefaultLang();if(!o||a!==o){var l=null==n?void 0:n[a];(null==l?void 0:l[e])&&(i=l[e])}return i},t.formatDate=function(e,n,o){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n}(q={exports:{}},q.exports),q.exports),G={vars:[],parts:[]},Q={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[{name:"invalid-feedback",description:""}]};function X(e){let n,r,i,g,m,v,y,b,$,w,x,k,E,_,C,T,A,L,N,S,O,j,D,P,V,R,F,I,M,J,B,H,U,W,z,q,K,G,Q,X;return{c(){var o,a,l,s;n=c("div"),r=c("button"),r.textContent="clear",i=d(),g=c("button"),g.textContent="select",m=d(),v=c("button"),v.textContent="draw",y=d(),b=c("button"),$=u("undo"),x=d(),k=c("button"),E=u("redo"),C=d(),T=c("button"),T.textContent="load",A=d(),L=c("button"),N=u("save"),O=d(),j=c("button"),D=u("move"),V=d(),R=c("button"),F=u("brush"),M=d(),J=c("br"),B=u("load:"),H=c("hb-input-file"),U=u("\n\tinsert:"),W=c("hb-input-file"),z=d(),q=c("div"),K=c("hb-stylus-paper"),this.c=t,b.disabled=w=!e[4],k.disabled=_=!e[5],L.disabled=S=!e[4],j.disabled=P=!e[4],R.disabled=I="draw"!==e[1],h(H,"id","loadfile"),h(H,"style",e[3]),h(H,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"})),h(W,"id","insertfile"),h(W,"style",e[3]),h(W,"schemaentry",JSON.stringify({label:"ciao"})),p(n,"part","controller"),p(n,"id","controller"),h(K,"id","stylus-paper"),h(K,"goto",e[0]),h(K,"style",e[2]),h(K,"background_color","green"),h(K,"mode",e[1]),h(K,"save_as",G=JSON.stringify(e[6])),h(K,"load_draw",e[7]),p(q,"part","paper-container"),p(q,"id","paper-container"),o=q,a="position",null===(l="relative")?o.style.removeProperty(a):o.style.setProperty(a,l,s?"important":"")},m(t,o){l(t,n,o),a(n,r),a(n,i),a(n,g),a(n,m),a(n,v),a(n,y),a(n,b),a(b,$),a(n,x),a(n,k),a(k,E),a(n,C),a(n,T),a(n,A),a(n,L),a(L,N),a(n,O),a(n,j),a(j,D),a(n,V),a(n,R),a(R,F),a(n,M),a(n,J),a(n,B),a(n,H),a(n,U),a(n,W),l(t,z,o),l(t,q,o),a(q,K),Q||(X=[f(r,"click",e[20]),f(g,"click",e[21]),f(v,"click",e[22]),f(b,"click",e[23]),f(k,"click",e[24]),f(T,"click",e[25]),f(L,"click",e[26]),f(j,"click",e[27]),f(H,"setValue",e[28]),f(W,"setValue",e[29]),f(K,"historyIndex",e[30]),f(K,"save",e[31])],Q=!0)},p(t,e){16&e[0]&&w!==(w=!t[4])&&(b.disabled=w),32&e[0]&&_!==(_=!t[5])&&(k.disabled=_),16&e[0]&&S!==(S=!t[4])&&(L.disabled=S),16&e[0]&&P!==(P=!t[4])&&(j.disabled=P),2&e[0]&&I!==(I="draw"!==t[1])&&(R.disabled=I),8&e[0]&&h(H,"style",t[3]),8&e[0]&&h(W,"style",t[3]),1&e[0]&&h(K,"goto",t[0]),4&e[0]&&h(K,"style",t[2]),2&e[0]&&h(K,"mode",t[1]),64&e[0]&&G!==(G=JSON.stringify(t[6]))&&h(K,"save_as",G),128&e[0]&&h(K,"load_draw",t[7])},i:t,o:t,d(t){t&&s(n),t&&s(z),t&&s(q),Q=!1,o(X)}}}function Y(t,e,n){const o=y();b();let r,i,a,l,s,c,{id:u}=e,{style:d}=e,f="draw",p="",h="",g=!1,m=!1;function v(t){n(1,f=t)}function $(){console.log("ch",i,a),i>=0&&(!a||a>-1)&&(n(0,a=a||0===a?a-1:i-1),console.log("undo",i,a))}function w(){console.log(i,a),(a||0===a)&&a<=i&&(n(0,a++,a),console.log("redo",i,a))}function x(t){m||n(19,m=!0),console.log("h",t),n(18,i=t.index-1),n(0,a=null)}function k(){n(6,s={name:"test",type:"json"})}function E(t){var e,o,r,i;console.log("save",t),n(6,s=null),e=t,o=t.name+".json",r="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e)),(i=document.createElement("a")).setAttribute("href",r),i.setAttribute("download",o),document.body.appendChild(i),i.click(),i.remove()}function _(t){if(console.log("file",t),t.value.name){const e=new FileReader;e.readAsText(t.value,"UTF-8"),e.onload=function(t){try{n(7,c=t.target.result.toString())}catch(t){console.error("error loading file")}},e.onerror=function(t){console.error("error reading file")}}}K.addComponent({repoName:"@htmlbricks/hb-stylus-paper",version:P}),K.addComponent({repoName:"@htmlbricks/hb-input-file",version:P}),function(t){y().$$.on_mount.push(t)}((()=>{console.log(o.shadowRoot.getElementById("skeletontest"))}));return t.$$set=t=>{"id"in t&&n(15,u=t.id),"style"in t&&n(16,d=t.style)},t.$$.update=()=>{1015809&t.$$.dirty[0]&&(u||n(15,u=""),d&&(n(17,r=z(d)),n(2,p=K.getChildStyleToPass(r,null==G?void 0:G.vars)),n(3,h=K.getChildStyleToPass(r,null==Q?void 0:Q.vars))),i||0===i||n(18,i=0),n(5,l=!(0!==a&&!a||!(a<i))),n(4,g=!(!i&&0!==i||!m||a&&-1===a)))},[a,f,p,h,g,l,s,c,v,$,w,x,k,E,_,u,d,r,i,m,()=>v("eraser"),()=>v("select"),()=>v("draw"),()=>$(),()=>w(),()=>{},()=>k(),()=>{},t=>_(t.detail),t=>function(t){if(t.value.name){const e=new FileReader;e.readAsText(t.value,"UTF-8"),e.onload=function(t){console.log(t.target.result);try{console.log("insert file")}catch(t){console.error("error loading file")}},e.onerror=function(t){console.error("error reading file")}}}(t.detail),t=>x(t.detail),t=>E(t.detail)]}class Z extends D{constructor(t){super(),this.shadowRoot.innerHTML='<style>@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host{font-family:"Roboto", sans-serif;position:absolute;width:100%;height:100%;display:block;display:grid;grid-template-areas:"header" "paper";grid-template-columns:1fr;grid-template-rows:auto 1fr}#controller{grid-area:header}#paper-container{grid-area:paper;background:green}</style>',j(this,{target:this.shadowRoot,props:g(this.attributes),customElement:!0},Y,X,i,{id:15,style:16},null,[-1,-1]),t&&(t.target&&l(t.target,this,t.anchor),t.props&&(this.$set(t.props),L()))}static get observedAttributes(){return["id","style"]}get id(){return this.$$.ctx[15]}set id(t){this.$$set({id:t}),L()}get style(){return this.$$.ctx[16]}set style(t){this.$$set({style:t}),L()}}return customElements.define("hb-stylus-notebook",Z),Z}();
2
2
  //# sourceMappingURL=release.js.map