All Projects → nartc → super-expressive-playground

nartc / super-expressive-playground

Licence: other
SuperExpressive Playground

Programming Languages

typescript
32286 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to super-expressive-playground

VenoDev
💻 My personal portfolio and contact website.
Stars: ✭ 14 (-33.33%)
Mutual labels:  netlify
Game-of-Life-Vue
vue implementation of game of life
Stars: ✭ 17 (-19.05%)
Mutual labels:  netlify
python-hyperscan
A CPython extension for the Hyperscan regular expression matching library.
Stars: ✭ 112 (+433.33%)
Mutual labels:  regexp
netlify-lambda-function-example
An example Netlify Lambda function that processes payments with Stripe.
Stars: ✭ 93 (+342.86%)
Mutual labels:  netlify
pwl
Password Lense: reveal character types in a password
Stars: ✭ 20 (-4.76%)
Mutual labels:  netlify
is-regex
Is this value a JS regex?
Stars: ✭ 22 (+4.76%)
Mutual labels:  regexp
11straps
11straps is a static website boilerplate. It combines Eleventy with Bootstrap 5. 🎉
Stars: ✭ 85 (+304.76%)
Mutual labels:  netlify
build-plugin-template
Template repository to create new Netlify Build plugins.
Stars: ✭ 26 (+23.81%)
Mutual labels:  netlify
gatsby-starter
Gatsby Starter for creating portfolio & blog.
Stars: ✭ 55 (+161.9%)
Mutual labels:  netlify
cookie
Landing website + Blog using Jekyll & Tailwind CSS
Stars: ✭ 61 (+190.48%)
Mutual labels:  netlify
vue-seo-friendly-spa-template
Vue.js PWA/SPA template initially scaffolded with vue-cli and configured for SEO. Makes use of prerendering and other techniques/packages in order to achieve a perfect "Lighthouse Score".
Stars: ✭ 41 (+95.24%)
Mutual labels:  netlify
neu ui
Prototype and build projects faster using Neu UI - an open source React component library designed to neumorphic style. Built using React, Styled Components, Jest and Storybook.
Stars: ✭ 23 (+9.52%)
Mutual labels:  netlify
doc
Documentation repository for wallabag v2.
Stars: ✭ 18 (-14.29%)
Mutual labels:  netlify
bluise
🍄 Bluise - A Nuxt.js & Netlify CMS boilerplate.
Stars: ✭ 132 (+528.57%)
Mutual labels:  netlify
expand-brackets
Expand POSIX bracket expressions (character classes) in glob patterns.
Stars: ✭ 26 (+23.81%)
Mutual labels:  regexp
Tsundoku
Web App for people having lots of unread tech books
Stars: ✭ 50 (+138.1%)
Mutual labels:  netlify
gosquito
gosquito ("go" + "mosquito") is a pluggable tool for data gathering, data processing and data transmitting to various destinations.
Stars: ✭ 25 (+19.05%)
Mutual labels:  regexp
trailing-slash-guide
Understand and fix your static website trailing slash issues!
Stars: ✭ 255 (+1114.29%)
Mutual labels:  netlify
regexp-graph
No description or website provided.
Stars: ✭ 22 (+4.76%)
Mutual labels:  regexp
portfolio-svelte
My over-complicated personal site. A place to show off work and writing, and a place to try weird stuff.
Stars: ✭ 24 (+14.29%)
Mutual labels:  netlify

SuperExpressive Playground

This is the playground for SuperExpressive Library.

Table Of Content

Working application

Check out the working app -> https://sepg.netlify.app/

SuperExpressive Playground by @nartc

Features

  • Use the code editor to write Regular Expression using SuperExpressive API

  • Test the generated RegExp

  • Mobile friendly - @trungk18

  • Automatic execution

Technologies

Challenges

There are a couple of challenges that I ran into while working on this project.

Monaco Editor

Monaco is a powerful library, but it's also very complex. The way it's loaded is pretty tricky. However, the integration is quite smooth using ngx-monaco-editor. It was quite satisfied when I was able to load extra library type definitions (for SuperExpressive intellisense) into the Monaco instance

Executing the value of the editor

This is one tricky task as eval() is considered bad practice. So, I use new Function() instead. Also, I need to execute a snippet like:

SuperExpressive().anyChar.toRegex();

which will execute SuperExpressive() which is a 3rd-party API. Hence, in order for me to execute that, I need to assign SuperExpressive onto the window object.

import SuperExpressive from "super-expressive";

window.SuperExpressive = SuperExpressive;

Furthermore, I only want to execute a single-invoke of SuperExpressive() at a time, so I need to trim the editor's value.

Scully and Monaco

Scully will not work with Monaco as is because Scully will generate the html from the Angular build bundle and in turns will inject several <script> tags that were used to load Monaco. With multiple <script> tags with the same value (because Scully generates multiple html for multiple routes), Monaco complains that it's already been loaded.

To resolve that, I write a quick plugin to remove Monaco related <script> from the generated html by Scully.

function removeMonacoScriptPluginHandler(html: string) {
  return Promise.resolve(
    html
      .replace(/<script.+(?:editor\.main(?:\.nls)\.js)"><\/script>/g, "") // remove duplicate loader
      .replace(/<script.+(?:tsMode\.js|typescript\.js)"><\/script>/g, "") // remove duplicate loader
      .replace(/<ngx-monaco-editor.+><\/ngx-monaco-editor>/g, "") // remove flickering
  );
}

Mobile Responsiveness

Again, because of how Monaco is loaded and rendered, it's tricky to get Mobile Responsiveness right which I haven't paid too much attention to for the first iteration.

Contribution

Any contribution is welcome

Credit

License

The MIT License (MIT)

Copyright (c) 2015 Chris Kibble

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].