keycomfort 0.4.0 → 0.5.0

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.
@@ -12704,21 +12704,21 @@ var os=require$$0$2,fs=require$$3,fsp=require$$2,path=require$$3$1,node_stream=r
12704
12704
  });
12705
12705
  }var test=/*#__PURE__*/Object.freeze({__proto__:null,InvalidTest:InvalidTest,assertEqual:assertEqual,assertProps:assertProps,assertType:assertType,testFn:testFn,testInstance:testInstance,testMethod:testMethod});amekusa_util.arr=arr;amekusa_util.clean=clean$1;amekusa_util.dig=dig;amekusa_util.gen=gen;amekusa_util.io=io;amekusa_util.is=is;amekusa_util.isEmpty=isEmpty;amekusa_util.isEmptyOrFalsey=isEmptyOrFalsey;amekusa_util.isEmptyOrFalsy=isEmptyOrFalsy;amekusa_util.merge=merge$1;amekusa_util.sh=sh;amekusa_util.subst=subst;amekusa_util.test=test;amekusa_util.time=time;amekusa_util.web=web;
12706
12706
  return amekusa_util;
12707
- }var bundle = {};var hasRequiredBundle;
12707
+ }var karabinerge = {};var hasRequiredKarabinerge;
12708
12708
 
12709
- function requireBundle () {
12710
- if (hasRequiredBundle) return bundle;
12711
- hasRequiredBundle = 1;
12709
+ function requireKarabinerge () {
12710
+ if (hasRequiredKarabinerge) return karabinerge;
12711
+ hasRequiredKarabinerge = 1;
12712
12712
 
12713
12713
  var node_process = require$$0$1;
12714
12714
  var path = require$$3$1;
12715
- var node_child_process = require$$1;
12716
12715
  var os = require$$0$2;
12717
12716
  var fs = require$$3;
12718
12717
  var fsp = require$$2;
12719
12718
  var node_stream = require$$4;
12720
12719
 
12721
12720
 
12721
+
12722
12722
  function _interopNamespaceDefault(e) {
12723
12723
  var n = Object.create(null);
12724
12724
  if (e) {
@@ -12738,195 +12738,104 @@ function requireBundle () {
12738
12738
 
12739
12739
  var fsp__namespace = /*#__PURE__*/_interopNamespaceDefault(fsp);
12740
12740
 
12741
- /*!
12742
- * Shell Utils
12743
- * @author amekusa
12744
- */
12745
-
12746
12741
  /**
12747
- * Executes the given shell command, and returns a Promise that resolves the stdout
12748
- * @param {string} cmd
12749
- * @param {object} [opts]
12750
- * @return {Promise}
12742
+ * Coerces the given value into an array.
12743
+ * @param {any} x
12744
+ * @return {any[]}
12751
12745
  */
12752
- function exec(cmd, opts = {}) {
12753
- opts = Object.assign({
12754
- dryRun: false,
12755
- }, opts);
12756
- return new Promise((resolve, reject) => {
12757
- if (opts.dryRun) {
12758
- console.log(`[DRYRUN] ${cmd}`);
12759
- return resolve();
12760
- }
12761
- node_child_process.exec(cmd, (err, stdout) => {
12762
- return err ? reject(err) : resolve(stdout);
12763
- });
12764
- });
12746
+ function arr(x) {
12747
+ return Array.isArray(x) ? x : [x];
12765
12748
  }
12766
12749
 
12767
- /*!
12768
- * I/O Utils
12769
- * @author amekusa
12770
- */
12771
-
12772
12750
  /**
12773
- * Alias of `os.homedir()`.
12774
- * @type {string}
12775
- */
12776
- const home = os.homedir();
12777
-
12778
- /**
12779
- * Searchs the given file path in the given directories.
12780
- * @param {string} file - File to find
12781
- * @param {string[]} dirs - Array of directories to search
12782
- * @param {object} [opts] - Options
12783
- * @return {string|boolean} found file path, or false if not found
12751
+ * Returns whether the given value can be considered as "empty".
12752
+ * @param {any} x
12753
+ * @return {boolean}
12784
12754
  */
12785
- function find(file, dirs = [], opts = {}) {
12786
- let {allowAbsolute = true} = opts;
12787
- if (allowAbsolute && path.isAbsolute(file)) return fs.existsSync(file) ? file : false;
12788
- for (let i = 0; i < dirs.length; i++) {
12789
- let find = path.join(dirs[i], file);
12790
- if (fs.existsSync(find)) return find;
12755
+ function isEmpty(x) {
12756
+ if (Array.isArray(x)) return x.length == 0;
12757
+ switch (typeof x) {
12758
+ case 'string':
12759
+ return !x;
12760
+ case 'object':
12761
+ for (let _ in x) return false;
12762
+ return true;
12763
+ case 'undefined':
12764
+ return true;
12791
12765
  }
12792
12766
  return false;
12793
12767
  }
12794
12768
 
12795
12769
  /**
12796
- * Replaces the beginning `~` character with `os.homedir()`.
12797
- * @param {string} file - File path
12798
- * @param {string} [replace=os.homedir()] - Replacement
12799
- * @return {string} modified `file`
12800
- */
12801
- function untilde(file, replace = home) {
12802
- if (!file.startsWith('~')) return file;
12803
- if (file.length == 1) return replace;
12804
- if (file.startsWith(path.sep, 1)) return replace + file.substring(1);
12805
- return file;
12806
- }
12807
-
12808
- /**
12809
- * Deletes the contents of the given directory.
12810
- * @return {Promise}
12811
- */
12812
- function clean$1(dir, pattern, depth = 1) {
12813
- return exec(`find '${dir}' -type f -name '${pattern}' -maxdepth ${depth} -delete`);
12814
- }
12815
-
12816
- /**
12817
- * Deletes the given file or directory.
12818
- * @param {string} file
12819
- * @return {Promise}
12820
- */
12821
- function rm(file) {
12822
- return fsp__namespace.rm(file, {recursive: true, force: true});
12823
- }
12824
-
12825
- /**
12826
- * Deletes the given file or directory synchronously.
12827
- * @param {string} file
12828
- */
12829
- function rmSync(file) {
12830
- return fs.rmSync(file, {recursive: true, force: true});
12831
- }
12832
-
12833
- /**
12834
- * Copies the given file(s) to another directory
12835
- * @param {string|object|string[]|object[]} src
12836
- * @param {string} dst Base destination directory
12837
- * @return {Promise}
12770
+ * Removes "empty" values from the given object or array.
12771
+ * @param {object|any[]} x
12772
+ * @param {number} recurse - Recursion limit
12773
+ * @return {object|any[]} modified `x`
12838
12774
  */
12839
- function copy(src, dst) {
12840
- return Promise.all((Array.isArray(src) ? src : [src]).map(item => {
12841
- let _src, _dst;
12842
- switch (typeof item) {
12843
- case 'object':
12844
- _src = item.src;
12845
- _dst = item.dst;
12846
- break;
12847
- case 'string':
12848
- _src = item;
12849
- break;
12850
- default:
12851
- throw 'invalid type';
12775
+ function clean$1(x, recurse = 8) {
12776
+ if (recurse) {
12777
+ if (Array.isArray(x)) {
12778
+ let r = [];
12779
+ for (let i = 0; i < x.length; i++) {
12780
+ let v = clean$1(x[i], recurse - 1);
12781
+ if (!isEmpty(v)) r.push(v);
12782
+ }
12783
+ return r;
12852
12784
  }
12853
- _dst = path.join(dst, _dst || path.basename(_src));
12854
- return fsp__namespace.mkdir(path.dirname(_dst), {recursive: true}).then(fsp__namespace.copyFile(_src, _dst));
12855
- }));
12785
+ if (typeof x == 'object') {
12786
+ let r = {};
12787
+ for (let k in x) {
12788
+ let v = clean$1(x[k], recurse - 1);
12789
+ if (!isEmpty(v)) r[k] = v;
12790
+ }
12791
+ return r;
12792
+ }
12793
+ }
12794
+ return x;
12856
12795
  }
12857
12796
 
12858
12797
  /**
12859
- * Returns a Transform stream object with the given function as its transform() method.
12860
- * `fn` must return a string which is to be the new content, or a Promise which resolves a string.
12861
- *
12862
- * @example
12863
- * return gulp.src(src)
12864
- * .pipe(modify((data, enc) => {
12865
- * // do stuff
12866
- * return newData;
12867
- * }));
12868
- *
12869
- * @param {function} fn
12870
- * @return {Transform}
12798
+ * Merges the 2nd object into the 1st object recursively (deep-merge). The 1st object will be modified.
12799
+ * @param {object} x - The 1st object
12800
+ * @param {object} y - The 2nd object
12801
+ * @param {object} [opts] - Options
12802
+ * @param {number} opts.recurse=8 - Recurstion limit. Negative number means unlimited
12803
+ * @param {boolean|string} opts.mergeArrays - How to merge arrays
12804
+ * - `true`: merge x with y
12805
+ * - 'push': push y elements to x
12806
+ * - 'concat': concat x and y
12807
+ * - other: replace x with y
12808
+ * @return {object} The 1st object
12871
12809
  */
12872
- function modifyStream(fn) {
12873
- return new node_stream.Transform({
12874
- objectMode: true,
12875
- transform(file, enc, done) {
12876
- let r = fn(file.contents.toString(enc), enc);
12877
- if (r instanceof Promise) {
12878
- r.then(modified => {
12879
- file.contents = Buffer.from(modified, enc);
12880
- this.push(file);
12881
- done();
12882
- });
12883
- } else {
12884
- file.contents = Buffer.from(r, enc);
12885
- this.push(file);
12886
- done();
12887
- }
12810
+ function merge$1(x, y, opts = {}) {
12811
+ if (!('recurse' in opts)) opts.recurse = 8;
12812
+ switch (Array.isArray(x) + Array.isArray(y)) {
12813
+ case 0: // no array
12814
+ if (opts.recurse && x && y && typeof x == 'object' && typeof y == 'object') {
12815
+ opts.recurse--;
12816
+ for (let k in y) x[k] = merge$1(x[k], y[k], opts);
12817
+ opts.recurse++;
12818
+ return x;
12888
12819
  }
12889
- });
12820
+ case 1: // 1 array
12821
+ return y;
12822
+ }
12823
+ // 2 arrays
12824
+ switch (opts.mergeArrays) {
12825
+ case true:
12826
+ for (let i = 0; i < y.length; i++) {
12827
+ if (!x.includes(y[i])) x.push(y[i]);
12828
+ }
12829
+ return x;
12830
+ case 'push':
12831
+ x.push(...y);
12832
+ return x;
12833
+ case 'concat':
12834
+ return x.concat(y);
12835
+ }
12836
+ return y;
12890
12837
  }
12891
12838
 
12892
- var io = /*#__PURE__*/Object.freeze({
12893
- __proto__: null,
12894
- clean: clean$1,
12895
- copy: copy,
12896
- find: find,
12897
- home: home,
12898
- modifyStream: modifyStream,
12899
- rm: rm,
12900
- rmSync: rmSync,
12901
- untilde: untilde
12902
- });
12903
-
12904
- /*!
12905
- * === @amekusa/util.js/web === *
12906
- * MIT License
12907
- *
12908
- * Copyright (c) 2024 Satoshi Soma
12909
- *
12910
- * Permission is hereby granted, free of charge, to any person obtaining a copy
12911
- * of this software and associated documentation files (the "Software"), to deal
12912
- * in the Software without restriction, including without limitation the rights
12913
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12914
- * copies of the Software, and to permit persons to whom the Software is
12915
- * furnished to do so, subject to the following conditions:
12916
- *
12917
- * The above copyright notice and this permission notice shall be included in all
12918
- * copies or substantial portions of the Software.
12919
- *
12920
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12921
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12922
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12923
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12924
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12925
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12926
- * SOFTWARE.
12927
- */
12928
-
12929
-
12930
12839
  const escHTML_map = {
12931
12840
  '&': 'amp',
12932
12841
  '"': 'quot',
@@ -12937,31 +12846,6 @@ function requireBundle () {
12937
12846
 
12938
12847
  new RegExp(`["'<>]|(&(?!${Object.values(escHTML_map).join('|')};))`, 'g');
12939
12848
 
12940
- /*!
12941
- * === @amekusa/util.js/time === *
12942
- * MIT License
12943
- *
12944
- * Copyright (c) 2024 Satoshi Soma
12945
- *
12946
- * Permission is hereby granted, free of charge, to any person obtaining a copy
12947
- * of this software and associated documentation files (the "Software"), to deal
12948
- * in the Software without restriction, including without limitation the rights
12949
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12950
- * copies of the Software, and to permit persons to whom the Software is
12951
- * furnished to do so, subject to the following conditions:
12952
- *
12953
- * The above copyright notice and this permission notice shall be included in all
12954
- * copies or substantial portions of the Software.
12955
- *
12956
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12957
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12958
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12959
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12960
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12961
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12962
- * SOFTWARE.
12963
- */
12964
-
12965
12849
  /**
12966
12850
  * Coerces the given value into a `Date` object.
12967
12851
  * @param {...any} args - A `Date` object or args to pass to `Date()`
@@ -13107,146 +12991,370 @@ function requireBundle () {
13107
12991
  */
13108
12992
  function iso9075(d) {
13109
12993
  return ymd(d, '-') + ' ' + hms(d, ':');
12994
+ }var time=/*#__PURE__*/Object.freeze({__proto__:null,addTime:addTime,ceil:ceil,date:date,floor:floor,hms:hms,iso9075:iso9075,localize:localize,ms:ms,quantize:quantize,round:round,ymd:ymd});/*!
12995
+ * === @amekusa/util.js/sh === *
12996
+ * MIT License
12997
+ *
12998
+ * Copyright (c) 2024 Satoshi Soma
12999
+ *
13000
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13001
+ * of this software and associated documentation files (the "Software"), to deal
13002
+ * in the Software without restriction, including without limitation the rights
13003
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13004
+ * copies of the Software, and to permit persons to whom the Software is
13005
+ * furnished to do so, subject to the following conditions:
13006
+ *
13007
+ * The above copyright notice and this permission notice shall be included in all
13008
+ * copies or substantial portions of the Software.
13009
+ *
13010
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13011
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13012
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13013
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13014
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13015
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
13016
+ * SOFTWARE.
13017
+ */
13018
+
13019
+ /**
13020
+ * This is for copying styles or scripts to a certain HTML directory.
13021
+ * @author Satoshi Soma (github.com/amekusa)
13022
+ */
13023
+ class AssetImporter {
13024
+ /**
13025
+ * @param {object} config
13026
+ * @param {boolean} [config.minify=false] - Prefer `*.min.*` version
13027
+ * @param {string} config.src - Source dir to search
13028
+ * @param {string} config.dst - Destination dir
13029
+ */
13030
+ constructor(config) {
13031
+ this.config = Object.assign({
13032
+ minify: false,
13033
+ src: '', // source dir to search
13034
+ dst: '', // destination dir
13035
+ }, config);
13036
+ this.queue = [];
13037
+ this.results = {
13038
+ script: [],
13039
+ style: [],
13040
+ asset: [],
13041
+ };
13042
+ }
13043
+ /**
13044
+ * Adds a new item to import.
13045
+ * @param {string|string[]|object|object[]} newImport
13046
+ */
13047
+ add(newImport) {
13048
+ if (!Array.isArray(newImport)) newImport = [newImport];
13049
+ for (let i = 0; i < newImport.length; i++) {
13050
+ let item = newImport[i];
13051
+ switch (typeof item) {
13052
+ case 'string':
13053
+ item = {src: item};
13054
+ break;
13055
+ case 'object':
13056
+ if (Array.isArray(item)) throw `invalid type: array`;
13057
+ break;
13058
+ default:
13059
+ throw `invalid type: ${typeof item}`;
13060
+ }
13061
+ if (!('src' in item)) throw `'src' property is missing`;
13062
+ this.queue.push(Object.assign({
13063
+ order: 0,
13064
+ resolve: 'local',
13065
+ private: false,
13066
+ }, item));
13067
+ }
13068
+ }
13069
+ /**
13070
+ * Resolves the location of the given file path
13071
+ * @param {string} file - File path
13072
+ * @param {string} method - Resolution method
13073
+ * @return {string} Resolved file path
13074
+ */
13075
+ resolve(file, method) {
13076
+ let find = [];
13077
+ if (this.config.minify) {
13078
+ let _ext = ext(file);
13079
+ find.push(ext(file, '.min' + _ext));
13080
+ }
13081
+ find.push(file);
13082
+ for (let i = 0; i < find.length; i++) {
13083
+ let r;
13084
+ switch (method) {
13085
+ case 'require':
13086
+ try {
13087
+ r = require.resolve(find[i]);
13088
+ } catch (e) {
13089
+ if (e.code == 'MODULE_NOT_FOUND') continue;
13090
+ throw e;
13091
+ }
13092
+ return r;
13093
+ case 'local':
13094
+ r = path.join(this.config.src, find[i]);
13095
+ if (fs.existsSync(r)) return r;
13096
+ break;
13097
+ case 'local:absolute':
13098
+ case 'local:abs':
13099
+ r = find[i];
13100
+ if (fs.existsSync(r)) return r;
13101
+ break;
13102
+ default:
13103
+ throw `invalid resolution method: ${method}`;
13104
+ }
13105
+ }
13106
+ throw `cannot resolve '${file}'`;
13107
+ }
13108
+ /**
13109
+ * Imports all items in the queue at once.
13110
+ * @return {Promise}
13111
+ */
13112
+ import() {
13113
+ let tasks = [];
13114
+ let typeMap = {
13115
+ '.css': 'style',
13116
+ '.js': 'script',
13117
+ };
13118
+ this.queue.sort((a, b) => (Number(a.order) - Number(b.order))); // sort by order
13119
+ while (this.queue.length) {
13120
+ let item = this.queue.shift();
13121
+ let {type, src} = item;
13122
+ let url;
13123
+
13124
+ if (!item.resolve) { // no resolution
13125
+ url = src;
13126
+ if (!type) type = typeMap[ext(src)] || 'asset';
13127
+ console.log('---- File Link ----');
13128
+ console.log(' type:', type);
13129
+ console.log(' src:', src);
13130
+
13131
+ } else { // needs resolution
13132
+ let {dst:dstDir, as:dstFile} = item;
13133
+ let create = item.resolve == 'create'; // needs creation?
13134
+ if (create) {
13135
+ if (!dstFile) throw `'as' property is required with {resolve: 'create'}`;
13136
+ } else {
13137
+ src = this.resolve(src, item.resolve);
13138
+ if (!dstFile) dstFile = path.basename(src);
13139
+ }
13140
+ if (!type) type = typeMap[ext(dstFile)] || 'asset';
13141
+ if (!dstDir) dstDir = type + 's';
13142
+
13143
+ // absolute destination
13144
+ url = path.join(dstDir, dstFile);
13145
+ let dst = path.join(this.config.dst, url);
13146
+ dstDir = path.dirname(dst);
13147
+ if (!fs.existsSync(dstDir)) fs.mkdirSync(dstDir, {recursive:true});
13148
+
13149
+ // create/copy file
13150
+ if (create) {
13151
+ console.log('---- File Creation ----');
13152
+ console.log(' type:', type);
13153
+ console.log(' dst:', dst);
13154
+ tasks.push(fsp.writeFile(dst, src));
13155
+ } else {
13156
+ console.log('---- File Import ----');
13157
+ console.log(' type:', type);
13158
+ console.log(' src:', src);
13159
+ console.log(' dst:', dst);
13160
+ tasks.push(fsp.copyFile(src, dst));
13161
+ }
13162
+ }
13163
+
13164
+ if (!item.private) {
13165
+ if (!(type in this.results)) this.results[type] = [];
13166
+ this.results[type].push({type, url});
13167
+ }
13168
+ }
13169
+
13170
+ return tasks.length ? Promise.all(tasks) : Promise.resolve();
13171
+ }
13172
+ /**
13173
+ * Outputs HTML tags for imported items.
13174
+ * @param {string} [type] - Type
13175
+ * @return {string} HTML
13176
+ */
13177
+ toHTML(type = null) {
13178
+ let r;
13179
+ if (type) {
13180
+ let tmpl = templates[type];
13181
+ if (!tmpl) return '';
13182
+ if (Array.isArray(tmpl)) tmpl = tmpl.join('\n');
13183
+ let items = this.results[type];
13184
+ r = new Array(items.length);
13185
+ for (let i = 0; i < items.length; i++) {
13186
+ r[i] = tmpl.replaceAll('%s', items[i].url || '');
13187
+ }
13188
+ } else {
13189
+ let keys = Object.keys(this.results);
13190
+ r = new Array(keys.length);
13191
+ for (let i = 0; i < keys.length; i++) {
13192
+ r[i] = this.toHTML(keys[i]);
13193
+ }
13194
+ }
13195
+ return r.join('\n');
13196
+ }
13110
13197
  }
13111
13198
 
13112
- var time = /*#__PURE__*/Object.freeze({
13113
- __proto__: null,
13114
- addTime: addTime,
13115
- ceil: ceil,
13116
- date: date,
13117
- floor: floor,
13118
- hms: hms,
13119
- iso9075: iso9075,
13120
- localize: localize,
13121
- ms: ms,
13122
- quantize: quantize,
13123
- round: round,
13124
- ymd: ymd
13125
- });
13126
-
13127
- /*!
13128
- * === @amekusa/util.js === *
13129
- * MIT License
13130
- *
13131
- * Copyright (c) 2024 Satoshi Soma
13132
- *
13133
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13134
- * of this software and associated documentation files (the "Software"), to deal
13135
- * in the Software without restriction, including without limitation the rights
13136
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13137
- * copies of the Software, and to permit persons to whom the Software is
13138
- * furnished to do so, subject to the following conditions:
13139
- *
13140
- * The above copyright notice and this permission notice shall be included in all
13141
- * copies or substantial portions of the Software.
13142
- *
13143
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13144
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13145
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13146
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13147
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13148
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
13149
- * SOFTWARE.
13199
+ const templates = {
13200
+ script: [
13201
+ `<script src="%s"></script>`,
13202
+ ],
13203
+ module: [
13204
+ `<script type="module" src="%s"></script>`,
13205
+ ],
13206
+ style: [
13207
+ `<link rel="stylesheet" href="%s">`,
13208
+ ],
13209
+ };/**
13210
+ * Alias of `os.homedir()`.
13211
+ * @type {string}
13150
13212
  */
13213
+ const home = os.homedir();
13151
13214
 
13152
13215
  /**
13153
- * Coerces the given value into an array.
13154
- * @param {any} x
13155
- * @return {any[]}
13216
+ * Returns or overwrites the extension of the given file path.
13217
+ * @param {string} file - File path
13218
+ * @param {string} [set] - New extension
13219
+ * @return {string} the extension, or a modified file path with the new extension
13156
13220
  */
13157
- function arr(x) {
13158
- return Array.isArray(x) ? x : [x];
13221
+ function ext(file, set = null) {
13222
+ let dot = file.lastIndexOf('.');
13223
+ return typeof set == 'string'
13224
+ ? (dot < 0 ? (file + set) : (file.substring(0, dot) + set))
13225
+ : (dot < 0 ? '' : file.substring(dot));
13159
13226
  }
13160
13227
 
13161
13228
  /**
13162
- * Returns whether the given value can be considered as "empty".
13163
- * @param {any} x
13164
- * @return {boolean}
13229
+ * Searches the given file path in the given directories.
13230
+ * @param {string} file - File to find
13231
+ * @param {string[]} dirs - Array of directories to search
13232
+ * @param {object} [opts] - Options
13233
+ * @param {boolean} [opts.allowAbsolute=true] - If true, `file` can be an absolute path
13234
+ * @return {string|boolean} found file path, or false if not found
13165
13235
  */
13166
- function isEmpty(x) {
13167
- if (Array.isArray(x)) return x.length == 0;
13168
- switch (typeof x) {
13169
- case 'string':
13170
- return !x;
13171
- case 'object':
13172
- if (x === null) return true;
13173
- for (let i in x) return false;
13174
- case 'undefined':
13175
- return true;
13236
+ function find(file, dirs = [], opts = {}) {
13237
+ let {allowAbsolute = true} = opts;
13238
+ if (allowAbsolute && path.isAbsolute(file)) return fs.existsSync(file) ? file : false;
13239
+ for (let i = 0; i < dirs.length; i++) {
13240
+ let find = path.join(dirs[i], file);
13241
+ if (fs.existsSync(find)) return find;
13176
13242
  }
13177
13243
  return false;
13178
13244
  }
13179
13245
 
13180
13246
  /**
13181
- * Removes "empty" values from the given object or array.
13182
- * @param {object|any[]} x
13183
- * @param {number} recurse - Recursion limit
13184
- * @return {object|any[]} modified `x`
13247
+ * Replaces the beginning `~` character with `os.homedir()`.
13248
+ * @param {string} file - File path
13249
+ * @param {string} [replace=os.homedir()] - Replacement
13250
+ * @return {string} modified `file`
13185
13251
  */
13186
- function clean(x, recurse = 8) {
13187
- if (recurse) {
13188
- if (Array.isArray(x)) {
13189
- let r = [];
13190
- for (let i = 0; i < x.length; i++) {
13191
- let I = clean(x[i], recurse - 1);
13192
- if (!isEmpty(I)) r.push(I);
13193
- }
13194
- return r;
13195
- }
13196
- if (typeof x == 'object') {
13197
- let r = {};
13198
- for (let k in x) {
13199
- let v = clean(x[k], recurse - 1);
13200
- if (!isEmpty(v)) r[k] = v;
13201
- }
13202
- return r;
13203
- }
13204
- }
13205
- return x;
13252
+ function untilde(file, replace = home) {
13253
+ if (!file.startsWith('~')) return file;
13254
+ if (file.length == 1) return replace;
13255
+ if (file.startsWith(path.sep, 1)) return replace + file.substring(1);
13256
+ return file;
13206
13257
  }
13207
13258
 
13208
13259
  /**
13209
- * Merges the 2nd object into the 1st object recursively (deep-merge). The 1st object will be modified.
13210
- * @param {object} x - The 1st object
13211
- * @param {object} y - The 2nd object
13260
+ * Deletes the files in the given directory.
13261
+ * @param {string} dir - Directory to clean
13262
+ * @param {string|RegExp} [pattern] - File pattern
13212
13263
  * @param {object} [opts] - Options
13213
- * @param {number} opts.recurse=8 - Recurstion limit. Negative number means unlimited
13214
- * @param {boolean|string} opts.mergeArrays - How to merge arrays
13215
- * - `true`: merge x with y
13216
- * - 'push': push y elements to x
13217
- * - 'concat': concat x and y
13218
- * - other: replace x with y
13219
- * @return {object} The 1st object
13264
+ * @param {boolean} [opts.recursive=false] - Searches recursively
13265
+ * @param {object} [opts.types] - File types to delete
13266
+ * @param {boolean} [opts.types.any=false] - Any type
13267
+ * @param {boolean} [opts.types.file=true] - Regular file
13268
+ * @param {boolean} [opts.types.dir=false] - Directory
13269
+ * @param {boolean} [opts.types.symlink=false] - Symbolic link
13270
+ * @return {Promise} a promise resolved with the deleted file paths
13220
13271
  */
13221
- function merge(x, y, opts = {}) {
13222
- if (!('recurse' in opts)) opts.recurse = 8;
13223
- switch (Array.isArray(x) + Array.isArray(y)) {
13224
- case 0: // no array
13225
- if (opts.recurse && x && y && typeof x == 'object' && typeof y == 'object') {
13226
- opts.recurse--;
13227
- for (let k in y) x[k] = merge(x[k], y[k], opts);
13228
- opts.recurse++;
13229
- return x;
13272
+ function clean(dir, pattern = null, opts = {}) {
13273
+ if (pattern && typeof pattern == 'string') pattern = new RegExp(pattern);
13274
+ let {
13275
+ recursive = false,
13276
+ types = {file: true},
13277
+ } = opts;
13278
+ return fsp__namespace.readdir(dir, {recursive, withFileTypes: true}).then(files => {
13279
+ let tasks = [];
13280
+ for (let i = 0; i < files.length; i++) {
13281
+ let f = files[i];
13282
+ if (!types.any) {
13283
+ if (f.isFile()) {
13284
+ if (!types.file) continue;
13285
+ } else if (f.isDirectory()) {
13286
+ if (!types.dir) continue;
13287
+ } else if (f.isSymbolicLink()) {
13288
+ if (!types.symlink) continue;
13289
+ }
13290
+ }
13291
+ f = path.join(dir, f.name);
13292
+ if (pattern && !f.match(pattern)) continue;
13293
+ tasks.push(fsp__namespace.rm(f, {force: true, recursive: true}).then(() => f));
13230
13294
  }
13231
- case 1: // 1 array
13232
- return y;
13233
- }
13234
- // 2 arrays
13235
- switch (opts.mergeArrays) {
13236
- case true:
13237
- for (let i = 0; i < y.length; i++) {
13238
- if (!x.includes(y[i])) x.push(y[i]);
13295
+ return tasks.length ? Promise.all(tasks) : false;
13296
+ });
13297
+ }
13298
+
13299
+ /**
13300
+ * Copies the given file(s) to another directory
13301
+ * @param {string|object|string[]|object[]} src
13302
+ * @param {string} dst Base destination directory
13303
+ * @return {Promise}
13304
+ */
13305
+ function copy(src, dst) {
13306
+ return Promise.all((Array.isArray(src) ? src : [src]).map(item => {
13307
+ let _src, _dst;
13308
+ switch (typeof item) {
13309
+ case 'object':
13310
+ _src = item.src;
13311
+ _dst = item.dst;
13312
+ break;
13313
+ case 'string':
13314
+ _src = item;
13315
+ break;
13316
+ default:
13317
+ throw 'invalid type';
13239
13318
  }
13240
- return x;
13241
- case 'push':
13242
- x.push(...y);
13243
- return x;
13244
- case 'concat':
13245
- return x.concat(y);
13246
- }
13247
- return y;
13319
+ _dst = path.join(dst, _dst || path.basename(_src));
13320
+ return fsp__namespace.mkdir(path.dirname(_dst), {recursive: true}).then(fsp__namespace.copyFile(_src, _dst));
13321
+ }));
13248
13322
  }
13249
13323
 
13324
+ /**
13325
+ * Returns a Transform stream object with the given function as its transform() method.
13326
+ * `fn` must return a string which is to be the new content, or a Promise which resolves a string.
13327
+ *
13328
+ * @example
13329
+ * return gulp.src(src)
13330
+ * .pipe(modifyStream((data, enc) => {
13331
+ * // do stuff
13332
+ * return newData;
13333
+ * }));
13334
+ *
13335
+ * @param {function} fn
13336
+ * @return {Transform}
13337
+ */
13338
+ function modifyStream(fn) {
13339
+ return new node_stream.Transform({
13340
+ objectMode: true,
13341
+ transform(file, enc, done) {
13342
+ let r = fn(file.contents.toString(enc), enc);
13343
+ if (r instanceof Promise) {
13344
+ r.then(modified => {
13345
+ file.contents = Buffer.from(modified, enc);
13346
+ this.push(file);
13347
+ done();
13348
+ });
13349
+ } else {
13350
+ file.contents = Buffer.from(r, enc);
13351
+ this.push(file);
13352
+ done();
13353
+ }
13354
+ }
13355
+ });
13356
+ }var io=/*#__PURE__*/Object.freeze({__proto__:null,AssetImporter:AssetImporter,clean:clean,copy:copy,ext:ext,find:find,home:home,modifyStream:modifyStream,untilde:untilde});
13357
+
13250
13358
  /**
13251
13359
  * File I/O manager.
13252
13360
  */
@@ -13608,7 +13716,7 @@ function requireBundle () {
13608
13716
  if (r.modifiers) r.modifiers.mandatory = _mods.mandatory;
13609
13717
  else r.modifiers = _mods.mandatory;
13610
13718
  }
13611
- return opts ? merge(r, opts, {mergeArrays: true}) : r;
13719
+ return opts ? merge$1(r, opts, {mergeArrays: true}) : r;
13612
13720
  }
13613
13721
 
13614
13722
  /**
@@ -13730,6 +13838,44 @@ function requireBundle () {
13730
13838
  };
13731
13839
  }
13732
13840
 
13841
+ function var_touch(area = undefined) {
13842
+ let areas = {
13843
+ 'left_half_area': /^left/i,
13844
+ 'right_half_area': /^right/i,
13845
+ 'upper_half_area': /^(?:up|uppper|top)/i,
13846
+ 'lower_half_area': /^(?:low|lower|bottom)/i,
13847
+ };
13848
+ if (area) {
13849
+ for (let k in areas) {
13850
+ if (areas[k].test(area)) {
13851
+ area = k;
13852
+ break;
13853
+ }
13854
+ }
13855
+ } else area = 'total';
13856
+ return `multitouch_extension_finger_count_${area}`;
13857
+ }
13858
+
13859
+ /**
13860
+ * Returns an object with `type: 'variable_if'` property for Multitouch Extension, which can be passed to {@link Rule#cond} as a condition.
13861
+ * @param {string} count - finger count
13862
+ * @param {string} [area] - area to check (top/right/bottom/left)
13863
+ * @return {object} an object like: `{ type: 'variable_if', ... }`
13864
+ */
13865
+ function if_touched(count, area = undefined) {
13866
+ return if_var(var_touch(area), count);
13867
+ }
13868
+
13869
+ /**
13870
+ * Returns an object with `type: 'variable_unless'` property for Multitouch Extension, which can be passed to {@link Rule#cond} as a condition.
13871
+ * @param {string} count - finger count
13872
+ * @param {string} [area] - area to check (top/right/bottom/left)
13873
+ * @return {object} an object like: `{ type: 'variable_unless', ... }`
13874
+ */
13875
+ function unless_touched(count, area = undefined) {
13876
+ return unless_var(var_touch(area), count);
13877
+ }
13878
+
13733
13879
  /**
13734
13880
  * @typedef {object|string} Keymap
13735
13881
  * A keymap definition which can be passed to {@link Rule#remap} as `from` or `to` properties.
@@ -13817,7 +13963,7 @@ function requireBundle () {
13817
13963
  remap(map) {
13818
13964
  if (!map.type) map.type = 'basic';
13819
13965
  if (this.conds.length) map = Object.assign(map, {conditions: this.conds});
13820
- map = clean(remapSanitizer.sanitize(map));
13966
+ map = clean$1(remapSanitizer.sanitize(map));
13821
13967
  if (isEmpty(map)) console.warn(`Rule.remap: empty argument`);
13822
13968
  else this.remaps.push(map);
13823
13969
  return this;
@@ -13839,7 +13985,7 @@ function requireBundle () {
13839
13985
  * .remap( ... );
13840
13986
  */
13841
13987
  cond(cond) {
13842
- cond = clean(cond);
13988
+ cond = clean$1(cond);
13843
13989
  if (isEmpty(cond)) console.warn(`Rule.cond: empty argument`);
13844
13990
  else this.conds.push(cond);
13845
13991
  return this;
@@ -14174,22 +14320,24 @@ function requireBundle () {
14174
14320
  }
14175
14321
  }
14176
14322
 
14177
- bundle.Config = Config;
14178
- bundle.IO = IO;
14179
- bundle.Rule = Rule;
14180
- bundle.RuleSet = RuleSet;
14181
- bundle.click = click;
14182
- bundle.if_app = if_app;
14183
- bundle.if_lang = if_lang;
14184
- bundle.if_var = if_var;
14185
- bundle.key = key;
14186
- bundle.set_var = set_var;
14187
- bundle.unless_app = unless_app;
14188
- bundle.unless_lang = unless_lang;
14189
- bundle.unless_var = unless_var;
14190
- return bundle;
14323
+ karabinerge.Config = Config;
14324
+ karabinerge.IO = IO;
14325
+ karabinerge.Rule = Rule;
14326
+ karabinerge.RuleSet = RuleSet;
14327
+ karabinerge.click = click;
14328
+ karabinerge.if_app = if_app;
14329
+ karabinerge.if_lang = if_lang;
14330
+ karabinerge.if_touched = if_touched;
14331
+ karabinerge.if_var = if_var;
14332
+ karabinerge.key = key;
14333
+ karabinerge.set_var = set_var;
14334
+ karabinerge.unless_app = unless_app;
14335
+ karabinerge.unless_lang = unless_lang;
14336
+ karabinerge.unless_touched = unless_touched;
14337
+ karabinerge.unless_var = unless_var;
14338
+ return karabinerge;
14191
14339
  }var name = "keycomfort";
14192
- var version = "0.3.0";
14340
+ var version = "0.4.0";
14193
14341
  var description = "Comfortable keyboard remaps for Karabiner/AutoHotKey";
14194
14342
  var require$$9 = {
14195
14343
  name: name,
@@ -14206,7 +14354,8 @@ function requireRules () {
14206
14354
  set_var,
14207
14355
  if_var, unless_var,
14208
14356
  if_lang, unless_lang,
14209
- } = requireBundle();
14357
+ if_touched, unless_touched,
14358
+ } = requireKarabinerge();
14210
14359
 
14211
14360
  const modding = if_var('keycomfort_layer', 1);
14212
14361
  const any = {optional: 'any'};
@@ -14768,6 +14917,30 @@ function requireRules () {
14768
14917
  });
14769
14918
  },
14770
14919
 
14920
+ 'l-click'(c, r) {
14921
+ r.cond(if_touched(1))
14922
+ .remap({
14923
+ from: key(c.from, any),
14924
+ to: {pointing_button: c.to}
14925
+ });
14926
+ },
14927
+
14928
+ 'r-click'(c, r) {
14929
+ r.cond(if_touched(1))
14930
+ .remap({
14931
+ from: key(c.from, any),
14932
+ to: {pointing_button: c.to}
14933
+ });
14934
+ },
14935
+
14936
+ 'm-click'(c, r) {
14937
+ r.cond(if_touched(1))
14938
+ .remap({
14939
+ from: key(c.from, any),
14940
+ to: {pointing_button: c.to}
14941
+ });
14942
+ },
14943
+
14771
14944
  };
14772
14945
 
14773
14946
  rules_1 = rules;
@@ -14789,7 +14962,7 @@ function requireMain () {
14789
14962
  const {
14790
14963
  RuleSet, Config,
14791
14964
  if_app, unless_app,
14792
- } = requireBundle();
14965
+ } = requireKarabinerge();
14793
14966
 
14794
14967
  /*!
14795
14968
  * === KEYCOMFORT === *
@@ -14822,7 +14995,7 @@ function requireMain () {
14822
14995
 
14823
14996
  const pkg = require$$9;
14824
14997
  const rules = requireRules();
14825
- const defaultsYML = "# === KEYCOMFORT CONFIG ===\n# NOTE:\n# 0 means \"No\"\n# 1 means \"Yes\"\n\npaths:\n karabiner:\n save_as: ~/.config/karabiner/assets/complex_modifications/keycomfort.json\n apply_to: ~/.config/karabiner/karabiner.json\n ahk:\n save_as: ~/Desktop/keycomfort.ahk\n apply_to:\n\nvim_like: 0 # prefer vim-like mappings?\n\nrules: # mapping rules\n\n modifier:\n desc: Use [key] as a special modifier key (Required)\n enable: 1\n key: spacebar\n alone: spacebar\n\n cancel modifier:\n desc: Cancel modifier (<modifier>) with [key]\n enable: 1\n key: left_shift\n\n disable modifier:\n desc: Disable modifier (<modifier>) with <modifier> + [key]\n enable: 1\n key: right_shift + escape\n\n enable modifier:\n desc: Enable modifier (<modifier>) with [key]\n enable: 1\n key: right_shift + escape\n\n arrows:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Up / Right / Down / Left\n enable: 1\n up: e\n right: f\n down: d\n left: s\n\n page up/down:\n desc: <modifier> + { [up] / [down] } = Page Up / Down\n enable: 1\n up: w\n down: r\n\n prev/next word:\n desc: <modifier> + { [prev] / [next] } = Prev / Next Word\n enable: 1\n prev: a\n next: g\n apps:\n sonicpi: 1\n others: 1\n\n line start/end:\n desc: <modifier> + { [start] / [end] } = Line Start / End\n enable: 1\n start: q\n end: t\n apps:\n terminal: 1\n sonicpi: 1\n others: 1\n\n select:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Select Up / Right / Down / Left\n enable: 1\n up: i\n right: l\n down: k\n left: j\n vim:\n left: h\n down: j\n up: k\n right: l\n\n indent/outdent:\n desc: <modifier> + { [indent] / [outdent] } = Indent / Outdent\n enable: 1\n indent: o\n outdent: u\n\n backspace/delete:\n desc: <modifier> + { [backspace] / [delete] } = Backspace / Delete\n enable: 1\n backspace: n\n delete: m\n\n delete word:\n desc: <modifier> + [key] = Delete Word\n enable: 1\n key: b\n\n edit:\n desc: <modifier> + { [undo] / [cut] / [copy] / [paste] } = Undo / Cut / Copy / Paste\n enable: 1\n undo: z\n cut: x\n copy: c\n paste: v\n\n delete line:\n desc: <modifier> + [key] = Delete Line\n enable: 1\n key: shift + m\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n insert line:\n desc: <modifier> + [key] = New Line Below\n enable: 1\n key: return_or_enter\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n move line:\n desc: <modifier> + { [up] / [down] } = Move Line Up / Down\n enable: 1\n up: shift + i\n down: shift + k\n vim:\n up: shift + k\n down: shift + j\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n sonicpi: 1\n\n left/right tab:\n desc: <modifier> + { [left] / [right] } = Left / Right Tab\n enable: 1\n left: 2\n right: 3\n apps:\n vscode: 1\n eclipse: 1\n others: 1\n\n close/open tab:\n desc: <modifier> + { [close] / [open] } = Close / Open Tab\n enable: 1\n close: 1\n open: 4\n\n numpad:\n desc: <modifier> + [trigger] = Numpad Mode ([num1]=1, [num5]=5, [num9]=9)\n enable: 1\n trigger: left_control\n\n num0: b\n num1: n\n num2: m\n num3: comma\n\n num4: j\n num5: k\n num6: l\n\n num7: u\n num8: i\n num9: o\n\n slash: 8\n asterisk: 9\n hyphen: 0\n plus: p\n\n enter: slash\n delete: semicolon\n backspace: h\n\n plus/minus:\n desc: <modifier> + { [plus] / [minus] } = Plus / Minus\n enable: 1\n plus: p\n minus: shift + p\n to:\n plus: shift + equal_sign\n minus: hyphen\n\n backslash:\n desc: <modifier> + [from] = Backslash\n enable: 1\n from: slash\n to: backslash\n\n backtick:\n desc: <modifier> + [from] = Backtick\n enable: 1\n from: quote\n to: grave_accent_and_tilde\n\n tilde:\n desc: <modifier> + [from] = Tilde\n enable: 1\n from: hyphen\n to: shift + grave_accent_and_tilde\n\n pipe:\n desc: <modifier> + [from] = Pipe\n enable: 1\n from: 7\n to: shift + backslash\n\n equal:\n desc: <modifier> + [from] = Equal Sign\n enable: 1\n from: semicolon\n to: equal_sign\n\n enter:\n desc: <modifier> + [from] = Enter\n enable: 1\n from: tab\n to: return_or_enter\n\n underscore:\n desc: <modifier> + [from] = Underscore\n enable: 1\n from: period\n to: shift + hyphen\n\n custom:\n desc: <modifier> + Custom Keys\n enable: 1\n rules:\n # Examples\n # - from: p\n # to: shift + equal_sign\n\n remap capslock:\n desc: Caps Lock = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap l-control:\n desc: Left Control = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap r-control:\n desc: Right Control = [to] / [alone]\n enable: 0\n to: right_control\n alone: escape\n\n remap l-command:\n desc: Left Command = [to] / [alone]\n enable: 0\n to: left_command\n alone: left_command\n\n remap r-command:\n desc: Right Command = [to] / [alone]\n enable: 0\n to: right_command\n alone: right_command\n\n remap l-shift:\n desc: Left Shift = [to] / [alone]\n enable: 0\n to: left_shift\n alone: left_shift\n\n remap r-shift:\n desc: Right Shift = [to] / [alone]\n enable: 0\n to: right_shift\n alone: right_shift\n\n\napps:\n others:\n enable: 1\n\n login:\n enable: 1\n id:\n - com.apple.loginwindow\n\n terminal:\n enable: 1\n id:\n - com.apple.Terminal\n - com.googlecode.iterm2\n - org.alacritty\n exe:\n - cmd.exe\n\n vscode:\n enable: 0\n id:\n - com.microsoft.VSCode\n - com.vscodium\n exe:\n - Code.exe\n\n atom:\n enable: 0\n id:\n - com.github.atom\n - dev.pulsar-edit.pulsar\n\n eclipse:\n enable: 0\n id:\n - org.eclipse.platform.ide\n exe:\n - eclipse.exe\n\n sonicpi:\n enable: 0\n id:\n - net.sonic-pi.app\n\n\nkey_labels: # display names for key codes\n spacebar: Space\n return_or_enter: Enter\n grave_accent_and_tilde: Backtick\n japanese_eisuu: 英数\n japanese_kana: かな\n\n";
14998
+ const defaultsYML = "# === KEYCOMFORT CONFIG ===\n# NOTE:\n# 0 means \"No\"\n# 1 means \"Yes\"\n\npaths:\n karabiner:\n save_as: ~/.config/karabiner/assets/complex_modifications/keycomfort.json\n apply_to: ~/.config/karabiner/karabiner.json\n ahk:\n save_as: ~/Desktop/keycomfort.ahk\n apply_to:\n\nvim_like: 0 # prefer vim-like mappings?\n\nrules: # mapping rules\n\n modifier:\n desc: Use [key] as a special modifier key (Required)\n enable: 1\n key: spacebar\n alone: spacebar\n\n cancel modifier:\n desc: Cancel modifier (<modifier>) with [key]\n enable: 1\n key: left_shift\n\n disable modifier:\n desc: Disable modifier (<modifier>) with <modifier> + [key]\n enable: 1\n key: right_shift + escape\n\n enable modifier:\n desc: Enable modifier (<modifier>) with [key]\n enable: 1\n key: right_shift + escape\n\n arrows:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Up / Right / Down / Left\n enable: 1\n up: e\n right: f\n down: d\n left: s\n\n page up/down:\n desc: <modifier> + { [up] / [down] } = Page Up / Down\n enable: 1\n up: w\n down: r\n\n prev/next word:\n desc: <modifier> + { [prev] / [next] } = Prev / Next Word\n enable: 1\n prev: a\n next: g\n apps:\n sonicpi: 1\n others: 1\n\n line start/end:\n desc: <modifier> + { [start] / [end] } = Line Start / End\n enable: 1\n start: q\n end: t\n apps:\n terminal: 1\n sonicpi: 1\n others: 1\n\n select:\n desc: <modifier> + { [up] / [right] / [down] / [left] } = Select Up / Right / Down / Left\n enable: 1\n up: i\n right: l\n down: k\n left: j\n vim:\n left: h\n down: j\n up: k\n right: l\n\n indent/outdent:\n desc: <modifier> + { [indent] / [outdent] } = Indent / Outdent\n enable: 1\n indent: o\n outdent: u\n\n backspace/delete:\n desc: <modifier> + { [backspace] / [delete] } = Backspace / Delete\n enable: 1\n backspace: n\n delete: m\n\n delete word:\n desc: <modifier> + [key] = Delete Word\n enable: 1\n key: b\n\n edit:\n desc: <modifier> + { [undo] / [cut] / [copy] / [paste] } = Undo / Cut / Copy / Paste\n enable: 1\n undo: z\n cut: x\n copy: c\n paste: v\n\n delete line:\n desc: <modifier> + [key] = Delete Line\n enable: 1\n key: shift + m\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n insert line:\n desc: <modifier> + [key] = New Line Below\n enable: 1\n key: return_or_enter\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n\n move line:\n desc: <modifier> + { [up] / [down] } = Move Line Up / Down\n enable: 1\n up: shift + i\n down: shift + k\n vim:\n up: shift + k\n down: shift + j\n apps:\n atom: 1\n vscode: 1\n eclipse: 1\n sonicpi: 1\n\n left/right tab:\n desc: <modifier> + { [left] / [right] } = Left / Right Tab\n enable: 1\n left: 2\n right: 3\n apps:\n vscode: 1\n eclipse: 1\n others: 1\n\n close/open tab:\n desc: <modifier> + { [close] / [open] } = Close / Open Tab\n enable: 1\n close: 1\n open: 4\n\n numpad:\n desc: <modifier> + [trigger] = Numpad Mode ([num1]=1, [num5]=5, [num9]=9)\n enable: 1\n trigger: left_control\n\n num0: b\n num1: n\n num2: m\n num3: comma\n\n num4: j\n num5: k\n num6: l\n\n num7: u\n num8: i\n num9: o\n\n slash: 8\n asterisk: 9\n hyphen: 0\n plus: p\n\n enter: slash\n delete: semicolon\n backspace: h\n\n plus/minus:\n desc: <modifier> + { [plus] / [minus] } = Plus / Minus\n enable: 1\n plus: p\n minus: shift + p\n to:\n plus: shift + equal_sign\n minus: hyphen\n\n backslash:\n desc: <modifier> + [from] = Backslash\n enable: 1\n from: slash\n to: backslash\n\n backtick:\n desc: <modifier> + [from] = Backtick\n enable: 1\n from: quote\n to: grave_accent_and_tilde\n\n tilde:\n desc: <modifier> + [from] = Tilde\n enable: 1\n from: hyphen\n to: shift + grave_accent_and_tilde\n\n pipe:\n desc: <modifier> + [from] = Pipe\n enable: 1\n from: 7\n to: shift + backslash\n\n equal:\n desc: <modifier> + [from] = Equal Sign\n enable: 1\n from: semicolon\n to: equal_sign\n\n enter:\n desc: <modifier> + [from] = Enter\n enable: 1\n from: tab\n to: return_or_enter\n\n underscore:\n desc: <modifier> + [from] = Underscore\n enable: 1\n from: period\n to: shift + hyphen\n\n custom:\n desc: <modifier> + Custom Keys\n enable: 1\n rules:\n # Examples\n # - from: p\n # to: shift + equal_sign\n\n remap capslock:\n desc: Caps Lock = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap l-control:\n desc: Left Control = [to] / [alone]\n enable: 1\n to: left_control\n alone: escape\n\n remap r-control:\n desc: Right Control = [to] / [alone]\n enable: 0\n to: right_control\n alone: escape\n\n remap l-command:\n desc: Left Command = [to] / [alone]\n enable: 0\n to: left_command\n alone: left_command\n\n remap r-command:\n desc: Right Command = [to] / [alone]\n enable: 0\n to: right_command\n alone: right_command\n\n remap l-shift:\n desc: Left Shift = [to] / [alone]\n enable: 0\n to: left_shift\n alone: left_shift\n\n remap r-shift:\n desc: Right Shift = [to] / [alone]\n enable: 0\n to: right_shift\n alone: right_shift\n\n l-click:\n desc: (MultiTouchExtension) Touchpad + [from] = [to]\n enable: 1\n from: j\n to: button1\n\n r-click:\n desc: (MultiTouchExtension) Touchpad + [from] = [to]\n enable: 1\n from: l\n to: button2\n\n m-click:\n desc: (MultiTouchExtension) Touchpad + [from] = [to]\n enable: 1\n from: k\n to: button3\n\n\napps:\n others:\n enable: 1\n\n login:\n enable: 1\n id:\n - com.apple.loginwindow\n\n terminal:\n enable: 1\n id:\n - com.apple.Terminal\n - com.googlecode.iterm2\n - org.alacritty\n exe:\n - cmd.exe\n\n vscode:\n enable: 0\n id:\n - com.microsoft.VSCode\n - com.vscodium\n exe:\n - Code.exe\n\n atom:\n enable: 0\n id:\n - com.github.atom\n - dev.pulsar-edit.pulsar\n\n eclipse:\n enable: 0\n id:\n - org.eclipse.platform.ide\n exe:\n - eclipse.exe\n\n sonicpi:\n enable: 0\n id:\n - net.sonic-pi.app\n\n\nkey_labels: # display names for key codes\n spacebar: Space\n return_or_enter: Enter\n grave_accent_and_tilde: Backtick\n button1: Left Click\n button2: Right Click\n button3: Middle Click\n japanese_eisuu: 英数\n japanese_kana: かな\n\n";
14826
14999
  const defaults = yaml.parse(defaultsYML);
14827
15000
  const defaultConfig = loc(io.home, '.config', 'keycomfort', 'config.yml');
14828
15001
 
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "keycomfort",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Comfortable keyboard remaps for Karabiner/AutoHotKey",
5
5
  "files": [
6
- "dist/bundle.js"
6
+ "dist/keycomfort.js"
7
7
  ],
8
8
  "bin": {
9
- "keycomfort": "./dist/bundle.js"
9
+ "keycomfort": "./dist/keycomfort.js"
10
10
  },
11
11
  "scripts": {
12
12
  "dev": "rollup -c --watch",
13
13
  "test": "echo noop",
14
- "build": "rollup -c && chmod +x ./dist/bundle.js",
14
+ "build": "rollup -c && chmod +x ./dist/keycomfort.js",
15
15
  "clean": "rm -rf ./dist",
16
16
  "dist": "npm run clean; NODE_ENV=production npm run build"
17
17
  },
@@ -37,7 +37,7 @@
37
37
  "@rollup/plugin-node-resolve": "^16.0.3",
38
38
  "@rollup/plugin-replace": "^6.0.3",
39
39
  "commander": "^14.0.2",
40
- "karabinerge": "^2.1.0",
40
+ "karabinerge": "^2.2.1",
41
41
  "yaml": "^2.8.2"
42
42
  }
43
43
  }