@knowark/componarkjs 1.14.0 → 1.14.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 (100) hide show
  1. package/README.md +57 -45
  2. package/lib/base/component/component.js +127 -21
  3. package/lib/base/component/component.test.js +296 -3
  4. package/lib/base/component/index.js +3 -0
  5. package/lib/base/styles/index.js +4 -1
  6. package/lib/base/utils/define.js +2 -1
  7. package/lib/base/utils/format.js +12 -6
  8. package/lib/base/utils/helpers.js +31 -5
  9. package/lib/base/utils/index.js +1 -0
  10. package/lib/base/utils/slots.js +3 -2
  11. package/lib/base/utils/uuid.js +1 -1
  12. package/lib/components/audio/components/audio.js +17 -2
  13. package/lib/components/audio/index.js +1 -0
  14. package/lib/components/audio/styles/index.js +5 -1
  15. package/lib/components/camera/components/camera.js +10 -0
  16. package/lib/components/camera/index.js +1 -0
  17. package/lib/components/camera/styles/index.js +5 -1
  18. package/lib/components/capture/components/capture.js +18 -2
  19. package/lib/components/capture/index.js +1 -0
  20. package/lib/components/droparea/components/droparea-preview.js +58 -13
  21. package/lib/components/droparea/components/droparea-preview.test.js +82 -0
  22. package/lib/components/droparea/components/droparea.js +41 -2
  23. package/lib/components/droparea/index.js +1 -0
  24. package/lib/components/droparea/styles/index.js +5 -1
  25. package/lib/components/emit/components/emit.js +11 -1
  26. package/lib/components/emit/index.js +1 -0
  27. package/lib/components/index.js +2 -1
  28. package/lib/components/list/components/item.js +6 -0
  29. package/lib/components/list/components/list.js +18 -4
  30. package/lib/components/list/index.js +1 -0
  31. package/lib/components/paginator/components/paginator.js +34 -8
  32. package/lib/components/paginator/index.js +1 -0
  33. package/lib/components/paginator/styles/index.js +5 -1
  34. package/lib/components/spinner/components/spinner.js +10 -0
  35. package/lib/components/spinner/index.js +1 -0
  36. package/lib/components/spinner/styles/index.js +5 -1
  37. package/lib/components/splitview/components/splitview.detail.js +10 -1
  38. package/lib/components/splitview/components/splitview.js +18 -3
  39. package/lib/components/splitview/components/splitview.master.js +10 -0
  40. package/lib/components/splitview/index.js +1 -0
  41. package/lib/components/translate/components/translate.js +42 -11
  42. package/lib/components/translate/components/translate.test.js +169 -1
  43. package/lib/components/translate/index.js +1 -0
  44. package/lib/index.js +3 -0
  45. package/package.json +2 -1
  46. package/tsconfig.json +1 -1
  47. package/types/base/component/component.d.ts +43 -8
  48. package/types/base/component/component.d.ts.map +1 -1
  49. package/types/base/component/index.d.ts +4 -6
  50. package/types/base/component/index.d.ts.map +1 -1
  51. package/types/base/styles/index.d.ts +3 -2
  52. package/types/base/styles/index.d.ts.map +1 -1
  53. package/types/base/utils/define.d.ts +3 -2
  54. package/types/base/utils/define.d.ts.map +1 -1
  55. package/types/base/utils/format.d.ts +12 -6
  56. package/types/base/utils/format.d.ts.map +1 -1
  57. package/types/base/utils/helpers.d.ts +27 -7
  58. package/types/base/utils/helpers.d.ts.map +1 -1
  59. package/types/base/utils/slots.d.ts +8 -10
  60. package/types/base/utils/slots.d.ts.map +1 -1
  61. package/types/base/utils/uuid.d.ts +1 -1
  62. package/types/base/utils/uuid.d.ts.map +1 -1
  63. package/types/components/audio/components/audio.d.ts +23 -9
  64. package/types/components/audio/components/audio.d.ts.map +1 -1
  65. package/types/components/audio/styles/index.d.ts +3 -2
  66. package/types/components/audio/styles/index.d.ts.map +1 -1
  67. package/types/components/camera/components/camera.d.ts +11 -3
  68. package/types/components/camera/components/camera.d.ts.map +1 -1
  69. package/types/components/camera/styles/index.d.ts +3 -2
  70. package/types/components/camera/styles/index.d.ts.map +1 -1
  71. package/types/components/capture/components/capture.d.ts +23 -3
  72. package/types/components/capture/components/capture.d.ts.map +1 -1
  73. package/types/components/droparea/components/droparea-preview.d.ts +64 -11
  74. package/types/components/droparea/components/droparea-preview.d.ts.map +1 -1
  75. package/types/components/droparea/components/droparea.d.ts +58 -13
  76. package/types/components/droparea/components/droparea.d.ts.map +1 -1
  77. package/types/components/droparea/styles/index.d.ts +3 -2
  78. package/types/components/droparea/styles/index.d.ts.map +1 -1
  79. package/types/components/emit/components/emit.d.ts +15 -3
  80. package/types/components/emit/components/emit.d.ts.map +1 -1
  81. package/types/components/list/components/item.d.ts +8 -1
  82. package/types/components/list/components/item.d.ts.map +1 -1
  83. package/types/components/list/components/list.d.ts +23 -5
  84. package/types/components/list/components/list.d.ts.map +1 -1
  85. package/types/components/paginator/components/paginator.d.ts +32 -8
  86. package/types/components/paginator/components/paginator.d.ts.map +1 -1
  87. package/types/components/paginator/styles/index.d.ts +3 -2
  88. package/types/components/paginator/styles/index.d.ts.map +1 -1
  89. package/types/components/spinner/components/spinner.d.ts +14 -3
  90. package/types/components/spinner/components/spinner.d.ts.map +1 -1
  91. package/types/components/spinner/styles/index.d.ts +3 -2
  92. package/types/components/spinner/styles/index.d.ts.map +1 -1
  93. package/types/components/splitview/components/splitview.d.ts +22 -4
  94. package/types/components/splitview/components/splitview.d.ts.map +1 -1
  95. package/types/components/splitview/components/splitview.detail.d.ts +12 -2
  96. package/types/components/splitview/components/splitview.detail.d.ts.map +1 -1
  97. package/types/components/splitview/components/splitview.master.d.ts +12 -1
  98. package/types/components/splitview/components/splitview.master.d.ts.map +1 -1
  99. package/types/components/translate/components/translate.d.ts +44 -10
  100. package/types/components/translate/components/translate.d.ts.map +1 -1
