@atomicsmash/blocks-helpers 4.0.0-beta.23 → 4.0.0-beta.25
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/block-supports.d.ts +2 -25
- package/dist/block-supports.d.ts.map +1 -1
- package/dist/default-attributes/index.d.ts +2 -2
- package/dist/default-attributes/index.d.ts.map +1 -1
- package/dist/default-attributes/layout.d.ts +3 -28
- package/dist/default-attributes/layout.d.ts.map +1 -1
- package/dist/default-attributes/style.d.ts +67 -0
- package/dist/default-attributes/style.d.ts.map +1 -0
- package/dist/default-attributes/style.test.d.ts +2 -0
- package/dist/default-attributes/style.test.d.ts.map +1 -0
- package/dist/default-attributes/style.test.js +59 -0
- package/dist/layout.d.ts +32 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +1 -0
- package/package.json +1 -1
- package/dist/default-attributes/background.d.ts +0 -43
- package/dist/default-attributes/background.d.ts.map +0 -1
- package/dist/default-attributes/background.test.d.ts +0 -2
- package/dist/default-attributes/background.test.d.ts.map +0 -1
- package/dist/default-attributes/background.test.js +0 -17
- /package/dist/default-attributes/{background.js → style.js} +0 -0
package/dist/block-supports.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AllPossibleLayouts } from "./layout";
|
|
1
2
|
export type BlockSupports = Record<string, any> & {
|
|
2
3
|
anchor?: boolean;
|
|
3
4
|
align?: boolean | ("wide" | "full" | "left" | "center" | "right")[];
|
|
@@ -38,31 +39,7 @@ export type BlockSupports = Record<string, any> & {
|
|
|
38
39
|
interactive?: boolean;
|
|
39
40
|
};
|
|
40
41
|
layout?: boolean | {
|
|
41
|
-
default?:
|
|
42
|
-
type: "default";
|
|
43
|
-
} | ({
|
|
44
|
-
type: "flex";
|
|
45
|
-
flexWrap?: "wrap" | "nowrap";
|
|
46
|
-
} & ({
|
|
47
|
-
orientation?: "horizontal";
|
|
48
|
-
justifyContent?: "left" | "center" | "right" | "space-between";
|
|
49
|
-
} | {
|
|
50
|
-
orientation: "vertical";
|
|
51
|
-
justifyContent?: "left" | "center" | "right" | "stretch";
|
|
52
|
-
})) | ({
|
|
53
|
-
type: "grid";
|
|
54
|
-
} & ({
|
|
55
|
-
minimumColumnWidth?: "12rem";
|
|
56
|
-
columnCount?: never;
|
|
57
|
-
} | {
|
|
58
|
-
minimumColumnWidth?: never;
|
|
59
|
-
columnCount?: 3;
|
|
60
|
-
})) | {
|
|
61
|
-
type: "constrained";
|
|
62
|
-
justifyContent?: "left" | "center" | "right";
|
|
63
|
-
contentSize?: string;
|
|
64
|
-
wideSize?: string;
|
|
65
|
-
};
|
|
42
|
+
default?: AllPossibleLayouts;
|
|
66
43
|
allowSwitching?: boolean;
|
|
67
44
|
allowEditing?: boolean;
|
|
68
45
|
allowInheriting?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-supports.d.ts","sourceRoot":"","sources":["../src/block-supports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block-supports.d.ts","sourceRoot":"","sources":["../src/block-supports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC;IACpE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE;QACZ,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EACH;QACA,UAAU,CAAC,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AAC;KACjB,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE;QACT,MAAM,CAAC,EACJ,OAAO,GACP,CAAC,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,EAAE,GACvC,CAAC,UAAU,GAAG,YAAY,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,EACL,OAAO,GACP,CAAC,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,EAAE,GACvC,CAAC,UAAU,GAAG,YAAY,CAAC,EAAE,CAAC;QACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,UAAU,GAAG,YAAY,CAAC,EAAE,CAAC;KACnD,CAAC;IACF,UAAU,CAAC,EAAE;QACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC;KACtD,CAAC;CACF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BlockSupports } from "@atomicsmash/blocks-helpers";
|
|
2
2
|
import { AlignAttribute } from "./align";
|
|
3
|
-
import { BackgroundAttribute } from "./background";
|
|
4
3
|
import { ClassNameAttribute } from "./className";
|
|
5
4
|
import { LayoutAttribute } from "./layout";
|
|
6
5
|
import { LockAttribute } from "./lock";
|
|
7
|
-
|
|
6
|
+
import { StyleAttribute } from "./style";
|
|
7
|
+
export type DefaultAttributes<Supports extends BlockSupports> = AlignAttribute<Supports> & ClassNameAttribute<Supports> & LayoutAttribute<Supports> & LockAttribute<Supports> & StyleAttribute<Supports>;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/default-attributes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/default-attributes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,aAAa,IAC3D,cAAc,CAAC,QAAQ,CAAC,GACvB,kBAAkB,CAAC,QAAQ,CAAC,GAC5B,eAAe,CAAC,QAAQ,CAAC,GACzB,aAAa,CAAC,QAAQ,CAAC,GACvB,cAAc,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AllPossibleLayouts } from "../layout";
|
|
2
|
+
import type { BlockSupports } from "@atomicsmash/blocks-helpers";
|
|
2
3
|
export type LayoutAttribute<Supports extends BlockSupports> = {
|
|
3
4
|
layout?: Supports extends {
|
|
4
5
|
layout?: false | undefined;
|
|
5
|
-
} ? never :
|
|
6
|
-
type: "default";
|
|
7
|
-
} | ({
|
|
8
|
-
type: "flex";
|
|
9
|
-
flexWrap?: "wrap" | "nowrap";
|
|
10
|
-
} & ({
|
|
11
|
-
orientation?: "horizontal";
|
|
12
|
-
justifyContent?: "left" | "center" | "right" | "space-between";
|
|
13
|
-
verticalAlignment?: "top" | "center" | "bottom" | "stretch";
|
|
14
|
-
} | {
|
|
15
|
-
orientation: "vertical";
|
|
16
|
-
justifyContent?: "left" | "center" | "right" | "stretch";
|
|
17
|
-
verticalAlignment?: "top" | "center" | "bottom" | "space-between";
|
|
18
|
-
})) | ({
|
|
19
|
-
type: "grid";
|
|
20
|
-
} & ({
|
|
21
|
-
minimumColumnWidth?: string;
|
|
22
|
-
columnCount?: never;
|
|
23
|
-
} | {
|
|
24
|
-
minimumColumnWidth?: never;
|
|
25
|
-
columnCount?: number;
|
|
26
|
-
})) | {
|
|
27
|
-
type: "constrained";
|
|
28
|
-
justifyContent?: "left" | "center" | "right";
|
|
29
|
-
contentSize?: string;
|
|
30
|
-
wideSize?: string;
|
|
31
|
-
};
|
|
6
|
+
} ? never : AllPossibleLayouts;
|
|
32
7
|
};
|
|
33
8
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/default-attributes/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/default-attributes/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,MAAM,MAAM,eAAe,CAAC,QAAQ,SAAS,aAAa,IAAI;IAC7D,MAAM,CAAC,EAAE,QAAQ,SAAS;QAAE,MAAM,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;KAAE,GACrD,KAAK,GAMN,kBAAkB,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BlockSupports } from "@atomicsmash/blocks-helpers";
|
|
2
|
+
export type StyleAttribute<Supports extends BlockSupports> = {
|
|
3
|
+
style?: BackgroundImageAttribute<Supports["background"]> & BackgroundSizeAttribute<Supports["background"]> & SpacingMarginAttribute<Supports["spacing"]> & SpacingPaddingAttribute<Supports["spacing"]> & SpacingBlockGapAttribute<Supports["spacing"]> extends never ? never : {
|
|
4
|
+
background?: BackgroundImageAttribute<Supports["background"]> & BackgroundSizeAttribute<Supports["background"]>;
|
|
5
|
+
spacing?: SpacingMarginAttribute<Supports["spacing"]> & SpacingPaddingAttribute<Supports["spacing"]> & SpacingBlockGapAttribute<Supports["spacing"]>;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
type BackgroundImageAttribute<Spacing extends BlockSupports["background"]> = Spacing extends undefined ? never : Spacing extends {
|
|
9
|
+
backgroundImage: false;
|
|
10
|
+
} ? never : {
|
|
11
|
+
backgroundImage?: {
|
|
12
|
+
url: string;
|
|
13
|
+
id: number;
|
|
14
|
+
source: string;
|
|
15
|
+
title: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
type BackgroundSizeAttribute<Spacing extends BlockSupports["background"]> = Spacing extends undefined ? never : Spacing extends {
|
|
19
|
+
backgroundSize: false;
|
|
20
|
+
} ? never : {
|
|
21
|
+
backgroundPosition?: string;
|
|
22
|
+
};
|
|
23
|
+
type SpacingMarginAttribute<Spacing extends BlockSupports["spacing"]> = Spacing extends undefined ? never : Spacing extends {
|
|
24
|
+
margin: false;
|
|
25
|
+
} ? never : Spacing extends {
|
|
26
|
+
margin: undefined;
|
|
27
|
+
} ? never : {
|
|
28
|
+
margin: {
|
|
29
|
+
bottom?: string;
|
|
30
|
+
left?: string;
|
|
31
|
+
right?: string;
|
|
32
|
+
top?: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type SpacingPaddingAttribute<Spacing extends BlockSupports["spacing"]> = Spacing extends undefined ? never : Spacing extends {
|
|
36
|
+
padding: false;
|
|
37
|
+
} ? never : Spacing extends {
|
|
38
|
+
padding: undefined;
|
|
39
|
+
} ? never : {
|
|
40
|
+
padding: {
|
|
41
|
+
bottom?: string;
|
|
42
|
+
left?: string;
|
|
43
|
+
right?: string;
|
|
44
|
+
top?: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
type SpacingBlockGapAttribute<Spacing extends BlockSupports["spacing"]> = Spacing extends undefined ? never : Spacing extends {
|
|
48
|
+
blockGap: false;
|
|
49
|
+
} ? never : Spacing extends {
|
|
50
|
+
blockGap: undefined;
|
|
51
|
+
} ? never : Spacing extends {
|
|
52
|
+
blockGap: ["horizontal"];
|
|
53
|
+
} ? {
|
|
54
|
+
blockGap: {
|
|
55
|
+
left: string;
|
|
56
|
+
};
|
|
57
|
+
} : Spacing extends {
|
|
58
|
+
blockGap: ["vertical"];
|
|
59
|
+
} ? {
|
|
60
|
+
blockGap: {
|
|
61
|
+
top: string;
|
|
62
|
+
};
|
|
63
|
+
} : {
|
|
64
|
+
blockGap: string;
|
|
65
|
+
};
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/default-attributes/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,aAAa,IAAI;IAC5D,KAAK,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GACvD,uBAAuB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAC/C,sBAAsB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAC3C,uBAAuB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAC5C,wBAAwB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,SAAS,KAAK,GACzD,KAAK,GACL;QACA,UAAU,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAC5D,uBAAuB,CAAC,QAAQ,CAAC,YAAY,CAA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AAS,CAAC,IACpE,OAAO,SAAS,SAAS,GACtB,KAAK,GACL,OAAO,SAAS;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,GACjC,KAAK,GACL,OAAO,SAAS;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GACrC,KAAK,GACL;IACA,OAAO,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;KACb,CAAC;CACF,CAAC;AAEP,KAAK,wBAAwB,CAAC,OAAO,SAAS,aAAa,CAAC,SAAS,CAAC,IACrE,OAAO,SAAS,SAAS,GACtB,KAAK,GACL,OAAO,SAAS;IAAE,QAAQ,EAAE,KAAK,CAAA;CAAE,GAClC,KAAK,GACL,OAAO,SAAS;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GACtC,KAAK,GACL,OAAO,SAAS;IAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,CAAA;CAAE,GAC3C;IACA,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3B,GACA,OAAO,SAAS;IAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,CAAA;CAAE,GACzC;IACA,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1B,GACA;IACA,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.test.d.ts","sourceRoot":"","sources":["../../src/default-attributes/style.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const validBackgroundValue = {
|
|
2
|
+
backgroundImage: {
|
|
3
|
+
url: "string",
|
|
4
|
+
id: 0,
|
|
5
|
+
source: "string",
|
|
6
|
+
title: "string",
|
|
7
|
+
},
|
|
8
|
+
backgroundPosition: "string",
|
|
9
|
+
};
|
|
10
|
+
const validSpacingValue = {
|
|
11
|
+
margin: {
|
|
12
|
+
bottom: "string",
|
|
13
|
+
left: "string",
|
|
14
|
+
right: "string",
|
|
15
|
+
top: "string",
|
|
16
|
+
},
|
|
17
|
+
padding: {
|
|
18
|
+
bottom: "string",
|
|
19
|
+
left: "string",
|
|
20
|
+
right: "string",
|
|
21
|
+
top: "string",
|
|
22
|
+
},
|
|
23
|
+
blockGap: "string",
|
|
24
|
+
};
|
|
25
|
+
let defaultAttributes;
|
|
26
|
+
defaultAttributes = {
|
|
27
|
+
// Style is only present in attributes if the value is explicitly set in the editor.
|
|
28
|
+
};
|
|
29
|
+
defaultAttributes = {
|
|
30
|
+
// @ts-expect-error Style should not be present when no style related properties are unsupported.
|
|
31
|
+
style: {},
|
|
32
|
+
};
|
|
33
|
+
/* Background */
|
|
34
|
+
defaultAttributes = {
|
|
35
|
+
// @ts-expect-error Background should not be present when background is unsupported.
|
|
36
|
+
style: {
|
|
37
|
+
background: {},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
defaultAttributes = {
|
|
41
|
+
style: {
|
|
42
|
+
// Spacing possible when combined with other style attributes
|
|
43
|
+
background: validBackgroundValue,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
/* Spacing */
|
|
47
|
+
defaultAttributes = {
|
|
48
|
+
// @ts-expect-error Spacing should not be present when spacing is unsupported.
|
|
49
|
+
style: {
|
|
50
|
+
spacing: {},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
defaultAttributes = {
|
|
54
|
+
style: {
|
|
55
|
+
// Spacing possible when combined with other style attributes
|
|
56
|
+
spacing: validSpacingValue,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export {};
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type FlowLayout = {
|
|
2
|
+
type: "default";
|
|
3
|
+
};
|
|
4
|
+
export type ConstrainedLayout = {
|
|
5
|
+
type: "constrained";
|
|
6
|
+
justifyContent?: "left" | "center" | "right";
|
|
7
|
+
contentSize?: string;
|
|
8
|
+
wideSize?: string;
|
|
9
|
+
};
|
|
10
|
+
export type FlexLayout = {
|
|
11
|
+
type: "flex";
|
|
12
|
+
flexWrap?: "wrap" | "nowrap";
|
|
13
|
+
} & ({
|
|
14
|
+
orientation?: "horizontal";
|
|
15
|
+
justifyContent?: "left" | "center" | "right" | "space-between";
|
|
16
|
+
verticalAlignment?: "top" | "center" | "bottom" | "stretch";
|
|
17
|
+
} | {
|
|
18
|
+
orientation: "vertical";
|
|
19
|
+
justifyContent?: "left" | "center" | "right" | "stretch";
|
|
20
|
+
verticalAlignment?: "top" | "center" | "bottom" | "space-between";
|
|
21
|
+
});
|
|
22
|
+
export type GridLayout = {
|
|
23
|
+
type: "grid";
|
|
24
|
+
} & ({
|
|
25
|
+
minimumColumnWidth?: string;
|
|
26
|
+
columnCount?: never;
|
|
27
|
+
} | {
|
|
28
|
+
minimumColumnWidth?: never;
|
|
29
|
+
columnCount?: number;
|
|
30
|
+
});
|
|
31
|
+
export type AllPossibleLayouts = FlowLayout | FlexLayout | GridLayout | ConstrainedLayout;
|
|
32
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAC7C,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC7B,GAAG,CACD;IACA,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,eAAe,CAAC;IAC/D,iBAAiB,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC3D,GACD;IACA,WAAW,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IACzD,iBAAiB,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,eAAe,CAAC;CACjE,CACH,CAAC;AACF,MAAM,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;CACb,GAAG,CACD;IACA,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC;CACnB,GACD;IACA,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACpB,CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC3B,UAAU,GACV,UAAU,GACV,UAAU,GACV,iBAAiB,CAAC"}
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BlockSupports } from "@atomicsmash/blocks-helpers";
|
|
2
|
-
export type BackgroundAttribute<Supports extends BlockSupports> = {
|
|
3
|
-
style?: Supports extends {
|
|
4
|
-
background: {
|
|
5
|
-
backgroundImage: true;
|
|
6
|
-
backgroundSize: true;
|
|
7
|
-
};
|
|
8
|
-
} ? {
|
|
9
|
-
background?: {
|
|
10
|
-
backgroundImage?: {
|
|
11
|
-
url: string;
|
|
12
|
-
id: number;
|
|
13
|
-
source: string;
|
|
14
|
-
title: string;
|
|
15
|
-
};
|
|
16
|
-
backgroundPosition?: string;
|
|
17
|
-
};
|
|
18
|
-
} : Supports extends {
|
|
19
|
-
background: {
|
|
20
|
-
backgroundImage: true;
|
|
21
|
-
backgroundSize: false;
|
|
22
|
-
};
|
|
23
|
-
} ? {
|
|
24
|
-
background?: {
|
|
25
|
-
backgroundImage?: {
|
|
26
|
-
url: string;
|
|
27
|
-
id: number;
|
|
28
|
-
source: string;
|
|
29
|
-
title: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
} : Supports extends {
|
|
33
|
-
background: {
|
|
34
|
-
backgroundImage: false;
|
|
35
|
-
backgroundSize: true;
|
|
36
|
-
};
|
|
37
|
-
} ? {
|
|
38
|
-
background?: {
|
|
39
|
-
backgroundPosition?: string;
|
|
40
|
-
};
|
|
41
|
-
} : never;
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=background.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../src/default-attributes/background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,MAAM,mBAAmB,CAAC,QAAQ,SAAS,aAAa,IAAI;IACjE,KAAK,CAAC,EAAE,QAAQ,SAAS;QACxB,UAAU,EAAE;YACX,eAAe,EAAE,IAAI,CAAC;YACtB,cAAc,EAAE,IAAI,CAAC;SACrB,CAAC;KACF,GACE;QACA,UAAU,CAAC,EAAE;YACZ,eAAe,CAAC,EAAE;gBACjB,GAAG,EAAE,MAAM,CAAC;gBACZ,EAAE,EAAE,MAAM,CAAC;gBACX,MAAM,EAAE,MAAM,CAAC;gBACf,KAAK,EAAE,MAAM,CAAC;aACd,CAAC;YACF,kBAAkB,CAAC,EAAE,MAAM,CAAC;SAC5B,CAAC;KACF,GACA,QAAQ,SAAS;QAChB,UAAU,EAAE;YACX,eAAe,EAAE,IAAI,CAAC;YACtB,cAAc,EAAE,KAAK,CAAC;SACtB,CAAC;KACD,GACD;QACA,UAAU,CAAC,EAAE;YACZ,eAAe,CAAC,EAAE;gBACjB,GAAG,EAAE,MAAM,CAAC;gBACZ,EAAE,EAAE,MAAM,CAAC;gBACX,MAAM,EAAE,MAAM,CAAC;gBACf,KAAK,EAAE,MAAM,CAAC;aACd,CAAC;SACF,CAAC;KACF,GACA,QAAQ,SAAS;QAChB,UAAU,EAAE;YACX,eAAe,EAAE,KAAK,CAAC;YACvB,cAAc,EAAE,IAAI,CAAC;SACrB,CAAC;KACD,GACD;QACA,UAAU,CAAC,EAAE;YACZ,kBAAkB,CAAC,EAAE,MAAM,CAAC;SAC5B,CAAC;KACF,GACA,KAAK,CAAC;CACX,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"background.test.d.ts","sourceRoot":"","sources":["../../src/default-attributes/background.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
let defaultAttributes;
|
|
2
|
-
defaultAttributes = {
|
|
3
|
-
// Background is only present in attributes if the value is explicitly set in the editor.
|
|
4
|
-
};
|
|
5
|
-
defaultAttributes = {
|
|
6
|
-
// @ts-expect-error Background should not be present when background is unsupported.
|
|
7
|
-
style: {
|
|
8
|
-
background: {},
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
defaultAttributes = {
|
|
12
|
-
// @ts-expect-error Background should not be present when background is unsupported.
|
|
13
|
-
style: {
|
|
14
|
-
background: {},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
export {};
|
|
File without changes
|