@wix/site-service-site-theme 1.0.5 → 1.0.7

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.
@@ -1,17 +1,57 @@
1
1
  import type { ServiceDefinition } from '@wix/services-definitions';
2
2
  import type { SiteColors, SiteFonts, ColorsMap } from '../types';
3
+ /** Values the host supplies when it creates the service. */
3
4
  export type ISiteThemeServiceConfig = {
4
5
  siteColors: SiteColors;
5
6
  siteFonts: SiteFonts;
6
7
  colorsMap: ColorsMap;
7
8
  };
9
+ /**
10
+ * Reads the site's theme colors and fonts, so code running on the site can match the design a Wix user
11
+ * chose.
12
+ */
8
13
  export interface ISiteThemeService {
14
+ /**
15
+ * Site's theme colors, keyed by theme color ID.
16
+ *
17
+ * Use it to resolve a theme color ID, such as `color_4`, to its color value.
18
+ *
19
+ * The host fills `colors` and `colorsMap` from the same list of theme colors, so `colors['color_<n>']`
20
+ * is the same value as `colorsMap[n]`, counting from `color_0`.
21
+ *
22
+ * Don't change the object's entries. Every component on the page reads the same object, so a change shows
23
+ * in all of them, and the site doesn't save it.
24
+ *
25
+ * @exampleValue `{ "color_0": "#FFFFFF", "color_1": "#E8E6E6", "color_2": "#9C9C9C", "color_3": "#1F1F1F", "color_4": "#0088CB", "color_5": "#ED1C24" }`
26
+ */
9
27
  readonly colors: SiteColors;
28
+ /**
29
+ * Site's theme fonts, keyed by theme font ID.
30
+ *
31
+ * Don't change the object's entries. Every component on the page reads the same object, so a change shows
32
+ * in all of them, and the site doesn't save it.
33
+ *
34
+ * @exampleValue `{ "font_0": "normal normal normal 40px/1.4em helvetica-w01-bold,sans-serif", "font_1": "normal normal normal 16px/1.4em proxima-n-w01-reg,sans-serif" }`
35
+ */
10
36
  readonly fonts: SiteFonts;
37
+ /**
38
+ * Site's theme colors, in order.
39
+ *
40
+ * The host fills `colorsMap` and `colors` from the same list of theme colors, so entry `n` is the theme
41
+ * color with ID `color_<n>`.
42
+ *
43
+ * Don't change the array, for example by sorting it in place. Every component on the page reads the same
44
+ * array, so a change shows in all of them, and the site doesn't save it.
45
+ *
46
+ * @exampleValue `["#FFFFFF", "#E8E6E6", "#9C9C9C", "#1F1F1F", "#0088CB", "#ED1C24"]`
47
+ */
11
48
  readonly colorsMap: ColorsMap;
49
+ /** @internal Host-only. Replaces config values when the host's state changes. */
12
50
  _updateConfig: (config: Partial<ISiteThemeServiceConfig>) => void;
13
51
  }
52
+ /** Definition of the Site Theme service, used to resolve it from the services manager. */
14
53
  export type ISiteThemeDefinition = ServiceDefinition<ISiteThemeService, ISiteThemeServiceConfig>;