@@ -1,6 +1,9 @@
1
1
  import { Component } from "#base/index.js"
2
2
 
3
3
  const tag = 'ark-splitview-master'
4
+ /**
5
+ * Master pane controller for split-view layout.
6
+ */
4
7
  export class SplitViewMaster extends Component {
5
8
  constructor () {
6
9
  super()
@@ -9,25 +12,31 @@ export class SplitViewMaster extends Component {
9
12
  this.masterEvent = this.masterEvent
10
13
  }
11
14
 
15
+ /** @param {object} context
16
+ * @returns {this} */
12
17
  init (context = {}) {
13
18
  this.binding = 'splitview-master-listen'
14
19
  return super.init(context)
15
20
  }
16
21
 
22
+ /** @returns {string[]} */
17
23
  reflectedProperties () {
18
24
  return ['masterEvent']
19
25
  }
20
26
 
27
+ /** @returns {void} */
21
28
  connectedCallback () {
22
29
  this._syncMasterEventListener()
23
30
  super.connectedCallback()
24
31
  }
25
32
 
33
+ /** @returns {void} */
26
34
  disconnectedCallback () {
27
35
  this._removeMasterEventListener()
28
36
  super.disconnectedCallback()
29
37
  }
30
38
 
39
+ /** @returns {void} */
31
40
  _syncMasterEventListener () {
32
41
  const masterEvent = (this.masterEvent || '').trim()
33
42
  if (!masterEvent || masterEvent === this._boundMasterEvent) return
@@ -37,6 +46,7 @@ export class SplitViewMaster extends Component {
37
46
  this._boundMasterEvent = masterEvent
38
47
  }
39
48
 
49
+ /** @returns {void} */
40
50
  _removeMasterEventListener () {
41
51
  if (!this._boundMasterEvent) return
42
52
  this.removeEventListener(this._boundMasterEvent, this._onMasterEvent)
@@ -1,3 +1,4 @@
1
+ /** Master-detail split view components. */
1
2
  export { SplitViewDetail } from './components/splitview.detail.js'
2
3
  export { SplitViewMaster } from './components/splitview.master.js'
3
4
  export { SplitView } from './components/splitview.js'
@@ -1,13 +1,24 @@
1
1
  import { Component } from "#base/index.js"
2
2
 
3
3
  const tag = 'ark-translate'
4
+ /**
5
+ * Translation component.
6
+ * @typedef {{key:string, namespace:string}} TranslatedKey
7
+ * @typedef {Record<string, Record<string, Record<string, string>>>} DictionaryStore
8
+ * @typedef {{language?:string, root?:string}} TransliterateOptions
9
+ */
4
10
  export class Translate extends Component {
11
+ /** @type {DictionaryStore} */
12
+ dictionary
13
+ /** @param {object} context
14
+ * @returns {this} */
5
15
  init (context = {}) {
6
16
  this.languages = this.languages
7
17
  this.global = context.global || window
8
18
  this.endpoint = context.endpoint || this.endpoint || '/locales'
9
19
  this.namespace = context.namespace || this.namespace || 'default'
10
20
  this.root = context.root || this.root || 'body'
21
+ /** @type {DictionaryStore} */
11
22
  this.dictionary = context.dictionary || {}
12
23
 
13
24
  const dictionary = (
@@ -15,7 +26,7 @@ export class Translate extends Component {
15
26
  if (dictionary) {
16
27
  const content = dictionary.content.textContent
17
28
  try {
18
- this.dictionary = JSON.parse(content)
29
+ this.dictionary = /** @type {DictionaryStore} */ (JSON.parse(content))
19
30
  } catch (error) {
20
31
  this.emit('error', error)
21
32
  }
@@ -24,10 +35,12 @@ export class Translate extends Component {
24
35
  return super.init(context)
25
36
  }
26
37
 
38
+ /** @returns {string[]} */
27
39
  reflectedProperties () {
28
40
  return ['languages', 'endpoint', 'namespace', 'root']
29
41
  }
30
42
 
43
+ /** @returns {this} */
31
44
  render () {
32
45
  const languages = this.languages.split(',').filter(
33
46
  item => Boolean(item) && item.trim())
@@ -46,12 +59,17 @@ export class Translate extends Component {
46
59
  return super.render()
47
60
  }
48
61
 
62
+ /** @param {Event} event
63
+ * @returns {Promise<void>} */
49
64
  async onLanguageChanged (event) {
50
65
  event.stopPropagation()
51
- const language = event.target.value
66
+ const target = /** @type {HTMLSelectElement|null} */ (event.target)
67
+ const language = target?.value
52
68
  await this.transliterate({ language })
53
69
  }
54
70
 
71
+ /** @param {TransliterateOptions} options
72
+ * @returns {Promise<void>} */
55
73
  async transliterate (options = {}) {
56
74
  const language = options.language || 'es'
57
75
  const root = this.global.document.querySelector(
@@ -67,12 +85,15 @@ export class Translate extends Component {
67
85
  language, namespace
68
86
  )
69
87
  )
70
- const dictionary = dictionaries[namespace]
88
+ const dictionary = /** @type {Record<string, string>} */ (
89
+ dictionaries[namespace])
71
90
 
72
91
  node.textContent = dictionary[key] || node.textContent
73
92
  }
74
93
  }
75
94
 
95
+ /** @param {string} value
96
+ * @returns {TranslatedKey} */
76
97
  parseKey (value) {
77
98
  let key = value
78
99
  let namespace = this.namespace
@@ -86,26 +107,36 @@ export class Translate extends Component {
86
107
  return { key, namespace }
87
108
  }
88
109
 
110
+ /** @param {string} language
111
+ * @param {string} namespace
112
+ * @returns {Promise<Record<string,string>>} */
89
113
  async resolveDictionary (language, namespace) {
90
- let dictionary = ((this.dictionary[language] ||
91
- {})[namespace] || null)
114
+ /** @type {DictionaryStore} */
115
+ const translations = this.dictionary
116
+ /** @type {Record<string, string>|null} */
117
+ let dictionary = /** @type {Record<string, string>|null} */ (
118
+ /** @type {unknown} */ (translations[language]?.[namespace]) || null)
92
119
 
93
120
  if (dictionary !== null) return dictionary
94
121
 
95
- if (!this.global.fetch) return {}
122
+ if (!this.global.fetch) return /** @type {Record<string, string>} */ ({})
96
123
 
97
124
  const url = `${this.endpoint}/${language}/${namespace}.json`
98
125
  try {
99
126
  const response = await this.global.fetch(url)
100
- if (response.ok === false) return {}
101
- dictionary = await response.json()
127
+ if (response.ok === false) return /** @type {Record<string, string>} */ ({})
128
+ dictionary = /** @type {Record<string, string>} */ (
129
+ await response.json())
102
130
  } catch (error) {
103
131
  this.emit('error', error)
104
- return {}
132
+ return /** @type {Record<string, string>} */ ({})
105
133
  }
106
134
 
107
- this.dictionary[language] || (this.dictionary[language] = {})
108
- this.dictionary[language][namespace] = dictionary
135
+ const cache = /** @type {Record<string, Record<string, Record<string, string>>>} */ (
136
+ /** @type {unknown} */ (translations))
137
+ cache[language] = cache[language] || {}
138
+ cache[language][namespace] = /** @type {Record<string, string>} */ (
139
+ /** @type {unknown} */ (dictionary || {}))
109
140
 
110
141
  return dictionary
111
142
  }
@@ -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.1",
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"}