@gct-paas/core-web 0.0.1-dev.12

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1 -0
  4. package/dist/core-web.css +0 -0
  5. package/dist/index.min.cjs +11 -0
  6. package/dist/index.system.min.js +11 -0
  7. package/es/components/code-editor/code-editor.d.ts +3 -0
  8. package/es/components/code-editor/code-editor.mjs +34 -0
  9. package/es/components/code-editor/code-editor.scss +3 -0
  10. package/es/components/index.d.ts +1 -0
  11. package/es/components/index.mjs +3 -0
  12. package/es/index.d.ts +5 -0
  13. package/es/index.mjs +11 -0
  14. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/_virtual/_rollupPluginBabelHelpers.mjs +142 -0
  15. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/config/index.mjs +7 -0
  16. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/index.mjs +1 -0
  17. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/loader/index.mjs +188 -0
  18. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/utils/compose.mjs +13 -0
  19. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/utils/curry.mjs +19 -0
  20. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/utils/deepMerge.mjs +14 -0
  21. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/utils/isObject.mjs +5 -0
  22. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/utils/makeCancelable.mjs +20 -0
  23. package/es/node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/validators/index.mjs +49 -0
  24. package/es/node_modules/.pnpm/state-local@1.0.7/node_modules/state-local/lib/es/state-local.mjs +193 -0
  25. package/es/types/index.d.ts +0 -0
  26. package/es/vite-env.d.ts +1 -0
  27. package/package.json +61 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # 版本变更日志
