@haiilo/catalyst 0.14.2 → 0.14.3

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.
@@ -1,21 +1,43 @@
1
1
  (function (doc) {
2
- var scriptElm = doc.scripts[doc.scripts.length - 1];
3
- var warn = ['Discouraged script use, please remove: ' + scriptElm.outerHTML];
2
+ var scriptMap = doc.createElement('script');
3
+ scriptMap.setAttribute('type', 'importmap');
4
+ scriptMap.text = `
5
+ {
6
+ "imports": {
7
+ "@haiilo/catalyst": "https://cdn.jsdelivr.net/npm/@haiilo/catalyst/dist/catalyst/index.esm.js",
8
+ "@haiilo/catalyst-icons": "https://cdn.jsdelivr.net/npm/@haiilo/catalyst-icons/dist/js/icons.object.js"
9
+ }
10
+ }
11
+ `;
4
12
 
5
- warn.push('To improve performance it is recommended to set the script in the head as follows:');
13
+ var scriptComp = doc.createElement('script');
14
+ scriptComp.setAttribute('type', 'module');
15
+ scriptComp.setAttribute('data-stencil-namespace', 'catalyst');
16
+ scriptComp.src = 'https://cdn.jsdelivr.net/npm/@haiilo/catalyst/dist/catalyst/catalyst.esm.js';
6
17
 
7
- var parts = scriptElm.src.split('/');
8
- parts.pop();
9
- // add subfolder(s) here
10
- // parts.push('...');
11
- var url = parts.join('/');
18
+ var scriptInit = doc.createElement('script');
19
+ scriptInit.setAttribute('type', 'module');
20
+ scriptInit.text = `
21
+ import { ci } from '@haiilo/catalyst-icons';
22
+ import { CatI18nRegistry, CatIconRegistry } from '@haiilo/catalyst';
12
23
 
13
- scriptElm = doc.createElement('script');
14
- scriptElm.setAttribute('type', 'module');
15
- scriptElm.src = url + '/catalyst.esm.js';
16
- warn.push(scriptElm.outerHTML);
17
- scriptElm.setAttribute('data-stencil-namespace', 'catalyst');
18
- doc.head.appendChild(scriptElm);
24
+ CatIconRegistry.getInstance().addIcons(ci);
25
+ CatI18nRegistry.getInstance().register('en', {
26
+ 'input.clear': 'Clear',
27
+ 'input.optional': 'Optional',
28
+ 'select.addItem': 'Add item',
29
+ 'select.customAddItem': 'Custom add item',
30
+ 'select.loading': 'Loading',
31
+ 'select.noResults': 'No results',
32
+ 'select.noChoices': 'No choices',
33
+ 'select.removeItem': 'Remove item',
34
+ 'select.searchPlaceholder': 'Search',
35
+ 'select.selectItem': 'Select item',
36
+ 'select.uniqueItem': 'Unique item'
37
+ });
38
+ `;
19
39
 
20
- console.warn(warn.join('\n'));
40
+ doc.head.appendChild(scriptMap);
41
+ doc.head.appendChild(scriptComp);
42
+ doc.head.appendChild(scriptInit);
21
43
  })(document);
@@ -1,21 +1,43 @@
1
1
  (function (doc) {
2
- var scriptElm = doc.scripts[doc.scripts.length - 1];
3
- var warn = ['Discouraged script use, please remove: ' + scriptElm.outerHTML];
2
+ var scriptMap = doc.createElement('script');
3
+ scriptMap.setAttribute('type', 'importmap');
4
+ scriptMap.text = `
5
+ {
6
+ "imports": {
7
+ "@haiilo/catalyst": "https://cdn.jsdelivr.net/npm/@haiilo/catalyst/dist/catalyst/index.esm.js",
8
+ "@haiilo/catalyst-icons": "https://cdn.jsdelivr.net/npm/@haiilo/catalyst-icons/dist/js/icons.object.js"
9
+ }
10
+ }
11
+ `;
4
12
 
5
- warn.push('To improve performance it is recommended to set the script in the head as follows:');
13
+ var scriptComp = doc.createElement('script');
14
+ scriptComp.setAttribute('type', 'module');
15
+ scriptComp.setAttribute('data-stencil-namespace', 'catalyst');
16
+ scriptComp.src = 'https://cdn.jsdelivr.net/npm/@haiilo/catalyst/dist/catalyst/catalyst.esm.js';
6
17
 
7
- var parts = scriptElm.src.split('/');
8
- parts.pop();
9
- // add subfolder(s) here
10
- // parts.push('...');
11
- var url = parts.join('/');
18
+ var scriptInit = doc.createElement('script');
19
+ scriptInit.setAttribute('type', 'module');
20
+ scriptInit.text = `
21
+ import { ci } from '@haiilo/catalyst-icons';
22
+ import { CatI18nRegistry, CatIconRegistry } from '@haiilo/catalyst';
12
23
 
13
- scriptElm = doc.createElement('script');
14
- scriptElm.setAttribute('type', 'module');
15
- scriptElm.src = url + '/catalyst.esm.js';
16
- warn.push(scriptElm.outerHTML);
17
- scriptElm.setAttribute('data-stencil-namespace', 'catalyst');
18
- doc.head.appendChild(scriptElm);
24
+ CatIconRegistry.getInstance().addIcons(ci);
25
+ CatI18nRegistry.getInstance().register('en', {
26
+ 'input.clear': 'Clear',
27
+ 'input.optional': 'Optional',
28
+ 'select.addItem': 'Add item',
29
+ 'select.customAddItem': 'Custom add item',
30
+ 'select.loading': 'Loading',
31
+ 'select.noResults': 'No results',
32
+ 'select.noChoices': 'No choices',
33
+ 'select.removeItem': 'Remove item',
34
+ 'select.searchPlaceholder': 'Search',
35
+ 'select.selectItem': 'Select item',
36
+ 'select.uniqueItem': 'Unique item'
37
+ });
38
+ `;
19
39
 
20
- console.warn(warn.join('\n'));
40
+ doc.head.appendChild(scriptMap);
41
+ doc.head.appendChild(scriptComp);
42
+ doc.head.appendChild(scriptInit);
21
43
  })(document);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haiilo/catalyst",
3
- "version": "0.14.2",
3
+ "version": "0.14.3",
4
4
  "description": "Catalyst Design System",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@floating-ui/dom": "0.4.1",
46
- "@haiilo/catalyst-tokens": "0.14.2",
46
+ "@haiilo/catalyst-tokens": "0.14.3",
47
47
  "@stencil/core": "2.17.0",
48
48
  "autosize": "5.0.1",
49
49
  "choices.js": "10.1.0",