54
+ /** Definition of the Site Theme service. Specify it in `useService()`. */
15
55
  export declare const SiteThemeDefinition: string & {
16
56
  __api: ISiteThemeService;
17
57
  __config: ISiteThemeServiceConfig;
@@ -2,5 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SiteThemeDefinition = void 0;
4
4
  const services_definitions_1 = require("@wix/services-definitions");
5
+ /** Definition of the Site Theme service. Specify it in `useService()`. */
5
6
  exports.SiteThemeDefinition = (0, services_definitions_1.defineService)('@wix/site-service-site-theme');
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAmB5C,QAAA,mBAAmB,GAAG,IAAA,oCAAa,EAC/C,8BAA8B,CAC9B,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AA0DzD,0EAA0E;AAC7D,QAAA,mBAAmB,GAAG,IAAA,oCAAa,EAC/C,8BAA8B,CAC9B,CAAA"}
@@ -1,10 +1,21 @@
1
- /** CSS colour value, e.g. `'#fff'`, `'#ffffff'`, `'rgb(255,255,255)'` */
1
+ /** CSS color value, such as `#0088CB`. */
2
2
  export type Color = string;
3
+ /** Site's theme colors, keyed by theme color ID. */
3
4
  export type SiteColors = {
5
+ /**
6
+ * CSS color value of the theme color with this ID. IDs have the form `color_<n>`, starting at
7
+ * `color_0`.
8
+ */
4
9
  [colorIndex: string]: Color;
5
10
  };
11
+ /** Site's theme fonts, keyed by theme font ID. */
6
12
  export type SiteFonts = {
13
+ /**
14
+ * Definition of the theme font with this ID, such as its size and font family. IDs have the form
15
+ * `font_<n>`, starting at `font_0`.
16
+ */
7
17
  [fontIndex: string]: string;
8
18
  };
19
+ /** Site's theme colors, in order. */
9
20
  export type ColorsMap = Array<Color>;
10
21
  export type { ISiteThemeService, ISiteThemeServiceConfig, ISiteThemeDefinition } from '../definition';
@@ -1,17 +1,57 @@
1
1
  import type { ServiceDefinition } from '@wix/services-definitions';
2
2
  import type { SiteColors, SiteFonts, ColorsMap } from '../types';
3
+ /** Values the host supplies when it creates the service. */
3
4
  export type ISiteThemeServiceConfig = {
4
5
  siteColors: SiteColors;
5
6
  siteFonts: SiteFonts;
6
7
  colorsMap: ColorsMap;
7
8
  };
9
+ /**
10
+ * Reads the site's theme colors and fonts, so code running on the site can match the design a Wix user
11
+ * chose.
12
+ */
8
13
  export interface ISiteThemeService {
14
+ /**
15
+ * Site's theme colors, keyed by theme color ID.
16
+ *
17
+ * Use it to resolve a theme color ID, such as `color_4`, to its color value.
18
+ *
19
+ * The host fills `colors` and `colorsMap` from the same list of theme colors, so `colors['color_<n>']`
20
+ * is the same value as `colorsMap[n]`, counting from `color_0`.
21
+ *
22
+ * Don't change the object's entries. Every component on the page reads the same object, so a change shows
23
+ * in all of them, and the site doesn't save it.
24
+ *
25
+ * @exampleValue `{ "color_0": "#FFFFFF", "color_1": "#E8E6E6", "color_2": "#9C9C9C", "color_3": "#1F1F1F", "color_4": "#0088CB", "color_5": "#ED1C24" }`
26
+ */
9
27
  readonly colors: SiteColors;
28
+ /**
29
+ * Site's theme fonts, keyed by theme font ID.
30
+ *
31
+ * Don't change the object's entries. Every component on the page reads the same object, so a change shows
32
+ * in all of them, and the site doesn't save it.
33
+ *
34
+ * @exampleValue `{ "font_0": "normal normal normal 40px/1.4em helvetica-w01-bold,sans-serif", "font_1": "normal normal normal 16px/1.4em proxima-n-w01-reg,sans-serif" }`
35
+ */
10
36
  readonly fonts: SiteFonts;
37
+ /**
38
+ * Site's theme colors, in order.
39
+ *
40
+ * The host fills `colorsMap` and `colors` from the same list of theme colors, so entry `n` is the theme
41
+ * color with ID `color_<n>`.
42
+ *
43
+ * Don't change the array, for example by sorting it in place. Every component on the page reads the same
44
+ * array, so a change shows in all of them, and the site doesn't save it.
45
+ *
46
+ * @exampleValue `["#FFFFFF", "#E8E6E6", "#9C9C9C", "#1F1F1F", "#0088CB", "#ED1C24"]`
47
+ */
11
48
  readonly colorsMap: ColorsMap;
49
+ /** @internal Host-only. Replaces config values when the host's state changes. */
12
50
  _updateConfig: (config: Partial<ISiteThemeServiceConfig>) => void;
13
51
  }
52
+ /** Definition of the Site Theme service, used to resolve it from the services manager. */
14
53
  export type ISiteThemeDefinition = ServiceDefinition<ISiteThemeService, ISiteThemeServiceConfig>;
54
+ /** Definition of the Site Theme service. Specify it in `useService()`. */
15
55
  export declare const SiteThemeDefinition: string & {
16
56
  __api: ISiteThemeService;
17
57
  __config: ISiteThemeServiceConfig;
@@ -1,3 +1,4 @@
1
1
  import { defineService } from '@wix/services-definitions';
2
+ /** Definition of the Site Theme service. Specify it in `useService()`. */
2
3
  export const SiteThemeDefinition = defineService('@wix/site-service-site-theme');
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAmBzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC/C,8BAA8B,CAC9B,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AA0DzD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAC/C,8BAA8B,CAC9B,CAAA"}
@@ -1,10 +1,21 @@
1
- /** CSS colour value, e.g. `'#fff'`, `'#ffffff'`, `'rgb(255,255,255)'` */
1
+ /** CSS color value, such as `#0088CB`. */
2
2
  export type Color = string;
3
+ /** Site's theme colors, keyed by theme color ID. */
3
4
  export type SiteColors = {
5
+ /**
6
+ * CSS color value of the theme color with this ID. IDs have the form `color_<n>`, starting at
7
+ * `color_0`.
8
+ */
4
9
  [colorIndex: string]: Color;
5
10
  };
11
+ /** Site's theme fonts, keyed by theme font ID. */
6
12
  export type SiteFonts = {
13
+ /**
14
+ * Definition of the theme font with this ID, such as its size and font family. IDs have the form
15
+ * `font_<n>`, starting at `font_0`.
16
+ */
7
17
  [fontIndex: string]: string;
8
18
  };
19
+ /** Site's theme colors, in order. */
9
20
  export type ColorsMap = Array<Color>;
10
21
  export type { ISiteThemeService, ISiteThemeServiceConfig, ISiteThemeDefinition } from '../definition';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/site-service-site-theme",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "dist",
@@ -77,5 +77,5 @@
77
77
  ]
78
78
  }