2
+
3
+ 这个项目的所有关键变化都将记录在此文件中.
4
+
5
+ 此日志格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
6
+ 并且此项目遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.0.1] - 2025-01-07
11
+
12
+ ### Added
13
+
14
+ - 初始化项目.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 冠骋信息技术有限公司
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+
File without changes
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("vue"),D=require("@gct-paas/core");function M(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function O(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,r)}return t}function j(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?O(Object(t),!0).forEach(function(r){M(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):O(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function R(e,n){if(e==null)return{};var t={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(n.indexOf(o)>=0)&&(t[o]=e[o]);return t}function z(e,n){if(e==null)return{};var t=R(e,n),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}function N(e,n){return L(e)||F(e,n)||H(e,n)||U()}function L(e){if(Array.isArray(e))return e}function F(e,n){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var t=[],r=!0,o=!1,i=void 0;try{for(var a=e[Symbol.iterator](),u;!(r=(u=a.next()).done)&&(t.push(u.value),!(n&&t.length===n));r=!0);}catch(c){o=!0,i=c}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw i}}return t}}function H(e,n){if(e){if(typeof e=="string")return w(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return w(e,n)}}function w(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function U(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var x=require("../internals/export"),B=require("../internals/array-includes").includes,K=require("../internals/fails"),W=require("../internals/add-to-unscopables"),G=K(function(){return!Array(1).includes()});x({target:"Array",proto:!0,forced:G},{includes:function(n){return B(this,n,arguments.length>1?arguments[1]:void 0)}});W("includes");function V(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function P(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,r)}return t}function S(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?P(Object(t),!0).forEach(function(r){V(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):P(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function Y(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return function(r){return n.reduceRight(function(o,i){return i(o)},r)}}function l(e){return function n(){for(var t=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return n.apply(t,[].concat(o,u))}}}function m(e){return{}.toString.call(e).includes("Object")}function J(e){return!Object.keys(e).length}function s(e){return typeof e=="function"}function Q(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function X(e,n){return m(n)||f("changeType"),Object.keys(n).some(function(t){return!Q(e,t)})&&f("changeField"),n}function Z(e){s(e)||f("selectorType")}function _(e){s(e)||m(e)||f("handlerType"),m(e)&&Object.values(e).some(function(n){return!s(n)})&&f("handlersType")}function k(e){e||f("initialIsRequired"),m(e)||f("initialType"),J(e)&&f("initialContent")}function ee(e,n){throw new Error(e[n]||e.default)}var ne={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},f=l(ee)(ne),g={changes:X,selector:Z,handler:_,initial:k};function te(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};g.initial(e),g.handler(n);var t={current:e},r=l(ie)(t,n),o=l(oe)(t),i=l(g.changes)(e),a=l(re)(t);function u(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(C){return C};return g.selector(p),p(t.current)}function c(p){Y(r,o,i,a)(p)}return[u,c]}function re(e,n){return s(n)?n(e.current):n}function oe(e,n){return e.current=S(S({},e.current),n),n}function ie(e,n,t){return s(n)?n(e.current):Object.keys(t).forEach(function(r){var o;return(o=n[r])===null||o===void 0?void 0:o.call(n,e.current[r])}),t}var ae={create:te},ce={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function ue(e){return function n(){for(var t=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return n.apply(t,[].concat(o,u))}}}function fe(e){return{}.toString.call(e).includes("Object")}function le(e){return e||I("configIsRequired"),fe(e)||I("configType"),e.urls?(se(),{paths:{vs:e.urls.monacoBase}}):e}function se(){console.warn(E.deprecation)}function de(e,n){throw new Error(e[n]||e.default)}var E={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
+ You are using deprecated way of configuration.
4
+
5
+ Instead of using
6
+ monaco.config({ urls: { monacoBase: '...' } })
7
+ use
8
+ monaco.config({ paths: { vs: '...' } })
9
+
10
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
11
+ `},I=ue(de)(E),pe={config:le},ve=function(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];return function(o){return t.reduceRight(function(i,a){return a(i)},o)}};function T(e,n){return Object.keys(n).forEach(function(t){n[t]instanceof Object&&e[t]&&Object.assign(n[t],T(e[t],n[t]))}),j(j({},e),n)}var ge={type:"cancelation",msg:"operation is manually canceled"};function b(e){var n=!1,t=new Promise(function(r,o){e.then(function(i){return n?o(ge):r(i)}),e.catch(o)});return t.cancel=function(){return n=!0},t}var me=ae.create({config:ce,isInitialized:!1,resolve:null,reject:null,monaco:null}),$=N(me,2),d=$[0],h=$[1];function he(e){var n=pe.config(e),t=n.monaco,r=z(n,["monaco"]);h(function(o){return{config:T(o.config,r),monaco:t}})}function be(){var e=d(function(n){var t=n.monaco,r=n.isInitialized,o=n.resolve;return{monaco:t,isInitialized:r,resolve:o}});if(!e.isInitialized){if(h({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),b(y);if(window.monaco&&window.monaco.editor)return q(window.monaco),e.resolve(window.monaco),b(y);ve(ye,je)(we)}return b(y)}function ye(e){return document.body.appendChild(e)}function Oe(e){var n=document.createElement("script");return e&&(n.src=e),n}function je(e){var n=d(function(r){var o=r.config,i=r.reject;return{config:o,reject:i}}),t=Oe("".concat(n.config.paths.vs,"/loader.js"));return t.onload=function(){return e()},t.onerror=n.reject,t}function we(){var e=d(function(t){var r=t.config,o=t.resolve,i=t.reject;return{config:r,resolve:o,reject:i}}),n=window.require;n.config(e.config),n(["vs/editor/editor.main"],function(t){q(t),e.resolve(t)},function(t){e.reject(t)})}function q(e){d().monaco||h({monaco:e})}function Pe(){return d(function(e){var n=e.monaco;return n})}var y=new Promise(function(e,n){return h({resolve:e,reject:n})}),Se={config:he,init:be,__getMonacoInstance:Pe};const A=v.defineComponent({name:"CodeEditor",setup(){const e=D.useNamespace("code-editor"),n=v.ref(null);return v.onMounted(()=>{Se.init().then(t=>{n.value&&t.editor.create(n.value,{value:"// some comment",language:"javascript"})})}),{ns:e}},render(){return v.createVNode("div",{class:this.ns.b()},null)}}),Ie={install(e){e.component(A.name,A)}};exports.default=Ie;
@@ -0,0 +1,11 @@
1
+ System.register(["vue","@gct-paas/core"],function(z,$e){"use strict";var O,j,w,P,S;return{setters:[f=>{O=f.defineComponent,j=f.createVNode,w=f.ref,P=f.onMounted},f=>{S=f.useNamespace}],execute:function(){function f(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function I(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,r)}return t}function A(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?I(Object(t),!0).forEach(function(r){f(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):I(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function x(e,n){if(e==null)return{};var t={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(n.indexOf(o)>=0)&&(t[o]=e[o]);return t}function L(e,n){if(e==null)return{};var t=x(e,n),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}function F(e,n){return H(e)||U(e,n)||B(e,n)||K()}function H(e){if(Array.isArray(e))return e}function U(e,n){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var t=[],r=!0,o=!1,i=void 0;try{for(var a=e[Symbol.iterator](),u;!(r=(u=a.next()).done)&&(t.push(u.value),!(n&&t.length===n));r=!0);}catch(c){o=!0,i=c}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw i}}return t}}function B(e,n){if(e){if(typeof e=="string")return E(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return E(e,n)}}function E(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function K(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var W=require("../internals/export"),V=require("../internals/array-includes").includes,G=require("../internals/fails"),Y=require("../internals/add-to-unscopables"),J=G(function(){return!Array(1).includes()});W({target:"Array",proto:!0,forced:J},{includes:function(n){return V(this,n,arguments.length>1?arguments[1]:void 0)}}),Y("includes");function Q(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function T(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,r)}return t}function $(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?T(Object(t),!0).forEach(function(r){Q(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):T(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function X(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return function(r){return n.reduceRight(function(o,i){return i(o)},r)}}function l(e){return function n(){for(var t=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return n.apply(t,[].concat(o,u))}}}function v(e){return{}.toString.call(e).includes("Object")}function Z(e){return!Object.keys(e).length}function d(e){return typeof e=="function"}function _(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function k(e,n){return v(n)||s("changeType"),Object.keys(n).some(function(t){return!_(e,t)})&&s("changeField"),n}function ee(e){d(e)||s("selectorType")}function ne(e){d(e)||v(e)||s("handlerType"),v(e)&&Object.values(e).some(function(n){return!d(n)})&&s("handlersType")}function te(e){e||s("initialIsRequired"),v(e)||s("initialType"),Z(e)&&s("initialContent")}function re(e,n){throw new Error(e[n]||e.default)}var oe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},s=l(re)(oe),g={changes:k,selector:ee,handler:ne,initial:te};function ie(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};g.initial(e),g.handler(n);var t={current:e},r=l(ue)(t,n),o=l(ce)(t),i=l(g.changes)(e),a=l(ae)(t);function u(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(Te){return Te};return g.selector(h),h(t.current)}function c(h){X(r,o,i,a)(h)}return[u,c]}function ae(e,n){return d(n)?n(e.current):n}function ce(e,n){return e.current=$($({},e.current),n),n}function ue(e,n,t){return d(n)?n(e.current):Object.keys(t).forEach(function(r){var o;return(o=n[r])===null||o===void 0?void 0:o.call(n,e.current[r])}),t}var fe={create:ie},se={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function le(e){return function n(){for(var t=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];return n.apply(t,[].concat(o,u))}}}function de(e){return{}.toString.call(e).includes("Object")}function pe(e){return e||q("configIsRequired"),de(e)||q("configType"),e.urls?(ve(),{paths:{vs:e.urls.monacoBase}}):e}function ve(){console.warn(C.deprecation)}function ge(e,n){throw new Error(e[n]||e.default)}var C={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
+ You are using deprecated way of configuration.
4
+
5
+ Instead of using
6
+ monaco.config({ urls: { monacoBase: '...' } })
7
+ use
8
+ monaco.config({ paths: { vs: '...' } })
9
+
10
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
11
+ `},q=le(ge)(C),me={config:pe},he=function(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];return function(o){return t.reduceRight(function(i,a){return a(i)},o)}};function D(e,n){return Object.keys(n).forEach(function(t){n[t]instanceof Object&&e[t]&&Object.assign(n[t],D(e[t],n[t]))}),A(A({},e),n)}var be={type:"cancelation",msg:"operation is manually canceled"};function b(e){var n=!1,t=new Promise(function(r,o){e.then(function(i){return n?o(be):r(i)}),e.catch(o)});return t.cancel=function(){return n=!0},t}var ye=fe.create({config:se,isInitialized:!1,resolve:null,reject:null,monaco:null}),R=F(ye,2),p=R[0],m=R[1];function Oe(e){var n=me.config(e),t=n.monaco,r=L(n,["monaco"]);m(function(o){return{config:D(o.config,r),monaco:t}})}function je(){var e=p(function(n){var t=n.monaco,r=n.isInitialized,o=n.resolve;return{monaco:t,isInitialized:r,resolve:o}});if(!e.isInitialized){if(m({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),b(y);if(window.monaco&&window.monaco.editor)return M(window.monaco),e.resolve(window.monaco),b(y);he(we,Se)(Ie)}return b(y)}function we(e){return document.body.appendChild(e)}function Pe(e){var n=document.createElement("script");return e&&(n.src=e),n}function Se(e){var n=p(function(r){var o=r.config,i=r.reject;return{config:o,reject:i}}),t=Pe("".concat(n.config.paths.vs,"/loader.js"));return t.onload=function(){return e()},t.onerror=n.reject,t}function Ie(){var e=p(function(t){var r=t.config,o=t.resolve,i=t.reject;return{config:r,resolve:o,reject:i}}),n=window.require;n.config(e.config),n(["vs/editor/editor.main"],function(t){M(t),e.resolve(t)},function(t){e.reject(t)})}function M(e){p().monaco||m({monaco:e})}function Ae(){return p(function(e){var n=e.monaco;return n})}var y=new Promise(function(e,n){return m({resolve:e,reject:n})}),Ee={config:Oe,init:je,__getMonacoInstance:Ae};const N=O({name:"CodeEditor",setup(){const e=S("code-editor"),n=w(null);return P(()=>{Ee.init().then(t=>{n.value&&t.editor.create(n.value,{value:"// some comment",language:"javascript"})})}),{ns:e}},render(){return j("div",{class:this.ns.b()},null)}}),Ce=z("default",{install(e){e.component(N.name,N)}})}}});
@@ -0,0 +1,3 @@
1
+ export declare const CodeEditor: import('vue').DefineComponent<{}, {
2
+ ns: import('@gct-paas/core').Namespace;
3
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,34 @@
1
+ import { defineComponent, createVNode, ref, onMounted } from 'vue';
2
+ import { useNamespace } from '@gct-paas/core';
3
+ import '../../node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/index.mjs';
4
+ import './code-editor.scss';
5
+ import loader from '../../node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/loader/index.mjs';
6
+
7
+ "use strict";
8
+ const CodeEditor = /* @__PURE__ */ defineComponent({
9
+ name: "CodeEditor",
10
+ setup() {
11
+ const ns = useNamespace("code-editor");
12
+ const el = ref(null);
13
+ onMounted(() => {
14
+ loader.init().then((m) => {
15
+ if (el.value) {
16
+ m.editor.create(el.value, {
17
+ value: "// some comment",
18
+ language: "javascript"
19
+ });
20
+ }
21
+ });
22
+ });
23
+ return {
24
+ ns
25
+ };
26
+ },
27
+ render() {
28
+ return createVNode("div", {
29
+ "class": this.ns.b()
30
+ }, null);
31
+ }
32
+ });
33
+
34
+ export { CodeEditor };
@@ -0,0 +1,3 @@
1
+ @include b(code-editor) {
2
+ // todo
3
+ }
@@ -0,0 +1 @@
1
+ export { CodeEditor } from './code-editor/code-editor';
@@ -0,0 +1,3 @@
1
+ export { CodeEditor } from './code-editor/code-editor.mjs';
2
+
3
+ "use strict";
package/es/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { App } from 'vue';
2
+ declare const _default: {
3
+ install(app: App): void;
4
+ };
5
+ export default _default;
package/es/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import './components/index.mjs';
2
+ import { CodeEditor } from './components/code-editor/code-editor.mjs';
3
+
4
+ "use strict";
5
+ var index = {
6
+ install(app) {
7
+ app.component(CodeEditor.name, CodeEditor);
8
+ }
9
+ };
10
+
11
+ export { index as default };
@@ -0,0 +1,142 @@
1
+ function _defineProperty(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+
13
+ return obj;
14
+ }
15
+
16
+ function ownKeys(object, enumerableOnly) {
17
+ var keys = Object.keys(object);
18
+
19
+ if (Object.getOwnPropertySymbols) {
20
+ var symbols = Object.getOwnPropertySymbols(object);
21
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
22
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
23
+ });
24
+ keys.push.apply(keys, symbols);
25
+ }
26
+
27
+ return keys;
28
+ }
29
+
30
+ function _objectSpread2(target) {
31
+ for (var i = 1; i < arguments.length; i++) {
32
+ var source = arguments[i] != null ? arguments[i] : {};
33
+
34
+ if (i % 2) {
35
+ ownKeys(Object(source), true).forEach(function (key) {
36
+ _defineProperty(target, key, source[key]);
37
+ });
38
+ } else if (Object.getOwnPropertyDescriptors) {
39
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
40
+ } else {
41
+ ownKeys(Object(source)).forEach(function (key) {
42
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
43
+ });
44
+ }
45
+ }
46
+
47
+ return target;
48
+ }
49
+
50
+ function _objectWithoutPropertiesLoose(source, excluded) {
51
+ if (source == null) return {};
52
+ var target = {};
53
+ var sourceKeys = Object.keys(source);
54
+ var key, i;
55
+
56
+ for (i = 0; i < sourceKeys.length; i++) {
57
+ key = sourceKeys[i];
58
+ if (excluded.indexOf(key) >= 0) continue;
59
+ target[key] = source[key];
60
+ }
61
+
62
+ return target;
63
+ }
64
+
65
+ function _objectWithoutProperties(source, excluded) {
66
+ if (source == null) return {};
67
+
68
+ var target = _objectWithoutPropertiesLoose(source, excluded);
69
+
70
+ var key, i;
71
+
72
+ if (Object.getOwnPropertySymbols) {
73
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
74
+
75
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
76
+ key = sourceSymbolKeys[i];
77
+ if (excluded.indexOf(key) >= 0) continue;
78
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
79
+ target[key] = source[key];
80
+ }
81
+ }
82
+
83
+ return target;
84
+ }
85
+
86
+ function _slicedToArray(arr, i) {
87
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
88
+ }
89
+
90
+ function _arrayWithHoles(arr) {
91
+ if (Array.isArray(arr)) return arr;
92
+ }
93
+
94
+ function _iterableToArrayLimit(arr, i) {
95
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
96
+ var _arr = [];
97
+ var _n = true;
98
+ var _d = false;
99
+ var _e = undefined;
100
+
101
+ try {
102
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
103
+ _arr.push(_s.value);
104
+
105
+ if (i && _arr.length === i) break;
106
+ }
107
+ } catch (err) {
108
+ _d = true;
109
+ _e = err;
110
+ } finally {
111
+ try {
112
+ if (!_n && _i["return"] != null) _i["return"]();
113
+ } finally {
114
+ if (_d) throw _e;
115
+ }
116
+ }
117
+
118
+ return _arr;
119
+ }
120
+
121
+ function _unsupportedIterableToArray(o, minLen) {
122
+ if (!o) return;
123
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
124
+ var n = Object.prototype.toString.call(o).slice(8, -1);
125
+ if (n === "Object" && o.constructor) n = o.constructor.name;
126
+ if (n === "Map" || n === "Set") return Array.from(o);
127
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
128
+ }
129
+
130
+ function _arrayLikeToArray(arr, len) {
131
+ if (len == null || len > arr.length) len = arr.length;
132
+
133
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
134
+
135
+ return arr2;
136
+ }
137
+
138
+ function _nonIterableRest() {
139
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
140
+ }
141
+
142
+ export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _defineProperty as defineProperty, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _objectSpread2 as objectSpread2, _objectWithoutProperties as objectWithoutProperties, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose, _slicedToArray as slicedToArray, _unsupportedIterableToArray as unsupportedIterableToArray };
@@ -0,0 +1,7 @@
1
+ var config = {
2
+ paths: {
3
+ vs: 'https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs'
4
+ }
5
+ };
6
+
7
+ export { config as default };
@@ -0,0 +1 @@
1
+ export { default } from './loader/index.mjs';
@@ -0,0 +1,188 @@
1
+ import { slicedToArray as _slicedToArray, objectWithoutProperties as _objectWithoutProperties } from '../_virtual/_rollupPluginBabelHelpers.mjs';
2
+ import index from '../../../../../../../state-local@1.0.7/node_modules/state-local/lib/es/state-local.mjs';
3
+ import config$1 from '../config/index.mjs';
4
+ import validators from '../validators/index.mjs';
5
+ import compose from '../utils/compose.mjs';
6
+ import merge from '../utils/deepMerge.mjs';
7
+ import makeCancelable from '../utils/makeCancelable.mjs';
8
+
9
+ /** the local state of the module */
10
+
11
+ var _state$create = index.create({
12
+ config: config$1,
13
+ isInitialized: false,
14
+ resolve: null,
15
+ reject: null,
16
+ monaco: null
17
+ }),
18
+ _state$create2 = _slicedToArray(_state$create, 2),
19
+ getState = _state$create2[0],
20
+ setState = _state$create2[1];
21
+ /**
22
+ * set the loader configuration
23
+ * @param {Object} config - the configuration object
24
+ */
25
+
26
+
27
+ function config(globalConfig) {
28
+ var _validators$config = validators.config(globalConfig),
29
+ monaco = _validators$config.monaco,
30
+ config = _objectWithoutProperties(_validators$config, ["monaco"]);
31
+
32
+ setState(function (state) {
33
+ return {
34
+ config: merge(state.config, config),
35
+ monaco: monaco
36
+ };
37
+ });
38
+ }
39
+ /**
40
+ * handles the initialization of the monaco-editor
41
+ * @return {Promise} - returns an instance of monaco (with a cancelable promise)
42
+ */
43
+
44
+
45
+ function init() {
46
+ var state = getState(function (_ref) {
47
+ var monaco = _ref.monaco,
48
+ isInitialized = _ref.isInitialized,
49
+ resolve = _ref.resolve;
50
+ return {
51
+ monaco: monaco,
52
+ isInitialized: isInitialized,
53
+ resolve: resolve
54
+ };
55
+ });
56
+
57
+ if (!state.isInitialized) {
58
+ setState({
59
+ isInitialized: true
60
+ });
61
+
62
+ if (state.monaco) {
63
+ state.resolve(state.monaco);
64
+ return makeCancelable(wrapperPromise);
65
+ }
66
+
67
+ if (window.monaco && window.monaco.editor) {
68
+ storeMonacoInstance(window.monaco);
69
+ state.resolve(window.monaco);
70
+ return makeCancelable(wrapperPromise);
71
+ }
72
+
73
+ compose(injectScripts, getMonacoLoaderScript)(configureLoader);
74
+ }
75
+
76
+ return makeCancelable(wrapperPromise);
77
+ }
78
+ /**
79
+ * injects provided scripts into the document.body
80
+ * @param {Object} script - an HTML script element
81
+ * @return {Object} - the injected HTML script element
82
+ */
83
+
84
+
85
+ function injectScripts(script) {
86
+ return document.body.appendChild(script);
87
+ }
88
+ /**
89
+ * creates an HTML script element with/without provided src
90
+ * @param {string} [src] - the source path of the script
91
+ * @return {Object} - the created HTML script element
92
+ */
93
+
94
+
95
+ function createScript(src) {
96
+ var script = document.createElement('script');
97
+ return src && (script.src = src), script;
98
+ }
99
+ /**
100
+ * creates an HTML script element with the monaco loader src
101
+ * @return {Object} - the created HTML script element
102
+ */
103
+
104
+
105
+ function getMonacoLoaderScript(configureLoader) {
106
+ var state = getState(function (_ref2) {
107
+ var config = _ref2.config,
108
+ reject = _ref2.reject;
109
+ return {
110
+ config: config,
111
+ reject: reject
112
+ };
113
+ });
114
+ var loaderScript = createScript("".concat(state.config.paths.vs, "/loader.js"));
115
+
116
+ loaderScript.onload = function () {
117
+ return configureLoader();
118
+ };
119
+
120
+ loaderScript.onerror = state.reject;
121
+ return loaderScript;
122
+ }
123
+ /**
124
+ * configures the monaco loader
125
+ */
126
+
127
+
128
+ function configureLoader() {
129
+ var state = getState(function (_ref3) {
130
+ var config = _ref3.config,
131
+ resolve = _ref3.resolve,
132
+ reject = _ref3.reject;
133
+ return {
134
+ config: config,
135
+ resolve: resolve,
136
+ reject: reject
137
+ };
138
+ });
139
+ var require = window.require;
140
+
141
+ require.config(state.config);
142
+
143
+ require(['vs/editor/editor.main'], function (monaco) {
144
+ storeMonacoInstance(monaco);
145
+ state.resolve(monaco);
146
+ }, function (error) {
147
+ state.reject(error);
148
+ });
149
+ }
150
+ /**
151
+ * store monaco instance in local state
152
+ */
153
+
154
+
155
+ function storeMonacoInstance(monaco) {
156
+ if (!getState().monaco) {
157
+ setState({
158
+ monaco: monaco
159
+ });
160
+ }
161
+ }
162
+ /**
163
+ * internal helper function
164
+ * extracts stored monaco instance
165
+ * @return {Object|null} - the monaco instance
166
+ */
167
+
168
+
169
+ function __getMonacoInstance() {
170
+ return getState(function (_ref4) {
171
+ var monaco = _ref4.monaco;
172
+ return monaco;
173
+ });
174
+ }
175
+
176
+ var wrapperPromise = new Promise(function (resolve, reject) {
177
+ return setState({
178
+ resolve: resolve,
179
+ reject: reject
180
+ });
181
+ });
182
+ var loader = {
183
+ config: config,
184
+ init: init,
185
+ __getMonacoInstance: __getMonacoInstance
186
+ };
187
+
188
+ export { loader as default };
@@ -0,0 +1,13 @@
1
+ var compose = function compose() {
2
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
3
+ fns[_key] = arguments[_key];
4
+ }
5
+
6
+ return function (x) {
7
+ return fns.reduceRight(function (y, f) {
8
+ return f(y);
9
+ }, x);
10
+ };
11
+ };
12
+
13
+ export { compose as default };
@@ -0,0 +1,19 @@
1
+ function curry(fn) {
2
+ return function curried() {
3
+ var _this = this;
4
+
5
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6
+ args[_key] = arguments[_key];
7
+ }
8
+
9
+ return args.length >= fn.length ? fn.apply(this, args) : function () {
10
+ for (var _len2 = arguments.length, nextArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
11
+ nextArgs[_key2] = arguments[_key2];
12
+ }
13
+
14
+ return curried.apply(_this, [].concat(args, nextArgs));
15
+ };
16
+ };
17
+ }
18
+
19
+ export { curry as default };
@@ -0,0 +1,14 @@
1
+ import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.mjs';
2
+
3
+ function merge(target, source) {
4
+ Object.keys(source).forEach(function (key) {
5
+ if (source[key] instanceof Object) {
6
+ if (target[key]) {
7
+ Object.assign(source[key], merge(target[key], source[key]));
8
+ }
9
+ }
10
+ });
11
+ return _objectSpread2(_objectSpread2({}, target), source);
12
+ }
13
+
14
+ export { merge as default };
@@ -0,0 +1,5 @@
1
+ function isObject(value) {
2
+ return {}.toString.call(value).includes('Object');
3
+ }
4
+
5
+ export { isObject as default };
@@ -0,0 +1,20 @@
1
+ // The source (has been changed) is https://github.com/facebook/react/issues/5465#issuecomment-157888325
2
+ var CANCELATION_MESSAGE = {
3
+ type: 'cancelation',
4
+ msg: 'operation is manually canceled'
5
+ };
6
+
7
+ function makeCancelable(promise) {
8
+ var hasCanceled_ = false;
9
+ var wrappedPromise = new Promise(function (resolve, reject) {
10
+ promise.then(function (val) {
11
+ return hasCanceled_ ? reject(CANCELATION_MESSAGE) : resolve(val);
12
+ });
13
+ promise["catch"](reject);
14
+ });
15
+ return wrappedPromise.cancel = function () {
16
+ return hasCanceled_ = true;
17
+ }, wrappedPromise;
18
+ }
19
+
20
+ export { CANCELATION_MESSAGE, makeCancelable as default };
@@ -0,0 +1,49 @@
1
+ import curry from '../utils/curry.mjs';
2
+ import isObject from '../utils/isObject.mjs';
3
+
4
+ /**
5
+ * validates the configuration object and informs about deprecation
6
+ * @param {Object} config - the configuration object
7
+ * @return {Object} config - the validated configuration object
8
+ */
9
+
10
+ function validateConfig(config) {
11
+ if (!config) errorHandler('configIsRequired');
12
+ if (!isObject(config)) errorHandler('configType');
13
+
14
+ if (config.urls) {
15
+ informAboutDeprecation();
16
+ return {
17
+ paths: {
18
+ vs: config.urls.monacoBase
19
+ }
20
+ };
21
+ }
22
+
23
+ return config;
24
+ }
25
+ /**
26
+ * logs deprecation message
27
+ */
28
+
29
+
30
+ function informAboutDeprecation() {
31
+ console.warn(errorMessages.deprecation);
32
+ }
33
+
34
+ function throwError(errorMessages, type) {
35
+ throw new Error(errorMessages[type] || errorMessages["default"]);
36
+ }
37
+
38
+ var errorMessages = {
39
+ configIsRequired: 'the configuration object is required',
40
+ configType: 'the configuration object should be an object',
41
+ "default": 'an unknown error accured in `@monaco-editor/loader` package',
42
+ deprecation: "Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "
43
+ };
44
+ var errorHandler = curry(throwError)(errorMessages);
45
+ var validators = {
46
+ config: validateConfig
47
+ };
48
+
49
+ export { validators as default, errorHandler, errorMessages };
@@ -0,0 +1,193 @@
1
+ function _defineProperty(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+
13
+ return obj;
14
+ }
15
+
16
+ function ownKeys(object, enumerableOnly) {
17
+ var keys = Object.keys(object);
18
+
19
+ if (Object.getOwnPropertySymbols) {
20
+ var symbols = Object.getOwnPropertySymbols(object);
21
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
22
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
23
+ });
24
+ keys.push.apply(keys, symbols);
25
+ }
26
+
27
+ return keys;
28
+ }
29
+
30
+ function _objectSpread2(target) {
31
+ for (var i = 1; i < arguments.length; i++) {
32
+ var source = arguments[i] != null ? arguments[i] : {};
33
+
34
+ if (i % 2) {
35
+ ownKeys(Object(source), true).forEach(function (key) {
36
+ _defineProperty(target, key, source[key]);
37
+ });
38
+ } else if (Object.getOwnPropertyDescriptors) {
39
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
40
+ } else {
41
+ ownKeys(Object(source)).forEach(function (key) {
42
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
43
+ });
44
+ }
45
+ }
46
+
47
+ return target;
48
+ }
49
+
50
+ function compose() {
51
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
52
+ fns[_key] = arguments[_key];
53
+ }
54
+
55
+ return function (x) {
56
+ return fns.reduceRight(function (y, f) {
57
+ return f(y);
58
+ }, x);
59
+ };
60
+ }
61
+
62
+ function curry(fn) {
63
+ return function curried() {
64
+ var _this = this;
65
+
66
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
67
+ args[_key2] = arguments[_key2];
68
+ }
69
+
70
+ return args.length >= fn.length ? fn.apply(this, args) : function () {
71
+ for (var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
72
+ nextArgs[_key3] = arguments[_key3];
73
+ }
74
+
75
+ return curried.apply(_this, [].concat(args, nextArgs));
76
+ };
77
+ };
78
+ }
79
+
80
+ function isObject(value) {
81
+ return {}.toString.call(value).includes('Object');
82
+ }
83
+
84
+ function isEmpty(obj) {
85
+ return !Object.keys(obj).length;
86
+ }
87
+
88
+ function isFunction(value) {
89
+ return typeof value === 'function';
90
+ }
91
+
92
+ function hasOwnProperty(object, property) {
93
+ return Object.prototype.hasOwnProperty.call(object, property);
94
+ }
95
+
96
+ function validateChanges(initial, changes) {
97
+ if (!isObject(changes)) errorHandler('changeType');
98
+ if (Object.keys(changes).some(function (field) {
99
+ return !hasOwnProperty(initial, field);
100
+ })) errorHandler('changeField');
101
+ return changes;
102
+ }
103
+
104
+ function validateSelector(selector) {
105
+ if (!isFunction(selector)) errorHandler('selectorType');
106
+ }
107
+
108
+ function validateHandler(handler) {
109
+ if (!(isFunction(handler) || isObject(handler))) errorHandler('handlerType');
110
+ if (isObject(handler) && Object.values(handler).some(function (_handler) {
111
+ return !isFunction(_handler);
112
+ })) errorHandler('handlersType');
113
+ }
114
+
115
+ function validateInitial(initial) {
116
+ if (!initial) errorHandler('initialIsRequired');
117
+ if (!isObject(initial)) errorHandler('initialType');
118
+ if (isEmpty(initial)) errorHandler('initialContent');
119
+ }
120
+
121
+ function throwError(errorMessages, type) {
122
+ throw new Error(errorMessages[type] || errorMessages["default"]);
123
+ }
124
+
125
+ var errorMessages = {
126
+ initialIsRequired: 'initial state is required',
127
+ initialType: 'initial state should be an object',
128
+ initialContent: 'initial state shouldn\'t be an empty object',
129
+ handlerType: 'handler should be an object or a function',
130
+ handlersType: 'all handlers should be a functions',
131
+ selectorType: 'selector should be a function',
132
+ changeType: 'provided value of changes should be an object',
133
+ changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
134
+ "default": 'an unknown error accured in `state-local` package'
135
+ };
136
+ var errorHandler = curry(throwError)(errorMessages);
137
+ var validators = {
138
+ changes: validateChanges,
139
+ selector: validateSelector,
140
+ handler: validateHandler,
141
+ initial: validateInitial
142
+ };
143
+
144
+ function create(initial) {
145
+ var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
146
+ validators.initial(initial);
147
+ validators.handler(handler);
148
+ var state = {
149
+ current: initial
150
+ };
151
+ var didUpdate = curry(didStateUpdate)(state, handler);
152
+ var update = curry(updateState)(state);
153
+ var validate = curry(validators.changes)(initial);
154
+ var getChanges = curry(extractChanges)(state);
155
+
156
+ function getState() {
157
+ var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (state) {
158
+ return state;
159
+ };
160
+ validators.selector(selector);
161
+ return selector(state.current);
162
+ }
163
+
164
+ function setState(causedChanges) {
165
+ compose(didUpdate, update, validate, getChanges)(causedChanges);
166
+ }
167
+
168
+ return [getState, setState];
169
+ }
170
+
171
+ function extractChanges(state, causedChanges) {
172
+ return isFunction(causedChanges) ? causedChanges(state.current) : causedChanges;
173
+ }
174
+
175
+ function updateState(state, changes) {
176
+ state.current = _objectSpread2(_objectSpread2({}, state.current), changes);
177
+ return changes;
178
+ }
179
+
180
+ function didStateUpdate(state, handler, changes) {
181
+ isFunction(handler) ? handler(state.current) : Object.keys(changes).forEach(function (field) {
182
+ var _handler$field;
183
+
184
+ return (_handler$field = handler[field]) === null || _handler$field === void 0 ? void 0 : _handler$field.call(handler, state.current[field]);
185
+ });
186
+ return changes;
187
+ }
188
+
189
+ var index = {
190
+ create: create
191
+ };
192
+
193
+ export { index as default };
File without changes
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@gct-paas/core-web",
3
+ "version": "0.0.1-dev.12",
4
+ "type": "module",
5
+ "description": "paas 平台网页端核心包",
6
+ "main": "dist/index.min.cjs",
7
+ "module": "es/index.mjs",
8
+ "types": "es/index.d.ts",
9
+ "system": "dist/index.system.min.js",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./es/index.d.ts",
13
+ "import": "./es/index.mjs",
14
+ "require": "./dist/index.min.cjs"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "es",
20
+ "CHANGELOG.md",
21
+ "README.md"
22
+ ],
23
+ "keywords": [
24
+ "paas",
25
+ "gct"
26
+ ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://git.gct-china.com/paas/frontend/paas-package.git"
30
+ },
31
+ "license": "MIT",
32
+ "author": "gct",
33
+ "scripts": {
34
+ "dev": "rollup -c -w --environment=NODE_ENV:development",
35
+ "build": "npm run lint && rollup -c --environment=NODE_ENV:production && vite build --mode production --config vite.config.ts",
36
+ "lint": "eslint src/",
37
+ "publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
38
+ "publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
39
+ "publish:alpha": "npm run build && npm publish --access public --tag=alpha --registry=https://registry.npmjs.org/",
40
+ "publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
41
+ "publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/",
42
+ "gen-api": "npm run gen-api:apaas && npm run gen-api:platform",
43
+ "gen-api:apaas": "gct-paas gen-api --url=http://paas.paasdev.gct-paas.com --tag=apaas -t ../cli/hbs-temp -o ./src/service/gct-apaas && prettier './src/service/gct-apaas' --write",
44
+ "gen-api:platform": "gct-paas gen-api --url=http://paas.paasdev.gct-paas.com --tag=platform -t ../cli/hbs-temp -o ./src/service/gct-platform && prettier './src/service/gct-platform' --write"
45
+ },
46
+ "dependencies": {
47
+ "@gct-paas/core": "0.0.1-dev.12",
48
+ "@monaco-editor/loader": "^1.5.0",
49
+ "monaco-editor": "^0.52.2",
50
+ "vue": "^3.5.13"
51
+ },
52
+ "devDependencies": {
53
+ "@gct-paas/build": "0.0.1-dev.12",
54
+ "@gct-paas/scss": "workspace:*",
55
+ "sass": "^1.84.0"
56
+ },
57
+ "peerDependencies": {
58
+ "vue": "^3.x"
59
+ },
60
+ "gitHead": "b8e3713e94a27f7df471dae92fbc7ee050a7b4d5"
61
+ }