@htmlbricks/hb-stylus-notebook 0.17.14 → 0.17.18
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 +5 -5
- package/release/manifest.json +1 -1
- package/release/release.js +1 -1
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.17.
|
|
5
|
+
"version": "0.17.18",
|
|
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.17.
|
|
33
|
+
"@htmlbricks/hb-jsutils": "^0.17.18",
|
|
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": "
|
|
78
|
+
"gitHead": "deb874b7854c5972a7c8375737890db2535a80bb",
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@htmlbricks/hb-input-file": "^0.17.
|
|
81
|
-
"@htmlbricks/hb-stylus-paper": "^0.17.
|
|
80
|
+
"@htmlbricks/hb-input-file": "^0.17.18",
|
|
81
|
+
"@htmlbricks/hb-stylus-paper": "^0.17.18",
|
|
82
82
|
"style-to-object": "^0.3.0"
|
|
83
83
|
}
|
|
84
84
|
}
|
package/release/manifest.json
CHANGED
package/release/release.js
CHANGED
|
@@ -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 g(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:p(t,e,n)}function h(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=[],_=[],x=[],E=Promise.resolve();let k=!1;function C(t){_.push(t)}const S=new Set;let N=0;function T(){const t=v;do{for(;N<$.length;){const t=$[N];N++,m(t),O(t.$$)}for(m(null),$.length=0,N=0;w.length;)w.pop()();for(let t=0;t<_.length;t+=1){const e=_[t];S.has(e)||(S.add(e),e())}_.length=0}while($.length);for(;x.length;)x.pop()();k=!1,S.clear(),m(t)}function O(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 L=new Set;function A(t,e){-1===t.$$.dirty[0]&&($.push(t),k||(k=!0,E.then(T)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function j(i,a,l,c,u,d,f,p=[-1]){const g=v;m(i);const h=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||(g?g.$$.context:[])),callbacks:n(),dirty:p,skip_bound:!1,root:a.target||g.$$.root};f&&f(h.root);let y=!1;if(h.ctx=l?l(i,a.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return h.ctx&&u(h.ctx[t],h.ctx[t]=o)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](o),y&&A(i,t)),e})):[],h.update(),y=!0,o(h.before_update),h.fragment=!!c&&c(h.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);h.fragment&&h.fragment.l(t),t.forEach(s)}else h.fragment&&h.fragment.c();a.intro&&((b=i.$$.fragment)&&b.i&&(L.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),T()}var b,$;m(g)}let J;"function"==typeof HTMLElement&&(J=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 D="0.17.14",P=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,V=/^\s*/,F=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,I=/^:\s*/,M=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,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(V)}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(F);if(e){if(d(),!s(I))return l("property missing ':'");var n=s(M),o=t({type:"declaration",property:W(e[0].replace(P,U)),value:n?W(n[0].replace(P,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,h,v,m,y,b,$,w,_,x,E,k,C,S,N,T,O,L,A,j,J,D,P,R,V,F,I,M,B,H,U,W,z,q;return{c(){var o,a,l,s;n=c("div"),r=c("button"),r.textContent="clear",i=d(),h=c("button"),h.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(),S=c("button"),N=u("save"),O=d(),L=c("button"),A=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],S.disabled=T=!e[5],L.disabled=j="draw"!==e[2],g(R,"id","loadfile"),g(R,"style",e[4]),g(R,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"})),g(F,"id","insertfile"),g(F,"style",e[4]),g(F,"schemaentry",JSON.stringify({label:"ciao"})),p(n,"part","controller"),p(n,"id","controller"),g(B,"id","stylus-paper"),g(B,"goto",e[1]),g(B,"style",e[3]),g(B,"background_color","green"),g(B,"mode",e[2]),g(B,"save_as",H=JSON.stringify(e[7])),g(B,"load_draw",U=e[0]?JSON.stringify(e[0]):null),g(B,"insert_image",W=e[8]?JSON.stringify(e[8]):null),g(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,h),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,S),a(S,N),a(n,O),a(n,L),a(L,A),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),z||(q=[f(r,"click",e[24]),f(h,"click",e[25]),f(m,"click",e[26]),f(b,"click",e[27]),f(x,"click",e[28]),f(S,"click",e[29]),f(R,"setValue",e[30]),f(F,"setValue",e[31]),f(B,"historyIndex",e[32]),f(B,"save",e[33])],z=!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]&&T!==(T=!t[5])&&(S.disabled=T),4&e[0]&&j!==(j="draw"!==t[2])&&(L.disabled=j),16&e[0]&&g(R,"style",t[4]),16&e[0]&&g(F,"style",t[4]),2&e[0]&&g(B,"goto",t[1]),8&e[0]&&g(B,"style",t[3]),4&e[0]&&g(B,"mode",t[2]),128&e[0]&&H!==(H=JSON.stringify(t[7]))&&g(B,"save_as",H),1&e[0]&&U!==(U=t[0]?JSON.stringify(t[0]):null)&&g(B,"load_draw",U),256&e[0]&&W!==(W=t[8]?JSON.stringify(t[8]):null)&&g(B,"insert_image",W)},i:t,o:t,d(t){t&&s(n),t&&s(I),t&&s(M),z=!1,o(q)}}}function Y(t,e,n){const o=y();b();let r,i,a,l,s,c,u,{id:d}=e,{style:f}=e,p="draw",g="",h="",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 S(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 N(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")}}}K.addComponent({repoName:"@htmlbricks/hb-stylus-paper",version:D}),K.addComponent({repoName:"@htmlbricks/hb-input-file",version:D}),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=z(f)),n(3,g=K.getChildStyleToPass(r,null==G?void 0:G.vars)),n(4,h=K.getChildStyleToPass(r,null==Q?void 0:Q.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,g,h,v,l,s,c,undefined,w,_,x,E,k,C,S,N,d,f,r,i,m,u,()=>w("eraser"),()=>w("select"),()=>w("draw"),()=>_(),()=>x(),()=>k(),t=>N(t.detail),t=>C(t.detail),t=>E(t.detail),t=>S(t.detail)]}class Z extends J{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:h(this.attributes),customElement:!0},Y,X,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),T()))}static get observedAttributes(){return["id","style","load_draw"]}get id(){return this.$$.ctx[18]}set id(t){this.$$set({id:t}),T()}get style(){return this.$$.ctx[19]}set style(t){this.$$set({style:t}),T()}get load_draw(){return this.$$.ctx[0]}set load_draw(t){this.$$set({load_draw:t}),T()}}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 g(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:p(t,e,n)}function h(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=[],_=[],x=[],E=Promise.resolve();let k=!1;function C(t){_.push(t)}const S=new Set;let N=0;function T(){const t=v;do{for(;N<$.length;){const t=$[N];N++,m(t),O(t.$$)}for(m(null),$.length=0,N=0;w.length;)w.pop()();for(let t=0;t<_.length;t+=1){const e=_[t];S.has(e)||(S.add(e),e())}_.length=0}while($.length);for(;x.length;)x.pop()();k=!1,S.clear(),m(t)}function O(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 L=new Set;function A(t,e){-1===t.$$.dirty[0]&&($.push(t),k||(k=!0,E.then(T)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function j(i,a,l,c,u,d,f,p=[-1]){const g=v;m(i);const h=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||(g?g.$$.context:[])),callbacks:n(),dirty:p,skip_bound:!1,root:a.target||g.$$.root};f&&f(h.root);let y=!1;if(h.ctx=l?l(i,a.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return h.ctx&&u(h.ctx[t],h.ctx[t]=o)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](o),y&&A(i,t)),e})):[],h.update(),y=!0,o(h.before_update),h.fragment=!!c&&c(h.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);h.fragment&&h.fragment.l(t),t.forEach(s)}else h.fragment&&h.fragment.c();a.intro&&((b=i.$$.fragment)&&b.i&&(L.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),T()}var b,$;m(g)}let J;"function"==typeof HTMLElement&&(J=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 D="0.17.18",P=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,V=/^\s*/,F=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,I=/^:\s*/,M=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,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(V)}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(F);if(e){if(d(),!s(I))return l("property missing ':'");var n=s(M),o=t({type:"declaration",property:W(e[0].replace(P,U)),value:n?W(n[0].replace(P,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,h,v,m,y,b,$,w,_,x,E,k,C,S,N,T,O,L,A,j,J,D,P,R,V,F,I,M,B,H,U,W,z,q;return{c(){var o,a,l,s;n=c("div"),r=c("button"),r.textContent="clear",i=d(),h=c("button"),h.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(),S=c("button"),N=u("save"),O=d(),L=c("button"),A=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],S.disabled=T=!e[5],L.disabled=j="draw"!==e[2],g(R,"id","loadfile"),g(R,"style",e[4]),g(R,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"})),g(F,"id","insertfile"),g(F,"style",e[4]),g(F,"schemaentry",JSON.stringify({label:"ciao"})),p(n,"part","controller"),p(n,"id","controller"),g(B,"id","stylus-paper"),g(B,"goto",e[1]),g(B,"style",e[3]),g(B,"background_color","green"),g(B,"mode",e[2]),g(B,"save_as",H=JSON.stringify(e[7])),g(B,"load_draw",U=e[0]?JSON.stringify(e[0]):null),g(B,"insert_image",W=e[8]?JSON.stringify(e[8]):null),g(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,h),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,S),a(S,N),a(n,O),a(n,L),a(L,A),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),z||(q=[f(r,"click",e[24]),f(h,"click",e[25]),f(m,"click",e[26]),f(b,"click",e[27]),f(x,"click",e[28]),f(S,"click",e[29]),f(R,"setValue",e[30]),f(F,"setValue",e[31]),f(B,"historyIndex",e[32]),f(B,"save",e[33])],z=!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]&&T!==(T=!t[5])&&(S.disabled=T),4&e[0]&&j!==(j="draw"!==t[2])&&(L.disabled=j),16&e[0]&&g(R,"style",t[4]),16&e[0]&&g(F,"style",t[4]),2&e[0]&&g(B,"goto",t[1]),8&e[0]&&g(B,"style",t[3]),4&e[0]&&g(B,"mode",t[2]),128&e[0]&&H!==(H=JSON.stringify(t[7]))&&g(B,"save_as",H),1&e[0]&&U!==(U=t[0]?JSON.stringify(t[0]):null)&&g(B,"load_draw",U),256&e[0]&&W!==(W=t[8]?JSON.stringify(t[8]):null)&&g(B,"insert_image",W)},i:t,o:t,d(t){t&&s(n),t&&s(I),t&&s(M),z=!1,o(q)}}}function Y(t,e,n){const o=y();b();let r,i,a,l,s,c,u,{id:d}=e,{style:f}=e,p="draw",g="",h="",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 S(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 N(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")}}}K.addComponent({repoName:"@htmlbricks/hb-stylus-paper",version:D}),K.addComponent({repoName:"@htmlbricks/hb-input-file",version:D}),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=z(f)),n(3,g=K.getChildStyleToPass(r,null==G?void 0:G.vars)),n(4,h=K.getChildStyleToPass(r,null==Q?void 0:Q.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,g,h,v,l,s,c,undefined,w,_,x,E,k,C,S,N,d,f,r,i,m,u,()=>w("eraser"),()=>w("select"),()=>w("draw"),()=>_(),()=>x(),()=>k(),t=>N(t.detail),t=>C(t.detail),t=>E(t.detail),t=>S(t.detail)]}class Z extends J{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:h(this.attributes),customElement:!0},Y,X,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),T()))}static get observedAttributes(){return["id","style","load_draw"]}get id(){return this.$$.ctx[18]}set id(t){this.$$set({id:t}),T()}get style(){return this.$$.ctx[19]}set style(t){this.$$set({style:t}),T()}get load_draw(){return this.$$.ctx[0]}set load_draw(t){this.$$set({load_draw:t}),T()}}return customElements.define("hb-stylus-notebook",Z),Z}();
|
|
2
2
|
//# sourceMappingURL=release.js.map
|