Browse Source

Move to npm, use tingle, bump to 0.2.0.

Herby Vojčík 5 years ago
parent
commit
58a6397b2c
9 changed files with 82 additions and 68 deletions
  1. 1 1
      LICENSE-MIT
  2. 0 5
      blockui.amd.json
  3. 0 36
      bower.json
  4. 8 2
      config.js
  5. 1 2
      index.html
  6. 27 22
      lib/idestarter.js
  7. 30 0
      package.json
  8. 10 0
      require-css.amd.json
  9. 5 0
      tingle.js.amd.json

+ 1 - 1
LICENSE-MIT

@@ -1,4 +1,4 @@
-Copyright (c) 2014 Herbert Vojčík
+Copyright (c) 2014, 2018 Herbert Vojčík
 
 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation

+ 0 - 5
blockui.amd.json

@@ -1,5 +0,0 @@
-{
-    "paths": {
-        "jquery.blockUI": "jquery.blockUI"
-    }
-}

+ 0 - 36
bower.json

@@ -1,36 +0,0 @@
-{
-  "name": "amber-ide-starter-dialog",
-  "description": "Hidden modal dialog to open Amber IDEs",
-  "version": "0.1.0",
-  "ignore": [
-    "**/.*",
-    "node_modules",
-    "bower_components",
-    "/index.html",
-    "/config.js",
-    "test",
-    "tests"
-  ],
-  "authors": [
-    {
-      "name": "Herbert Vojčík",
-      "email": "herby@mailbox.sk"
-    }
-  ],
-  "homepage": "https://github.com/amber-smalltalk/amber-ide-starter",
-  "keywords": [
-    "Amber",
-    "Smalltalk"
-  ],
-  "license": [
-    "MIT"
-  ],
-  "private": false,
-  "dependencies": {
-    "mousetrap": "^1.4.6",
-    "blockui": "2.65"
-  },
-  "devDependencies": {
-    "requirejs": "~2.1.15"
-  }
-}

+ 8 - 2
config.js

@@ -4,8 +4,14 @@ var require;
 if (!require) require = {config: function (x) {require = x;}};
 require.config({
   "paths": {
-    "mousetrap": "bower_components/mousetrap/mousetrap",
-    "jquery.blockUI": "bower_components/blockui/jquery.blockUI",
+    "tingle": "node_modules/tingle.js/dist/tingle",
+    "require-css": "node_modules/require-css",
+    "mousetrap": "node_modules/mousetrap/mousetrap",
     "amber-ide-starter-dialog": "lib/idestarter"
+  },
+  "map": {
+    "*": {
+      "css": "require-css/css"
+    }
   }
 });

+ 1 - 2
index.html

@@ -5,13 +5,12 @@
     <title>Amber Smalltalk IDE starter menu</title>
     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     <meta name="author" content="Herbert Vojčík"/>
-    <script type='text/javascript' src='bower_components/requirejs/require.js'></script>
+    <script type='text/javascript' src='node_modules/requirejs/require.js'></script>
     <script type='text/javascript' src='config.js'></script>
 </head>
 
 <body>
 <script type='text/javascript'>
-    require.config({paths: {jquery: "bower_components/jquery/dist/jquery"}});
     require(['amber-ide-starter-dialog'], function (s) {
         s.start();
     });

+ 27 - 22
lib/idestarter.js

@@ -1,32 +1,37 @@
-define(["jquery", "mousetrap", "jquery.blockUI"], function ($, mouseTrap) {
+define(["tingle", "mousetrap", "css!tingle"], function (tingle, mouseTrap) {
+    var modal = new tingle.modal({
+        footer: true,
+        stickyFooter: false,
+        closeMethods: ['overlay', 'escape'],
+        onOpen: function() {
+            mouseTrap.unbind(exports.keystroke);
+        },
+        onClose: function() {
+            mouseTrap.bind(exports.keystroke, openMe);
+        }
+    });
+
+    modal.addFooterBtn('legacy IDE', 'tingle-btn', function () {
+        require('amber/helpers').globals.Browser._open();
+        modal.close();
+    });
+
+    modal.addFooterBtn('Helios IDE', 'tingle-btn', function () {
+        require('amber/helpers').popupHelios();
+        modal.close();
+    });
+
     var exports = {
-        html: "<p><em>Esc</em> to escape; <em>Shift Shift Ctrl Shift</em> to show again</p>" +
-            "<p><button class=\"unblockUI\" onclick=\"require('amber/helpers').globals.Browser._open()\">legacy IDE</button>" +
-            "<button class=\"unblockUI\" onclick=\"require('amber/helpers').popupHelios()\">Helios IDE</button></p>",
+        html: "<p><em>Esc</em> to escape; <em>Shift Shift Ctrl Shift</em> to show again</p>",
         keystroke: "shift shift ctrl shift",
         start: function () {
-            $(document).ready(openMe);
+            setTimeout(openMe);
         }
     };
 
     function openMe() {
-        $.blockUI({message: exports.html});
-        $(".unblockUI").on("click", closeMe);
-        $(document).on("keyup", escapeBinding);
-        mouseTrap.unbind(exports.keystroke);
-    }
-
-    function closeMe() {
-        $.unblockUI();
-        $(".unblockUI").off("click", closeMe);
-        $(document).off("keyup", escapeBinding);
-        mouseTrap.bind(exports.keystroke, openMe);
-    }
-
-    function escapeBinding(event) {
-        if (event.keyCode == 27) { //esc
-            closeMe();
-        }
+        modal.setContent(exports.html);
+        modal.open();
     }
 
     return exports;

+ 30 - 0
package.json

@@ -0,0 +1,30 @@
+{
+  "name": "@ambers/ide-starter-modal",
+  "version": "0.2.0",
+  "description": "Hidden modal dialog to open Amber IDEs",
+  "main": "lib/idestarter.js",
+  "directories": {
+    "lib": "lib"
+  },
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://lolg.it/amber/amber-ide-starter.git"
+  },
+  "keywords": [
+    "Amber",
+    "Smalltalk"
+  ],
+  "author": "Herbert Vojčík <herby@mailbox.sk>",
+  "license": "MIT",
+  "dependencies": {
+    "mousetrap": "^1.6.2",
+    "require-css": "^0.1.10",
+    "tingle.js": "^0.13.2"
+  },
+  "devDependencies": {
+    "requirejs": "^2.3.5"
+  }
+}

+ 10 - 0
require-css.amd.json

@@ -0,0 +1,10 @@
+{
+    "paths": {
+        "require-css": "."
+    },
+    "map": {
+        "*": {
+            "css": "require-css/css"
+        }
+    }
+}

+ 5 - 0
tingle.js.amd.json

@@ -0,0 +1,5 @@
+{
+  "paths": {
+    "tingle": "dist/tingle"
+  }
+}