@zipify/wysiwyg 1.1.1 → 1.2.1-1

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.
Files changed (176) hide show
  1. package/.github/actions/lint-css/action.yaml +1 -3
  2. package/.release-it.json +2 -1
  3. package/dist/cli.js +3 -3
  4. package/dist/wysiwyg.css +24 -25
  5. package/dist/wysiwyg.mjs +641 -618
  6. package/jest.config.js +3 -0
  7. package/lib/components/base/Modal.vue +21 -2
  8. package/lib/components/base/__tests__/Modal.test.js +1 -0
  9. package/lib/components/toolbar/controls/link/LinkControl.vue +22 -10
  10. package/lib/components/toolbar/controls/link/LinkControlHeader.vue +3 -3
  11. package/lib/components/toolbar/controls/link/__tests__/LinkControl.test.js +8 -8
  12. package/lib/components/toolbar/controls/link/__tests__/LinkControlHeader.test.js +1 -1
  13. package/lib/components/toolbar/controls/link/composables/useLink.js +10 -6
  14. package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +1 -1
  15. package/lib/composables/useEditor.js +4 -3
  16. package/lib/enums/TextSettings.js +2 -0
  17. package/lib/extensions/FontStyle.js +2 -2
  18. package/lib/extensions/FontWeight.js +2 -0
  19. package/lib/extensions/Link.js +13 -15
  20. package/lib/extensions/StylePreset.js +33 -3
  21. package/lib/extensions/TextDecoration.js +6 -12
  22. package/lib/extensions/__tests__/FontFamily.test.js +7 -6
  23. package/lib/extensions/__tests__/FontWeight.test.js +19 -10
  24. package/lib/extensions/__tests__/StylePreset.test.js +52 -2
  25. package/lib/extensions/__tests__/TextDecoration.test.js +11 -40
  26. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +2 -2
  27. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +1 -1
  28. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +1 -1
  29. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +19 -1
  30. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +2 -2
  31. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +17 -1
  32. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +26 -1
  33. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +2 -2
  34. package/lib/extensions/__tests__/__snapshots__/Margin.test.js.snap +2 -2
  35. package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +22 -2
  36. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +3 -46
  37. package/package.json +22 -22
  38. package/lib/components/toolbar/controls/link/LinkControlApply.vue +0 -35
  39. package/node_modules_lambda/acorn-globals/node_modules/.bin/acorn +0 -4
  40. package/node_modules_lambda/acorn-globals/node_modules/acorn/CHANGELOG.md +0 -620
  41. package/node_modules_lambda/acorn-globals/node_modules/acorn/LICENSE +0 -21
  42. package/node_modules_lambda/acorn-globals/node_modules/acorn/README.md +0 -269
  43. package/node_modules_lambda/acorn-globals/node_modules/acorn/bin/acorn +0 -4
  44. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.d.ts +0 -209
  45. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js +0 -5186
  46. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js.map +0 -1
  47. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs +0 -5155
  48. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.d.ts +0 -2
  49. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.map +0 -1
  50. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/bin.js +0 -64
  51. package/node_modules_lambda/acorn-globals/node_modules/acorn/package.json +0 -35
  52. package/node_modules_lambda/cssstyle/node_modules/cssom/LICENSE.txt +0 -20
  53. package/node_modules_lambda/cssstyle/node_modules/cssom/README.mdown +0 -67
  54. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSDocumentRule.js +0 -39
  55. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSFontFaceRule.js +0 -36
  56. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSHostRule.js +0 -37
  57. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSImportRule.js +0 -132
  58. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframeRule.js +0 -37
  59. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframesRule.js +0 -39
  60. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSMediaRule.js +0 -41
  61. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSOM.js +0 -3
  62. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSRule.js +0 -43
  63. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleDeclaration.js +0 -148
  64. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleRule.js +0 -190
  65. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleSheet.js +0 -88
  66. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSSupportsRule.js +0 -36
  67. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValue.js +0 -43
  68. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValueExpression.js +0 -344
  69. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MatcherList.js +0 -62
  70. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MediaList.js +0 -61
  71. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/StyleSheet.js +0 -17
  72. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/clone.js +0 -82
  73. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/index.js +0 -21
  74. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/parse.js +0 -464
  75. package/node_modules_lambda/cssstyle/node_modules/cssom/package.json +0 -18
  76. package/node_modules_lambda/data-urls/node_modules/whatwg-url/LICENSE.txt +0 -21
  77. package/node_modules_lambda/data-urls/node_modules/whatwg-url/README.md +0 -106
  78. package/node_modules_lambda/data-urls/node_modules/whatwg-url/index.js +0 -27
  79. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/Function.js +0 -42
  80. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL-impl.js +0 -209
  81. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL.js +0 -442
  82. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams-impl.js +0 -130
  83. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams.js +0 -472
  84. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/VoidFunction.js +0 -26
  85. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/encoding.js +0 -16
  86. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/infra.js +0 -26
  87. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/percent-encoding.js +0 -142
  88. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/url-state-machine.js +0 -1244
  89. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/urlencoded.js +0 -106
  90. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/utils.js +0 -190
  91. package/node_modules_lambda/data-urls/node_modules/whatwg-url/package.json +0 -58
  92. package/node_modules_lambda/data-urls/node_modules/whatwg-url/webidl2js-wrapper.js +0 -7
  93. package/node_modules_lambda/escodegen/node_modules/estraverse/.jshintrc +0 -16
  94. package/node_modules_lambda/escodegen/node_modules/estraverse/LICENSE.BSD +0 -19
  95. package/node_modules_lambda/escodegen/node_modules/estraverse/README.md +0 -153
  96. package/node_modules_lambda/escodegen/node_modules/estraverse/estraverse.js +0 -805
  97. package/node_modules_lambda/escodegen/node_modules/estraverse/gulpfile.js +0 -70
  98. package/node_modules_lambda/escodegen/node_modules/estraverse/package.json +0 -40
  99. package/node_modules_lambda/escodegen/node_modules/levn/LICENSE +0 -22
  100. package/node_modules_lambda/escodegen/node_modules/levn/README.md +0 -196
  101. package/node_modules_lambda/escodegen/node_modules/levn/lib/cast.js +0 -298
  102. package/node_modules_lambda/escodegen/node_modules/levn/lib/coerce.js +0 -285
  103. package/node_modules_lambda/escodegen/node_modules/levn/lib/index.js +0 -22
  104. package/node_modules_lambda/escodegen/node_modules/levn/lib/parse-string.js +0 -113
  105. package/node_modules_lambda/escodegen/node_modules/levn/lib/parse.js +0 -102
  106. package/node_modules_lambda/escodegen/node_modules/levn/package.json +0 -47
  107. package/node_modules_lambda/escodegen/node_modules/optionator/CHANGELOG.md +0 -56
  108. package/node_modules_lambda/escodegen/node_modules/optionator/LICENSE +0 -22
  109. package/node_modules_lambda/escodegen/node_modules/optionator/README.md +0 -238
  110. package/node_modules_lambda/escodegen/node_modules/optionator/lib/help.js +0 -260
  111. package/node_modules_lambda/escodegen/node_modules/optionator/lib/index.js +0 -465
  112. package/node_modules_lambda/escodegen/node_modules/optionator/lib/util.js +0 -54
  113. package/node_modules_lambda/escodegen/node_modules/optionator/package.json +0 -44
  114. package/node_modules_lambda/escodegen/node_modules/prelude-ls/CHANGELOG.md +0 -99
  115. package/node_modules_lambda/escodegen/node_modules/prelude-ls/LICENSE +0 -22
  116. package/node_modules_lambda/escodegen/node_modules/prelude-ls/README.md +0 -15
  117. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Func.js +0 -65
  118. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/List.js +0 -686
  119. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Num.js +0 -130
  120. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Obj.js +0 -154
  121. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Str.js +0 -92
  122. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/index.js +0 -178
  123. package/node_modules_lambda/escodegen/node_modules/prelude-ls/package.json +0 -52
  124. package/node_modules_lambda/escodegen/node_modules/source-map/CHANGELOG.md +0 -301
  125. package/node_modules_lambda/escodegen/node_modules/source-map/LICENSE +0 -28
  126. package/node_modules_lambda/escodegen/node_modules/source-map/README.md +0 -742
  127. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.debug.js +0 -3234
  128. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.js +0 -3233
  129. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js +0 -2
  130. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js.map +0 -1
  131. package/node_modules_lambda/escodegen/node_modules/source-map/lib/array-set.js +0 -121
  132. package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64-vlq.js +0 -140
  133. package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64.js +0 -67
  134. package/node_modules_lambda/escodegen/node_modules/source-map/lib/binary-search.js +0 -111
  135. package/node_modules_lambda/escodegen/node_modules/source-map/lib/mapping-list.js +0 -79
  136. package/node_modules_lambda/escodegen/node_modules/source-map/lib/quick-sort.js +0 -114
  137. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  138. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-generator.js +0 -425
  139. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-node.js +0 -413
  140. package/node_modules_lambda/escodegen/node_modules/source-map/lib/util.js +0 -488
  141. package/node_modules_lambda/escodegen/node_modules/source-map/package.json +0 -73
  142. package/node_modules_lambda/escodegen/node_modules/source-map/source-map.d.ts +0 -98
  143. package/node_modules_lambda/escodegen/node_modules/source-map/source-map.js +0 -8
  144. package/node_modules_lambda/escodegen/node_modules/type-check/LICENSE +0 -22
  145. package/node_modules_lambda/escodegen/node_modules/type-check/README.md +0 -210
  146. package/node_modules_lambda/escodegen/node_modules/type-check/lib/check.js +0 -126
  147. package/node_modules_lambda/escodegen/node_modules/type-check/lib/index.js +0 -16
  148. package/node_modules_lambda/escodegen/node_modules/type-check/lib/parse-type.js +0 -196
  149. package/node_modules_lambda/escodegen/node_modules/type-check/package.json +0 -40
  150. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  151. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/Changelog.md +0 -212
  152. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/LICENSE +0 -21
  153. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/README.md +0 -130
  154. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
  155. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
  156. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/index.js +0 -23
  157. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/internal.js +0 -198
  158. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  159. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  160. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
  161. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  162. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  163. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  164. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  165. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  166. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  167. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  168. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  169. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf16.js +0 -197
  170. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf32.js +0 -319
  171. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf7.js +0 -290
  172. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  173. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.d.ts +0 -41
  174. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.js +0 -180
  175. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/streams.js +0 -109
  176. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/package.json +0 -44