79
79
  },
80
- "falconPackageHash": "f518f3b0692d28b8093378da823ac73233727a1e0fc9ec414fc80afa"
80
+ "falconPackageHash": "5f4da3cf5aef09b6afc88b9fd5eaaa34b10aae3996bed8712de2a2f0"
81
81
  }
@@ -2,21 +2,61 @@ import { defineService } from '@wix/services-definitions'
2
2
  import type { ServiceDefinition } from '@wix/services-definitions'
3
3
  import type { SiteColors, SiteFonts, ColorsMap } from '../types'
4
4
 
5
+ /** Values the host supplies when it creates the service. */
5
6
  export type ISiteThemeServiceConfig = {
6
7
  siteColors: SiteColors
7
8
  siteFonts: SiteFonts
8
9
  colorsMap: ColorsMap
9
10
  }
10
11
 
12
+ /**
13
+ * Reads the site's theme colors and fonts, so code running on the site can match the design a Wix user
14
+ * chose.
15
+ */
11
16
  export interface ISiteThemeService {
17
+ /**
18
+ * Site's theme colors, keyed by theme color ID.
19
+ *
20
+ * Use it to resolve a theme color ID, such as `color_4`, to its color value.
21
+ *
22
+ * The host fills `colors` and `colorsMap` from the same list of theme colors, so `colors['color_<n>']`
23
+ * is the same value as `colorsMap[n]`, counting from `color_0`.
24
+ *
25
+ * Don't change the object's entries. Every component on the page reads the same object, so a change shows
26
+ * in all of them, and the site doesn't save it.
27
+ *
28
+ * @exampleValue `{ "color_0": "#FFFFFF", "color_1": "#E8E6E6", "color_2": "#9C9C9C", "color_3": "#1F1F1F", "color_4": "#0088CB", "color_5": "#ED1C24" }`
29
+ */
12
30
  readonly colors: SiteColors
31
+ /**
32
+ * Site's theme fonts, keyed by theme font ID.
33
+ *
34
+ * Don't change the object's entries. Every component on the page reads the same object, so a change shows
35
+ * in all of them, and the site doesn't save it.
36
+ *
37
+ * @exampleValue `{ "font_0": "normal normal normal 40px/1.4em helvetica-w01-bold,sans-serif", "font_1": "normal normal normal 16px/1.4em proxima-n-w01-reg,sans-serif" }`
38
+ */
13
39
  readonly fonts: SiteFonts
40
+ /**
41
+ * Site's theme colors, in order.
42
+ *
43
+ * The host fills `colorsMap` and `colors` from the same list of theme colors, so entry `n` is the theme
44
+ * color with ID `color_<n>`.
45
+ *
46
+ * Don't change the array, for example by sorting it in place. Every component on the page reads the same
47
+ * array, so a change shows in all of them, and the site doesn't save it.
48
+ *
49
+ * @exampleValue `["#FFFFFF", "#E8E6E6", "#9C9C9C", "#1F1F1F", "#0088CB", "#ED1C24"]`
50
+ */
14
51
  readonly colorsMap: ColorsMap
52
+ /** @internal Host-only. Replaces config values when the host's state changes. */
15
53
  _updateConfig: (config: Partial<ISiteThemeServiceConfig>) => void
16
54
  }
17
55
 
56
+ /** Definition of the Site Theme service, used to resolve it from the services manager. */
18
57
  export type ISiteThemeDefinition = ServiceDefinition<ISiteThemeService, ISiteThemeServiceConfig>
19
58
 
59
+ /** Definition of the Site Theme service. Specify it in `useService()`. */
20
60
  export const SiteThemeDefinition = defineService<ISiteThemeService, ISiteThemeServiceConfig>(
21
61
  '@wix/site-service-site-theme'
22
62
  )
@@ -1,7 +1,22 @@
1
- /** CSS colour value, e.g. `'#fff'`, `'#ffffff'`, `'rgb(255,255,255)'` */
1
+ /** CSS color value, such as `#0088CB`. */
2
2
  export type Color = string
3
- export type SiteColors = { [colorIndex: string]: Color }
4
- export type SiteFonts = { [fontIndex: string]: string }
3
+ /** Site's theme colors, keyed by theme color ID. */
4
+ export type SiteColors = {
5
+ /**
6
+ * CSS color value of the theme color with this ID. IDs have the form `color_<n>`, starting at
7
+ * `color_0`.
8
+ */
9
+ [colorIndex: string]: Color
10
+ }
11
+ /** Site's theme fonts, keyed by theme font ID. */
12
+ export type SiteFonts = {
13
+ /**
14
+ * Definition of the theme font with this ID, such as its size and font family. IDs have the form
15
+ * `font_<n>`, starting at `font_0`.
16
+ */
17
+ [fontIndex: string]: string
18
+ }
19
+ /** Site's theme colors, in order. */
5
20
  export type ColorsMap = Array<Color>
6
21
 
7
22
  export type { ISiteThemeService, ISiteThemeServiceConfig, ISiteThemeDefinition } from '../definition'