@tessera-ui/angular 0.4.0
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/LICENSE +21 -0
- package/dist/directives/angular-component-lib/utils.d.ts +9 -0
- package/dist/directives/angular-component-lib/utils.js +58 -0
- package/dist/directives/index.d.ts +2 -0
- package/dist/directives/index.js +55 -0
- package/dist/directives/proxies.d.ts +634 -0
- package/dist/directives/proxies.js +1418 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 James Kenneth Guidaven
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const proxyInputs: (Cmp: any, inputs: string[]) => void;
|
|
2
|
+
export declare const proxyMethods: (Cmp: any, methods: string[]) => void;
|
|
3
|
+
export declare const proxyOutputs: (instance: any, el: any, events: string[]) => void;
|
|
4
|
+
export declare const defineCustomElement: (tagName: string, customElement: any) => void;
|
|
5
|
+
export declare function ProxyCmp(opts: {
|
|
6
|
+
defineCustomElementFn?: () => void;
|
|
7
|
+
inputs?: any;
|
|
8
|
+
methods?: any;
|
|
9
|
+
}): (cls: any) => any;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
import { fromEvent } from 'rxjs';
|
|
4
|
+
export const proxyInputs = (Cmp, inputs) => {
|
|
5
|
+
const Prototype = Cmp.prototype;
|
|
6
|
+
inputs.forEach((item) => {
|
|
7
|
+
Object.defineProperty(Prototype, item, {
|
|
8
|
+
get() {
|
|
9
|
+
return this.el[item];
|
|
10
|
+
},
|
|
11
|
+
set(val) {
|
|
12
|
+
this.z.runOutsideAngular(() => (this.el[item] = val));
|
|
13
|
+
},
|
|
14
|
+
/**
|
|
15
|
+
* In the event that proxyInputs is called
|
|
16
|
+
* multiple times re-defining these inputs
|
|
17
|
+
* will cause an error to be thrown. As a result
|
|
18
|
+
* we set configurable: true to indicate these
|
|
19
|
+
* properties can be changed.
|
|
20
|
+
*/
|
|
21
|
+
configurable: true,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const proxyMethods = (Cmp, methods) => {
|
|
26
|
+
const Prototype = Cmp.prototype;
|
|
27
|
+
methods.forEach((methodName) => {
|
|
28
|
+
Prototype[methodName] = function () {
|
|
29
|
+
const args = arguments;
|
|
30
|
+
return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const proxyOutputs = (instance, el, events) => {
|
|
35
|
+
events.forEach((eventName) => (instance[eventName] = fromEvent(el, eventName)));
|
|
36
|
+
};
|
|
37
|
+
export const defineCustomElement = (tagName, customElement) => {
|
|
38
|
+
if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
|
|
39
|
+
customElements.define(tagName, customElement);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
// tslint:disable-next-line: only-arrow-functions
|
|
43
|
+
export function ProxyCmp(opts) {
|
|
44
|
+
const decorator = function (cls) {
|
|
45
|
+
const { defineCustomElementFn, inputs, methods } = opts;
|
|
46
|
+
if (defineCustomElementFn !== undefined) {
|
|
47
|
+
defineCustomElementFn();
|
|
48
|
+
}
|
|
49
|
+
if (inputs) {
|
|
50
|
+
proxyInputs(cls, inputs);
|
|
51
|
+
}
|
|
52
|
+
if (methods) {
|
|
53
|
+
proxyMethods(cls, methods);
|
|
54
|
+
}
|
|
55
|
+
return cls;
|
|
56
|
+
};
|
|
57
|
+
return decorator;
|
|
58
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import * as d from './proxies';
|
|
2
|
+
export declare const DIRECTIVES: (typeof d.TsAccordion | typeof d.TsAccordionItem | typeof d.TsAlert | typeof d.TsAvatar | typeof d.TsBadge | typeof d.TsBanner | typeof d.TsBreadcrumb | typeof d.TsBreadcrumbItem | typeof d.TsButton | typeof d.TsCard | typeof d.TsCheckbox | typeof d.TsChip | typeof d.TsContainer | typeof d.TsDatePicker | typeof d.TsDialog | typeof d.TsDivider | typeof d.TsDrawer | typeof d.TsEmptyState | typeof d.TsFileUpload | typeof d.TsGrid | typeof d.TsIcon | typeof d.TsInput | typeof d.TsMenu | typeof d.TsMenuItem | typeof d.TsModal | typeof d.TsNav | typeof d.TsNavItem | typeof d.TsPagination | typeof d.TsPopover | typeof d.TsProgress | typeof d.TsRadio | typeof d.TsRow | typeof d.TsSelect | typeof d.TsSkeleton | typeof d.TsSlider | typeof d.TsSpacer | typeof d.TsSpinner | typeof d.TsStack | typeof d.TsStep | typeof d.TsStepper | typeof d.TsSwitchGroup | typeof d.TsSwitchOption | typeof d.TsTabPanel | typeof d.TsTable | typeof d.TsTabs | typeof d.TsTextarea | typeof d.TsToast | typeof d.TsToggle | typeof d.TsToolbar | typeof d.TsTooltip | typeof d.TsTree | typeof d.TsTreeItem)[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as d from './proxies';
|
|
2
|
+
export const DIRECTIVES = [
|
|
3
|
+
d.TsAccordion,
|
|
4
|
+
d.TsAccordionItem,
|
|
5
|
+
d.TsAlert,
|
|
6
|
+
d.TsAvatar,
|
|
7
|
+
d.TsBadge,
|
|
8
|
+
d.TsBanner,
|
|
9
|
+
d.TsBreadcrumb,
|
|
10
|
+
d.TsBreadcrumbItem,
|
|
11
|
+
d.TsButton,
|
|
12
|
+
d.TsCard,
|
|
13
|
+
d.TsCheckbox,
|
|
14
|
+
d.TsChip,
|
|
15
|
+
d.TsContainer,
|
|
16
|
+
d.TsDatePicker,
|
|
17
|
+
d.TsDialog,
|
|
18
|
+
d.TsDivider,
|
|
19
|
+
d.TsDrawer,
|
|
20
|
+
d.TsEmptyState,
|
|
21
|
+
d.TsFileUpload,
|
|
22
|
+
d.TsGrid,
|
|
23
|
+
d.TsIcon,
|
|
24
|
+
d.TsInput,
|
|
25
|
+
d.TsMenu,
|
|
26
|
+
d.TsMenuItem,
|
|
27
|
+
d.TsModal,
|
|
28
|
+
d.TsNav,
|
|
29
|
+
d.TsNavItem,
|
|
30
|
+
d.TsPagination,
|
|
31
|
+
d.TsPopover,
|
|
32
|
+
d.TsProgress,
|
|
33
|
+
d.TsRadio,
|
|
34
|
+
d.TsRow,
|
|
35
|
+
d.TsSelect,
|
|
36
|
+
d.TsSkeleton,
|
|
37
|
+
d.TsSlider,
|
|
38
|
+
d.TsSpacer,
|
|
39
|
+
d.TsSpinner,
|
|
40
|
+
d.TsStack,
|
|
41
|
+
d.TsStep,
|
|
42
|
+
d.TsStepper,
|
|
43
|
+
d.TsSwitchGroup,
|
|
44
|
+
d.TsSwitchOption,
|
|
45
|
+
d.TsTabPanel,
|
|
46
|
+
d.TsTable,
|
|
47
|
+
d.TsTabs,
|
|
48
|
+
d.TsTextarea,
|
|
49
|
+
d.TsToast,
|
|
50
|
+
d.TsToggle,
|
|
51
|
+
d.TsToolbar,
|
|
52
|
+
d.TsTooltip,
|
|
53
|
+
d.TsTree,
|
|
54
|
+
d.TsTreeItem
|
|
55
|
+
];
|