svgedit/dist/editor/extensions/ext-helloworld/ext-helloworld.js

11 lines
46 KiB
JavaScript
Raw Normal View History

var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var check=function(t){return t&&t.Math==Math&&t},e=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof t&&t)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},r=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i={f:o&&!n.call({1:2},1)?function propertyIsEnumerable(t){var e=o(this,t);return!!e&&e.enumerable}:n},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},a={}.toString,classofRaw=function(t){return a.call(t).slice(8,-1)},c="".split,u=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?c.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return u(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},f={}.hasOwnProperty,has=function(t,e){return f.call(t,e)},l=e.document,s=isObject(l)&&isObject(l.createElement),documentCreateElement=function(t){return s?l.createElement(t):{}},p=!r&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),h=Object.getOwnPropertyDescriptor,y={f:r?h:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),p)try{return h(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!i.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},v=Object.defineProperty,d={f:r?v:function defineProperty(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),p)try{return v(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},g=r?function(t,e,r){return d.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,r){try{g(e,t,r)}catch(n){e[t]=r}return r},m=e["__core-js_shared__"]||setGlobal("__core-js_shared__",{}),b=Function.toString;"function"!=typeof m.inspectSource&&(m.inspectSource=function(t){return b.call(t)});var w,S,x,E=m.inspectSource,O=e.WeakMap,j="function"==typeof O&&/native code/.test(E(O)),_=createCommonjsModule((function(t){(t.exports=function(t,e){return m[t]||(m[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),P=0,A=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++P+A).toString(36)},T=_("keys"),sharedKey=function(t){return T[t]||(T[t]=uid(t))},I={},L=e.WeakMap;if(j){var k=new L,R=k.get,M=k.has,C=k.set;w=function(t,e){return C.call(k,t,e),e},S=function(t){return R.call(k,t)||{}},x=function(t){return M.call(k,t)}}else{var G=sharedKey("state");I[G]=!0,w=function(t,e){return g(t,G,e),e},S=function(t){return has(t,G)?t[G]:{}},x=function(t){return has(t,G)}}var N={set:w,get:S,has:x,enforce:function(t){return x(t)?S(t):w(t,{})},getterFor:function(t){return function(e){var r;if(!isObject(e)||(r=S(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},D=createCommonjsModule((function(t){var r=N.get,n=N.enforce,o=
2020-09-06 06:32:10 +00:00
/**
2020-09-11 23:27:47 +00:00
* @file ext-helloworld.js
*
2020-09-06 06:32:10 +00:00
* @license MIT
*
* @copyright 2010 Alexis Deveria
*
2020-10-05 20:01:57 +00:00
*/var fo=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee(t){var e;return regeneratorRuntime.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,__variableDynamicImportRuntime0__("./locale/".concat(encodeURIComponent(t),".js"));case 3:e=r.sent,r.next=12;break;case 6:return r.prev=6,r.t0=r.catch(0),console.error("Missing translation (".concat(t,") - using 'en'")),r.next=11,Promise.resolve().then((function(){return so}));case 11:e=r.sent;case 12:return r.abrupt("return",e.default);case 13:case"end":return r.stop()}}),_callee,null,[[0,6]])})));return function loadExtensionTranslation(e){return t.apply(this,arguments)}}(),lo={name:"helloworld",init:function init(t){var e=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee2(){var r,n,o,i;return regeneratorRuntime.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:return r=t.$,t.importLocale,n=e,a.next=4,fo(n.curPrefs.lang);case 4:return o=a.sent,i=n.canvas,a.abrupt("return",{name:o.name,svgicons:"helloworld-icon.xml",buttons:[{id:"hello_world",icon:"helloworld.png",type:"mode",title:o.buttons[0].title,events:{click:function click(){i.setMode("hello_world")}}}],mouseDown:function mouseDown(){if("hello_world"===i.getMode())return{started:!0}},mouseUp:function mouseUp(t){if("hello_world"===i.getMode()){var e=i.getZoom(),n=t.mouse_x/e,a=t.mouse_y/e,c=o.text;[["x",n],["y",a]].forEach((function(t){var e=_slicedToArray(t,2),r=e[0],n=e[1];c=c.replace("{"+r+"}",n)})),r.alert(c)}}});case 7:case"end":return a.stop()}}),_callee2)})))()}},so=Object.freeze({__proto__:null,default:{name:"Hello World",text:"Hello World!\n\nYou clicked here: {x}, {y}",buttons:[{title:"Say 'Hello World'"}]}}),po=Object.freeze({__proto__:null,default:{name:"Hello World",text:"Hello World!\n\n : {x}, {y}",buttons:[{title:" 'Hello World'"}]}});export default lo;
2020-09-06 06:32:10 +00:00
//# sourceMappingURL=ext-helloworld.js.map