@knowark/componarkjs 1.14.0 → 1.14.2

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 (102) hide show
  1. package/README.md +57 -45
  2. package/lib/base/component/README.md +127 -0
  3. package/lib/base/component/component.js +127 -21
  4. package/lib/base/component/component.test.js +296 -3
  5. package/lib/base/component/index.js +3 -0
  6. package/lib/base/styles/index.js +4 -1
  7. package/lib/base/utils/define.js +2 -1
  8. package/lib/base/utils/format.js +12 -6
  9. package/lib/base/utils/helpers.js +31 -5
  10. package/lib/base/utils/index.js +1 -0
  11. package/lib/base/utils/slots.js +3 -2
  12. package/lib/base/utils/uuid.js +1 -1
  13. package/lib/components/audio/components/audio.js +17 -2
  14. package/lib/components/audio/index.js +1 -0
  15. package/lib/components/audio/styles/index.js +5 -1
  16. package/lib/components/camera/components/camera.js +10 -0
  17. package/lib/components/camera/index.js +1 -0
  18. package/lib/components/camera/styles/index.js +5 -1
  19. package/lib/components/capture/components/capture.js +18 -2
  20. package/lib/components/capture/index.js +1 -0
  21. package/lib/components/droparea/components/droparea-preview.js +58 -13
  22. package/lib/components/droparea/components/droparea-preview.test.js +82 -0
  23. package/lib/components/droparea/components/droparea.js +41 -2
  24. package/lib/components/droparea/index.js +1 -0
  25. package/lib/components/droparea/styles/index.js +5 -1
  26. package/lib/components/emit/components/emit.js +11 -1
  27. package/lib/components/emit/index.js +1 -0
  28. package/lib/components/index.js +2 -1
  29. package/lib/components/list/components/item.js +6 -0
  30. package/lib/components/list/components/list.js +18 -4
  31. package/lib/components/list/index.js +1 -0
  32. package/lib/components/paginator/components/paginator.js +34 -8
  33. package/lib/components/paginator/index.js +1 -0
  34. package/lib/components/paginator/styles/index.js +5 -1
  35. package/lib/components/spinner/components/spinner.js +10 -0
  36. package/lib/components/spinner/index.js +1 -0
  37. package/lib/components/spinner/styles/index.js +5 -1
  38. package/lib/components/splitview/components/splitview.detail.js +10 -1
  39. package/lib/components/splitview/components/splitview.js +18 -3
  40. package/lib/components/splitview/components/splitview.master.js +10 -0
  41. package/lib/components/splitview/index.js +1 -0
  42. package/lib/components/translate/components/translate.js +42 -11
  43. package/lib/components/translate/components/translate.test.js +169 -1
  44. package/lib/components/translate/index.js +1 -0
  45. package/lib/index.js +3 -0
  46. package/package.json +2 -1
  47. package/tsconfig.json +1 -1
  48. package/types/base/component/component.d.ts +43 -8
  49. package/types/base/component/component.d.ts.map +1 -1
  50. package/types/base/component/index.d.ts +4 -6
  51. package/types/base/component/index.d.ts.map +1 -1
  52. package/types/base/styles/index.d.ts +3 -2
  53. package/types/base/styles/index.d.ts.map +1 -1
  54. package/types/base/utils/define.d.ts +3 -2
  55. package/types/base/utils/define.d.ts.map +1 -1
  56. package/types/base/utils/format.d.ts +12 -6
  57. package/types/base/utils/format.d.ts.map +1 -1
  58. package/types/base/utils/helpers.d.ts +27 -7
  59. package/types/base/utils/helpers.d.ts.map +1 -1
  60. package/types/base/utils/slots.d.ts +8 -10
  61. package/types/base/utils/slots.d.ts.map +1 -1
  62. package/types/base/utils/uuid.d.ts +1 -1
  63. package/types/base/utils/uuid.d.ts.map +1 -1
  64. package/types/components/audio/components/audio.d.ts +23 -9
  65. package/types/components/audio/components/audio.d.ts.map +1 -1
  66. package/types/components/audio/styles/index.d.ts +3 -2
  67. package/types/components/audio/styles/index.d.ts.map +1 -1
  68. package/types/components/camera/components/camera.d.ts +11 -3
  69. package/types/components/camera/components/camera.d.ts.map +1 -1
  70. package/types/components/camera/styles/index.d.ts +3 -2
  71. package/types/components/camera/styles/index.d.ts.map +1 -1
  72. package/types/components/capture/components/capture.d.ts +23 -3
  73. package/types/components/capture/components/capture.d.ts.map +1 -1
  74. package/types/components/droparea/components/droparea-preview.d.ts +64 -11
  75. package/types/components/droparea/components/droparea-preview.d.ts.map +1 -1
  76. package/types/components/droparea/components/droparea.d.ts +58 -13
  77. package/types/components/droparea/components/droparea.d.ts.map +1 -1
  78. package/types/components/droparea/styles/index.d.ts +3 -2
  79. package/types/components/droparea/styles/index.d.ts.map +1 -1
  80. package/types/components/emit/components/emit.d.ts +15 -3
  81. package/types/components/emit/components/emit.d.ts.map +1 -1
  82. package/types/components/list/components/item.d.ts +8 -1
  83. package/types/components/list/components/item.d.ts.map +1 -1
  84. package/types/components/list/components/list.d.ts +23 -5
  85. package/types/components/list/components/list.d.ts.map +1 -1
  86. package/types/components/paginator/components/paginator.d.ts +32 -8
  87. package/types/components/paginator/components/paginator.d.ts.map +1 -1
  88. package/types/components/paginator/styles/index.d.ts +3 -2
  89. package/types/components/paginator/styles/index.d.ts.map +1 -1
  90. package/types/components/spinner/components/spinner.d.ts +14 -3
  91. package/types/components/spinner/components/spinner.d.ts.map +1 -1
  92. package/types/components/spinner/styles/index.d.ts +3 -2
  93. package/types/components/spinner/styles/index.d.ts.map +1 -1
  94. package/types/components/splitview/components/splitview.d.ts +22 -4
  95. package/types/components/splitview/components/splitview.d.ts.map +1 -1
  96. package/types/components/splitview/components/splitview.detail.d.ts +12 -2
  97. package/types/components/splitview/components/splitview.detail.d.ts.map +1 -1
  98. package/types/components/splitview/components/splitview.master.d.ts +12 -1
  99. package/types/components/splitview/components/splitview.master.d.ts.map +1 -1
  100. package/types/components/translate/components/translate.d.ts +44 -10
  101. package/types/components/translate/components/translate.d.ts.map +1 -1
  102. package/lib/base/component/README.rst +0 -113
