@claspo/templates 15.0.11 → 16.0.0

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.
@@ -5,6 +5,7 @@ import { TemplateType } from "./TemplateType.enum";
5
5
  import SortableRecordI from "./SortableRecord.interface";
6
6
  import { PrizePoolModelI } from '@claspo/common/PrizePool.interface';
7
7
  import { WidgetType } from '@claspo/common/WidgetType';
8
+ import { ThemeI } from "@claspo/common/document/Document.interface";
8
9
  export default interface TemplateI<RuleT, LayoutT, DocumentT = Record<string, any>, SyncT = Record<string, any> | null> extends SortableRecordI {
9
10
  id: number;
10
11
  name: string;
@@ -17,9 +18,10 @@ export default interface TemplateI<RuleT, LayoutT, DocumentT = Record<string, an
17
18
  sync: SyncT;
18
19
  };
19
20
  dynamicParams?: {
20
- cssVars: {
21
+ cssVars?: {
21
22
  [key: string]: string;
22
23
  };
24
+ theme?: ThemeI;
23
25
  backgroundInline: {
24
26
  path: number[];
25
27
  props: Record<string, any>;
package/TemplateMapper.js CHANGED
@@ -1 +1 @@
1
- import{TemplateType}from"./TemplateType.enum";import DocumentCssVarsReplace from"@claspo/common/document/DocumentCssVarsReplace";import DocumentUtils from"@claspo/common/document/DocumentUtils";export default class TemplateMapper{static mapTemplates(e){return e.map(e=>{var s,o;if(e.type===TemplateType.STATIC)return e;let t=null===(s=e.dynamicParams)||void 0===s?void 0:s.cssVars;const a=null===(o=e.dynamicParams)||void 0===o?void 0:o.backgroundInline;if(t){let s=e.json.document;e.json.document=DocumentCssVarsReplace.replaceValues(s,t),e.json.document.shared.cssVars=t}return a&&(null==a||a.forEach(({path:s,props:o})=>{const t=DocumentUtils.getNodeByPath(e.json.document.views,s);t&&(t.props=Object.assign(Object.assign({},t.props),o))})),e})}}
1
+ import{TemplateType}from"./TemplateType.enum";import DocumentCssVarsReplace from"@claspo/common/document/DocumentCssVarsReplace";import DocumentUtils from"@claspo/common/document/DocumentUtils";import{prepareKeys}from"@claspo/common/element/ThemeCssVars";export default class TemplateMapper{static mapTemplates(e){return e.map(e=>{var s,o,a;if(e.type===TemplateType.STATIC)return e;let m=null===(s=e.dynamicParams)||void 0===s?void 0:s.cssVars;const n=null===(o=e.dynamicParams)||void 0===o?void 0:o.backgroundInline;if(m){let s=e.json.document;e.json.document=DocumentCssVarsReplace.replaceValues(s,m),e.json.document.shared.cssVars=m}if(null===(a=e.dynamicParams)||void 0===a?void 0:a.theme){const s=e.json.document,o=e.dynamicParams.theme,a=prepareKeys((null==o?void 0:o.schema)||{});e.json.document=DocumentCssVarsReplace.replaceValues(s,a),e.json.document.shared||(e.json.document.shared={}),e.json.document.shared.theme=o}return n&&(null==n||n.forEach(({path:s,props:o})=>{const a=DocumentUtils.getNodeByPath(e.json.document.views,s);a&&(a.props=Object.assign(Object.assign({},a.props),o))})),e})}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claspo/templates",
3
- "version": "15.0.11",
3
+ "version": "16.0.0",
4
4
  "engines": {
5
5
  "node": ">=18.16.0"
6
6
  },
@@ -12,10 +12,10 @@
12
12
  "package": "npm i && npm run test && npm run build && cp package.json out && cd out && npm publish --access=public && cd .."
13
13
  },
14
14
  "dependencies": {
15
- "@claspo/common": "6.0.16",
16
- "@claspo/document-connector": "15.0.17",
17
- "@claspo/renderer": "17.0.15",
18
- "@claspo/components": "1.1.35"
15
+ "@claspo/common": "7.0.0",
16
+ "@claspo/document-connector": "16.0.0",
17
+ "@claspo/renderer": "18.0.0",
18
+ "@claspo/components": "1.2.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/jest": "^27.5.1",