@stencil/core 5.0.0-beta.11 → 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.
@@ -137,7 +137,7 @@ const setErrorHandler = (handler) => customError = handler;
137
137
  //#endregion
138
138
  //#region src/client/client-style.ts
139
139
  const styles = /*@__PURE__*/ new Map();
140
- const modeResolutionChain = [];
140
+ const modeResolver = [];
141
141
  //#endregion
142
142
  //#region src/runtime/runtime-constants.ts
143
143
  /**
@@ -863,10 +863,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
863
863
  const isComplex = isComplexType(newValue);
864
864
  if (!BUILD.lazyLoad) {
865
865
  const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
866
- if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && typeof customElements !== "undefined" && !customElements.get(elm.tagName.toLowerCase())) {
866
+ if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
867
867
  if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
868
868
  elm["s-pp"].set(memberName, newValue);
869
- return;
869
+ if (isComplex || /[A-Z]/.test(memberName)) return;
870
870
  }
871
871
  }
872
872
  if ((isProp || isComplex && newValue !== null) && !isSvg) try {
@@ -2228,7 +2228,10 @@ const validateInputProperties = (inputElm) => {
2228
2228
  };
2229
2229
  //#endregion
2230
2230
  //#region src/runtime/mode.ts
2231
- const setMode = (handler) => modeResolutionChain.push(handler);
2231
+ const setMode = (handler) => {
2232
+ modeResolver.length = 0;
2233
+ modeResolver.push(handler);
2234
+ };
2232
2235
  const getMode = (ref) => getHostRef(ref)?.$modeName$;
2233
2236
  //#endregion
2234
2237
  //#region src/runtime/mixin.ts
@@ -1,11 +1,77 @@
1
1
  import ts from "typescript";
2
2
  import "rolldown";
3
3
  //#region src/declarations/stencil-public-docs.d.ts
4
+ /**
5
+ * A descriptor for a single JSDoc tag found in a block comment
6
+ */
7
+ interface JsonDocsTag {
8
+ /**
9
+ * The tag name (immediately following the '@')
10
+ */
11
+ name: string;
12
+ /**
13
+ * The description that immediately follows the tag name
14
+ */
15
+ text?: string;
16
+ }
4
17
  interface JsonDocMethodParameter {
5
18
  name: string;
6
19
  type: string;
7
20
  docs: string;
8
21
  }
22
+ /**
23
+ * A descriptor for a Custom State defined via @AttachInternals({ states: {...} })
24
+ *
25
+ * Custom states are exposed via the ElementInternals.states CustomStateSet
26
+ * and can be targeted with the CSS `:state()` pseudo-class.
27
+ *
28
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet
29
+ */
30
+ interface JsonDocsCustomState {
31
+ /**
32
+ * The name of the custom state (without dashes)
33
+ */
34
+ name: string;
35
+ /**
36
+ * The initial/default value of the state
37
+ */
38
+ initialValue: boolean;
39
+ /**
40
+ * A textual description of the custom state
41
+ */
42
+ docs: string;
43
+ }
44
+ /**
45
+ * Represents a parsed block comment in a CSS, Sass, etc. file for a custom property.
46
+ */
47
+ interface StyleDoc {
48
+ /**
49
+ * The name of the CSS property
50
+ */
51
+ name: string;
52
+ /**
53
+ * The user-defined description of the CSS property
54
+ */
55
+ docs: string;
56
+ /**
57
+ * The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
58
+ * Used to inform Stencil where the start of a new property's description starts (and where the previous description
59
+ * ends).
60
+ */
61
+ annotation: 'prop';
62
+ /**
63
+ * The Stencil style-mode that is associated with this property.
64
+ */
65
+ mode: string | undefined;
66
+ /**
67
+ * The CSS `syntax` descriptor, if this property was registered via a native `@property` at-rule.
68
+ */
69
+ syntax?: string;
70
+ /**
71
+ * The `initial-value` descriptor, if this property was registered via a native `@property` at-rule.
72
+ */
73
+ default?: string;
74
+ }
9
75
  //#endregion
10
76
  //#region src/declarations/stencil-public-runtime.d.ts
11
77
  type ListenTargetOptions = 'body' | 'document' | 'window';