@@ -182,6 +182,27 @@ it('translates the page content on language changes', async () => {
182
182
  assert.deepStrictEqual(givenOptions, { language: 'en' })
183
183
  })
184
184
 
185
+ it('passes an undefined language when language change event has no target', async () => {
186
+ setup()
187
+ const translateContainer = document.createElement('div')
188
+ translateContainer.innerHTML = '<ark-translate></ark-translate>'
189
+ container.appendChild(translateContainer)
190
+ const translate = /** @type Translate **/ (
191
+ translateContainer.querySelector('ark-translate'))
192
+ let givenOptions = null
193
+
194
+ translate.transliterate = async (options) => {
195
+ givenOptions = options
196
+ }
197
+
198
+ await translate.onLanguageChanged({
199
+ stopPropagation: () => {},
200
+ target: null
201
+ })
202
+
203
+ assert.deepStrictEqual(givenOptions, { language: undefined })
204
+ })
205
+
185
206
  it('fetches its translation files from the server', async () => {
186
207
  setup();
187
208
  const root = document.createElement('div')
@@ -581,4 +602,151 @@ it('renders the translate component with an empty dictionary', async () => {
581
602
  </p>
582
603
  `
583
604
  assert.deepStrictEqual(root, expectedRoot)
584
- })
605
+ })
606
+
607
+ it('does not render language options for an empty language list', () => {
608
+ setup()
609
+ container.innerHTML = '<ark-translate languages=""></ark-translate>'
610
+ const translate = container.querySelector('ark-translate')
611
+
612
+ translate.init()
613
+
614
+ const select = translate.querySelector('select')
615
+ assert.equal(select, null)
616
+ })
617
+
618
+ it('does nothing when the configured transliterate root does not exist', async () => {
619
+ setup()
620
+ const root = document.createElement('div')
621
+ root.innerHTML = /* html */`
622
+ <span data-i18n="hello">Hello</span>
623
+ `
624
+ root.id = 'translations'
625
+ container.appendChild(root)
626
+ const translateContainer = document.createElement('div')
627
+ translateContainer.innerHTML = '<ark-translate></ark-translate>'
628
+ container.appendChild(translateContainer)
629
+ const translate = /** @type Translate **/ (
630
+ translateContainer.querySelector('ark-translate'))
631
+
632
+ let called = false
633
+ translate.resolveDictionary = async () => {
634
+ called = true
635
+ return {}
636
+ }
637
+
638
+ await translate.transliterate({ root: '#missing-root' })
639
+
640
+ assert.equal(called, false)
641
+ })
642
+
643
+ it('returns an empty dictionary when no fetch API is available', async () => {
644
+ setup()
645
+ const translateContainer = document.createElement('div')
646
+ translateContainer.innerHTML = '<ark-translate></ark-translate>'
647
+ container.appendChild(translateContainer)
648
+ const translate = /** @type Translate **/ (
649
+ translateContainer.querySelector('ark-translate'))
650
+
651
+ translate.init({ global: { document } })
652
+
653
+ const dictionary = await translate.resolveDictionary('es', 'default')
654
+ assert.deepStrictEqual(dictionary, {})
655
+ })
656
+
657
+ it('keeps original text when translation endpoint returns a non-ok response', async () => {
658
+ setup()
659
+ const root = document.createElement('div')
660
+ root.innerHTML = /* html */`
661
+ <span data-i18n="hello">Hello</span>
662
+ `
663
+ root.id = 'translate-root'
664
+ container.appendChild(root)
665
+ const translateContainer = document.createElement('div')
666
+ translateContainer.innerHTML = '<ark-translate languages="es"></ark-translate>'
667
+ container.appendChild(translateContainer)
668
+ const translate = /** @type Translate **/ (
669
+ translateContainer.querySelector('ark-translate'))
670
+ let requestedUrl = null
671
+
672
+ translate.init({
673
+ root: '#translate-root',
674
+ global: {
675
+ document,
676
+ fetch: async (url) => {
677
+ requestedUrl = url
678
+ return { ok: false }
679
+ }
680
+ }
681
+ })
682
+
683
+ await translate.transliterate({ language: 'es' })
684
+
685
+ assert.equal(requestedUrl, '/locales/es/default.json')
686
+ assert.equal(root.querySelector('[data-i18n="hello"]').textContent, 'Hello')
687
+ })
688
+
689
+ it('stores an empty dictionary cache entry when fetch returns null JSON', async () => {
690
+ setup()
691
+ const translateContainer = document.createElement('div')
692
+ translateContainer.innerHTML = '<ark-translate></ark-translate>'
693
+ container.appendChild(translateContainer)
694
+ const translate = /** @type Translate **/ (
695
+ translateContainer.querySelector('ark-translate'))
696
+
697
+ translate.init({
698
+ global: {
699
+ document,
700
+ fetch: async () => ({
701
+ ok: true,
702
+ json: async () => null
703
+ })
704
+ }
705
+ })
706
+
707
+ const dictionary = await translate.resolveDictionary('es', 'default')
708
+
709
+ assert.equal(dictionary, null)
710
+ assert.deepStrictEqual(translate.dictionary.es.default, {})
711
+ })
712
+
713
+ it('reuses cached dictionaries for repeated transliterations', async () => {
714
+ setup()
715
+ const root = document.createElement('div')
716
+ root.innerHTML = /* html */`
717
+ <span data-i18n="hello">Hello</span>
718
+ <span data-i18n="world">World</span>
719
+ `
720
+ root.id = 'translate-root'
721
+ container.appendChild(root)
722
+ const translateContainer = document.createElement('div')
723
+ translateContainer.innerHTML = '<ark-translate></ark-translate>'
724
+ container.appendChild(translateContainer)
725
+ const translate = /** @type Translate **/ (
726
+ translateContainer.querySelector('ark-translate'))
727
+
728
+ let fetchCalls = 0
729
+ translate.init({
730
+ root: '#translate-root',
731
+ global: {
732
+ document,
733
+ fetch: async () => {
734
+ fetchCalls += 1
735
+ return {
736
+ ok: true,
737
+ json: async () => ({
738
+ hello: 'Hola',
739
+ world: 'Mundo'
740
+ })
741
+ }
742
+ }
743
+ }
744
+ })
745
+
746
+ await translate.transliterate({ language: 'es' })
747
+ await translate.transliterate({ language: 'es' })
748
+
749
+ assert.equal(fetchCalls, 1)
750
+ assert.equal(root.querySelector('[data-i18n="hello"]').textContent, 'Hola')
751
+ assert.equal(root.querySelector('[data-i18n="world"]').textContent, 'Mundo')
752
+ })
@@ -1 +1,2 @@
1
+ /** Translation component. */
1
2
  export { Translate } from './components/translate.js'
package/lib/index.js CHANGED
@@ -1,2 +1,5 @@
1
+ /**
2
+ * @module componark
3
+ */
1
4
  export * from './base/index.js'
2
5
  export * from './components/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowark/componarkjs",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "author": "Knowark",
5
5
  "description": "Knowark's Web Components Library",
6
6
  "license": "ISC",
@@ -9,6 +9,7 @@
9
9
  "types": "types/index.d.ts",
10
10
  "scripts": {
11
11
  "test": "NODE_OPTIONS='--no-warnings' node --test --experimental-test-coverage --test-coverage-include='lib/**/*.js' --test-coverage-exclude='**/*.test.js' --import ./scripts/node-test-setup.js",
12
+ "types": "tsc -p tsconfig.json --emitDeclarationOnly false --noEmit --checkJs false",
12
13
  "dev": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' webpack serve --mode development --env development",
13
14
  "prod": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' webpack --mode production --env production"
14
15
  },
package/tsconfig.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "module": "nodenext",
6
6
  "moduleResolution": "nodenext",
7
7
  "allowJs": true,
8
- "checkJs": true,
8
+ "checkJs": false,
9
9
  "baseUrl": "lib",
10
10
  "declaration": true,
11
11
  "emitDeclarationOnly": true,
@@ -1,11 +1,22 @@
1
+ /**
2
+ * Base composable UI component.
3
+ * @extends {globalThis.HTMLElement}
4
+ */
1
5
  export class Component extends HTMLElement {
2
6
  /**
3
- * @param {string} tag
7
+ * Register a custom element and optional CSS for the same tag.
8
+ * @param {string} tagName
4
9
  * @param {CustomElementConstructor} element
5
- * @param {string} styles **/
6
- static define(tag: string, element: CustomElementConstructor, styles?: string): void;
10
+ * @param {string} [styles]
11
+ * @returns {void}
12
+ */
13
+ static define(tagName: string, element: CustomElementConstructor, styles?: string): void;
7
14
  binding: string;
8
15
  local: {};
16
+ _isConnected: boolean;
17
+ _cleanupCallbacks: any[];
18
+ _needsBinding: boolean;
19
+ global: typeof globalThis;
9
20
  /**
10
21
  * @param {object} styleMap
11
22
  * @return {string} **/
@@ -16,18 +27,24 @@ export class Component extends HTMLElement {
16
27
  init(context?: object): Component;
17
28
  /** @return {string[]} */
18
29
  reflectedProperties(): string[];
19
- get slots(): {
20
- [x: string]: HTMLElement[];
21
- };
30
+ get slots(): Record<string, HTMLElement[]>;
22
31
  /** @param {string} content */
23
32
  set content(content: string);
24
33
  /** @return {string} */
25
34
  get content(): string;
35
+ /** @returns {void} */
26
36
  connectedCallback(): void;
37
+ /** @returns {void} */
38
+ disconnectedCallback(): void;
39
+ /**
40
+ * @param {Function} callback
41
+ * @return {Function} */
42
+ registerCleanup(callback: Function): Function;
27
43
  /** @return {Component} */
28
44
  render(): Component;
29
- /** @param {object} context */
30
- load(context?: object): Promise<void>;
45
+ /** @param {object} context
46
+ * @returns {void | Promise<void>} */
47
+ load(context?: object): void | Promise<void>;
31
48
  /**
32
49
  * @param {string} selectors
33
50
  * @return {Component} */
@@ -44,5 +61,23 @@ export class Component extends HTMLElement {
44
61
  * @param {string} resource
45
62
  * @return {any} */
46
63
  resolve(resource: string): any;
64
+ /**
65
+ * @param {any} detail
66
+ * @param {string} phase
67
+ * @return {Error} */
68
+ _enhanceError(detail: any, phase: string): Error;
69
+ /** @returns {void} */
70
+ _cleanup(): void;
71
+ /**
72
+ * Creates an event object for dispatch.
73
+ * @param {string} type
74
+ * @param {any} detail
75
+ * @param {{ bubbles?: boolean, cancelable?: boolean }} [options]
76
+ * @returns {CustomEvent}
77
+ */
78
+ _createEvent(type: string, detail: any, options?: {
79
+ bubbles?: boolean;
80
+ cancelable?: boolean;
81
+ }): CustomEvent;
47
82
  }
48
83
  //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../lib/base/component/component.js"],"names":[],"mappings":"AAIA;IAQE;;;iCAG6B;IAC7B,mBAHW,MAAM,WACN,wBAAwB,WACxB,MAAM,QAGhB;IAXC,gBAAuB;IACvB,UAAe;IAYjB;;2BAEuB;IACvB,qBAFW,MAAM,GACL,MAAM,CAGjB;IAED;;6BAEyB;IACzB,eAFW,MAAM,GACL,SAAS,CAGpB;IAED,yBAAyB;IACzB,uBADa,MAAM,EAAE,CAGpB;IAED;;MAEC;IAED,8BAA8B;IAC9B,6BAEC;IAED,uBAAuB;IACvB,sBAEC;IAED,0BASC;IAED,0BAA0B;IAC1B,UADa,SAAS,CAKrB;IAED,8BAA8B;IAC9B,eADY,MAAM,iBACU;IAE5B;;6BAEyB;IACzB,kBAFW,MAAM,GACL,SAAS,CAGpB;IAED;;yCAEqC;IACrC,qBAFW,MAAM,GACL,UAAU,CAAC,SAAS,CAAC,CAKhC;IAED;;6BAEyB;IACzB,WAFW,MAAM,UACN,GAAG,QASb;IAED;;uBAEmB;IACnB,kBAFW,MAAM,GACL,GAAG,CASd;CACF"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../lib/base/component/component.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH;IAYE;;;;;;OAMG;IACH,uBALW,MAAM,WACN,wBAAwB,WACxB,MAAM,GACJ,IAAI,CAIhB;IAlBC,gBAAuB;IACvB,UAAe;IACf,sBAAyB;IACzB,yBAA2B;IAC3B,uBAAyB;IACzB,0BAAwB;IAe1B;;2BAEuB;IACvB,qBAFW,MAAM,GACL,MAAM,CAGjB;IAED;;6BAEyB;IACzB,eAFW,MAAM,GACL,SAAS,CAGpB;IAED,yBAAyB;IACzB,uBADa,MAAM,EAAE,CAGpB;IAED,2CAEC;IAED,8BAA8B;IAC9B,6BAGC;IAED,uBAAuB;IACvB,sBAEC;IAED,sBAAsB;IACtB,qBADc,IAAI,CAqBjB;IAED,sBAAsB;IACtB,wBADc,IAAI,CAIjB;IAED;;4BAEwB;IACxB,8CASC;IAED,0BAA0B;IAC1B,UADa,SAAS,CAQrB;IAED;yCACqC;IACrC,eAFY,MAAM,GACL,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CACX;IAEtB;;6BAEyB;IACzB,kBAFW,MAAM,GACL,SAAS,CAGpB;IAED;;yCAEqC;IACrC,qBAFW,MAAM,GACL,UAAU,CAAC,SAAS,CAAC,CAKhC;IAED;;6BAEyB;IACzB,WAFW,MAAM,UACN,GAAG,QAMb;IAED;;uBAEmB;IACnB,kBAFW,MAAM,GACL,GAAG,CAQd;IAED;;;yBAGqB;IACrB,sBAHW,GAAG,SACH,MAAM,GACL,KAAK,CAYhB;IAED,sBAAsB;IACtB,YADc,IAAI,CAYjB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,UACN,GAAG,YACH;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GACzC,WAAW,CAkBvB;CACF"}
@@ -1,8 +1,6 @@
1
1
  export { Component } from "./component.js";
2
- export const css: (template: {
3
- raw: readonly string[] | ArrayLike<string>;
4
- }, ...substitutions: any[]) => string;
5
- export const html: (template: {
6
- raw: readonly string[] | ArrayLike<string>;
7
- }, ...substitutions: any[]) => string;
2
+ /** @type {typeof String.raw} */
3
+ export const css: typeof String.raw;
4
+ /** @type {typeof String.raw} */
5
+ export const html: typeof String.raw;
8
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/base/component/index.js"],"names":[],"mappings":";AACA;;sCAA6B;AAC7B;;sCAA8B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/base/component/index.js"],"names":[],"mappings":";AAEA,gCAAgC;AAChC,kBADW,OAAO,MAAM,CAAC,GAAG,CACC;AAC7B,gCAAgC;AAChC,mBADW,OAAO,MAAM,CAAC,GAAG,CACE"}
@@ -1,3 +1,4 @@
1
- export default styles;
2
- import styles from './styles.js';
1
+ export default stylesText;
2
+ /** @type {string} */
3
+ declare const stylesText: string;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/base/styles/index.js"],"names":[],"mappings":";mBAAmB,aAAa"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/base/styles/index.js"],"names":[],"mappings":";AAEA,qBAAqB;AACrB,0BADW,MAAM,CACQ"}
@@ -1,5 +1,6 @@
1
1
  /** @param {string} tag
2
2
  * @param {CustomElementConstructor} element
3
- * @param {string} styles **/
4
- export function define(tag: string, element: CustomElementConstructor, styles?: string): CSSStyleSheet[];
3
+ * @param {string} [styles]
4
+ * @returns {CSSStyleSheet|HTMLStyleElement|undefined} */
5
+ export function define(tag: string, element: CustomElementConstructor, styles?: string): CSSStyleSheet | HTMLStyleElement | undefined;
5
6
  //# sourceMappingURL=define.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/define.js"],"names":[],"mappings":"AAEA;;6BAE6B;AAC7B,4BAHY,MAAM,WACP,wBAAwB,WACxB,MAAM,mBAehB"}
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/define.js"],"names":[],"mappings":"AAKA;;;yDAGyD;AACzD,4BAJY,MAAM,WACP,wBAAwB,WACxB,MAAM,GACJ,aAAa,GAAC,gBAAgB,GAAC,SAAS,CAkCpD"}
@@ -1,13 +1,19 @@
1
1
  /**
2
- * Convert Strings from camelCase to kebab-case
3
- * @param {string} input @returns {string} */
2
+ * Convert Strings from camelCase to kebab-case.
3
+ * @param {string} input
4
+ * @returns {string}
5
+ */
4
6
  export function camelToKebab(input: string): string;
5
7
  /**
6
- * Convert Strings from kebab-case to camelCase
7
- * @param {string} input @returns {string} */
8
+ * Convert Strings from kebab-case to camelCase.
9
+ * @param {string} input
10
+ * @returns {string}
11
+ */
8
12
  export function kebabToCamel(input: string): string;
9
13
  /**
10
- * Convert Strings from snake to camelCase
11
- * @param {string} input @returns {string} */
14
+ * Convert Strings from snake to camelCase.
15
+ * @param {string} input
16
+ * @returns {string}
17
+ */
12
18
  export function snakeToCamel(input: string): string;
13
19
  //# sourceMappingURL=format.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/format.js"],"names":[],"mappings":"AAAA;;6CAE6C;AAC7C,oCADW,MAAM,GAAkB,MAAM,CAGxC;AAED;;6CAE6C;AAC7C,oCADW,MAAM,GAAkB,MAAM,CAKxC;AAED;;6CAE6C;AAC7C,oCADW,MAAM,GAAkB,MAAM,CAKxC"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/format.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAMlB;AAED;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,CAMlB"}
@@ -1,11 +1,31 @@
1
- /** @param {HTMLElement} self */
2
- export function listen(self: HTMLElement): void;
1
+ /**
2
+ * Binds declarative event handlers in descendant nodes for a component.
3
+ * @param {Component|HTMLElement} self
4
+ * @returns {void}
5
+ */
6
+ export function listen(self: Component | HTMLElement): void;
3
7
  /** @param {HTMLElement} self @param {string[]} properties */
4
8
  export function reflect(self: HTMLElement, properties: string[]): void;
5
- /** @param {object} object @param {string} path @param {any} value */
6
- export function set(object: object, path: string, value: any): void;
7
- /** @param {object} object @param {string} path @param {any} fallback */
8
- export function get(object: object, path: string, fallback: any): any;
9
- /** @param {object} object @return {string} */
9
+ /**
10
+ * Sets a nested property value by object path.
11
+ * @param {unknown} object
12
+ * @param {string} path
13
+ * @param {any} value
14
+ * @returns {void}
15
+ */
16
+ export function set(object: unknown, path: string, value: any): void;
17
+ /**
18
+ * Reads a nested property value by path.
19
+ * @param {unknown} object
20
+ * @param {string} path
21
+ * @param {any} fallback
22
+ * @returns {any}
23
+ */
24
+ export function get(object: unknown, path: string, fallback: any): any;
25
+ /** @param {object} object
26
+ * @return {string}
27
+ * @description Returns truthy CSS class names from object values.
28
+ */
10
29
  export function keys(object: object): string;
30
+ import type { Component } from '../component/component.js';
11
31
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/helpers.js"],"names":[],"mappings":"AAEA,gCAAgC;AAChC,6BADY,WAAW,QAyDtB;AAeD,6DAA6D;AAC7D,8BADY,WAAW,cAAe,MAAM,EAAE,QAiB7C;AAUD,qEAAqE;AACrE,4BADY,MAAM,QAAiB,MAAM,SAAe,GAAG,QAS1D;AAED,wEAAwE;AACxE,4BADY,MAAM,QAAiB,MAAM,YAAe,GAAG,OAM1D;AAED,8CAA8C;AAC9C,6BADY,MAAM,GAAkB,MAAM,CAIzC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/helpers.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,6BAHW,SAAS,GAAC,WAAW,GACnB,IAAI,CA6DhB;AAmBD,6DAA6D;AAC7D,8BADY,WAAW,cAAe,MAAM,EAAE,QAiB7C;AAUD;;;;;;GAMG;AACH,4BALW,OAAO,QACP,MAAM,SACN,GAAG,GACD,IAAI,CAWhB;AAED;;;;;;GAMG;AACH,4BALW,OAAO,QACP,MAAM,YACN,GAAG,GACD,GAAG,CAUf;AAED;;;GAGG;AACH,6BAJY,MAAM,GACN,MAAM,CAMjB;+BA5J6B,2BAA2B"}
@@ -1,15 +1,13 @@
1
1
  /**
2
+ * Groups child nodes by slot name.
2
3
  * @param {HTMLElement} container
3
- * @return {Object<string, Array<HTMLElement>>}
4
- * */
5
- export function getSlots(container: HTMLElement): {
6
- [x: string]: Array<HTMLElement>;
7
- };
4
+ * @returns {Record<string, HTMLElement[]>}
5
+ */
6
+ export function getSlots(container: HTMLElement): Record<string, HTMLElement[]>;
8
7
  /**
8
+ * Groups child nodes by slot name.
9
9
  * @param {HTMLElement} container
10
- * @return {Object<string, Array<HTMLElement>>}
11
- * */
12
- export function slot(container: HTMLElement): {
13
- [x: string]: Array<HTMLElement>;
14
- };
10
+ * @returns {Record<string, HTMLElement[]>}
11
+ */
12
+ export function slot(container: HTMLElement): Record<string, HTMLElement[]>;
15
13
  //# sourceMappingURL=slots.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/slots.js"],"names":[],"mappings":"AAAA;;;KAGK;AACL,oCAHW,WAAW,GACV;QAAO,MAAM,GAAE,KAAK,CAAC,WAAW,CAAC;CAAC,CAa7C;AAfD;;;KAGK;AACL,gCAHW,WAAW,GACV;QAAO,MAAM,GAAE,KAAK,CAAC,WAAW,CAAC;CAAC,CAa7C"}
1
+ {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/slots.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oCAHW,WAAW,GACT,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAazC;AAhBD;;;;GAIG;AACH,gCAHW,WAAW,GACT,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAazC"}
@@ -1,3 +1,3 @@
1
- /** @returns {string} */
1
+ /** @returns {string} Generated RFC-4122-like identifier. */
2
2
  export function uuid(): string;
3
3
  //# sourceMappingURL=uuid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/uuid.js"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,wBADc,MAAM,CAQnB"}
1
+ {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../lib/base/utils/uuid.js"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,wBADc,MAAM,CAQnB"}
@@ -1,18 +1,32 @@
1
+ /**
2
+ * Audio recorder component.
3
+ * Emits:
4
+ * - `error` with `Error` detail on capture/rendering issues.
5
+ */
1
6
  export class Audio extends Component {
2
- init(context?: {}): Component;
3
- status: string;
4
- dataURL: any;
5
- timerId: NodeJS.Timer;
6
- recorder: any;
7
- global: any;
8
- /** @param {Event} event */
7
+ /** @param {object} context
8
+ * @returns {Audio} */
9
+ init(context?: object): Audio;
10
+ /** @type {'idle'|'recording'|'done'} */
11
+ status: "idle" | "recording" | "done";
12
+ dataURL: string | ArrayBuffer;
13
+ timerId: NodeJS.Timeout;
14
+ recorder: MediaRecorder;
15
+ objectURL: string;
16
+ /** @param {Event} event
17
+ * @returns {Promise<void>} */
9
18
  start(event: Event): Promise<void>;
10
- /** @param {Event} event */
19
+ /** @param {Event} event
20
+ * @returns {void} */
11
21
  stop(event: Event): void;
22
+ /** @returns {void} */
12
23
  reset(): void;
13
- _time(): NodeJS.Timer;
24
+ /** @returns {ReturnType<typeof setInterval>} Interval handle. */
25
+ _time(): ReturnType<typeof setInterval>;
14
26
  /** @param {any} event */
15
27
  _onData(event: any): void;
28
+ /** @returns {void} */
29
+ _revokeObjectURL(): void;
16
30
  }
17
31
  import { Component } from '#base/index.js';
18
32
  //# sourceMappingURL=audio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../../../lib/components/audio/components/audio.js"],"names":[],"mappings":"AAIA;IACE,8BAQC;IAPC,eAAoB;IACpB,aAAmB;IACnB,sBAAmB;IACnB,cAAoB;IACpB,YAAsC;IAoCxC,2BAA2B;IAC3B,aADY,KAAK,iBAahB;IAED,2BAA2B;IAC3B,YADY,KAAK,QAQhB;IAED,cAMC;IAED,sBAYC;IAED,yBAAyB;IACzB,eADY,GAAG,QAQd;CACF;0BAtGyB,gBAAgB"}
1
+ {"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../../../lib/components/audio/components/audio.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH;IACE;2BACuB;IACvB,eAFY,MAAM,GACJ,KAAK,CAWlB;IATC,wCAAwC;IACxC,QADW,MAAM,GAAC,WAAW,GAAC,MAAM,CAChB;IACpB,8BAAmB;IACnB,wBAAmB;IACnB,wBAAoB;IACpB,kBAAqB;IAqCvB;mCAC+B;IAC/B,aAFY,KAAK,GACH,OAAO,CAAC,IAAI,CAAC,CAa1B;IAED;0BACsB;IACtB,YAFY,KAAK,GACH,IAAI,CAQjB;IAED,sBAAsB;IACtB,SADc,IAAI,CASjB;IAUD,iEAAiE;IACjE,SADc,UAAU,CAAC,OAAO,WAAW,CAAC,CAa3C;IAED,yBAAyB;IACzB,eADY,GAAG,QAUd;IAED,sBAAsB;IACtB,oBADc,IAAI,CAKjB;CACF;0BAtIyB,gBAAgB"}
@@ -1,3 +1,4 @@
1
- export default styles;
2
- import styles from './ark.css.js';
1
+ export default stylesText;
2
+ /** @type {string} */
3
+ declare const stylesText: string;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/audio/styles/index.js"],"names":[],"mappings":";mBAAmB,cAAc"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/audio/styles/index.js"],"names":[],"mappings":";AAEA,qBAAqB;AACrB,0BADW,MAAM,CACQ"}
@@ -1,14 +1,22 @@
1
+ /**
2
+ * Camera capture component.
3
+ */
1
4
  export class Camera extends Component {
2
- init(context?: {}): Component;
5
+ /** @param {object} context
6
+ * @returns {Camera} */
7
+ init(context?: object): Camera;
3
8
  width: any;
4
9
  height: any;
5
10
  facingMode: any;
6
- global: any;
7
11
  /** @returns {string} */
8
12
  dataURL(width?: any, height?: any): string;
13
+ /** @returns {Promise<void>} */
9
14
  start(): Promise<void>;
15
+ /** @returns {void} */
10
16
  stop(): void;
11
- setCameraOrientation(facingMode: any): Promise<void>;
17
+ /** @param {string} facingMode
18
+ * @returns {Promise<void>} */
19
+ setCameraOrientation(facingMode: string): Promise<void>;
12
20
  /** @returns {HTMLVideoElement} */
13
21
  get video(): HTMLVideoElement;
14
22
  /** @returns {HTMLCanvasElement} */
@@ -1 +1 @@
1
- {"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../../lib/components/camera/components/camera.js"],"names":[],"mappings":"AAIA;IACE,8BAOC;IANC,WAA+C;IAC/C,YAAkD;IAClD,gBAAiE;IACjE,YAAsC;IAyBxC,wBAAwB;IACxB,oCADc,MAAM,CAanB;IAED,uBAWC;IAED,aAIC;IAED,qDAIC;IAED,kCAAkC;IAClC,8BAEC;IAED,mCAAmC;IACnC,gCAEC;CACF;0BAnFyB,gBAAgB"}
1
+ {"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../../lib/components/camera/components/camera.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACE;4BACwB;IACxB,eAFY,MAAM,GACJ,MAAM,CAQnB;IANC,WAA+C;IAC/C,YAAkD;IAClD,gBAAiE;IA0BnE,wBAAwB;IACxB,oCADc,MAAM,CAanB;IAED,+BAA+B;IAC/B,SADc,OAAO,CAAC,IAAI,CAAC,CAY1B;IAED,sBAAsB;IACtB,QADc,IAAI,CAKjB;IAED;mCAC+B;IAC/B,iCAFY,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAK1B;IAQD,kCAAkC;IAClC,8BAEC;IAED,mCAAmC;IACnC,gCAEC;CACF;0BAlGyB,gBAAgB"}
@@ -1,3 +1,4 @@
1
- export default styles;
2
- import styles from './ark.css.js';
1
+ export default stylesText;
2
+ /** @type {string} */
3
+ declare const stylesText: string;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/camera/styles/index.js"],"names":[],"mappings":";mBAAmB,cAAc"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/components/camera/styles/index.js"],"names":[],"mappings":";AAEA,qBAAqB;AACrB,0BADW,MAAM,CACQ"}
@@ -1,10 +1,30 @@
1
+ /** Template-driven renderer component. */
1
2
  export class Capture extends Component {
2
3
  receive: string;
4
+ /** @param {object} context
5
+ * @returns {Capture} */
6
+ init(context?: object): Capture;
3
7
  source: any;
4
8
  template: any;
5
- handle(event: any): void;
6
- _format(template: any): (data: any) => any;
7
- _pop(selector: any): any;
9
+ /** @param {{detail:any}} event */
10
+ handle(event: {
11
+ detail: any;
12
+ }): void;
13
+ /**
14
+ * @param {string} template
15
+ * @returns {(data: any) => string}
16
+ */
17
+ _format(template: string): (data: any) => string;
18
+ /**
19
+ * @param {string} selector
20
+ * @returns {HTMLElement|null}
21
+ */
22
+ _pop(selector: string): HTMLElement | null;
23
+ /**
24
+ * @param {string|null} source
25
+ * @returns {object|null}
26
+ */
27
+ _parseJSON(source: string | null): object | null;
8
28
  }
9
29
  import { Component } from "#base/index.js";
10
30
  //# sourceMappingURL=capture.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../../lib/components/capture/components/capture.js"],"names":[],"mappings":"AAGA;IAGI,gBAAqC;IAWrC,YAC8C;IAC9C,cACsC;IAkBxC,yBAGC;IAED,2CAEC;IAED,yBAIC;CACF;0BApDyB,gBAAgB"}
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../../lib/components/capture/components/capture.js"],"names":[],"mappings":"AAGA,0CAA0C;AAC1C;IAGI,gBAAqC;IAQvC;6BACyB;IACzB,eAFY,MAAM,GACJ,OAAO,CASpB;IANC,YAC8C;IAC9C,cACsC;IAkBxC,kCAAkC;IAClC,cADY;QAAC,MAAM,EAAC,GAAG,CAAA;KAAC,QAIvB;IAED;;;OAGG;IACH,kBAHW,MAAM,GACJ,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,CAqBjC;IAED;;;OAGG;IACH,eAHW,MAAM,GACJ,WAAW,GAAC,IAAI,CAM5B;IAED;;;OAGG;IACH,mBAHW,MAAM,GAAC,IAAI,GACT,MAAM,GAAC,IAAI,CAWvB;CACF;0BA/FyB,gBAAgB"}