@htmlbricks/hb-stylus-notebook 0.16.55 → 0.16.56
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.16.
|
|
5
|
+
"version": "0.16.56",
|
|
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.
|
|
33
|
+
"@htmlbricks/hb-jsutils": "^0.16.56",
|
|
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": "38221a32cdd8bc1430626cc82e1858e9c114e5f3",
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@htmlbricks/hb-input-file": "^0.16.
|
|
81
|
-
"@htmlbricks/hb-stylus-paper": "^0.16.
|
|
80
|
+
"@htmlbricks/hb-input-file": "^0.16.56",
|
|
81
|
+
"@htmlbricks/hb-stylus-paper": "^0.16.56",
|
|
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 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=[],k=[],E=[],_=Promise.resolve();let x=!1;function C(t){k.push(t)}const T=new Set;let L=0;function A(){const t=v;do{for(;L<$.length;){const t=$[L];L++,m(t),N(t.$$)}for(m(null),$.length=0,L=0;w.length;)w.pop()();for(let t=0;t<k.length;t+=1){const e=k[t];T.has(e)||(T.add(e),e())}k.length=0}while($.length);for(;E.length;)E.pop()();x=!1,T.clear(),m(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 j=new Set;function S(t,e){-1===t.$$.dirty[0]&&($.push(t),x||(x=!0,_.then(A)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function D(i,a,l,c,u,d,f,p=[-1]){const h=v;m(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&&S(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&&(j.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),A()}var b,$;m(h)}let O;"function"==typeof HTMLElement&&(O=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.55",V=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,I=/^\s*/,M=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,F=/^:\s*/,B=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,H=/^[;\s]*/,J=/^\s+|\s+$/g,W="";function z(t){return t?t.replace(J,W):W}var U=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(I)}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;W!=t.charAt(n)&&("*"!=t.charAt(n)||"/"!=t.charAt(n+1));)++n;if(n+=2,W===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(M);if(e){if(d(),!s(F))return l("property missing ':'");var n=s(B),o=t({type:"declaration",property:z(e[0].replace(V,W)),value:n?z(n[0].replace(V,W)):W});return s(H),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,v,m,y,b,$,w,k,E,_,x,C,T,L,A,N,j,S,D,O,P,V,R,I,M,F,B,H,J,W,z,U,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"),k=d(),E=c("button"),_=u("redo"),C=d(),T=c("button"),T.textContent="load",L=d(),A=c("button"),N=u("save"),S=d(),D=c("button"),O=u("move"),V=d(),R=c("button"),I=u("brush"),F=d(),B=c("hb-input-file"),H=d(),J=c("div"),W=c("hb-stylus-paper"),this.c=t,b.disabled=w=!e[4],E.disabled=x=!e[5],A.disabled=j=!e[4],D.disabled=P=!e[4],R.disabled=M="draw"!==e[1],h(B,"id","input-file"),h(B,"style",e[3]),p(n,"part","controller"),p(n,"id","controller"),h(W,"id","stylus-paper"),h(W,"goto",e[0]),h(W,"style",e[2]),h(W,"background_color","green"),h(W,"mode",e[1]),h(W,"save_as",z=JSON.stringify(e[6])),h(W,"load_draw",e[7]),p(J,"part","paper-container"),p(J,"id","paper-container"),o=J,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,k),a(n,E),a(E,_),a(n,C),a(n,T),a(n,L),a(n,A),a(A,N),a(n,S),a(n,D),a(D,O),a(n,V),a(n,R),a(R,I),a(n,F),a(n,B),l(t,H,o),l(t,J,o),a(J,W),U||(q=[f(r,"click",e[20]),f(g,"click",e[21]),f(m,"click",e[22]),f(b,"click",e[23]),f(E,"click",e[24]),f(T,"click",e[25]),f(A,"click",e[26]),f(D,"click",e[27]),f(B,"setValue",e[28]),f(W,"historyIndex",e[29]),f(W,"save",e[30])],U=!0)},p(t,e){16&e[0]&&w!==(w=!t[4])&&(b.disabled=w),32&e[0]&&x!==(x=!t[5])&&(E.disabled=x),16&e[0]&&j!==(j=!t[4])&&(A.disabled=j),16&e[0]&&P!==(P=!t[4])&&(D.disabled=P),2&e[0]&&M!==(M="draw"!==t[1])&&(R.disabled=M),8&e[0]&&h(B,"style",t[3]),1&e[0]&&h(W,"goto",t[0]),4&e[0]&&h(W,"style",t[2]),2&e[0]&&h(W,"mode",t[1]),64&e[0]&&z!==(z=JSON.stringify(t[6]))&&h(W,"save_as",z),128&e[0]&&h(W,"load_draw",t[7])},i:t,o:t,d(t){t&&s(n),t&&s(H),t&&s(J),U=!1,o(q)}}}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,v=!1;function m(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 k(t){v||n(19,v=!0),console.log("h",t),n(18,i=t.index-1),n(0,a=null)}function E(){n(6,s={name:"test",type:"json"})}function _(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 x(t){if(console.log("file",t),t.value.name){const e=new FileReader;e.readAsText(t.value,"UTF-8"),e.onload=function(t){console.log(t.target.result);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=U(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||!v||a&&-1===a)))},[a,f,p,h,g,l,s,c,m,$,w,k,E,_,x,u,d,r,i,v,()=>m("eraser"),()=>m("select"),()=>m("draw"),()=>$(),()=>w(),()=>{},()=>E(),()=>{},t=>x(t.detail),t=>k(t.detail),t=>_(t.detail)]}class Z extends O{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>',D(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),A()))}static get observedAttributes(){return["id","style"]}get id(){return this.$$.ctx[15]}set id(t){this.$$set({id:t}),A()}get style(){return this.$$.ctx[16]}set style(t){this.$$set({style:t}),A()}}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 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=[],k=[],E=[],_=Promise.resolve();let x=!1;function C(t){k.push(t)}const T=new Set;let L=0;function A(){const t=v;do{for(;L<$.length;){const t=$[L];L++,m(t),N(t.$$)}for(m(null),$.length=0,L=0;w.length;)w.pop()();for(let t=0;t<k.length;t+=1){const e=k[t];T.has(e)||(T.add(e),e())}k.length=0}while($.length);for(;E.length;)E.pop()();x=!1,T.clear(),m(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 j=new Set;function S(t,e){-1===t.$$.dirty[0]&&($.push(t),x||(x=!0,_.then(A)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function D(i,a,l,c,u,d,f,p=[-1]){const h=v;m(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&&S(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&&(j.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),A()}var b,$;m(h)}let O;"function"==typeof HTMLElement&&(O=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.56",V=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,I=/^\s*/,M=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,F=/^:\s*/,B=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,H=/^[;\s]*/,J=/^\s+|\s+$/g,W="";function z(t){return t?t.replace(J,W):W}var U=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(I)}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;W!=t.charAt(n)&&("*"!=t.charAt(n)||"/"!=t.charAt(n+1));)++n;if(n+=2,W===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(M);if(e){if(d(),!s(F))return l("property missing ':'");var n=s(B),o=t({type:"declaration",property:z(e[0].replace(V,W)),value:n?z(n[0].replace(V,W)):W});return s(H),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,v,m,y,b,$,w,k,E,_,x,C,T,L,A,N,j,S,D,O,P,V,R,I,M,F,B,H,J,W,z,U,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"),k=d(),E=c("button"),_=u("redo"),C=d(),T=c("button"),T.textContent="load",L=d(),A=c("button"),N=u("save"),S=d(),D=c("button"),O=u("move"),V=d(),R=c("button"),I=u("brush"),F=d(),B=c("hb-input-file"),H=d(),J=c("div"),W=c("hb-stylus-paper"),this.c=t,b.disabled=w=!e[4],E.disabled=x=!e[5],A.disabled=j=!e[4],D.disabled=P=!e[4],R.disabled=M="draw"!==e[1],h(B,"id","input-file"),h(B,"style",e[3]),p(n,"part","controller"),p(n,"id","controller"),h(W,"id","stylus-paper"),h(W,"goto",e[0]),h(W,"style",e[2]),h(W,"background_color","green"),h(W,"mode",e[1]),h(W,"save_as",z=JSON.stringify(e[6])),h(W,"load_draw",e[7]),p(J,"part","paper-container"),p(J,"id","paper-container"),o=J,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,k),a(n,E),a(E,_),a(n,C),a(n,T),a(n,L),a(n,A),a(A,N),a(n,S),a(n,D),a(D,O),a(n,V),a(n,R),a(R,I),a(n,F),a(n,B),l(t,H,o),l(t,J,o),a(J,W),U||(q=[f(r,"click",e[20]),f(g,"click",e[21]),f(m,"click",e[22]),f(b,"click",e[23]),f(E,"click",e[24]),f(T,"click",e[25]),f(A,"click",e[26]),f(D,"click",e[27]),f(B,"setValue",e[28]),f(W,"historyIndex",e[29]),f(W,"save",e[30])],U=!0)},p(t,e){16&e[0]&&w!==(w=!t[4])&&(b.disabled=w),32&e[0]&&x!==(x=!t[5])&&(E.disabled=x),16&e[0]&&j!==(j=!t[4])&&(A.disabled=j),16&e[0]&&P!==(P=!t[4])&&(D.disabled=P),2&e[0]&&M!==(M="draw"!==t[1])&&(R.disabled=M),8&e[0]&&h(B,"style",t[3]),1&e[0]&&h(W,"goto",t[0]),4&e[0]&&h(W,"style",t[2]),2&e[0]&&h(W,"mode",t[1]),64&e[0]&&z!==(z=JSON.stringify(t[6]))&&h(W,"save_as",z),128&e[0]&&h(W,"load_draw",t[7])},i:t,o:t,d(t){t&&s(n),t&&s(H),t&&s(J),U=!1,o(q)}}}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,v=!1;function m(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 k(t){v||n(19,v=!0),console.log("h",t),n(18,i=t.index-1),n(0,a=null)}function E(){n(6,s={name:"test",type:"json"})}function _(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 x(t){if(console.log("file",t),t.value.name){const e=new FileReader;e.readAsText(t.value,"UTF-8"),e.onload=function(t){console.log(t.target.result);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=U(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||!v||a&&-1===a)))},[a,f,p,h,g,l,s,c,m,$,w,k,E,_,x,u,d,r,i,v,()=>m("eraser"),()=>m("select"),()=>m("draw"),()=>$(),()=>w(),()=>{},()=>E(),()=>{},t=>x(t.detail),t=>k(t.detail),t=>_(t.detail)]}class Z extends O{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>',D(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),A()))}static get observedAttributes(){return["id","style"]}get id(){return this.$$.ctx[15]}set id(t){this.$$set({id:t}),A()}get style(){return this.$$.ctx[16]}set style(t){this.$$set({style:t}),A()}}return customElements.define("hb-stylus-notebook",Z),Z}();
|
|
2
2
|
//# sourceMappingURL=release.js.map
|