From 18 Jan, 2021 0:00 UTC: All services will be temporary unavailable for maintenance
  • R/O
  • SSH

micro-keyboard: Commit

keyboard event helper and constants library


Commit MetaInfo

Revisiond49409678e05497d63146cf42abd8192815c725d (tree)
Time2017-04-13 23:56:22
Authorfrostbane
Commiterfrostbane

Log Message

Merge with feature/npm module

Change Summary

Incremental Difference

diff -r 608645ca326f -r d49409678e05 Gruntfile.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Gruntfile.js Thu Apr 13 23:56:22 2017 +0900
@@ -0,0 +1,115 @@
1+/*
2+ * micro-keyboard
3+ *
4+ *
5+ *
6+ */
7+
8+
9+module.exports = function(grunt){
10+
11+ 'use strict';
12+
13+ /* */// ------------------------------------------------ //
14+ /* */// 設定定義
15+ /* */// ------------------------------------------------ //
16+
17+ var uglifyConfig = {
18+ release :{
19+ options :{
20+ preserveComments :function(node, comment){
21+ // preserve comments that start with a bang
22+ return /^!/.test(comment.value);
23+ },
24+ mangle :true,
25+ compress :true,
26+ },
27+
28+ files :{
29+ './bin/microkeyboard/microkeyboard.js' :[
30+ './src/microkeyboard.js',
31+ ],
32+ },
33+ },
34+ },
35+
36+ copyConfig = {
37+ release :{
38+ files :[
39+ {
40+ expand :false,
41+ src :[
42+ './LICENSE.md',
43+ ],
44+ dest :'./bin/microkeyboard/LICENSE.md',
45+ filter :'isFile'
46+ },
47+ {
48+ expand :false,
49+ src :[
50+ './package.json',
51+ ],
52+ dest :'./bin/microkeyboard/package.json',
53+ filter :'isFile'
54+ },
55+ ],
56+ },
57+ };
58+
59+ /* */// ------------------------------------------------ //
60+ /* */// 設定登録
61+ /* */// ------------------------------------------------ //
62+
63+ grunt.initConfig({
64+ uglify :uglifyConfig,
65+ copy :copyConfig,
66+
67+ });
68+
69+ /* */// ------------------------------------------------ //
70+ /* */// タスク読み込み
71+ /* */// ------------------------------------------------ //
72+
73+ [
74+ 'grunt-jxunit',
75+ 'grunt-jsdoc',
76+ 'grunt-contrib-uglify',
77+ 'grunt-contrib-copy',
78+ ]
79+ .map(function(task){
80+ grunt.loadNpmTasks(task);
81+ });
82+
83+ /* */// ------------------------------------------------ //
84+ /* */// タスク登録
85+ /* */// ------------------------------------------------ //
86+
87+ [
88+ {
89+ summary :"prepare the src dir for publish",
90+ target :"release",
91+ commands :[
92+ "uglify:release",
93+ "copy:release",
94+ ],
95+ },
96+ ]
97+ .map(function(task){
98+ var alias = task.alias || [];
99+ if(alias.indexOf(task.name) < 0)
100+ alias = alias.concat([task.target]);
101+ alias.map(function(target){
102+ if(typeof target === typeof undefined ||
103+ target === null ||
104+ target.trim() === "")
105+ return;
106+
107+ grunt.registerTask(target, task.commands);
108+ });
109+
110+ });
111+
112+
113+ /* */// ------------------------------------------------ //
114+
115+};
diff -r 608645ca326f -r d49409678e05 LICENSE.md
--- a/LICENSE.md Thu Apr 13 23:18:29 2017 +0900
+++ b/LICENSE.md Thu Apr 13 23:56:22 2017 +0900
@@ -39,6 +39,6 @@
3939 notice, this list of conditions and the following disclaimer in the
4040 documentation and/or other materials provided with the distribution.
4141
42-3. Neither the name of micro-dialog nor the names of its
42+3. Neither the name of micro-keyboard nor the names of its
4343 contributors may be used to endorse or promote products derived from
4444 this software without specific prior written permission.
diff -r 608645ca326f -r d49409678e05 package.json
--- a/package.json Thu Apr 13 23:18:29 2017 +0900
+++ b/package.json Thu Apr 13 23:56:22 2017 +0900
@@ -1,7 +1,7 @@
11 {
22 "name" : "micro-keyboard",
3- "version" : "v0.0.0",
4- "description" : "Key codes enumeration",
3+ "version" : "v0.0.2",
4+ "description" : "Keyboard key code enumeration",
55 "repository" : {
66 "type": "hg",
77 "url" : "https://bitbucket.org/frostbane/micro-keyboard"
diff -r 608645ca326f -r d49409678e05 src/microkeyboard.js
--- a/src/microkeyboard.js Thu Apr 13 23:18:29 2017 +0900
+++ b/src/microkeyboard.js Thu Apr 13 23:56:22 2017 +0900
@@ -1,6 +1,160 @@
1+/*!
2+ .. ┌ -: .
3+ ([]▄▄├]▄▄▄¿┐`,
4+ .¡ ,. D{}▓███████████░█∩^} =
5+ ,▓¼ .▐▓▓█████████████▓██▓▓, (▓
6+ █▌╕. ─@╣████████████████████▄─ ./▀'
7+ :▓█▌Ç... └ '└▓██████████████████████Ö'` .. '└`'┌
8+ \ g█████▄Ü┌ C g██████████████████████████╗─ ² ² t▄▓██ù- `╞
9+ ¡ Å╠█▌╠█▓▓▓▓▌N@▌| ╓██████████████████████████▌ .╣▓▓▓▓▓▓▓]▐╙ÅÅ∩!
10+ ` ` ╫½┌▀▀▀▀▀▀░╫▌┘ ▀▀▀▀▀██████████████████▀█▀C :╝▀▀▀▀▀▀▀. `:
11+ L ─ⁿ'``' ─ ''' ─█████████████████▌─█= ╞º'`'º──
12+ ..Å╫█╛. ~
13+ ╔▄▄▓██▓▄¿ .
14+ - ]:├╣██▀▀▀▀▀▒Q¿.¿{ )=
15+ <─Ω╚█░▓███'──h⌂▓██╡██▌Ü─4
16+ `┌ ▐▓█▄▓██╟≤¡yQ▄███▓█▌▐▓M
17+ ^. └▀▀▄▓██▄▒▄▄╬▄████▀ └▀╙`
18+ «-'''█▓▓█▓██▓██▓▓██└``'⌐
19+ #╛ µ:▓▄;xφ(⌠ █
20+ ╗µ ~╙'` `┌█╣
21+ ╝Ñ. '' ' L▀▀
22+ ~ ,
23+ ^
24+ ÷ ─.
25+ N. ∩ts )
26+ ∩ ²⌠ ` ─
27+ (@ ~▒▒ .
28+ ` └▀/ .>▀▀ :
29+ ⌐ ,⌐
130
2-var Keyboard = (function(){
31+
32+ Keyboard key code enumeration
33+ Version 0.0.2
34+ Copyright (c) 2016, 2017 Frostbane Ac
35+ See LICENSE.md.
36+ www.??.com
37+
38+
39+ */
40+
41+/**
42+ * 2016.09.04
43+ * frostbane
44+ *
45+ *
46+ *
47+ */
48+
49+/* jshint
50+forin: false,
51+nonew: false,
52+proto: true
53+ */
54+
55+/* global
56+root,
57+window,
58+Promise,
59+$,
60+$$,
61+exports,
62+module
63+ */
64+
65+
66+
67+(function(global, factory){
368 "use strict";
69+
70+ if(typeof exports !== typeof undefined && global.exports !== exports){
71+ module.exports = factory;
72+ }else{
73+ global.Keyboard = factory;
74+ }
75+
76+}(this, (function(){
77+ "use strict";
78+
79+ var functype = typeof function(){};
80+
81+ // var Enum = function(){
82+ // var offset = 0,
83+ // index = 0,
84+ // stringtype = typeof "string",
85+ // functype = typeof function(){},
86+ // idRe = new RegExp(/^[$A-Z_][0-9A-Z_$]*$/i),
87+ // numRe = new RegExp(/^[0-9]*$/i),
88+ // trimRe = new RegExp(/^\s+|\s+$/g),
89+ // eobj = { __proto__ :this, },
90+ // setVal = function(obj, val, opts){
91+ // try {
92+ // Object.defineProperty(obj, val, opts);
93+ // } catch(ex) {
94+ // obj[val] = opts.value;
95+ // }
96+ // };
97+ //
98+ // for (var i = 0; i < arguments.length; i++) {
99+ // var val = arguments[i];
100+ //
101+ // if (typeof val !== stringtype)
102+ // throw "invalid enumeration type, '" + typeof val + "'";
103+ //
104+ // if (val.replace(trimRe, '') === "")
105+ // throw "blank enumeration";
106+ //
107+ // if (val.indexOf("=") === 0)
108+ // throw "blank enumeration, '" + val + "'";
109+ //
110+ // if (val.indexOf("=") > 0) {
111+ // var parts = val.split("=");
112+ //
113+ // if (parts.length !== 2)
114+ // throw "multiple assignments, '" + val + "'";
115+ //
116+ // var assignment = parts[1].replace(trimRe, '');
117+ //
118+ // if (assignment !== "") {
119+ // if (!numRe.test(assignment))
120+ // throw "invalid assignment, '" + val + "'";
121+ //
122+ // offset = parseInt(assignment);
123+ //
124+ // if (isNaN(offset))
125+ // throw "invalid assignment, '" + val + "'";
126+ //
127+ // index = 0;
128+ // }
129+ //
130+ // val = parts[0];
131+ // }
132+ //
133+ // val = val.replace(trimRe, '');
134+ //
135+ // if (!idRe.test(val))
136+ // throw "invalid enumeration, '" + val + "'";
137+ //
138+ // if (eobj.hasOwnProperty(val))
139+ // throw "duplicate enumeration, '" + val + "'";
140+ //
141+ // setVal(eobj, val, {
142+ // value :offset + index++,
143+ // writable :false,
144+ // configurable :false,
145+ // enumerable :true,
146+ // });
147+ //
148+ // }
149+ //
150+ // if (Object.hasOwnProperty("freeze") && typeof Object.freeze === functype)
151+ // Object.freeze(eobj);
152+ // else if (Object.hasOwnProperty("preventExtensions") && typeof Object.preventExtensions === functype)
153+ // Object.preventExtensions(eobj);
154+ //
155+ // return eobj;
156+ // };
157+
4158 var kb = {};
5159
6160 var KeyCodes = [];
@@ -102,6 +256,12 @@
102256 KeyCodes[220] = "\\";
103257 KeyCodes[221] = "]";
104258 KeyCodes[222] = "'";
259+
260+ if (Object.hasOwnProperty("freeze") && typeof Object.freeze === functype)
261+ Object.freeze(KeyCodes);
262+ else if (Object.hasOwnProperty("preventExtensions") && typeof Object.preventExtensions === functype)
263+ Object.preventExtensions(KeyCodes);
264+
105265 kb.keyCodes = KeyCodes;
106266
107267
@@ -207,10 +367,13 @@
207367 kb.ClosingBrace = 221;
208368 kb.SingleQuote = 222;
209369
370+ if (Object.hasOwnProperty("freeze") && typeof Object.freeze === functype)
371+ Object.freeze(kb);
372+ else if (Object.hasOwnProperty("preventExtensions") && typeof Object.preventExtensions === functype)
373+ Object.preventExtensions(kb);
374+ else
375+ console.warn("Unable to freeze object, Keyboard will be mutable.");
210376
211377 return kb;
212-}());
213378
214-// if inside a browser module will be undefined
215-if(typeof exports !== "undefined" && this.exports !== exports)
216- module.exports = Keyboard;
379+}())));
Show on old repository browser