@stencil/core 5.0.0-beta.12 → 5.0.0-beta.13
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/dist/{client-CdFmjaQa.mjs → client-NHI55T4R.mjs} +7 -4
- package/dist/compiler/browser.d.ts +96 -54
- package/dist/compiler/browser.js +140 -18
- package/dist/compiler/index.d.mts +87 -2
- package/dist/compiler/index.mjs +3 -3
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-BjKDj129.mjs → compiler-Dr9JHtLp.mjs} +3571 -2384
- package/dist/declarations/stencil-public-compiler.d.ts +85 -59
- package/dist/declarations/stencil-public-docs.d.ts +23 -0
- package/dist/declarations/stencil-public-runtime.d.ts +2 -2
- package/dist/{index-CKnzMkZC.d.mts → index-BBJVAnzJ.d.mts} +2 -2
- package/dist/{index-Cw1NW9FW.d.mts → index-BilaSOF5.d.mts} +87 -61
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-HKfDhPR3.mjs → node-DrwzfDH1.mjs} +1 -1
- package/dist/runtime/client/lazy.js +87 -84
- package/dist/runtime/client/runtime.d.ts +5 -6
- package/dist/runtime/client/runtime.js +87 -84
- package/dist/runtime/index.d.ts +2 -3
- package/dist/runtime/index.js +85 -82
- package/dist/runtime/server/index.d.mts +4 -5
- package/dist/runtime/server/index.mjs +97 -84
- package/dist/runtime/server/runner.mjs +27 -41
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/index.mjs +1 -1
- package/dist/sys/node/worker.mjs +2 -2
- package/dist/testing/index.d.mts +77 -58
- package/dist/testing/index.mjs +167 -156
- package/package.json +5 -4
|
@@ -1111,6 +1111,11 @@ interface JsonDocsComponent {
|
|
|
1111
1111
|
* A deprecation reason/description found following a `@deprecated` tag
|
|
1112
1112
|
*/
|
|
1113
1113
|
deprecation?: string;
|
|
1114
|
+
/**
|
|
1115
|
+
* `true` if this is a "CSS-only component"
|
|
1116
|
+
* discovered in .css file via `@component`-marked JSDoc block
|
|
1117
|
+
*/
|
|
1118
|
+
cssOnly?: boolean;
|
|
1114
1119
|
}
|
|
1115
1120
|
interface JsonDocsDependencyGraph {
|
|
1116
1121
|
[tagName: string]: string[];
|
|
@@ -1270,6 +1275,16 @@ interface JsonDocsStyle {
|
|
|
1270
1275
|
* The annotation used in the JSDoc of the style (e.g. `@prop`)
|
|
1271
1276
|
*/
|
|
1272
1277
|
annotation: string;
|
|
1278
|
+
/**
|
|
1279
|
+
* The CSS `syntax` descriptor for a custom property, if it was registered via a native
|
|
1280
|
+
* `@property` at-rule (e.g. `"<length>"`).
|
|
1281
|
+
*/
|
|
1282
|
+
syntax?: string;
|
|
1283
|
+
/**
|
|
1284
|
+
* The `initial-value` descriptor for a custom property, if it was registered via a native
|
|
1285
|
+
* `@property` at-rule.
|
|
1286
|
+
*/
|
|
1287
|
+
default?: string;
|
|
1273
1288
|
/**
|
|
1274
1289
|
* The mode associated with the style
|
|
1275
1290
|
*/
|
|
@@ -1356,6 +1371,14 @@ interface StyleDoc {
|
|
|
1356
1371
|
* The Stencil style-mode that is associated with this property.
|
|
1357
1372
|
*/
|
|
1358
1373
|
mode: string | undefined;
|
|
1374
|
+
/**
|
|
1375
|
+
* The CSS `syntax` descriptor, if this property was registered via a native `@property` at-rule.
|
|
1376
|
+
*/
|
|
1377
|
+
syntax?: string;
|
|
1378
|
+
/**
|
|
1379
|
+
* The `initial-value` descriptor, if this property was registered via a native `@property` at-rule.
|
|
1380
|
+
*/
|
|
1381
|
+
default?: string;
|
|
1359
1382
|
}
|
|
1360
1383
|
//#endregion
|
|
1361
1384
|
//#region src/declarations/stencil-public-runtime.d.ts
|
|
@@ -1412,7 +1435,7 @@ interface ComponentOptions {
|
|
|
1412
1435
|
/**
|
|
1413
1436
|
* Relative URL to an external stylesheet providing document-level styles for this component.
|
|
1414
1437
|
* Unlike `styleUrl`, these styles are not scoped to shadow/scoped DOM - they are collected
|
|
1415
|
-
* at build time and injected wherever `@import "stencil-globals"` appears in a global stylesheet.
|
|
1438
|
+
* at build time and injected wherever `@import "stencil-component-globals"` appears in a global stylesheet.
|
|
1416
1439
|
*
|
|
1417
1440
|
* Useful for
|
|
1418
1441
|
* - pre-first-js-render styles (combatting cumulative layout shift)
|
|
@@ -1427,7 +1450,7 @@ interface ComponentOptions {
|
|
|
1427
1450
|
globalStyleUrl?: string;
|
|
1428
1451
|
/**
|
|
1429
1452
|
* Inline CSS string providing document-level styles for this component.
|
|
1430
|
-
* Collected at build time and injected wherever `@import "stencil-globals"` appears.
|
|
1453
|
+
* Collected at build time and injected wherever `@import "stencil-component-globals"` appears.
|
|
1431
1454
|
* @see globalStyleUrl
|
|
1432
1455
|
*/
|
|
1433
1456
|
globalStyle?: string;
|
|
@@ -1788,6 +1811,15 @@ interface StencilConfig {
|
|
|
1788
1811
|
* whenever a config file is present - set this explicitly to opt an existing project in or out.
|
|
1789
1812
|
*/
|
|
1790
1813
|
generateExportMaps?: boolean;
|
|
1814
|
+
/**
|
|
1815
|
+
* Set to `false` to disable discovery of "CSS-only components" - pure-CSS custom-element
|
|
1816
|
+
* definitions marked with a `@component` JSDoc tag in `.css` files under `srcDir`. No JS
|
|
1817
|
+
* class, never registered via `customElements.define()` - just a documented,
|
|
1818
|
+
* type-checked tag name and its CSS custom properties/attribute variants.
|
|
1819
|
+
*
|
|
1820
|
+
* Defaults to `true`.
|
|
1821
|
+
*/
|
|
1822
|
+
enableCssOnlyComponents?: boolean;
|
|
1791
1823
|
/**
|
|
1792
1824
|
* The namespace config is a string representing a namespace for the app.
|
|
1793
1825
|
* For apps that are not meant to be a library of reusable components,
|
|
@@ -3118,6 +3150,7 @@ interface CompilerBuildResults {
|
|
|
3118
3150
|
buildId: number;
|
|
3119
3151
|
componentGraph?: BuildResultsComponentGraph;
|
|
3120
3152
|
components: ComponentCompilerMeta[];
|
|
3153
|
+
cssOnlyComponents: ComponentCompilerMeta[];
|
|
3121
3154
|
diagnostics: Diagnostic$1[];
|
|
3122
3155
|
dirsAdded: string[];
|
|
3123
3156
|
dirsDeleted: string[];
|
|
@@ -3134,6 +3167,15 @@ interface CompilerBuildResults {
|
|
|
3134
3167
|
namespace: string;
|
|
3135
3168
|
fsNamespace: string;
|
|
3136
3169
|
outputs: BuildOutput[];
|
|
3170
|
+
/**
|
|
3171
|
+
* Absolute paths to every global stylesheet, in cascade order: each `global-style` output
|
|
3172
|
+
* target's compiled CSS in the order those targets are declared in `config.outputTargets` - or,
|
|
3173
|
+
* with none configured, the generated `{fsNamespace}.css` holding Stencil's auto-placed CSS (when
|
|
3174
|
+
* emitted). Unlike `outputs`, which groups files by type and sorts them alphabetically, this
|
|
3175
|
+
* preserves author-intended order for consumers like the dev-server's auto-generated component
|
|
3176
|
+
* preview.
|
|
3177
|
+
*/
|
|
3178
|
+
globalStyleFiles: string[];
|
|
3137
3179
|
rootDir: string;
|
|
3138
3180
|
srcDir: string;
|
|
3139
3181
|
timestamp: string;
|
|
@@ -3149,6 +3191,7 @@ interface HotModuleReplacement {
|
|
|
3149
3191
|
componentsUpdated?: string[];
|
|
3150
3192
|
excludeHmr?: string[];
|
|
3151
3193
|
externalStylesUpdated?: string[];
|
|
3194
|
+
globalStylesUpdated?: HmrGlobalStyleUpdate[];
|
|
3152
3195
|
imagesUpdated?: string[];
|
|
3153
3196
|
indexHtmlUpdated?: boolean;
|
|
3154
3197
|
inlineStylesUpdated?: HmrStyleUpdate[];
|
|
@@ -3163,6 +3206,15 @@ interface HmrStyleUpdate {
|
|
|
3163
3206
|
styleTag: string;
|
|
3164
3207
|
styleText: string;
|
|
3165
3208
|
}
|
|
3209
|
+
/**
|
|
3210
|
+
* A live-reload update for a `global-style` output target's CSS. Applied on
|
|
3211
|
+
* the client by matching `fileName` against the `<link>` that loads it and
|
|
3212
|
+
* inserting/updating an adjacent `<style>` override
|
|
3213
|
+
*/
|
|
3214
|
+
interface HmrGlobalStyleUpdate {
|
|
3215
|
+
fileName: string;
|
|
3216
|
+
styleText: string;
|
|
3217
|
+
}
|
|
3166
3218
|
type BuildOnEventRemove = () => boolean;
|
|
3167
3219
|
interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
|
|
3168
3220
|
unsubscribeAll(): void;
|
|
@@ -3923,10 +3975,8 @@ interface OutputTargetStandalone extends OutputTargetBaseNext {
|
|
|
3923
3975
|
type: 'standalone';
|
|
3924
3976
|
empty?: boolean;
|
|
3925
3977
|
/**
|
|
3926
|
-
*
|
|
3927
|
-
*
|
|
3928
|
-
* 2. File names are not hashed.
|
|
3929
|
-
* 3. File minification will follow the behavior defined at the root of the Stencil config.
|
|
3978
|
+
* When `true`, all `@stencil/core/*` module references are treated as external
|
|
3979
|
+
* during bundling rather than being included in the generated output.
|
|
3930
3980
|
*
|
|
3931
3981
|
* @default false
|
|
3932
3982
|
*/
|
|
@@ -4451,6 +4501,12 @@ interface TranspileOptions {
|
|
|
4451
4501
|
* that the specified flags take effect for this component at runtime.
|
|
4452
4502
|
*/
|
|
4453
4503
|
buildOverrides?: BuildOverrides;
|
|
4504
|
+
/**
|
|
4505
|
+
* When `true`, a `.css`/`.scss` transpile also collects CSS custom-property docs
|
|
4506
|
+
* onto {@link TranspileResults.styleDocs}. Off by default, since it costs an extra parse
|
|
4507
|
+
* of the style text.
|
|
4508
|
+
*/
|
|
4509
|
+
docs?: boolean;
|
|
4454
4510
|
}
|
|
4455
4511
|
/**
|
|
4456
4512
|
* Keys of {@link BuildConditionals} that can be meaningfully overridden at
|
|
@@ -4476,6 +4532,7 @@ interface TranspileResults {
|
|
|
4476
4532
|
inputFilePath: string;
|
|
4477
4533
|
map: any;
|
|
4478
4534
|
outputFilePath: string;
|
|
4535
|
+
styleDocs?: StyleDoc[];
|
|
4479
4536
|
}
|
|
4480
4537
|
interface TransformOptions {
|
|
4481
4538
|
coreImportPath: string;
|
|
@@ -4521,6 +4578,8 @@ interface CliInitOptions {
|
|
|
4521
4578
|
}
|
|
4522
4579
|
//#endregion
|
|
4523
4580
|
//#region src/declarations/stencil-private.d.ts
|
|
4581
|
+
/** Build-time virtual `@import`s a `global-style` input can use to place Stencil-generated CSS. */
|
|
4582
|
+
type StencilVirtualImport = 'stencil-hydrate' | 'stencil-component-globals' | 'stencil-css-components';
|
|
4524
4583
|
interface SourceMap$1 {
|
|
4525
4584
|
file: string;
|
|
4526
4585
|
mappings: string;
|
|
@@ -4659,6 +4718,7 @@ interface BuildCtx {
|
|
|
4659
4718
|
esmComponentBundle: ReadonlyArray<BundleModule>;
|
|
4660
4719
|
commonJsComponentBundle: ReadonlyArray<BundleModule>;
|
|
4661
4720
|
components: ComponentCompilerMeta[];
|
|
4721
|
+
cssOnlyComponents: ComponentCompilerMeta[];
|
|
4662
4722
|
componentGraph: Map<string, string[]>;
|
|
4663
4723
|
config: ValidatedConfig;
|
|
4664
4724
|
createTimeSpan(msg: string, debug?: boolean): LoggerTimeSpan;
|
|
@@ -4707,6 +4767,9 @@ interface BuildCtx {
|
|
|
4707
4767
|
*/
|
|
4708
4768
|
stylesPromise: Promise<string>;
|
|
4709
4769
|
stylesUpdated: BuildStyleUpdate[];
|
|
4770
|
+
globalStylesUpdated: BuildGlobalStyleLinkUpdate[];
|
|
4771
|
+
/** Absolute path of the generated `{fsNamespace}.css`, when this build emitted one */
|
|
4772
|
+
stencilCssFile?: string;
|
|
4710
4773
|
timeSpan: LoggerTimeSpan;
|
|
4711
4774
|
timestamp: string;
|
|
4712
4775
|
transpileBuildCount: number;
|
|
@@ -4719,6 +4782,14 @@ interface BuildStyleUpdate {
|
|
|
4719
4782
|
styleText: string;
|
|
4720
4783
|
styleMode: string;
|
|
4721
4784
|
}
|
|
4785
|
+
/**
|
|
4786
|
+
* A live-reload update for a `global-style` output target's CSS, matched on
|
|
4787
|
+
* the client by `fileName` against the `<link>`
|
|
4788
|
+
*/
|
|
4789
|
+
interface BuildGlobalStyleLinkUpdate {
|
|
4790
|
+
fileName: string;
|
|
4791
|
+
styleText: string;
|
|
4792
|
+
}
|
|
4722
4793
|
type BuildTask = any;
|
|
4723
4794
|
interface CompilerBuildStats {
|
|
4724
4795
|
timestamp: string;
|
|
@@ -4860,6 +4931,12 @@ interface CompilerCtx {
|
|
|
4860
4931
|
cssModuleImports: Map<string, string[]>;
|
|
4861
4932
|
/** Cache of built global styles, keyed by input file path */
|
|
4862
4933
|
globalStyleCache: Map<string, string>;
|
|
4934
|
+
/** Cache of discovered CSS-only components from the last scan, keyed by absolute .css file path */
|
|
4935
|
+
cssOnlyComponentsCache: Map<string, ComponentCompilerMeta[]>;
|
|
4936
|
+
/** Contents of the last auto-placed `stencil-*` CSS, used to detect changes for HMR */
|
|
4937
|
+
stencilCss?: string;
|
|
4938
|
+
/** Virtual imports found in each built global style (post-preprocessing), keyed by input path */
|
|
4939
|
+
globalStyleVirtualImports: Map<string, Set<StencilVirtualImport>>;
|
|
4863
4940
|
collections: CollectionCompilerMeta[];
|
|
4864
4941
|
compilerOptions: any;
|
|
4865
4942
|
events: BuildEvents;
|
|
@@ -5005,7 +5082,7 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
|
|
|
5005
5082
|
* Custom states to initialize on the ElementInternals.states CustomStateSet.
|
|
5006
5083
|
* These are defined via @AttachInternals({ states: {...} }).
|
|
5007
5084
|
*/
|
|
5008
|
-
attachInternalsCustomStates:
|
|
5085
|
+
attachInternalsCustomStates: JsonDocsCustomState[];
|
|
5009
5086
|
componentClassName: string;
|
|
5010
5087
|
/**
|
|
5011
5088
|
* A list of web component tag names that are either:
|
|
@@ -5075,7 +5152,7 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
|
|
|
5075
5152
|
sourceFilePath: string;
|
|
5076
5153
|
sourceMapPath: string;
|
|
5077
5154
|
states: ComponentCompilerState[];
|
|
5078
|
-
styleDocs:
|
|
5155
|
+
styleDocs: StyleDoc[];
|
|
5079
5156
|
styles: StyleCompiler[];
|
|
5080
5157
|
globalStyles: ComponentGlobalStyle[];
|
|
5081
5158
|
tagName: string;
|
|
@@ -5278,20 +5355,6 @@ interface ComponentCompilerState {
|
|
|
5278
5355
|
* Custom states are exposed via the ElementInternals.states CustomStateSet
|
|
5279
5356
|
* and can be targeted with the CSS :state() pseudo-class.
|
|
5280
5357
|
*/
|
|
5281
|
-
interface ComponentCompilerCustomState {
|
|
5282
|
-
/**
|
|
5283
|
-
* The name of the custom state (without dashes)
|
|
5284
|
-
*/
|
|
5285
|
-
name: string;
|
|
5286
|
-
/**
|
|
5287
|
-
* The initial value of the state
|
|
5288
|
-
*/
|
|
5289
|
-
initialValue: boolean;
|
|
5290
|
-
/**
|
|
5291
|
-
* Optional JSDoc description for the state
|
|
5292
|
-
*/
|
|
5293
|
-
docs: string;
|
|
5294
|
-
}
|
|
5295
5358
|
/**
|
|
5296
5359
|
* Representation of JSDoc that is pulled off a node in the AST
|
|
5297
5360
|
*/
|
|
@@ -5303,44 +5366,7 @@ interface CompilerJsDoc {
|
|
|
5303
5366
|
/**
|
|
5304
5367
|
* Tags included in the JSDoc
|
|
5305
5368
|
*/
|
|
5306
|
-
tags:
|
|
5307
|
-
}
|
|
5308
|
-
/**
|
|
5309
|
-
* Representation of a tag that exists in a JSDoc
|
|
5310
|
-
*/
|
|
5311
|
-
interface CompilerJsDocTagInfo {
|
|
5312
|
-
/**
|
|
5313
|
-
* The name of the tag - e.g. `@deprecated`
|
|
5314
|
-
*/
|
|
5315
|
-
name: string;
|
|
5316
|
-
/**
|
|
5317
|
-
* Additional text that is associated with the tag - e.g. `@deprecated use v2 of this API`
|
|
5318
|
-
*/
|
|
5319
|
-
text?: string;
|
|
5320
|
-
}
|
|
5321
|
-
/**
|
|
5322
|
-
* The (internal) representation of a CSS block comment in a CSS, Sass, etc. file. This data structure is used during
|
|
5323
|
-
* the initial compilation phases of Stencil, as a piece of {@link ComponentCompilerMeta}.
|
|
5324
|
-
*/
|
|
5325
|
-
interface CompilerStyleDoc {
|
|
5326
|
-
/**
|
|
5327
|
-
* The name of the CSS property
|
|
5328
|
-
*/
|
|
5329
|
-
name: string;
|
|
5330
|
-
/**
|
|
5331
|
-
* The user-defined description of the CSS property
|
|
5332
|
-
*/
|
|
5333
|
-
docs: string;
|
|
5334
|
-
/**
|
|
5335
|
-
* The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
|
|
5336
|
-
* Used to inform Stencil where the start of a new property's description starts (and where the previous description
|
|
5337
|
-
* ends).
|
|
5338
|
-
*/
|
|
5339
|
-
annotation: 'prop';
|
|
5340
|
-
/**
|
|
5341
|
-
* The Stencil style-mode that is associated with this property.
|
|
5342
|
-
*/
|
|
5343
|
-
mode: string;
|
|
5369
|
+
tags: JsonDocsTag[];
|
|
5344
5370
|
}
|
|
5345
5371
|
interface CompilerAssetDir {
|
|
5346
5372
|
absolutePath?: string;
|
|
@@ -6187,4 +6213,4 @@ type MsgToWorker<T extends WorkerContextMethod> = IPCSerializable<{
|
|
|
6187
6213
|
*/
|
|
6188
6214
|
type WorkerMsgHandler = <T extends WorkerContextMethod>(msgToWorker: MsgToWorker<T>) => ReturnType<CompilerWorkerContext[T]>;
|
|
6189
6215
|
//#endregion
|
|
6190
|
-
export {
|
|
6216
|
+
export { CompilerSystemRemoveDirectoryOptions as $, GENERATED_DTS as $i, UserBuildConditionals as $n, isOutputTargetDocs as $r, OutputTargetDocsCustomElementsManifest as $t, CompilerBuildStart as A, loadTypeScriptDiagnostics as Ai, SsrFactoryOptions as An, isJsFile as Ar, LoadConfigInit as At, CompilerEventFileUpdate as B, COLLECTION_APP_DATA_FILE_NAME as Bi, ValidatedConfig as Bn, rolldownToStencilSourceMap as Br, OptimizeJsInput as Bt, BuildResultsComponentGraph as C, hasWarning as Ci, RobotsTxtResults as Cn, ParsePackageJsonResult as Cr, HotModuleReplacement as Ct, CompileTarget as D, splitLineBreaks as Di, SitemapXmpOpts as Dn, getTextDocs as Dr, LOG_LEVELS as Dt, CompileScriptMinifyOptions as E, normalizeDiagnostics as Ei, ServiceWorkerConfig as En, generatePreamble as Er, HydratedFlag as Et, CompilerEventBuildStart as F, formatLazyBundleRuntimeMeta as Fi, TransformOptions as Fn, readOnlyArrayHasStringMember as Fr, LoggerTimeSpan as Ft, CompilerFileWatcherEvent as G, DIST_LAZY as Gi, ComponentInterface as Gn, getComponentsDtsSrcFilePath as Gr, OutputTargetBaseNext as Gt, CompilerEventName as H, COPY as Hi, WatcherCloseResults as Hn, FilterComponentsResult as Hr, OutputTarget as Ht, CompilerEventDirAdd as I, stringifyRuntimeData as Ii, TranspileOnlyResults as In, readPackageJson as Ir, ModeConfig as It, CompilerRequestResponse as J, DOCS_CUSTOM_ELEMENTS_MANIFEST as Ji, MixedInCtor as Jn, isOutputTargetAssets as Jr, OutputTargetCopy as Jt, CompilerFsStats as K, DOCS_AGENT_SKILL as Ki, ErrorHandler as Kn, getComponentsDtsTypesFilePath as Kr, OutputTargetBuild as Kt, CompilerEventDirDelete as L, ASSETS as Li, TranspileOptions as Ln, getInlineSourceMappingUrlLinker as Lr, NodeResolveConfig as Lt, CompilerEventBuildFinish as M, isRolldownError as Mi, StencilDevServerConfig as Mn, isTsFile as Mr, LogLevel as Mt, CompilerEventBuildLog as N, loadRolldownDiagnostics as Ni, StencilDocsConfig as Nn, isTsxFile as Nr, Logger as Nt, Compiler as O, augmentDiagnosticWithNode as Oi, SitemapXmpResults as On, hasDependency as Or, LazyRequire as Ot, CompilerEventBuildNoChange as P, formatComponentRuntimeMeta as Pi, SystemDetails as Pn, parsePackageJson as Pr, LoggerLineUpdater as Pt, CompilerSystemRealpathResults as Q, EVENT_FLAGS as Qi, TagTransformer as Qn, isOutputTargetDistLazy as Qr, OutputTargetDocsCustom as Qt, CompilerEventFileAdd as R, CMP_FLAGS as Ri, TranspileResults as Rn, getSourceMappingUrlForEndOfFile as Rr, OptimizeCssInput as Rt, BuildOverrides as S, hasError as Si, RobotsTxtOpts as Sn, validateComponentTag as Sr, HmrStyleUpdate as St, CliInitOptions as T, escapeHtml as Ti, SerializeDocumentOptions as Tn, createJsVarName as Tr, HydrateFactoryOptions as Tt, CompilerFileWatcher as U, CUSTOM as Ui, WorkerMainController as Un, filterActiveTargets as Ur, OutputTargetAssets as Ut, CompilerEventFsChange as V, COLLECTION_MANIFEST_FILE_NAME as Vi, ValidatedOutputTargetWww as Vn, result_d_exports as Vr, OptimizeJsOutput as Vt, CompilerFileWatcherCallback as W, DEFAULT_STYLE_MODE as Wi, WorkerOptions as Wn, filterExcludedComponents as Wr, OutputTargetBase as Wt, CompilerSystemCreateDirectoryOptions as X, DOCS_README as Xi, ReactiveControllerHostInterface as Xn, isOutputTargetCopy as Xr, OutputTargetDistLazy as Xt, CompilerSystem as Y, DOCS_JSON as Yi, RafCallback as Yn, isOutputTargetCollection as Yr, OutputTargetCustom as Yt, CompilerSystemCreateDirectoryResults as Z, DOCS_VSCODE as Zi, ResolutionHandler as Zn, isOutputTargetCustom as Zr, OutputTargetDocsAgentSkill as Zt, BuildLog as _, XLINK_NS as _a, TASK_CANCELED_MSG as _i, PrerenderResults as _n, JsonDocsValue as _r, Diagnostic$1 as _t, ComponentGlobalStyle as a, MEMBER_FLAGS as aa, isOutputTargetDocsVscode as ai, OutputTargetSsr as an, JsonDocsDependencyGraph as ar, CompilerWatcher as at, BuildOnEvents as b, buildWarn as bi, ResolveModuleIdResults as bn, ModeValidationError as br, HistoryApiFallback as bt, PackageJsonData as c, SSR_WASM as ca, isOutputTargetSsr as ci, OutputTargetStats as cn, JsonDocsMethod as cr, ConfigCompat as ct, RuntimeRef as d, STYLE_EXT as da, isOutputTargetStats as di, PageReloadStrategy as dn, JsonDocsProp as dr, Credentials as dt, GLOBAL_STYLE as ea, isOutputTargetDocsAgentSkill as ei, OutputTargetDocsJson as en, VNode as er, CompilerSystemRemoveDirectoryResults as et, SsrResults as f, SVG_NS as fa, isOutputTargetTypes as fi, ParsedPath as fn, JsonDocsSlot as fr, CustomElementsExportBehavior as ft, BuildEvents as g, WWW as ga, shouldExcludeComponent as gi, PrerenderOptions as gn, JsonDocsUsage as gr, DevServerEditor as gt, BuildEmitEvents as h, WATCH_FLAGS as ha, relativeImport as hi, PrerenderHydrateOptions as hn, JsonDocsTypeLibrary as hr, DevServerConfig as ht, ComponentCompilerTypeReferences as i, LOADER_BUNDLE as ia, isOutputTargetDocsReadme as ii, OutputTargetLoaderBundle as in, JsonDocsCustomState as ir, CompilerSystemWriteFileResults as it, CompilerDependency as j, createOnWarnFn as ji, StencilConfig as jn, isJsxFile as jr, LoadConfigResults as jt, CompilerBuildResults as k, loadTypeScriptDiagnostic as ki, SsrDocumentOptions as kn, isDtsFile as kr, LightDomPatches as kt, PrintLine as l, STANDALONE as la, isOutputTargetSsrWasm as li, OutputTargetTypes as ln, JsonDocsMethodReturn as lr, CopyResults as lt, AutoprefixerOptions as m, VALID_CONFIG_OUTPUT_TARGETS as ma, isValidConfigOutputTarget as mi, PrerenderConfig as mn, JsonDocsTag as mr, DevServer as mt, CompilerWorkerContext as n, HTML_NS as na, isOutputTargetDocsCustomElementsManifest as ni, OutputTargetDocsVscode as nn, JsonDocs as nr, CompilerSystemRenameResults as nt, HostElement as o, NODE_TYPES as oa, isOutputTargetGlobalStyle as oi, OutputTargetSsrWasm as on, JsonDocsEvent as or, Config as ot, WorkerMsgHandler as p, TYPES as pa, isOutputTargetWww as pi, PlatformPath as pn, JsonDocsStyle as pr, CustomElementsExportBehaviorOptions as pt, CompilerRequest as q, DOCS_CUSTOM as qi, FunctionalComponent as qn, getComponentsFromModules as qr, OutputTargetCollection as qt, ComponentCompilerMeta as r, LISTENER_FLAGS as ra, isOutputTargetDocsJson as ri, OutputTargetGlobalStyle as rn, JsonDocsComponent as rr, CompilerSystemRenamedPath as rt, LazyBundlesRuntimeData as s, SSR as sa, isOutputTargetLoaderBundle as si, OutputTargetStandalone as sn, JsonDocsListener as sr, ConfigBundle as st, ChildType as t, HOST_FLAGS as ta, isOutputTargetDocsCustom as ti, OutputTargetDocsReadme as tn, JsonDocMethodParameter as tr, CompilerSystemRemoveFileResults as tt, PropsType as u, STATS as ua, isOutputTargetStandalone as ui, OutputTargetWww as un, JsonDocsPart as ur, CopyTask as ut, BuildNoChangeResults as v, buildError as vi, PrerenderStartOptions as vn, StyleDoc as vr, DocsReadmeCustomColumn as vt, CacheStorage as w, shouldIgnoreError as wi, RolldownConfig as wn, addDocBlock as wr, HydrateDocumentOptions as wt, BuildOutput as x, catchError as xi, ResolveModuleOptions as xn, validateComponentModes as xr, HmrGlobalStyleUpdate as xt, BuildOnEventRemove as y, buildJsonFileError as yi, ResolveModuleIdOptions as yn, FsWriteResults as yr, FsWatchResults as yt, CompilerEventFileDelete as z, COLLECTION as zi, UnvalidatedConfig as zn, getSourceMappingUrlLinker as zr, OptimizeCssOutput as zt };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, w as Build, x as setPlatformHelpers, y as readTask } from "./client-
|
|
1
|
+
import { C as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, w as Build, x as setPlatformHelpers, y as readTask } from "./client-NHI55T4R.mjs";
|
|
2
2
|
import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
|
|
3
3
|
//#region src/client/client-decorators.ts
|
|
4
4
|
/**
|
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import "./client-
|
|
2
|
+
import "./client-NHI55T4R.mjs";
|
|
3
3
|
import { c as isFunction, f as isString, m as noop, r as flatOne } from "./helpers-Cpp3qc3u.mjs";
|
|
4
4
|
import { $ as catchError, K as normalizePath, X as buildError, Y as TASK_CANCELED_MSG, nt as shouldIgnoreError, rt as isGlob } from "./util-IKfWWLJo.mjs";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -494,8 +494,8 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
494
494
|
//#endregion
|
|
495
495
|
//#region src/client/client-style.ts
|
|
496
496
|
const styles = /*@__PURE__*/ new Map();
|
|
497
|
-
const
|
|
498
|
-
const
|
|
497
|
+
const modeResolver = [];
|
|
498
|
+
const setScopedSSR = (_opts) => {};
|
|
499
499
|
const needsScopedSSR = () => false;
|
|
500
500
|
//#endregion
|
|
501
501
|
//#region src/runtime/runtime-constants.ts
|
|
@@ -1853,10 +1853,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1853
1853
|
const isComplex = isComplexType(newValue);
|
|
1854
1854
|
if (!BUILD.lazyLoad) {
|
|
1855
1855
|
const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
|
|
1856
|
-
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" &&
|
|
1856
|
+
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
|
|
1857
1857
|
if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
|
|
1858
1858
|
elm["s-pp"].set(memberName, newValue);
|
|
1859
|
-
return;
|
|
1859
|
+
if (isComplex || /[A-Z]/.test(memberName)) return;
|
|
1860
1860
|
}
|
|
1861
1861
|
}
|
|
1862
1862
|
if ((isProp || isComplex && newValue !== null) && !isSvg) try {
|
|
@@ -4134,8 +4134,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
4134
4134
|
};
|
|
4135
4135
|
//#endregion
|
|
4136
4136
|
//#region src/runtime/mode.ts
|
|
4137
|
-
const computeMode = (elm) =>
|
|
4138
|
-
const setMode = (handler) =>
|
|
4137
|
+
const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
|
|
4138
|
+
const setMode = (handler) => {
|
|
4139
|
+
modeResolver.length = 0;
|
|
4140
|
+
modeResolver.push(handler);
|
|
4141
|
+
};
|
|
4139
4142
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
4140
4143
|
//#endregion
|
|
4141
4144
|
//#region src/runtime/normalize-watchers.ts
|
|
@@ -4200,23 +4203,14 @@ const normalizeWatchers = (raw) => {
|
|
|
4200
4203
|
*
|
|
4201
4204
|
* @param propValue the new value to coerce to some type
|
|
4202
4205
|
* @param propType the type of the prop, expressed as a binary number
|
|
4203
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
4204
4206
|
* @returns the parsed/coerced value
|
|
4205
4207
|
*/
|
|
4206
|
-
const parsePropertyValue = (propValue, propType
|
|
4208
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
4207
4209
|
if (propValue != null && !isComplexType(propValue)) {
|
|
4208
4210
|
/**
|
|
4209
4211
|
* ensure this value is of the correct prop type
|
|
4210
4212
|
*/
|
|
4211
|
-
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean)
|
|
4212
|
-
/**
|
|
4213
|
-
* For form-associated components, according to HTML spec, the presence of any boolean attribute
|
|
4214
|
-
* (regardless of its value, even "false") should make the property true.
|
|
4215
|
-
* For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
|
|
4216
|
-
*/
|
|
4217
|
-
if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
|
|
4218
|
-
else return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
4219
|
-
}
|
|
4213
|
+
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
4220
4214
|
/**
|
|
4221
4215
|
* force it to be a number
|
|
4222
4216
|
*/
|
|
@@ -4258,7 +4252,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4258
4252
|
if (BUILD.signalBacking) {
|
|
4259
4253
|
const sig = hostRef?.$signalValues$?.get(propName);
|
|
4260
4254
|
if (sig !== void 0) {
|
|
4261
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
4255
|
+
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4262
4256
|
if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
4263
4257
|
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4264
4258
|
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
@@ -4276,7 +4270,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4276
4270
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
4277
4271
|
const flags = hostRef.$flags$;
|
|
4278
4272
|
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
4279
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
4273
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4280
4274
|
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
4281
4275
|
if ((!BUILD.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
4282
4276
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
@@ -4325,6 +4319,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4325
4319
|
*/
|
|
4326
4320
|
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
4327
4321
|
/**
|
|
4322
|
+
* Hand values written to a lazy component's element before its instance existed to the
|
|
4323
|
+
* instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
|
|
4324
|
+
* whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
|
|
4325
|
+
*
|
|
4326
|
+
* @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
|
|
4327
|
+
* @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
|
|
4328
|
+
*/
|
|
4329
|
+
const replayPendingSetterValues = (hostRef, cmpMeta) => {
|
|
4330
|
+
const instance = hostRef.$lazyInstance$;
|
|
4331
|
+
if (!instance) return;
|
|
4332
|
+
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
|
|
4333
|
+
const pendingValue = hostRef.$instanceValues$.get(memberName);
|
|
4334
|
+
if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
|
|
4335
|
+
}
|
|
4336
|
+
};
|
|
4337
|
+
/**
|
|
4328
4338
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
4329
4339
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
4330
4340
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4381,9 +4391,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4381
4391
|
if (BUILD.lazyLoad) {
|
|
4382
4392
|
if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
|
|
4383
4393
|
const ref = getHostRef(this);
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
return instance[memberName];
|
|
4394
|
+
if (!ref) return prototype[memberName];
|
|
4395
|
+
return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
|
|
4387
4396
|
}
|
|
4388
4397
|
if (!BUILD.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
|
4389
4398
|
},
|
|
@@ -4398,7 +4407,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4398
4407
|
}
|
|
4399
4408
|
if (origSetter) {
|
|
4400
4409
|
if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
|
|
4401
|
-
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags
|
|
4410
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
|
4402
4411
|
newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
|
|
4403
4412
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4404
4413
|
return;
|
|
@@ -4410,26 +4419,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4410
4419
|
if (BUILD.lazyLoad) {
|
|
4411
4420
|
if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
|
|
4412
4421
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4413
|
-
if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
|
|
4414
|
-
if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
|
|
4415
|
-
});
|
|
4416
4422
|
return;
|
|
4417
4423
|
}
|
|
4418
|
-
const parsedValue = parsePropertyValue(newValue, memberFlags
|
|
4419
|
-
|
|
4424
|
+
const parsedValue = parsePropertyValue(newValue, memberFlags);
|
|
4425
|
+
if (ref.$lazyInstance$) {
|
|
4420
4426
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
4421
4427
|
if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
|
|
4422
|
-
ref.$lazyInstance$[memberName] =
|
|
4428
|
+
ref.$lazyInstance$[memberName] = parsedValue;
|
|
4423
4429
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
4424
|
-
};
|
|
4425
|
-
if (ref.$lazyInstance$) setterSetVal(parsedValue);
|
|
4426
|
-
else {
|
|
4427
|
-
ref.$instanceValues$.set(memberName, parsedValue);
|
|
4428
|
-
ref.$fetchedCbList$.push(() => {
|
|
4429
|
-
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
4430
|
-
if (ref.$lazyInstance$[memberName] !== pendingValue) setterSetVal(pendingValue);
|
|
4431
|
-
});
|
|
4432
|
-
}
|
|
4430
|
+
} else ref.$instanceValues$.set(memberName, parsedValue);
|
|
4433
4431
|
}
|
|
4434
4432
|
} });
|
|
4435
4433
|
} else if (BUILD.lazyLoad && BUILD.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
|
|
@@ -4481,10 +4479,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4481
4479
|
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4482
4480
|
if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4483
4481
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4484
|
-
if (isBooleanTarget)
|
|
4485
|
-
|
|
4482
|
+
if (isBooleanTarget) {
|
|
4483
|
+
if (BUILD.isDev && newValue === "false") consoleDevWarn(`<${cmpMeta.$tagName$} ${attrName}="false">: boolean attributes are true when present, regardless of value. Remove the attribute or set the "${propName}" property to false instead.`);
|
|
4484
|
+
newValue = newValue !== null;
|
|
4485
|
+
}
|
|
4486
4486
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4487
|
-
if (!isSpuriousBooleanRemoval && newValue !=
|
|
4487
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4488
4488
|
});
|
|
4489
4489
|
};
|
|
4490
4490
|
Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -4545,7 +4545,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4545
4545
|
} catch (e) {
|
|
4546
4546
|
consoleError(e, elm);
|
|
4547
4547
|
}
|
|
4548
|
-
if (BUILD.member)
|
|
4548
|
+
if (BUILD.member) {
|
|
4549
|
+
hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
|
|
4550
|
+
replayPendingSetterValues(hostRef, cmpMeta);
|
|
4551
|
+
}
|
|
4549
4552
|
endNewInstance();
|
|
4550
4553
|
if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
|
|
4551
4554
|
if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
@@ -4765,48 +4768,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
|
|
|
4765
4768
|
`${modulePath}?s-hmr=${hmrVersionId}`
|
|
4766
4769
|
);
|
|
4767
4770
|
const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
|
|
4768
|
-
if (
|
|
4769
|
-
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4770
|
-
if (ctor) {
|
|
4771
|
-
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4772
|
-
if (key === "constructor") continue;
|
|
4773
|
-
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4774
|
-
}
|
|
4775
|
-
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4776
|
-
if (styleDesc) {
|
|
4777
|
-
Object.defineProperty(ctor, "style", styleDesc);
|
|
4778
|
-
const newStyle = NewClass.style;
|
|
4779
|
-
if (newStyle) {
|
|
4780
|
-
const scopeId = getScopeId(cmpMeta);
|
|
4781
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4782
|
-
console.log("[stencil-hmr] registerStyle", {
|
|
4783
|
-
tag: cmpMeta.$tagName$,
|
|
4784
|
-
scopeId,
|
|
4785
|
-
isShadow,
|
|
4786
|
-
cssLen: newStyle.length
|
|
4787
|
-
});
|
|
4788
|
-
registerStyle(scopeId, newStyle, isShadow);
|
|
4789
|
-
}
|
|
4790
|
-
}
|
|
4791
|
-
}
|
|
4792
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4793
|
-
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4794
|
-
const hostRef = getHostRef(el);
|
|
4795
|
-
if (BUILD.hostListener && hostRef?.$rmListeners$) {
|
|
4796
|
-
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4797
|
-
hostRef.$rmListeners$ = void 0;
|
|
4798
|
-
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4799
|
-
}
|
|
4800
|
-
if (!isShadow && hostRef) {
|
|
4801
|
-
console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
|
|
4802
|
-
attachStyles(hostRef);
|
|
4803
|
-
}
|
|
4804
|
-
forceUpdate(el);
|
|
4805
|
-
});
|
|
4771
|
+
if (NewClass) hmrApplyClass(cmpMeta, NewClass);
|
|
4806
4772
|
} catch (e) {
|
|
4807
4773
|
console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
|
|
4808
4774
|
}
|
|
4809
4775
|
};
|
|
4776
|
+
/**
|
|
4777
|
+
* Patch a re-executed component class onto the registered one and re-render every live instance.
|
|
4778
|
+
* Shared by the standalone re-import above and bundlers that re-execute the module themselves
|
|
4779
|
+
* (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
|
|
4780
|
+
*
|
|
4781
|
+
* @param cmpMeta runtime metadata for the component
|
|
4782
|
+
* @param NewClass the component's newly executed class
|
|
4783
|
+
*/
|
|
4784
|
+
const hmrApplyClass = (cmpMeta, NewClass) => {
|
|
4785
|
+
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4786
|
+
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4787
|
+
if (ctor && ctor !== NewClass) {
|
|
4788
|
+
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4789
|
+
if (key === "constructor") continue;
|
|
4790
|
+
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4791
|
+
}
|
|
4792
|
+
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4793
|
+
if (styleDesc) {
|
|
4794
|
+
Object.defineProperty(ctor, "style", styleDesc);
|
|
4795
|
+
const newStyle = NewClass.style;
|
|
4796
|
+
if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4800
|
+
const hostRef = getHostRef(el);
|
|
4801
|
+
if (BUILD.hostListener && hostRef?.$rmListeners$) {
|
|
4802
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4803
|
+
hostRef.$rmListeners$ = void 0;
|
|
4804
|
+
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4805
|
+
}
|
|
4806
|
+
if (!isShadow && hostRef) attachStyles(hostRef);
|
|
4807
|
+
forceUpdate(el);
|
|
4808
|
+
});
|
|
4809
|
+
};
|
|
4810
4810
|
//#endregion
|
|
4811
4811
|
//#region src/runtime/bootstrap-standalone.ts
|
|
4812
4812
|
const defineCustomElement = (Cstr, compactMeta) => {
|
|
@@ -4829,9 +4829,12 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4829
4829
|
cmpMeta.$serializers$ = Cstr.$serializers$;
|
|
4830
4830
|
}
|
|
4831
4831
|
if (BUILD.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4832
|
-
if (BUILD.hotModuleReplacement)
|
|
4833
|
-
|
|
4834
|
-
|
|
4832
|
+
if (BUILD.hotModuleReplacement) {
|
|
4833
|
+
Cstr.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4834
|
+
hmrStart(this, cmpMeta, hmrVersionId);
|
|
4835
|
+
};
|
|
4836
|
+
Cstr["s-hmr-apply"] = (NewClass) => hmrApplyClass(cmpMeta, NewClass);
|
|
4837
|
+
}
|
|
4835
4838
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD.slotCloneNode || BUILD.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(Cstr.prototype);
|
|
4836
4839
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
|
|
4837
4840
|
if (BUILD.lightDomPatches || BUILD.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(Cstr.prototype);
|
|
@@ -5347,4 +5350,4 @@ function hasKeys(obj) {
|
|
|
5347
5350
|
return false;
|
|
5348
5351
|
}
|
|
5349
5352
|
//#endregion
|
|
5350
|
-
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, ReactiveControllerHost, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, injectSideEffectStyle, isMemberInElement, jsx, jsxDEV, jsxs, loadModule,
|
|
5353
|
+
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, ReactiveControllerHost, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, injectSideEffectStyle, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolver, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, registerSideEffectStyleTarget, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSSR, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, unregisterSideEffectStyleTarget, win, writeTask };
|