@@ -1,465 +0,0 @@
1
- // Generated by LiveScript 1.6.0
2
- (function(){
3
- var VERSION, ref$, id, map, compact, any, groupBy, partition, chars, isItNaN, keys, Obj, camelize, deepIs, closestString, nameToRaw, dasherize, naturalJoin, generateHelp, generateHelpForOption, parsedTypeCheck, parseType, parseLevn, camelizeKeys, parseString, main, toString$ = {}.toString, slice$ = [].slice, arrayFrom$ = Array.from || function(x){return slice$.call(x);};
4
- VERSION = '0.8.3';
5
- ref$ = require('prelude-ls'), id = ref$.id, map = ref$.map, compact = ref$.compact, any = ref$.any, groupBy = ref$.groupBy, partition = ref$.partition, chars = ref$.chars, isItNaN = ref$.isItNaN, keys = ref$.keys, Obj = ref$.Obj, camelize = ref$.camelize;
6
- deepIs = require('deep-is');
7
- ref$ = require('./util'), closestString = ref$.closestString, nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin;
8
- ref$ = require('./help'), generateHelp = ref$.generateHelp, generateHelpForOption = ref$.generateHelpForOption;
9
- ref$ = require('type-check'), parsedTypeCheck = ref$.parsedTypeCheck, parseType = ref$.parseType;
10
- parseLevn = require('levn').parsedTypeParse;
11
- camelizeKeys = function(obj){
12
- var key, value, resultObj$ = {};
13
- for (key in obj) {
14
- value = obj[key];
15
- resultObj$[camelize(key)] = value;
16
- }
17
- return resultObj$;
18
- };
19
- parseString = function(string){
20
- var assignOpt, regex, replaceRegex, result;
21
- assignOpt = '--?[a-zA-Z][-a-z-A-Z0-9]*=';
22
- regex = RegExp('(?:' + assignOpt + ')?(?:\'(?:\\\\\'|[^\'])+\'|"(?:\\\\"|[^"])+")|[^\'"\\s]+', 'g');
23
- replaceRegex = RegExp('^(' + assignOpt + ')?[\'"]([\\s\\S]*)[\'"]$');
24
- result = map(function(it){
25
- return it.replace(replaceRegex, '$1$2');
26
- }, string.match(regex) || []);
27
- return result;
28
- };
29
- main = function(libOptions){
30
- var opts, defaults, required, traverse, getOption, parse;
31
- opts = {};
32
- defaults = {};
33
- required = [];
34
- if (toString$.call(libOptions.stdout).slice(8, -1) === 'Undefined') {
35
- libOptions.stdout = process.stdout;
36
- }
37
- libOptions.positionalAnywhere == null && (libOptions.positionalAnywhere = true);
38
- libOptions.typeAliases == null && (libOptions.typeAliases = {});
39
- libOptions.defaults == null && (libOptions.defaults = {});
40
- if (libOptions.concatRepeatedArrays != null) {
41
- libOptions.defaults.concatRepeatedArrays = libOptions.concatRepeatedArrays;
42
- }
43
- if (libOptions.mergeRepeatedObjects != null) {
44
- libOptions.defaults.mergeRepeatedObjects = libOptions.mergeRepeatedObjects;
45
- }
46
- traverse = function(options){
47
- var i$, len$, option, name, k, ref$, v, type, that, e, parsedPossibilities, parsedType, j$, len1$, possibility, rawDependsType, dependsOpts, dependsType, cra, alias, shortNames, longNames;
48
- if (toString$.call(options).slice(8, -1) !== 'Array') {
49
- throw new Error('No options defined.');
50
- }
51
- for (i$ = 0, len$ = options.length; i$ < len$; ++i$) {
52
- option = options[i$];
53
- if (option.heading == null) {
54
- name = option.option;
55
- if (opts[name] != null) {
56
- throw new Error("Option '" + name + "' already defined.");
57
- }
58
- for (k in ref$ = libOptions.defaults) {
59
- v = ref$[k];
60
- option[k] == null && (option[k] = v);
61
- }
62
- if (option.type === 'Boolean') {
63
- option.boolean == null && (option.boolean = true);
64
- }
65
- if (option.parsedType == null) {
66
- if (!option.type) {
67
- throw new Error("No type defined for option '" + name + "'.");
68
- }
69
- try {
70
- type = (that = libOptions.typeAliases[option.type]) != null
71
- ? that
72
- : option.type;
73
- option.parsedType = parseType(type);
74
- } catch (e$) {
75
- e = e$;
76
- throw new Error("Option '" + name + "': Error parsing type '" + option.type + "': " + e.message);
77
- }
78
- }
79
- if (option['default']) {
80
- try {
81
- defaults[name] = parseLevn(option.parsedType, option['default']);
82
- } catch (e$) {
83
- e = e$;
84
- throw new Error("Option '" + name + "': Error parsing default value '" + option['default'] + "' for type '" + option.type + "': " + e.message);
85
- }
86
- }
87
- if (option['enum'] && !option.parsedPossiblities) {
88
- parsedPossibilities = [];
89
- parsedType = option.parsedType;
90
- for (j$ = 0, len1$ = (ref$ = option['enum']).length; j$ < len1$; ++j$) {
91
- possibility = ref$[j$];
92
- try {
93
- parsedPossibilities.push(parseLevn(parsedType, possibility));
94
- } catch (e$) {
95
- e = e$;
96
- throw new Error("Option '" + name + "': Error parsing enum value '" + possibility + "' for type '" + option.type + "': " + e.message);
97
- }
98
- }
99
- option.parsedPossibilities = parsedPossibilities;
100
- }
101
- if (that = option.dependsOn) {
102
- if (that.length) {
103
- ref$ = [].concat(option.dependsOn), rawDependsType = ref$[0], dependsOpts = slice$.call(ref$, 1);
104
- dependsType = rawDependsType.toLowerCase();
105
- if (dependsOpts.length) {
106
- if (dependsType === 'and' || dependsType === 'or') {
107
- option.dependsOn = [dependsType].concat(arrayFrom$(dependsOpts));
108
- } else {
109
- throw new Error("Option '" + name + "': If you have more than one dependency, you must specify either 'and' or 'or'");
110
- }
111
- } else {
112
- if ((ref$ = dependsType.toLowerCase()) === 'and' || ref$ === 'or') {
113
- option.dependsOn = null;
114
- } else {
115
- option.dependsOn = ['and', rawDependsType];
116
- }
117
- }
118
- } else {
119
- option.dependsOn = null;
120
- }
121
- }
122
- if (option.required) {
123
- required.push(name);
124
- }
125
- opts[name] = option;
126
- if (option.concatRepeatedArrays != null) {
127
- cra = option.concatRepeatedArrays;
128
- if ('Boolean' === toString$.call(cra).slice(8, -1)) {
129
- option.concatRepeatedArrays = [cra, {}];
130
- } else if (cra.length === 1) {
131
- option.concatRepeatedArrays = [cra[0], {}];
132
- } else if (cra.length !== 2) {
133
- throw new Error("Invalid setting for concatRepeatedArrays");
134
- }
135
- }
136
- if (option.alias || option.aliases) {
137
- if (name === 'NUM') {
138
- throw new Error("-NUM option can't have aliases.");
139
- }
140
- if (option.alias) {
141
- option.aliases == null && (option.aliases = [].concat(option.alias));
142
- }
143
- for (j$ = 0, len1$ = (ref$ = option.aliases).length; j$ < len1$; ++j$) {
144
- alias = ref$[j$];
145
- if (opts[alias] != null) {
146
- throw new Error("Option '" + alias + "' already defined.");
147
- }
148
- opts[alias] = option;
149
- }
150
- ref$ = partition(fn$, option.aliases), shortNames = ref$[0], longNames = ref$[1];
151
- option.shortNames == null && (option.shortNames = shortNames);
152
- option.longNames == null && (option.longNames = longNames);
153
- }
154
- if ((!option.aliases || option.shortNames.length === 0) && option.type === 'Boolean' && option['default'] === 'true') {
155
- option.negateName = true;
156
- }
157
- }
158
- }
159
- function fn$(it){
160
- return it.length === 1;
161
- }
162
- };
163
- traverse(libOptions.options);
164
- getOption = function(name){
165
- var opt, possiblyMeant;
166
- opt = opts[name];
167
- if (opt == null) {
168
- possiblyMeant = closestString(keys(opts), name);
169
- throw new Error("Invalid option '" + nameToRaw(name) + "'" + (possiblyMeant ? " - perhaps you meant '" + nameToRaw(possiblyMeant) + "'?" : '.'));
170
- }
171
- return opt;
172
- };
173
- parse = function(input, arg$){
174
- var slice, obj, positional, restPositional, overrideRequired, prop, setValue, setDefaults, checkRequired, mutuallyExclusiveError, checkMutuallyExclusive, checkDependency, checkDependencies, checkProp, args, key, value, option, ref$, i$, len$, arg, that, result, short, argName, usingAssign, val, flags, len, j$, len1$, i, flag, opt, name, valPrime, negated, noedName;
175
- slice = (arg$ != null
176
- ? arg$
177
- : {}).slice;
178
- obj = {};
179
- positional = [];
180
- restPositional = false;
181
- overrideRequired = false;
182
- prop = null;
183
- setValue = function(name, value){
184
- var opt, val, cra, e, currentType;
185
- opt = getOption(name);
186
- if (opt.boolean) {
187
- val = value;
188
- } else {
189
- try {
190
- cra = opt.concatRepeatedArrays;
191
- if (cra != null && cra[0] && cra[1].oneValuePerFlag && opt.parsedType.length === 1 && opt.parsedType[0].structure === 'array') {
192
- val = [parseLevn(opt.parsedType[0].of, value)];
193
- } else {
194
- val = parseLevn(opt.parsedType, value);
195
- }
196
- } catch (e$) {
197
- e = e$;
198
- throw new Error("Invalid value for option '" + name + "' - expected type " + opt.type + ", received value: " + value + ".");
199
- }
200
- if (opt['enum'] && !any(function(it){
201
- return deepIs(it, val);
202
- }, opt.parsedPossibilities)) {
203
- throw new Error("Option " + name + ": '" + val + "' not one of " + naturalJoin(opt['enum']) + ".");
204
- }
205
- }
206
- currentType = toString$.call(obj[name]).slice(8, -1);
207
- if (obj[name] != null) {
208
- if (opt.concatRepeatedArrays != null && opt.concatRepeatedArrays[0] && currentType === 'Array') {
209
- obj[name] = obj[name].concat(val);
210
- } else if (opt.mergeRepeatedObjects && currentType === 'Object') {
211
- import$(obj[name], val);
212
- } else {
213
- obj[name] = val;
214
- }
215
- } else {
216
- obj[name] = val;
217
- }
218
- if (opt.restPositional) {
219
- restPositional = true;
220
- }
221
- if (opt.overrideRequired) {
222
- overrideRequired = true;
223
- }
224
- };
225
- setDefaults = function(){
226
- var name, ref$, value;
227
- for (name in ref$ = defaults) {
228
- value = ref$[name];
229
- if (obj[name] == null) {
230
- obj[name] = value;
231
- }
232
- }
233
- };
234
- checkRequired = function(){
235
- var i$, ref$, len$, name;
236
- if (overrideRequired) {
237
- return;
238
- }
239
- for (i$ = 0, len$ = (ref$ = required).length; i$ < len$; ++i$) {
240
- name = ref$[i$];
241
- if (!obj[name]) {
242
- throw new Error("Option " + nameToRaw(name) + " is required.");
243
- }
244
- }
245
- };
246
- mutuallyExclusiveError = function(first, second){
247
- throw new Error("The options " + nameToRaw(first) + " and " + nameToRaw(second) + " are mutually exclusive - you cannot use them at the same time.");
248
- };
249
- checkMutuallyExclusive = function(){
250
- var rules, i$, len$, rule, present, j$, len1$, element, k$, len2$, opt;
251
- rules = libOptions.mutuallyExclusive;
252
- if (!rules) {
253
- return;
254
- }
255
- for (i$ = 0, len$ = rules.length; i$ < len$; ++i$) {
256
- rule = rules[i$];
257
- present = null;
258
- for (j$ = 0, len1$ = rule.length; j$ < len1$; ++j$) {
259
- element = rule[j$];
260
- if (toString$.call(element).slice(8, -1) === 'Array') {
261
- for (k$ = 0, len2$ = element.length; k$ < len2$; ++k$) {
262
- opt = element[k$];
263
- if (opt in obj) {
264
- if (present != null) {
265
- mutuallyExclusiveError(present, opt);
266
- } else {
267
- present = opt;
268
- break;
269
- }
270
- }
271
- }
272
- } else {
273
- if (element in obj) {
274
- if (present != null) {
275
- mutuallyExclusiveError(present, element);
276
- } else {
277
- present = element;
278
- }
279
- }
280
- }
281
- }
282
- }
283
- };
284
- checkDependency = function(option){
285
- var dependsOn, type, targetOptionNames, i$, len$, targetOptionName, targetOption;
286
- dependsOn = option.dependsOn;
287
- if (!dependsOn || option.dependenciesMet) {
288
- return true;
289
- }
290
- type = dependsOn[0], targetOptionNames = slice$.call(dependsOn, 1);
291
- for (i$ = 0, len$ = targetOptionNames.length; i$ < len$; ++i$) {
292
- targetOptionName = targetOptionNames[i$];
293
- targetOption = obj[targetOptionName];
294
- if (targetOption && checkDependency(targetOption)) {
295
- if (type === 'or') {
296
- return true;
297
- }
298
- } else if (type === 'and') {
299
- throw new Error("The option '" + option.option + "' did not have its dependencies met.");
300
- }
301
- }
302
- if (type === 'and') {
303
- return true;
304
- } else {
305
- throw new Error("The option '" + option.option + "' did not meet any of its dependencies.");
306
- }
307
- };
308
- checkDependencies = function(){
309
- var name;
310
- for (name in obj) {
311
- checkDependency(opts[name]);
312
- }
313
- };
314
- checkProp = function(){
315
- if (prop) {
316
- throw new Error("Value for '" + prop + "' of type '" + getOption(prop).type + "' required.");
317
- }
318
- };
319
- switch (toString$.call(input).slice(8, -1)) {
320
- case 'String':
321
- args = parseString(input.slice(slice != null ? slice : 0));
322
- break;
323
- case 'Array':
324
- args = input.slice(slice != null ? slice : 2);
325
- break;
326
- case 'Object':
327
- obj = {};
328
- for (key in input) {
329
- value = input[key];
330
- if (key !== '_') {
331
- option = getOption(dasherize(key));
332
- if (parsedTypeCheck(option.parsedType, value)) {
333
- obj[option.option] = value;
334
- } else {
335
- throw new Error("Option '" + option.option + "': Invalid type for '" + value + "' - expected type '" + option.type + "'.");
336
- }
337
- }
338
- }
339
- checkMutuallyExclusive();
340
- checkDependencies();
341
- setDefaults();
342
- checkRequired();
343
- return ref$ = camelizeKeys(obj), ref$._ = input._ || [], ref$;
344
- default:
345
- throw new Error("Invalid argument to 'parse': " + input + ".");
346
- }
347
- for (i$ = 0, len$ = args.length; i$ < len$; ++i$) {
348
- arg = args[i$];
349
- if (arg === '--') {
350
- restPositional = true;
351
- } else if (restPositional) {
352
- positional.push(arg);
353
- } else {
354
- if (that = arg.match(/^(--?)([a-zA-Z][-a-zA-Z0-9]*)(=)?(.*)?$/)) {
355
- result = that;
356
- checkProp();
357
- short = result[1].length === 1;
358
- argName = result[2];
359
- usingAssign = result[3] != null;
360
- val = result[4];
361
- if (usingAssign && val == null) {
362
- throw new Error("No value for '" + argName + "' specified.");
363
- }
364
- if (short) {
365
- flags = chars(argName);
366
- len = flags.length;
367
- for (j$ = 0, len1$ = flags.length; j$ < len1$; ++j$) {
368
- i = j$;
369
- flag = flags[j$];
370
- opt = getOption(flag);
371
- name = opt.option;
372
- if (restPositional) {
373
- positional.push(flag);
374
- } else if (i === len - 1) {
375
- if (usingAssign) {
376
- valPrime = opt.boolean ? parseLevn([{
377
- type: 'Boolean'
378
- }], val) : val;
379
- setValue(name, valPrime);
380
- } else if (opt.boolean) {
381
- setValue(name, true);
382
- } else {
383
- prop = name;
384
- }
385
- } else if (opt.boolean) {
386
- setValue(name, true);
387
- } else {
388
- throw new Error("Can't set argument '" + flag + "' when not last flag in a group of short flags.");
389
- }
390
- }
391
- } else {
392
- negated = false;
393
- if (that = argName.match(/^no-(.+)$/)) {
394
- negated = true;
395
- noedName = that[1];
396
- opt = getOption(noedName);
397
- } else {
398
- opt = getOption(argName);
399
- }
400
- name = opt.option;
401
- if (opt.boolean) {
402
- valPrime = usingAssign ? parseLevn([{
403
- type: 'Boolean'
404
- }], val) : true;
405
- if (negated) {
406
- setValue(name, !valPrime);
407
- } else {
408
- setValue(name, valPrime);
409
- }
410
- } else {
411
- if (negated) {
412
- throw new Error("Only use 'no-' prefix for Boolean options, not with '" + noedName + "'.");
413
- }
414
- if (usingAssign) {
415
- setValue(name, val);
416
- } else {
417
- prop = name;
418
- }
419
- }
420
- }
421
- } else if (that = arg.match(/^-([0-9]+(?:\.[0-9]+)?)$/)) {
422
- opt = opts.NUM;
423
- if (!opt) {
424
- throw new Error('No -NUM option defined.');
425
- }
426
- setValue(opt.option, that[1]);
427
- } else {
428
- if (prop) {
429
- setValue(prop, arg);
430
- prop = null;
431
- } else {
432
- positional.push(arg);
433
- if (!libOptions.positionalAnywhere) {
434
- restPositional = true;
435
- }
436
- }
437
- }
438
- }
439
- }
440
- checkProp();
441
- checkMutuallyExclusive();
442
- checkDependencies();
443
- setDefaults();
444
- checkRequired();
445
- return ref$ = camelizeKeys(obj), ref$._ = positional, ref$;
446
- };
447
- return {
448
- parse: parse,
449
- parseArgv: function(it){
450
- return parse(it, {
451
- slice: 2
452
- });
453
- },
454
- generateHelp: generateHelp(libOptions),
455
- generateHelpForOption: generateHelpForOption(getOption, libOptions)
456
- };
457
- };
458
- main.VERSION = VERSION;
459
- module.exports = main;
460
- function import$(obj, src){
461
- var own = {}.hasOwnProperty;
462
- for (var key in src) if (own.call(src, key)) obj[key] = src[key];
463
- return obj;
464
- }
465
- }).call(this);
@@ -1,54 +0,0 @@
1
- // Generated by LiveScript 1.6.0
2
- (function(){
3
- var prelude, map, sortBy, fl, closestString, nameToRaw, dasherize, naturalJoin;
4
- prelude = require('prelude-ls'), map = prelude.map, sortBy = prelude.sortBy;
5
- fl = require('fast-levenshtein');
6
- closestString = function(possibilities, input){
7
- var distances, ref$, string, distance;
8
- if (!possibilities.length) {
9
- return;
10
- }
11
- distances = map(function(it){
12
- var ref$, longer, shorter;
13
- ref$ = input.length > it.length
14
- ? [input, it]
15
- : [it, input], longer = ref$[0], shorter = ref$[1];
16
- return {
17
- string: it,
18
- distance: fl.get(longer, shorter)
19
- };
20
- })(
21
- possibilities);
22
- ref$ = sortBy(function(it){
23
- return it.distance;
24
- }, distances)[0], string = ref$.string, distance = ref$.distance;
25
- return string;
26
- };
27
- nameToRaw = function(name){
28
- if (name.length === 1 || name === 'NUM') {
29
- return "-" + name;
30
- } else {
31
- return "--" + name;
32
- }
33
- };
34
- dasherize = function(string){
35
- if (/^[A-Z]/.test(string)) {
36
- return string;
37
- } else {
38
- return prelude.dasherize(string);
39
- }
40
- };
41
- naturalJoin = function(array){
42
- if (array.length < 3) {
43
- return array.join(' or ');
44
- } else {
45
- return array.slice(0, -1).join(', ') + ", or " + array[array.length - 1];
46
- }
47
- };
48
- module.exports = {
49
- closestString: closestString,
50
- nameToRaw: nameToRaw,
51
- dasherize: dasherize,
52
- naturalJoin: naturalJoin
53
- };
54
- }).call(this);
@@ -1,44 +0,0 @@
1
- {
2
- "name": "optionator",
3
- "version": "0.8.3",
4
- "author": "George Zahariev <z@georgezahariev.com>",
5
- "description": "option parsing and help generation",
6
- "homepage": "https://github.com/gkz/optionator",
7
- "keywords": [
8
- "options",
9
- "flags",
10
- "option parsing",
11
- "cli"
12
- ],
13
- "files": [
14
- "lib",
15
- "README.md",
16
- "LICENSE"
17
- ],
18
- "main": "./lib/",
19
- "bugs": "https://github.com/gkz/optionator/issues",
20
- "license": "MIT",
21
- "engines": {
22
- "node": ">= 0.8.0"
23
- },
24
- "repository": {
25
- "type": "git",
26
- "url": "git://github.com/gkz/optionator.git"
27
- },
28
- "scripts": {
29
- "test": "make test"
30
- },
31
- "dependencies": {
32
- "prelude-ls": "~1.1.2",
33
- "deep-is": "~0.1.3",
34
- "word-wrap": "~1.2.3",
35
- "type-check": "~0.3.2",
36
- "levn": "~0.3.0",
37
- "fast-levenshtein": "~2.0.6"
38
- },
39
- "devDependencies": {
40
- "livescript": "~1.6.0",
41
- "mocha": "~6.2.2",
42
- "istanbul": "~0.4.5"
43
- }
44
- }
@@ -1,99 +0,0 @@
1
- # 1.1.2
2
- - add `Func.memoize`
3
- - fix `zip-all` and `zip-with-all` corner case (no input)
4
- - build with LiveScript 1.4.0
5
-
6
- # 1.1.1
7
- - curry `unique-by`, `minimum-by`
8
-
9
- # 1.1.0
10
- - added `List` functions: `maximum-by`, `minimum-by`, `unique-by`
11
- - added `List` functions: `at`, `elem-index`, `elem-indices`, `find-index`, `find-indices`
12
- - added `Str` functions: `capitalize`, `camelize`, `dasherize`
13
- - added `Func` function: `over` - eg. ``same-length = (==) `over` (.length)``
14
- - exported `Str.repeat` through main `prelude` object
15
- - fixed definition of `foldr` and `foldr1`, the new correct definition is backwards incompatible with the old, incorrect one
16
- - fixed issue with `fix`
17
- - improved code coverage
18
-
19
- # 1.0.3
20
- - build browser versions
21
-
22
- # 1.0.2
23
- - bug fix for `flatten` - slight change with bug fix, flattens arrays only, not array-like objects
24
-
25
- # 1.0.1
26
- - bug fixes for `drop-while` and `take-while`
27
-
28
- # 1.0.0
29
- * massive update - separated functions into separate modules
30
- * functions do not accept multiple types anymore - use different versions in their respective modules in some cases (eg. `Obj.map`), or use `chars` or `values` in other cases to transform into a list
31
- * objects are no longer transformed into functions, simply use `(obj.)` in LiveScript to do that
32
- * browser version now using browserify - use `prelude = require('prelude-ls')`
33
- * added `compact`, `split`, `flatten`, `difference`, `intersection`, `union`, `count-by`, `group-by`, `chars`, `unchars`, `apply`
34
- * added `lists-to-obj` which takes a list of keys and list of values and zips them up into an object, and the converse `obj-to-lists`
35
- * added `pairs-to-obj` which takes a list of pairs (2 element lists) and creates an object, and the converse `obj-to-pairs`
36
- * removed `cons`, `append` - use the concat operator
37
- * removed `compose` - use the compose operator
38
- * removed `obj-to-func` - use partially applied access (eg. `(obj.)`)
39
- * removed `length` - use `(.length)`
40
- * `sort-by` renamed to `sort-with`
41
- * added new `sort-by`
42
- * removed `compare` - just use the new `sort-by`
43
- * `break-it` renamed `break-list`, (`Str.break-str` for the string version)
44
- * added `Str.repeat` which creates a new string by repeating the input n times
45
- * `unfold` as alias to `unfoldr` is no longer used
46
- * fixed up style and compiled with LiveScript 1.1.1
47
- * use Make instead of Slake
48
- * greatly improved tests
49
-
50
- # 0.6.0
51
- * fixed various bugs
52
- * added `fix`, a fixpoint (Y combinator) for anonymous recursive functions
53
- * added `unfoldr` (alias `unfold`)
54
- * calling `replicate` with a string now returns a list of strings
55
- * removed `partial`, just use native partial application in LiveScript using the `_` placeholder, or currying
56
- * added `sort`, `sortBy`, and `compare`
57
-
58
- # 0.5.0
59
- * removed `lookup` - use (.prop)
60
- * removed `call` - use (.func arg1, arg2)
61
- * removed `pluck` - use map (.prop), xs
62
- * fixed buys wtih `head` and `last`
63
- * added non-minifed browser version, as `prelude-browser.js`
64
- * renamed `prelude-min.js` to `prelude-browser-min.js`
65
- * renamed `zip` to `zipAll`
66
- * renamed `zipWith` to `zipAllWith`
67
- * added `zip`, a curried zip that takes only two arguments
68
- * added `zipWith`, a curried zipWith that takes only two arguments
69
-
70
- # 0.4.0
71
- * added `parition` function
72
- * added `curry` function
73
- * removed `elem` function (use `in`)
74
- * removed `notElem` function (use `not in`)
75
-
76
- # 0.3.0
77
- * added `listToObject`
78
- * added `unique`
79
- * added `objToFunc`
80
- * added support for using strings in map and the like
81
- * added support for using objects in map and the like
82
- * added ability to use objects instead of functions in certain cases
83
- * removed `error` (just use throw)
84
- * added `tau` constant
85
- * added `join`
86
- * added `values`
87
- * added `keys`
88
- * added `partial`
89
- * renamed `log` to `ln`
90
- * added alias to `head`: `first`
91
- * added `installPrelude` helper
92
-
93
- # 0.2.0
94
- * removed functions that simply warp operators as you can now use operators as functions in LiveScript
95
- * `min/max` are now curried and take only 2 arguments
96
- * added `call`
97
-
98
- # 0.1.0
99
- * initial public release
@@ -1,22 +0,0 @@
1
- Copyright (c) George Zahariev
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.