@stencil/core 4.41.3 → 4.42.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/cli/index.cjs +3 -2
- package/cli/index.js +3 -2
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +527 -127
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/package.json +1 -1
- package/internal/client/index.js +25 -2
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +25 -2
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +1 -1
- package/internal/package.json +1 -1
- package/internal/stencil-ext-modules.d.ts +1 -1
- package/internal/stencil-private.d.ts +32 -0
- package/internal/stencil-public-compiler.d.ts +17 -1
- package/internal/stencil-public-docs.d.ts +26 -0
- package/internal/stencil-public-runtime.d.ts +24 -1
- package/internal/testing/index.js +24 -1
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +1 -1
- package/mock-doc/index.js +1 -1
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +27 -27
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +20 -1
- package/testing/package.json +1 -1
package/compiler/stencil.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Compiler v4.
|
|
2
|
+
Stencil Compiler v4.42.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
var __create = Object.create;
|
|
@@ -60573,7 +60573,7 @@ ${lanes.join("\n")}
|
|
|
60573
60573
|
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
60574
60574
|
return !!(symbol.flags & 111551 || symbol.flags & 2097152 && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551);
|
|
60575
60575
|
}
|
|
60576
|
-
function
|
|
60576
|
+
function createType2(flags) {
|
|
60577
60577
|
var _a2;
|
|
60578
60578
|
const result2 = new Type29(checker, flags);
|
|
60579
60579
|
typeCount++;
|
|
@@ -60582,7 +60582,7 @@ ${lanes.join("\n")}
|
|
|
60582
60582
|
return result2;
|
|
60583
60583
|
}
|
|
60584
60584
|
function createTypeWithSymbol(flags, symbol) {
|
|
60585
|
-
const result2 =
|
|
60585
|
+
const result2 = createType2(flags);
|
|
60586
60586
|
result2.symbol = symbol;
|
|
60587
60587
|
return result2;
|
|
60588
60588
|
}
|
|
@@ -60591,7 +60591,7 @@ ${lanes.join("\n")}
|
|
|
60591
60591
|
}
|
|
60592
60592
|
function createIntrinsicType(kind, intrinsicName, objectFlags = 0, debugIntrinsicName) {
|
|
60593
60593
|
checkIntrinsicName(intrinsicName, debugIntrinsicName);
|
|
60594
|
-
const type =
|
|
60594
|
+
const type = createType2(kind);
|
|
60595
60595
|
type.intrinsicName = intrinsicName;
|
|
60596
60596
|
type.debugIntrinsicName = debugIntrinsicName;
|
|
60597
60597
|
type.objectFlags = objectFlags | 524288 | 2097152 | 33554432 | 16777216;
|
|
@@ -71142,7 +71142,7 @@ ${lanes.join("\n")}
|
|
|
71142
71142
|
if (cached) {
|
|
71143
71143
|
return cached;
|
|
71144
71144
|
}
|
|
71145
|
-
const result2 =
|
|
71145
|
+
const result2 = createType2(
|
|
71146
71146
|
33554432
|
|
71147
71147
|
/* Substitution */
|
|
71148
71148
|
);
|
|
@@ -72366,7 +72366,7 @@ ${lanes.join("\n")}
|
|
|
72366
72366
|
const id = typeKey + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
72367
72367
|
let type = unionTypes.get(id);
|
|
72368
72368
|
if (!type) {
|
|
72369
|
-
type =
|
|
72369
|
+
type = createType2(
|
|
72370
72370
|
1048576
|
|
72371
72371
|
/* Union */
|
|
72372
72372
|
);
|
|
@@ -72528,7 +72528,7 @@ ${lanes.join("\n")}
|
|
|
72528
72528
|
return true;
|
|
72529
72529
|
}
|
|
72530
72530
|
function createIntersectionType(types2, objectFlags, aliasSymbol, aliasTypeArguments) {
|
|
72531
|
-
const result2 =
|
|
72531
|
+
const result2 = createType2(
|
|
72532
72532
|
2097152
|
|
72533
72533
|
/* Intersection */
|
|
72534
72534
|
);
|
|
@@ -72684,7 +72684,7 @@ ${lanes.join("\n")}
|
|
|
72684
72684
|
return links.resolvedType;
|
|
72685
72685
|
}
|
|
72686
72686
|
function createIndexType(type, indexFlags) {
|
|
72687
|
-
const result2 =
|
|
72687
|
+
const result2 = createType2(
|
|
72688
72688
|
4194304
|
|
72689
72689
|
/* Index */
|
|
72690
72690
|
);
|
|
@@ -72906,7 +72906,7 @@ ${lanes.join("\n")}
|
|
|
72906
72906
|
return type.flags & 128 ? type.value : type.flags & 256 ? "" + type.value : type.flags & 2048 ? pseudoBigIntToString(type.value) : type.flags & (512 | 98304) ? type.intrinsicName : void 0;
|
|
72907
72907
|
}
|
|
72908
72908
|
function createTemplateLiteralType(texts, types2) {
|
|
72909
|
-
const type =
|
|
72909
|
+
const type = createType2(
|
|
72910
72910
|
134217728
|
|
72911
72911
|
/* TemplateLiteral */
|
|
72912
72912
|
);
|
|
@@ -72963,7 +72963,7 @@ ${lanes.join("\n")}
|
|
|
72963
72963
|
return result2;
|
|
72964
72964
|
}
|
|
72965
72965
|
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
72966
|
-
const type =
|
|
72966
|
+
const type = createType2(
|
|
72967
72967
|
8388608
|
|
72968
72968
|
/* IndexedAccess */
|
|
72969
72969
|
);
|
|
@@ -73537,7 +73537,7 @@ ${lanes.join("\n")}
|
|
|
73537
73537
|
break;
|
|
73538
73538
|
}
|
|
73539
73539
|
}
|
|
73540
|
-
result2 =
|
|
73540
|
+
result2 = createType2(
|
|
73541
73541
|
16777216
|
|
73542
73542
|
/* Conditional */
|
|
73543
73543
|
);
|
|
@@ -245765,7 +245765,7 @@ var import_typescript72 = __toESM(require_typescript_5_8_3_bundle_cache_min());
|
|
|
245765
245765
|
|
|
245766
245766
|
// src/version.ts
|
|
245767
245767
|
init_import_meta_url();
|
|
245768
|
-
var buildId = "
|
|
245768
|
+
var buildId = "1769988906";
|
|
245769
245769
|
var minfyJsId = "terser5.37.0_7";
|
|
245770
245770
|
var optimizeCssId = "autoprefixer10.4.19_postcss8.5.6_7";
|
|
245771
245771
|
var parse5Version = "7.2.1";
|
|
@@ -245773,8 +245773,8 @@ var rollupVersion = "4.34.9";
|
|
|
245773
245773
|
var jqueryVersion = "4.0.0-pre";
|
|
245774
245774
|
var terserVersion = "5.37.0";
|
|
245775
245775
|
var typescriptVersion = "5.8.3";
|
|
245776
|
-
var vermoji = "\u{
|
|
245777
|
-
var version = "4.
|
|
245776
|
+
var vermoji = "\u{1F691}";
|
|
245777
|
+
var version = "4.42.0";
|
|
245778
245778
|
var versions = {
|
|
245779
245779
|
stencil: version,
|
|
245780
245780
|
parse5: parse5Version,
|
|
@@ -245812,6 +245812,7 @@ var DOCS_CUSTOM = "docs-custom";
|
|
|
245812
245812
|
var DOCS_JSON = "docs-json";
|
|
245813
245813
|
var DOCS_README = "docs-readme";
|
|
245814
245814
|
var DOCS_VSCODE = "docs-vscode";
|
|
245815
|
+
var DOCS_CUSTOM_ELEMENTS_MANIFEST = "docs-custom-elements-manifest";
|
|
245815
245816
|
var STATS = "stats";
|
|
245816
245817
|
var WWW = "www";
|
|
245817
245818
|
var VALID_CONFIG_OUTPUT_TARGETS = [
|
|
@@ -245827,6 +245828,7 @@ var VALID_CONFIG_OUTPUT_TARGETS = [
|
|
|
245827
245828
|
DOCS_README,
|
|
245828
245829
|
DOCS_VSCODE,
|
|
245829
245830
|
DOCS_CUSTOM,
|
|
245831
|
+
DOCS_CUSTOM_ELEMENTS_MANIFEST,
|
|
245830
245832
|
// MISC
|
|
245831
245833
|
COPY,
|
|
245832
245834
|
CUSTOM,
|
|
@@ -248210,11 +248212,12 @@ var isOutputTargetDistLazyLoader = (o) => o.type === DIST_LAZY_LOADER;
|
|
|
248210
248212
|
var isOutputTargetDistGlobalStyles = (o) => o.type === DIST_GLOBAL_STYLES;
|
|
248211
248213
|
var isOutputTargetHydrate = (o) => o.type === DIST_HYDRATE_SCRIPT;
|
|
248212
248214
|
var isOutputTargetCustom = (o) => o.type === CUSTOM;
|
|
248213
|
-
var isOutputTargetDocs = (o) => o.type === DOCS_README || o.type === DOCS_JSON || o.type === DOCS_CUSTOM || o.type === DOCS_VSCODE;
|
|
248215
|
+
var isOutputTargetDocs = (o) => o.type === DOCS_README || o.type === DOCS_JSON || o.type === DOCS_CUSTOM || o.type === DOCS_VSCODE || o.type === DOCS_CUSTOM_ELEMENTS_MANIFEST;
|
|
248214
248216
|
var isOutputTargetDocsReadme = (o) => o.type === DOCS_README;
|
|
248215
248217
|
var isOutputTargetDocsJson = (o) => o.type === DOCS_JSON;
|
|
248216
248218
|
var isOutputTargetDocsCustom = (o) => o.type === DOCS_CUSTOM;
|
|
248217
248219
|
var isOutputTargetDocsVscode = (o) => o.type === DOCS_VSCODE;
|
|
248220
|
+
var isOutputTargetDocsCustomElementsManifest = (o) => o.type === DOCS_CUSTOM_ELEMENTS_MANIFEST;
|
|
248218
248221
|
var isOutputTargetWww = (o) => o.type === WWW;
|
|
248219
248222
|
var isOutputTargetStats = (o) => o.type === STATS;
|
|
248220
248223
|
var isOutputTargetDistTypes = (o) => o.type === DIST_TYPES;
|
|
@@ -249739,92 +249742,112 @@ var HOST_REF_ARG = "hostRef";
|
|
|
249739
249742
|
|
|
249740
249743
|
// src/compiler/transformers/component-lazy/attach-internals.ts
|
|
249741
249744
|
function createLazyAttachInternalsBinding(cmp) {
|
|
249745
|
+
var _a2;
|
|
249742
249746
|
if (!(cmp == null ? void 0 : cmp.attachInternalsMemberName)) {
|
|
249743
249747
|
return [];
|
|
249744
249748
|
}
|
|
249745
|
-
|
|
249746
|
-
|
|
249747
|
-
|
|
249748
|
-
|
|
249749
|
-
|
|
249750
|
-
|
|
249751
|
-
|
|
249752
|
-
|
|
249753
|
-
|
|
249754
|
-
|
|
249755
|
-
|
|
249756
|
-
|
|
249757
|
-
|
|
249758
|
-
|
|
249759
|
-
|
|
249760
|
-
|
|
249761
|
-
|
|
249762
|
-
import_typescript4.default.factory.
|
|
249763
|
-
import_typescript4.default.factory.
|
|
249764
|
-
import_typescript4.default.factory.
|
|
249765
|
-
|
|
249766
|
-
|
|
249767
|
-
|
|
249768
|
-
|
|
249769
|
-
|
|
249770
|
-
hostRefElementInternalsPropAccess()
|
|
249771
|
-
)
|
|
249749
|
+
const statements = [
|
|
249750
|
+
import_typescript4.default.factory.createIfStatement(
|
|
249751
|
+
// the condition for the `if` statement here is just whether the
|
|
249752
|
+
// following is defined:
|
|
249753
|
+
//
|
|
249754
|
+
// ```ts
|
|
249755
|
+
// hostRef.$hostElement$["s-ei"]
|
|
249756
|
+
// ```
|
|
249757
|
+
hostRefElementInternalsPropAccess(),
|
|
249758
|
+
import_typescript4.default.factory.createBlock(
|
|
249759
|
+
[
|
|
249760
|
+
// this `ts.factory` call creates the following statement:
|
|
249761
|
+
//
|
|
249762
|
+
// ```ts
|
|
249763
|
+
// this.${ cmp.formInternalsMemberName } = hostRef.$hostElement$['s-ei'];
|
|
249764
|
+
// ```
|
|
249765
|
+
import_typescript4.default.factory.createExpressionStatement(
|
|
249766
|
+
import_typescript4.default.factory.createBinaryExpression(
|
|
249767
|
+
import_typescript4.default.factory.createPropertyAccessExpression(
|
|
249768
|
+
import_typescript4.default.factory.createThis(),
|
|
249769
|
+
// use the name set on the {@link d.ComponentCompilerMeta}
|
|
249770
|
+
import_typescript4.default.factory.createIdentifier(cmp.attachInternalsMemberName)
|
|
249771
|
+
),
|
|
249772
|
+
import_typescript4.default.factory.createToken(import_typescript4.default.SyntaxKind.EqualsToken),
|
|
249773
|
+
hostRefElementInternalsPropAccess()
|
|
249772
249774
|
)
|
|
249773
|
-
|
|
249774
|
-
|
|
249775
|
-
|
|
249776
|
-
|
|
249777
|
-
|
|
249778
|
-
|
|
249779
|
-
|
|
249780
|
-
|
|
249781
|
-
|
|
249782
|
-
|
|
249783
|
-
|
|
249784
|
-
|
|
249775
|
+
)
|
|
249776
|
+
],
|
|
249777
|
+
true
|
|
249778
|
+
),
|
|
249779
|
+
import_typescript4.default.factory.createBlock(
|
|
249780
|
+
[
|
|
249781
|
+
// this `ts.factory` call creates the following statement:
|
|
249782
|
+
//
|
|
249783
|
+
// ```ts
|
|
249784
|
+
// this.${ cmp.attachInternalsMemberName } = hostRef.$hostElement$.attachInternals();
|
|
249785
|
+
// ```
|
|
249786
|
+
import_typescript4.default.factory.createExpressionStatement(
|
|
249787
|
+
import_typescript4.default.factory.createBinaryExpression(
|
|
249788
|
+
import_typescript4.default.factory.createPropertyAccessExpression(
|
|
249789
|
+
import_typescript4.default.factory.createThis(),
|
|
249790
|
+
// use the name set on the {@link d.ComponentCompilerMeta}
|
|
249791
|
+
import_typescript4.default.factory.createIdentifier(cmp.attachInternalsMemberName)
|
|
249792
|
+
),
|
|
249793
|
+
import_typescript4.default.factory.createToken(import_typescript4.default.SyntaxKind.EqualsToken),
|
|
249794
|
+
import_typescript4.default.factory.createCallExpression(
|
|
249785
249795
|
import_typescript4.default.factory.createPropertyAccessExpression(
|
|
249786
|
-
import_typescript4.default.factory.createThis(),
|
|
249787
|
-
// use the name set on the {@link d.ComponentCompilerMeta}
|
|
249788
|
-
import_typescript4.default.factory.createIdentifier(cmp.attachInternalsMemberName)
|
|
249789
|
-
),
|
|
249790
|
-
import_typescript4.default.factory.createToken(import_typescript4.default.SyntaxKind.EqualsToken),
|
|
249791
|
-
import_typescript4.default.factory.createCallExpression(
|
|
249792
249796
|
import_typescript4.default.factory.createPropertyAccessExpression(
|
|
249793
|
-
import_typescript4.default.factory.
|
|
249794
|
-
|
|
249795
|
-
import_typescript4.default.factory.createIdentifier("$hostElement$")
|
|
249796
|
-
),
|
|
249797
|
-
import_typescript4.default.factory.createIdentifier("attachInternals")
|
|
249797
|
+
import_typescript4.default.factory.createIdentifier(HOST_REF_ARG),
|
|
249798
|
+
import_typescript4.default.factory.createIdentifier("$hostElement$")
|
|
249798
249799
|
),
|
|
249799
|
-
|
|
249800
|
-
|
|
249801
|
-
|
|
249800
|
+
import_typescript4.default.factory.createIdentifier("attachInternals")
|
|
249801
|
+
),
|
|
249802
|
+
void 0,
|
|
249803
|
+
[]
|
|
249802
249804
|
)
|
|
249803
|
-
)
|
|
249804
|
-
|
|
249805
|
-
|
|
249806
|
-
|
|
249807
|
-
|
|
249808
|
-
|
|
249809
|
-
|
|
249810
|
-
|
|
249811
|
-
|
|
249812
|
-
|
|
249813
|
-
|
|
249814
|
-
|
|
249815
|
-
|
|
249816
|
-
|
|
249817
|
-
)
|
|
249805
|
+
)
|
|
249806
|
+
),
|
|
249807
|
+
// this `ts.factory` call produces the following:
|
|
249808
|
+
//
|
|
249809
|
+
// ```ts
|
|
249810
|
+
// hostRef.$hostElement$['s-ei'] = this.${ cmp.attachInternalsMemberName };
|
|
249811
|
+
// ```
|
|
249812
|
+
import_typescript4.default.factory.createExpressionStatement(
|
|
249813
|
+
import_typescript4.default.factory.createBinaryExpression(
|
|
249814
|
+
hostRefElementInternalsPropAccess(),
|
|
249815
|
+
import_typescript4.default.factory.createToken(import_typescript4.default.SyntaxKind.EqualsToken),
|
|
249816
|
+
import_typescript4.default.factory.createPropertyAccessExpression(
|
|
249817
|
+
import_typescript4.default.factory.createThis(),
|
|
249818
|
+
// use the name set on the {@link d.ComponentCompilerMeta}
|
|
249819
|
+
import_typescript4.default.factory.createIdentifier(cmp.attachInternalsMemberName)
|
|
249818
249820
|
)
|
|
249819
249821
|
)
|
|
249820
|
-
|
|
249821
|
-
|
|
249822
|
-
|
|
249822
|
+
)
|
|
249823
|
+
],
|
|
249824
|
+
true
|
|
249823
249825
|
)
|
|
249824
|
-
|
|
249825
|
-
|
|
249826
|
-
|
|
249826
|
+
)
|
|
249827
|
+
];
|
|
249828
|
+
if (((_a2 = cmp.attachInternalsCustomStates) == null ? void 0 : _a2.length) > 0) {
|
|
249829
|
+
for (const customState of cmp.attachInternalsCustomStates) {
|
|
249830
|
+
if (customState.initialValue) {
|
|
249831
|
+
statements.push(createStatesAddCall(cmp.attachInternalsMemberName, customState.name));
|
|
249832
|
+
}
|
|
249833
|
+
}
|
|
249827
249834
|
}
|
|
249835
|
+
return statements;
|
|
249836
|
+
}
|
|
249837
|
+
function createStatesAddCall(memberName, stateName) {
|
|
249838
|
+
return import_typescript4.default.factory.createExpressionStatement(
|
|
249839
|
+
import_typescript4.default.factory.createCallExpression(
|
|
249840
|
+
import_typescript4.default.factory.createPropertyAccessExpression(
|
|
249841
|
+
import_typescript4.default.factory.createPropertyAccessExpression(
|
|
249842
|
+
import_typescript4.default.factory.createPropertyAccessExpression(import_typescript4.default.factory.createThis(), import_typescript4.default.factory.createIdentifier(memberName)),
|
|
249843
|
+
import_typescript4.default.factory.createIdentifier("states")
|
|
249844
|
+
),
|
|
249845
|
+
import_typescript4.default.factory.createIdentifier("add")
|
|
249846
|
+
),
|
|
249847
|
+
void 0,
|
|
249848
|
+
[import_typescript4.default.factory.createStringLiteral(stateName)]
|
|
249849
|
+
)
|
|
249850
|
+
);
|
|
249828
249851
|
}
|
|
249829
249852
|
function hostRefElementInternalsPropAccess() {
|
|
249830
249853
|
return import_typescript4.default.factory.createElementAccessExpression(
|
|
@@ -268035,30 +268058,53 @@ var import_typescript27 = __toESM(require_typescript_5_8_3_bundle_cache_min());
|
|
|
268035
268058
|
init_import_meta_url();
|
|
268036
268059
|
var import_typescript26 = __toESM(require_typescript_5_8_3_bundle_cache_min());
|
|
268037
268060
|
function createNativeAttachInternalsBinding(cmp) {
|
|
268038
|
-
|
|
268039
|
-
|
|
268040
|
-
|
|
268041
|
-
|
|
268061
|
+
var _a2;
|
|
268062
|
+
if (!cmp.attachInternalsMemberName) {
|
|
268063
|
+
return [];
|
|
268064
|
+
}
|
|
268065
|
+
const statements = [
|
|
268066
|
+
import_typescript26.default.factory.createExpressionStatement(
|
|
268067
|
+
import_typescript26.default.factory.createBinaryExpression(
|
|
268068
|
+
import_typescript26.default.factory.createPropertyAccessExpression(
|
|
268069
|
+
import_typescript26.default.factory.createThis(),
|
|
268070
|
+
// use the name set on the {@link d.ComponentCompilerMeta}
|
|
268071
|
+
import_typescript26.default.factory.createIdentifier(cmp.attachInternalsMemberName)
|
|
268072
|
+
),
|
|
268073
|
+
import_typescript26.default.factory.createToken(import_typescript26.default.SyntaxKind.EqualsToken),
|
|
268074
|
+
import_typescript26.default.factory.createCallExpression(
|
|
268042
268075
|
import_typescript26.default.factory.createPropertyAccessExpression(
|
|
268043
268076
|
import_typescript26.default.factory.createThis(),
|
|
268044
|
-
|
|
268045
|
-
import_typescript26.default.factory.createIdentifier(cmp.attachInternalsMemberName)
|
|
268077
|
+
import_typescript26.default.factory.createIdentifier("attachInternals")
|
|
268046
268078
|
),
|
|
268047
|
-
|
|
268048
|
-
|
|
268049
|
-
import_typescript26.default.factory.createPropertyAccessExpression(
|
|
268050
|
-
import_typescript26.default.factory.createThis(),
|
|
268051
|
-
import_typescript26.default.factory.createIdentifier("attachInternals")
|
|
268052
|
-
),
|
|
268053
|
-
void 0,
|
|
268054
|
-
[]
|
|
268055
|
-
)
|
|
268079
|
+
void 0,
|
|
268080
|
+
[]
|
|
268056
268081
|
)
|
|
268057
268082
|
)
|
|
268058
|
-
|
|
268059
|
-
|
|
268060
|
-
|
|
268083
|
+
)
|
|
268084
|
+
];
|
|
268085
|
+
if (((_a2 = cmp.attachInternalsCustomStates) == null ? void 0 : _a2.length) > 0) {
|
|
268086
|
+
for (const customState of cmp.attachInternalsCustomStates) {
|
|
268087
|
+
if (customState.initialValue) {
|
|
268088
|
+
statements.push(createStatesAddCall2(cmp.attachInternalsMemberName, customState.name));
|
|
268089
|
+
}
|
|
268090
|
+
}
|
|
268061
268091
|
}
|
|
268092
|
+
return statements;
|
|
268093
|
+
}
|
|
268094
|
+
function createStatesAddCall2(memberName, stateName) {
|
|
268095
|
+
return import_typescript26.default.factory.createExpressionStatement(
|
|
268096
|
+
import_typescript26.default.factory.createCallExpression(
|
|
268097
|
+
import_typescript26.default.factory.createPropertyAccessExpression(
|
|
268098
|
+
import_typescript26.default.factory.createPropertyAccessExpression(
|
|
268099
|
+
import_typescript26.default.factory.createPropertyAccessExpression(import_typescript26.default.factory.createThis(), import_typescript26.default.factory.createIdentifier(memberName)),
|
|
268100
|
+
import_typescript26.default.factory.createIdentifier("states")
|
|
268101
|
+
),
|
|
268102
|
+
import_typescript26.default.factory.createIdentifier("add")
|
|
268103
|
+
),
|
|
268104
|
+
void 0,
|
|
268105
|
+
[import_typescript26.default.factory.createStringLiteral(stateName)]
|
|
268106
|
+
)
|
|
268107
|
+
);
|
|
268062
268108
|
}
|
|
268063
268109
|
|
|
268064
268110
|
// src/compiler/transformers/component-native/native-constructor.ts
|
|
@@ -270016,18 +270062,19 @@ var writeHydrateOutput = async (config, compilerCtx, buildCtx, outputTarget, rol
|
|
|
270016
270062
|
const hydrateCoreIndexPath = join(hydrateAppDirPath, "index.js");
|
|
270017
270063
|
const hydrateCoreIndexPathESM = join(hydrateAppDirPath, "index.mjs");
|
|
270018
270064
|
const hydrateCoreIndexDtsFilePath = join(hydrateAppDirPath, "index.d.ts");
|
|
270019
|
-
const
|
|
270020
|
-
|
|
270021
|
-
|
|
270022
|
-
|
|
270023
|
-
|
|
270024
|
-
|
|
270025
|
-
|
|
270026
|
-
|
|
270027
|
-
|
|
270028
|
-
|
|
270029
|
-
compilerCtx.fs.writeFile(pkgJsonPath, pkgJsonCode)
|
|
270030
|
-
|
|
270065
|
+
const writeOperations = [copyHydrateRunnerDts(config, compilerCtx, hydrateAppDirPath)];
|
|
270066
|
+
if (outputTarget.generatePackageJson) {
|
|
270067
|
+
const pkgJsonPath = join(hydrateAppDirPath, "package.json");
|
|
270068
|
+
const pkgJsonCode = getHydratePackageJson(
|
|
270069
|
+
config,
|
|
270070
|
+
hydrateCoreIndexPath,
|
|
270071
|
+
hydrateCoreIndexPathESM,
|
|
270072
|
+
hydrateCoreIndexDtsFilePath,
|
|
270073
|
+
hydratePackageName
|
|
270074
|
+
);
|
|
270075
|
+
writeOperations.push(compilerCtx.fs.writeFile(pkgJsonPath, pkgJsonCode));
|
|
270076
|
+
}
|
|
270077
|
+
await Promise.all(writeOperations);
|
|
270031
270078
|
buildCtx.hydrateAppFilePath = hydrateCoreIndexPath;
|
|
270032
270079
|
const minify2 = outputTarget.minify === true;
|
|
270033
270080
|
await Promise.all(
|
|
@@ -271655,6 +271702,10 @@ var validateDocs = (config, diagnostics, userOutputs) => {
|
|
|
271655
271702
|
vscodeDocsOutputs.forEach((vscodeDocsOutput) => {
|
|
271656
271703
|
docsOutputs.push(validateVScodeDocsOutputTarget(diagnostics, vscodeDocsOutput));
|
|
271657
271704
|
});
|
|
271705
|
+
const customElementsManifestOutputs = userOutputs.filter(isOutputTargetDocsCustomElementsManifest);
|
|
271706
|
+
customElementsManifestOutputs.forEach((cemOutput) => {
|
|
271707
|
+
docsOutputs.push(validateCustomElementsManifestOutputTarget(config, cemOutput));
|
|
271708
|
+
});
|
|
271658
271709
|
return docsOutputs;
|
|
271659
271710
|
};
|
|
271660
271711
|
var validateReadmeOutputTarget = (config, outputTarget) => {
|
|
@@ -271699,6 +271750,14 @@ var validateVScodeDocsOutputTarget = (diagnostics, outputTarget) => {
|
|
|
271699
271750
|
}
|
|
271700
271751
|
return outputTarget;
|
|
271701
271752
|
};
|
|
271753
|
+
var validateCustomElementsManifestOutputTarget = (config, outputTarget) => {
|
|
271754
|
+
if (!isString(outputTarget.file)) {
|
|
271755
|
+
outputTarget.file = "custom-elements.json";
|
|
271756
|
+
}
|
|
271757
|
+
outputTarget.file = join(config.rootDir, outputTarget.file);
|
|
271758
|
+
outputTarget.strict = !!outputTarget.strict;
|
|
271759
|
+
return outputTarget;
|
|
271760
|
+
};
|
|
271702
271761
|
|
|
271703
271762
|
// src/compiler/config/outputs/validate-hydrate-script.ts
|
|
271704
271763
|
init_import_meta_url();
|
|
@@ -271738,6 +271797,9 @@ var validateHydrateScript = (config, userOutputs) => {
|
|
|
271738
271797
|
if (!isBoolean(outputTarget.minify)) {
|
|
271739
271798
|
outputTarget.minify = false;
|
|
271740
271799
|
}
|
|
271800
|
+
if (!isBoolean(outputTarget.generatePackageJson)) {
|
|
271801
|
+
outputTarget.generatePackageJson = true;
|
|
271802
|
+
}
|
|
271741
271803
|
outputTarget.external = outputTarget.external || [];
|
|
271742
271804
|
outputTarget.external.push("fs");
|
|
271743
271805
|
outputTarget.external.push("path");
|
|
@@ -273065,6 +273127,7 @@ var getDocsComponents = async (config, compilerCtx, buildCtx) => {
|
|
|
273065
273127
|
styles: getDocsStyles(cmp),
|
|
273066
273128
|
slots: getDocsSlots(cmp.docs.tags),
|
|
273067
273129
|
parts: getDocsParts(cmp.htmlParts, cmp.docs.tags),
|
|
273130
|
+
customStates: getDocsCustomStates(cmp),
|
|
273068
273131
|
listeners: getDocsListeners(cmp.listeners)
|
|
273069
273132
|
}));
|
|
273070
273133
|
})
|
|
@@ -273263,6 +273326,19 @@ var getDocsParts = (vdom, tags) => {
|
|
|
273263
273326
|
(p) => p.name
|
|
273264
273327
|
);
|
|
273265
273328
|
};
|
|
273329
|
+
var getDocsCustomStates = (cmpMeta) => {
|
|
273330
|
+
if (!cmpMeta.attachInternalsCustomStates || cmpMeta.attachInternalsCustomStates.length === 0) {
|
|
273331
|
+
return [];
|
|
273332
|
+
}
|
|
273333
|
+
return sortBy(
|
|
273334
|
+
cmpMeta.attachInternalsCustomStates.map((state) => ({
|
|
273335
|
+
name: state.name,
|
|
273336
|
+
initialValue: state.initialValue,
|
|
273337
|
+
docs: state.docs || ""
|
|
273338
|
+
})),
|
|
273339
|
+
(state) => state.name
|
|
273340
|
+
);
|
|
273341
|
+
};
|
|
273266
273342
|
var getNameText = (name, tags) => {
|
|
273267
273343
|
return tags.filter((tag) => tag.name === name && tag.text).map(({ text }) => {
|
|
273268
273344
|
const [namePart, ...rest] = (" " + text).split(" - ");
|
|
@@ -273375,6 +273451,190 @@ var generateCustomDocs = async (config, docsData, outputTargets) => {
|
|
|
273375
273451
|
);
|
|
273376
273452
|
};
|
|
273377
273453
|
|
|
273454
|
+
// src/compiler/docs/cem/index.ts
|
|
273455
|
+
init_import_meta_url();
|
|
273456
|
+
var generateCustomElementsManifestDocs = async (compilerCtx, docsData, outputTargets) => {
|
|
273457
|
+
const cemOutputTargets = outputTargets.filter(isOutputTargetDocsCustomElementsManifest);
|
|
273458
|
+
if (cemOutputTargets.length === 0) {
|
|
273459
|
+
return;
|
|
273460
|
+
}
|
|
273461
|
+
const manifest = generateManifest(docsData);
|
|
273462
|
+
const jsonContent = JSON.stringify(manifest, null, 2);
|
|
273463
|
+
await Promise.all(cemOutputTargets.map((outputTarget) => compilerCtx.fs.writeFile(outputTarget.file, jsonContent)));
|
|
273464
|
+
};
|
|
273465
|
+
var generateManifest = (docsData) => {
|
|
273466
|
+
const componentsByFile = /* @__PURE__ */ new Map();
|
|
273467
|
+
for (const component of docsData.components) {
|
|
273468
|
+
const filePath = component.filePath;
|
|
273469
|
+
if (!componentsByFile.has(filePath)) {
|
|
273470
|
+
componentsByFile.set(filePath, []);
|
|
273471
|
+
}
|
|
273472
|
+
componentsByFile.get(filePath).push(component);
|
|
273473
|
+
}
|
|
273474
|
+
const modules = [];
|
|
273475
|
+
for (const [filePath, components] of componentsByFile) {
|
|
273476
|
+
const declarations = components.map((component) => componentToDeclaration(component));
|
|
273477
|
+
const exports2 = components.flatMap((component) => {
|
|
273478
|
+
const className = dashToPascalCase(component.tag);
|
|
273479
|
+
return [
|
|
273480
|
+
{
|
|
273481
|
+
kind: "js",
|
|
273482
|
+
name: className,
|
|
273483
|
+
declaration: {
|
|
273484
|
+
name: className
|
|
273485
|
+
}
|
|
273486
|
+
},
|
|
273487
|
+
{
|
|
273488
|
+
kind: "custom-element-definition",
|
|
273489
|
+
name: component.tag,
|
|
273490
|
+
declaration: {
|
|
273491
|
+
name: className
|
|
273492
|
+
}
|
|
273493
|
+
}
|
|
273494
|
+
];
|
|
273495
|
+
});
|
|
273496
|
+
modules.push({
|
|
273497
|
+
kind: "javascript-module",
|
|
273498
|
+
path: filePath,
|
|
273499
|
+
declarations,
|
|
273500
|
+
exports: exports2
|
|
273501
|
+
});
|
|
273502
|
+
}
|
|
273503
|
+
return {
|
|
273504
|
+
schemaVersion: "2.1.0",
|
|
273505
|
+
modules
|
|
273506
|
+
};
|
|
273507
|
+
};
|
|
273508
|
+
var convertTypeReferences = (references) => {
|
|
273509
|
+
if (!references || Object.keys(references).length === 0) {
|
|
273510
|
+
return void 0;
|
|
273511
|
+
}
|
|
273512
|
+
return Object.entries(references).map(([name, ref]) => ({
|
|
273513
|
+
name,
|
|
273514
|
+
// Global types (like HTMLElement, Array) get 'global:' package
|
|
273515
|
+
...ref.location === "global" && { package: "global:" },
|
|
273516
|
+
// Imported types get their module path
|
|
273517
|
+
...ref.location === "import" && ref.path && { module: ref.path }
|
|
273518
|
+
// Local types don't need package or module (they're in the same module)
|
|
273519
|
+
}));
|
|
273520
|
+
};
|
|
273521
|
+
var createType = (text, references) => {
|
|
273522
|
+
const typeRefs = convertTypeReferences(references);
|
|
273523
|
+
return {
|
|
273524
|
+
text,
|
|
273525
|
+
...typeRefs && { references: typeRefs }
|
|
273526
|
+
};
|
|
273527
|
+
};
|
|
273528
|
+
var componentToDeclaration = (component) => {
|
|
273529
|
+
const className = dashToPascalCase(component.tag);
|
|
273530
|
+
const attributes = component.props.filter((prop) => prop.attr !== void 0).map((prop) => {
|
|
273531
|
+
var _a2;
|
|
273532
|
+
return {
|
|
273533
|
+
name: prop.attr,
|
|
273534
|
+
...prop.docs && { description: prop.docs },
|
|
273535
|
+
...prop.type && { type: createType(prop.type, (_a2 = prop.complexType) == null ? void 0 : _a2.references) },
|
|
273536
|
+
...prop.default !== void 0 && { default: prop.default },
|
|
273537
|
+
fieldName: prop.name,
|
|
273538
|
+
...prop.deprecation !== void 0 && { deprecated: prop.deprecation || true }
|
|
273539
|
+
};
|
|
273540
|
+
});
|
|
273541
|
+
const members = [
|
|
273542
|
+
// Fields (properties)
|
|
273543
|
+
...component.props.map(
|
|
273544
|
+
(prop) => {
|
|
273545
|
+
var _a2;
|
|
273546
|
+
return {
|
|
273547
|
+
kind: "field",
|
|
273548
|
+
name: prop.name,
|
|
273549
|
+
...prop.docs && { description: prop.docs },
|
|
273550
|
+
...prop.type && { type: createType(prop.type, (_a2 = prop.complexType) == null ? void 0 : _a2.references) },
|
|
273551
|
+
...prop.default !== void 0 && { default: prop.default },
|
|
273552
|
+
...prop.deprecation !== void 0 && { deprecated: prop.deprecation || true },
|
|
273553
|
+
...!prop.mutable && { readonly: true },
|
|
273554
|
+
...prop.attr && { attribute: prop.attr },
|
|
273555
|
+
...prop.reflectToAttr && { reflects: true }
|
|
273556
|
+
};
|
|
273557
|
+
}
|
|
273558
|
+
),
|
|
273559
|
+
// Methods
|
|
273560
|
+
...component.methods.map(
|
|
273561
|
+
(method) => {
|
|
273562
|
+
var _a2;
|
|
273563
|
+
return {
|
|
273564
|
+
kind: "method",
|
|
273565
|
+
name: method.name,
|
|
273566
|
+
...method.docs && { description: method.docs },
|
|
273567
|
+
...method.deprecation !== void 0 && { deprecated: method.deprecation || true },
|
|
273568
|
+
...method.parameters && method.parameters.length > 0 && {
|
|
273569
|
+
parameters: method.parameters.map((param) => {
|
|
273570
|
+
var _a3;
|
|
273571
|
+
return {
|
|
273572
|
+
name: param.name,
|
|
273573
|
+
...param.docs && { description: param.docs },
|
|
273574
|
+
...param.type && { type: createType(param.type, (_a3 = method.complexType) == null ? void 0 : _a3.references) }
|
|
273575
|
+
};
|
|
273576
|
+
})
|
|
273577
|
+
},
|
|
273578
|
+
...method.returns && {
|
|
273579
|
+
return: {
|
|
273580
|
+
...method.returns.type && { type: createType(method.returns.type, (_a2 = method.complexType) == null ? void 0 : _a2.references) },
|
|
273581
|
+
...method.returns.docs && { description: method.returns.docs }
|
|
273582
|
+
}
|
|
273583
|
+
}
|
|
273584
|
+
};
|
|
273585
|
+
}
|
|
273586
|
+
)
|
|
273587
|
+
];
|
|
273588
|
+
const events = component.events.map((event) => {
|
|
273589
|
+
var _a2;
|
|
273590
|
+
return {
|
|
273591
|
+
name: event.event,
|
|
273592
|
+
...event.docs && { description: event.docs },
|
|
273593
|
+
type: createType(event.detail ? `CustomEvent<${event.detail}>` : "CustomEvent", (_a2 = event.complexType) == null ? void 0 : _a2.references),
|
|
273594
|
+
...event.deprecation !== void 0 && { deprecated: event.deprecation || true }
|
|
273595
|
+
};
|
|
273596
|
+
});
|
|
273597
|
+
const slots = component.slots.map((slot) => ({
|
|
273598
|
+
name: slot.name,
|
|
273599
|
+
...slot.docs && { description: slot.docs }
|
|
273600
|
+
}));
|
|
273601
|
+
const cssParts = component.parts.map((part) => ({
|
|
273602
|
+
name: part.name,
|
|
273603
|
+
...part.docs && { description: part.docs }
|
|
273604
|
+
}));
|
|
273605
|
+
const cssProperties = component.styles.filter((style) => style.annotation === "prop").map((style) => ({
|
|
273606
|
+
name: style.name,
|
|
273607
|
+
...style.docs && { description: style.docs }
|
|
273608
|
+
}));
|
|
273609
|
+
const demos = Object.entries(component.usage || {}).map(([name, content]) => ({
|
|
273610
|
+
// Create relative URL from usagesDir + filename
|
|
273611
|
+
url: component.usagesDir ? `${component.usagesDir}/${name}.md` : `${name}.md`,
|
|
273612
|
+
...content && { description: content }
|
|
273613
|
+
}));
|
|
273614
|
+
return {
|
|
273615
|
+
kind: "class",
|
|
273616
|
+
customElement: true,
|
|
273617
|
+
tagName: component.tag,
|
|
273618
|
+
name: className,
|
|
273619
|
+
...component.docs && { description: component.docs },
|
|
273620
|
+
...component.deprecation !== void 0 && { deprecated: component.deprecation || true },
|
|
273621
|
+
...attributes.length > 0 && { attributes },
|
|
273622
|
+
...members.length > 0 && { members },
|
|
273623
|
+
...events.length > 0 && { events },
|
|
273624
|
+
...slots.length > 0 && { slots },
|
|
273625
|
+
...cssParts.length > 0 && { cssParts },
|
|
273626
|
+
...cssProperties.length > 0 && { cssProperties },
|
|
273627
|
+
...component.customStates.length > 0 && {
|
|
273628
|
+
customStates: component.customStates.map((state) => ({
|
|
273629
|
+
name: state.name,
|
|
273630
|
+
initialValue: state.initialValue,
|
|
273631
|
+
...state.docs && { description: state.docs }
|
|
273632
|
+
}))
|
|
273633
|
+
},
|
|
273634
|
+
...demos.length > 0 && { demos }
|
|
273635
|
+
};
|
|
273636
|
+
};
|
|
273637
|
+
|
|
273378
273638
|
// src/compiler/docs/json/index.ts
|
|
273379
273639
|
init_import_meta_url();
|
|
273380
273640
|
var generateJsonDocs = async (config, compilerCtx, docsData, outputTargets) => {
|
|
@@ -273411,6 +273671,7 @@ export default _default;
|
|
|
273411
273671
|
styles: cmp.styles,
|
|
273412
273672
|
slots: cmp.slots,
|
|
273413
273673
|
parts: cmp.parts,
|
|
273674
|
+
states: cmp.customStates,
|
|
273414
273675
|
dependents: cmp.dependents,
|
|
273415
273676
|
dependencies: cmp.dependencies,
|
|
273416
273677
|
dependencyGraph: cmp.dependencyGraph,
|
|
@@ -273457,6 +273718,26 @@ var stylesToMarkdown = (styles2) => {
|
|
|
273457
273718
|
return content;
|
|
273458
273719
|
};
|
|
273459
273720
|
|
|
273721
|
+
// src/compiler/docs/readme/markdown-custom-states.ts
|
|
273722
|
+
init_import_meta_url();
|
|
273723
|
+
var customStatesToMarkdown = (customStates) => {
|
|
273724
|
+
const content = [];
|
|
273725
|
+
if (customStates.length === 0) {
|
|
273726
|
+
return content;
|
|
273727
|
+
}
|
|
273728
|
+
content.push(`## Custom States`);
|
|
273729
|
+
content.push(``);
|
|
273730
|
+
const table = new MarkdownTable();
|
|
273731
|
+
table.addHeader(["State", "Initial Value", "Description"]);
|
|
273732
|
+
customStates.forEach((state) => {
|
|
273733
|
+
table.addRow([`\`:state(${state.name})\``, state.initialValue ? "`true`" : "`false`", state.docs]);
|
|
273734
|
+
});
|
|
273735
|
+
content.push(...table.toMarkdown());
|
|
273736
|
+
content.push(``);
|
|
273737
|
+
content.push(``);
|
|
273738
|
+
return content;
|
|
273739
|
+
};
|
|
273740
|
+
|
|
273460
273741
|
// src/compiler/docs/readme/markdown-dependencies.ts
|
|
273461
273742
|
init_import_meta_url();
|
|
273462
273743
|
var depsToMarkdown = (cmp, cmps, config) => {
|
|
@@ -273757,6 +274038,7 @@ var generateMarkdown = (userContent, cmp, cmps, readmeOutput, config) => {
|
|
|
273757
274038
|
...methodsToMarkdown(cmp.methods),
|
|
273758
274039
|
...slotsToMarkdown(cmp.slots),
|
|
273759
274040
|
...partsToMarkdown(cmp.parts),
|
|
274041
|
+
...customStatesToMarkdown(cmp.customStates),
|
|
273760
274042
|
...stylesToMarkdown(cmp.styles),
|
|
273761
274043
|
...dependencies,
|
|
273762
274044
|
`----------------------------------------------`,
|
|
@@ -273883,7 +274165,7 @@ var outputDocs = async (config, compilerCtx, buildCtx) => {
|
|
|
273883
274165
|
return;
|
|
273884
274166
|
}
|
|
273885
274167
|
const docsOutputTargets = config.outputTargets.filter(
|
|
273886
|
-
(o) => isOutputTargetDocsReadme(o) || isOutputTargetDocsJson(o) || isOutputTargetDocsCustom(o) || isOutputTargetDocsVscode(o)
|
|
274168
|
+
(o) => isOutputTargetDocsReadme(o) || isOutputTargetDocsJson(o) || isOutputTargetDocsCustom(o) || isOutputTargetDocsVscode(o) || isOutputTargetDocsCustomElementsManifest(o)
|
|
273887
274169
|
);
|
|
273888
274170
|
if (docsOutputTargets.length === 0) {
|
|
273889
274171
|
return;
|
|
@@ -273894,7 +274176,8 @@ var outputDocs = async (config, compilerCtx, buildCtx) => {
|
|
|
273894
274176
|
generateReadmeDocs(config, compilerCtx, docsData, docsOutputTargets),
|
|
273895
274177
|
generateJsonDocs(config, compilerCtx, docsData, docsOutputTargets),
|
|
273896
274178
|
generateVscodeDocs(compilerCtx, docsData, docsOutputTargets),
|
|
273897
|
-
generateCustomDocs(config, docsData, docsOutputTargets)
|
|
274179
|
+
generateCustomDocs(config, docsData, docsOutputTargets),
|
|
274180
|
+
generateCustomElementsManifestDocs(compilerCtx, docsData, docsOutputTargets)
|
|
273898
274181
|
]);
|
|
273899
274182
|
};
|
|
273900
274183
|
|
|
@@ -274477,6 +274760,22 @@ var generateComponentTypes = (cmp, typeImportData, areTypesInternal) => {
|
|
|
274477
274760
|
` new (): ${htmlElementName};`,
|
|
274478
274761
|
` };`
|
|
274479
274762
|
];
|
|
274763
|
+
const propsWithAttributes = cmp.properties.filter((prop) => prop.attribute !== void 0);
|
|
274764
|
+
const hasExplicitAttributes = propsWithAttributes.length > 0;
|
|
274765
|
+
const requiredProps = propsWithAttributes.filter((prop) => prop.required);
|
|
274766
|
+
const hasRequiredProps = requiredProps.length > 0;
|
|
274767
|
+
const explicitAttributes = propsWithAttributes.map((prop) => {
|
|
274768
|
+
var _a2, _b;
|
|
274769
|
+
const propMeta = cmp.properties.find((p) => p.name === prop.name);
|
|
274770
|
+
const simpleType = (_a2 = propMeta == null ? void 0 : propMeta.type) == null ? void 0 : _a2.trim();
|
|
274771
|
+
let attrType;
|
|
274772
|
+
if (simpleType && ["string", "number", "boolean"].includes(simpleType)) {
|
|
274773
|
+
attrType = ((_b = propMeta == null ? void 0 : propMeta.complexType) == null ? void 0 : _b.original) || simpleType;
|
|
274774
|
+
} else {
|
|
274775
|
+
attrType = "string";
|
|
274776
|
+
}
|
|
274777
|
+
return ` "${prop.name}": ${attrType};`;
|
|
274778
|
+
}).join("\n");
|
|
274480
274779
|
return {
|
|
274481
274780
|
isDep,
|
|
274482
274781
|
tagName,
|
|
@@ -274487,7 +274786,16 @@ ${componentAttributes} }`, cmp.docs, 4),
|
|
|
274487
274786
|
jsx: ` interface ${tagNameAsPascal} {
|
|
274488
274787
|
${jsxAttributes} }`,
|
|
274489
274788
|
element: element.join(`
|
|
274490
|
-
`)
|
|
274789
|
+
`),
|
|
274790
|
+
explicitAttributes: hasExplicitAttributes ? ` interface ${tagNameAsPascal}Attributes {
|
|
274791
|
+
${explicitAttributes}
|
|
274792
|
+
}` : null,
|
|
274793
|
+
explicitProperties: null,
|
|
274794
|
+
requiredProps: hasRequiredProps ? requiredProps.map((p) => ({
|
|
274795
|
+
name: p.name,
|
|
274796
|
+
type: p.type,
|
|
274797
|
+
complexType: p.complexType
|
|
274798
|
+
})) : null
|
|
274491
274799
|
};
|
|
274492
274800
|
};
|
|
274493
274801
|
function generateStandardElementInterface(htmlElementName, tagNameAsPascal, htmlElementEventListenerProperties, docs) {
|
|
@@ -274563,7 +274871,10 @@ var generateEventDetailTypes = (cmp) => {
|
|
|
274563
274871
|
htmlElementName,
|
|
274564
274872
|
component: cmpInterface.join("\n"),
|
|
274565
274873
|
jsx: cmpInterface.join("\n"),
|
|
274566
|
-
element: cmpInterface.join("\n")
|
|
274874
|
+
element: cmpInterface.join("\n"),
|
|
274875
|
+
explicitAttributes: null,
|
|
274876
|
+
explicitProperties: null,
|
|
274877
|
+
requiredProps: null
|
|
274567
274878
|
};
|
|
274568
274879
|
};
|
|
274569
274880
|
|
|
@@ -274752,14 +275063,43 @@ var generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
|
274752
275063
|
c.push(` }`);
|
|
274753
275064
|
c.push(`}`);
|
|
274754
275065
|
c.push(`declare namespace LocalJSX {`);
|
|
275066
|
+
const hasAnyRequiredProps = modules.some((m) => m.requiredProps);
|
|
275067
|
+
if (hasAnyRequiredProps) {
|
|
275068
|
+
c.push(
|
|
275069
|
+
` type OneOf<K extends string, T> = { [P in K]: T } | { [P in \`attr:\${K}\`]: T } | { [P in \`prop:\${K}\`]: T };`
|
|
275070
|
+
);
|
|
275071
|
+
c.push(``);
|
|
275072
|
+
}
|
|
274755
275073
|
c.push(
|
|
274756
275074
|
...modules.map((m) => {
|
|
274757
275075
|
const docs = components.find((c2) => c2.tagName === m.tagName).docs;
|
|
274758
275076
|
return addDocBlock(m.jsx, docs, 4);
|
|
274759
275077
|
})
|
|
274760
275078
|
);
|
|
275079
|
+
const attributeInterfaces = modules.filter((m) => m.explicitAttributes).map((m) => m.explicitAttributes);
|
|
275080
|
+
if (attributeInterfaces.length > 0) {
|
|
275081
|
+
c.push(``);
|
|
275082
|
+
c.push(...attributeInterfaces);
|
|
275083
|
+
c.push(``);
|
|
275084
|
+
}
|
|
274761
275085
|
c.push(` interface IntrinsicElements {`);
|
|
274762
|
-
c.push(
|
|
275086
|
+
c.push(
|
|
275087
|
+
...modules.map((m) => {
|
|
275088
|
+
if (m.explicitAttributes) {
|
|
275089
|
+
const baseOptional = `Omit<${m.tagNameAsPascal}, keyof ${m.tagNameAsPascal}Attributes> & { [K in keyof ${m.tagNameAsPascal} & keyof ${m.tagNameAsPascal}Attributes]?: ${m.tagNameAsPascal}[K] } & { [K in keyof ${m.tagNameAsPascal} & keyof ${m.tagNameAsPascal}Attributes as \`attr:\${K}\`]?: ${m.tagNameAsPascal}Attributes[K] } & { [K in keyof ${m.tagNameAsPascal} & keyof ${m.tagNameAsPascal}Attributes as \`prop:\${K}\`]?: ${m.tagNameAsPascal}[K] }`;
|
|
275090
|
+
if (m.requiredProps && m.requiredProps.length > 0) {
|
|
275091
|
+
const requiredUnions = m.requiredProps.map((prop) => {
|
|
275092
|
+
return `OneOf<"${prop.name}", ${m.tagNameAsPascal}["${prop.name}"]>`;
|
|
275093
|
+
}).join(" & ");
|
|
275094
|
+
return ` "${m.tagName}": ${baseOptional} & ${requiredUnions};`;
|
|
275095
|
+
} else {
|
|
275096
|
+
return ` "${m.tagName}": ${baseOptional};`;
|
|
275097
|
+
}
|
|
275098
|
+
} else {
|
|
275099
|
+
return ` "${m.tagName}": ${m.tagNameAsPascal};`;
|
|
275100
|
+
}
|
|
275101
|
+
})
|
|
275102
|
+
);
|
|
274763
275103
|
c.push(` }`);
|
|
274764
275104
|
c.push(`}`);
|
|
274765
275105
|
c.push(`export { LocalJSX as JSX };`);
|
|
@@ -274770,7 +275110,7 @@ var generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
|
274770
275110
|
...modules.map((m) => {
|
|
274771
275111
|
const docs = components.find((c2) => c2.tagName === m.tagName).docs;
|
|
274772
275112
|
return addDocBlock(
|
|
274773
|
-
` "${m.tagName}": LocalJSX
|
|
275113
|
+
` "${m.tagName}": LocalJSX.IntrinsicElements["${m.tagName}"] & JSXBase.HTMLAttributes<${m.htmlElementName}>;`,
|
|
274774
275114
|
docs,
|
|
274775
275115
|
12
|
|
274776
275116
|
);
|
|
@@ -275953,9 +276293,10 @@ var isDecoratorNamed = (propName) => {
|
|
|
275953
276293
|
|
|
275954
276294
|
// src/compiler/transformers/decorators-to-static/attach-internals.ts
|
|
275955
276295
|
var attachInternalsDecoratorsToStatic = (diagnostics, decoratedMembers, newMembers, typeChecker, decoratorName) => {
|
|
276296
|
+
var _a2;
|
|
275956
276297
|
const attachInternalsMembers = decoratedMembers.filter(import_typescript44.default.isPropertyDeclaration).filter((prop) => {
|
|
275957
|
-
var
|
|
275958
|
-
return !!((
|
|
276298
|
+
var _a3;
|
|
276299
|
+
return !!((_a3 = retrieveTsDecorators(prop)) == null ? void 0 : _a3.find(isDecoratorNamed(decoratorName)));
|
|
275959
276300
|
});
|
|
275960
276301
|
if (attachInternalsMembers.length === 0) {
|
|
275961
276302
|
return;
|
|
@@ -275967,8 +276308,52 @@ var attachInternalsDecoratorsToStatic = (diagnostics, decoratedMembers, newMembe
|
|
|
275967
276308
|
}
|
|
275968
276309
|
const [decoratedProp] = attachInternalsMembers;
|
|
275969
276310
|
const { staticName: name } = tsPropDeclName(decoratedProp, typeChecker);
|
|
276311
|
+
const decorator3 = (_a2 = retrieveTsDecorators(decoratedProp)) == null ? void 0 : _a2.find(isDecoratorNamed(decoratorName));
|
|
276312
|
+
const customStates = parseCustomStatesFromDecorator(decorator3, typeChecker);
|
|
275970
276313
|
newMembers.push(createStaticGetter("attachInternalsMemberName", convertValueToLiteral(name)));
|
|
276314
|
+
if (customStates.length > 0) {
|
|
276315
|
+
newMembers.push(createStaticGetter("attachInternalsCustomStates", convertValueToLiteral(customStates)));
|
|
276316
|
+
}
|
|
275971
276317
|
};
|
|
276318
|
+
function parseCustomStatesFromDecorator(decorator3, typeChecker) {
|
|
276319
|
+
if (!decorator3 || !import_typescript44.default.isCallExpression(decorator3.expression)) {
|
|
276320
|
+
return [];
|
|
276321
|
+
}
|
|
276322
|
+
const [firstArg] = decorator3.expression.arguments;
|
|
276323
|
+
if (!firstArg || !import_typescript44.default.isObjectLiteralExpression(firstArg)) {
|
|
276324
|
+
return [];
|
|
276325
|
+
}
|
|
276326
|
+
const statesProp = firstArg.properties.find(
|
|
276327
|
+
(prop) => import_typescript44.default.isPropertyAssignment(prop) && import_typescript44.default.isIdentifier(prop.name) && prop.name.text === "states"
|
|
276328
|
+
);
|
|
276329
|
+
if (!statesProp || !import_typescript44.default.isObjectLiteralExpression(statesProp.initializer)) {
|
|
276330
|
+
return [];
|
|
276331
|
+
}
|
|
276332
|
+
const customStates = [];
|
|
276333
|
+
for (const prop of statesProp.initializer.properties) {
|
|
276334
|
+
if (!import_typescript44.default.isPropertyAssignment(prop)) {
|
|
276335
|
+
continue;
|
|
276336
|
+
}
|
|
276337
|
+
const stateName = import_typescript44.default.isIdentifier(prop.name) ? prop.name.text : import_typescript44.default.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
276338
|
+
if (!stateName) {
|
|
276339
|
+
continue;
|
|
276340
|
+
}
|
|
276341
|
+
let initialValue = false;
|
|
276342
|
+
if (prop.initializer.kind === import_typescript44.default.SyntaxKind.TrueKeyword) {
|
|
276343
|
+
initialValue = true;
|
|
276344
|
+
} else if (prop.initializer.kind === import_typescript44.default.SyntaxKind.FalseKeyword) {
|
|
276345
|
+
initialValue = false;
|
|
276346
|
+
}
|
|
276347
|
+
const symbol = typeChecker.getSymbolAtLocation(prop.name);
|
|
276348
|
+
const docs = symbol ? import_typescript44.default.displayPartsToString(symbol.getDocumentationComment(typeChecker)) : "";
|
|
276349
|
+
customStates.push({
|
|
276350
|
+
name: stateName,
|
|
276351
|
+
initialValue,
|
|
276352
|
+
docs
|
|
276353
|
+
});
|
|
276354
|
+
}
|
|
276355
|
+
return customStates;
|
|
276356
|
+
}
|
|
275972
276357
|
|
|
275973
276358
|
// src/compiler/transformers/decorators-to-static/component-decorator.ts
|
|
275974
276359
|
init_import_meta_url();
|
|
@@ -277771,6 +278156,20 @@ var parseAttachInternals = (staticMembers) => {
|
|
|
277771
278156
|
return null;
|
|
277772
278157
|
}
|
|
277773
278158
|
};
|
|
278159
|
+
var parseAttachInternalsCustomStates = (staticMembers) => {
|
|
278160
|
+
const parsedCustomStates = getStaticValue(staticMembers, "attachInternalsCustomStates");
|
|
278161
|
+
if (Array.isArray(parsedCustomStates)) {
|
|
278162
|
+
return parsedCustomStates.map((state) => {
|
|
278163
|
+
var _a2;
|
|
278164
|
+
return {
|
|
278165
|
+
name: String(state.name),
|
|
278166
|
+
initialValue: Boolean(state.initialValue),
|
|
278167
|
+
docs: (_a2 = state.docs) != null ? _a2 : ""
|
|
278168
|
+
};
|
|
278169
|
+
});
|
|
278170
|
+
}
|
|
278171
|
+
return [];
|
|
278172
|
+
};
|
|
277774
278173
|
|
|
277775
278174
|
// src/compiler/transformers/static-to-meta/class-methods.ts
|
|
277776
278175
|
init_import_meta_url();
|
|
@@ -278431,6 +278830,7 @@ var parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile, b
|
|
|
278431
278830
|
const encapsulation = parseStaticEncapsulation(staticMembers);
|
|
278432
278831
|
const cmp = {
|
|
278433
278832
|
attachInternalsMemberName: parseAttachInternals(staticMembers),
|
|
278833
|
+
attachInternalsCustomStates: parseAttachInternalsCustomStates(staticMembers),
|
|
278434
278834
|
formAssociated: parseFormAssociated(staticMembers),
|
|
278435
278835
|
tagName,
|
|
278436
278836
|
excludeFromCollection: moduleFile.excludeFromCollection,
|