@htmlplus/element 0.8.6 → 1.1.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 +616 -534
- package/bundlers/rollup.d.ts +2 -2
- package/bundlers/rollup.js +5 -5
- package/bundlers/vite.d.ts +2 -2
- package/bundlers/vite.js +5 -5
- package/client/decorators/bind.d.ts +4 -0
- package/client/decorators/bind.js +4 -0
- package/client/decorators/direction.d.ts +5 -0
- package/client/decorators/direction.js +8 -0
- package/client/decorators/element.d.ts +5 -0
- package/client/decorators/element.js +7 -2
- package/client/decorators/event.d.ts +21 -7
- package/client/decorators/event.js +7 -2
- package/client/decorators/host.d.ts +4 -2
- package/client/decorators/host.js +5 -8
- package/client/decorators/index.d.ts +3 -0
- package/client/decorators/index.js +3 -0
- package/client/decorators/isRTL.d.ts +4 -0
- package/client/decorators/isRTL.js +7 -0
- package/client/decorators/listen.d.ts +38 -8
- package/client/decorators/listen.js +9 -12
- package/client/decorators/method.d.ts +4 -0
- package/client/decorators/method.js +4 -0
- package/client/decorators/property.d.ts +8 -1
- package/client/decorators/property.js +4 -0
- package/client/decorators/query.d.ts +9 -2
- package/client/decorators/query.js +10 -9
- package/client/decorators/queryAll.d.ts +12 -2
- package/client/decorators/queryAll.js +13 -9
- package/client/decorators/slots.d.ts +4 -0
- package/client/decorators/slots.js +7 -0
- package/client/decorators/state.d.ts +4 -0
- package/client/decorators/state.js +4 -0
- package/client/decorators/watch.d.ts +5 -4
- package/client/decorators/watch.js +5 -4
- package/client/index.d.ts +1 -3
- package/client/index.js +1 -3
- package/client/utils/classes.d.ts +3 -0
- package/client/utils/classes.js +11 -28
- package/client/utils/config.d.ts +25 -3
- package/client/utils/config.js +18 -10
- package/client/utils/direction.d.ts +5 -2
- package/client/utils/direction.js +5 -1
- package/client/utils/event.d.ts +6 -0
- package/client/utils/event.js +6 -0
- package/client/utils/host.d.ts +3 -0
- package/client/utils/host.js +3 -0
- package/client/utils/index.d.ts +4 -1
- package/client/utils/index.js +4 -1
- package/client/utils/isCSSColor.d.ts +5 -0
- package/client/utils/isCSSColor.js +9 -0
- package/client/utils/isRTL.d.ts +3 -0
- package/client/utils/isRTL.js +3 -0
- package/client/utils/isServer.d.ts +3 -0
- package/client/utils/isServer.js +3 -0
- package/client/utils/query.d.ts +5 -0
- package/client/utils/query.js +8 -0
- package/client/utils/queryAll.d.ts +5 -0
- package/client/utils/queryAll.js +8 -0
- package/client/utils/request.d.ts +1 -1
- package/client/utils/request.js +1 -1
- package/client/utils/slots.d.ts +3 -0
- package/client/utils/slots.js +6 -1
- package/client/utils/styles.d.ts +3 -0
- package/client/utils/styles.js +3 -0
- package/client/utils/toDecorator.d.ts +2 -0
- package/client/utils/toDecorator.js +10 -0
- package/client/utils/toUnit.d.ts +4 -1
- package/client/utils/toUnit.js +6 -3
- package/constants/index.d.ts +1 -0
- package/constants/index.js +2 -0
- package/package.json +11 -4
- package/transformer/index.d.ts +3 -0
- package/transformer/index.js +3 -0
- package/transformer/plugins/assets.d.ts +8 -0
- package/transformer/plugins/assets.js +29 -0
- package/{compiler → transformer}/plugins/copy.d.ts +2 -2
- package/{compiler → transformer}/plugins/customElement.d.ts +2 -2
- package/{compiler → transformer}/plugins/customElement.js +13 -12
- package/{compiler → transformer}/plugins/customElementReact/customElementReact.d.ts +4 -4
- package/{compiler → transformer}/plugins/customElementReact/customElementReact.js +18 -18
- package/{compiler → transformer}/plugins/customElementReact/templates/src/components/{{fileName}}.compact.ts.hbs +1 -1
- package/{compiler → transformer}/plugins/customElementReact/templates/src/components/{{fileName}}.ts.hbs +3 -3
- package/transformer/plugins/customElementReact/templates/src/index.ts.hbs +1 -0
- package/transformer/plugins/document.d.ts +7 -0
- package/{compiler → transformer}/plugins/document.js +18 -18
- package/transformer/plugins/extract.d.ts +2 -0
- package/{compiler → transformer}/plugins/extract.js +1 -18
- package/transformer/plugins/parse.d.ts +6 -0
- package/{compiler → transformer}/plugins/parse.js +1 -1
- package/transformer/plugins/read.d.ts +8 -0
- package/transformer/plugins/read.js +20 -0
- package/transformer/plugins/readme.d.ts +6 -0
- package/{compiler → transformer}/plugins/readme.js +3 -2
- package/transformer/plugins/style.d.ts +6 -0
- package/{compiler → transformer}/plugins/style.js +4 -2
- package/transformer/plugins/validate.d.ts +2 -0
- package/transformer/plugins/validate.js +41 -0
- package/transformer/plugins/visualStudioCode.d.ts +8 -0
- package/{compiler → transformer}/plugins/visualStudioCode.js +10 -8
- package/transformer/plugins/webTypes.d.ts +10 -0
- package/{compiler → transformer}/plugins/webTypes.js +11 -7
- package/transformer/transformer.d.ts +6 -0
- package/{compiler/compiler.js → transformer/transformer.js} +17 -17
- package/transformer/transformer.types.d.ts +50 -0
- package/{compiler → transformer}/utils/printType.js +2 -2
- package/{compiler → transformer}/utils/renderTemplate.js +2 -0
- package/types/index.d.ts +2 -4
- package/types/index.js +1 -4
- package/bundlers/index.d.ts +0 -2
- package/bundlers/index.js +0 -2
- package/client/helpers/index.d.ts +0 -1
- package/client/helpers/index.js +0 -1
- package/client/services/index.d.ts +0 -1
- package/client/services/index.js +0 -1
- package/client/services/link.d.ts +0 -4
- package/client/services/link.js +0 -196
- package/client/utils/getNamespace.d.ts +0 -2
- package/client/utils/getNamespace.js +0 -4
- package/client/vendors/uhtml.d.ts +0 -29
- package/client/vendors/uhtml.js +0 -700
- package/compiler/compiler.d.ts +0 -6
- package/compiler/index.d.ts +0 -2
- package/compiler/index.js +0 -2
- package/compiler/plugins/assets.d.ts +0 -8
- package/compiler/plugins/assets.js +0 -33
- package/compiler/plugins/customElementReact/templates/src/index.ts.hbs +0 -1
- package/compiler/plugins/document.d.ts +0 -7
- package/compiler/plugins/extract.d.ts +0 -2
- package/compiler/plugins/parse.d.ts +0 -5
- package/compiler/plugins/read.d.ts +0 -8
- package/compiler/plugins/read.js +0 -13
- package/compiler/plugins/readme.d.ts +0 -6
- package/compiler/plugins/style.d.ts +0 -6
- package/compiler/plugins/validate.d.ts +0 -2
- package/compiler/plugins/validate.js +0 -37
- package/compiler/plugins/visualStudioCode.d.ts +0 -8
- package/compiler/plugins/webTypes.d.ts +0 -10
- package/types/context.d.ts +0 -31
- package/types/global.d.ts +0 -4
- package/types/global.js +0 -1
- package/types/plugin.d.ts +0 -10
- package/types/plugin.js +0 -1
- package/types/plusElement.d.ts +0 -2
- package/types/plusElement.js +0 -1
- /package/{compiler → transformer}/plugins/copy.js +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/index.d.ts +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/index.js +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/templates/README.md.hbs +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/templates/_.gitignore.hbs +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/templates/package.json.hbs +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/templates/rollup.config.js.hbs +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/templates/src/components/index.ts.hbs +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/templates/src/proxy.ts.hbs +0 -0
- /package/{compiler → transformer}/plugins/customElementReact/templates/tsconfig.json.hbs +0 -0
- /package/{compiler → transformer}/plugins/index.d.ts +0 -0
- /package/{compiler → transformer}/plugins/index.js +0 -0
- /package/{types/context.js → transformer/transformer.types.js} +0 -0
- /package/{compiler → transformer}/utils/__dirname.d.ts +0 -0
- /package/{compiler → transformer}/utils/__dirname.js +0 -0
- /package/{compiler → transformer}/utils/addDependency.d.ts +0 -0
- /package/{compiler → transformer}/utils/addDependency.js +0 -0
- /package/{compiler → transformer}/utils/getInitializer.d.ts +0 -0
- /package/{compiler → transformer}/utils/getInitializer.js +0 -0
- /package/{compiler → transformer}/utils/getType.d.ts +0 -0
- /package/{compiler → transformer}/utils/getType.js +0 -0
- /package/{compiler → transformer}/utils/getTypeReference.d.ts +0 -0
- /package/{compiler → transformer}/utils/getTypeReference.js +0 -0
- /package/{compiler → transformer}/utils/hasDecorator.d.ts +0 -0
- /package/{compiler → transformer}/utils/hasDecorator.js +0 -0
- /package/{compiler → transformer}/utils/index.d.ts +0 -0
- /package/{compiler → transformer}/utils/index.js +0 -0
- /package/{compiler → transformer}/utils/isDirectoryEmpty.d.ts +0 -0
- /package/{compiler → transformer}/utils/isDirectoryEmpty.js +0 -0
- /package/{compiler → transformer}/utils/print.d.ts +0 -0
- /package/{compiler → transformer}/utils/print.js +0 -0
- /package/{compiler → transformer}/utils/printType.d.ts +0 -0
- /package/{compiler → transformer}/utils/removeUnusedImport.d.ts +0 -0
- /package/{compiler → transformer}/utils/removeUnusedImport.js +0 -0
- /package/{compiler → transformer}/utils/renderTemplate.d.ts +0 -0
- /package/{compiler → transformer}/utils/tags.d.ts +0 -0
- /package/{compiler → transformer}/utils/tags.js +0 -0
- /package/{compiler → transformer}/utils/visitor.d.ts +0 -0
- /package/{compiler → transformer}/utils/visitor.js +0 -0
package/compiler/compiler.d.ts
DELETED
package/compiler/index.d.ts
DELETED
package/compiler/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Context, Plugin } from '../../types';
|
|
2
|
-
export declare const ASSETS_OPTIONS: Partial<AssetsOptions>;
|
|
3
|
-
export type AssetsOptions = {
|
|
4
|
-
once?: boolean;
|
|
5
|
-
destination: (context: Context) => string;
|
|
6
|
-
source?: (context: Context) => string;
|
|
7
|
-
};
|
|
8
|
-
export declare const assets: (options: AssetsOptions) => Plugin;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
export const ASSETS_OPTIONS = {
|
|
4
|
-
once: true,
|
|
5
|
-
destination(context) {
|
|
6
|
-
return `assets/${context.fileName}`;
|
|
7
|
-
},
|
|
8
|
-
source(context) {
|
|
9
|
-
return path.join(context.directoryPath, 'assets');
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export const assets = (options) => {
|
|
13
|
-
const name = 'assets';
|
|
14
|
-
options = Object.assign({}, ASSETS_OPTIONS, options);
|
|
15
|
-
const sources = new Set();
|
|
16
|
-
const run = (context) => {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
const source = (_a = options.source) === null || _a === void 0 ? void 0 : _a.call(options, context);
|
|
19
|
-
if (!source)
|
|
20
|
-
return;
|
|
21
|
-
if (!fs.existsSync(source))
|
|
22
|
-
return;
|
|
23
|
-
if (options.once) {
|
|
24
|
-
if (sources.has(source))
|
|
25
|
-
return;
|
|
26
|
-
sources.add(source);
|
|
27
|
-
}
|
|
28
|
-
const destination = (_b = options.destination) === null || _b === void 0 ? void 0 : _b.call(options, context);
|
|
29
|
-
fs.copySync(source, destination);
|
|
30
|
-
context.assets = source;
|
|
31
|
-
};
|
|
32
|
-
return { name, run };
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Context, Plugin } from '../../types';
|
|
2
|
-
export declare const DOCUMENT_OPTIONS: Partial<DocumentOptions>;
|
|
3
|
-
export interface DocumentOptions {
|
|
4
|
-
destination: string;
|
|
5
|
-
transformer?: (context: Context, element: any) => any;
|
|
6
|
-
}
|
|
7
|
-
export declare const document: (options: DocumentOptions) => Plugin;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Plugin } from '../../types';
|
|
3
|
-
export declare const READ_OPTIONS: Partial<ReadOptions>;
|
|
4
|
-
export type ReadOptions = {
|
|
5
|
-
encoding: BufferEncoding;
|
|
6
|
-
flag?: string | undefined;
|
|
7
|
-
};
|
|
8
|
-
export declare const read: (options?: ReadOptions) => Plugin;
|
package/compiler/plugins/read.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
export const READ_OPTIONS = {
|
|
3
|
-
encoding: 'utf8'
|
|
4
|
-
};
|
|
5
|
-
export const read = (options) => {
|
|
6
|
-
const name = 'read';
|
|
7
|
-
options = Object.assign({}, READ_OPTIONS, options);
|
|
8
|
-
const run = (context) => {
|
|
9
|
-
var _a;
|
|
10
|
-
context.fileContent = (_a = context.fileContent) !== null && _a !== void 0 ? _a : fs.readFileSync(context.filePath, options);
|
|
11
|
-
};
|
|
12
|
-
return { name, run };
|
|
13
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as CONSTANTS from '../../constants/index.js';
|
|
2
|
-
import { hasDecorator, visitor } from '../utils/index.js';
|
|
3
|
-
export const validate = () => {
|
|
4
|
-
const name = 'validate';
|
|
5
|
-
const run = (context) => {
|
|
6
|
-
let hasValidImport;
|
|
7
|
-
visitor(context.fileAST, {
|
|
8
|
-
ImportDeclaration(path) {
|
|
9
|
-
var _a;
|
|
10
|
-
if (((_a = path.node.source) === null || _a === void 0 ? void 0 : _a.value) !== CONSTANTS.PACKAGE_NAME)
|
|
11
|
-
return;
|
|
12
|
-
for (const specifier of path.node.specifiers) {
|
|
13
|
-
if (specifier.imported.name !== CONSTANTS.DECORATOR_ELEMENT)
|
|
14
|
-
continue;
|
|
15
|
-
hasValidImport = true;
|
|
16
|
-
path.stop();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
let hasValidExport;
|
|
21
|
-
visitor(context.fileAST, {
|
|
22
|
-
ExportNamedDeclaration(path) {
|
|
23
|
-
if (hasValidExport) {
|
|
24
|
-
hasValidExport = false;
|
|
25
|
-
return path.stop();
|
|
26
|
-
}
|
|
27
|
-
if (path.node.declaration.type !== 'ClassDeclaration')
|
|
28
|
-
return;
|
|
29
|
-
if (!hasDecorator(path.node.declaration, CONSTANTS.DECORATOR_ELEMENT))
|
|
30
|
-
return;
|
|
31
|
-
hasValidExport = true;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
context.isInvalid = !hasValidImport || !hasValidExport;
|
|
35
|
-
};
|
|
36
|
-
return { name, run };
|
|
37
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Context, Plugin } from '../../types';
|
|
2
|
-
export declare const VISUAL_STUDIO_CODE_OPTIONS: Partial<VisualStudioCodeOptions>;
|
|
3
|
-
export interface VisualStudioCodeOptions {
|
|
4
|
-
destination: string;
|
|
5
|
-
reference?: (context: Context) => string;
|
|
6
|
-
transformer?: (context: Context, component: any) => any;
|
|
7
|
-
}
|
|
8
|
-
export declare const visualStudioCode: (options: VisualStudioCodeOptions) => Plugin;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Context, Plugin } from '../../types';
|
|
2
|
-
export declare const WEB_TYPES_OPTIONS: Partial<WebTypesOptions>;
|
|
3
|
-
export interface WebTypesOptions {
|
|
4
|
-
destination: string;
|
|
5
|
-
packageName: string;
|
|
6
|
-
packageVersion: string;
|
|
7
|
-
reference?: (context: Context) => string;
|
|
8
|
-
transformer?: (context: Context, component: any) => any;
|
|
9
|
-
}
|
|
10
|
-
export declare const webTypes: (options: WebTypesOptions) => Plugin;
|
package/types/context.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ClassBody, ClassDeclaration, ClassMethod, ClassProperty, File } from '@babel/types';
|
|
2
|
-
export interface Context {
|
|
3
|
-
customElementNames?: Array<string>;
|
|
4
|
-
isInvalid?: boolean;
|
|
5
|
-
script?: string;
|
|
6
|
-
assets?: string;
|
|
7
|
-
class?: ClassDeclaration;
|
|
8
|
-
classEvents?: Array<ClassProperty>;
|
|
9
|
-
classHasMount?: boolean;
|
|
10
|
-
classHasUnmount?: boolean;
|
|
11
|
-
classMembers?: ClassBody['body'];
|
|
12
|
-
classMethods?: Array<ClassMethod>;
|
|
13
|
-
className?: string;
|
|
14
|
-
classProperties?: Array<ClassProperty>;
|
|
15
|
-
classRender?: ClassMethod;
|
|
16
|
-
classStates?: Array<ClassProperty>;
|
|
17
|
-
componentKey?: string;
|
|
18
|
-
directoryName?: string;
|
|
19
|
-
directoryPath?: string;
|
|
20
|
-
fileAST?: File;
|
|
21
|
-
fileContent?: string;
|
|
22
|
-
fileExtension?: string;
|
|
23
|
-
fileName?: string;
|
|
24
|
-
filePath?: string;
|
|
25
|
-
readmeContent?: string;
|
|
26
|
-
readmePath?: string;
|
|
27
|
-
styleContent?: string;
|
|
28
|
-
styleDependencies?: Array<string>;
|
|
29
|
-
styleParsed?: string;
|
|
30
|
-
stylePath?: string;
|
|
31
|
-
}
|
package/types/global.d.ts
DELETED
package/types/global.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/types/plugin.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Context } from './context';
|
|
2
|
-
import { Global } from './global';
|
|
3
|
-
export type Return<T> = void | T | Promise<void | T>;
|
|
4
|
-
export type Plugin = {
|
|
5
|
-
name: string;
|
|
6
|
-
options?: any;
|
|
7
|
-
start?: (global: Global) => Return<Global>;
|
|
8
|
-
run?: (context: Context, global: Global) => Return<Context>;
|
|
9
|
-
finish?: (global: Global) => Return<Global>;
|
|
10
|
-
};
|
package/types/plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/types/plusElement.d.ts
DELETED
package/types/plusElement.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{compiler → transformer}/plugins/customElementReact/templates/src/components/index.ts.hbs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|