@alloy-js/core 0.16.0 → 0.18.0-dev.2
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/CHANGELOG.md +15 -0
- package/dist/src/binder.d.ts +19 -235
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +85 -386
- package/dist/src/code.d.ts +1 -1
- package/dist/src/code.d.ts.map +1 -1
- package/dist/src/components/Block.d.ts +1 -1
- package/dist/src/components/Block.d.ts.map +1 -1
- package/dist/src/components/Block.js +3 -1
- package/dist/src/components/Declaration.d.ts +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +6 -5
- package/dist/src/components/For.d.ts +1 -1
- package/dist/src/components/For.d.ts.map +1 -1
- package/dist/src/components/For.js +1 -1
- package/dist/src/components/Indent.d.ts +1 -1
- package/dist/src/components/Indent.d.ts.map +1 -1
- package/dist/src/components/List.d.ts +1 -1
- package/dist/src/components/List.d.ts.map +1 -1
- package/dist/src/components/List.js +3 -1
- package/dist/src/components/MemberDeclaration.d.ts +3 -3
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js +4 -4
- package/dist/src/components/MemberScope.d.ts +2 -2
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +0 -2
- package/dist/src/components/Output.d.ts +1 -1
- package/dist/src/components/Output.d.ts.map +1 -1
- package/dist/src/components/Output.js +1 -1
- package/dist/src/components/Prose.d.ts +1 -1
- package/dist/src/components/Prose.d.ts.map +1 -1
- package/dist/src/components/ReferenceOrContent.d.ts +1 -1
- package/dist/src/components/ReferenceOrContent.d.ts.map +1 -1
- package/dist/src/components/Scope.d.ts +2 -2
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js +3 -6
- package/dist/src/components/Show.d.ts +1 -1
- package/dist/src/components/Show.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.d.ts +1 -1
- package/dist/src/components/SourceDirectory.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.js +1 -1
- package/dist/src/components/SourceFile.d.ts +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +1 -1
- package/dist/src/components/StatementList.d.ts +1 -1
- package/dist/src/components/StatementList.d.ts.map +1 -1
- package/dist/src/components/StatementList.js +1 -1
- package/dist/src/components/Switch.d.ts +2 -2
- package/dist/src/components/Switch.d.ts.map +1 -1
- package/dist/src/components/Switch.js +2 -1
- package/dist/src/components/Wrap.d.ts +1 -1
- package/dist/src/components/Wrap.d.ts.map +1 -1
- package/dist/src/context/assignment.d.ts +1 -1
- package/dist/src/context/assignment.d.ts.map +1 -1
- package/dist/src/context/binder.d.ts +3 -3
- package/dist/src/context/binder.d.ts.map +1 -1
- package/dist/src/context/declaration.d.ts +1 -1
- package/dist/src/context/declaration.d.ts.map +1 -1
- package/dist/src/context/member-declaration.d.ts +1 -1
- package/dist/src/context/member-declaration.d.ts.map +1 -1
- package/dist/src/context/member-declaration.js +0 -1
- package/dist/src/context/member-scope.d.ts +1 -1
- package/dist/src/context/member-scope.d.ts.map +1 -1
- package/dist/src/context/name-policy.d.ts +1 -1
- package/dist/src/context/name-policy.d.ts.map +1 -1
- package/dist/src/context/scope.d.ts +1 -1
- package/dist/src/context/scope.d.ts.map +1 -1
- package/dist/src/context/source-directory.d.ts +1 -1
- package/dist/src/context/source-directory.d.ts.map +1 -1
- package/dist/src/context/source-file.d.ts +2 -2
- package/dist/src/context/source-file.d.ts.map +1 -1
- package/dist/src/context.d.ts +2 -2
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +1 -1
- package/dist/src/debug.d.ts +1 -0
- package/dist/src/debug.d.ts.map +1 -1
- package/dist/src/debug.js +4 -1
- package/dist/src/index.d.ts +8 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -2
- package/dist/src/jsx-runtime.d.ts +4 -272
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +3 -315
- package/dist/src/props-combinators.d.ts +19 -0
- package/dist/src/props-combinators.d.ts.map +1 -0
- package/dist/src/props-combinators.js +108 -0
- package/dist/src/reactive-union-set.d.ts +29 -0
- package/dist/src/reactive-union-set.d.ts.map +1 -0
- package/dist/src/reactive-union-set.js +183 -0
- package/dist/src/reactivity.d.ts +75 -0
- package/dist/src/reactivity.d.ts.map +1 -0
- package/dist/src/reactivity.js +141 -0
- package/dist/src/refkey.d.ts +36 -0
- package/dist/src/refkey.d.ts.map +1 -1
- package/dist/src/refkey.js +40 -0
- package/dist/src/render.d.ts +5 -1
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +68 -15
- package/dist/src/runtime/component.d.ts +24 -0
- package/dist/src/runtime/component.d.ts.map +1 -0
- package/dist/src/runtime/component.js +19 -0
- package/dist/src/runtime/intrinsic.d.ts +168 -0
- package/dist/src/runtime/intrinsic.d.ts.map +1 -0
- package/dist/src/runtime/intrinsic.js +11 -0
- package/dist/src/scheduler.d.ts +2 -2
- package/dist/src/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler.js +27 -6
- package/dist/src/slot.d.ts +2 -2
- package/dist/src/slot.d.ts.map +1 -1
- package/dist/src/slot.js +1 -1
- package/dist/src/stc.d.ts +1 -1
- package/dist/src/stc.d.ts.map +1 -1
- package/dist/src/sti.d.ts +7 -6
- package/dist/src/sti.d.ts.map +1 -1
- package/dist/src/sti.js +1 -1
- package/dist/src/symbols/flags.d.ts +70 -0
- package/dist/src/symbols/flags.d.ts.map +1 -0
- package/dist/src/symbols/flags.js +72 -0
- package/dist/src/symbols/index.d.ts +7 -0
- package/dist/src/symbols/index.d.ts.map +1 -0
- package/dist/src/symbols/index.js +6 -0
- package/dist/src/symbols/output-scope.d.ts +94 -0
- package/dist/src/symbols/output-scope.d.ts.map +1 -0
- package/dist/src/symbols/output-scope.js +222 -0
- package/dist/src/symbols/output-symbol.d.ts +89 -0
- package/dist/src/symbols/output-symbol.d.ts.map +1 -0
- package/dist/src/symbols/output-symbol.js +333 -0
- package/dist/src/symbols/symbol-flow.d.ts +13 -0
- package/dist/src/symbols/symbol-flow.d.ts.map +1 -0
- package/dist/src/symbols/symbol-flow.js +74 -0
- package/dist/src/symbols/symbol-slot.d.ts +12 -0
- package/dist/src/symbols/symbol-slot.d.ts.map +1 -0
- package/dist/src/symbols/symbol-slot.js +36 -0
- package/dist/src/symbols/symbol-table.d.ts +14 -0
- package/dist/src/symbols/symbol-table.d.ts.map +1 -0
- package/dist/src/symbols/symbol-table.js +42 -0
- package/dist/src/tap.d.ts +3 -2
- package/dist/src/tap.d.ts.map +1 -1
- package/dist/src/tracer.d.ts +238 -0
- package/dist/src/tracer.d.ts.map +1 -0
- package/dist/src/tracer.js +496 -0
- package/dist/src/tsdoc-metadata.json +1 -1
- package/dist/src/utils.d.ts +4 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +2 -1
- package/dist/test/components/slot.test.js +5 -7
- package/dist/test/props-with-defaults.test.js +1 -1
- package/dist/test/reactive-union-set.test.d.ts +2 -0
- package/dist/test/reactive-union-set.test.d.ts.map +1 -0
- package/dist/test/reactive-union-set.test.js +170 -0
- package/dist/test/reactivity/cleanup.test.js +2 -1
- package/dist/test/reactivity/memo.test.js +1 -1
- package/dist/test/reactivity/untrack.test.js +1 -1
- package/dist/test/rendering/memoization.test.js +2 -1
- package/dist/test/split-props.test.js +1 -1
- package/dist/test/symbols/output-scope.test.d.ts +2 -0
- package/dist/test/symbols/output-scope.test.d.ts.map +1 -0
- package/dist/test/symbols/output-scope.test.js +343 -0
- package/dist/test/symbols/output-symbol.test.d.ts +2 -0
- package/dist/test/symbols/output-symbol.test.d.ts.map +1 -0
- package/dist/test/symbols/output-symbol.test.js +447 -0
- package/dist/test/symbols/resolution.test.d.ts +2 -0
- package/dist/test/symbols/resolution.test.d.ts.map +1 -0
- package/dist/test/symbols/resolution.test.js +141 -0
- package/dist/test/symbols/utils.d.ts +25 -0
- package/dist/test/symbols/utils.d.ts.map +1 -0
- package/dist/test/symbols/utils.js +47 -0
- package/dist/testing/extend-expect.d.ts +15 -0
- package/dist/testing/extend-expect.d.ts.map +1 -1
- package/dist/testing/extend-expect.js +2 -1
- package/dist/testing/render.d.ts +1 -1
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -24
- package/src/binder.ts +146 -672
- package/src/code.ts +1 -1
- package/src/components/Block.tsx +4 -1
- package/src/components/Declaration.tsx +8 -7
- package/src/components/For.tsx +2 -1
- package/src/components/Indent.tsx +1 -1
- package/src/components/List.tsx +3 -1
- package/src/components/MemberDeclaration.tsx +7 -6
- package/src/components/MemberScope.tsx +2 -5
- package/src/components/Output.tsx +2 -1
- package/src/components/Prose.tsx +1 -1
- package/src/components/ReferenceOrContent.tsx +1 -1
- package/src/components/Scope.tsx +3 -7
- package/src/components/Show.tsx +1 -1
- package/src/components/SourceDirectory.tsx +2 -1
- package/src/components/SourceFile.tsx +2 -1
- package/src/components/StatementList.tsx +2 -1
- package/src/components/Switch.tsx +2 -1
- package/src/components/Wrap.tsx +1 -1
- package/src/context/assignment.ts +1 -1
- package/src/context/binder.ts +3 -3
- package/src/context/declaration.ts +1 -1
- package/src/context/member-declaration.ts +1 -1
- package/src/context/member-scope.ts +1 -1
- package/src/context/name-policy.ts +1 -1
- package/src/context/scope.ts +1 -1
- package/src/context/source-directory.ts +1 -1
- package/src/context/source-file.ts +2 -2
- package/src/context.ts +3 -7
- package/src/debug.ts +5 -1
- package/src/index.ts +15 -1
- package/src/jsx-runtime.ts +15 -674
- package/src/props-combinators.ts +148 -0
- package/src/reactive-union-set.ts +238 -0
- package/src/reactivity.ts +230 -0
- package/src/refkey.ts +40 -0
- package/src/render.ts +97 -26
- package/src/runtime/component.ts +67 -0
- package/src/runtime/intrinsic.ts +199 -0
- package/src/scheduler.ts +31 -6
- package/src/slot.ts +3 -4
- package/src/stc.ts +2 -2
- package/src/sti.ts +11 -11
- package/src/symbols/flags.ts +82 -0
- package/src/symbols/index.ts +6 -0
- package/src/symbols/output-scope.ts +296 -0
- package/src/symbols/output-symbol.ts +459 -0
- package/src/symbols/symbol-flow.ts +100 -0
- package/src/symbols/symbol-slot.tsx +48 -0
- package/src/symbols/symbol-table.ts +72 -0
- package/src/tap.ts +3 -2
- package/src/tracer.ts +474 -0
- package/src/utils.tsx +7 -5
- package/temp/api.json +7446 -5133
- package/test/components/slot.test.tsx +8 -11
- package/test/props-with-defaults.test.ts +1 -1
- package/test/reactive-union-set.test.tsx +191 -0
- package/test/reactivity/cleanup.test.tsx +2 -1
- package/test/reactivity/memo.test.tsx +1 -1
- package/test/reactivity/untrack.test.ts +1 -1
- package/test/rendering/basic.test.tsx +1 -1
- package/test/rendering/memoization.test.tsx +1 -1
- package/test/split-props.test.ts +1 -1
- package/test/symbols/output-scope.test.ts +300 -0
- package/test/symbols/output-symbol.test.ts +456 -0
- package/test/symbols/resolution.test.ts +170 -0
- package/test/symbols/utils.ts +93 -0
- package/test/utils.test.tsx +1 -1
- package/testing/extend-expect.ts +16 -0
- package/testing/render.ts +1 -2
- package/LICENSE +0 -7
- package/dist/test/symbols.test.d.ts +0 -2
- package/dist/test/symbols.test.d.ts.map +0 -1
- package/dist/test/symbols.test.js +0 -884
- package/test/symbols.test.ts +0 -1006
package/dist/src/render.js
CHANGED
|
@@ -3,9 +3,13 @@ import { doc } from "prettier";
|
|
|
3
3
|
import prettier from "prettier/doc.js";
|
|
4
4
|
import { useContext } from "./context.js";
|
|
5
5
|
import { SourceFileContext } from "./context/source-file.js";
|
|
6
|
-
import {
|
|
6
|
+
import { shouldDebug } from "./debug.js";
|
|
7
|
+
import { effect, getContext, getElementCache, isCustomContext, root, untrack } from "./reactivity.js";
|
|
7
8
|
import { isRefkey } from "./refkey.js";
|
|
9
|
+
import { isComponentCreator } from "./runtime/component.js";
|
|
10
|
+
import { isIntrinsicElement } from "./runtime/intrinsic.js";
|
|
8
11
|
import { flushJobs } from "./scheduler.js";
|
|
12
|
+
import { trace, TracePhase } from "./tracer.js";
|
|
9
13
|
const {
|
|
10
14
|
builders: {
|
|
11
15
|
align,
|
|
@@ -122,10 +126,6 @@ export function createRenderTreeHook(subtree, hooks) {
|
|
|
122
126
|
export function isPrintHook(type) {
|
|
123
127
|
return typeof type === "object" && type !== null && printHookTag in type;
|
|
124
128
|
}
|
|
125
|
-
function traceRender(phase, message) {
|
|
126
|
-
return false;
|
|
127
|
-
//console.log(`[\x1b[34m${phase}\x1b[0m]: ${message()}`);
|
|
128
|
-
}
|
|
129
129
|
export function render(children, options) {
|
|
130
130
|
const tree = renderTree(children);
|
|
131
131
|
flushJobs();
|
|
@@ -197,7 +197,10 @@ export function renderTree(children) {
|
|
|
197
197
|
return rootElem;
|
|
198
198
|
}
|
|
199
199
|
function renderWorker(node, children) {
|
|
200
|
-
|
|
200
|
+
if (!getContext()) {
|
|
201
|
+
throw new Error("Cannot render without a context. Make sure you are using the Output component.");
|
|
202
|
+
}
|
|
203
|
+
trace(TracePhase.render.worker, () => dumpChildren(children));
|
|
201
204
|
if (Array.isArray(node)) {
|
|
202
205
|
nodesToContext.set(node, getContext());
|
|
203
206
|
}
|
|
@@ -210,19 +213,19 @@ function renderWorker(node, children) {
|
|
|
210
213
|
}
|
|
211
214
|
}
|
|
212
215
|
function appendChild(node, rawChild) {
|
|
213
|
-
|
|
216
|
+
trace(TracePhase.render.appendChild, () => debugPrintChild(rawChild));
|
|
214
217
|
const child = normalizeChild(rawChild);
|
|
215
218
|
if (typeof child === "string") {
|
|
216
219
|
node.push(child);
|
|
217
220
|
} else {
|
|
218
221
|
const cache = getElementCache();
|
|
219
222
|
if (cache.has(child)) {
|
|
220
|
-
|
|
223
|
+
trace(TracePhase.render.appendChild, () => "Cached: " + debugPrintChild(child));
|
|
221
224
|
node.push(cache.get(child));
|
|
222
225
|
return;
|
|
223
226
|
}
|
|
224
227
|
if (isCustomContext(child)) {
|
|
225
|
-
|
|
228
|
+
trace(TracePhase.render.appendChild, () => "CustomContext: " + debugPrintChild(child));
|
|
226
229
|
child.useCustomContext(children => {
|
|
227
230
|
const newNode = [];
|
|
228
231
|
renderWorker(newNode, children);
|
|
@@ -230,8 +233,8 @@ function appendChild(node, rawChild) {
|
|
|
230
233
|
cache.set(child, newNode);
|
|
231
234
|
});
|
|
232
235
|
} else if (isIntrinsicElement(child)) {
|
|
236
|
+
trace(TracePhase.render.appendChild, () => "IntrinsicElement: " + debugPrintChild(child));
|
|
233
237
|
// don't need a new context here because intrinsics are never reactive
|
|
234
|
-
traceRender("appendChild:intrinsic-element", () => debugPrintChild(child));
|
|
235
238
|
const newNode = [];
|
|
236
239
|
function formatHookWithChildren(command) {
|
|
237
240
|
node.push(createRenderTreeHook(newNode, {
|
|
@@ -322,20 +325,20 @@ function appendChild(node, rawChild) {
|
|
|
322
325
|
}
|
|
323
326
|
} else if (isComponentCreator(child)) {
|
|
324
327
|
effect(() => {
|
|
325
|
-
|
|
328
|
+
trace(TracePhase.render.appendChild, () => "Component: " + debugPrintChild(child));
|
|
326
329
|
const componentRoot = [];
|
|
327
330
|
pushStack(child.component, child.props);
|
|
328
331
|
renderWorker(componentRoot, untrack(child));
|
|
329
332
|
popStack();
|
|
330
333
|
node.push(componentRoot);
|
|
331
334
|
cache.set(child, componentRoot);
|
|
332
|
-
|
|
335
|
+
trace(TracePhase.render.appendChild, () => "Component done: " + debugPrintChild(child));
|
|
333
336
|
});
|
|
334
337
|
} else if (typeof child === "function") {
|
|
335
|
-
|
|
338
|
+
trace(TracePhase.render.appendChild, () => "Memo: " + child.toString());
|
|
336
339
|
const index = node.length;
|
|
337
340
|
effect(() => {
|
|
338
|
-
|
|
341
|
+
trace(TracePhase.render.renderEffect, () => "");
|
|
339
342
|
let res = child();
|
|
340
343
|
while (typeof res === "function" && !isComponentCreator(res)) {
|
|
341
344
|
res = res();
|
|
@@ -346,7 +349,6 @@ function appendChild(node, rawChild) {
|
|
|
346
349
|
cache.set(child, newNodes);
|
|
347
350
|
return newNodes;
|
|
348
351
|
});
|
|
349
|
-
traceRender("appendChild:memo-done", () => "");
|
|
350
352
|
} else {
|
|
351
353
|
throw new Error("Unexpected child type");
|
|
352
354
|
}
|
|
@@ -392,6 +394,8 @@ function debugPrintChild(child) {
|
|
|
392
394
|
return "$memo";
|
|
393
395
|
} else if (isRef(child)) {
|
|
394
396
|
return "$ref";
|
|
397
|
+
} else if (isIntrinsicElement(child)) {
|
|
398
|
+
return `<${child.name}>`;
|
|
395
399
|
} else {
|
|
396
400
|
return JSON.stringify(child);
|
|
397
401
|
}
|
|
@@ -424,4 +428,53 @@ function printTreeWorker(tree) {
|
|
|
424
428
|
}
|
|
425
429
|
}
|
|
426
430
|
return doc;
|
|
431
|
+
}
|
|
432
|
+
// debugging utilities
|
|
433
|
+
const renderStack = [];
|
|
434
|
+
export function pushStack(component, props) {
|
|
435
|
+
if (!shouldDebug()) return;
|
|
436
|
+
renderStack.push({
|
|
437
|
+
component,
|
|
438
|
+
props
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
export function popStack() {
|
|
442
|
+
if (!shouldDebug()) return;
|
|
443
|
+
renderStack.pop();
|
|
444
|
+
}
|
|
445
|
+
export function printRenderStack() {
|
|
446
|
+
if (!shouldDebug()) return;
|
|
447
|
+
|
|
448
|
+
// eslint-disable-next-line no-console
|
|
449
|
+
console.error("Error rendering:");
|
|
450
|
+
for (let i = renderStack.length - 1; i >= 0; i--) {
|
|
451
|
+
const {
|
|
452
|
+
component,
|
|
453
|
+
props
|
|
454
|
+
} = renderStack[i];
|
|
455
|
+
// eslint-disable-next-line no-console
|
|
456
|
+
console.error(` at ${component.name}(${inspectProps(props)})`);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function inspectProps(props) {
|
|
460
|
+
return JSON.stringify(Object.fromEntries(Object.entries(props).map(([key, value]) => {
|
|
461
|
+
let safeValue;
|
|
462
|
+
switch (typeof value) {
|
|
463
|
+
case "string":
|
|
464
|
+
case "number":
|
|
465
|
+
case "boolean":
|
|
466
|
+
safeValue = value;
|
|
467
|
+
break;
|
|
468
|
+
case "undefined":
|
|
469
|
+
safeValue = "undefined";
|
|
470
|
+
break;
|
|
471
|
+
case "object":
|
|
472
|
+
safeValue = value ? "{...}" : null;
|
|
473
|
+
break;
|
|
474
|
+
case "function":
|
|
475
|
+
safeValue = "function";
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
return [key, safeValue];
|
|
479
|
+
})));
|
|
427
480
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ref } from "@vue/reactivity";
|
|
2
|
+
import { CustomContext } from "../reactivity.js";
|
|
3
|
+
import { Refkey } from "../refkey.js";
|
|
4
|
+
import { IntrinsicElement } from "./intrinsic.js";
|
|
5
|
+
export type Child = string | boolean | number | undefined | null | void | (() => Children) | Ref | Refkey | CustomContext | IntrinsicElement;
|
|
6
|
+
export type Children = Child | Children[];
|
|
7
|
+
export type Props = Record<string, any>;
|
|
8
|
+
export interface ComponentDefinition<TProps = Props> {
|
|
9
|
+
(props: TProps): Children;
|
|
10
|
+
}
|
|
11
|
+
export interface Component<TProps = Props> {
|
|
12
|
+
(props: TProps): Children;
|
|
13
|
+
tag?: symbol;
|
|
14
|
+
}
|
|
15
|
+
export interface ComponentCreator<TProps = Props> {
|
|
16
|
+
component: Component<TProps>;
|
|
17
|
+
(): Children;
|
|
18
|
+
props: TProps;
|
|
19
|
+
tag?: symbol;
|
|
20
|
+
}
|
|
21
|
+
export declare function isComponentCreator<TProps = any>(item: unknown, component?: Component<TProps>): item is ComponentCreator<TProps>;
|
|
22
|
+
export declare function createComponent<TProps extends Props = Props>(C: Component<TProps>, props: TProps): ComponentCreator<TProps>;
|
|
23
|
+
export declare function taggedComponent<TProps = Props>(tag: symbol, component: Component<TProps>): Component<TProps> & Required<Pick<Component<TProps>, "tag">>;
|
|
24
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@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eAAe,CAAC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC1D,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EACpB,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAAC,MAAM,CAAC,CAS1B;AAED,wBAAgB,eAAe,CAAC,MAAM,GAAG,KAAK,EAC5C,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,GAC3B,SAAS,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAG9D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function isComponentCreator(item, component) {
|
|
2
|
+
if (!component) {
|
|
3
|
+
return typeof item === "function" && item.component;
|
|
4
|
+
}
|
|
5
|
+
return typeof item === "function" && item.component === component;
|
|
6
|
+
}
|
|
7
|
+
export function createComponent(C, props) {
|
|
8
|
+
const creator = () => /* */C(props);
|
|
9
|
+
creator.props = props;
|
|
10
|
+
creator.component = C;
|
|
11
|
+
if (C.tag) {
|
|
12
|
+
creator.tag = C.tag;
|
|
13
|
+
}
|
|
14
|
+
return creator;
|
|
15
|
+
}
|
|
16
|
+
export function taggedComponent(tag, component) {
|
|
17
|
+
component.tag = tag;
|
|
18
|
+
return component;
|
|
19
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { Children } from "./component.js";
|
|
2
|
+
export interface IntrinsicElements {
|
|
3
|
+
/**
|
|
4
|
+
* Attempt to render the children on a single line if possible. If a group
|
|
5
|
+
* contains `<breakParent />` or a hard line, or if the group exceeds the
|
|
6
|
+
* print width, all linebreaks in the group will be broken.
|
|
7
|
+
*/
|
|
8
|
+
group: {
|
|
9
|
+
shouldBreak?: boolean;
|
|
10
|
+
id?: symbol;
|
|
11
|
+
children: Children;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A regular line break. This will break if the line exceeds the print
|
|
15
|
+
* width, otherwise it will be a space.
|
|
16
|
+
*/
|
|
17
|
+
line: {};
|
|
18
|
+
/**
|
|
19
|
+
* A regular line break. This will break if the line exceeds the print
|
|
20
|
+
* width, otherwise it will be a space.
|
|
21
|
+
*/
|
|
22
|
+
br: {};
|
|
23
|
+
/**
|
|
24
|
+
* A hard line break. This is a line that will always break, even if the
|
|
25
|
+
* group does not exceed print width.
|
|
26
|
+
*/
|
|
27
|
+
hardline: {};
|
|
28
|
+
/**
|
|
29
|
+
* A hard line break. This is a line that will always break, even if the
|
|
30
|
+
* group does not exceed print width.
|
|
31
|
+
*/
|
|
32
|
+
hbr: {};
|
|
33
|
+
/**
|
|
34
|
+
* A soft line break. This will break if the line exceeds the print width,
|
|
35
|
+
* otherwise it will be be nothing.
|
|
36
|
+
*/
|
|
37
|
+
softline: {};
|
|
38
|
+
/**
|
|
39
|
+
* A soft line break. This will break if the line exceeds the print width,
|
|
40
|
+
* otherwise it will be be nothing.
|
|
41
|
+
*/
|
|
42
|
+
sbr: {};
|
|
43
|
+
/**
|
|
44
|
+
* A literal line break. This will always break, even if the group does not
|
|
45
|
+
* exceed print width. The new line will ignore indentation.
|
|
46
|
+
*/
|
|
47
|
+
literalline: {};
|
|
48
|
+
/**
|
|
49
|
+
* A literal line break. This will always break, even if the group does not
|
|
50
|
+
* exceed print width. The new line will ignore indentation.
|
|
51
|
+
*/
|
|
52
|
+
lbr: {};
|
|
53
|
+
/**
|
|
54
|
+
* Increase the indentation level of the children of this component.
|
|
55
|
+
* Indentation is determined by the print options provided to the Output
|
|
56
|
+
* component or source file.
|
|
57
|
+
*/
|
|
58
|
+
indent: {
|
|
59
|
+
children: Children;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Indent the children of this component if the group specified by `groupId`
|
|
63
|
+
* is broken (or not broken if `negate` is passed). The specified group must
|
|
64
|
+
* already be printed.
|
|
65
|
+
*/
|
|
66
|
+
indentIfBreak: {
|
|
67
|
+
children: Children;
|
|
68
|
+
groupId: symbol;
|
|
69
|
+
negate?: boolean;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Similar to `group`, but will only place a line break before the last
|
|
73
|
+
* segment to exceed the print width. This is useful for formatting
|
|
74
|
+
* paragraphs of text where breaks are inserted prior to words which would
|
|
75
|
+
* otherwise exceed the print width.
|
|
76
|
+
*/
|
|
77
|
+
fill: {
|
|
78
|
+
children: Children;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Force the parent group to break.
|
|
82
|
+
*/
|
|
83
|
+
breakParent: {};
|
|
84
|
+
/**
|
|
85
|
+
* Print children if the current group or already printed group specified by
|
|
86
|
+
* `groupId` is broken. Otherwise, `flatContents` is printed instead.
|
|
87
|
+
*/
|
|
88
|
+
ifBreak: {
|
|
89
|
+
children: Children;
|
|
90
|
+
flatContents?: Children;
|
|
91
|
+
groupId?: symbol;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Print this content at the end of the line. Useful for things like line
|
|
95
|
+
* comments.
|
|
96
|
+
*/
|
|
97
|
+
lineSuffix: {
|
|
98
|
+
children: Children;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Force any line suffixes to print at this point.
|
|
102
|
+
*/
|
|
103
|
+
lineSuffixBoundary: {};
|
|
104
|
+
/**
|
|
105
|
+
* Decrease the indentation level of the children of this component.
|
|
106
|
+
* Indentation is determined by the print options provided to the Output
|
|
107
|
+
* component or source file.
|
|
108
|
+
*/
|
|
109
|
+
dedent: {
|
|
110
|
+
children: Children;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Indent the children of this component by either the number of characters
|
|
114
|
+
* indicated by the `width` prop, or by the provided string indicated by the
|
|
115
|
+
* `string` prop.
|
|
116
|
+
*/
|
|
117
|
+
align: {
|
|
118
|
+
children: Children;
|
|
119
|
+
width: number;
|
|
120
|
+
} | {
|
|
121
|
+
children: Children;
|
|
122
|
+
string: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Mark the current indentation level as "root" for the purposes of literal
|
|
126
|
+
* line breaks and `dedentToRoot`.
|
|
127
|
+
*/
|
|
128
|
+
markAsRoot: {
|
|
129
|
+
children: Children;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Decrease the indentation level to the root level specified by
|
|
133
|
+
* `<markAsRoot />`, or else to no indentation.
|
|
134
|
+
*/
|
|
135
|
+
dedentToRoot: {
|
|
136
|
+
children: Children;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface IntrinsicElementBase<TKey extends keyof IntrinsicElements = keyof IntrinsicElements> {
|
|
140
|
+
[intrinsicElementKey]: true;
|
|
141
|
+
name: TKey;
|
|
142
|
+
props: IntrinsicElements[TKey];
|
|
143
|
+
}
|
|
144
|
+
export declare function createIntrinsic<TKey extends keyof IntrinsicElements>(name: TKey, props: IntrinsicElements[TKey]): IntrinsicElementBase<TKey>;
|
|
145
|
+
export declare function isIntrinsicElement(type: unknown): type is IntrinsicElement;
|
|
146
|
+
export declare const intrinsicElementKey: unique symbol;
|
|
147
|
+
export type IndentIntrinsicElement = IntrinsicElementBase<"indent">;
|
|
148
|
+
export type IndentIfBreakIntrinsicElement = IntrinsicElementBase<"indentIfBreak">;
|
|
149
|
+
export type BrIntrinsicElement = IntrinsicElementBase<"br">;
|
|
150
|
+
export type LineIntrinsicElement = IntrinsicElementBase<"line">;
|
|
151
|
+
export type HbrIntrinsicElement = IntrinsicElementBase<"hbr">;
|
|
152
|
+
export type HardlineIntrinsicElement = IntrinsicElementBase<"hardline">;
|
|
153
|
+
export type SbrIntrinsicElement = IntrinsicElementBase<"sbr">;
|
|
154
|
+
export type SoftlineIntrinsicElement = IntrinsicElementBase<"softline">;
|
|
155
|
+
export type GroupIntrinsicElement = IntrinsicElementBase<"group">;
|
|
156
|
+
export type AlignIntrinsicElement = IntrinsicElementBase<"align">;
|
|
157
|
+
export type FillIntrinsicElement = IntrinsicElementBase<"fill">;
|
|
158
|
+
export type BreakParentIntrinsicElement = IntrinsicElementBase<"breakParent">;
|
|
159
|
+
export type LineSuffixIntrinsicElement = IntrinsicElementBase<"lineSuffix">;
|
|
160
|
+
export type LineSuffixBoundaryIntrinsicElement = IntrinsicElementBase<"lineSuffixBoundary">;
|
|
161
|
+
export type DedentIntrinsicElement = IntrinsicElementBase<"dedent">;
|
|
162
|
+
export type DedentToRootIntrinsicElement = IntrinsicElementBase<"dedentToRoot">;
|
|
163
|
+
export type MarkAsRootIntrinsicElement = IntrinsicElementBase<"markAsRoot">;
|
|
164
|
+
export type LiterallineIntrinsicElement = IntrinsicElementBase<"literalline">;
|
|
165
|
+
export type LbrIntrinsicElement = IntrinsicElementBase<"lbr">;
|
|
166
|
+
export type IfBreakIntrinsicElement = IntrinsicElementBase<"ifBreak">;
|
|
167
|
+
export type IntrinsicElement = IndentIntrinsicElement | IndentIfBreakIntrinsicElement | BrIntrinsicElement | LineIntrinsicElement | HbrIntrinsicElement | HardlineIntrinsicElement | SbrIntrinsicElement | SoftlineIntrinsicElement | GroupIntrinsicElement | AlignIntrinsicElement | FillIntrinsicElement | BreakParentIntrinsicElement | LineSuffixIntrinsicElement | LineSuffixBoundaryIntrinsicElement | DedentIntrinsicElement | LiterallineIntrinsicElement | LbrIntrinsicElement | DedentToRootIntrinsicElement | MarkAsRootIntrinsicElement | IfBreakIntrinsicElement;
|
|
168
|
+
//# sourceMappingURL=intrinsic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intrinsic.d.ts","sourceRoot":"","sources":["../../../src/runtime/intrinsic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,KAAK,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC;IAElE;;;O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ement(type) {
|
|
9
|
+
return typeof type === "object" && type !== null && intrinsicElementKey in type;
|
|
10
|
+
}
|
|
11
|
+
export const intrinsicElementKey = Symbol();
|
package/dist/src/scheduler.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ReactiveEffectRunner } from "@vue/reactivity";
|
|
|
2
2
|
export interface QueueJob {
|
|
3
3
|
(): any;
|
|
4
4
|
}
|
|
5
|
-
export declare function scheduler(jobGetter: () => ReactiveEffectRunner): () => void;
|
|
6
|
-
export declare function queueJob(job: QueueJob): void;
|
|
5
|
+
export declare function scheduler(jobGetter: () => ReactiveEffectRunner, immediate?: boolean): () => void;
|
|
6
|
+
export declare function queueJob(job: QueueJob, immediate?: boolean): void;
|
|
7
7
|
export declare function flushJobs(): void;
|
|
8
8
|
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../src/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,QAAQ;IACvB,IAAI,GAAG,CAAC;CACT;
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../src/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,QAAQ;IACvB,IAAI,GAAG,CAAC;CACT;AAID,wBAAgB,SAAS,CACvB,SAAS,EAAE,MAAM,oBAAoB,EACrC,SAAS,UAAQ,cAKlB;AACD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,UAAQ,QASxD;AAED,wBAAgB,SAAS,SAKxB"}
|
package/dist/src/scheduler.js
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
|
+
const immediateQueue = new Set();
|
|
1
2
|
const queue = new Set();
|
|
2
|
-
export function scheduler(jobGetter) {
|
|
3
|
+
export function scheduler(jobGetter, immediate = false) {
|
|
3
4
|
return () => {
|
|
4
|
-
queueJob(jobGetter());
|
|
5
|
+
queueJob(jobGetter(), immediate);
|
|
5
6
|
};
|
|
6
7
|
}
|
|
7
|
-
export function queueJob(job) {
|
|
8
|
+
export function queueJob(job, immediate = false) {
|
|
9
|
+
// if we have an immediate job, we don't need to queue the normal job.
|
|
8
10
|
// the set is serving an important purpose here in deduping the effects we run
|
|
9
11
|
// (which in effect coalesces multiple update effects together).
|
|
10
|
-
|
|
12
|
+
if (immediate) {
|
|
13
|
+
immediateQueue.add(job);
|
|
14
|
+
} else {
|
|
15
|
+
queue.add(job);
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
export function flushJobs() {
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
let job;
|
|
20
|
+
while ((job = takeJob()) !== null) {
|
|
15
21
|
job();
|
|
16
22
|
}
|
|
23
|
+
}
|
|
24
|
+
function takeJob() {
|
|
25
|
+
if (immediateQueue.size > 0) {
|
|
26
|
+
// return first item in immediateQueue
|
|
27
|
+
const job = immediateQueue.values().next().value;
|
|
28
|
+
immediateQueue.delete(job);
|
|
29
|
+
return job;
|
|
30
|
+
}
|
|
31
|
+
if (queue.size > 0) {
|
|
32
|
+
// return first item in queue
|
|
33
|
+
const job = queue.values().next().value;
|
|
34
|
+
queue.delete(job);
|
|
35
|
+
return job;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
17
38
|
}
|
package/dist/src/slot.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from "@vue/reactivity";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Children, Component, ComponentDefinition } from "./runtime/component.js";
|
|
3
|
+
import type { OutputSymbol } from "./symbols/output-symbol.js";
|
|
4
4
|
export interface SlotInstance extends ComponentDefinition {
|
|
5
5
|
}
|
|
6
6
|
export interface SlotDefinition<TSlotProps> {
|
package/dist/src/slot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,GAAG,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EACL,QAAQ,EACR,SAAS,EACT,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,YAAa,SAAQ,mBAAmB;CAAG;AAE5D,MAAM,WAAW,cAAc,CAAC,UAAU;IACxC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,CACJ,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,UAAU,EACjB,cAAc,CAAC,EAAE,QAAQ,GACxB,mBAAmB,CAAC;CACxB;AAED,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;AAInC,wBAAgB,UAAU,CACxB,UAAU,EACV,OAAO,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,CAC3D,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,GAAG,CAAC,OAAO,CAAC,GAAG,OAAO,EAC3B,MAAM,EAAE,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,CAsB7C;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,IAAI,CAAC,EAAO,CAAC;AAEnD,wBAAgB,OAAO,CAAC,CAAC,EACvB,SAAS,EAAE,MAAM,OAAO,EACxB,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,QAkB1B;AAED,wBAAgB,MAAM,CACpB,SAAS,EAAE,MAAM,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC,EAC9C,OAAO,EAAE,MAAM,QAShB"}
|
package/dist/src/slot.js
CHANGED
package/dist/src/stc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children, ComponentCreator, ComponentDefinition } from "
|
|
1
|
+
import { Children, ComponentCreator, ComponentDefinition } from "./runtime/component.js";
|
|
2
2
|
export type MakeChildrenOptional<T extends object> = T extends {
|
|
3
3
|
children?: any;
|
|
4
4
|
} ? Omit<T, "children"> & Partial<Pick<T, "children">> : T;
|
package/dist/src/stc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stc.d.ts","sourceRoot":"","sources":["../../src/stc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stc.d.ts","sourceRoot":"","sources":["../../src/stc.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,IAC/C,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,GAC1B,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,GAClD,CAAC,CAAC;AAEN,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,EAAE,IAAI,CACvC,GAAG,IAAI,EAAE,OAAO,SAAS,CAAC,GAAG,EAAE,GAC7B,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAClE,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,KAC/B,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAE5B,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IACzD,IAAI,CACF,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,aAAa,EAAE,QAAQ,EAAE,GAC3B,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,CACF,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,aAAa,EAAE,QAAQ,EAAE,GAC3B,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,CAAC,GAAG,QAAQ,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACxD,CAAC;AAEF,wBAAgB,GAAG,CAAC,CAAC,SAAS,EAAE,EAC9B,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAChC,YAAY,CAAC,CAAC,CAAC,CAyCjB"}
|
package/dist/src/sti.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Children
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Children } from "./runtime/component.js";
|
|
2
|
+
import { IntrinsicElementBase, IntrinsicElements } from "./runtime/intrinsic.js";
|
|
3
|
+
export type StiSignature<T extends keyof IntrinsicElements> = (...args: unknown extends T ? [] : {} extends Omit<IntrinsicElements[T], "children"> ? [
|
|
4
|
+
props?: IntrinsicElements[T]
|
|
5
|
+
] : [props: IntrinsicElements[T]]) => StiComponentCreator<T>;
|
|
6
|
+
export type StiComponentCreator<T extends keyof IntrinsicElements> = (() => IntrinsicElementBase<T>) & {
|
|
6
7
|
code(template: TemplateStringsArray, ...substitutions: Children[]): () => IntrinsicElementBase<T>;
|
|
7
8
|
text(template: TemplateStringsArray, ...substitutions: Children[]): () => IntrinsicElementBase<T>;
|
|
8
9
|
children(...children: Children[]): () => IntrinsicElementBase<T>;
|
|
9
10
|
};
|
|
10
|
-
export declare function sti<T extends keyof
|
|
11
|
+
export declare function sti<T extends keyof IntrinsicElements>(name: T): StiSignature<T>;
|
|
11
12
|
//# sourceMappingURL=sti.d.ts.map
|
package/dist/src/sti.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sti.d.ts","sourceRoot":"","sources":["../../src/sti.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sti.d.ts","sourceRoot":"","sources":["../../src/sti.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAEL,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,iBAAiB,IAAI,CAC5D,GAAG,IAAI,EAAE,OAAO,SAAS,CAAC,GAAG,EAAE,GAC7B,EAAE,SAAS,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GACjD;IAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC;CAAC,GAC9B,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAC5B,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAE5B,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,iBAAiB,IAC/D,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC,GAAG;IAChC,IAAI,CACF,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,aAAa,EAAE,QAAQ,EAAE,GAC3B,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,CACF,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,aAAa,EAAE,QAAQ,EAAE,GAC3B,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACjC,QAAQ,CAAC,GAAG,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC;CAClE,CAAC;AAEJ,wBAAgB,GAAG,CAAC,CAAC,SAAS,MAAM,iBAAiB,EACnD,IAAI,EAAE,CAAC,GACN,YAAY,CAAC,CAAC,CAAC,CAgCjB"}
|
package/dist/src/sti.js
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags that describe an output scope.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum OutputScopeFlags {
|
|
5
|
+
None = 0,
|
|
6
|
+
/**
|
|
7
|
+
* This scope is a static member scope.
|
|
8
|
+
*/
|
|
9
|
+
StaticMemberScope = 1,
|
|
10
|
+
/**
|
|
11
|
+
* This scope is an instance member scope.
|
|
12
|
+
*/
|
|
13
|
+
InstanceMemberScope = 2,
|
|
14
|
+
/**
|
|
15
|
+
* This scope is transient, and only exists to be merged with other scopes.
|
|
16
|
+
*/
|
|
17
|
+
Transient = 4,
|
|
18
|
+
/**
|
|
19
|
+
* This scope is a member scope. Scopes with this flag will have an `owner`
|
|
20
|
+
* property that points to the symbol whose member this scope holds.
|
|
21
|
+
*/
|
|
22
|
+
MemberScope = 3
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Flags that describe an output symbol.
|
|
26
|
+
*/
|
|
27
|
+
export declare enum OutputSymbolFlags {
|
|
28
|
+
None = 0,
|
|
29
|
+
/**
|
|
30
|
+
* The symbol is an instance member container. Symbols with this flag will have a
|
|
31
|
+
* instanceMemberScope property that contains symbols for instance members.
|
|
32
|
+
*/
|
|
33
|
+
InstanceMemberContainer = 1,
|
|
34
|
+
/**
|
|
35
|
+
* The symbol is a static member container. Symbols with this flag will have a
|
|
36
|
+
* staticMemberScope property that contains symbols for static members.
|
|
37
|
+
*/
|
|
38
|
+
StaticMemberContainer = 2,
|
|
39
|
+
/**
|
|
40
|
+
* Whether this symbol contains members of any kind.
|
|
41
|
+
*/
|
|
42
|
+
MemberContainer = 3,
|
|
43
|
+
/**
|
|
44
|
+
* Whether this symbol is an instance member of another symbol (i.e that it is
|
|
45
|
+
* stored in an instance member scope).
|
|
46
|
+
*/
|
|
47
|
+
InstanceMember = 4,
|
|
48
|
+
/**
|
|
49
|
+
* Whether this symbol is a static member of another symbol (i.e that it is
|
|
50
|
+
* stored in a static member scope).
|
|
51
|
+
*/
|
|
52
|
+
StaticMember = 8,
|
|
53
|
+
/**
|
|
54
|
+
* Transient symbols are not added to symbol tables and do not create
|
|
55
|
+
* referencable refkeys. They are used for temporary symbols that are intended
|
|
56
|
+
* to be used to calculate other symbols.
|
|
57
|
+
*/
|
|
58
|
+
Transient = 16,
|
|
59
|
+
/**
|
|
60
|
+
* This symbol aliases another symbol. Only its name, flags, and scope are
|
|
61
|
+
* stored in this symbol. Otherwise, everything else is located on the alias
|
|
62
|
+
* target.
|
|
63
|
+
*/
|
|
64
|
+
Alias = 32,
|
|
65
|
+
/**
|
|
66
|
+
* Whether this is an instance member or static member of another symbol.
|
|
67
|
+
*/
|
|
68
|
+
Member = 12
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/symbols/flags.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,IAAI,IAAI;IAER;;OAEG;IACH,iBAAiB,IAAS;IAE1B;;OAEG;IACH,mBAAmB,IAAS;IAE5B;;OAEG;IACH,SAAS,IAAS;IAElB;;;OAGG;IACH,WAAW,IAA0C;CACtD;AAED;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,IAAI,IAAI;IAER;;;OAGG;IACH,uBAAuB,IAAS;IAEhC;;;OAGG;IACH,qBAAqB,IAAS;IAE9B;;OAEG;IACH,eAAe,IAAkD;IAEjE;;;OAGG;IACH,cAAc,IAAS;IAEvB;;;OAGG;IACH,YAAY,IAAS;IAErB;;;;OAIG;IACH,SAAS,KAAS;IAElB;;;;OAIG;IACH,KAAK,KAAS;IAEd;;OAEG;IACH,MAAM,KAAgC;CACvC"}
|