@knapsack/rendering-utils 4.69.13--canary.4821.ae550c0.0 → 4.69.13
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/rendering.d.ts +1 -5
- package/dist/rendering.d.ts.map +1 -1
- package/dist/rendering.js +0 -30
- package/dist/rendering.js.map +1 -1
- package/package.json +7 -7
- package/src/rendering.ts +1 -46
package/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# v4.69.11 (Thu Sep 26 2024)
|
2
|
+
|
3
|
+
#### 🐛 Bug Fix
|
4
|
+
|
5
|
+
- update design src user flow to be async [#4739](https://github.com/knapsack-labs/app-monorepo/pull/4739) ([@mabry1985](https://github.com/mabry1985))
|
6
|
+
|
7
|
+
#### 🏠 Internal
|
8
|
+
|
9
|
+
- extract rendering utils out [#4789](https://github.com/knapsack-labs/app-monorepo/pull/4789) ([@EvanLovely](https://github.com/EvanLovely))
|
10
|
+
|
11
|
+
#### Authors: 2
|
12
|
+
|
13
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
14
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
package/dist/rendering.d.ts
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
import type { KsAppClientData,
|
2
|
-
export declare function getContentStateFromAppClientData({ patterns, demosById, }: {
|
3
|
-
patterns: KsAppClientDataNoMeta['patternsState']['patterns'];
|
4
|
-
demosById: KsAppClientDataNoMeta['db']['demos']['byId'];
|
5
|
-
}): ContentStateForRendering;
|
1
|
+
import type { KsAppClientData, RenderDataDemo } from '@knapsack/types';
|
6
2
|
/**
|
7
3
|
* What we're going to here is look at all the slots data and grab
|
8
4
|
* the ACTUAL demo data we have locally here instead of just sending up the
|
package/dist/rendering.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rendering.d.ts","sourceRoot":"","sources":["../src/rendering.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"rendering.d.ts","sourceRoot":"","sources":["../src/rendering.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGvE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,IAAI,EACJ,oBAAoB,GACrB,EAAE;IACD,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,oBAAoB,EAAE,MAAM,CAAC;CAC9B,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAkC5C"}
|
package/dist/rendering.js
CHANGED
@@ -1,35 +1,5 @@
|
|
1
1
|
import { isEmpty, produce } from '@knapsack/utils';
|
2
2
|
import { convertSlotOptions } from './slot-layout-options-utils.js';
|
3
|
-
export function getContentStateFromAppClientData({ patterns, demosById, }) {
|
4
|
-
return {
|
5
|
-
patterns: Object.values(patterns).reduce((acc, pattern) => {
|
6
|
-
var _a, _b;
|
7
|
-
acc[pattern.id] = {
|
8
|
-
id: pattern.id,
|
9
|
-
templateDemos: ((_a = pattern.templates) === null || _a === void 0 ? void 0 : _a.flatMap((t) => {
|
10
|
-
return t.demoIds
|
11
|
-
.map((demoId) => {
|
12
|
-
const demo = demosById[demoId];
|
13
|
-
return {
|
14
|
-
...demo,
|
15
|
-
templateId: t.id,
|
16
|
-
templateLanguageId: t.templateLanguageId,
|
17
|
-
};
|
18
|
-
})
|
19
|
-
.filter((d) => d.type === 'template');
|
20
|
-
})) || [],
|
21
|
-
templates: ((_b = pattern.templates) === null || _b === void 0 ? void 0 : _b.map(({ id, alias, path, templateLanguageId, spec }) => ({
|
22
|
-
id,
|
23
|
-
alias,
|
24
|
-
path,
|
25
|
-
templateLanguageId,
|
26
|
-
spec,
|
27
|
-
}))) || [],
|
28
|
-
};
|
29
|
-
return acc;
|
30
|
-
}, {}),
|
31
|
-
};
|
32
|
-
}
|
33
3
|
/**
|
34
4
|
* What we're going to here is look at all the slots data and grab
|
35
5
|
* the ACTUAL demo data we have locally here instead of just sending up the
|
package/dist/rendering.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rendering.js","sourceRoot":"","sources":["../src/rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"rendering.js","sourceRoot":"","sources":["../src/rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,SAAS,EACT,IAAI,EACJ,oBAAoB,GAKrB;IACC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACjE,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;QAC7B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAC5C,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE,EAAE;;;YAC3B,MAAM,WAAW,GAAG,MAAA,KAAK,CAAC,IAAI,CAAC,YAAY,0CAAG,QAAQ,CAAC,CAAC;YACxD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC1B,MAAA,KAAK,CAAC,IAAI,EAAC,oBAAoB,QAApB,oBAAoB,GAAK,EAAE,EAAC;gBACvC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC;oBAC7D,WAAW;oBACX,oBAAoB;iBACrB,CAAC,CAAC;YACL,CAAC;YACD,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;gBACnC,IAAI,WAAW,CAAC,IAAI,KAAK,eAAe;oBAAE,OAAO;gBACjD,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAClD,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,MAAM,IAAI,KAAK,CACb,gBAAgB,WAAW,CAAC,MAAM,iBAAiB,KAAK,CAAC,EAAE,EAAE,CAC9D,CAAC;gBACJ,CAAC;gBAED,IAAI,WAAW,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBAChC,wEAAwE;oBACxE,WAAW,CAAC,IAAI,GAAG,cAAc,CAAC;wBAChC,SAAS;wBACT,IAAI,EAAE,WAAW;wBACjB,oBAAoB;qBACrB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@knapsack/rendering-utils",
|
3
3
|
"description": "",
|
4
|
-
"version": "4.69.13
|
4
|
+
"version": "4.69.13",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
7
7
|
".": {
|
@@ -18,13 +18,13 @@
|
|
18
18
|
"lint": "eslint ./"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
|
-
"@knapsack/utils": "4.69.13
|
21
|
+
"@knapsack/utils": "4.69.13"
|
22
22
|
},
|
23
23
|
"devDependencies": {
|
24
|
-
"@knapsack/eslint-config-starter": "4.69.13
|
25
|
-
"@knapsack/prettier-config": "4.69.13
|
26
|
-
"@knapsack/types": "4.69.13
|
27
|
-
"@knapsack/typescript-config-starter": "4.69.13
|
24
|
+
"@knapsack/eslint-config-starter": "4.69.13",
|
25
|
+
"@knapsack/prettier-config": "4.69.13",
|
26
|
+
"@knapsack/types": "4.69.13",
|
27
|
+
"@knapsack/typescript-config-starter": "4.69.13",
|
28
28
|
"eslint": "^8.57.0",
|
29
29
|
"typescript": "^5.5.4"
|
30
30
|
},
|
@@ -37,5 +37,5 @@
|
|
37
37
|
"directory": "libs/rendering-utils",
|
38
38
|
"type": "git"
|
39
39
|
},
|
40
|
-
"gitHead": "
|
40
|
+
"gitHead": "d92e69870e1d094abc7d97fb1170ae68c0411b17"
|
41
41
|
}
|
package/src/rendering.ts
CHANGED
@@ -1,52 +1,7 @@
|
|
1
1
|
import { isEmpty, produce } from '@knapsack/utils';
|
2
|
-
import type {
|
3
|
-
KsAppClientData,
|
4
|
-
KsAppClientDataNoMeta,
|
5
|
-
RenderDataDemo,
|
6
|
-
ContentStateForRendering,
|
7
|
-
} from '@knapsack/types';
|
2
|
+
import type { KsAppClientData, RenderDataDemo } from '@knapsack/types';
|
8
3
|
import { convertSlotOptions } from './slot-layout-options-utils.js';
|
9
4
|
|
10
|
-
export function getContentStateFromAppClientData({
|
11
|
-
patterns,
|
12
|
-
demosById,
|
13
|
-
}: {
|
14
|
-
patterns: KsAppClientDataNoMeta['patternsState']['patterns'];
|
15
|
-
demosById: KsAppClientDataNoMeta['db']['demos']['byId'];
|
16
|
-
}): ContentStateForRendering {
|
17
|
-
return {
|
18
|
-
patterns: Object.values(patterns).reduce((acc, pattern) => {
|
19
|
-
acc[pattern.id] = {
|
20
|
-
id: pattern.id,
|
21
|
-
templateDemos:
|
22
|
-
pattern.templates?.flatMap((t) => {
|
23
|
-
return t.demoIds
|
24
|
-
.map((demoId) => {
|
25
|
-
const demo = demosById[demoId];
|
26
|
-
return {
|
27
|
-
...demo,
|
28
|
-
templateId: t.id,
|
29
|
-
templateLanguageId: t.templateLanguageId,
|
30
|
-
};
|
31
|
-
})
|
32
|
-
.filter((d) => d.type === 'template');
|
33
|
-
}) || [],
|
34
|
-
templates:
|
35
|
-
pattern.templates?.map(
|
36
|
-
({ id, alias, path, templateLanguageId, spec }) => ({
|
37
|
-
id,
|
38
|
-
alias,
|
39
|
-
path,
|
40
|
-
templateLanguageId,
|
41
|
-
spec,
|
42
|
-
}),
|
43
|
-
) || [],
|
44
|
-
};
|
45
|
-
return acc;
|
46
|
-
}, {} as ContentStateForRendering['patterns']),
|
47
|
-
};
|
48
|
-
}
|
49
|
-
|
50
5
|
/**
|
51
6
|
* What we're going to here is look at all the slots data and grab
|
52
7
|
* the ACTUAL demo data we have locally here instead of just sending up the
|