@tessera-ui/angular 0.4.1 → 0.5.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/README.md +36 -0
- package/dist/cjs/directives/angular-component-lib/utils.js +66 -0
- package/dist/cjs/directives/index.js +91 -0
- package/dist/cjs/directives/proxies.js +1422 -0
- package/dist/cjs/index.js +22 -0
- package/package.json +21 -6
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @tessera-ui/angular
|
|
2
|
+
|
|
3
|
+
Angular wrappers for [Tessera UI](https://github.com/jkguidaven/tessera-ui) web components.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @tessera-ui/angular
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { DIRECTIVES } from '@tessera-ui/angular';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
imports: [DIRECTIVES],
|
|
18
|
+
template: `
|
|
19
|
+
<ts-input label="Email" placeholder="you@example.com"></ts-input>
|
|
20
|
+
<ts-button variant="primary">Submit</ts-button>
|
|
21
|
+
`,
|
|
22
|
+
})
|
|
23
|
+
export class AppComponent {}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Design tokens (CSS custom properties) are auto-imported — no additional CSS import needed.
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
|
|
30
|
+
- [Component docs](https://jkguidaven.github.io/tessera-ui/)
|
|
31
|
+
- [Storybook](https://jkguidaven.github.io/tessera-ui/storybook/)
|
|
32
|
+
- [GitHub](https://github.com/jkguidaven/tessera-ui)
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
MIT
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineCustomElement = exports.proxyOutputs = exports.proxyMethods = exports.proxyInputs = void 0;
|
|
4
|
+
exports.ProxyCmp = ProxyCmp;
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
/* tslint:disable */
|
|
7
|
+
const rxjs_1 = require("rxjs");
|
|
8
|
+
const proxyInputs = (Cmp, inputs) => {
|
|
9
|
+
const Prototype = Cmp.prototype;
|
|
10
|
+
inputs.forEach((item) => {
|
|
11
|
+
Object.defineProperty(Prototype, item, {
|
|
12
|
+
get() {
|
|
13
|
+
return this.el[item];
|
|
14
|
+
},
|
|
15
|
+
set(val) {
|
|
16
|
+
this.z.runOutsideAngular(() => (this.el[item] = val));
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* In the event that proxyInputs is called
|
|
20
|
+
* multiple times re-defining these inputs
|
|
21
|
+
* will cause an error to be thrown. As a result
|
|
22
|
+
* we set configurable: true to indicate these
|
|
23
|
+
* properties can be changed.
|
|
24
|
+
*/
|
|
25
|
+
configurable: true,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.proxyInputs = proxyInputs;
|
|
30
|
+
const proxyMethods = (Cmp, methods) => {
|
|
31
|
+
const Prototype = Cmp.prototype;
|
|
32
|
+
methods.forEach((methodName) => {
|
|
33
|
+
Prototype[methodName] = function () {
|
|
34
|
+
const args = arguments;
|
|
35
|
+
return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
exports.proxyMethods = proxyMethods;
|
|
40
|
+
const proxyOutputs = (instance, el, events) => {
|
|
41
|
+
events.forEach((eventName) => (instance[eventName] = (0, rxjs_1.fromEvent)(el, eventName)));
|
|
42
|
+
};
|
|
43
|
+
exports.proxyOutputs = proxyOutputs;
|
|
44
|
+
const defineCustomElement = (tagName, customElement) => {
|
|
45
|
+
if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
|
|
46
|
+
customElements.define(tagName, customElement);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.defineCustomElement = defineCustomElement;
|
|
50
|
+
// tslint:disable-next-line: only-arrow-functions
|
|
51
|
+
function ProxyCmp(opts) {
|
|
52
|
+
const decorator = function (cls) {
|
|
53
|
+
const { defineCustomElementFn, inputs, methods } = opts;
|
|
54
|
+
if (defineCustomElementFn !== undefined) {
|
|
55
|
+
defineCustomElementFn();
|
|
56
|
+
}
|
|
57
|
+
if (inputs) {
|
|
58
|
+
(0, exports.proxyInputs)(cls, inputs);
|
|
59
|
+
}
|
|
60
|
+
if (methods) {
|
|
61
|
+
(0, exports.proxyMethods)(cls, methods);
|
|
62
|
+
}
|
|
63
|
+
return cls;
|
|
64
|
+
};
|
|
65
|
+
return decorator;
|
|
66
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.DIRECTIVES = void 0;
|
|
37
|
+
const d = __importStar(require("./proxies"));
|
|
38
|
+
exports.DIRECTIVES = [
|
|
39
|
+
d.TsAccordion,
|
|
40
|
+
d.TsAccordionItem,
|
|
41
|
+
d.TsAlert,
|
|
42
|
+
d.TsAvatar,
|
|
43
|
+
d.TsBadge,
|
|
44
|
+
d.TsBanner,
|
|
45
|
+
d.TsBreadcrumb,
|
|
46
|
+
d.TsBreadcrumbItem,
|
|
47
|
+
d.TsButton,
|
|
48
|
+
d.TsCard,
|
|
49
|
+
d.TsCheckbox,
|
|
50
|
+
d.TsChip,
|
|
51
|
+
d.TsContainer,
|
|
52
|
+
d.TsDatePicker,
|
|
53
|
+
d.TsDialog,
|
|
54
|
+
d.TsDivider,
|
|
55
|
+
d.TsDrawer,
|
|
56
|
+
d.TsEmptyState,
|
|
57
|
+
d.TsFileUpload,
|
|
58
|
+
d.TsGrid,
|
|
59
|
+
d.TsIcon,
|
|
60
|
+
d.TsInput,
|
|
61
|
+
d.TsMenu,
|
|
62
|
+
d.TsMenuItem,
|
|
63
|
+
d.TsModal,
|
|
64
|
+
d.TsNav,
|
|
65
|
+
d.TsNavItem,
|
|
66
|
+
d.TsPagination,
|
|
67
|
+
d.TsPopover,
|
|
68
|
+
d.TsProgress,
|
|
69
|
+
d.TsRadio,
|
|
70
|
+
d.TsRow,
|
|
71
|
+
d.TsSelect,
|
|
72
|
+
d.TsSkeleton,
|
|
73
|
+
d.TsSlider,
|
|
74
|
+
d.TsSpacer,
|
|
75
|
+
d.TsSpinner,
|
|
76
|
+
d.TsStack,
|
|
77
|
+
d.TsStep,
|
|
78
|
+
d.TsStepper,
|
|
79
|
+
d.TsSwitchGroup,
|
|
80
|
+
d.TsSwitchOption,
|
|
81
|
+
d.TsTabPanel,
|
|
82
|
+
d.TsTable,
|
|
83
|
+
d.TsTabs,
|
|
84
|
+
d.TsTextarea,
|
|
85
|
+
d.TsToast,
|
|
86
|
+
d.TsToggle,
|
|
87
|
+
d.TsToolbar,
|
|
88
|
+
d.TsTooltip,
|
|
89
|
+
d.TsTree,
|
|
90
|
+
d.TsTreeItem
|
|
91
|
+
];
|