dothtml-interfaces 6.0.5 → 6.0.6
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/package.json +1 -1
- package/src/i-dot.ts +6 -5
- package/src/index.ts +2 -0
- package/src/styles/i-dot-css.ts +2 -5
- package/src/styles/i-dot-style-builder.ts +13 -0
package/package.json
CHANGED
package/src/i-dot.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {IReactive} from "./bindings/i-reactive";
|
|
|
6
6
|
import { IBinding } from "./bindings/i-binding";
|
|
7
7
|
import { IWatcher } from "./bindings/i-watcher";
|
|
8
8
|
import IDotcssProp from "./styles/i-css-prop";
|
|
9
|
+
import { IDotStyleBuilder } from "./styles/i-dot-style-builder";
|
|
9
10
|
import { IRef } from "./bindings/i-ref";
|
|
10
11
|
|
|
11
12
|
export type DotContentPrimitive = string | number | boolean | undefined | null;
|
|
@@ -51,15 +52,15 @@ export interface IDotDocument {
|
|
|
51
52
|
/**
|
|
52
53
|
* Creates a generic HTML node that can render a string, HTML nodes, or dotHTML content.
|
|
53
54
|
*/
|
|
54
|
-
html(content:
|
|
55
|
+
html(content: DotContent): IDotDocument;
|
|
55
56
|
/**
|
|
56
57
|
* Creates a text node that will render as a string, rather than being parsed as markup.
|
|
57
58
|
*/
|
|
58
|
-
text(content:
|
|
59
|
+
text(content: DotContent): IDotDocument;
|
|
59
60
|
/**
|
|
60
61
|
* Creates a text node that will render as a string, rather than being parsed as markup.
|
|
61
62
|
*/
|
|
62
|
-
md(content:
|
|
63
|
+
md(content: DotContent): IDotDocument;
|
|
63
64
|
/**
|
|
64
65
|
* Mounts a component or appends content.
|
|
65
66
|
*/
|
|
@@ -94,7 +95,7 @@ export interface IDotDocument {
|
|
|
94
95
|
*/
|
|
95
96
|
remove(): void;
|
|
96
97
|
|
|
97
|
-
style(c: string | ISignal<any> | IBinding<any, any> |
|
|
98
|
+
style(c: string | ISignal<any> | IBinding<any, any> | IDotcssProp | IDotStyleBuilder | ((s: IDotStyleBuilder) => void)): this;
|
|
98
99
|
attr(name: string, value: any): this;
|
|
99
100
|
on(event: string, callback: (e: any) => void): this;
|
|
100
101
|
onEnter(callback: (el: HTMLElement) => void): this;
|
|
@@ -460,7 +461,7 @@ export interface IDotGlobalAttrs<T extends HTMLElement = HTMLElement> {
|
|
|
460
461
|
part?: AttrVal<string>;
|
|
461
462
|
role?: AttrVal<string>;
|
|
462
463
|
spellCheck?: AttrVal<"true"> | AttrVal<"false">;
|
|
463
|
-
style?: AttrVal<string> | IDotcssProp | ((s:
|
|
464
|
+
style?: AttrVal<string> | IDotcssProp | IDotStyleBuilder | ((s: IDotStyleBuilder) => void);
|
|
464
465
|
tabIndex?: AttrVal<number>;
|
|
465
466
|
title?: AttrVal<string>;
|
|
466
467
|
translate?: AttrVal<string>;
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from "./i-dot";
|
|
|
4
4
|
|
|
5
5
|
export { default as IDotCss } from "./styles/i-dot-css";
|
|
6
6
|
export * from "./styles/i-dot-css";
|
|
7
|
+
export { default as IDotcssProp } from "./styles/i-css-prop";
|
|
8
|
+
export { IDotStyleBuilder } from "./styles/i-dot-style-builder";
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
export { default as IDotComponent, FrameworkItems } from "./i-dot-component";
|
package/src/styles/i-dot-css.ts
CHANGED
|
@@ -6,6 +6,7 @@ import IAtFontPaletteValues from "./at-rules/i-at-font-palette-values";
|
|
|
6
6
|
import IAtKeyframesBuilder from "./at-rules/i-at-keyframes-builder";
|
|
7
7
|
import IAtPageBuilder from "./at-rules/i-at-page-builder";
|
|
8
8
|
import IDotcssProp from "./i-css-prop";
|
|
9
|
+
import { IDotStyleBuilder } from "./i-dot-style-builder";
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
@@ -148,7 +149,7 @@ type Flex = `${number}fr`;
|
|
|
148
149
|
// type FlexFlowShorthand = BasicCommonValues|`${FlexDirectionNames} ${FlexWrapNames}`;
|
|
149
150
|
// type FlexShorthand = BasicCommonValues|`${BasicCommonValues|number} ${BasicCommonValues|number} ${BasicCommonValues|`${number}${AllLengthUnits}`}`;
|
|
150
151
|
|
|
151
|
-
export default interface IDotCss extends
|
|
152
|
+
export default interface IDotCss extends IDotStyleBuilder{
|
|
152
153
|
// TODO: ensure each of these has test cases.
|
|
153
154
|
// Right now, most of these don't actually work. But they're typed so that they can progressively be added to the librrary.
|
|
154
155
|
(selector: "@charset", charset: string): void;
|
|
@@ -177,10 +178,6 @@ export default interface IDotCss extends IDotcssProp{
|
|
|
177
178
|
(selector: Array<HTMLElement>|HTMLElement|string, styles: IDotcssProp): void;
|
|
178
179
|
(styles: IDotcssProp): void;
|
|
179
180
|
|
|
180
|
-
variable(name: string, value: any): this;
|
|
181
|
-
v(name: string): string;
|
|
182
|
-
[prop: string]: any;
|
|
183
|
-
|
|
184
181
|
version: string;
|
|
185
182
|
}
|
|
186
183
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import IDotcssProp from "./i-css-prop";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A fluent builder for CSS properties.
|
|
5
|
+
* Transforms all properties from IDotcssProp into methods that return the builder.
|
|
6
|
+
*/
|
|
7
|
+
export type IDotStyleBuilder = {
|
|
8
|
+
[K in keyof IDotcssProp]-?: (value: Exclude<IDotcssProp[K], undefined>) => IDotStyleBuilder;
|
|
9
|
+
} & {
|
|
10
|
+
variable(name: string, value: any): IDotStyleBuilder;
|
|
11
|
+
v(name: string): string;
|
|
12
|
+
[prop: string]: any;
|
|
13
|
+
};
|