@htmlplus/element 1.0.0 → 2.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.
Files changed (184) hide show
  1. package/README.md +616 -534
  2. package/bundlers/rollup.d.ts +2 -2
  3. package/bundlers/rollup.js +5 -5
  4. package/bundlers/vite.d.ts +2 -2
  5. package/bundlers/vite.js +5 -5
  6. package/client/decorators/bind.d.ts +4 -0
  7. package/client/decorators/bind.js +4 -0
  8. package/client/decorators/direction.d.ts +5 -0
  9. package/client/decorators/direction.js +8 -0
  10. package/client/decorators/element.d.ts +5 -0
  11. package/client/decorators/element.js +7 -2
  12. package/client/decorators/event.d.ts +21 -7
  13. package/client/decorators/event.js +7 -2
  14. package/client/decorators/host.d.ts +4 -2
  15. package/client/decorators/host.js +5 -8
  16. package/client/decorators/index.d.ts +3 -0
  17. package/client/decorators/index.js +3 -0
  18. package/client/decorators/isRTL.d.ts +4 -0
  19. package/client/decorators/isRTL.js +7 -0
  20. package/client/decorators/listen.d.ts +38 -8
  21. package/client/decorators/listen.js +9 -12
  22. package/client/decorators/method.d.ts +4 -0
  23. package/client/decorators/method.js +4 -0
  24. package/client/decorators/property.d.ts +8 -1
  25. package/client/decorators/property.js +4 -0
  26. package/client/decorators/query.d.ts +9 -2
  27. package/client/decorators/query.js +10 -9
  28. package/client/decorators/queryAll.d.ts +12 -2
  29. package/client/decorators/queryAll.js +13 -9
  30. package/client/decorators/slots.d.ts +4 -0
  31. package/client/decorators/slots.js +7 -0
  32. package/client/decorators/state.d.ts +4 -0
  33. package/client/decorators/state.js +4 -0
  34. package/client/decorators/watch.d.ts +5 -4
  35. package/client/decorators/watch.js +5 -4
  36. package/client/index.d.ts +1 -3
  37. package/client/index.js +1 -3
  38. package/client/utils/classes.d.ts +3 -0
  39. package/client/utils/classes.js +11 -28
  40. package/client/utils/config.d.ts +25 -3
  41. package/client/utils/config.js +18 -10
  42. package/client/utils/direction.d.ts +5 -2
  43. package/client/utils/direction.js +5 -1
  44. package/client/utils/event.d.ts +6 -0
  45. package/client/utils/event.js +6 -0
  46. package/client/utils/host.d.ts +3 -0
  47. package/client/utils/host.js +3 -0
  48. package/client/utils/index.d.ts +4 -1
  49. package/client/utils/index.js +4 -1
  50. package/client/utils/isCSSColor.d.ts +5 -0
  51. package/client/utils/isCSSColor.js +9 -0
  52. package/client/utils/isRTL.d.ts +3 -0
  53. package/client/utils/isRTL.js +3 -0
  54. package/client/utils/isServer.d.ts +3 -0
  55. package/client/utils/isServer.js +3 -0
  56. package/client/utils/query.d.ts +5 -0
  57. package/client/utils/query.js +8 -0
  58. package/client/utils/queryAll.d.ts +5 -0
  59. package/client/utils/queryAll.js +8 -0
  60. package/client/utils/request.d.ts +1 -1
  61. package/client/utils/request.js +1 -1
  62. package/client/utils/slots.d.ts +3 -0
  63. package/client/utils/slots.js +6 -1
  64. package/client/utils/styles.d.ts +3 -0
  65. package/client/utils/styles.js +3 -0
  66. package/client/utils/toDecorator.d.ts +2 -0
  67. package/client/utils/toDecorator.js +10 -0
  68. package/client/utils/toUnit.d.ts +4 -1
  69. package/client/utils/toUnit.js +6 -3
  70. package/constants/index.d.ts +1 -0
  71. package/constants/index.js +2 -0
  72. package/package.json +3 -3
  73. package/transformer/index.d.ts +3 -0
  74. package/transformer/index.js +3 -0
  75. package/transformer/plugins/assets.d.ts +8 -0
  76. package/transformer/plugins/assets.js +29 -0
  77. package/{compiler → transformer}/plugins/copy.d.ts +2 -2
  78. package/{compiler → transformer}/plugins/customElement.d.ts +2 -2
  79. package/{compiler → transformer}/plugins/customElement.js +13 -12
  80. package/transformer/plugins/document.d.ts +7 -0
  81. package/{compiler → transformer}/plugins/document.js +18 -18
  82. package/transformer/plugins/extract.d.ts +2 -0
  83. package/{compiler → transformer}/plugins/extract.js +1 -18
  84. package/{compiler → transformer}/plugins/index.d.ts +0 -1
  85. package/{compiler → transformer}/plugins/index.js +0 -1
  86. package/transformer/plugins/parse.d.ts +6 -0
  87. package/{compiler → transformer}/plugins/parse.js +1 -1
  88. package/transformer/plugins/read.d.ts +8 -0
  89. package/transformer/plugins/read.js +20 -0
  90. package/transformer/plugins/readme.d.ts +6 -0
  91. package/{compiler → transformer}/plugins/readme.js +3 -2
  92. package/transformer/plugins/style.d.ts +6 -0
  93. package/{compiler → transformer}/plugins/style.js +4 -2
  94. package/transformer/plugins/validate.d.ts +2 -0
  95. package/transformer/plugins/validate.js +41 -0
  96. package/transformer/plugins/visualStudioCode.d.ts +8 -0
  97. package/{compiler → transformer}/plugins/visualStudioCode.js +10 -8
  98. package/transformer/plugins/webTypes.d.ts +10 -0
  99. package/{compiler → transformer}/plugins/webTypes.js +11 -7
  100. package/transformer/transformer.d.ts +6 -0
  101. package/{compiler/compiler.js → transformer/transformer.js} +17 -17
  102. package/transformer/transformer.types.d.ts +50 -0
  103. package/{compiler → transformer}/utils/printType.js +2 -2
  104. package/{compiler → transformer}/utils/renderTemplate.js +2 -0
  105. package/types/index.d.ts +2 -4
  106. package/types/index.js +1 -4
  107. package/CHANGELOG.md +0 -7
  108. package/bundlers/index.d.ts +0 -2
  109. package/bundlers/index.js +0 -2
  110. package/client/helpers/index.d.ts +0 -1
  111. package/client/helpers/index.js +0 -1
  112. package/client/services/index.d.ts +0 -1
  113. package/client/services/index.js +0 -1
  114. package/client/services/link.d.ts +0 -4
  115. package/client/services/link.js +0 -196
  116. package/client/utils/getNamespace.d.ts +0 -2
  117. package/client/utils/getNamespace.js +0 -4
  118. package/client/vendors/uhtml.d.ts +0 -29
  119. package/client/vendors/uhtml.js +0 -700
  120. package/compiler/compiler.d.ts +0 -6
  121. package/compiler/index.d.ts +0 -2
  122. package/compiler/index.js +0 -2
  123. package/compiler/plugins/assets.d.ts +0 -8
  124. package/compiler/plugins/assets.js +0 -33
  125. package/compiler/plugins/customElementReact/customElementReact.d.ts +0 -16
  126. package/compiler/plugins/customElementReact/customElementReact.js +0 -97
  127. package/compiler/plugins/customElementReact/index.d.ts +0 -1
  128. package/compiler/plugins/customElementReact/index.js +0 -1
  129. package/compiler/plugins/customElementReact/templates/README.md.hbs +0 -1
  130. package/compiler/plugins/customElementReact/templates/_.gitignore.hbs +0 -2
  131. package/compiler/plugins/customElementReact/templates/package.json.hbs +0 -37
  132. package/compiler/plugins/customElementReact/templates/rollup.config.js.hbs +0 -21
  133. package/compiler/plugins/customElementReact/templates/src/components/index.ts.hbs +0 -17
  134. package/compiler/plugins/customElementReact/templates/src/components/{{fileName}}.compact.ts.hbs +0 -18
  135. package/compiler/plugins/customElementReact/templates/src/components/{{fileName}}.ts.hbs +0 -23
  136. package/compiler/plugins/customElementReact/templates/src/index.ts.hbs +0 -1
  137. package/compiler/plugins/customElementReact/templates/src/proxy.ts.hbs +0 -269
  138. package/compiler/plugins/customElementReact/templates/tsconfig.json.hbs +0 -17
  139. package/compiler/plugins/document.d.ts +0 -7
  140. package/compiler/plugins/extract.d.ts +0 -2
  141. package/compiler/plugins/parse.d.ts +0 -5
  142. package/compiler/plugins/read.d.ts +0 -8
  143. package/compiler/plugins/read.js +0 -13
  144. package/compiler/plugins/readme.d.ts +0 -6
  145. package/compiler/plugins/style.d.ts +0 -6
  146. package/compiler/plugins/validate.d.ts +0 -2
  147. package/compiler/plugins/validate.js +0 -37
  148. package/compiler/plugins/visualStudioCode.d.ts +0 -8
  149. package/compiler/plugins/webTypes.d.ts +0 -10
  150. package/types/context.d.ts +0 -31
  151. package/types/global.d.ts +0 -4
  152. package/types/global.js +0 -1
  153. package/types/plugin.d.ts +0 -10
  154. package/types/plugin.js +0 -1
  155. package/types/plusElement.d.ts +0 -2
  156. package/types/plusElement.js +0 -1
  157. /package/{compiler → transformer}/plugins/copy.js +0 -0
  158. /package/{types/context.js → transformer/transformer.types.js} +0 -0
  159. /package/{compiler → transformer}/utils/__dirname.d.ts +0 -0
  160. /package/{compiler → transformer}/utils/__dirname.js +0 -0
  161. /package/{compiler → transformer}/utils/addDependency.d.ts +0 -0
  162. /package/{compiler → transformer}/utils/addDependency.js +0 -0
  163. /package/{compiler → transformer}/utils/getInitializer.d.ts +0 -0
  164. /package/{compiler → transformer}/utils/getInitializer.js +0 -0
  165. /package/{compiler → transformer}/utils/getType.d.ts +0 -0
  166. /package/{compiler → transformer}/utils/getType.js +0 -0
  167. /package/{compiler → transformer}/utils/getTypeReference.d.ts +0 -0
  168. /package/{compiler → transformer}/utils/getTypeReference.js +0 -0
  169. /package/{compiler → transformer}/utils/hasDecorator.d.ts +0 -0
  170. /package/{compiler → transformer}/utils/hasDecorator.js +0 -0
  171. /package/{compiler → transformer}/utils/index.d.ts +0 -0
  172. /package/{compiler → transformer}/utils/index.js +0 -0
  173. /package/{compiler → transformer}/utils/isDirectoryEmpty.d.ts +0 -0
  174. /package/{compiler → transformer}/utils/isDirectoryEmpty.js +0 -0
  175. /package/{compiler → transformer}/utils/print.d.ts +0 -0
  176. /package/{compiler → transformer}/utils/print.js +0 -0
  177. /package/{compiler → transformer}/utils/printType.d.ts +0 -0
  178. /package/{compiler → transformer}/utils/removeUnusedImport.d.ts +0 -0
  179. /package/{compiler → transformer}/utils/removeUnusedImport.js +0 -0
  180. /package/{compiler → transformer}/utils/renderTemplate.d.ts +0 -0
  181. /package/{compiler → transformer}/utils/tags.d.ts +0 -0
  182. /package/{compiler → transformer}/utils/tags.js +0 -0
  183. /package/{compiler → transformer}/utils/visitor.d.ts +0 -0
  184. /package/{compiler → transformer}/utils/visitor.js +0 -0
@@ -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;
@@ -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
@@ -1,4 +0,0 @@
1
- import { Context } from './context';
2
- export interface Global {
3
- contexts: Array<Context>;
4
- }
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 {};
@@ -1,2 +0,0 @@
1
- export interface PlusElement {
2
- }
@@ -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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes