marko 5.25.6 → 5.25.7
Sign up to get free protection for your applications and to get access to all the features.
- package/docs/typescript.md +43 -0
- package/package.json +1 -1
- package/tags-html.d.ts +6 -24
package/docs/typescript.md
CHANGED
@@ -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
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
|
/**
|
@@ -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 |
|
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
|