@coveo/atomic-angular 3.10.12 → 3.10.14

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.
package/src/public-api.ts DELETED
@@ -1,8 +0,0 @@
1
- /*
2
- * Public API surface of atomic-angular
3
- */
4
-
5
- export {Bindings, i18n} from '@coveo/atomic';
6
- export * from '@coveo/headless';
7
- export {AtomicAngularModule} from './lib/generated/atomic-angular.module';
8
- export * from './lib/generated/components';
package/src/utils.ts DELETED
@@ -1,108 +0,0 @@
1
- /* oxlint-disable @typescript-eslint/no-explicit-any -- Copied file from stencil angular output */
2
-
3
- import customElementsManifest from '@coveo/atomic/custom-elements-manifest';
4
- import {fromEvent} from 'rxjs';
5
-
6
- const createPropertyToAttributeMap = (): Map<string, string> => {
7
- const map = new Map<string, string>();
8
-
9
- customElementsManifest.modules.forEach((module: any) => {
10
- module.declarations?.forEach((declaration: any) => {
11
- if (declaration.kind === 'class' && declaration.attributes) {
12
- declaration.attributes.forEach((attr: any) => {
13
- if (attr.fieldName && attr.name) {
14
- map.set(attr.fieldName, attr.name);
15
- }
16
- });
17
- }
18
- });
19
- });
20
-
21
- return map;
22
- };
23
-
24
- const propertyToAttributeMap = createPropertyToAttributeMap();
25
-
26
- const getAttributeName = (propertyName: string): string => {
27
- const mappedAttr = propertyToAttributeMap.get(propertyName);
28
- return mappedAttr || propertyName.replace(/([A-Z])/g, '-$1').toLowerCase();
29
- };
30
-
31
- export const proxyInputs = (Cmp: any, inputs: string[]) => {
32
- const Prototype = Cmp.prototype;
33
- inputs.forEach((item) => {
34
- Object.defineProperty(Prototype, item, {
35
- get() {
36
- return this.el[item];
37
- },
38
- set(val: any) {
39
- this.z.runOutsideAngular(() => {
40
- const attrName = getAttributeName(item);
41
- this.el.setAttribute(attrName, val);
42
- });
43
- },
44
- /**
45
- * In the event that proxyInputs is called
46
- * multiple times re-defining these inputs
47
- * will cause an error to be thrown. As a result
48
- * we set configurable: true to indicate these
49
- * properties can be changed.
50
- */
51
- configurable: true,
52
- });
53
- });
54
- };
55
-
56
- export const proxyMethods = (Cmp: any, methods: string[]) => {
57
- const Prototype = Cmp.prototype;
58
- methods.forEach((methodName) => {
59
- Prototype[methodName] = function () {
60
- // oxlint-disable-next-line prefer-rest-params -- allow arguments usage here
61
- const args = arguments;
62
- return this.z.runOutsideAngular(() =>
63
- this.el[methodName].apply(this.el, args)
64
- );
65
- };
66
- });
67
- };
68
-
69
- export const proxyOutputs = (instance: any, el: any, events: string[]) => {
70
- events.forEach((eventName) => {
71
- instance[eventName] = fromEvent(el, eventName);
72
- });
73
- };
74
-
75
- export const defineCustomElement = (tagName: string, customElement: any) => {
76
- if (
77
- customElement !== undefined &&
78
- typeof customElements !== 'undefined' &&
79
- !customElements.get(tagName)
80
- ) {
81
- customElements.define(tagName, customElement);
82
- }
83
- };
84
-
85
- /* oxlint-disable prefer-arrow-callback -- Allow function declaration for decorator */
86
- export function ProxyCmp(opts: {
87
- defineCustomElementFn?: () => void;
88
- inputs?: any;
89
- methods?: any;
90
- }) {
91
- const decorator = function (cls: any) {
92
- const {defineCustomElementFn, inputs, methods} = opts;
93
-
94
- if (defineCustomElementFn !== undefined) {
95
- defineCustomElementFn();
96
- }
97
-
98
- if (inputs) {
99
- proxyInputs(cls, inputs);
100
- }
101
- if (methods) {
102
- proxyMethods(cls, methods);
103
- }
104
- return cls;
105
- };
106
- return decorator;
107
- }
108
- /* oxlint-enable prefer-arrow-callback */
package/tsconfig.lib.json DELETED
@@ -1,13 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/lib",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "inlineSources": true,
9
- "types": [],
10
- "paths": {"@coveo/atomic-angular": ["../atomic-angular/*"]}
11
- },
12
- "exclude": ["src/test.ts", "**/*.spec.ts"]
13
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
File without changes