@htmlplus/element 0.5.5 → 0.5.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.
@@ -1,5 +1,5 @@
1
1
  import { PlusElement } from '../../types';
2
- export declare type EventEmitter<T = any> = (data?: T) => CustomEvent<T>;
2
+ export type EventEmitter<T = any> = (data?: T) => CustomEvent<T>;
3
3
  export interface EventOptions {
4
4
  /**
5
5
  * A string custom event name to override the default.
@@ -1,3 +1,3 @@
1
1
  import { PlusElement } from '../../types';
2
- export declare type Direction = 'ltr' | 'rtl';
2
+ export type Direction = 'ltr' | 'rtl';
3
3
  export declare const direction: (target: PlusElement) => Direction;
@@ -1,5 +1,5 @@
1
1
  import { PlusElement } from '../../types';
2
- declare type Slots = {
2
+ type Slots = {
3
3
  [key: string]: boolean;
4
4
  };
5
5
  export declare const slots: (target: PlusElement) => Slots;
@@ -1,4 +1,4 @@
1
- export declare type LinkConfig = {
1
+ export type LinkConfig = {
2
2
  scope?: Function;
3
3
  };
4
4
  export declare const createLink: (namespace: string) => any;
@@ -1,3 +1,3 @@
1
- declare type Types = 'array' | 'boolean' | 'function' | 'number' | 'object' | 'string';
1
+ type Types = 'array' | 'boolean' | 'function' | 'number' | 'object' | 'string';
2
2
  export declare const typeOf: (input: any) => Types;
3
3
  export {};
@@ -1,6 +1,6 @@
1
1
  import { Context } from '../../types';
2
2
  export declare const ASSETS_OPTIONS: Partial<AssetsOptions>;
3
- export declare type AssetsOptions = {
3
+ export type AssetsOptions = {
4
4
  once?: boolean;
5
5
  destination: (context: Context) => string;
6
6
  source?: (context: Context) => string;
@@ -12,9 +12,13 @@ export const extract = (options) => {
12
12
  visitor(context.fileAST, {
13
13
  ClassDeclaration: {
14
14
  exit(path) {
15
- var _a, _b;
15
+ var _a, _b, _c;
16
16
  context.class = path.node;
17
17
  context.classMembers = ((_b = (_a = context.class) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.body) || [];
18
+ // TODO
19
+ if (path.parentPath.isExportNamedDeclaration() && !((_c = context.class) === null || _c === void 0 ? void 0 : _c.leadingComments)) {
20
+ context.class['_leadingComments'] = t.cloneNode(path.parentPath.node, true).leadingComments || [];
21
+ }
18
22
  path.skip();
19
23
  }
20
24
  },
@@ -1,7 +1,7 @@
1
1
  import { ParserOptions } from '@babel/parser';
2
2
  import { Context } from '../../types';
3
3
  export declare const PARSE_OPTIONS: Partial<ParseOptions>;
4
- export declare type ParseOptions = ParserOptions;
4
+ export type ParseOptions = ParserOptions;
5
5
  export declare const parse: (options?: ParseOptions) => {
6
6
  name: string;
7
7
  next: (context: Context) => void;
@@ -1,7 +1,7 @@
1
1
  import { parse as parser } from '@babel/parser';
2
2
  export const PARSE_OPTIONS = {
3
- allowImportExportEverywhere: true,
4
- plugins: ['jsx', 'typescript', 'decorators-legacy']
3
+ sourceType: 'module',
4
+ plugins: [['decorators', { decoratorsBeforeExport: true }], 'jsx', 'typescript']
5
5
  };
6
6
  export const parse = (options) => {
7
7
  const name = 'parse';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { Context } from '../../types';
3
3
  export declare const READ_OPTIONS: Partial<ReadOptions>;
4
- export declare type ReadOptions = {
4
+ export type ReadOptions = {
5
5
  encoding: BufferEncoding;
6
6
  flag?: string | undefined;
7
7
  };
@@ -1,6 +1,6 @@
1
1
  import { Context, Global } from '../../types';
2
2
  export declare const README_OPTIONS: Partial<ReadmeOptions>;
3
- export declare type ReadmeOptions = {
3
+ export type ReadmeOptions = {
4
4
  source?: (context: Context) => string;
5
5
  };
6
6
  export declare const readme: (options: ReadmeOptions) => {
@@ -1,6 +1,6 @@
1
1
  import { Context } from '../../types';
2
2
  export declare const STYLE_OPTIONS: Partial<StyleOptions>;
3
- export declare type StyleOptions = {
3
+ export type StyleOptions = {
4
4
  source?: (context: Context) => string | string[];
5
5
  };
6
6
  export declare const style: (options?: StyleOptions) => {
@@ -2,14 +2,16 @@ export const getTag = (node, key) => {
2
2
  return getTags(node, key).pop();
3
3
  };
4
4
  export const getTags = (node, filter) => {
5
- var _a, _b, _c, _d;
5
+ var _a, _b, _c;
6
6
  const tags = [];
7
- const lines = (_d = (_c = (_b = (_a = node.leadingComments) === null || _a === void 0 ? void 0 : _a.map((comment) => {
7
+ // TODO
8
+ const comments = node['_leadingComments'] || node.leadingComments;
9
+ const lines = (_c = (_b = (_a = comments === null || comments === void 0 ? void 0 : comments.map((comment) => {
8
10
  const { type, value } = comment;
9
11
  if (type == 'CommentLine')
10
12
  return value;
11
13
  return value.replace(/\r\n/g, '\n').split('\n');
12
- })) === null || _b === void 0 ? void 0 : _b.flat()) === null || _c === void 0 ? void 0 : _c.filter((line) => line.trim().replace(/\*/g, ''))) === null || _d === void 0 ? void 0 : _d.map((line) => line.replace(/^( +)?(\*+)?( +)?/, ''));
14
+ })) === null || _a === void 0 ? void 0 : _a.flat()) === null || _b === void 0 ? void 0 : _b.filter((line) => line.trim().replace(/\*/g, ''))) === null || _c === void 0 ? void 0 : _c.map((line) => line.replace(/^( +)?(\*+)?( +)?/, ''));
13
15
  for (const line of lines || []) {
14
16
  const has = !!tags.length;
15
17
  const isTag = line.startsWith('@');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htmlplus/element",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "license": "MIT",
5
5
  "author": "Masood Abdolian <m.abdolian@gmail.com>",
6
6
  "description": "A powerful library for building scalable, reusable, fast, tastable and lightweight design system for any web technologies. Powerd by Web Component.",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "homepage": "https://github.com/htmlplus/element#readme",
33
33
  "dependencies": {
34
- "@babel/generator": "^7.20.3",
34
+ "@babel/generator": "^7.20.4",
35
35
  "@babel/parser": "^7.20.3",
36
36
  "@babel/traverse": "^7.20.1",
37
37
  "@babel/types": "^7.20.2",
@@ -41,15 +41,15 @@
41
41
  "fs-extra": "^10.1.0",
42
42
  "handlebars": "^4.7.7",
43
43
  "ora": "^6.1.2",
44
- "typescript": "^4.8.4"
44
+ "typescript": "^4.9.3"
45
45
  },
46
46
  "devDependencies": {
47
- "@trivago/prettier-plugin-sort-imports": "^3.4.0",
47
+ "@trivago/prettier-plugin-sort-imports": "^4.0.0",
48
48
  "cpy": "^9.0.1",
49
49
  "nodemon": "^2.0.20",
50
- "prettier": "^2.7.1",
50
+ "prettier": "^2.8.0",
51
51
  "rimraf": "^3.0.2",
52
52
  "ts-node": "^10.9.1",
53
- "vite": "^3.2.3"
53
+ "vite": "^3.2.4"
54
54
  }
55
55
  }
package/types/plugin.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Context } from './context';
2
2
  import { Global } from './global';
3
- export declare type Return<T> = void | T | Promise<T>;
4
- export declare type Plugin = {
3
+ export type Return<T> = void | T | Promise<T>;
4
+ export type Plugin = {
5
5
  name: string;
6
6
  options?: any;
7
7
  start?: (global: Global) => Return<void>;