@htmlbricks/hb-stylus-notebook 0.20.15 → 0.20.17

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.20.15",
5
+ "version": "0.20.17",
6
6
  "main": "release/release.js",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -75,10 +75,10 @@
75
75
  "webcomponents"
76
76
  ],
77
77
  "contributors": [],
78
- "gitHead": "dd6a5cf7cc52fa6572b0f3db83e52fd2c9ba4126",
78
+ "gitHead": "0670e46cc090b813b86b0bdec8587eb30a4d655a",
79
79
  "dependencies": {
80
- "@htmlbricks/hb-input-file": "^0.20.15",
81
- "@htmlbricks/hb-stylus-paper": "^0.20.15",
80
+ "@htmlbricks/hb-input-file": "^0.20.17",
81
+ "@htmlbricks/hb-stylus-paper": "^0.20.17",
82
82
  "style-to-object": "^0.3.0"
83
83
  }
84
84
  }
@@ -336,5 +336,5 @@
336
336
  },
337
337
  "iifePath": "release/release.js",
338
338
  "repoName": "@htmlbricks/hb-stylus-notebook",
339
- "version": "0.20.15"
339
+ "version": "0.20.17"
340
340
  }
@@ -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&&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 v;function m(t){v=t}function y(){if(!v)throw new Error("Function called outside component initialization");return v}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=[];let _=[];const x=[],E=Promise.resolve();let k=!1;function C(t){_.push(t)}const N=new Set;let S=0;function O(){if(0!==S)return;const t=v;do{try{for(;S<$.length;){const t=$[S];S++,m(t),T(t.$$)}}catch(t){throw $.length=0,S=0,t}for(m(null),$.length=0,S=0;w.length;)w.pop()();for(let t=0;t<_.length;t+=1){const e=_[t];N.has(e)||(N.add(e),e())}_.length=0}while($.length);for(;x.length;)x.pop()();k=!1,N.clear(),m(t)}function T(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 A=new Set;function L(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];_.forEach((o=>-1===t.indexOf(o)?e.push(o):n.push(o))),n.forEach((t=>t())),_=e}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function j(t,e){-1===t.$$.dirty[0]&&($.push(t),k||(k=!0,E.then(O)),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=v;m(i);const g=i.$$={fragment:null,ctx:[],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&&j(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&&(A.delete(b),b.i($))),function(t,n,i,a){const{fragment:l,after_update:s}=t.$$;l&&l.m(n,i),a||C((()=>{const n=t.$$.on_mount.map(e).filter(r);t.$$.on_destroy?t.$$.on_destroy.push(...n):o(n),t.$$.on_mount=[]})),s.forEach(C)}(i,a.target,a.anchor,a.customElement),O()}var b,$;m(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(){L(this,1),this.$destroy=t}$on(e,n){if(!r(n))return t;const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(n),()=>{const t=o.indexOf(n);-1!==t&&o.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.20.15",R=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,V=/\n/g,F=/^\s*/,I=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,M=/^:\s*/,B=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,U=/^[;\s]*/,W=/^\s+|\s+$/g,z="";function H(t){return t?t.replace(W,z):z}var q=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(V);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;z!=t.charAt(n)&&("*"!=t.charAt(n)||"/"!=t.charAt(n+1));)++n;if(n+=2,z===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(B),o=t({type:"declaration",property:H(e[0].replace(R,z)),value:n?H(n[0].replace(R,z)):z});return s(U),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 K,G=(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}(K={exports:{}},K.exports),K.exports),Q={vars:[],parts:[]},X={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 Y(e){let n,r,i,g,v,m,y,b,$,w,_,x,E,k,C,N,S,O,T,A,L,j,J,D,P,R,V,F,I,M,B,U,W,z,H,q;return{c(){var o,a,l,s;n=c("div"),r=c("button"),r.textContent="clear",i=d(),g=c("button"),g.textContent="select",v=d(),m=c("button"),m.textContent="draw",y=d(),b=c("button"),$=u("undo"),_=d(),x=c("button"),E=u("redo"),C=d(),N=c("button"),S=u("save"),T=d(),A=c("button"),L=u("brush"),J=d(),D=c("br"),P=u("load:"),R=c("hb-input-file"),V=u("\n\tinsert:"),F=c("hb-input-file"),I=d(),M=c("div"),B=c("hb-stylus-paper"),this.c=t,b.disabled=w=!e[5],x.disabled=k=!e[6],N.disabled=O=!e[5],A.disabled=j="draw"!==e[2],h(R,"id","loadfile"),h(R,"style",e[4]),h(R,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"})),h(F,"id","insertfile"),h(F,"style",e[4]),h(F,"schemaentry",JSON.stringify({label:"ciao"})),p(n,"part","controller"),p(n,"id","controller"),h(B,"id","stylus-paper"),h(B,"goto",e[1]),h(B,"style",e[3]),h(B,"background_color","green"),h(B,"mode",e[2]),h(B,"save_as",U=JSON.stringify(e[7])),h(B,"load_draw",W=e[0]?JSON.stringify(e[0]):null),h(B,"insert_image",z=e[8]?JSON.stringify(e[8]):null),h(B,"insert_text",e[9]?JSON.stringify(e[9]):null),p(M,"part","paper-container"),p(M,"id","paper-container"),o=M,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,v),a(n,m),a(n,y),a(n,b),a(b,$),a(n,_),a(n,x),a(x,E),a(n,C),a(n,N),a(N,S),a(n,T),a(n,A),a(A,L),a(n,J),a(n,D),a(n,P),a(n,R),a(n,V),a(n,F),l(t,I,o),l(t,M,o),a(M,B),H||(q=[f(r,"click",e[24]),f(g,"click",e[25]),f(m,"click",e[26]),f(b,"click",e[27]),f(x,"click",e[28]),f(N,"click",e[29]),f(R,"setValue",e[30]),f(F,"setValue",e[31]),f(B,"historyIndex",e[32]),f(B,"save",e[33])],H=!0)},p(t,e){32&e[0]&&w!==(w=!t[5])&&(b.disabled=w),64&e[0]&&k!==(k=!t[6])&&(x.disabled=k),32&e[0]&&O!==(O=!t[5])&&(N.disabled=O),4&e[0]&&j!==(j="draw"!==t[2])&&(A.disabled=j),16&e[0]&&h(R,"style",t[4]),16&e[0]&&h(F,"style",t[4]),2&e[0]&&h(B,"goto",t[1]),8&e[0]&&h(B,"style",t[3]),4&e[0]&&h(B,"mode",t[2]),128&e[0]&&U!==(U=JSON.stringify(t[7]))&&h(B,"save_as",U),1&e[0]&&W!==(W=t[0]?JSON.stringify(t[0]):null)&&h(B,"load_draw",W),256&e[0]&&z!==(z=t[8]?JSON.stringify(t[8]):null)&&h(B,"insert_image",z)},i:t,o:t,d(t){t&&s(n),t&&s(I),t&&s(M),H=!1,o(q)}}}function Z(t,e,n){const o=y();b();let r,i,a,l,s,c,u,{id:d}=e,{style:f}=e,p="draw",h="",g="",v=!1,m=!1,{load_draw:$}=e;function w(t){n(2,p=t)}function _(){console.log("ch",i,a),i>=0&&(!a||a>-1)&&(n(1,a=a||0===a?a-1:i-1),console.log("undo",i,a))}function x(){console.log(i,a),(a||0===a)&&a<=i&&(n(1,a++,a),console.log("redo",i,a))}function E(t){m||n(22,m=!0),console.log("h",t),n(21,i=t.index-1),t.start_index&&n(23,u=t.start_index),n(1,a=null)}function k(){n(7,s={name:"test",type:"json"})}function C(t){var e;const o=null===(e=t.value)||void 0===e?void 0:e.name;if(o){const e=new FileReader;e.readAsDataURL(t.value),e.onload=function(t){var e,r;try{if(console.log("insert file",t.target,null===(e=t.target)||void 0===e?void 0:e.result),null===(r=t.target)||void 0===r?void 0:r.result){const e=t.target.result.toString().split(";")[0].split("/")[1];n(8,c={base64:t.target.result.toString(),type:e,name:o})}}catch(t){console.error("error loading file")}},e.onerror=function(t){console.error("error reading file")}}}function N(t){var e,o,r,i;console.log("save",t),n(7,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 S(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(0,$=JSON.parse(t.target.result.toString()))}catch(t){console.error("error loading file")}},e.onerror=function(t){console.error("error reading file")}}}G.addComponent({repoName:"@htmlbricks/hb-stylus-paper",version:P}),G.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(18,d=t.id),"style"in t&&n(19,f=t.style),"load_draw"in t&&n(0,$=t.load_draw)},t.$$.update=()=>{if(16515075&t.$$.dirty[0])if(d||n(18,d=""),f&&(n(20,r=q(f)),n(3,h=G.getChildStyleToPass(r,null==Q?void 0:Q.vars)),n(4,g=G.getChildStyleToPass(r,null==X?void 0:X.vars))),i||0===i||n(21,i=0),n(6,l=!(0!==a&&!a||!(a<i))),n(5,v=!(!i&&0!==i||!m||a&&-1===a||u&&!(u<i&&(!a||a<u)))),"string"==typeof $&&(null==$?void 0:$.length))try{n(0,$=JSON.parse($))}catch(t){console.error("error parsing json",t)}else $||n(0,$=null)},[$,a,p,h,g,v,l,s,c,undefined,w,_,x,E,k,C,N,S,d,f,r,i,m,u,()=>w("eraser"),()=>w("select"),()=>w("draw"),()=>_(),()=>x(),()=>k(),t=>S(t.detail),t=>C(t.detail),t=>E(t.detail),t=>N(t.detail)]}class tt extends D{constructor(t){super();const e=document.createElement("style");e.textContent='@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}',this.shadowRoot.appendChild(e),J(this,{target:this.shadowRoot,props:g(this.attributes),customElement:!0},Z,Y,i,{id:18,style:19,load_draw:0},null,[-1,-1]),t&&(t.target&&l(t.target,this,t.anchor),t.props&&(this.$set(t.props),O()))}static get observedAttributes(){return["id","style","load_draw"]}get id(){return this.$$.ctx[18]}set id(t){this.$$set({id:t}),O()}get style(){return this.$$.ctx[19]}set style(t){this.$$set({style:t}),O()}get load_draw(){return this.$$.ctx[0]}set load_draw(t){this.$$set({load_draw:t}),O()}}return customElements.define("hb-stylus-notebook",tt),tt}();
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&&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 v;function m(t){v=t}function y(){if(!v)throw new Error("Function called outside component initialization");return v}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=[];let _=[];const x=[],E=Promise.resolve();let k=!1;function C(t){_.push(t)}const N=new Set;let S=0;function O(){if(0!==S)return;const t=v;do{try{for(;S<$.length;){const t=$[S];S++,m(t),T(t.$$)}}catch(t){throw $.length=0,S=0,t}for(m(null),$.length=0,S=0;w.length;)w.pop()();for(let t=0;t<_.length;t+=1){const e=_[t];N.has(e)||(N.add(e),e())}_.length=0}while($.length);for(;x.length;)x.pop()();k=!1,N.clear(),m(t)}function T(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 A=new Set;function L(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];_.forEach((o=>-1===t.indexOf(o)?e.push(o):n.push(o))),n.forEach((t=>t())),_=e}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function j(t,e){-1===t.$$.dirty[0]&&($.push(t),k||(k=!0,E.then(O)),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=v;m(i);const g=i.$$={fragment:null,ctx:[],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&&j(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&&(A.delete(b),b.i($))),function(t,n,i,a){const{fragment:l,after_update:s}=t.$$;l&&l.m(n,i),a||C((()=>{const n=t.$$.on_mount.map(e).filter(r);t.$$.on_destroy?t.$$.on_destroy.push(...n):o(n),t.$$.on_mount=[]})),s.forEach(C)}(i,a.target,a.anchor,a.customElement),O()}var b,$;m(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(){L(this,1),this.$destroy=t}$on(e,n){if(!r(n))return t;const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(n),()=>{const t=o.indexOf(n);-1!==t&&o.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.20.17",R=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,V=/\n/g,F=/^\s*/,I=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,M=/^:\s*/,B=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,U=/^[;\s]*/,W=/^\s+|\s+$/g,z="";function H(t){return t?t.replace(W,z):z}var q=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(V);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;z!=t.charAt(n)&&("*"!=t.charAt(n)||"/"!=t.charAt(n+1));)++n;if(n+=2,z===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(B),o=t({type:"declaration",property:H(e[0].replace(R,z)),value:n?H(n[0].replace(R,z)):z});return s(U),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 K,G=(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}(K={exports:{}},K.exports),K.exports),Q={vars:[],parts:[]},X={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 Y(e){let n,r,i,g,v,m,y,b,$,w,_,x,E,k,C,N,S,O,T,A,L,j,J,D,P,R,V,F,I,M,B,U,W,z,H,q;return{c(){var o,a,l,s;n=c("div"),r=c("button"),r.textContent="clear",i=d(),g=c("button"),g.textContent="select",v=d(),m=c("button"),m.textContent="draw",y=d(),b=c("button"),$=u("undo"),_=d(),x=c("button"),E=u("redo"),C=d(),N=c("button"),S=u("save"),T=d(),A=c("button"),L=u("brush"),J=d(),D=c("br"),P=u("load:"),R=c("hb-input-file"),V=u("\n\tinsert:"),F=c("hb-input-file"),I=d(),M=c("div"),B=c("hb-stylus-paper"),this.c=t,b.disabled=w=!e[5],x.disabled=k=!e[6],N.disabled=O=!e[5],A.disabled=j="draw"!==e[2],h(R,"id","loadfile"),h(R,"style",e[4]),h(R,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"})),h(F,"id","insertfile"),h(F,"style",e[4]),h(F,"schemaentry",JSON.stringify({label:"ciao"})),p(n,"part","controller"),p(n,"id","controller"),h(B,"id","stylus-paper"),h(B,"goto",e[1]),h(B,"style",e[3]),h(B,"background_color","green"),h(B,"mode",e[2]),h(B,"save_as",U=JSON.stringify(e[7])),h(B,"load_draw",W=e[0]?JSON.stringify(e[0]):null),h(B,"insert_image",z=e[8]?JSON.stringify(e[8]):null),h(B,"insert_text",e[9]?JSON.stringify(e[9]):null),p(M,"part","paper-container"),p(M,"id","paper-container"),o=M,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,v),a(n,m),a(n,y),a(n,b),a(b,$),a(n,_),a(n,x),a(x,E),a(n,C),a(n,N),a(N,S),a(n,T),a(n,A),a(A,L),a(n,J),a(n,D),a(n,P),a(n,R),a(n,V),a(n,F),l(t,I,o),l(t,M,o),a(M,B),H||(q=[f(r,"click",e[24]),f(g,"click",e[25]),f(m,"click",e[26]),f(b,"click",e[27]),f(x,"click",e[28]),f(N,"click",e[29]),f(R,"setValue",e[30]),f(F,"setValue",e[31]),f(B,"historyIndex",e[32]),f(B,"save",e[33])],H=!0)},p(t,e){32&e[0]&&w!==(w=!t[5])&&(b.disabled=w),64&e[0]&&k!==(k=!t[6])&&(x.disabled=k),32&e[0]&&O!==(O=!t[5])&&(N.disabled=O),4&e[0]&&j!==(j="draw"!==t[2])&&(A.disabled=j),16&e[0]&&h(R,"style",t[4]),16&e[0]&&h(F,"style",t[4]),2&e[0]&&h(B,"goto",t[1]),8&e[0]&&h(B,"style",t[3]),4&e[0]&&h(B,"mode",t[2]),128&e[0]&&U!==(U=JSON.stringify(t[7]))&&h(B,"save_as",U),1&e[0]&&W!==(W=t[0]?JSON.stringify(t[0]):null)&&h(B,"load_draw",W),256&e[0]&&z!==(z=t[8]?JSON.stringify(t[8]):null)&&h(B,"insert_image",z)},i:t,o:t,d(t){t&&s(n),t&&s(I),t&&s(M),H=!1,o(q)}}}function Z(t,e,n){const o=y();b();let r,i,a,l,s,c,u,{id:d}=e,{style:f}=e,p="draw",h="",g="",v=!1,m=!1,{load_draw:$}=e;function w(t){n(2,p=t)}function _(){console.log("ch",i,a),i>=0&&(!a||a>-1)&&(n(1,a=a||0===a?a-1:i-1),console.log("undo",i,a))}function x(){console.log(i,a),(a||0===a)&&a<=i&&(n(1,a++,a),console.log("redo",i,a))}function E(t){m||n(22,m=!0),console.log("h",t),n(21,i=t.index-1),t.start_index&&n(23,u=t.start_index),n(1,a=null)}function k(){n(7,s={name:"test",type:"json"})}function C(t){var e;const o=null===(e=t.value)||void 0===e?void 0:e.name;if(o){const e=new FileReader;e.readAsDataURL(t.value),e.onload=function(t){var e,r;try{if(console.log("insert file",t.target,null===(e=t.target)||void 0===e?void 0:e.result),null===(r=t.target)||void 0===r?void 0:r.result){const e=t.target.result.toString().split(";")[0].split("/")[1];n(8,c={base64:t.target.result.toString(),type:e,name:o})}}catch(t){console.error("error loading file")}},e.onerror=function(t){console.error("error reading file")}}}function N(t){var e,o,r,i;console.log("save",t),n(7,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 S(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(0,$=JSON.parse(t.target.result.toString()))}catch(t){console.error("error loading file")}},e.onerror=function(t){console.error("error reading file")}}}G.addComponent({repoName:"@htmlbricks/hb-stylus-paper",version:P}),G.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(18,d=t.id),"style"in t&&n(19,f=t.style),"load_draw"in t&&n(0,$=t.load_draw)},t.$$.update=()=>{if(16515075&t.$$.dirty[0])if(d||n(18,d=""),f&&(n(20,r=q(f)),n(3,h=G.getChildStyleToPass(r,null==Q?void 0:Q.vars)),n(4,g=G.getChildStyleToPass(r,null==X?void 0:X.vars))),i||0===i||n(21,i=0),n(6,l=!(0!==a&&!a||!(a<i))),n(5,v=!(!i&&0!==i||!m||a&&-1===a||u&&!(u<i&&(!a||a<u)))),"string"==typeof $&&(null==$?void 0:$.length))try{n(0,$=JSON.parse($))}catch(t){console.error("error parsing json",t)}else $||n(0,$=null)},[$,a,p,h,g,v,l,s,c,undefined,w,_,x,E,k,C,N,S,d,f,r,i,m,u,()=>w("eraser"),()=>w("select"),()=>w("draw"),()=>_(),()=>x(),()=>k(),t=>S(t.detail),t=>C(t.detail),t=>E(t.detail),t=>N(t.detail)]}class tt extends D{constructor(t){super();const e=document.createElement("style");e.textContent='@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}',this.shadowRoot.appendChild(e),J(this,{target:this.shadowRoot,props:g(this.attributes),customElement:!0},Z,Y,i,{id:18,style:19,load_draw:0},null,[-1,-1]),t&&(t.target&&l(t.target,this,t.anchor),t.props&&(this.$set(t.props),O()))}static get observedAttributes(){return["id","style","load_draw"]}get id(){return this.$$.ctx[18]}set id(t){this.$$set({id:t}),O()}get style(){return this.$$.ctx[19]}set style(t){this.$$set({style:t}),O()}get load_draw(){return this.$$.ctx[0]}set load_draw(t){this.$$set({load_draw:t}),O()}}return customElements.define("hb-stylus-notebook",tt),tt}();
2
2
  //# sourceMappingURL=release.js.map