marko 5.25.6 → 5.25.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -357,3 +357,46 @@ _components/color-rotate-button/index.marko_
357
357
  <${input.renderBody}/>
358
358
  </button>
359
359
  ```
360
+
361
+ ## Extend Native Tags (for custom elements)
362
+
363
+ ```ts
364
+ interface MyCustomElementAttributes {
365
+ // ...
366
+ }
367
+
368
+ declare global {
369
+ namespace Marko {
370
+ namespace NativeTags {
371
+ // By adding this entry, you can now use `my-custom-element` as a native html tag.
372
+ "my-custom-element": MyCustomElementAttributes
373
+ }
374
+ }
375
+ }
376
+ ```
377
+
378
+ ## Extending the "global" HTML Attributes
379
+
380
+ ```ts
381
+ declare global {
382
+ namespace Marko {
383
+ interface HTMLAttributes {
384
+ "my-non-standard-attribute"?: string; // Adds this attribute as available on all HTML tags.
385
+ }
386
+ }
387
+ }
388
+ ```
389
+
390
+ ## Extending CSS Properties (for custom properties)
391
+
392
+ ```ts
393
+ declare global {
394
+ namespace Marko {
395
+ namespace CSS {
396
+ interface Properties {
397
+ "--foo"?: string; // adds a support for a custom `--foo` css property.
398
+ }
399
+ }
400
+ }
401
+ }
402
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.25.6",
3
+ "version": "5.25.8",
4
4
  "license": "MIT",
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "dependencies": {
package/tags-html.d.ts CHANGED
@@ -124,6 +124,10 @@ declare global {
124
124
  wbr: Tag<_.Marko·Inputᐸʺwbrʺᐳ>;
125
125
  }
126
126
 
127
+ namespace CSS {
128
+ export interface Properties extends csstype.PropertiesHyphen {}
129
+ }
130
+
127
131
  namespace HTML {
128
132
  interface A extends HTMLAttributes<HTMLAnchorElement> {
129
133
  /**
@@ -1046,7 +1050,7 @@ declare global {
1046
1050
  * Specifies whether the input field should have autocomplete enabled or disabled.
1047
1051
  * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete
1048
1052
  */
1049
- autocomplete?: AttrOnOff;
1053
+ autocomplete?: AttrAutoComplete;
1050
1054
 
1051
1055
  /**
1052
1056
  * Indicates whether a file input should use a specific capture method.
@@ -1128,7 +1132,7 @@ declare global {
1128
1132
  * The maximum allowed value for the input.
1129
1133
  * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-max
1130
1134
  */
1131
- max?: AttrString;
1135
+ max?: AttrStringOrNumber;
1132
1136
 
1133
1137
  /**
1134
1138
  * The maximum number of characters allowed in the input.
@@ -1140,7 +1144,7 @@ declare global {
1140
1144
  * The minimum allowed value for the input.
1141
1145
  * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-min
1142
1146
  */
1143
- min?: AttrString;
1147
+ min?: AttrStringOrNumber;
1144
1148
 
1145
1149
  /**
1146
1150
  * The minimum number of characters required in the input.
@@ -1171,7 +1175,7 @@ declare global {
1171
1175
  * A short hint to display in the input field before the user enters a value.
1172
1176
  * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-placeholder
1173
1177
  */
1174
- placeholder?: AttrString;
1178
+ placeholder?: AttrStringOrNumber;
1175
1179
 
1176
1180
  /**
1177
1181
  * Specifies the target element for the popover.
@@ -1213,7 +1217,7 @@ declare global {
1213
1217
  * Specifies the allowed number intervals for the input value.
1214
1218
  * @see https://html.spec.whatwg.org/multipage/input.html#attr-input-step
1215
1219
  */
1216
- step?: AttrString;
1220
+ step?: AttrStringOrNumber;
1217
1221
 
1218
1222
  /**
1219
1223
  * Controls the data type (and associated control) of the element.
@@ -1775,7 +1779,7 @@ declare global {
1775
1779
  * Controls whether the browser should automatically complete the value for the select.
1776
1780
  * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete
1777
1781
  */
1778
- autocomplete?: AttrOnOff;
1782
+ autocomplete?: AttrAutoComplete;
1779
1783
 
1780
1784
  /**
1781
1785
  * Indicates whether the select element should be disabled or not.
@@ -1983,7 +1987,7 @@ declare global {
1983
1987
  * Helps browsers autofill the user's input based on previous entries.
1984
1988
  * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete
1985
1989
  */
1986
- autocomplete?: AttrOnOff;
1990
+ autocomplete?: AttrAutoComplete;
1987
1991
 
1988
1992
  /**
1989
1993
  * (Safari only). Controls the autocorrect behavior of the <textarea> element.
@@ -3630,29 +3634,7 @@ declare global {
3630
3634
  type Marko·Inputᐸʺiʺᐳ = { [K in keyof HTML.I]: HTML.I[K] };
3631
3635
  type Marko·Inputᐸʺiframeʺᐳ = { [K in keyof HTML.IFrame]: HTML.IFrame[K] };
3632
3636
  type Marko·Inputᐸʺimgʺᐳ = { [K in keyof HTML.Img]: HTML.Img[K] };
3633
- type Marko·Inputᐸʺinputʺᐳ = {} & (
3634
- | HTML.InputHidden
3635
- | HTML.InputText
3636
- | HTML.InputTel
3637
- | HTML.InputURL
3638
- | HTML.InputEmail
3639
- | HTML.InputPassword
3640
- | HTML.InputDate
3641
- | HTML.InputMonth
3642
- | HTML.InputWeek
3643
- | HTML.InputTime
3644
- | HTML.InputDateTimeLocal
3645
- | HTML.InputNumber
3646
- | HTML.InputRange
3647
- | HTML.InputColor
3648
- | HTML.InputCheckbox
3649
- | HTML.InputRadio
3650
- | HTML.InputFile
3651
- | HTML.InputSubmit
3652
- | HTML.InputImage
3653
- | HTML.InputReset
3654
- | HTML.InputButton
3655
- );
3637
+ type Marko·Inputᐸʺinputʺᐳ = { [K in keyof HTML.Input]: HTML.Input[K] };
3656
3638
  type Marko·Inputᐸʺinsʺᐳ = { [K in keyof HTML.Ins]: HTML.Ins[K] };
3657
3639
  type Marko·Inputᐸʺkbdʺᐳ = { [K in keyof HTML.Kbd]: HTML.Kbd[K] };
3658
3640
  type Marko·Inputᐸʺlabelʺᐳ = { [K in keyof HTML.Label]: HTML.Label[K] };
@@ -3737,7 +3719,7 @@ type AttrClass =
3737
3719
  | string
3738
3720
  | AttrClass[]
3739
3721
  | Record<string, AttrMissing | boolean>;
3740
- type AttrStyle = AttrMissing | string | csstype.PropertiesHyphen | AttrStyle[];
3722
+ type AttrStyle = AttrMissing | string | Marko.CSS.Properties | AttrStyle[];
3741
3723
  type AttrCrossOrigin = AttrBoolean | "anonymous" | "use-credentials";
3742
3724
  type AttrEventHandler<Event, Target> =
3743
3725
  | AttrMissing
@@ -3767,33 +3749,60 @@ type AttrBooleanString = AttrMissing | "false" | "true";
3767
3749
  type AttrYesNoString = AttrMissing | "no" | "yes";
3768
3750
  type AttrTriState = AttrBooleanString | "mixed";
3769
3751
  type AttrOnOff = AttrMissing | "on" | "off";
3752
+ type AttrAutoComplete =
3753
+ | AttrOnOff
3754
+ | "shipping"
3755
+ | "billing"
3756
+ | "name"
3757
+ | "honorific-prefix"
3758
+ | "given-name"
3759
+ | "additional-name"
3760
+ | "family-name"
3761
+ | "honorific-suffix"
3762
+ | "nickname"
3763
+ | "username"
3764
+ | "new-password"
3765
+ | "current-password"
3766
+ | "one-time-code"
3767
+ | "organization-title"
3768
+ | "organization"
3769
+ | "street-address"
3770
+ | "address-line1"
3771
+ | "address-line2"
3772
+ | "address-line3"
3773
+ | "address-level4"
3774
+ | "address-level3"
3775
+ | "address-level2"
3776
+ | "address-level1"
3777
+ | "country"
3778
+ | "country-name"
3779
+ | "postal-code"
3780
+ | "cc-name"
3781
+ | "cc-given-name"
3782
+ | "cc-additional-name"
3783
+ | "cc-family-name"
3784
+ | "cc-number"
3785
+ | "cc-exp"
3786
+ | "cc-exp-month"
3787
+ | "cc-exp-year"
3788
+ | "cc-csc"
3789
+ | "cc-type"
3790
+ | "transaction-currency"
3791
+ | "transaction-amount"
3792
+ | "language"
3793
+ | "bday"
3794
+ | "bday-day"
3795
+ | "bday-month"
3796
+ | "bday-year"
3797
+ | "sex"
3798
+ | "url"
3799
+ | "photo"
3800
+ | "home"
3801
+ | "work"
3802
+ | "mobile"
3803
+ | "fax"
3804
+ | "pager"
3805
+ | (string & {});
3770
3806
  type Tag<Input> = Input extends Marko.HTMLAttributes<infer Element>
3771
3807
  ? Marko.NativeTag<Input, Element>
3772
3808
  : never;
3773
- type UpperCaseChar =
3774
- | "A"
3775
- | "B"
3776
- | "C"
3777
- | "D"
3778
- | "E"
3779
- | "F"
3780
- | "G"
3781
- | "H"
3782
- | "I"
3783
- | "J"
3784
- | "K"
3785
- | "L"
3786
- | "M"
3787
- | "N"
3788
- | "O"
3789
- | "P"
3790
- | "Q"
3791
- | "R"
3792
- | "S"
3793
- | "T"
3794
- | "U"
3795
- | "V"
3796
- | "W"
3797
- | "X"
3798
- | "Y"
3799
- | "Z";