@htmlbricks/hb-stylus-notebook 0.19.26 → 0.19.28
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 +4 -4
- 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.19.
|
|
5
|
+
"version": "0.19.28",
|
|
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": "
|
|
78
|
+
"gitHead": "9a985b86696ae14c3da0c6d0103f796c6a190ac3",
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@htmlbricks/hb-input-file": "^0.19.
|
|
81
|
-
"@htmlbricks/hb-stylus-paper": "^0.19.
|
|
80
|
+
"@htmlbricks/hb-input-file": "^0.19.28",
|
|
81
|
+
"@htmlbricks/hb-stylus-paper": "^0.19.28",
|
|
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 e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function r(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function s(e,t){e.appendChild(t)}function l(e,t,n){e.insertBefore(t,n||null)}function a(e){e.parentNode&&e.parentNode.removeChild(e)}function c(e){return document.createElement(e)}function u(e){return document.createTextNode(e)}function d(){return u(" ")}function p(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function f(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function g(e,t,n){t in e?e[t]="boolean"==typeof e[t]&&""===n||n:f(e,t,n)}function h(e){const t={};for(const n of e)t[n.name]=n.value;return t}let m;function v(e){m=e}function y(){if(!m)throw new Error("Function called outside component initialization");return m}function b(){const e=y();return(t,n,{cancelable:o=!1}={})=>{const r=e.$$.callbacks[t];if(r){const i=function(e,t,{bubbles:n=!1,cancelable:o=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n,o,t),r}(t,n,{cancelable:o});return r.slice().forEach((t=>{t.call(e,i)})),!i.defaultPrevented}return!0}}const $=[],w=[],_=[],k=[],x=Promise.resolve();let C=!1;function E(e){_.push(e)}const N=new Set;let S=0;function j(){if(0!==S)return;const e=m;do{try{for(;S<$.length;){const e=$[S];S++,v(e),T(e.$$)}}catch(e){throw $.length=0,S=0,e}for(v(null),$.length=0,S=0;w.length;)w.pop()();for(let e=0;e<_.length;e+=1){const t=_[e];N.has(t)||(N.add(t),t())}_.length=0}while($.length);for(;k.length;)k.pop()();C=!1,N.clear(),v(e)}function T(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(E)}}const O=new Set;function L(e,t){-1===e.$$.dirty[0]&&($.push(e),C||(C=!0,x.then(j)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function D(i,s,l,c,u,d,p,f=[-1]){const g=m;v(i);const h=i.$$={fragment:null,ctx:[],props:d,update:e,not_equal:u,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(g?g.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:s.target||g.$$.root};p&&p(h.root);let y=!1;if(h.ctx=l?l(i,s.props||{},((e,t,...n)=>{const o=n.length?n[0]:t;return h.ctx&&u(h.ctx[e],h.ctx[e]=o)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](o),y&&L(i,e)),t})):[],h.update(),y=!0,o(h.before_update),h.fragment=!!c&&c(h.ctx),s.target){if(s.hydrate){const e=function(e){return Array.from(e.childNodes)}(s.target);h.fragment&&h.fragment.l(e),e.forEach(a)}else h.fragment&&h.fragment.c();s.intro&&((b=i.$$.fragment)&&b.i&&(O.delete(b),b.i($))),function(e,n,i,s){const{fragment:l,after_update:a}=e.$$;l&&l.m(n,i),s||E((()=>{const n=e.$$.on_mount.map(t).filter(r);e.$$.on_destroy?e.$$.on_destroy.push(...n):o(n),e.$$.on_mount=[]})),a.forEach(E)}(i,s.target,s.anchor,s.customElement),j()}var b,$;v(g)}let A;"function"==typeof HTMLElement&&(A=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(t).filter(r);for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(t,n){if(!r(n))return e;const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(n),()=>{const e=o.indexOf(n);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});var J={name:"@htmlbricks/hb-stylus-notebook",displayName:"Svelte-Bootstrap stylus-notebook",description:"Svelte-Bootstrap stylus-notebook",version:"0.19.26",main:"release/release.js",publishConfig:{access:"public"},author:"Dario Caruso <dev@dariocaruso.info> (https://dariocaruso.info)",authorUrl:"https://dariocaruso.info",license:"MIT","license-docs":"CC BY 4.0","license-translations":"CC BY 4.0","license-images":"CC BY-NC 4.0",engines:{node:">=16.0.0"},scripts:{start:"sirv dist",dev:"rm -rf ./dist && rollup -c -w",build:"rm -rf ./dist && rollup -c","generate-manifest":"npm run generate-schemes && monorepo-wc-packages-manifester --dir $PWD","generate-component-schema":"ts-json-schema-generator --type 'Component' --path 'app/types/webcomponent.type.d.ts' > dist/webcomponent.type.d.json","generate-events-schema":"ts-json-schema-generator --type 'Events' --path 'app/types/webcomponent.type.d.ts' > dist/webcomponent_events.type.d.json","generate-schemes":"npm run generate-events-schema && npm run generate-component-schema",copydest:"rm -rf release && mkdir -p release && mkdir -p release && cp dist/* ./release/","build-extra":"tsc --moduleResolution node --module es2020 --esModuleInterop true --outDir dist --sourceMap --skipLibCheck extra/*","build:release":"PRODUCTION=true npm run build && npm run build-extra && npm run generate-manifest && npm run copydest",prepublish:"npm run build:release"},devDependencies:{"@rollup/plugin-alias":"^3.1.2","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^4.0.0","@rollup/plugin-typescript":"^8.2.1","@tsconfig/svelte":"^1.0.10","@types/node":"^16.7.1","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0",eslint:"^7.25.0","eslint-plugin-jsdoc":"^33.0.0","eslint-plugin-svelte3":"^3.2.0","monorepo-wc-packages-manifester":"^0.0.3","node-sass":"^6.0.1",postcss:"^8.2.13","postcss-load-config":"^3.0.1",prettier:"^2.8.4",rollup:"^2.46.0","rollup-plugin-copy":"^3.4.0","rollup-plugin-css-only":"^3.1.0","rollup-plugin-livereload":"^2.0.0","rollup-plugin-svelte":"^7.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-ts-paths":"^1.0.5","rollup-plugin-typescript2":"^0.31.1",sass:"^1.32.12","sirv-cli":"^1.0.11",svelte:"^3.46.2","svelte-check":"^1.5.2","svelte-preprocess":"^4.7.2","ts-json-schema-generator":"^0.98.0","ts-node":"^9.1.1",tslib:"^2.2.0",ttypescript:"^1.5.12",typescript:"^4.2.4","typescript-transform-paths":"^2.2.3","wc-js-utils":"^0.0.1"},keywords:["svelte","svelte-webcomponents","webcomponents"],contributors:[],gitHead:"2aca7296aa6983bda173f6c9b1dbd85a268f604f",dependencies:{"@htmlbricks/hb-input-file":"^0.19.26","@htmlbricks/hb-stylus-paper":"^0.19.26","style-to-object":"^0.3.0"}},P=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,I=/^\s*/,M=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,V=/^:\s*/,B=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,F=/^[;\s]*/,U=/^\s+|\s+$/g,H="\n",W="/",Y="*",z="",q="comment",K="declaration",G=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,o=1;function r(e){var t=e.match(R);t&&(n+=t.length);var r=e.lastIndexOf(H);o=~r?e.length-r:o+e.length}function i(){var e={line:n,column:o};return function(t){return t.position=new s(e),c(),t}}function s(e){this.start=e,this.end={line:n,column:o},this.source=t.source}function l(r){var i=new Error(t.source+":"+n+":"+o+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=o,i.source=e,!t.silent)throw i}function a(t){var n=t.exec(e);if(n){var o=n[0];return r(o),e=e.slice(o.length),n}}function c(){a(I)}function u(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var t=i();if(W==e.charAt(0)&&Y==e.charAt(1)){for(var n=2;z!=e.charAt(n)&&(Y!=e.charAt(n)||W!=e.charAt(n+1));)++n;if(n+=2,z===e.charAt(n-1))return l("End of comment missing");var s=e.slice(2,n-2);return o+=2,r(s),e=e.slice(n),o+=2,t({type:q,comment:s})}}function p(){var e=i(),t=a(M);if(t){if(d(),!a(V))return l("property missing ':'");var n=a(B),o=e({type:K,property:Q(t[0].replace(P,z)),value:n?Q(n[0].replace(P,z)):z});return a(F),o}}return s.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=p();)!1!==e&&(t.push(e),u(t));return t}()};function Q(e){return e?e.replace(U,z):z}var X=function(e,t){var n,o=null;if(!e||"string"!=typeof e)return o;for(var r,i,s=G(e),l="function"==typeof t,a=0,c=s.length;a<c;a++)r=(n=s[a]).property,i=n.value,l?t(r,i,n):i&&(o||(o={}),o[r]=i);return o};var Z,ee=(function(e,t){t.__esModule=!0,t.LanguageTranslator=t.addComponent=t.getChildStyleToPass=void 0,t.getChildStyleToPass=function(e,t){var n,o,r="";if(e&&(null==t?void 0:t.length)&&(null===(n=Object.keys(e))||void 0===n?void 0:n.length)&&(null===(o=null==t?void 0:t.filter((function(t){return Object.keys(e).includes(t.name)})))||void 0===o?void 0:o.length))for(var i=function(n){(null==t?void 0:t.filter((function(t){return t.name===n&&t.defaultValue!==e[n]})))&&(r+="".concat(n,":").concat(e[n],";"))},s=0,l=Object.keys(e);s<l.length;s++)i(l[s]);return r},t.addComponent=function(e){var t,n=(null===(t=null==e?void 0:e.repoName.split("/"))||void 0===t?void 0:t[1])||(null==e?void 0:e.repoName);if(!n)throw new Error("wrong componentPath "+(null==e?void 0:e.repoName));if(!(null==e?void 0:e.version))throw new Error("wrong version "+(null==e?void 0:e.version));var o=(null==e?void 0:e.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(e.repoName,"@").concat(e.version,"/").concat(o),(null==e?void 0:e.local)&&location.href.includes("localhost")&&(r.src="".concat(e.local)),document.head.appendChild(r)}catch(e){console.warn(e)}};var n=function(){function e(e){if(!(null==e?void 0:e.dictionary))throw new Error("no dictionary provided");this.dictionary=e.dictionary,this.setLang(null==e?void 0:e.lang)}return e.prototype.setLang=function(t){t||(t=e.getDefaultLang()),this.lang=t},e.prototype.translateWord=function(t,n){return e.getDictionaryWord(t,this.dictionary,n||this.lang)},e.prototype.translateDate=function(t,n,o){return e.formatDate(t,n,o||this.lang)},e.getDefaultLang=function(){var e,t,n,o,r,i="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(t=null===(e=navigator.languages[0])||void 0===e?void 0:e.split("-")[0])||void 0===t?void 0:t.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},e.getDictionaryWord=function(t,n,o){var r;if(!t)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[t]))return n[o][t];var i="",s=e.getDefaultLang();if(!o||s!==o){var l=null==n?void 0:n[s];(null==l?void 0:l[t])&&(i=l[t])}return i},e.formatDate=function(t,n,o){if(!t)throw new Error("no date provided");if("function"!=typeof t.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||e.getDefaultLang(),n).format(t)},e}();t.LanguageTranslator=n}(Z={exports:{}},Z.exports),Z.exports),te={vars:[],parts:[]},ne={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 oe(t){let n,r,i,h,m,v,y,b,$,w,_,k,x,C,E,N,S,j,T,O,L,D,A,J,P,R,I,M,V,B,F,U,H,W,Y,z;return{c(){var o,s,l,a;n=c("div"),r=c("button"),r.textContent="clear",i=d(),h=c("button"),h.textContent="select",m=d(),v=c("button"),v.textContent="draw",y=d(),b=c("button"),$=u("undo"),_=d(),k=c("button"),x=u("redo"),E=d(),N=c("button"),S=u("save"),T=d(),O=c("button"),L=u("brush"),A=d(),J=c("br"),P=u("load:"),R=c("hb-input-file"),I=u("\n\tinsert:"),M=c("hb-input-file"),V=d(),B=c("div"),F=c("hb-stylus-paper"),this.c=e,b.disabled=w=!t[5],k.disabled=C=!t[6],N.disabled=j=!t[5],O.disabled=D="draw"!==t[2],g(R,"id","loadfile"),g(R,"style",t[4]),g(R,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"})),g(M,"id","insertfile"),g(M,"style",t[4]),g(M,"schemaentry",JSON.stringify({label:"ciao"})),f(n,"part","controller"),f(n,"id","controller"),g(F,"id","stylus-paper"),g(F,"goto",t[1]),g(F,"style",t[3]),g(F,"background_color","green"),g(F,"mode",t[2]),g(F,"save_as",U=JSON.stringify(t[7])),g(F,"load_draw",H=t[0]?JSON.stringify(t[0]):null),g(F,"insert_image",W=t[8]?JSON.stringify(t[8]):null),g(F,"insert_text",t[9]?JSON.stringify(t[9]):null),f(B,"part","paper-container"),f(B,"id","paper-container"),o=B,s="position",null===(l="relative")?o.style.removeProperty(s):o.style.setProperty(s,l,a?"important":"")},m(e,o){l(e,n,o),s(n,r),s(n,i),s(n,h),s(n,m),s(n,v),s(n,y),s(n,b),s(b,$),s(n,_),s(n,k),s(k,x),s(n,E),s(n,N),s(N,S),s(n,T),s(n,O),s(O,L),s(n,A),s(n,J),s(n,P),s(n,R),s(n,I),s(n,M),l(e,V,o),l(e,B,o),s(B,F),Y||(z=[p(r,"click",t[24]),p(h,"click",t[25]),p(v,"click",t[26]),p(b,"click",t[27]),p(k,"click",t[28]),p(N,"click",t[29]),p(R,"setValue",t[30]),p(M,"setValue",t[31]),p(F,"historyIndex",t[32]),p(F,"save",t[33])],Y=!0)},p(e,t){32&t[0]&&w!==(w=!e[5])&&(b.disabled=w),64&t[0]&&C!==(C=!e[6])&&(k.disabled=C),32&t[0]&&j!==(j=!e[5])&&(N.disabled=j),4&t[0]&&D!==(D="draw"!==e[2])&&(O.disabled=D),16&t[0]&&g(R,"style",e[4]),16&t[0]&&g(M,"style",e[4]),2&t[0]&&g(F,"goto",e[1]),8&t[0]&&g(F,"style",e[3]),4&t[0]&&g(F,"mode",e[2]),128&t[0]&&U!==(U=JSON.stringify(e[7]))&&g(F,"save_as",U),1&t[0]&&H!==(H=e[0]?JSON.stringify(e[0]):null)&&g(F,"load_draw",H),256&t[0]&&W!==(W=e[8]?JSON.stringify(e[8]):null)&&g(F,"insert_image",W)},i:e,o:e,d(e){e&&a(n),e&&a(V),e&&a(B),Y=!1,o(z)}}}function re(e,t,n){const o=y();b();let r,i,s,l,a,c,u,{id:d}=t,{style:p}=t,f="draw",g="",h="",m=!1,v=!1,{load_draw:$}=t;function w(e){n(2,f=e)}function _(){console.log("ch",i,s),i>=0&&(!s||s>-1)&&(n(1,s=s||0===s?s-1:i-1),console.log("undo",i,s))}function k(){console.log(i,s),(s||0===s)&&s<=i&&(n(1,s++,s),console.log("redo",i,s))}function x(e){v||n(22,v=!0),console.log("h",e),n(21,i=e.index-1),e.start_index&&n(23,u=e.start_index),n(1,s=null)}function C(){n(7,a={name:"test",type:"json"})}function E(e){var t;const o=null===(t=e.value)||void 0===t?void 0:t.name;if(o){const t=new FileReader;t.readAsDataURL(e.value),t.onload=function(e){var t,r;try{if(console.log("insert file",e.target,null===(t=e.target)||void 0===t?void 0:t.result),null===(r=e.target)||void 0===r?void 0:r.result){const t=e.target.result.toString().split(";")[0].split("/")[1];n(8,c={base64:e.target.result.toString(),type:t,name:o})}}catch(e){console.error("error loading file")}},t.onerror=function(e){console.error("error reading file")}}}function N(e){var t,o,r,i;console.log("save",e),n(7,a=null),t=e,o=e.name+".json",r="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(t)),(i=document.createElement("a")).setAttribute("href",r),i.setAttribute("download",o),document.body.appendChild(i),i.click(),i.remove()}function S(e){if(console.log("file",e),e.value.name){const t=new FileReader;t.readAsText(e.value,"UTF-8"),t.onload=function(e){try{n(0,$=JSON.parse(e.target.result.toString()))}catch(e){console.error("error loading file")}},t.onerror=function(e){console.error("error reading file")}}}ee.addComponent({repoName:"@htmlbricks/hb-stylus-paper",version:J.version}),ee.addComponent({repoName:"@htmlbricks/hb-input-file",version:J.version}),function(e){y().$$.on_mount.push(e)}((()=>{console.log(o.shadowRoot.getElementById("skeletontest"))}));return e.$$set=e=>{"id"in e&&n(18,d=e.id),"style"in e&&n(19,p=e.style),"load_draw"in e&&n(0,$=e.load_draw)},e.$$.update=()=>{if(16515075&e.$$.dirty[0])if(d||n(18,d=""),p&&(n(20,r=X(p)),n(3,g=ee.getChildStyleToPass(r,null==te?void 0:te.vars)),n(4,h=ee.getChildStyleToPass(r,null==ne?void 0:ne.vars))),i||0===i||n(21,i=0),n(6,l=!(0!==s&&!s||!(s<i))),n(5,m=!(!i&&0!==i||!v||s&&-1===s||u&&!(u<i&&(!s||s<u)))),"string"==typeof $&&(null==$?void 0:$.length))try{n(0,$=JSON.parse($))}catch(e){console.error("error parsing json",e)}else $||n(0,$=null)},[$,s,f,g,h,m,l,a,c,undefined,w,_,k,x,C,E,N,S,d,p,r,i,v,u,()=>w("eraser"),()=>w("select"),()=>w("draw"),()=>_(),()=>k(),()=>C(),e=>S(e.detail),e=>E(e.detail),e=>x(e.detail),e=>N(e.detail)]}class ie extends A{constructor(e){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:h(this.attributes),customElement:!0},re,oe,i,{id:18,style:19,load_draw:0},null,[-1,-1]),e&&(e.target&&l(e.target,this,e.anchor),e.props&&(this.$set(e.props),j()))}static get observedAttributes(){return["id","style","load_draw"]}get id(){return this.$$.ctx[18]}set id(e){this.$$set({id:e}),j()}get style(){return this.$$.ctx[19]}set style(e){this.$$set({style:e}),j()}get load_draw(){return this.$$.ctx[0]}set load_draw(e){this.$$set({load_draw:e}),j()}}return customElements.define("hb-stylus-notebook",ie),ie}();
|
|
1
|
+
var release=function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function r(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function s(e,t){e.appendChild(t)}function l(e,t,n){e.insertBefore(t,n||null)}function a(e){e.parentNode&&e.parentNode.removeChild(e)}function c(e){return document.createElement(e)}function u(e){return document.createTextNode(e)}function d(){return u(" ")}function p(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function f(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function g(e,t,n){t in e?e[t]="boolean"==typeof e[t]&&""===n||n:f(e,t,n)}function h(e){const t={};for(const n of e)t[n.name]=n.value;return t}let m;function v(e){m=e}function y(){if(!m)throw new Error("Function called outside component initialization");return m}function b(){const e=y();return(t,n,{cancelable:o=!1}={})=>{const r=e.$$.callbacks[t];if(r){const i=function(e,t,{bubbles:n=!1,cancelable:o=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n,o,t),r}(t,n,{cancelable:o});return r.slice().forEach((t=>{t.call(e,i)})),!i.defaultPrevented}return!0}}const $=[],w=[],_=[],k=[],x=Promise.resolve();let C=!1;function E(e){_.push(e)}const N=new Set;let S=0;function j(){if(0!==S)return;const e=m;do{try{for(;S<$.length;){const e=$[S];S++,v(e),T(e.$$)}}catch(e){throw $.length=0,S=0,e}for(v(null),$.length=0,S=0;w.length;)w.pop()();for(let e=0;e<_.length;e+=1){const t=_[e];N.has(t)||(N.add(t),t())}_.length=0}while($.length);for(;k.length;)k.pop()();C=!1,N.clear(),v(e)}function T(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(E)}}const O=new Set;function L(e,t){-1===e.$$.dirty[0]&&($.push(e),C||(C=!0,x.then(j)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function D(i,s,l,c,u,d,p,f=[-1]){const g=m;v(i);const h=i.$$={fragment:null,ctx:[],props:d,update:e,not_equal:u,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(g?g.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:s.target||g.$$.root};p&&p(h.root);let y=!1;if(h.ctx=l?l(i,s.props||{},((e,t,...n)=>{const o=n.length?n[0]:t;return h.ctx&&u(h.ctx[e],h.ctx[e]=o)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](o),y&&L(i,e)),t})):[],h.update(),y=!0,o(h.before_update),h.fragment=!!c&&c(h.ctx),s.target){if(s.hydrate){const e=function(e){return Array.from(e.childNodes)}(s.target);h.fragment&&h.fragment.l(e),e.forEach(a)}else h.fragment&&h.fragment.c();s.intro&&((b=i.$$.fragment)&&b.i&&(O.delete(b),b.i($))),function(e,n,i,s){const{fragment:l,after_update:a}=e.$$;l&&l.m(n,i),s||E((()=>{const n=e.$$.on_mount.map(t).filter(r);e.$$.on_destroy?e.$$.on_destroy.push(...n):o(n),e.$$.on_mount=[]})),a.forEach(E)}(i,s.target,s.anchor,s.customElement),j()}var b,$;v(g)}let A;"function"==typeof HTMLElement&&(A=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(t).filter(r);for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(t,n){if(!r(n))return e;const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(n),()=>{const e=o.indexOf(n);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});var J={name:"@htmlbricks/hb-stylus-notebook",displayName:"Svelte-Bootstrap stylus-notebook",description:"Svelte-Bootstrap stylus-notebook",version:"0.19.28",main:"release/release.js",publishConfig:{access:"public"},author:"Dario Caruso <dev@dariocaruso.info> (https://dariocaruso.info)",authorUrl:"https://dariocaruso.info",license:"MIT","license-docs":"CC BY 4.0","license-translations":"CC BY 4.0","license-images":"CC BY-NC 4.0",engines:{node:">=16.0.0"},scripts:{start:"sirv dist",dev:"rm -rf ./dist && rollup -c -w",build:"rm -rf ./dist && rollup -c","generate-manifest":"npm run generate-schemes && monorepo-wc-packages-manifester --dir $PWD","generate-component-schema":"ts-json-schema-generator --type 'Component' --path 'app/types/webcomponent.type.d.ts' > dist/webcomponent.type.d.json","generate-events-schema":"ts-json-schema-generator --type 'Events' --path 'app/types/webcomponent.type.d.ts' > dist/webcomponent_events.type.d.json","generate-schemes":"npm run generate-events-schema && npm run generate-component-schema",copydest:"rm -rf release && mkdir -p release && mkdir -p release && cp dist/* ./release/","build-extra":"tsc --moduleResolution node --module es2020 --esModuleInterop true --outDir dist --sourceMap --skipLibCheck extra/*","build:release":"PRODUCTION=true npm run build && npm run build-extra && npm run generate-manifest && npm run copydest",prepublish:"npm run build:release"},devDependencies:{"@rollup/plugin-alias":"^3.1.2","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^4.0.0","@rollup/plugin-typescript":"^8.2.1","@tsconfig/svelte":"^1.0.10","@types/node":"^16.7.1","@typescript-eslint/eslint-plugin":"^4.22.0","@typescript-eslint/parser":"^4.22.0",eslint:"^7.25.0","eslint-plugin-jsdoc":"^33.0.0","eslint-plugin-svelte3":"^3.2.0","monorepo-wc-packages-manifester":"^0.0.3","node-sass":"^6.0.1",postcss:"^8.2.13","postcss-load-config":"^3.0.1",prettier:"^2.8.4",rollup:"^2.46.0","rollup-plugin-copy":"^3.4.0","rollup-plugin-css-only":"^3.1.0","rollup-plugin-livereload":"^2.0.0","rollup-plugin-svelte":"^7.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-ts-paths":"^1.0.5","rollup-plugin-typescript2":"^0.31.1",sass:"^1.32.12","sirv-cli":"^1.0.11",svelte:"^3.46.2","svelte-check":"^1.5.2","svelte-preprocess":"^4.7.2","ts-json-schema-generator":"^0.98.0","ts-node":"^9.1.1",tslib:"^2.2.0",ttypescript:"^1.5.12",typescript:"^4.2.4","typescript-transform-paths":"^2.2.3","wc-js-utils":"^0.0.1"},keywords:["svelte","svelte-webcomponents","webcomponents"],contributors:[],gitHead:"9a985b86696ae14c3da0c6d0103f796c6a190ac3",dependencies:{"@htmlbricks/hb-input-file":"^0.19.28","@htmlbricks/hb-stylus-paper":"^0.19.28","style-to-object":"^0.3.0"}},P=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,I=/^\s*/,M=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,V=/^:\s*/,B=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,F=/^[;\s]*/,U=/^\s+|\s+$/g,H="\n",W="/",Y="*",z="",q="comment",K="declaration",G=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,o=1;function r(e){var t=e.match(R);t&&(n+=t.length);var r=e.lastIndexOf(H);o=~r?e.length-r:o+e.length}function i(){var e={line:n,column:o};return function(t){return t.position=new s(e),c(),t}}function s(e){this.start=e,this.end={line:n,column:o},this.source=t.source}function l(r){var i=new Error(t.source+":"+n+":"+o+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=o,i.source=e,!t.silent)throw i}function a(t){var n=t.exec(e);if(n){var o=n[0];return r(o),e=e.slice(o.length),n}}function c(){a(I)}function u(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var t=i();if(W==e.charAt(0)&&Y==e.charAt(1)){for(var n=2;z!=e.charAt(n)&&(Y!=e.charAt(n)||W!=e.charAt(n+1));)++n;if(n+=2,z===e.charAt(n-1))return l("End of comment missing");var s=e.slice(2,n-2);return o+=2,r(s),e=e.slice(n),o+=2,t({type:q,comment:s})}}function p(){var e=i(),t=a(M);if(t){if(d(),!a(V))return l("property missing ':'");var n=a(B),o=e({type:K,property:Q(t[0].replace(P,z)),value:n?Q(n[0].replace(P,z)):z});return a(F),o}}return s.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=p();)!1!==e&&(t.push(e),u(t));return t}()};function Q(e){return e?e.replace(U,z):z}var X=function(e,t){var n,o=null;if(!e||"string"!=typeof e)return o;for(var r,i,s=G(e),l="function"==typeof t,a=0,c=s.length;a<c;a++)r=(n=s[a]).property,i=n.value,l?t(r,i,n):i&&(o||(o={}),o[r]=i);return o};var Z,ee=(function(e,t){t.__esModule=!0,t.LanguageTranslator=t.addComponent=t.getChildStyleToPass=void 0,t.getChildStyleToPass=function(e,t){var n,o,r="";if(e&&(null==t?void 0:t.length)&&(null===(n=Object.keys(e))||void 0===n?void 0:n.length)&&(null===(o=null==t?void 0:t.filter((function(t){return Object.keys(e).includes(t.name)})))||void 0===o?void 0:o.length))for(var i=function(n){(null==t?void 0:t.filter((function(t){return t.name===n&&t.defaultValue!==e[n]})))&&(r+="".concat(n,":").concat(e[n],";"))},s=0,l=Object.keys(e);s<l.length;s++)i(l[s]);return r},t.addComponent=function(e){var t,n=(null===(t=null==e?void 0:e.repoName.split("/"))||void 0===t?void 0:t[1])||(null==e?void 0:e.repoName);if(!n)throw new Error("wrong componentPath "+(null==e?void 0:e.repoName));if(!(null==e?void 0:e.version))throw new Error("wrong version "+(null==e?void 0:e.version));var o=(null==e?void 0:e.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(e.repoName,"@").concat(e.version,"/").concat(o),(null==e?void 0:e.local)&&location.href.includes("localhost")&&(r.src="".concat(e.local)),document.head.appendChild(r)}catch(e){console.warn(e)}};var n=function(){function e(e){if(!(null==e?void 0:e.dictionary))throw new Error("no dictionary provided");this.dictionary=e.dictionary,this.setLang(null==e?void 0:e.lang)}return e.prototype.setLang=function(t){t||(t=e.getDefaultLang()),this.lang=t},e.prototype.translateWord=function(t,n){return e.getDictionaryWord(t,this.dictionary,n||this.lang)},e.prototype.translateDate=function(t,n,o){return e.formatDate(t,n,o||this.lang)},e.getDefaultLang=function(){var e,t,n,o,r,i="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(t=null===(e=navigator.languages[0])||void 0===e?void 0:e.split("-")[0])||void 0===t?void 0:t.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},e.getDictionaryWord=function(t,n,o){var r;if(!t)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[t]))return n[o][t];var i="",s=e.getDefaultLang();if(!o||s!==o){var l=null==n?void 0:n[s];(null==l?void 0:l[t])&&(i=l[t])}return i},e.formatDate=function(t,n,o){if(!t)throw new Error("no date provided");if("function"!=typeof t.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(o||e.getDefaultLang(),n).format(t)},e}();t.LanguageTranslator=n}(Z={exports:{}},Z.exports),Z.exports),te={vars:[],parts:[]},ne={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 oe(t){let n,r,i,h,m,v,y,b,$,w,_,k,x,C,E,N,S,j,T,O,L,D,A,J,P,R,I,M,V,B,F,U,H,W,Y,z;return{c(){var o,s,l,a;n=c("div"),r=c("button"),r.textContent="clear",i=d(),h=c("button"),h.textContent="select",m=d(),v=c("button"),v.textContent="draw",y=d(),b=c("button"),$=u("undo"),_=d(),k=c("button"),x=u("redo"),E=d(),N=c("button"),S=u("save"),T=d(),O=c("button"),L=u("brush"),A=d(),J=c("br"),P=u("load:"),R=c("hb-input-file"),I=u("\n\tinsert:"),M=c("hb-input-file"),V=d(),B=c("div"),F=c("hb-stylus-paper"),this.c=e,b.disabled=w=!t[5],k.disabled=C=!t[6],N.disabled=j=!t[5],O.disabled=D="draw"!==t[2],g(R,"id","loadfile"),g(R,"style",t[4]),g(R,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"})),g(M,"id","insertfile"),g(M,"style",t[4]),g(M,"schemaentry",JSON.stringify({label:"ciao"})),f(n,"part","controller"),f(n,"id","controller"),g(F,"id","stylus-paper"),g(F,"goto",t[1]),g(F,"style",t[3]),g(F,"background_color","green"),g(F,"mode",t[2]),g(F,"save_as",U=JSON.stringify(t[7])),g(F,"load_draw",H=t[0]?JSON.stringify(t[0]):null),g(F,"insert_image",W=t[8]?JSON.stringify(t[8]):null),g(F,"insert_text",t[9]?JSON.stringify(t[9]):null),f(B,"part","paper-container"),f(B,"id","paper-container"),o=B,s="position",null===(l="relative")?o.style.removeProperty(s):o.style.setProperty(s,l,a?"important":"")},m(e,o){l(e,n,o),s(n,r),s(n,i),s(n,h),s(n,m),s(n,v),s(n,y),s(n,b),s(b,$),s(n,_),s(n,k),s(k,x),s(n,E),s(n,N),s(N,S),s(n,T),s(n,O),s(O,L),s(n,A),s(n,J),s(n,P),s(n,R),s(n,I),s(n,M),l(e,V,o),l(e,B,o),s(B,F),Y||(z=[p(r,"click",t[24]),p(h,"click",t[25]),p(v,"click",t[26]),p(b,"click",t[27]),p(k,"click",t[28]),p(N,"click",t[29]),p(R,"setValue",t[30]),p(M,"setValue",t[31]),p(F,"historyIndex",t[32]),p(F,"save",t[33])],Y=!0)},p(e,t){32&t[0]&&w!==(w=!e[5])&&(b.disabled=w),64&t[0]&&C!==(C=!e[6])&&(k.disabled=C),32&t[0]&&j!==(j=!e[5])&&(N.disabled=j),4&t[0]&&D!==(D="draw"!==e[2])&&(O.disabled=D),16&t[0]&&g(R,"style",e[4]),16&t[0]&&g(M,"style",e[4]),2&t[0]&&g(F,"goto",e[1]),8&t[0]&&g(F,"style",e[3]),4&t[0]&&g(F,"mode",e[2]),128&t[0]&&U!==(U=JSON.stringify(e[7]))&&g(F,"save_as",U),1&t[0]&&H!==(H=e[0]?JSON.stringify(e[0]):null)&&g(F,"load_draw",H),256&t[0]&&W!==(W=e[8]?JSON.stringify(e[8]):null)&&g(F,"insert_image",W)},i:e,o:e,d(e){e&&a(n),e&&a(V),e&&a(B),Y=!1,o(z)}}}function re(e,t,n){const o=y();b();let r,i,s,l,a,c,u,{id:d}=t,{style:p}=t,f="draw",g="",h="",m=!1,v=!1,{load_draw:$}=t;function w(e){n(2,f=e)}function _(){console.log("ch",i,s),i>=0&&(!s||s>-1)&&(n(1,s=s||0===s?s-1:i-1),console.log("undo",i,s))}function k(){console.log(i,s),(s||0===s)&&s<=i&&(n(1,s++,s),console.log("redo",i,s))}function x(e){v||n(22,v=!0),console.log("h",e),n(21,i=e.index-1),e.start_index&&n(23,u=e.start_index),n(1,s=null)}function C(){n(7,a={name:"test",type:"json"})}function E(e){var t;const o=null===(t=e.value)||void 0===t?void 0:t.name;if(o){const t=new FileReader;t.readAsDataURL(e.value),t.onload=function(e){var t,r;try{if(console.log("insert file",e.target,null===(t=e.target)||void 0===t?void 0:t.result),null===(r=e.target)||void 0===r?void 0:r.result){const t=e.target.result.toString().split(";")[0].split("/")[1];n(8,c={base64:e.target.result.toString(),type:t,name:o})}}catch(e){console.error("error loading file")}},t.onerror=function(e){console.error("error reading file")}}}function N(e){var t,o,r,i;console.log("save",e),n(7,a=null),t=e,o=e.name+".json",r="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(t)),(i=document.createElement("a")).setAttribute("href",r),i.setAttribute("download",o),document.body.appendChild(i),i.click(),i.remove()}function S(e){if(console.log("file",e),e.value.name){const t=new FileReader;t.readAsText(e.value,"UTF-8"),t.onload=function(e){try{n(0,$=JSON.parse(e.target.result.toString()))}catch(e){console.error("error loading file")}},t.onerror=function(e){console.error("error reading file")}}}ee.addComponent({repoName:"@htmlbricks/hb-stylus-paper",version:J.version}),ee.addComponent({repoName:"@htmlbricks/hb-input-file",version:J.version}),function(e){y().$$.on_mount.push(e)}((()=>{console.log(o.shadowRoot.getElementById("skeletontest"))}));return e.$$set=e=>{"id"in e&&n(18,d=e.id),"style"in e&&n(19,p=e.style),"load_draw"in e&&n(0,$=e.load_draw)},e.$$.update=()=>{if(16515075&e.$$.dirty[0])if(d||n(18,d=""),p&&(n(20,r=X(p)),n(3,g=ee.getChildStyleToPass(r,null==te?void 0:te.vars)),n(4,h=ee.getChildStyleToPass(r,null==ne?void 0:ne.vars))),i||0===i||n(21,i=0),n(6,l=!(0!==s&&!s||!(s<i))),n(5,m=!(!i&&0!==i||!v||s&&-1===s||u&&!(u<i&&(!s||s<u)))),"string"==typeof $&&(null==$?void 0:$.length))try{n(0,$=JSON.parse($))}catch(e){console.error("error parsing json",e)}else $||n(0,$=null)},[$,s,f,g,h,m,l,a,c,undefined,w,_,k,x,C,E,N,S,d,p,r,i,v,u,()=>w("eraser"),()=>w("select"),()=>w("draw"),()=>_(),()=>k(),()=>C(),e=>S(e.detail),e=>E(e.detail),e=>x(e.detail),e=>N(e.detail)]}class ie extends A{constructor(e){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:h(this.attributes),customElement:!0},re,oe,i,{id:18,style:19,load_draw:0},null,[-1,-1]),e&&(e.target&&l(e.target,this,e.anchor),e.props&&(this.$set(e.props),j()))}static get observedAttributes(){return["id","style","load_draw"]}get id(){return this.$$.ctx[18]}set id(e){this.$$set({id:e}),j()}get style(){return this.$$.ctx[19]}set style(e){this.$$set({style:e}),j()}get load_draw(){return this.$$.ctx[0]}set load_draw(e){this.$$set({load_draw:e}),j()}}return customElements.define("hb-stylus-notebook",ie),ie}();
|
|
2
2
|
//# sourceMappingURL=release.js.map
|