@twobirds/microcomponents 0.0.44 → 0.0.46

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 (57) hide show
  1. package/dist/MC.min.js +7 -56
  2. package/dist/microcomponents.min.js +1 -1
  3. package/dist/observables.d.ts.map +1 -1
  4. package/dist/observables.min.js +1 -1
  5. package/dist/observables.ts +7 -16
  6. package/dist/test.ts +1 -5
  7. package/package.json +1 -1
  8. package/public/MC.js +7 -52
  9. package/public/MC.js.map +1 -1
  10. package/public/MC.min.js +7 -56
  11. package/public/McEvent.js +0 -4
  12. package/public/McEvent.js.map +1 -1
  13. package/public/assets/search.js +1 -1
  14. package/public/autoloader.js +1 -6
  15. package/public/autoloader.js.map +1 -1
  16. package/public/classes/MC.DC.html +18 -23
  17. package/public/classes/MC.MC.html +12 -17
  18. package/public/classes/MC.McBase.html +4 -4
  19. package/public/classes/MC.McEvent.html +13 -13
  20. package/public/formValues.js +3 -19
  21. package/public/formValues.js.map +1 -1
  22. package/public/functions/MC.addListener.html +1 -1
  23. package/public/functions/MC.removeListener.html +1 -1
  24. package/public/functions/elements.defineCE.html +1 -1
  25. package/public/functions/elements.getCE.html +1 -1
  26. package/public/functions/formValues.formValues.html +1 -1
  27. package/public/functions/observables.observe.html +1 -1
  28. package/public/functions/selectors._d.html +1 -1
  29. package/public/functions/selectors._t.html +1 -1
  30. package/public/helpers.js +4 -5
  31. package/public/helpers.js.map +1 -1
  32. package/public/interfaces/MC.HTMLMcElement.html +2 -2
  33. package/public/interfaces/selectors.DSelector.html +55 -55
  34. package/public/interfaces/selectors.TSelector.html +37 -37
  35. package/public/microcomponents.es3.js +15 -61
  36. package/public/microcomponents.es3.js.map +1 -1
  37. package/public/microcomponents.min.js +1 -1
  38. package/public/modules/MC.html +1 -1
  39. package/public/modules/elements.html +1 -1
  40. package/public/modules/formValues.html +1 -1
  41. package/public/modules/observables.html +1 -1
  42. package/public/modules/selectors.html +1 -1
  43. package/public/observables.js +12 -56
  44. package/public/observables.js.map +1 -1
  45. package/public/observables.min.js +1 -1
  46. package/public/selectors.js +7 -125
  47. package/public/selectors.js.map +1 -1
  48. package/public/src/observables.ts +7 -16
  49. package/public/src/test.ts +1 -5
  50. package/public/test.js +6 -30
  51. package/public/test.js.map +1 -1
  52. package/public/types/observables.Observable.html +1 -1
  53. package/public/types/selectors.selection.html +1 -1
  54. package/public/types/selectors.singleSelector.html +1 -1
  55. package/src/observables.ts +7 -16
  56. package/src/test.ts +1 -5
  57. package/tsconfig.json +97 -101
