diff --git a/.github/workflows/publish-demo.yml b/.github/workflows/publish-demo.yml deleted file mode 100644 index 306ca01..0000000 --- a/.github/workflows/publish-demo.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Publish Demo -on: - push: - branches: - - main -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: '16' - cache: 'npm' - - run: npm ci - - run: npm run build - - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml deleted file mode 100644 index ed1e7b1..0000000 --- a/.github/workflows/publish-package.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Publish Package - -on: - release: - types: [published] - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: '16' - cache: 'npm' - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} - - - uses: actions/setup-node@v2 - with: - node-version: '16' - cache: 'npm' - registry-url: https://npm.pkg.github.com/ - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6cfd8ed..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -*.log -node_modules/ -dist/ diff --git a/.node-version b/.node-version deleted file mode 100644 index 53a4221..0000000 --- a/.node-version +++ /dev/null @@ -1 +0,0 @@ -v16.13.2 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 2681aa1..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Keldan Chapman - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 099d07b..0000000 --- a/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# codemirror-lambda-calculus - -Lambda Calculus mode for CodeMirror. - -- `defineMode(CodeMirror)`: Define `lambdacalc` mode and MIME `text/x-lambdacalc` - -## Usage - -```javascript -import CodeMirror from "codemirror"; - -import { defineMode } from "@codewars/codemirror-lambda-calculus"; - -defineMode(CodeMirror); -``` - -## Demo - -See https://codewars.github.io/codemirror-lambda-calculus/ - -## Development - -Run `npm run dev` to start a local dev server. diff --git a/assets/index.17b3fabc.js b/assets/index.17b3fabc.js new file mode 100644 index 0000000..a6599d0 --- /dev/null +++ b/assets/index.17b3fabc.js @@ -0,0 +1,3 @@ +import{createApp as U}from"https://unpkg.com/petite-vue@0.4.1?module";import*as I from"https://unpkg.com/@codewars/lambda-calculus";const z=function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))u(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&u(l)}).observe(document,{childList:!0,subtree:!0});function f(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerpolicy&&(o.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?o.credentials="include":r.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function u(r){if(r.ep)return;r.ep=!0;const o=f(r);fetch(r.href,o)}};z();const q=function(i){i.defineMode("lambdacalc",function(c,f){const u="variable-2",r="text",o="bracket",l="keyword",b=l,g="text",y="text",E="def",x="atom",A="number",L="text",v="error",C="variable-3",S="text",s="error",h=/[a-zA-Z][-'\w]*\??/,k=/=/,M=/\(|\)/,O=/[_a-zA-Z][-'\w]*\??|\./,N=/-?\d+/;function D(e,n){return e.match(/.*=/,!1)?a(e,n):p(e,n)}function a(e,n){const t=(e.match(h)||[])[0];if(n.f=P,!t||!e.match(/\s*=/,!1))return null;const d=[];return n.defined.includes(t)&&d.push(C),n.defined.push(t),d.push(u),d.join(" ")}function P(e,n){return e.match(k)?(n.f=p,r):null}function p(e,n){return T(e,n)||w(e,n)||B(e,n)||F(e)}function T(e,n){const t=e.eat(M);if(!t)return null;if(t=="("&&e.peek()==")")return e.next(),L;if(t=="(")n.depth.push(e.column()+e.indentation()),n.bound.push([]);else{if(!(n.depth.length&&n.bound.length))return s;n.depth.pop(),n.bound.pop()}return n.f=p,o}function w(e,n){return e.eat("\\")?(n.f=R,l):null}function B(e,n){const t=(e.match(h)||[])[0];return t?n.bound.some(d=>d.includes(t))?y:n.defined.includes(t)?g:v:null}function F(e,n){return(e.match(N)||[])[0]&&(/\s|\)/.test(e.peek())||e.eol())?A:null}function R(e,n){const t=(e.match(O)||[])[0];return t?t==="."?(n.f=p,b):t[0]==="_"?x:(n.bound[n.bound.length-1].push(t),E):null}function _(e,n){return e.match(/[^\s#]*/),s}return{startState:function(){return{f:a,depth:[],defined:[],bound:[[]],debug:!1}},copyState:function(e){return{f:e.f,depth:[...e.depth],defined:[...e.defined],bound:e.bound.map(n=>[...n]),debug:e.debug}},token:function(e,n){if(e.eat(/\t/))return s;if(/[ \n]/.test(e.peek())){e.eatWhile(/[ \n]/);return}if(e.peek()==="#")return e.match(/^#debug/)&&(n.debug=!n.debug),e.skipToEnd(),"comment";e.sol()&&n.depth.length===0&&(n.bound=[[]],n.f=a);const t=n.f(e,n)||(n.debug?null:D(e,n))||_(e);return!n.debug&&t==s?S:t},indent:function(e,n){return e.depth.length?e.depth[e.depth.length-1]+2:0},lineComment:"#"}}),i.defineMIME("text/x-lambdacalc","lambdacalc")};q(CodeMirror);const m=CodeMirror.fromTextArea(document.getElementById("code"),{mode:"lambdacalc",lineNumbers:!0,matchBrackets:!0,theme:"codewars",specialChars:/\\/,specialCharPlaceholder:()=>{const i=document.createElement("span");return i.setAttribute("cm-text","\\"),i.innerHTML="\u03BB",i}});m.setSize(500,400);const H=i=>i.replace(/\\/g,"\u03BB");U({purity:"Let",purityOptions:["Let","LetRec","PureLC"],verbosity:"Calm",verbosityOptions:["Calm","Concise","Loquacious","Verbose"],numEncoding:"Church",numEncodingOptions:["None","Church","Scott","BinaryScott"],evaluation:"not false",result:"",error:"",evaluate(){this.result="",this.error="";const i=m.getValue(),c=this.evaluation,f=I.compileWith({purity:this.purity,verbosity:this.verbosity,numEncoding:this.numEncoding});try{const{result:u}=f(`${i} + +result = ${c}`);this.result=H(u.term+"")}catch(u){this.error=u.message||u.name}}}).mount(); diff --git a/assets/index.6032cad9.css b/assets/index.6032cad9.css new file mode 100644 index 0000000..60e4db4 --- /dev/null +++ b/assets/index.6032cad9.css @@ -0,0 +1 @@ +:root{--color-cm-editor-bg: #ffffff;--color-cm-editor-fg: #000000;--color-cm-editor-selection: #e0e0e0;--color-cm-editor-gutter: #f9f9f9;--color-cm-editor-gutter-border: #ebebeb;--color-cm-editor-line-number: #b0b0b0;--color-cm-editor-cursor: #505050;--color-cm-editor-fat-cursor: #7e7;--color-cm-editor-active-line-bg: #fafafa;--color-cm-editor-dialog-bg: var(--color-cm-editor-bg);--color-cm-editor-dialog-fg: var(--color-cm-editor-fg);--color-cm-editor-hint-bg: var(--color-cm-editor-bg);--color-cm-editor-hint-fg: var(--color-cm-editor-fg);--color-cm-editor-hint-active-bg: var(--color-cm-editor-hint-fg);--color-cm-editor-hint-active-fg: var(--color-cm-editor-hint-bg);--color-cm-editor-matching-bracket: #000000;--color-cm-editor-matching-bracket-outline: #bbbbbb;--color-cm-atom: #7b007b;--color-cm-attribute: #7b007b;--color-cm-bracket: #333;--color-cm-builtin: #46438f;--color-cm-comment: #8e8e8e;--color-cm-def: #aa6c0b;--color-cm-error: #fdd;--color-cm-keyword: #850921;--color-cm-link: #448844;--color-cm-meta: #6b6bbc;--color-cm-number: #a34503;--color-cm-operator: #445358;--color-cm-placeholder: #bbb;--color-cm-property: #3a4f4a;--color-cm-qualifier: #555;--color-cm-string: #887836;--color-cm-symbol: #2aa198;--color-cm-tag: #850921;--color-cm-variable-2: #0d5a72;--color-cm-variable-3: #006c47;--color-cm-variable: #000000}.dark{--color-cm-editor-bg: #131414;--color-cm-editor-fg: #cccccc;--color-cm-editor-selection: #4a5964;--color-cm-editor-gutter: #131414;--color-cm-editor-gutter-border: #222222;--color-cm-editor-line-number: #515151;--color-cm-editor-cursor: #999999;--color-cm-editor-fat-cursor: #7e7;--color-cm-editor-active-line-bg: rgba(255, 255, 255, .05);--color-cm-editor-matching-bracket: #cccccc;--color-cm-editor-matching-bracket-outline: #555555;--color-cm-editor-dialog-bg: var(--color-cm-editor-bg);--color-cm-editor-dialog-fg: var(--color-cm-editor-fg);--color-cm-editor-hint-bg: var(--color-cm-editor-bg);--color-cm-editor-hint-fg: #cccccc;--color-cm-editor-hint-active-bg: var(--color-cm-editor-hint-fg);--color-cm-editor-hint-active-fg: var(--color-cm-editor-hint-bg);--color-cm-atom: #dc7069;--color-cm-attribute: #dc7069;--color-cm-bracket: #cccccc;--color-cm-builtin: #fff0f6;--color-cm-comment: #969896;--color-cm-def: #de935f;--color-cm-error: #b15255;--color-cm-keyword: #b294bb;--color-cm-link: #a16a94;--color-cm-meta: var(--color-cm-editor-fg);--color-cm-number: #de935f;--color-cm-operator: #ddd;--color-cm-placeholder: #444;--color-cm-property: #81a2be;--color-cm-qualifier: #bbb;--color-cm-string: #b5bd68;--color-cm-symbol: #ddd;--color-cm-tag: #f0c674;--color-cm-variable-2: #89b6c5;--color-cm-variable-3: #6abe79;--color-cm-variable: #eee}.cm-s-codewars{background:var(--color-cm-editor-bg);color:var(--color-cm-editor-fg)}.cm-s-codewars span.cm-atom{color:var(--color-cm-atom)}.cm-s-codewars span.cm-attribute{color:var(--color-cm-attribute)}.cm-s-codewars span.cm-bracket{color:var(--color-cm-bracket)}.cm-s-codewars span.cm-builtin{color:var(--color-cm-builtin)}.cm-s-codewars span.cm-comment{color:var(--color-cm-comment);font-style:italic}.cm-s-codewars span.cm-def{color:var(--color-cm-def)}.cm-s-codewars span.cm-error{background:var(--color-cm-error)}.cm-s-codewars span.cm-keyword{color:var(--color-cm-keyword)}.cm-s-codewars span.cm-link{color:var(--color-cm-link)}.cm-s-codewars span.cm-meta{color:var(--color-cm-meta)}.cm-s-codewars span.cm-number{color:var(--color-cm-number)}.cm-s-codewars span.cm-operator{color:var(--color-cm-operator)}.cm-s-codewars span.cm-property{color:var(--color-cm-property)}.cm-s-codewars span.cm-qualifier{color:var(--color-cm-qualifier)}.cm-s-codewars span.cm-string{color:var(--color-cm-string)}.cm-s-codewars span.cm-tag{color:var(--color-cm-tag)}.cm-s-codewars span.cm-variable{color:var(--color-cm-variable)}.cm-s-codewars span.cm-variable-2{color:var(--color-cm-variable-2)}.cm-s-codewars span.cm-variable-3{color:var(--color-cm-variable-3)}.cm-s-codewars .CodeMirror-scrollbar-filler{background:var(--color-cm-editor-bg)}.cm-s-codewars .CodeMirror-selected{background:var(--color-cm-editor-selection)!important}.cm-s-codewars .CodeMirror-gutters{background:var(--color-cm-editor-gutter);border-right:1px solid var(--color-cm-editor-gutter-border)}.cm-s-codewars .CodeMirror-linenumber{color:var(--color-cm-editor-line-number)}.cm-s-codewars .CodeMirror-activeline-background{background:var(--color-cm-editor-active-line-bg)!important}.cm-s-codewars .CodeMirror-matchingbracket{color:var(--color-cm-editor-matching-bracket)!important;outline:1px solid var(--color-cm-editor-matching-bracket-outline)!important}.cm-s-codewars:not(.cm-fat-cursor) .CodeMirror-cursor{border-left:1px solid var(--color-cm-editor-cursor)!important}.cm-s-codewars.cm-fat-cursor .CodeMirror-cursor{background:var(--color-cm-editor-fat-cursor)}.CodeMirror{border-top:1px solid black;border-bottom:1px solid black}[v-cloak]{display:none!important}.bg-white\/10{--tw-bg-opacity: .1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.bg-red-800\/60{--tw-bg-opacity: .6;background-color:rgba(153,27,27,var(--tw-bg-opacity))}.grid{display:-ms-grid;display:grid}.text-2xl{font-size:1.5rem;line-height:2rem}.\!m-0{margin:0!important}.mx-auto{margin-left:auto;margin-right:auto}.\!mb-0{margin-bottom:0!important}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-1{margin-top:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.text-center{text-align:center}.w-96{width:24rem}.w-80{width:20rem}.gap-1{grid-gap:.25rem;gap:.25rem}.grid-flow-row{grid-auto-flow:row}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.col-span-3{-ms-grid-column-span:span 3 / span 3;grid-column:span 3 / span 3}.col-span-1{-ms-grid-column-span:span 1 / span 1;grid-column:span 1 / span 1}.col-span-4{-ms-grid-column-span:span 4 / span 4;grid-column:span 4 / span 4}.grid-rows-2{grid-template-rows:repeat(2,minmax(0,1fr))}.grid-rows-3{grid-template-rows:repeat(3,minmax(0,1fr))} diff --git a/index.html b/index.html index 40b85af..aad36a8 100644 --- a/index.html +++ b/index.html @@ -4,14 +4,13 @@