@stencil/core 4.41.3-dev.1769664017.f2dbed7 → 4.41.3-dev.1769975738.ddc7508
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 +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +307 -103
- 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 +18 -1
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +18 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +1 -1
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +32 -0
- package/internal/stencil-public-compiler.d.ts +6 -6
- package/internal/stencil-public-docs.d.ts +26 -0
- package/internal/stencil-public-runtime.d.ts +20 -1
- package/internal/testing/index.js +17 -0
- 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 +30 -30
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +2 -1
- package/testing/package.json +1 -1
package/cli/index.cjs
CHANGED
package/cli/index.js
CHANGED
package/cli/package.json
CHANGED
package/compiler/package.json
CHANGED
package/compiler/stencil.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Compiler v4.41.3-dev.
|
|
2
|
+
Stencil Compiler v4.41.3-dev.1769975738.ddc7508 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
var __create = Object.create;
|
|
@@ -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 = "1769975738";
|
|
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.41.3-dev.
|
|
245776
|
+
var vermoji = "\u{1F336}";
|
|
245777
|
+
var version = "4.41.3-dev.1769975738.ddc7508";
|
|
245778
245778
|
var versions = {
|
|
245779
245779
|
stencil: version,
|
|
245780
245780
|
parse5: parse5Version,
|
|
@@ -249742,92 +249742,112 @@ var HOST_REF_ARG = "hostRef";
|
|
|
249742
249742
|
|
|
249743
249743
|
// src/compiler/transformers/component-lazy/attach-internals.ts
|
|
249744
249744
|
function createLazyAttachInternalsBinding(cmp) {
|
|
249745
|
+
var _a2;
|
|
249745
249746
|
if (!(cmp == null ? void 0 : cmp.attachInternalsMemberName)) {
|
|
249746
249747
|
return [];
|
|
249747
249748
|
}
|
|
249748
|
-
|
|
249749
|
-
|
|
249750
|
-
|
|
249751
|
-
|
|
249752
|
-
|
|
249753
|
-
|
|
249754
|
-
|
|
249755
|
-
|
|
249756
|
-
|
|
249757
|
-
|
|
249758
|
-
|
|
249759
|
-
|
|
249760
|
-
|
|
249761
|
-
|
|
249762
|
-
|
|
249763
|
-
|
|
249764
|
-
|
|
249765
|
-
import_typescript4.default.factory.
|
|
249766
|
-
import_typescript4.default.factory.
|
|
249767
|
-
import_typescript4.default.factory.
|
|
249768
|
-
|
|
249769
|
-
|
|
249770
|
-
|
|
249771
|
-
|
|
249772
|
-
|
|
249773
|
-
hostRefElementInternalsPropAccess()
|
|
249774
|
-
)
|
|
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()
|
|
249775
249774
|
)
|
|
249776
|
-
|
|
249777
|
-
|
|
249778
|
-
|
|
249779
|
-
|
|
249780
|
-
|
|
249781
|
-
|
|
249782
|
-
|
|
249783
|
-
|
|
249784
|
-
|
|
249785
|
-
|
|
249786
|
-
|
|
249787
|
-
|
|
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(
|
|
249788
249795
|
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(
|
|
249795
249796
|
import_typescript4.default.factory.createPropertyAccessExpression(
|
|
249796
|
-
import_typescript4.default.factory.
|
|
249797
|
-
|
|
249798
|
-
import_typescript4.default.factory.createIdentifier("$hostElement$")
|
|
249799
|
-
),
|
|
249800
|
-
import_typescript4.default.factory.createIdentifier("attachInternals")
|
|
249797
|
+
import_typescript4.default.factory.createIdentifier(HOST_REF_ARG),
|
|
249798
|
+
import_typescript4.default.factory.createIdentifier("$hostElement$")
|
|
249801
249799
|
),
|
|
249802
|
-
|
|
249803
|
-
|
|
249804
|
-
|
|
249800
|
+
import_typescript4.default.factory.createIdentifier("attachInternals")
|
|
249801
|
+
),
|
|
249802
|
+
void 0,
|
|
249803
|
+
[]
|
|
249805
249804
|
)
|
|
249806
|
-
)
|
|
249807
|
-
|
|
249808
|
-
|
|
249809
|
-
|
|
249810
|
-
|
|
249811
|
-
|
|
249812
|
-
|
|
249813
|
-
|
|
249814
|
-
|
|
249815
|
-
|
|
249816
|
-
|
|
249817
|
-
|
|
249818
|
-
|
|
249819
|
-
|
|
249820
|
-
)
|
|
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)
|
|
249821
249820
|
)
|
|
249822
249821
|
)
|
|
249823
|
-
|
|
249824
|
-
|
|
249825
|
-
|
|
249822
|
+
)
|
|
249823
|
+
],
|
|
249824
|
+
true
|
|
249826
249825
|
)
|
|
249827
|
-
|
|
249828
|
-
|
|
249829
|
-
|
|
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
|
+
}
|
|
249830
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
|
+
);
|
|
249831
249851
|
}
|
|
249832
249852
|
function hostRefElementInternalsPropAccess() {
|
|
249833
249853
|
return import_typescript4.default.factory.createElementAccessExpression(
|
|
@@ -268038,30 +268058,53 @@ var import_typescript27 = __toESM(require_typescript_5_8_3_bundle_cache_min());
|
|
|
268038
268058
|
init_import_meta_url();
|
|
268039
268059
|
var import_typescript26 = __toESM(require_typescript_5_8_3_bundle_cache_min());
|
|
268040
268060
|
function createNativeAttachInternalsBinding(cmp) {
|
|
268041
|
-
|
|
268042
|
-
|
|
268043
|
-
|
|
268044
|
-
|
|
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(
|
|
268045
268075
|
import_typescript26.default.factory.createPropertyAccessExpression(
|
|
268046
268076
|
import_typescript26.default.factory.createThis(),
|
|
268047
|
-
|
|
268048
|
-
import_typescript26.default.factory.createIdentifier(cmp.attachInternalsMemberName)
|
|
268077
|
+
import_typescript26.default.factory.createIdentifier("attachInternals")
|
|
268049
268078
|
),
|
|
268050
|
-
|
|
268051
|
-
|
|
268052
|
-
import_typescript26.default.factory.createPropertyAccessExpression(
|
|
268053
|
-
import_typescript26.default.factory.createThis(),
|
|
268054
|
-
import_typescript26.default.factory.createIdentifier("attachInternals")
|
|
268055
|
-
),
|
|
268056
|
-
void 0,
|
|
268057
|
-
[]
|
|
268058
|
-
)
|
|
268079
|
+
void 0,
|
|
268080
|
+
[]
|
|
268059
268081
|
)
|
|
268060
268082
|
)
|
|
268061
|
-
|
|
268062
|
-
|
|
268063
|
-
|
|
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
|
+
}
|
|
268064
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
|
+
);
|
|
268065
268108
|
}
|
|
268066
268109
|
|
|
268067
268110
|
// src/compiler/transformers/component-native/native-constructor.ts
|
|
@@ -273084,6 +273127,7 @@ var getDocsComponents = async (config, compilerCtx, buildCtx) => {
|
|
|
273084
273127
|
styles: getDocsStyles(cmp),
|
|
273085
273128
|
slots: getDocsSlots(cmp.docs.tags),
|
|
273086
273129
|
parts: getDocsParts(cmp.htmlParts, cmp.docs.tags),
|
|
273130
|
+
customStates: getDocsCustomStates(cmp),
|
|
273087
273131
|
listeners: getDocsListeners(cmp.listeners)
|
|
273088
273132
|
}));
|
|
273089
273133
|
})
|
|
@@ -273282,6 +273326,19 @@ var getDocsParts = (vdom, tags) => {
|
|
|
273282
273326
|
(p) => p.name
|
|
273283
273327
|
);
|
|
273284
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
|
+
};
|
|
273285
273342
|
var getNameText = (name, tags) => {
|
|
273286
273343
|
return tags.filter((tag) => tag.name === name && tag.text).map(({ text }) => {
|
|
273287
273344
|
const [namePart, ...rest] = (" " + text).split(" - ");
|
|
@@ -273394,7 +273451,7 @@ var generateCustomDocs = async (config, docsData, outputTargets) => {
|
|
|
273394
273451
|
);
|
|
273395
273452
|
};
|
|
273396
273453
|
|
|
273397
|
-
// src/compiler/docs/
|
|
273454
|
+
// src/compiler/docs/cem/index.ts
|
|
273398
273455
|
init_import_meta_url();
|
|
273399
273456
|
var generateCustomElementsManifestDocs = async (compilerCtx, docsData, outputTargets) => {
|
|
273400
273457
|
const cemOutputTargets = outputTargets.filter(isOutputTargetDocsCustomElementsManifest);
|
|
@@ -273567,6 +273624,13 @@ var componentToDeclaration = (component) => {
|
|
|
273567
273624
|
...slots.length > 0 && { slots },
|
|
273568
273625
|
...cssParts.length > 0 && { cssParts },
|
|
273569
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
|
+
},
|
|
273570
273634
|
...demos.length > 0 && { demos }
|
|
273571
273635
|
};
|
|
273572
273636
|
};
|
|
@@ -273607,6 +273671,7 @@ export default _default;
|
|
|
273607
273671
|
styles: cmp.styles,
|
|
273608
273672
|
slots: cmp.slots,
|
|
273609
273673
|
parts: cmp.parts,
|
|
273674
|
+
states: cmp.customStates,
|
|
273610
273675
|
dependents: cmp.dependents,
|
|
273611
273676
|
dependencies: cmp.dependencies,
|
|
273612
273677
|
dependencyGraph: cmp.dependencyGraph,
|
|
@@ -273653,6 +273718,26 @@ var stylesToMarkdown = (styles2) => {
|
|
|
273653
273718
|
return content;
|
|
273654
273719
|
};
|
|
273655
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
|
+
|
|
273656
273741
|
// src/compiler/docs/readme/markdown-dependencies.ts
|
|
273657
273742
|
init_import_meta_url();
|
|
273658
273743
|
var depsToMarkdown = (cmp, cmps, config) => {
|
|
@@ -273953,6 +274038,7 @@ var generateMarkdown = (userContent, cmp, cmps, readmeOutput, config) => {
|
|
|
273953
274038
|
...methodsToMarkdown(cmp.methods),
|
|
273954
274039
|
...slotsToMarkdown(cmp.slots),
|
|
273955
274040
|
...partsToMarkdown(cmp.parts),
|
|
274041
|
+
...customStatesToMarkdown(cmp.customStates),
|
|
273956
274042
|
...stylesToMarkdown(cmp.styles),
|
|
273957
274043
|
...dependencies,
|
|
273958
274044
|
`----------------------------------------------`,
|
|
@@ -274674,6 +274760,23 @@ var generateComponentTypes = (cmp, typeImportData, areTypesInternal) => {
|
|
|
274674
274760
|
` new (): ${htmlElementName};`,
|
|
274675
274761
|
` };`
|
|
274676
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
|
+
const propMeta = cmp.properties.find((p) => p.name === prop.name);
|
|
274769
|
+
let attrType = "string";
|
|
274770
|
+
if (propMeta == null ? void 0 : propMeta.type) {
|
|
274771
|
+
const simpleType = propMeta.type.trim();
|
|
274772
|
+
if (["string", "number", "boolean"].includes(simpleType)) {
|
|
274773
|
+
attrType = simpleType;
|
|
274774
|
+
} else {
|
|
274775
|
+
attrType = "string";
|
|
274776
|
+
}
|
|
274777
|
+
}
|
|
274778
|
+
return ` "${prop.name}": ${attrType};`;
|
|
274779
|
+
}).join("\n");
|
|
274677
274780
|
return {
|
|
274678
274781
|
isDep,
|
|
274679
274782
|
tagName,
|
|
@@ -274684,7 +274787,16 @@ ${componentAttributes} }`, cmp.docs, 4),
|
|
|
274684
274787
|
jsx: ` interface ${tagNameAsPascal} {
|
|
274685
274788
|
${jsxAttributes} }`,
|
|
274686
274789
|
element: element.join(`
|
|
274687
|
-
`)
|
|
274790
|
+
`),
|
|
274791
|
+
explicitAttributes: hasExplicitAttributes ? ` interface ${tagNameAsPascal}Attributes {
|
|
274792
|
+
${explicitAttributes}
|
|
274793
|
+
}` : null,
|
|
274794
|
+
explicitProperties: null,
|
|
274795
|
+
requiredProps: hasRequiredProps ? requiredProps.map((p) => ({
|
|
274796
|
+
name: p.name,
|
|
274797
|
+
type: p.type,
|
|
274798
|
+
complexType: p.complexType
|
|
274799
|
+
})) : null
|
|
274688
274800
|
};
|
|
274689
274801
|
};
|
|
274690
274802
|
function generateStandardElementInterface(htmlElementName, tagNameAsPascal, htmlElementEventListenerProperties, docs) {
|
|
@@ -274760,7 +274872,10 @@ var generateEventDetailTypes = (cmp) => {
|
|
|
274760
274872
|
htmlElementName,
|
|
274761
274873
|
component: cmpInterface.join("\n"),
|
|
274762
274874
|
jsx: cmpInterface.join("\n"),
|
|
274763
|
-
element: cmpInterface.join("\n")
|
|
274875
|
+
element: cmpInterface.join("\n"),
|
|
274876
|
+
explicitAttributes: null,
|
|
274877
|
+
explicitProperties: null,
|
|
274878
|
+
requiredProps: null
|
|
274764
274879
|
};
|
|
274765
274880
|
};
|
|
274766
274881
|
|
|
@@ -274949,14 +275064,43 @@ var generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
|
274949
275064
|
c.push(` }`);
|
|
274950
275065
|
c.push(`}`);
|
|
274951
275066
|
c.push(`declare namespace LocalJSX {`);
|
|
275067
|
+
const hasAnyRequiredProps = modules.some((m) => m.requiredProps);
|
|
275068
|
+
if (hasAnyRequiredProps) {
|
|
275069
|
+
c.push(
|
|
275070
|
+
` type OneOf<K extends string, T> = { [P in K]: T } | { [P in \`attr:\${K}\`]: T } | { [P in \`prop:\${K}\`]: T };`
|
|
275071
|
+
);
|
|
275072
|
+
c.push(``);
|
|
275073
|
+
}
|
|
274952
275074
|
c.push(
|
|
274953
275075
|
...modules.map((m) => {
|
|
274954
275076
|
const docs = components.find((c2) => c2.tagName === m.tagName).docs;
|
|
274955
275077
|
return addDocBlock(m.jsx, docs, 4);
|
|
274956
275078
|
})
|
|
274957
275079
|
);
|
|
275080
|
+
const attributeInterfaces = modules.filter((m) => m.explicitAttributes).map((m) => m.explicitAttributes);
|
|
275081
|
+
if (attributeInterfaces.length > 0) {
|
|
275082
|
+
c.push(``);
|
|
275083
|
+
c.push(...attributeInterfaces);
|
|
275084
|
+
c.push(``);
|
|
275085
|
+
}
|
|
274958
275086
|
c.push(` interface IntrinsicElements {`);
|
|
274959
|
-
c.push(
|
|
275087
|
+
c.push(
|
|
275088
|
+
...modules.map((m) => {
|
|
275089
|
+
if (m.explicitAttributes) {
|
|
275090
|
+
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] }`;
|
|
275091
|
+
if (m.requiredProps && m.requiredProps.length > 0) {
|
|
275092
|
+
const requiredUnions = m.requiredProps.map((prop) => {
|
|
275093
|
+
return `OneOf<"${prop.name}", ${m.tagNameAsPascal}["${prop.name}"]>`;
|
|
275094
|
+
}).join(" & ");
|
|
275095
|
+
return ` "${m.tagName}": ${baseOptional} & ${requiredUnions};`;
|
|
275096
|
+
} else {
|
|
275097
|
+
return ` "${m.tagName}": ${baseOptional};`;
|
|
275098
|
+
}
|
|
275099
|
+
} else {
|
|
275100
|
+
return ` "${m.tagName}": ${m.tagNameAsPascal};`;
|
|
275101
|
+
}
|
|
275102
|
+
})
|
|
275103
|
+
);
|
|
274960
275104
|
c.push(` }`);
|
|
274961
275105
|
c.push(`}`);
|
|
274962
275106
|
c.push(`export { LocalJSX as JSX };`);
|
|
@@ -274967,7 +275111,7 @@ var generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
|
274967
275111
|
...modules.map((m) => {
|
|
274968
275112
|
const docs = components.find((c2) => c2.tagName === m.tagName).docs;
|
|
274969
275113
|
return addDocBlock(
|
|
274970
|
-
` "${m.tagName}": LocalJSX
|
|
275114
|
+
` "${m.tagName}": LocalJSX.IntrinsicElements["${m.tagName}"] & JSXBase.HTMLAttributes<${m.htmlElementName}>;`,
|
|
274971
275115
|
docs,
|
|
274972
275116
|
12
|
|
274973
275117
|
);
|
|
@@ -276150,9 +276294,10 @@ var isDecoratorNamed = (propName) => {
|
|
|
276150
276294
|
|
|
276151
276295
|
// src/compiler/transformers/decorators-to-static/attach-internals.ts
|
|
276152
276296
|
var attachInternalsDecoratorsToStatic = (diagnostics, decoratedMembers, newMembers, typeChecker, decoratorName) => {
|
|
276297
|
+
var _a2;
|
|
276153
276298
|
const attachInternalsMembers = decoratedMembers.filter(import_typescript44.default.isPropertyDeclaration).filter((prop) => {
|
|
276154
|
-
var
|
|
276155
|
-
return !!((
|
|
276299
|
+
var _a3;
|
|
276300
|
+
return !!((_a3 = retrieveTsDecorators(prop)) == null ? void 0 : _a3.find(isDecoratorNamed(decoratorName)));
|
|
276156
276301
|
});
|
|
276157
276302
|
if (attachInternalsMembers.length === 0) {
|
|
276158
276303
|
return;
|
|
@@ -276164,8 +276309,52 @@ var attachInternalsDecoratorsToStatic = (diagnostics, decoratedMembers, newMembe
|
|
|
276164
276309
|
}
|
|
276165
276310
|
const [decoratedProp] = attachInternalsMembers;
|
|
276166
276311
|
const { staticName: name } = tsPropDeclName(decoratedProp, typeChecker);
|
|
276312
|
+
const decorator3 = (_a2 = retrieveTsDecorators(decoratedProp)) == null ? void 0 : _a2.find(isDecoratorNamed(decoratorName));
|
|
276313
|
+
const customStates = parseCustomStatesFromDecorator(decorator3, typeChecker);
|
|
276167
276314
|
newMembers.push(createStaticGetter("attachInternalsMemberName", convertValueToLiteral(name)));
|
|
276315
|
+
if (customStates.length > 0) {
|
|
276316
|
+
newMembers.push(createStaticGetter("attachInternalsCustomStates", convertValueToLiteral(customStates)));
|
|
276317
|
+
}
|
|
276168
276318
|
};
|
|
276319
|
+
function parseCustomStatesFromDecorator(decorator3, typeChecker) {
|
|
276320
|
+
if (!decorator3 || !import_typescript44.default.isCallExpression(decorator3.expression)) {
|
|
276321
|
+
return [];
|
|
276322
|
+
}
|
|
276323
|
+
const [firstArg] = decorator3.expression.arguments;
|
|
276324
|
+
if (!firstArg || !import_typescript44.default.isObjectLiteralExpression(firstArg)) {
|
|
276325
|
+
return [];
|
|
276326
|
+
}
|
|
276327
|
+
const statesProp = firstArg.properties.find(
|
|
276328
|
+
(prop) => import_typescript44.default.isPropertyAssignment(prop) && import_typescript44.default.isIdentifier(prop.name) && prop.name.text === "states"
|
|
276329
|
+
);
|
|
276330
|
+
if (!statesProp || !import_typescript44.default.isObjectLiteralExpression(statesProp.initializer)) {
|
|
276331
|
+
return [];
|
|
276332
|
+
}
|
|
276333
|
+
const customStates = [];
|
|
276334
|
+
for (const prop of statesProp.initializer.properties) {
|
|
276335
|
+
if (!import_typescript44.default.isPropertyAssignment(prop)) {
|
|
276336
|
+
continue;
|
|
276337
|
+
}
|
|
276338
|
+
const stateName = import_typescript44.default.isIdentifier(prop.name) ? prop.name.text : import_typescript44.default.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
276339
|
+
if (!stateName) {
|
|
276340
|
+
continue;
|
|
276341
|
+
}
|
|
276342
|
+
let initialValue = false;
|
|
276343
|
+
if (prop.initializer.kind === import_typescript44.default.SyntaxKind.TrueKeyword) {
|
|
276344
|
+
initialValue = true;
|
|
276345
|
+
} else if (prop.initializer.kind === import_typescript44.default.SyntaxKind.FalseKeyword) {
|
|
276346
|
+
initialValue = false;
|
|
276347
|
+
}
|
|
276348
|
+
const symbol = typeChecker.getSymbolAtLocation(prop.name);
|
|
276349
|
+
const docs = symbol ? import_typescript44.default.displayPartsToString(symbol.getDocumentationComment(typeChecker)) : "";
|
|
276350
|
+
customStates.push({
|
|
276351
|
+
name: stateName,
|
|
276352
|
+
initialValue,
|
|
276353
|
+
docs
|
|
276354
|
+
});
|
|
276355
|
+
}
|
|
276356
|
+
return customStates;
|
|
276357
|
+
}
|
|
276169
276358
|
|
|
276170
276359
|
// src/compiler/transformers/decorators-to-static/component-decorator.ts
|
|
276171
276360
|
init_import_meta_url();
|
|
@@ -277968,6 +278157,20 @@ var parseAttachInternals = (staticMembers) => {
|
|
|
277968
278157
|
return null;
|
|
277969
278158
|
}
|
|
277970
278159
|
};
|
|
278160
|
+
var parseAttachInternalsCustomStates = (staticMembers) => {
|
|
278161
|
+
const parsedCustomStates = getStaticValue(staticMembers, "attachInternalsCustomStates");
|
|
278162
|
+
if (Array.isArray(parsedCustomStates)) {
|
|
278163
|
+
return parsedCustomStates.map((state) => {
|
|
278164
|
+
var _a2;
|
|
278165
|
+
return {
|
|
278166
|
+
name: String(state.name),
|
|
278167
|
+
initialValue: Boolean(state.initialValue),
|
|
278168
|
+
docs: (_a2 = state.docs) != null ? _a2 : ""
|
|
278169
|
+
};
|
|
278170
|
+
});
|
|
278171
|
+
}
|
|
278172
|
+
return [];
|
|
278173
|
+
};
|
|
277971
278174
|
|
|
277972
278175
|
// src/compiler/transformers/static-to-meta/class-methods.ts
|
|
277973
278176
|
init_import_meta_url();
|
|
@@ -278628,6 +278831,7 @@ var parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile, b
|
|
|
278628
278831
|
const encapsulation = parseStaticEncapsulation(staticMembers);
|
|
278629
278832
|
const cmp = {
|
|
278630
278833
|
attachInternalsMemberName: parseAttachInternals(staticMembers),
|
|
278834
|
+
attachInternalsCustomStates: parseAttachInternalsCustomStates(staticMembers),
|
|
278631
278835
|
formAssociated: parseFormAssociated(staticMembers),
|
|
278632
278836
|
tagName,
|
|
278633
278837
|
excludeFromCollection: moduleFile.excludeFromCollection,
|