@norith/glimmerx-component 1.0.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/addon/index.js +6 -0
- package/dist/commonjs/index.d.ts +8 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +14 -0
- package/dist/modules/index.d.ts +8 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +5 -0
- package/ember-addon-main.js +56 -0
- package/index.ts +21 -0
- package/package.json +33 -0
package/addon/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default } from '@glimmer/component';
|
|
2
|
+
export { tracked } from '@glimmer/tracking';
|
|
3
|
+
export declare abstract class TemplateComponentInstance<S> {
|
|
4
|
+
protected abstract __concrete__: never;
|
|
5
|
+
}
|
|
6
|
+
export type TemplateComponent<S> = abstract new () => TemplateComponentInstance<S>;
|
|
7
|
+
export declare function hbs<S>(_strings: TemplateStringsArray): TemplateComponent<S>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/@glimmerx/component/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAO5C,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,yBAAyB,CAAC,CAAC;IACvD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;CACxC;AAMD,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,QAAQ,WAAW,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAEnF,wBAAgB,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,oBAAoB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAE3E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.hbs = exports.tracked = exports.default = void 0;
|
|
7
|
+
var component_1 = require("@glimmer/component");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(component_1).default; } });
|
|
9
|
+
var tracking_1 = require("@glimmer/tracking");
|
|
10
|
+
Object.defineProperty(exports, "tracked", { enumerable: true, get: function () { return tracking_1.tracked; } });
|
|
11
|
+
function hbs(_strings) {
|
|
12
|
+
throw new Error('hbs template should have been compiled at build time');
|
|
13
|
+
}
|
|
14
|
+
exports.hbs = hbs;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default } from '@glimmer/component';
|
|
2
|
+
export { tracked } from '@glimmer/tracking';
|
|
3
|
+
export declare abstract class TemplateComponentInstance<S> {
|
|
4
|
+
protected abstract __concrete__: never;
|
|
5
|
+
}
|
|
6
|
+
export type TemplateComponent<S> = abstract new () => TemplateComponentInstance<S>;
|
|
7
|
+
export declare function hbs<S>(_strings: TemplateStringsArray): TemplateComponent<S>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/@glimmerx/component/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAO5C,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,yBAAyB,CAAC,CAAC;IACvD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;CACxC;AAMD,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,QAAQ,WAAW,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAEnF,wBAAgB,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,oBAAoB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAE3E"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
let VersionChecker = require('ember-cli-version-checker');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
name: require('./package').name,
|
|
6
|
+
|
|
7
|
+
included() {
|
|
8
|
+
this._super.included.apply(this, arguments);
|
|
9
|
+
|
|
10
|
+
let emberChecker = new VersionChecker(this.project).for('ember-source');
|
|
11
|
+
let htmlbarsChecker = new VersionChecker(this.parent).for('ember-cli-htmlbars');
|
|
12
|
+
|
|
13
|
+
if (!emberChecker.gte('3.25.0')) {
|
|
14
|
+
throw new Error('@norith/glimmerx-component requires ember-source 3.25.0 or higher');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!htmlbarsChecker.gte('5.4.0')) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
'@norith/glimmerx-component requires ember-cli-htmlbars 5.4.0 or higher as a peer dependency'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let addonOptions = this._getAddonOptions();
|
|
24
|
+
|
|
25
|
+
let emberCliHtmlbarsOptions = (addonOptions['ember-cli-htmlbars'] =
|
|
26
|
+
addonOptions['ember-cli-htmlbars'] || {});
|
|
27
|
+
|
|
28
|
+
emberCliHtmlbarsOptions._customInlineModules = {
|
|
29
|
+
'@norith/glimmerx-component': {
|
|
30
|
+
export: 'hbs',
|
|
31
|
+
useTemplateLiteralProposalSemantics: 1,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
'TEMPLATE-TAG-MODULE': {
|
|
35
|
+
export: 'GLIMMER_TEMPLATE',
|
|
36
|
+
debugName: '<template>',
|
|
37
|
+
useTemplateTagProposalSemantics: 1,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
this.templateCompilerPath = this.parent.addons
|
|
42
|
+
.find((a) => a.name === 'ember-cli-htmlbars')
|
|
43
|
+
.templateCompilerPath();
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
_getAddonOptions() {
|
|
47
|
+
return (this.parent && this.parent.options) || (this.app && this.app.options) || {};
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
setupPreprocessorRegistry(type, registry) {
|
|
51
|
+
if (type === 'parent') {
|
|
52
|
+
let TemplateImportPreprocessor = require('ember-template-imports/lib/preprocessor-plugin');
|
|
53
|
+
registry.add('js', new TemplateImportPreprocessor(() => this.templateCompilerPath));
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
package/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { default } from '@glimmer/component';
|
|
2
|
+
export { tracked } from '@glimmer/tracking';
|
|
3
|
+
|
|
4
|
+
// This type exists to provide a non-user-constructible, non-subclassable
|
|
5
|
+
// type representing the conceptual "instance type" of a template-only component.
|
|
6
|
+
// The abstract field of type `never` prevents subclassing in userspace of
|
|
7
|
+
// the value returned from `hbs`.
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
+
export declare abstract class TemplateComponentInstance<S> {
|
|
10
|
+
protected abstract __concrete__: never;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// By making `TemplateComponent` abstract and impossible to subclass
|
|
14
|
+
// (see above), we prevent users from attempting to instantiate a the
|
|
15
|
+
// return value of `hbs` themselves, while leaving a hook for tools
|
|
16
|
+
// like Glint to augment the type.
|
|
17
|
+
export type TemplateComponent<S> = abstract new () => TemplateComponentInstance<S>;
|
|
18
|
+
|
|
19
|
+
export function hbs<S>(_strings: TemplateStringsArray): TemplateComponent<S> {
|
|
20
|
+
throw new Error('hbs template should have been compiled at build time');
|
|
21
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@norith/glimmerx-component",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Base component class",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ember-addon"
|
|
7
|
+
],
|
|
8
|
+
"main": "dist/commonjs/index.js",
|
|
9
|
+
"module": "dist/modules/index.js",
|
|
10
|
+
"repository": "https://github.com/snorith/glimmer-experimental",
|
|
11
|
+
"author": "Tom Dale <tom@tomdale.net>",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"private": false,
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "webpack"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@norith/glimmer-component": "1.0.0",
|
|
19
|
+
"@norith/glimmer-tracking": "1.0.0",
|
|
20
|
+
"ember-cli-babel": "^7.26.2",
|
|
21
|
+
"ember-cli-babel-plugin-helpers": "^1.1.0",
|
|
22
|
+
"ember-cli-htmlbars": "^5.7.1",
|
|
23
|
+
"ember-cli-version-checker": "5.1.2",
|
|
24
|
+
"ember-template-imports": "^1.1.1"
|
|
25
|
+
},
|
|
26
|
+
"ember-addon": {
|
|
27
|
+
"main": "ember-addon-main.js"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"registry": "https://registry.npmjs.org"
|
|
32
|
+
}
|
|
33
|
+
}
|