@htmlplus/element 0.3.2 → 0.4.1
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 +2 -2
- package/client/decorators/attributes.js +3 -3
- package/client/decorators/element.js +11 -4
- package/client/decorators/event.js +2 -3
- package/client/decorators/listen.js +2 -1
- package/client/decorators/method.js +4 -5
- package/client/decorators/property.d.ts +0 -4
- package/client/decorators/property.js +38 -43
- package/client/decorators/state.js +17 -26
- package/client/decorators/watch.d.ts +7 -1
- package/client/decorators/watch.js +24 -10
- package/client/helpers/classes.d.ts +1 -1
- package/client/helpers/index.d.ts +3 -3
- package/client/helpers/index.js +3 -3
- package/client/helpers/{is-rtl.d.ts → isRTL.d.ts} +0 -0
- package/client/helpers/{is-rtl.js → isRTL.js} +0 -0
- package/client/helpers/{query-all.d.ts → queryAll.d.ts} +0 -0
- package/client/helpers/{query-all.js → queryAll.js} +0 -0
- package/client/helpers/slots.js +1 -1
- package/client/helpers/styles.js +2 -1
- package/client/helpers/{to-unit.d.ts → toUnit.d.ts} +0 -0
- package/client/helpers/{to-unit.js → toUnit.js} +0 -0
- package/client/utils/{append-to-method.d.ts → appendToMethod.d.ts} +0 -0
- package/client/utils/{append-to-method.js → appendToMethod.js} +0 -0
- package/client/utils/{define-property.d.ts → defineProperty.d.ts} +0 -0
- package/client/utils/{define-property.js → defineProperty.js} +0 -0
- package/client/utils/event.d.ts +5 -2
- package/client/utils/event.js +7 -4
- package/client/utils/{get-members.d.ts → getMembers.d.ts} +0 -0
- package/client/utils/{get-members.js → getMembers.js} +0 -0
- package/client/utils/{get-styles.d.ts → getStyles.d.ts} +0 -0
- package/client/utils/{get-styles.js → getStyles.js} +0 -0
- package/client/utils/index.d.ts +11 -14
- package/client/utils/index.js +11 -14
- package/client/utils/{is-event.d.ts → isEvent.d.ts} +0 -0
- package/client/utils/{is-event.js → isEvent.js} +0 -0
- package/client/utils/{is-server.d.ts → isServer.d.ts} +0 -0
- package/client/utils/{is-server.js → isServer.js} +0 -0
- package/client/utils/{parse-value.d.ts → parseValue.d.ts} +0 -0
- package/client/utils/{parse-value.js → parseValue.js} +2 -2
- package/client/utils/request.d.ts +3 -1
- package/client/utils/request.js +15 -5
- package/client/utils/sync.js +3 -3
- package/client/utils/{to-boolean.d.ts → toBoolean.d.ts} +0 -0
- package/client/utils/{to-boolean.js → toBoolean.js} +0 -0
- package/client/utils/{to-event.d.ts → toEvent.d.ts} +0 -0
- package/client/utils/{to-event.js → toEvent.js} +0 -0
- package/client/utils/{type-of.d.ts → typeOf.d.ts} +0 -0
- package/client/utils/{type-of.js → typeOf.js} +0 -0
- package/client/utils/{update-attribute.d.ts → updateAttribute.d.ts} +0 -0
- package/client/utils/{update-attribute.js → updateAttribute.js} +0 -0
- package/client/vendor/uhtml.d.ts +22 -0
- package/client/vendor/uhtml.js +700 -0
- package/compiler/compiler.js +42 -22
- package/compiler/plugins/customElement.d.ts +4 -1
- package/compiler/plugins/customElement.js +96 -77
- package/compiler/plugins/customElementReact/customElementReact.d.ts +1 -1
- package/compiler/plugins/customElementReact/customElementReact.js +12 -8
- package/compiler/plugins/customElementReact/templates/package.json.hbs +2 -2
- package/compiler/plugins/customElementReact/templates/src/components/{{fileName}}.compact.ts.hbs +4 -4
- package/compiler/plugins/customElementReact/templates/src/components/{{fileName}}.ts.hbs +1 -1
- package/compiler/plugins/{docs.d.ts → document.d.ts} +3 -4
- package/compiler/plugins/document.js +254 -0
- package/compiler/plugins/external.d.ts +9 -0
- package/compiler/plugins/external.js +25 -0
- package/compiler/plugins/extract.d.ts +1 -1
- package/compiler/plugins/extract.js +3 -11
- package/compiler/plugins/index.d.ts +2 -0
- package/compiler/plugins/index.js +2 -0
- package/compiler/plugins/style.js +1 -1
- package/compiler/utils/{get-initializer.d.ts → getInitializer.d.ts} +0 -0
- package/compiler/utils/{get-initializer.js → getInitializer.js} +0 -0
- package/compiler/utils/{get-type.d.ts → getType.d.ts} +0 -0
- package/compiler/utils/{get-type.js → getType.js} +0 -0
- package/compiler/utils/getTypeReference.d.ts +2 -0
- package/compiler/utils/getTypeReference.js +33 -0
- package/compiler/utils/{has-decorator.d.ts → hasDecorator.d.ts} +0 -0
- package/compiler/utils/{has-decorator.js → hasDecorator.js} +0 -0
- package/compiler/utils/index.d.ts +8 -7
- package/compiler/utils/index.js +8 -7
- package/compiler/utils/{is-directory-empty.d.ts → isDirectoryEmpty.d.ts} +0 -0
- package/compiler/utils/{is-directory-empty.js → isDirectoryEmpty.js} +0 -0
- package/compiler/utils/{print-type.d.ts → printType.d.ts} +0 -0
- package/compiler/utils/{print-type.js → printType.js} +0 -0
- package/compiler/utils/{render-template.d.ts → renderTemplate.d.ts} +0 -0
- package/compiler/utils/{render-template.js → renderTemplate.js} +0 -0
- package/compiler/utils/tags.d.ts +13 -0
- package/compiler/utils/tags.js +53 -0
- package/constants/index.d.ts +1 -2
- package/constants/index.js +2 -2
- package/package.json +22 -27
- package/types/context.d.ts +6 -0
- package/types/index.d.ts +1 -1
- package/types/index.js +1 -1
- package/types/plugin.d.ts +4 -3
- package/types/{plus-element.d.ts → plusElement.d.ts} +0 -0
- package/types/{plus-element.js → plusElement.js} +0 -0
- package/client/utils/is-ready.d.ts +0 -2
- package/client/utils/is-ready.js +0 -4
- package/client/utils/on-ready.d.ts +0 -2
- package/client/utils/on-ready.js +0 -6
- package/client/utils/render.d.ts +0 -2
- package/client/utils/render.js +0 -19
- package/compiler/plugins/componentDependencyResolver.d.ts +0 -5
- package/compiler/plugins/componentDependencyResolver.js +0 -40
- package/compiler/plugins/docs.js +0 -320
- package/compiler/utils/get-tags.d.ts +0 -6
- package/compiler/utils/get-tags.js +0 -34
- package/runtime/index.d.ts +0 -1
- package/runtime/index.js +0 -4
package/types/plugin.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { Global } from './global';
|
|
|
3
3
|
export declare type Return<T> = void | T | Promise<T>;
|
|
4
4
|
export declare type Plugin = {
|
|
5
5
|
name: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
options?: any;
|
|
7
|
+
start?: (global: Global) => Return<void>;
|
|
8
|
+
next?: (context: Context, global: Global) => Return<any>;
|
|
9
|
+
finish?: (global: Global) => Return<void>;
|
|
9
10
|
};
|
|
File without changes
|
|
File without changes
|
package/client/utils/is-ready.js
DELETED
package/client/utils/on-ready.js
DELETED
package/client/utils/render.d.ts
DELETED
package/client/utils/render.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { html, render as renderer } from 'uhtml';
|
|
2
|
-
import * as CONSTANTS from '../../constants/index.js';
|
|
3
|
-
import { call } from './call.js';
|
|
4
|
-
import { getStyles } from './get-styles.js';
|
|
5
|
-
import { host } from './host.js';
|
|
6
|
-
export const render = (target) => {
|
|
7
|
-
const element = host(target);
|
|
8
|
-
renderer(element.shadowRoot, () => {
|
|
9
|
-
const markup = call(target, CONSTANTS.METHOD_RENDER);
|
|
10
|
-
const styles = getStyles(target);
|
|
11
|
-
if (!styles && !markup)
|
|
12
|
-
return html ``;
|
|
13
|
-
if (!styles)
|
|
14
|
-
return markup;
|
|
15
|
-
if (!markup)
|
|
16
|
-
return html `<style>${styles}</style>`;
|
|
17
|
-
return html `<style>${styles}</style>${markup}`;
|
|
18
|
-
});
|
|
19
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { visitor } from '../utils/index.js';
|
|
2
|
-
export const componentDependencyResolver = () => {
|
|
3
|
-
const name = 'componentDependencyResolver';
|
|
4
|
-
const next = (context, global) => {
|
|
5
|
-
var _a, _b, _c, _d;
|
|
6
|
-
if (!context.dependenciesUnresolved) {
|
|
7
|
-
visitor(context.fileAST, {
|
|
8
|
-
JSXOpeningElement(path) {
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
const name = path.node.name.name;
|
|
11
|
-
if (!name.includes('-'))
|
|
12
|
-
return;
|
|
13
|
-
const find = (_a = context.dependenciesUnresolved) === null || _a === void 0 ? void 0 : _a.includes(name);
|
|
14
|
-
if (find)
|
|
15
|
-
return;
|
|
16
|
-
(_b = context.dependenciesUnresolved) !== null && _b !== void 0 ? _b : (context.dependenciesUnresolved = []);
|
|
17
|
-
(_c = context.dependenciesUnresolved) === null || _c === void 0 ? void 0 : _c.push(name);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
for (const current of global.contexts) {
|
|
22
|
-
if (!((_a = current.dependenciesUnresolved) === null || _a === void 0 ? void 0 : _a.length))
|
|
23
|
-
continue;
|
|
24
|
-
const dependencies = global.contexts.filter((context) => { var _a; return (_a = current.dependenciesUnresolved) === null || _a === void 0 ? void 0 : _a.includes(context.componentTag); });
|
|
25
|
-
for (const dependency of dependencies) {
|
|
26
|
-
if ((_b = current.dependencies) === null || _b === void 0 ? void 0 : _b.some((item) => item.componentTag == dependency.componentTag))
|
|
27
|
-
continue;
|
|
28
|
-
(_c = current.dependencies) !== null && _c !== void 0 ? _c : (current.dependencies = []);
|
|
29
|
-
current.dependencies.push(dependency);
|
|
30
|
-
current.dependenciesUnresolved = (_d = current.dependenciesUnresolved) === null || _d === void 0 ? void 0 : _d.filter((current) => current != dependency.componentTag);
|
|
31
|
-
// TODO
|
|
32
|
-
// current.fileAST!.program.body.unshift(t.importDeclaration([], t.stringLiteral(dependency.filePath!)));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
return {
|
|
37
|
-
name,
|
|
38
|
-
next
|
|
39
|
-
};
|
|
40
|
-
};
|
package/compiler/plugins/docs.js
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { capitalCase, paramCase } from 'change-case';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
// import glob from 'glob';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { getInitializer, getTags, getType, printType } from '../utils/index.js';
|
|
6
|
-
export const docs = (options) => {
|
|
7
|
-
const name = 'docs';
|
|
8
|
-
const start = (global) => {
|
|
9
|
-
global.docs = {
|
|
10
|
-
prefix: options.prefix,
|
|
11
|
-
components: []
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
const next = (context, global) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const tags = getTags(context.class);
|
|
17
|
-
const development = tags.some((tag) => tag.key == 'development');
|
|
18
|
-
const experimental = tags.some((tag) => tag.key == 'experimental');
|
|
19
|
-
const externals = fs.existsSync(path.resolve(context.directoryPath || '', 'externals'));
|
|
20
|
-
const examples = (() => {
|
|
21
|
-
const items = [];
|
|
22
|
-
const source = path.join(context.directoryPath || '', 'examples');
|
|
23
|
-
if (!fs.existsSync(source))
|
|
24
|
-
return items;
|
|
25
|
-
return fs
|
|
26
|
-
.readdirSync(source)
|
|
27
|
-
.filter((file) => file.endsWith('.md'))
|
|
28
|
-
.map((file) => {
|
|
29
|
-
const item = {};
|
|
30
|
-
const regex = /```\w+\s\[\w+(:\w+)?\]\s[\S\s]*?```/g;
|
|
31
|
-
const filePath = path.join(source, file);
|
|
32
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
33
|
-
item.key = path.basename(filePath).replace('.md', '');
|
|
34
|
-
item.title = capitalCase(item.key);
|
|
35
|
-
item.readme = content.replace(regex, '').trim();
|
|
36
|
-
item.codes = (content.match(regex) || []).map((section) => {
|
|
37
|
-
try {
|
|
38
|
-
const lines = section.split('\n');
|
|
39
|
-
const key = ((lines[0].match(/\[\w+(:\w+)?\]/) || []).shift() || '').replace('[', '').replace(']', '');
|
|
40
|
-
const type = ((lines[0].match(/```\w+/) || []).pop() || '').replace('```', '');
|
|
41
|
-
const value = lines.slice(1, -1).join('\n');
|
|
42
|
-
return {
|
|
43
|
-
key,
|
|
44
|
-
type,
|
|
45
|
-
value
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
catch (_a) { }
|
|
49
|
-
});
|
|
50
|
-
return item;
|
|
51
|
-
});
|
|
52
|
-
})();
|
|
53
|
-
const readme = (() => {
|
|
54
|
-
try {
|
|
55
|
-
const source = path.resolve(context.directoryPath || '', `${context.fileName}.md`);
|
|
56
|
-
return fs.readFileSync(source, 'utf8');
|
|
57
|
-
}
|
|
58
|
-
catch (_a) { }
|
|
59
|
-
})();
|
|
60
|
-
const description = (() => {
|
|
61
|
-
const content = readme || '';
|
|
62
|
-
if (!content.startsWith('# '))
|
|
63
|
-
return '';
|
|
64
|
-
const sections = content.split('\n');
|
|
65
|
-
for (let i = 1; i < sections.length; i++) {
|
|
66
|
-
const section = sections[i].trim();
|
|
67
|
-
if (!section)
|
|
68
|
-
continue;
|
|
69
|
-
return section;
|
|
70
|
-
}
|
|
71
|
-
return '';
|
|
72
|
-
})();
|
|
73
|
-
const properties = (context.classProperties || []).map((property) => {
|
|
74
|
-
var _a;
|
|
75
|
-
const tags = getTags(property);
|
|
76
|
-
const name = property.key['name'];
|
|
77
|
-
const attribute = paramCase(name);
|
|
78
|
-
// TODO
|
|
79
|
-
const initializer = getInitializer(property.value);
|
|
80
|
-
// TODO
|
|
81
|
-
const reflect = (() => {
|
|
82
|
-
if (!property.decorators)
|
|
83
|
-
return false;
|
|
84
|
-
try {
|
|
85
|
-
for (const decorator of property.decorators) {
|
|
86
|
-
for (const argument of decorator.expression['arguments']) {
|
|
87
|
-
for (const property of argument.properties) {
|
|
88
|
-
if (property.key.name != 'reflect')
|
|
89
|
-
continue;
|
|
90
|
-
if (property.value.type != 'BooleanLiteral')
|
|
91
|
-
continue;
|
|
92
|
-
if (!property.value.value)
|
|
93
|
-
continue;
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
catch (_a) { }
|
|
100
|
-
return false;
|
|
101
|
-
})();
|
|
102
|
-
const required = !property.optional;
|
|
103
|
-
// TODO
|
|
104
|
-
const { type, members } = (() => {
|
|
105
|
-
const ast = getType(context.fileAST, (property.typeAnnotation || {})['typeAnnotation'], {
|
|
106
|
-
directory: context.directoryPath
|
|
107
|
-
});
|
|
108
|
-
return printType(ast);
|
|
109
|
-
})();
|
|
110
|
-
const experimental = tags.some((tag) => tag.key == 'experimental');
|
|
111
|
-
const description = (_a = tags.find((tag) => !tag.key)) === null || _a === void 0 ? void 0 : _a.value;
|
|
112
|
-
const model = tags.some((tag) => tag.key == 'model');
|
|
113
|
-
return {
|
|
114
|
-
name,
|
|
115
|
-
attribute,
|
|
116
|
-
initializer,
|
|
117
|
-
reflect,
|
|
118
|
-
required,
|
|
119
|
-
type,
|
|
120
|
-
experimental,
|
|
121
|
-
description,
|
|
122
|
-
members,
|
|
123
|
-
model
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
const parts = tags
|
|
127
|
-
.filter((tag) => tag.key == 'part')
|
|
128
|
-
.map((tag) => {
|
|
129
|
-
var _a;
|
|
130
|
-
const sections = ((_a = tag.value) === null || _a === void 0 ? void 0 : _a.split('-')) || [];
|
|
131
|
-
const name = sections[0].trim();
|
|
132
|
-
const description = sections.slice(1).join('-').trim();
|
|
133
|
-
return {
|
|
134
|
-
name,
|
|
135
|
-
description
|
|
136
|
-
};
|
|
137
|
-
});
|
|
138
|
-
const methods = (context.classMethods || []).map((method) => {
|
|
139
|
-
var _a;
|
|
140
|
-
const tags = getTags(method);
|
|
141
|
-
const name = method.key['name'];
|
|
142
|
-
const experimental = tags.some((tag) => tag.key == 'experimental');
|
|
143
|
-
// TODO
|
|
144
|
-
// const params = printType(getType(
|
|
145
|
-
// context.ast,
|
|
146
|
-
// method.params,
|
|
147
|
-
// {
|
|
148
|
-
// directory: context.directory,
|
|
149
|
-
// }
|
|
150
|
-
// ));
|
|
151
|
-
// console.log(111, params)
|
|
152
|
-
// TODO: returnType
|
|
153
|
-
const type = (() => {
|
|
154
|
-
try {
|
|
155
|
-
return printType(getType(context.fileAST, (method.returnType || {})['typeAnnotation'], {
|
|
156
|
-
directory: context.directoryPath
|
|
157
|
-
}));
|
|
158
|
-
}
|
|
159
|
-
catch (_a) { }
|
|
160
|
-
})();
|
|
161
|
-
// TODO
|
|
162
|
-
const signature = `${method.key['name']}(${''}) => ${type}`;
|
|
163
|
-
const description = (_a = tags.find((tag) => !tag.key)) === null || _a === void 0 ? void 0 : _a.value;
|
|
164
|
-
// TODO
|
|
165
|
-
const parameters = [
|
|
166
|
-
// {
|
|
167
|
-
// "name": "offsetX",
|
|
168
|
-
// "description": "Moving size (px) in the `horizontal` direction. Use `null` to ignore this."
|
|
169
|
-
// },
|
|
170
|
-
// {
|
|
171
|
-
// "name": "offsetY",
|
|
172
|
-
// "description": "Moving size (px) in the `vertical` direction. Use `null` to ignore this."
|
|
173
|
-
// }
|
|
174
|
-
];
|
|
175
|
-
return {
|
|
176
|
-
name,
|
|
177
|
-
experimental,
|
|
178
|
-
type,
|
|
179
|
-
signature,
|
|
180
|
-
description,
|
|
181
|
-
parameters
|
|
182
|
-
};
|
|
183
|
-
});
|
|
184
|
-
const slots = tags
|
|
185
|
-
.filter((tag) => tag.key == 'slot')
|
|
186
|
-
.map((tag) => {
|
|
187
|
-
var _a;
|
|
188
|
-
const sections = ((_a = tag.value) === null || _a === void 0 ? void 0 : _a.split('-')) || [];
|
|
189
|
-
const name = sections[0].trim();
|
|
190
|
-
const description = sections.slice(1).join('-').trim();
|
|
191
|
-
return {
|
|
192
|
-
name,
|
|
193
|
-
description
|
|
194
|
-
};
|
|
195
|
-
});
|
|
196
|
-
const events = (context.classEvents || []).map((event) => {
|
|
197
|
-
var _a;
|
|
198
|
-
const tags = getTags(event);
|
|
199
|
-
const name = event.key['name'];
|
|
200
|
-
const cancelable = (() => {
|
|
201
|
-
if (!event.decorators)
|
|
202
|
-
return false;
|
|
203
|
-
try {
|
|
204
|
-
for (const decorator of event.decorators) {
|
|
205
|
-
for (const argument of decorator.expression['arguments']) {
|
|
206
|
-
for (const property of argument.properties) {
|
|
207
|
-
if (property.key.name != 'cancelable')
|
|
208
|
-
continue;
|
|
209
|
-
if (property.value.type != 'BooleanLiteral')
|
|
210
|
-
continue;
|
|
211
|
-
if (!property.value.value)
|
|
212
|
-
continue;
|
|
213
|
-
return true;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
catch (_a) { }
|
|
219
|
-
return false;
|
|
220
|
-
})();
|
|
221
|
-
// TODO
|
|
222
|
-
const detail = (() => {
|
|
223
|
-
try {
|
|
224
|
-
return printType(getType(context.fileAST, (event.typeAnnotation || {})['typeAnnotation'].typeParameters.params[0], {
|
|
225
|
-
directory: context.directoryPath
|
|
226
|
-
}));
|
|
227
|
-
}
|
|
228
|
-
catch (_a) { }
|
|
229
|
-
})();
|
|
230
|
-
const experimental = tags.some((tag) => tag.key == 'experimental');
|
|
231
|
-
const description = (_a = tags.find((tag) => !tag.key)) === null || _a === void 0 ? void 0 : _a.value;
|
|
232
|
-
const model = tags.some((tag) => tag.key == 'model');
|
|
233
|
-
return {
|
|
234
|
-
name,
|
|
235
|
-
cancelable,
|
|
236
|
-
detail,
|
|
237
|
-
experimental,
|
|
238
|
-
description,
|
|
239
|
-
model
|
|
240
|
-
};
|
|
241
|
-
});
|
|
242
|
-
const styles = (() => {
|
|
243
|
-
const styles = [];
|
|
244
|
-
try {
|
|
245
|
-
fs.readFileSync(context.stylePath || '', 'utf8')
|
|
246
|
-
.split('@prop')
|
|
247
|
-
.slice(1)
|
|
248
|
-
.map((section) => {
|
|
249
|
-
var _a;
|
|
250
|
-
let [description, name] = section.split(/\n/);
|
|
251
|
-
name = name.split(':').slice(0, -1).join(':').trim();
|
|
252
|
-
description = description.trim();
|
|
253
|
-
let [initializer] = ((_a = context.styleParsed) === null || _a === void 0 ? void 0 : _a.split(name).slice(1, 2)) || [];
|
|
254
|
-
if (initializer)
|
|
255
|
-
initializer = initializer.split(/;|}/)[0].replace(':', '').trim();
|
|
256
|
-
styles.push({
|
|
257
|
-
name,
|
|
258
|
-
initializer,
|
|
259
|
-
description
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
catch (_a) { }
|
|
264
|
-
return styles;
|
|
265
|
-
})();
|
|
266
|
-
// TODO
|
|
267
|
-
const lastModified = 0;
|
|
268
|
-
// glob
|
|
269
|
-
// .sync(path.join(context.directory, '**/*.*'))
|
|
270
|
-
// .reduce((result, file) => {
|
|
271
|
-
// const state = fs.statSync(file);
|
|
272
|
-
// return result > state.mtime ? result : state.mtime
|
|
273
|
-
// }, 0);
|
|
274
|
-
const group = ((_a = tags.find((tag) => tag.key == 'group')) === null || _a === void 0 ? void 0 : _a.value) || null;
|
|
275
|
-
const main = (group && context.componentKey == group) || !group;
|
|
276
|
-
// TODO
|
|
277
|
-
// context.types = (() => {
|
|
278
|
-
// return [];
|
|
279
|
-
// })();
|
|
280
|
-
global.docs.components.push({
|
|
281
|
-
key: context.componentKey,
|
|
282
|
-
tag: context.componentTag,
|
|
283
|
-
title: capitalCase(context.componentKey || ''),
|
|
284
|
-
main,
|
|
285
|
-
group,
|
|
286
|
-
development,
|
|
287
|
-
experimental,
|
|
288
|
-
// TODO
|
|
289
|
-
deprecated: false,
|
|
290
|
-
externals,
|
|
291
|
-
lastModified,
|
|
292
|
-
// TODO
|
|
293
|
-
tags: [],
|
|
294
|
-
// TODO
|
|
295
|
-
source: context.componentKey,
|
|
296
|
-
description,
|
|
297
|
-
readme,
|
|
298
|
-
properties,
|
|
299
|
-
slots,
|
|
300
|
-
events,
|
|
301
|
-
styles,
|
|
302
|
-
parts,
|
|
303
|
-
methods,
|
|
304
|
-
examples
|
|
305
|
-
});
|
|
306
|
-
};
|
|
307
|
-
const finish = (global) => {
|
|
308
|
-
global.docs.components = global.docs.components.sort((a, b) => (a.key > b.key ? 1 : -1));
|
|
309
|
-
// TODO
|
|
310
|
-
// fs.ensureDirSync(path.dirname(options.dist));
|
|
311
|
-
// TODO
|
|
312
|
-
// fs.writeJSONSync(options.dist, global.docs, { replacer: null, spaces: 2 });
|
|
313
|
-
};
|
|
314
|
-
return {
|
|
315
|
-
name,
|
|
316
|
-
start,
|
|
317
|
-
next,
|
|
318
|
-
finish
|
|
319
|
-
};
|
|
320
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const getTags = (node) => {
|
|
2
|
-
if (!node)
|
|
3
|
-
return [];
|
|
4
|
-
const tags = [];
|
|
5
|
-
const lines = [];
|
|
6
|
-
const comments = (node.leadingComments || [])
|
|
7
|
-
.map((comment) => comment.value)
|
|
8
|
-
.join('\r\n')
|
|
9
|
-
.split('\r\n');
|
|
10
|
-
for (const comment of comments) {
|
|
11
|
-
let line = comment.trimLeft();
|
|
12
|
-
if (line.startsWith('*'))
|
|
13
|
-
line = line.slice(1);
|
|
14
|
-
if (!line)
|
|
15
|
-
continue;
|
|
16
|
-
const isTag = line.trim().startsWith('@');
|
|
17
|
-
if (isTag || !lines.length)
|
|
18
|
-
lines.push(line);
|
|
19
|
-
else
|
|
20
|
-
lines[lines.length - 1] += line;
|
|
21
|
-
}
|
|
22
|
-
for (const line of lines) {
|
|
23
|
-
let value = line.trim();
|
|
24
|
-
if (!value.startsWith('@')) {
|
|
25
|
-
tags.push({ value });
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
const sections = value.split(' ');
|
|
29
|
-
const key = sections[0].slice(1);
|
|
30
|
-
value = sections.slice(1).join(' ').trim();
|
|
31
|
-
tags.push({ key, value });
|
|
32
|
-
}
|
|
33
|
-
return tags;
|
|
34
|
-
};
|
package/runtime/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const html: (template: any, ...values: any[]) => any;
|
package/runtime/index.js
DELETED