@htmlplus/element 0.1.3 → 0.1.6
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/dist/client/decorators/element.js +1 -2
- package/dist/client/decorators/event.d.ts +19 -1
- package/dist/client/decorators/index.js +0 -1
- package/dist/client/decorators/listen.d.ts +8 -1
- package/dist/client/decorators/property.d.ts +11 -1
- package/dist/client/helpers/direction.d.ts +1 -1
- package/dist/client/helpers/slots.js +1 -1
- package/dist/client/utils/api.d.ts +5 -1
- package/dist/client/utils/host.js +1 -1
- package/dist/compiler/compiler.js +3 -3
- package/dist/compiler/index.d.ts +1 -2
- package/dist/compiler/index.js +1 -2
- package/dist/compiler/plugins/attach.js +12 -20
- package/dist/compiler/plugins/docs.js +1 -0
- package/dist/compiler/plugins/extract.js +14 -2
- package/dist/compiler/plugins/index.d.ts +1 -0
- package/dist/compiler/plugins/index.js +1 -0
- package/dist/compiler/plugins/react.proxy/index.d.ts +1 -0
- package/dist/compiler/plugins/react.proxy/index.js +1 -0
- package/dist/compiler/plugins/react.proxy/react.proxy.d.ts +11 -0
- package/dist/compiler/plugins/react.proxy/react.proxy.js +119 -0
- package/dist/compiler/plugins/react.proxy/templates/README.md.hbs +1 -0
- package/dist/compiler/plugins/react.proxy/templates/_.gitignore.hbs +2 -0
- package/dist/compiler/plugins/react.proxy/templates/package.json.hbs +37 -0
- package/dist/compiler/plugins/react.proxy/templates/rollup.config.js.hbs +21 -0
- package/dist/compiler/plugins/react.proxy/templates/src/components/index.ts.hbs +13 -0
- package/dist/compiler/plugins/react.proxy/templates/src/components/{{fileName}}.compact.ts.hbs +15 -0
- package/dist/compiler/plugins/react.proxy/templates/src/components/{{fileName}}.ts.hbs +23 -0
- package/dist/compiler/plugins/react.proxy/templates/src/index.ts.hbs +1 -0
- package/dist/compiler/plugins/react.proxy/templates/src/proxy.ts.hbs +277 -0
- package/dist/compiler/plugins/react.proxy/templates/tsconfig.json.hbs +17 -0
- package/dist/compiler/utils/__dirname.d.ts +1 -0
- package/dist/compiler/utils/__dirname.js +5 -0
- package/dist/compiler/utils/index.d.ts +3 -0
- package/dist/compiler/utils/index.js +3 -0
- package/dist/compiler/utils/is-directory-empty.d.ts +1 -0
- package/dist/compiler/utils/is-directory-empty.js +10 -0
- package/dist/compiler/utils/render-template.d.ts +1 -0
- package/dist/compiler/utils/render-template.js +25 -0
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +2 -1
- package/dist/types/context.d.ts +2 -0
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.js +0 -5
- package/dist/types/plugin.d.ts +4 -3
- package/package.json +10 -4
- package/dist/client/decorators/listen-options.d.ts +0 -2
- package/dist/client/decorators/listen-options.js +0 -2
- package/dist/types/api.d.ts +0 -5
- package/dist/types/api.js +0 -1
- package/dist/types/direction.d.ts +0 -1
- package/dist/types/direction.js +0 -1
- package/dist/types/event-options.d.ts +0 -18
- package/dist/types/event-options.js +0 -1
- package/dist/types/listen-options.d.ts +0 -7
- package/dist/types/listen-options.js +0 -1
- package/dist/types/property-options.d.ts +0 -10
- package/dist/types/property-options.js +0 -1
|
@@ -93,8 +93,7 @@ export function Element(tag) {
|
|
|
93
93
|
this.plus[name] = parseValue(next, type);
|
|
94
94
|
if (!this.plus[CONSTANTS.TOKEN_API][CONSTANTS.TOKEN_API_READY])
|
|
95
95
|
return;
|
|
96
|
-
this.plus[CONSTANTS.TOKEN_API][CONSTANTS.TOKEN_API_REQUEST]()
|
|
97
|
-
.catch((error) => {
|
|
96
|
+
this.plus[CONSTANTS.TOKEN_API][CONSTANTS.TOKEN_API_REQUEST]().catch((error) => {
|
|
98
97
|
throw error;
|
|
99
98
|
});
|
|
100
99
|
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlusElement } from '../../types/index.js';
|
|
2
2
|
export declare type EventEmitter<T = any> = (data?: T) => CustomEvent<T>;
|
|
3
|
+
export interface EventOptions {
|
|
4
|
+
/**
|
|
5
|
+
* A string custom event name to override the default.
|
|
6
|
+
*/
|
|
7
|
+
name?: string;
|
|
8
|
+
/**
|
|
9
|
+
* A Boolean indicating whether the event bubbles up through the DOM or not. default is `false`.
|
|
10
|
+
*/
|
|
11
|
+
bubbles?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* A Boolean indicating whether the event is cancelable. default is `false`.
|
|
14
|
+
*/
|
|
15
|
+
cancelable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A Boolean value indicating whether or not the event can bubble across the boundary between the shadow DOM and the regular DOM. The default is false.
|
|
18
|
+
*/
|
|
19
|
+
composed?: boolean;
|
|
20
|
+
}
|
|
3
21
|
export declare function Event<T = any>(options?: EventOptions): (target: PlusElement, propertyKey: PropertyKey) => void;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlusElement } from '../../types/index.js';
|
|
2
|
+
export interface ListenOptions {
|
|
3
|
+
target?: 'host' | 'body' | 'document' | 'window';
|
|
4
|
+
once?: boolean;
|
|
5
|
+
passive?: boolean;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
capture?: boolean;
|
|
8
|
+
}
|
|
2
9
|
export declare function Listen(name: string, options?: ListenOptions): (target: PlusElement, propertyKey: PropertyKey, descriptor: PropertyDescriptor) => {
|
|
3
10
|
configurable: boolean;
|
|
4
11
|
get(): any;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import { PlusElement
|
|
1
|
+
import { PlusElement } from '../../types/index.js';
|
|
2
|
+
export interface PropertyOptions {
|
|
3
|
+
/**
|
|
4
|
+
* TODO
|
|
5
|
+
*/
|
|
6
|
+
attribute?: boolean | string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether property value is reflected back to the associated attribute. default is `false`.
|
|
9
|
+
*/
|
|
10
|
+
reflect?: boolean;
|
|
11
|
+
}
|
|
2
12
|
export declare function Property(options?: PropertyOptions): (target: PlusElement, propertyKey: PropertyKey) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export declare type Direction = 'ltr' | 'rtl';
|
|
2
2
|
export declare const direction: (target: any) => Direction;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { api } from '
|
|
1
|
+
import { api } from './api.js';
|
|
2
2
|
export const host = (target) => api(target).host();
|
|
@@ -12,7 +12,7 @@ const log = (namespace, message) => {
|
|
|
12
12
|
logUpdate(`${new Date().toLocaleTimeString()} [@htmlplus/element]${namespace ? `[${namespace}]` : ''} ${message}`);
|
|
13
13
|
};
|
|
14
14
|
export default (...plugins) => {
|
|
15
|
-
|
|
15
|
+
let global = {
|
|
16
16
|
contexts: {}
|
|
17
17
|
};
|
|
18
18
|
const start = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -20,7 +20,7 @@ export default (...plugins) => {
|
|
|
20
20
|
for (const plugin of plugins) {
|
|
21
21
|
if (!plugin.start)
|
|
22
22
|
continue;
|
|
23
|
-
yield plugin.start(global);
|
|
23
|
+
global = (yield plugin.start(global)) || global;
|
|
24
24
|
log(plugin.name, 'Started successfully.');
|
|
25
25
|
}
|
|
26
26
|
});
|
|
@@ -43,7 +43,7 @@ export default (...plugins) => {
|
|
|
43
43
|
for (const plugin of plugins) {
|
|
44
44
|
if (!plugin.finish)
|
|
45
45
|
continue;
|
|
46
|
-
yield plugin.finish(global);
|
|
46
|
+
global = (yield plugin.finish(global)) || global;
|
|
47
47
|
log(plugin.name, 'Finished successfully.');
|
|
48
48
|
}
|
|
49
49
|
log(undefined, 'Finished.');
|
package/dist/compiler/index.d.ts
CHANGED
package/dist/compiler/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import t from '@babel/types';
|
|
2
|
-
import { pascalCase } from 'change-case';
|
|
3
2
|
import * as CONSTANTS from '../../configs/constants.js';
|
|
4
3
|
import { visitor } from '../utils/index.js';
|
|
5
4
|
const defaults = {
|
|
@@ -48,43 +47,36 @@ export const attach = (options) => {
|
|
|
48
47
|
]), undefined, undefined, undefined, true));
|
|
49
48
|
}
|
|
50
49
|
if (options.typings) {
|
|
51
|
-
const className = pascalCase(context.componentTag.split('-').slice(1).join('-'));
|
|
52
|
-
const elementName = `HTML${className}Element`;
|
|
53
50
|
visitor(context.fileAST, {
|
|
54
51
|
Program(path) {
|
|
55
52
|
path.node.body.push(Object.assign(t.tsModuleDeclaration(t.identifier('global'), t.tsModuleBlock([
|
|
56
|
-
t.tsInterfaceDeclaration(t.identifier(
|
|
53
|
+
t.tsInterfaceDeclaration(t.identifier(context.componentInterfaceName), null, [], t.tsInterfaceBody([
|
|
57
54
|
...context.classProperties.map((property) => Object.assign(t.tSPropertySignature(property.key, property.typeAnnotation), {
|
|
58
55
|
optional: property.optional,
|
|
59
56
|
leadingComments: property.leadingComments
|
|
60
57
|
}))
|
|
61
58
|
])),
|
|
62
59
|
t.variableDeclaration('var', [
|
|
63
|
-
t.variableDeclarator(Object.assign(t.identifier(
|
|
60
|
+
t.variableDeclarator(Object.assign(t.identifier(context.componentInterfaceName), {
|
|
64
61
|
typeAnnotation: t.tSTypeAnnotation(t.tSTypeLiteral([
|
|
65
|
-
t.tSPropertySignature(t.identifier('prototype'), t.tsTypeAnnotation(t.tSTypeReference(t.identifier(
|
|
66
|
-
t.tSConstructSignatureDeclaration(null, [], t.tSTypeAnnotation(t.tSTypeReference(t.identifier(
|
|
62
|
+
t.tSPropertySignature(t.identifier('prototype'), t.tsTypeAnnotation(t.tSTypeReference(t.identifier(context.componentInterfaceName)))),
|
|
63
|
+
t.tSConstructSignatureDeclaration(null, [], t.tSTypeAnnotation(t.tSTypeReference(t.identifier(context.componentInterfaceName))))
|
|
67
64
|
]))
|
|
68
65
|
}))
|
|
69
66
|
]),
|
|
70
|
-
t.tsInterfaceDeclaration(t.identifier(className), null, [], t.tsInterfaceBody([
|
|
71
|
-
...context.classProperties.map((property) => Object.assign(t.tSPropertySignature(property.key, property.typeAnnotation), {
|
|
72
|
-
optional: property.optional,
|
|
73
|
-
leadingComments: property.leadingComments
|
|
74
|
-
}))
|
|
75
|
-
])),
|
|
76
67
|
t.tsInterfaceDeclaration(t.identifier('HTMLElementTagNameMap'), null, [], t.tsInterfaceBody([
|
|
77
|
-
t.tSPropertySignature(t.stringLiteral(context.componentTag), t.tSTypeAnnotation(t.tSIntersectionType([t.tSTypeReference(t.identifier(
|
|
78
|
-
]))
|
|
79
|
-
t.exportNamedDeclaration(t.tSModuleDeclaration(t.identifier('JSX'), t.tsModuleBlock([
|
|
80
|
-
t.tsInterfaceDeclaration(t.identifier('IntrinsicElements'), undefined, undefined, t.tsInterfaceBody([
|
|
81
|
-
t.tsPropertySignature(t.stringLiteral(context.componentTag), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(className))))
|
|
82
|
-
]))
|
|
83
|
-
])))
|
|
68
|
+
t.tSPropertySignature(t.stringLiteral(context.componentTag), t.tSTypeAnnotation(t.tSIntersectionType([t.tSTypeReference(t.identifier(context.componentInterfaceName))])))
|
|
69
|
+
]))
|
|
84
70
|
])), {
|
|
85
71
|
declare: true,
|
|
86
72
|
global: true
|
|
87
73
|
}));
|
|
74
|
+
path.node.body.push(t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(context.componentClassName + 'JSX'), null, [], t.tsInterfaceBody([
|
|
75
|
+
...context.classProperties.map((property) => Object.assign(t.tSPropertySignature(property.key, property.typeAnnotation), {
|
|
76
|
+
optional: property.optional,
|
|
77
|
+
leadingComments: property.leadingComments
|
|
78
|
+
}))
|
|
79
|
+
]))));
|
|
88
80
|
}
|
|
89
81
|
});
|
|
90
82
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
|
-
import { paramCase } from 'change-case';
|
|
2
|
+
import { pascalCase, paramCase } from 'change-case';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import * as CONSTANTS from '../../configs/constants.js';
|
|
@@ -43,7 +43,19 @@ export const extract = (options) => {
|
|
|
43
43
|
context.fileExtension = path.extname(context.filePath);
|
|
44
44
|
context.fileName = path.basename(context.filePath, context.fileExtension);
|
|
45
45
|
context.className = (_b = (_a = context.class) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.name;
|
|
46
|
-
|
|
46
|
+
// TODO
|
|
47
|
+
// context.componentKey = paramCase(context.className);
|
|
48
|
+
context.componentClassName = pascalCase(context.componentTag.split('-').slice(1).join('-'));
|
|
49
|
+
context.componentInterfaceName = `HTML${context.componentClassName}Element`;
|
|
50
|
+
// TODO
|
|
51
|
+
// const componentClassName = "DialogBody"; [OK]
|
|
52
|
+
// const componentInterfaceName = "HTMLDialogBodyElement"; [OK]
|
|
53
|
+
// const componentTag = "plus-dialog-body"; [OK]
|
|
54
|
+
// const componentClassNameInCategory = "Body"; [RAW]
|
|
55
|
+
// const componentKey = "dialog-body-1"; [RAW]
|
|
56
|
+
// const fileName = "dialogBodyNew"; [OK]
|
|
57
|
+
// const className = "DialogBody1"; [OK]
|
|
58
|
+
// const category = "Dialog"; [RAW]
|
|
47
59
|
(() => {
|
|
48
60
|
const stylePath = path.join(context.directoryPath, `${context.fileName}.scss`);
|
|
49
61
|
if (!fs.existsSync(stylePath))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react.proxy.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './react.proxy.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ReactProxyOptions {
|
|
2
|
+
compact?: boolean;
|
|
3
|
+
dist: string;
|
|
4
|
+
eventName?: (eventName: string) => string;
|
|
5
|
+
importerComponent?: (context: any) => string;
|
|
6
|
+
importerComponentType?: (context: any) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare const reactProxy: (options: ReactProxyOptions) => {
|
|
9
|
+
name: string;
|
|
10
|
+
finish: (global: any) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { __dirname, isDirectoryEmpty, renderTemplate } from '../../utils/index.js';
|
|
2
|
+
const defaults = {
|
|
3
|
+
compact: false,
|
|
4
|
+
dist: '',
|
|
5
|
+
eventName: undefined,
|
|
6
|
+
importerComponent(context) {
|
|
7
|
+
return `YOUR_CORE_PACKAGE_NAME#${context.componentClassName}`;
|
|
8
|
+
},
|
|
9
|
+
importerComponentType(context) {
|
|
10
|
+
return `YOUR_CORE_PACKAGE_NAME#JSX.${context.componentClassName}`;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const reactProxy = (options) => {
|
|
14
|
+
const name = 'react-proxy';
|
|
15
|
+
const finish = (global) => {
|
|
16
|
+
options = Object.assign(Object.assign({}, defaults), options);
|
|
17
|
+
global = Object.assign(Object.assign({}, global), { options });
|
|
18
|
+
const config = { cwd: __dirname(import.meta.url) };
|
|
19
|
+
const isEmpty = isDirectoryEmpty(options.dist);
|
|
20
|
+
const skip = [];
|
|
21
|
+
const getKey = (component) => component.componentClassName;
|
|
22
|
+
for (const key in global.contexts) {
|
|
23
|
+
const context = global.contexts[key];
|
|
24
|
+
const parse = (input) => {
|
|
25
|
+
const [source, key] = input.split('#');
|
|
26
|
+
const [root, ...sub] = key.split('.');
|
|
27
|
+
const variable = ['Type', ...sub].join('.');
|
|
28
|
+
return {
|
|
29
|
+
source,
|
|
30
|
+
variable,
|
|
31
|
+
root
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const classEvents = context.classEvents.map((classEvent) => {
|
|
35
|
+
return Object.assign(Object.assign({}, classEvent), { converted: options.eventName(classEvent.key.name) });
|
|
36
|
+
});
|
|
37
|
+
const fileName = context.fileName;
|
|
38
|
+
const importerComponent = parse(options.importerComponent(context));
|
|
39
|
+
const importerComponentType = parse(options.importerComponentType(context));
|
|
40
|
+
const state = Object.assign(Object.assign({}, context), { classEvents,
|
|
41
|
+
fileName,
|
|
42
|
+
importerComponent,
|
|
43
|
+
importerComponentType,
|
|
44
|
+
options });
|
|
45
|
+
const patterns = [
|
|
46
|
+
'templates/src/components/*fileName*.ts.hbs',
|
|
47
|
+
'!templates/src/components/*fileName*.compact.ts.hbs'
|
|
48
|
+
];
|
|
49
|
+
renderTemplate(patterns, options.dist, config)(state);
|
|
50
|
+
}
|
|
51
|
+
if (options.compact) {
|
|
52
|
+
global.groups = Object.values(global.contexts)
|
|
53
|
+
.sort((a, b) => getKey(b).length - getKey(a).length)
|
|
54
|
+
.map((component, index, components) => ({
|
|
55
|
+
key: getKey(component),
|
|
56
|
+
components: components.filter((current) => getKey(current).startsWith(getKey(component)))
|
|
57
|
+
}))
|
|
58
|
+
.sort((a, b) => b.components.length - a.components.length)
|
|
59
|
+
.filter((group) => {
|
|
60
|
+
if (skip.includes(group.key))
|
|
61
|
+
return;
|
|
62
|
+
group.components.forEach((component) => skip.push(getKey(component)));
|
|
63
|
+
return true;
|
|
64
|
+
})
|
|
65
|
+
.map((group) => {
|
|
66
|
+
const all = group.components.reverse().map((component, index) => {
|
|
67
|
+
const componentClassNameInCategory = getKey(component).replace(group.key, '');
|
|
68
|
+
const parse = (input) => {
|
|
69
|
+
const [source, key] = input.split('#');
|
|
70
|
+
const [root, ...sub] = key.split('.');
|
|
71
|
+
const local = root + (index + 1);
|
|
72
|
+
const variable = [local, ...sub].join('.');
|
|
73
|
+
return {
|
|
74
|
+
source,
|
|
75
|
+
variable,
|
|
76
|
+
root,
|
|
77
|
+
local
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const importerComponent = parse(options.importerComponent(component));
|
|
81
|
+
const importerComponentType = parse(options.importerComponentType(component));
|
|
82
|
+
return Object.assign(Object.assign({}, component), { componentClassNameInCategory,
|
|
83
|
+
importerComponent,
|
|
84
|
+
importerComponentType });
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
all,
|
|
88
|
+
filterd: all.slice(1),
|
|
89
|
+
root: all.at(0),
|
|
90
|
+
single: all.length == 1
|
|
91
|
+
};
|
|
92
|
+
})
|
|
93
|
+
.sort((a, b) => (getKey(a.root) < getKey(b.root) ? -1 : 0));
|
|
94
|
+
for (const group of global.groups) {
|
|
95
|
+
if (group.single)
|
|
96
|
+
continue;
|
|
97
|
+
const state = Object.assign({ fileName: group.root.fileName, options }, group);
|
|
98
|
+
const patterns = ['templates/src/components/*fileName*.compact.ts.hbs'];
|
|
99
|
+
renderTemplate(patterns, options.dist, config)(state);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (isEmpty) {
|
|
103
|
+
const patterns = [
|
|
104
|
+
'templates/**',
|
|
105
|
+
'!templates/src/components/*fileName*.ts.hbs',
|
|
106
|
+
'!templates/src/components/*fileName*.compact.ts.hbs'
|
|
107
|
+
];
|
|
108
|
+
renderTemplate(patterns, options.dist, config)(global);
|
|
109
|
+
}
|
|
110
|
+
if (!isEmpty) {
|
|
111
|
+
const patterns = ['templates/src/proxy*', 'templates/src/components/index*'];
|
|
112
|
+
renderTemplate(patterns, options.dist, config)(global);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
name,
|
|
117
|
+
finish
|
|
118
|
+
};
|
|
119
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# React output target for your custom element.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "YOUR_REACT_PACKAGE_NAME",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "React output target for your custom element.",
|
|
6
|
+
"exports": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"prebuild": "npm run clean",
|
|
10
|
+
"build": "rollup -c",
|
|
11
|
+
"clean": "rimraf dist"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"YOUR_CORE_PACKAGE_NAME": "latest",
|
|
18
|
+
"change-case": "^4.1.2"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@rollup/plugin-commonjs": "^15.0.0",
|
|
22
|
+
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
23
|
+
"@types/react": "^16.9.49",
|
|
24
|
+
"glob": "^7.2.0",
|
|
25
|
+
"react": "^17.0.1",
|
|
26
|
+
"react-dom": "^17.0.1",
|
|
27
|
+
"rimraf": "^3.0.2",
|
|
28
|
+
"rollup": "^2.27.1",
|
|
29
|
+
"rollup-plugin-peer-deps-external": "^2.2.3",
|
|
30
|
+
"rollup-plugin-typescript2": "^0.27.2",
|
|
31
|
+
"typescript": "^4.0.2"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": "^16.0.0 || ^17.0.0",
|
|
35
|
+
"react-dom": "^16.0.0 || ^17.0.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
+
import glob from 'glob';
|
|
4
|
+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
5
|
+
import typescript from 'rollup-plugin-typescript2';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
input: glob.sync('src/**/*.ts'),
|
|
9
|
+
output: [
|
|
10
|
+
{
|
|
11
|
+
dir: 'dist',
|
|
12
|
+
format: 'esm',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
plugins: [
|
|
16
|
+
peerDepsExternal(),
|
|
17
|
+
resolve(),
|
|
18
|
+
commonjs(),
|
|
19
|
+
typescript(),
|
|
20
|
+
],
|
|
21
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{{#if options.compact}}
|
|
2
|
+
{{#each groups}}
|
|
3
|
+
{{#if single}}
|
|
4
|
+
export * from './{{root.fileName}}';
|
|
5
|
+
{{else}}
|
|
6
|
+
export * from './{{root.fileName}}.compact';
|
|
7
|
+
{{/if}}
|
|
8
|
+
{{/each}}
|
|
9
|
+
{{else}}
|
|
10
|
+
{{#each contexts}}
|
|
11
|
+
export * from './{{fileName}}';
|
|
12
|
+
{{/each}}
|
|
13
|
+
{{/if}}
|
package/dist/compiler/plugins/react.proxy/templates/src/components/{{fileName}}.compact.ts.hbs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* auto-generated */
|
|
4
|
+
|
|
5
|
+
{{#each all}}
|
|
6
|
+
import { {{componentClassName}} } from './{{fileName}}';
|
|
7
|
+
{{/each}}
|
|
8
|
+
|
|
9
|
+
const All = /*@__PURE__*/ Object.assign({{root.componentClassName}}, {
|
|
10
|
+
{{#each filterd}}
|
|
11
|
+
{{componentClassNameInCategory}}: {{componentClassName}},
|
|
12
|
+
{{/each}}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { All as {{root.componentClassName}} }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* auto-generated */
|
|
4
|
+
|
|
5
|
+
import { proxy } from '../proxy';
|
|
6
|
+
|
|
7
|
+
{{!-- import { {{importerComponent.root}} as Component } from '{{importerComponent.source}}'; --}}
|
|
8
|
+
import '{{importerComponent.source}}';
|
|
9
|
+
import type { {{importerComponentType.root}} as Type } from '{{importerComponentType.source}}';
|
|
10
|
+
|
|
11
|
+
type Rename<T, R extends { [K in keyof R]: K extends keyof T ? PropertyKey : "Error: key not in T" }> = { [P in keyof T as P extends keyof R ? R[P] : P]: T[P] }
|
|
12
|
+
|
|
13
|
+
type Renamed = Rename<{{importerComponentType.variable}}, {
|
|
14
|
+
{{#each classEvents}}
|
|
15
|
+
{{key.name}}: '{{converted}}',
|
|
16
|
+
{{/each}}
|
|
17
|
+
}>
|
|
18
|
+
|
|
19
|
+
export const {{componentClassName}} = /*@__PURE__*/ proxy<{{componentInterfaceName}}, Renamed>(
|
|
20
|
+
'{{componentTag}}',
|
|
21
|
+
[{{#each classProperties}}'{{key.name}}', {{/each}}],
|
|
22
|
+
[{{#each classEvents}}'{{key.name}}', {{/each}}],
|
|
23
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* version 0.0.9
|
|
3
|
+
*/
|
|
4
|
+
import { camelCase, paramCase, pascalCase } from 'change-case';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
type EventHandlerType = (event: Event) => any;
|
|
8
|
+
|
|
9
|
+
type FinalPropsType<ElementType> = Omit<PropsType<ElementType>, 'forwardedRef'>;
|
|
10
|
+
|
|
11
|
+
type Mutable<T> = { -readonly [P in keyof T]-?: T[P] };
|
|
12
|
+
|
|
13
|
+
interface ExtraType {
|
|
14
|
+
props?: Array<string>;
|
|
15
|
+
events?: Array<string>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface PropsType<ElementType> extends React.HTMLAttributes<ElementType> {
|
|
19
|
+
forwardedRef: React.RefObject<ElementType>;
|
|
20
|
+
ref?: React.Ref<any>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface StyleReactProps {
|
|
24
|
+
class?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const arrayToMap = (array: string[] | DOMTokenList) => {
|
|
32
|
+
const map = new Map<string, string>();
|
|
33
|
+
|
|
34
|
+
(array as string[]).forEach((s: string) => map.set(s, s));
|
|
35
|
+
|
|
36
|
+
return map;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getCustomEvent = (name: string, events: Array<string>) => {
|
|
40
|
+
// TODO
|
|
41
|
+
name = camelCase(name.slice(3));
|
|
42
|
+
|
|
43
|
+
const event = events.find((event) => event.endsWith(name));
|
|
44
|
+
|
|
45
|
+
if (!event) return;
|
|
46
|
+
|
|
47
|
+
return event;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const forwardRef = <ElementType, PropType>(ReactComponent: any) => {
|
|
51
|
+
const forwardRef = (
|
|
52
|
+
props: PropType & Omit<React.HTMLAttributes<ElementType>, 'style'> & StyleReactProps,
|
|
53
|
+
ref: React.Ref<ElementType>
|
|
54
|
+
) => {
|
|
55
|
+
const { children, ...remainedProps } = props;
|
|
56
|
+
|
|
57
|
+
const newProps = {
|
|
58
|
+
...remainedProps,
|
|
59
|
+
forwardedRef: ref
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return React.createElement(ReactComponent, newProps, children);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
forwardRef.displayName = ReactComponent.displayName;
|
|
66
|
+
|
|
67
|
+
return React.forwardRef(forwardRef);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const isEvent = (name: string) => {
|
|
71
|
+
return name.indexOf('on') === 0 && name[2] === name[2].toUpperCase();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const isPrimitive = (value: any) => {
|
|
75
|
+
const type = typeof value;
|
|
76
|
+
|
|
77
|
+
const match = type.match(/boolean|string|number/);
|
|
78
|
+
|
|
79
|
+
return match;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const getProps = <ElementType>(ref: React.Ref<ElementType>, props: PropsType<ElementType>, extra: ExtraType) => {
|
|
83
|
+
const { forwardedRef } = props;
|
|
84
|
+
|
|
85
|
+
const result: FinalPropsType<ElementType> = {
|
|
86
|
+
ref: mergeRefs(forwardedRef, ref)
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
Object.keys(props).forEach((name) => {
|
|
90
|
+
if (name === 'children' || name === 'className' || name === 'forwardedRef' || name === 'ref') return;
|
|
91
|
+
|
|
92
|
+
const value = props[name];
|
|
93
|
+
|
|
94
|
+
if (isEvent(name)) {
|
|
95
|
+
if (typeof document === 'undefined') return;
|
|
96
|
+
|
|
97
|
+
const event = getCustomEvent(name, extra.events);
|
|
98
|
+
|
|
99
|
+
if (event) return;
|
|
100
|
+
|
|
101
|
+
result[name] = value;
|
|
102
|
+
} else if (extra.props.includes(name)) {
|
|
103
|
+
if (!isPrimitive(value)) return;
|
|
104
|
+
|
|
105
|
+
result[paramCase(name)] = value;
|
|
106
|
+
} else {
|
|
107
|
+
result[name] = value;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return result;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const mergeRefs =
|
|
115
|
+
<ElementType>(...refs: React.Ref<ElementType>[]) =>
|
|
116
|
+
(value: ElementType) => {
|
|
117
|
+
return refs.forEach((ref) => {
|
|
118
|
+
if (typeof ref === 'function') return ref(value);
|
|
119
|
+
|
|
120
|
+
if (ref == null) return;
|
|
121
|
+
|
|
122
|
+
(ref as Mutable<React.RefObject<ElementType>>).current = value;
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const setClass = <ElementType>(element: ElementType, props: PropsType<ElementType>) => {
|
|
127
|
+
const classes: string[] = [];
|
|
128
|
+
|
|
129
|
+
const current = arrayToMap((element as any).classList);
|
|
130
|
+
|
|
131
|
+
const prev: string = element['$class'];
|
|
132
|
+
const next: string = props.className || (props as any).class;
|
|
133
|
+
|
|
134
|
+
const prevClass = arrayToMap(prev ? prev.split(' ') : []);
|
|
135
|
+
const nextClass = arrayToMap(next ? next.split(' ') : []);
|
|
136
|
+
|
|
137
|
+
current.forEach((key) => {
|
|
138
|
+
if (nextClass.has(key)) {
|
|
139
|
+
classes.push(key);
|
|
140
|
+
|
|
141
|
+
nextClass.delete(key);
|
|
142
|
+
} else if (!prevClass.has(key)) {
|
|
143
|
+
classes.push(key);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
nextClass.forEach((key) => classes.push(key));
|
|
148
|
+
|
|
149
|
+
const className = classes.join(' ');
|
|
150
|
+
|
|
151
|
+
(element as any).className = className;
|
|
152
|
+
|
|
153
|
+
element['$class'] = className;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const setEvent = (element: Element, name: string, handler: EventHandlerType) => {
|
|
157
|
+
const events = element['$events'] || (element['$events'] = {});
|
|
158
|
+
|
|
159
|
+
const previous = events[name];
|
|
160
|
+
|
|
161
|
+
previous && element.removeEventListener(name, previous);
|
|
162
|
+
|
|
163
|
+
function callback(event: Event) {
|
|
164
|
+
handler && handler.call(this, event);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
element.addEventListener(name, (events[name] = callback));
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const setProps = <ElementType>(element: ElementType, props: PropsType<ElementType>, extra: ExtraType) => {
|
|
171
|
+
if (!(element instanceof Element)) return;
|
|
172
|
+
|
|
173
|
+
setClass<ElementType>(element, props);
|
|
174
|
+
|
|
175
|
+
Object.keys(props).forEach((name) => {
|
|
176
|
+
if (
|
|
177
|
+
name === 'children' ||
|
|
178
|
+
name === 'class' ||
|
|
179
|
+
name === 'className' ||
|
|
180
|
+
name === 'forwardedRef' ||
|
|
181
|
+
name === 'ref' ||
|
|
182
|
+
name === 'style'
|
|
183
|
+
)
|
|
184
|
+
return;
|
|
185
|
+
|
|
186
|
+
const value = props[name];
|
|
187
|
+
|
|
188
|
+
if (isEvent(name)) {
|
|
189
|
+
if (typeof document === 'undefined') return;
|
|
190
|
+
|
|
191
|
+
const event = getCustomEvent(name, extra.events);
|
|
192
|
+
|
|
193
|
+
if (!event) return;
|
|
194
|
+
|
|
195
|
+
setEvent(element, event, value);
|
|
196
|
+
} else if (extra.props.includes(name)) {
|
|
197
|
+
if (isPrimitive(value)) {
|
|
198
|
+
element.setAttribute(paramCase(name), value);
|
|
199
|
+
} else {
|
|
200
|
+
element[name] = value;
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
element[name] = value;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export const proxy = <ElementType, PropType>(
|
|
209
|
+
tagName: string,
|
|
210
|
+
props: Array<string> = [],
|
|
211
|
+
events: Array<string> = []
|
|
212
|
+
) => {
|
|
213
|
+
const extra: ExtraType = {
|
|
214
|
+
props,
|
|
215
|
+
events
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const ReactComponent = class extends React.Component<PropsType<ElementType>> {
|
|
219
|
+
element!: ElementType;
|
|
220
|
+
|
|
221
|
+
setElement = (element: ElementType) => {
|
|
222
|
+
this.element = element;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
constructor(props: PropsType<ElementType>) {
|
|
226
|
+
super(props);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
componentDidMount() {
|
|
230
|
+
this.componentDidUpdate(/*this.props*/);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
componentDidUpdate(/*prevProps: InternalProps<ElementType>*/) {
|
|
234
|
+
setProps<ElementType>(this.element as any, this.props, extra);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
componentWillUnmount() {
|
|
238
|
+
if (!this.element) return;
|
|
239
|
+
|
|
240
|
+
const events = this.element['$events'] || {};
|
|
241
|
+
|
|
242
|
+
Object.keys(events).forEach((name) => {
|
|
243
|
+
const handler = events[name];
|
|
244
|
+
|
|
245
|
+
(this.element as any).removeEventListener(name, handler);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
delete this.element['$events'];
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
render() {
|
|
252
|
+
const { children } = this.props;
|
|
253
|
+
|
|
254
|
+
const props = getProps<ElementType>(this.setElement, this.props, extra);
|
|
255
|
+
|
|
256
|
+
return React.createElement(tagName, props, children);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// TODO
|
|
261
|
+
// const ReactComponentNew = (props: InternalPropsType<ElementType>) => {
|
|
262
|
+
|
|
263
|
+
// const { children } = props;
|
|
264
|
+
|
|
265
|
+
// const ref = useRef(null);
|
|
266
|
+
|
|
267
|
+
// const newProps: FinalPropsType<ElementType> = getProps(ref, props, events);
|
|
268
|
+
|
|
269
|
+
// useEffect(() => setProps(ref.current, props, events));
|
|
270
|
+
|
|
271
|
+
// return React.createElement(tagName, newProps, children);
|
|
272
|
+
// }
|
|
273
|
+
|
|
274
|
+
ReactComponent['displayName'] = pascalCase(tagName);
|
|
275
|
+
|
|
276
|
+
return forwardRef<ElementType, PropType>(ReactComponent);
|
|
277
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"experimentalDecorators": true,
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationDir": "dist",
|
|
6
|
+
"module": "esnext",
|
|
7
|
+
"target": "es5",
|
|
8
|
+
"lib": ["es6", "dom", "es2016", "es2017"],
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"jsx": "react",
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"esModuleInterop": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["src"],
|
|
16
|
+
"exclude": ["dist", "node_modules"]
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const __dirname: (url: string | URL) => string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
export * from './__dirname.js';
|
|
1
2
|
export * from './get-initializer.js';
|
|
2
3
|
export * from './get-tags.js';
|
|
3
4
|
export * from './get-type.js';
|
|
4
5
|
export * from './has-decorator.js';
|
|
6
|
+
export * from './is-directory-empty.js';
|
|
5
7
|
export * from './print-type.js';
|
|
6
8
|
export * from './print.js';
|
|
9
|
+
export * from './render-template.js';
|
|
7
10
|
export * from './visitor.js';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
export * from './__dirname.js';
|
|
1
2
|
export * from './get-initializer.js';
|
|
2
3
|
export * from './get-tags.js';
|
|
3
4
|
export * from './get-type.js';
|
|
4
5
|
export * from './has-decorator.js';
|
|
6
|
+
export * from './is-directory-empty.js';
|
|
5
7
|
export * from './print-type.js';
|
|
6
8
|
export * from './print.js';
|
|
9
|
+
export * from './render-template.js';
|
|
7
10
|
export * from './visitor.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isDirectoryEmpty: (directory: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const renderTemplate: (source: string | Array<string>, destination: string, options?: any) => (context: any) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import glob from 'fast-glob';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import handlebars from 'handlebars';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
export const renderTemplate = (source, destination, options) => (context) => {
|
|
6
|
+
const files = glob.sync(source, options);
|
|
7
|
+
for (const file of files) {
|
|
8
|
+
const from = path.resolve((options === null || options === void 0 ? void 0 : options.cwd) || '', file);
|
|
9
|
+
const to = path.join(destination, path
|
|
10
|
+
.normalize(file)
|
|
11
|
+
.split(path.sep)
|
|
12
|
+
.slice(1)
|
|
13
|
+
.map((section) => handlebars.compile(section)(context))
|
|
14
|
+
.join(path.sep)
|
|
15
|
+
.replace('_.', '.')
|
|
16
|
+
.replace('.hbs', ''));
|
|
17
|
+
const directory = path.dirname(to);
|
|
18
|
+
const raw = fs.readFileSync(from, 'utf8');
|
|
19
|
+
const template = handlebars.compile(raw)(context);
|
|
20
|
+
if (!fs.existsSync(directory)) {
|
|
21
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
fs.writeFileSync(to, template, 'utf8');
|
|
24
|
+
}
|
|
25
|
+
};
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { html
|
|
1
|
+
export { html } from 'uhtml';
|
package/dist/runtime/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { html
|
|
1
|
+
export { html } from 'uhtml';
|
|
2
|
+
// export const html = (...args: any[]): any => {};
|
package/dist/types/context.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ClassBody, ClassDeclaration, ClassMethod, ClassProperty, File } from '@babel/types';
|
|
2
2
|
export interface Context {
|
|
3
3
|
script?: string;
|
|
4
|
+
componentClassName?: string;
|
|
5
|
+
componentInterfaceName?: string;
|
|
4
6
|
componentKey?: string;
|
|
5
7
|
componentTag?: string;
|
|
6
8
|
directoryName?: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export * from './api.js';
|
|
2
1
|
export * from './context.js';
|
|
3
|
-
export * from './direction.js';
|
|
4
|
-
export * from './event-options.js';
|
|
5
|
-
export * from './listen-options.js';
|
|
6
2
|
export * from './plugin.js';
|
|
7
3
|
export * from './plus-element.js';
|
|
8
|
-
export * from './property-options.js';
|
package/dist/types/index.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export * from './api.js';
|
|
2
1
|
export * from './context.js';
|
|
3
|
-
export * from './direction.js';
|
|
4
|
-
export * from './event-options.js';
|
|
5
|
-
export * from './listen-options.js';
|
|
6
2
|
export * from './plugin.js';
|
|
7
3
|
export * from './plus-element.js';
|
|
8
|
-
export * from './property-options.js';
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Context } from './context.js';
|
|
2
|
+
export declare type Return<T> = void | T | Promise<T>;
|
|
2
3
|
export declare type Plugin = {
|
|
3
4
|
name: string;
|
|
4
|
-
start?: (global: any) =>
|
|
5
|
-
next?: (context: Context, global: any) =>
|
|
6
|
-
finish?: (global: any) =>
|
|
5
|
+
start?: (global: any) => Return<any>;
|
|
6
|
+
next?: (context: Context, global: any) => Return<Context>;
|
|
7
|
+
finish?: (global: any) => Return<any>;
|
|
7
8
|
};
|
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htmlplus/element",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Masood Abdolian <m.abdolian@gmail.com>",
|
|
6
6
|
"description": "Compiler of HTMLPlus",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"
|
|
9
|
+
"prebuild": "npm run clean",
|
|
10
|
+
"build": "tsc",
|
|
10
11
|
"build:watch": "tsc -w",
|
|
12
|
+
"postbuild": "node scripts/build.post.js",
|
|
11
13
|
"clean": "rimraf dist",
|
|
12
|
-
"
|
|
13
|
-
"start": "node src/dev/start.js"
|
|
14
|
+
"format": "prettier --write .",
|
|
15
|
+
"dev:start": "node src/dev/start.js",
|
|
16
|
+
"dev:build": "node src/dev/build.js"
|
|
14
17
|
},
|
|
15
18
|
"exports": {
|
|
16
19
|
".": {
|
|
@@ -78,6 +81,8 @@
|
|
|
78
81
|
"@babel/types": "^7.16.0",
|
|
79
82
|
"@types/node": "^16.11.11",
|
|
80
83
|
"change-case": "^4.1.2",
|
|
84
|
+
"fast-glob": "^3.2.11",
|
|
85
|
+
"handlebars": "^4.7.7",
|
|
81
86
|
"log-update": "^5.0.0",
|
|
82
87
|
"sass": "^1.43.4",
|
|
83
88
|
"ts-node": "^10.4.0",
|
|
@@ -86,6 +91,7 @@
|
|
|
86
91
|
},
|
|
87
92
|
"devDependencies": {
|
|
88
93
|
"@trivago/prettier-plugin-sort-imports": "^3.1.1",
|
|
94
|
+
"cpy": "^9.0.0",
|
|
89
95
|
"prettier": "^2.5.0",
|
|
90
96
|
"rimraf": "^3.0.2",
|
|
91
97
|
"vite": "^2.7.10"
|
package/dist/types/api.d.ts
DELETED
package/dist/types/api.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type Direction = 'ltr' | 'rtl';
|
package/dist/types/direction.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface EventOptions {
|
|
2
|
-
/**
|
|
3
|
-
* A string custom event name to override the default.
|
|
4
|
-
*/
|
|
5
|
-
name?: string;
|
|
6
|
-
/**
|
|
7
|
-
* A Boolean indicating whether the event bubbles up through the DOM or not. default is `false`.
|
|
8
|
-
*/
|
|
9
|
-
bubbles?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* A Boolean indicating whether the event is cancelable. default is `false`.
|
|
12
|
-
*/
|
|
13
|
-
cancelable?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* A Boolean value indicating whether or not the event can bubble across the boundary between the shadow DOM and the regular DOM. The default is false.
|
|
16
|
-
*/
|
|
17
|
-
composed?: boolean;
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|