@@ -367,6 +433,7 @@ interface CompilerBuildResults {
367
433
  buildId: number;
368
434
  componentGraph?: BuildResultsComponentGraph;
369
435
  components: ComponentCompilerMeta[];
436
+ cssOnlyComponents: ComponentCompilerMeta[];
370
437
  diagnostics: Diagnostic[];
371
438
  dirsAdded: string[];
372
439
  dirsDeleted: string[];
@@ -383,6 +450,15 @@ interface CompilerBuildResults {
383
450
  namespace: string;
384
451
  fsNamespace: string;
385
452
  outputs: BuildOutput[];
453
+ /**
454
+ * Absolute paths to every global stylesheet, in cascade order: each `global-style` output
455
+ * target's compiled CSS in the order those targets are declared in `config.outputTargets` - or,
456
+ * with none configured, the generated `{fsNamespace}.css` holding Stencil's auto-placed CSS (when
457
+ * emitted). Unlike `outputs`, which groups files by type and sorts them alphabetically, this
458
+ * preserves author-intended order for consumers like the dev-server's auto-generated component
459
+ * preview.
460
+ */
461
+ globalStyleFiles: string[];
386
462
  rootDir: string;
387
463
  srcDir: string;
388
464
  timestamp: string;
@@ -398,6 +474,7 @@ interface HotModuleReplacement {
398
474
  componentsUpdated?: string[];
399
475
  excludeHmr?: string[];
400
476
  externalStylesUpdated?: string[];
477
+ globalStylesUpdated?: HmrGlobalStyleUpdate[];
401
478
  imagesUpdated?: string[];
402
479
  indexHtmlUpdated?: boolean;
403
480
  inlineStylesUpdated?: HmrStyleUpdate[];
@@ -412,6 +489,15 @@ interface HmrStyleUpdate {
412
489
  styleTag: string;
413
490
  styleText: string;
414
491
  }
492
+ /**
493
+ * A live-reload update for a `global-style` output target's CSS. Applied on
494
+ * the client by matching `fileName` against the `<link>` that loads it and
495
+ * inserting/updating an adjacent `<style>` override
496
+ */
497
+ interface HmrGlobalStyleUpdate {
498
+ fileName: string;
499
+ styleText: string;
500
+ }
415
501
  type BuildOnEventRemove = () => boolean;
416
502
  interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
417
503
  unsubscribeAll(): void;
@@ -839,6 +925,12 @@ interface TranspileOptions {
839
925
  * that the specified flags take effect for this component at runtime.
840
926
  */
841
927
  buildOverrides?: BuildOverrides;
928
+ /**
929
+ * When `true`, a `.css`/`.scss` transpile also collects CSS custom-property docs
930
+ * onto {@link TranspileResults.styleDocs}. Off by default, since it costs an extra parse
931
+ * of the style text.
932
+ */
933
+ docs?: boolean;
842
934
  }
843
935
  /**
844
936
  * Keys of {@link BuildConditionals} that can be meaningfully overridden at
@@ -864,6 +956,7 @@ interface TranspileResults {
864
956
  inputFilePath: string;
865
957
  map: any;
866
958
  outputFilePath: string;
959
+ styleDocs?: StyleDoc[];
867
960
  }
868
961
  //#endregion
869
962
  //#region src/declarations/stencil-private.d.ts
@@ -1070,7 +1163,7 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1070
1163
  * Custom states to initialize on the ElementInternals.states CustomStateSet.
1071
1164
  * These are defined via @AttachInternals({ states: {...} }).
1072
1165
  */
1073
- attachInternalsCustomStates: ComponentCompilerCustomState[];
1166
+ attachInternalsCustomStates: JsonDocsCustomState[];
1074
1167
  componentClassName: string;
1075
1168
  /**
1076
1169
  * A list of web component tag names that are either:
@@ -1140,7 +1233,7 @@ interface ComponentCompilerMeta extends ComponentCompilerFeatures {
1140
1233
  sourceFilePath: string;
1141
1234
  sourceMapPath: string;
1142
1235
  states: ComponentCompilerState[];
1143
- styleDocs: CompilerStyleDoc[];
1236
+ styleDocs: StyleDoc[];
1144
1237
  styles: StyleCompiler[];
1145
1238
  globalStyles: ComponentGlobalStyle[];
1146
1239
  tagName: string;
@@ -1324,20 +1417,6 @@ interface ComponentCompilerState {
1324
1417
  * Custom states are exposed via the ElementInternals.states CustomStateSet
1325
1418
  * and can be targeted with the CSS :state() pseudo-class.
1326
1419
  */
1327
- interface ComponentCompilerCustomState {
1328
- /**
1329
- * The name of the custom state (without dashes)
1330
- */
1331
- name: string;
1332
- /**
1333
- * The initial value of the state
1334
- */
1335
- initialValue: boolean;
1336
- /**
1337
- * Optional JSDoc description for the state
1338
- */
1339
- docs: string;
1340
- }
1341
1420
  /**
1342
1421
  * Representation of JSDoc that is pulled off a node in the AST
1343
1422
  */
@@ -1349,44 +1428,7 @@ interface CompilerJsDoc {
1349
1428
  /**
1350
1429
  * Tags included in the JSDoc
1351
1430
  */
1352
- tags: CompilerJsDocTagInfo[];
1353
- }
1354
- /**
1355
- * Representation of a tag that exists in a JSDoc
1356
- */
1357
- interface CompilerJsDocTagInfo {
1358
- /**
1359
- * The name of the tag - e.g. `@deprecated`
1360
- */
1361
- name: string;
1362
- /**
1363
- * Additional text that is associated with the tag - e.g. `@deprecated use v2 of this API`
1364
- */
1365
- text?: string;
1366
- }
1367
- /**
1368
- * The (internal) representation of a CSS block comment in a CSS, Sass, etc. file. This data structure is used during
1369
- * the initial compilation phases of Stencil, as a piece of {@link ComponentCompilerMeta}.
1370
- */
1371
- interface CompilerStyleDoc {
1372
- /**
1373
- * The name of the CSS property
1374
- */
1375
- name: string;
1376
- /**
1377
- * The user-defined description of the CSS property
1378
- */
1379
- docs: string;
1380
- /**
1381
- * The JSDoc-style annotation (e.g. `@prop`) that was used in the block comment to detect the comment.
1382
- * Used to inform Stencil where the start of a new property's description starts (and where the previous description
1383
- * ends).
1384
- */
1385
- annotation: 'prop';
1386
- /**
1387
- * The Stencil style-mode that is associated with this property.
1388
- */
1389
- mode: string;
1431
+ tags: JsonDocsTag[];
1390
1432
  }
1391
1433
  interface CompilerAssetDir {
1392
1434
  absolutePath?: string;