package/public/test.js CHANGED
@@ -6,23 +6,20 @@ class Translator extends DC {
6
6
  Translation = {};
7
7
  constructor(target, translations, translationTargetObject) {
8
8
  super(target);
9
- let that = this; // minifier help
10
- // state
9
+ let that = this;
11
10
  that.Language = 'en';
12
11
  that.Translation = {};
13
12
  observe(that);
14
- // setup
15
13
  that.#translations = translations;
16
- // state
17
14
  that.Language.observe((lang) => {
18
15
  if (that.#translations.hasOwnProperty(lang)) {
19
- that.Translation = { lang: that.#translations[lang] }; // set translation
16
+ that.Translation = { lang: that.#translations[lang] };
20
17
  }
21
18
  });
22
19
  that.Translation.bind(translationTargetObject);
23
20
  this.target.setAttribute('language', 'en');
24
21
  this.Language.notify();
25
- delete that._mc; // cleanup, not needed
22
+ delete that._mc;
26
23
  }
27
24
  onAttributeChanged(ev) {
28
25
  if (!ev.data.newValue)
@@ -35,9 +32,7 @@ class Translator extends DC {
35
32
  }
36
33
  }
37
34
  }
38
- defineCE(
39
- // equivalent to custom element registry .define()
40
- 'my-tag', class MyTag extends DC {
35
+ defineCE('my-tag', class MyTag extends DC {
41
36
  #template = '<button>{lang.click} {counter}</button>';
42
37
  #languages = {
43
38
  en: {
@@ -50,25 +45,17 @@ defineCE(
50
45
  Dom = {};
51
46
  constructor(target) {
52
47
  super(target);
53
- let that = this; // minifier help
54
- // render
48
+ let that = this;
55
49
  target.innerHTML = this.#template;
56
- // add public translator
57
50
  DC.add(target, 'translator', new Translator(target, that.#languages, target));
58
- delete that._mc; // cleanup, not needed
51
+ delete that._mc;
59
52
  }
60
53
  oneInit(ev) {
61
54
  let that = this;
62
- // state
63
55
  that.Dom = { counter: 0 };
64
- // state: convert all props defined so far into observables
65
56
  observe(that);
66
- // bind Dom to target
67
57
  that.Dom.bind(that.target);
68
58
  }
69
- onAttributeChanged(ev) {
70
- this.target._mc.translator.Language = ev.data.newValue;
71
- }
72
59
  onClick(ev) {
73
60
  const that = this, c = this.Dom.counter++;
74
61
  ev.data.stopPropagation();
@@ -77,28 +64,17 @@ defineCE(
77
64
  }
78
65
  }, ['language']);
79
66
  let MyTag = getCE('my-tag'), fragment = new DocumentFragment();
80
- /*
81
- stress test
82
- */
83
67
  let start = new Date().getTime();
84
- // create 100 elements
85
68
  for (let x = 0; x < 1000; x++) {
86
69
  fragment.append(new MyTag());
87
70
  }
88
71
  let end = new Date().getTime();
89
- // and put them into the DOM
90
72
  document.body.appendChild(fragment);
91
- //document.querySelectorAll('my-tag').forEach((e) => e.remove());
92
- /*
93
- console test
94
- */
95
73
  setTimeout(() => {
96
- // console.clear();
97
74
  console.log('%c \n\nStress Test:\n\n %cInstancing 1000 web components (3000 classes): %c %s ms.', 'font-weight: bold; color: black;', 'font-weight: normal;', 'font-weight: bold; color: blue;', end - start);
98
75
  document.body.appendChild(new MyTag());
99
76
  let element = document.querySelector('my-tag');
100
77
  console.log("\n\n%cInspect this tag:%c \n( ...to see the inner structure in the '._mc' property )\n\n %O %c %s", 'font-weight: bold;', 'font-weight: normal;', element, 'font-weight: bold;', '\n\nLook up code in the debugger: test.js\n\n');
101
- // will trigger the event on all micro components contained in <my-tag>
102
78
  DC.trigger(element, 'doSomething');
103
79
  }, 500);
104
80
  //# sourceMappingURL=test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAEN,EAAE,EAEF,QAAQ,EACR,KAAK,EACL,OA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ACnG,oBAAoB,EACpB,sBAAsB,EACtB,OAAO,EACP,oBAAoB,EACpB,+CAA+C,CAC/C,CAAC;IAGF,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACpC,CAAC,EAAE,GAAG,CAAC,CAAC"}
@@ -55,7 +55,7 @@
55
55
  <h5>cb: <span class="tsd-signature-type">Callback</span></h5></li></ul></div>
56
56
  <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></li></ul></div><aside class="tsd-sources">
57
57
  <ul>
58
- <li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/a01d81a/src/observables.ts#L169">src/observables.ts:169</a></li></ul></aside></div>
58
+ <li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/b10756d/src/observables.ts#L185">src/observables.ts:185</a></li></ul></aside></div>
59
59
  <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
60
60
  <div class="tsd-navigation settings">
61
61
  <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
@@ -18,7 +18,7 @@
18
18
  <h1>Type alias selection</h1></div>
19
19
  <div class="tsd-signature">selection<span class="tsd-signature-symbol">:</span> <a href="selectors.singleSelector.html" class="tsd-signature-type" data-tsd-kind="Type alias">singleSelector</a><span class="tsd-signature-symbol"> | </span><a href="selectors.singleSelector.html" class="tsd-signature-type" data-tsd-kind="Type alias">singleSelector</a><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources">
20
20
  <ul>
21
- <li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/a01d81a/src/selectors.ts#L1634">src/selectors.ts:1634</a></li></ul></aside></div>
21
+ <li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/b10756d/src/selectors.ts#L1634">src/selectors.ts:1634</a></li></ul></aside></div>
22
22
  <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
23
23
  <div class="tsd-navigation settings">
24
24
  <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
@@ -18,7 +18,7 @@
18
18
  <h1>Type alias singleSelector</h1></div>
19
19
  <div class="tsd-signature">single<wbr/>Selector<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ShadowRoot</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLElement</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCollection</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">NodeList</span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/selectors.DSelector.html" class="tsd-signature-type" data-tsd-kind="Interface">DSelector</a><span class="tsd-signature-symbol"> | </span><a href="../classes/MC.MC.html" class="tsd-signature-type" data-tsd-kind="Class">MC</a><span class="tsd-signature-symbol"> | </span><a href="../classes/MC.DC.html" class="tsd-signature-type" data-tsd-kind="Class">DC</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/selectors.TSelector.html" class="tsd-signature-type" data-tsd-kind="Interface">TSelector</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span></div><aside class="tsd-sources">
20
20
  <ul>
21
- <li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/a01d81a/src/selectors.ts#L1632">src/selectors.ts:1632</a></li></ul></aside></div>
21
+ <li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/b10756d/src/selectors.ts#L1632">src/selectors.ts:1632</a></li></ul></aside></div>
22
22
  <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
23
23
  <div class="tsd-navigation settings">
24
24
  <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
@@ -70,10 +70,6 @@ class Placeholders extends DC {
70
70
  let that = this;
71
71
  getPlaceholders(target).forEach((property) => (that.data[property] = ''));
72
72
  observe(that);
73
- that.oldDisplay = target.style.display;
74
- if (!inputs.includes((target as any).constructor)) {
75
- target.style.display = 'none';
76
- }
77
73
  that.#attachCallbacks();
78
74
  delete that._mc; // cleanup, not needed
79
75
  }
@@ -145,6 +141,12 @@ class Placeholders extends DC {
145
141
  childNode.nodeValue = result;
146
142
  })(childNode.nodeValue)
147
143
  );
144
+
145
+ // hide for now
146
+ that.oldDisplay = target.getAttribute('style)') || '';
147
+ if (!inputs.includes((target as any).constructor)) {
148
+ target.style.display = 'none';
149
+ }
148
150
  });
149
151
  }
150
152
 
@@ -226,7 +228,6 @@ export const observe = (target: LooseObject, propertyName?: string) => {
226
228
  (this.constructor as LooseObject).callbacks = [];
227
229
  if (isObservableObject(val)) {
228
230
  // you cannot bind native values to the dom
229
- (this.constructor as LooseObject).bound = [];
230
231
  Object.getOwnPropertyNames(val).forEach((key) => {
231
232
  this[key] = val[key];
232
233
  });
@@ -274,18 +275,10 @@ export const observe = (target: LooseObject, propertyName?: string) => {
274
275
  that.valueOf() instanceof Array === false
275
276
  ? structuredClone(Object.assign({}, that))
276
277
  : that.valueOf();
277
- // console.log('notify', that.constructor, (that.constructor as any).callbacks.length, (that.constructor as any)?.bound?.length, data );
278
278
  (that.constructor as any).callbacks.forEach((f: Function) => {
279
279
  // console.log( 'callback', f, data);
280
280
  f(data);
281
281
  });
282
- if (isObservableObject(that.valueOf())) {
283
- // console.log('bound', this.constructor);
284
- (that.constructor as any).bound.forEach((f: Function) => {
285
- // console.log( 'bound', f, data);
286
- f(data);
287
- });
288
- }
289
282
  return this;
290
283
  }
291
284
  };
@@ -326,14 +319,12 @@ export const observe = (target: LooseObject, propertyName?: string) => {
326
319
 
327
320
  let hasFormHandler =
328
321
  (o.constructor as LooseObject)?.hasFormHandler ?? false,
329
- callbacks = (o.constructor as LooseObject).callbacks,
330
- bound = (o.constructor as LooseObject).bound;
322
+ callbacks = (o.constructor as LooseObject).callbacks;
331
323
  o = new Observable(structuredClone(Object.assign({}, val)));
332
324
 
333
325
  //console.log('after set o=', o, 'check', old);
334
326
  (o.constructor as LooseObject).callbacks = hasFormHandler;
335
327
  (o.constructor as LooseObject).callbacks = callbacks;
336
- (o.constructor as LooseObject).bound = bound;
337
328
 
338
329
  setTimeout(
339
330
  // check for changes
package/src/test.ts CHANGED
@@ -87,7 +87,7 @@ defineCE(
87
87
  // render
88
88
  target.innerHTML = this.#template;
89
89
 
90
- // add public translator
90
+ // add translator
91
91
  DC.add(
92
92
  target,
93
93
  'translator',
@@ -110,10 +110,6 @@ defineCE(
110
110
  (that.Dom as Observable).bind(that.target);
111
111
  }
112
112
 
113
- onAttributeChanged(ev: McEvent) {
114
- this.target._mc.translator.Language = ev.data.newValue;
115
- }
116
-
117
113
  onClick(ev: McEvent) {
118
114
  const that = this,
119
115
  c = this.Dom.counter++;
package/tsconfig.json CHANGED
@@ -1,111 +1,107 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
4
 
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- ///////"composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ ///////"composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
12
 
13
- /* Language and Environment */
14
- "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- // "jsx": "preserve", /* Specify what JSX code is generated. */
17
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
13
+ /* Language and Environment */
14
+ "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
26
 
27
- /* Modules */
28
- "module": "ESNext", /* Specify what module code is generated. */
29
- // "module": "commonjs", /* Specify what module code is generated. */
30
- // "rootDir": "./", /* Specify the root folder within your source files. */
31
- // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
32
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
35
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
36
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
37
- "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
38
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
39
- // "resolveJsonModule": true, /* Enable importing .json files. */
40
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
27
+ /* Modules */
28
+ "module": "ESNext" /* Specify what module code is generated. */,
29
+ // "module": "commonjs", /* Specify what module code is generated. */
30
+ // "rootDir": "./", /* Specify the root folder within your source files. */
31
+ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
32
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
35
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
36
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
37
+ "allowUmdGlobalAccess": true /* Allow accessing UMD globals from modules. */,
38
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
39
+ // "resolveJsonModule": true, /* Enable importing .json files. */
40
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
41
41
 
42
- /* JavaScript Support */
43
- "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
44
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
45
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
42
+ /* JavaScript Support */
43
+ "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
44
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
45
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
46
46
 
47
- /* Emit */
48
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
49
- "declarationMap": true, /* Create sourcemaps for d.ts files. */
50
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
51
- "sourceMap": true, /* Create source map files for emitted JavaScript files. */
52
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
53
- "outDir": "./build", /* Specify an output folder for all emitted files. */
54
- // "removeComments": true, /* Disable emitting comments. */
55
- // "noEmit": true, /* Disable emitting files from a compilation. */
56
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
57
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
58
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
59
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
60
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
61
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
62
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
63
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
64
- // "newLine": "crlf", /* Set the newline character for emitting files. */
65
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
66
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
67
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
68
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
69
- //"declarationDir": "./build/types", /* Specify the output directory for generated declaration files. */
70
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
47
+ /* Emit */
48
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
49
+ "declarationMap": true /* Create sourcemaps for d.ts files. */,
50
+ "removeComments": true,
51
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
52
+ "sourceMap": true /* Create source map files for emitted JavaScript files. */,
53
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
54
+ "outDir": "./build" /* Specify an output folder for all emitted files. */,
55
+ // "removeComments": true, /* Disable emitting comments. */
56
+ // "noEmit": true, /* Disable emitting files from a compilation. */
57
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
58
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
59
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
60
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
61
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
62
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
63
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
64
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
65
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
66
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
67
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
68
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
69
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
70
+ //"declarationDir": "./build/types", /* Specify the output directory for generated declaration files. */
71
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
71
72
 
72
- /* Interop Constraints */
73
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
74
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
75
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
76
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
77
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
73
+ /* Interop Constraints */
74
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
75
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
76
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
77
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
78
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
78
79
 
79
- /* Type Checking */
80
- "strict": true, /* Enable all strict type-checking options. */
81
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
82
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
83
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
84
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
85
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
86
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
87
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
88
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
89
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
90
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
91
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
92
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
93
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
94
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
95
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
96
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
97
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
98
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
80
+ /* Type Checking */
81
+ "strict": true /* Enable all strict type-checking options. */,
82
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
83
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
84
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
85
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
86
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
87
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
88
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
89
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
90
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
91
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
92
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
93
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
94
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
95
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
96
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
97
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
98
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
99
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
99
100
 
100
- /* Completeness */
101
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
102
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
103
- },
104
- "include": [
105
- "./src"
106
- ],
107
- "exclude": [
108
- "node_modules",
109
- "dist"
110
- ]
101
+ /* Completeness */
102
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
103
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
104
+ },
105
+ "include": ["./src"],
106
+ "exclude": ["node_modules", "dist"]
111
107
  }