@knapsack/types 4.69.9--canary.4768.997c53b.0 → 4.69.9--canary.4739.c87ad2d.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +77 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -2
- package/dist/index.mjs.map +1 -1
- package/dist/renderer-client-types.d.ts +0 -9
- package/dist/renderer-client-types.d.ts.map +1 -1
- package/dist/renderers.d.ts +105 -0
- package/dist/renderers.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# v4.69.8 (Thu Sep 12 2024)
|
2
|
+
|
3
|
+
#### 🐛 Bug Fix
|
4
|
+
|
5
|
+
- refactor Renderers for cleaner types [#4746](https://github.com/knapsack-labs/app-monorepo/pull/4746) ([@EvanLovely](https://github.com/EvanLovely))
|
6
|
+
|
7
|
+
#### Authors: 1
|
8
|
+
|
9
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
10
|
+
|
11
|
+
---
|
12
|
+
|
1
13
|
# v4.69.7 (Wed Sep 11 2024)
|
2
14
|
|
3
15
|
#### 🐛 Bug Fix
|
package/dist/index.js
CHANGED
@@ -88,6 +88,7 @@ __export(src_exports, {
|
|
88
88
|
WS_EVENTS: () => WS_EVENTS,
|
89
89
|
assertTokenData: () => assertTokenData,
|
90
90
|
customizableNavElements: () => customizableNavElements,
|
91
|
+
getKsRendererClientGlobal: () => getKsRendererClientGlobal,
|
91
92
|
getPrimitiveValue: () => getPrimitiveValue,
|
92
93
|
hasTokenReferences: () => hasTokenReferences,
|
93
94
|
isArrayOfObjectsProp: () => isArrayOfObjectsProp,
|
@@ -101,10 +102,13 @@ __export(src_exports, {
|
|
101
102
|
isKsAppClientDataAndMetaV3: () => isKsAppClientDataAndMetaV3,
|
102
103
|
isKsAppClientDataNoMeta: () => isKsAppClientDataNoMeta,
|
103
104
|
isKsAppClientDataNoMetaV3: () => isKsAppClientDataNoMetaV3,
|
105
|
+
isKsJsImports: () => isKsJsImports,
|
104
106
|
isKsMetaState: () => isKsMetaState,
|
105
107
|
isKsMetaStateV3: () => isKsMetaStateV3,
|
106
108
|
isKsRemoteChange: () => isKsRemoteChange,
|
107
109
|
isKsRemoteChanges: () => isKsRemoteChanges,
|
110
|
+
isKsRendererClientGlobal: () => isKsRendererClientGlobal,
|
111
|
+
isKsRendererClientGlobalImportedModules: () => isKsRendererClientGlobalImportedModules,
|
108
112
|
isNotTokenReference: () => isNotTokenReference,
|
109
113
|
isNumberProp: () => isNumberProp,
|
110
114
|
isObjKey: () => import_utils.isObjKey,
|
@@ -135,7 +139,6 @@ __export(src_exports, {
|
|
135
139
|
isTokenValueFontWeight: () => isTokenValueFontWeight,
|
136
140
|
isTokenValueShadow: () => isTokenValueShadow,
|
137
141
|
isTokenValueTransition: () => isTokenValueTransition,
|
138
|
-
ksRendererClientMetaId: () => ksRendererClientMetaId,
|
139
142
|
migrations: () => migrations,
|
140
143
|
pageElements: () => pageElements,
|
141
144
|
pageElementsV2: () => pageElementsV2,
|
@@ -1757,13 +1760,81 @@ var rendererIds = {
|
|
1757
1760
|
angular: "angular",
|
1758
1761
|
html: "html"
|
1759
1762
|
};
|
1763
|
+
function isKsJsImports(imports) {
|
1764
|
+
if (!Array.isArray(imports)) return false;
|
1765
|
+
if (imports.length === 0) return true;
|
1766
|
+
const [anImport] = imports;
|
1767
|
+
if (anImport.type === "pattern-template" && typeof anImport.patternId !== "string")
|
1768
|
+
return false;
|
1769
|
+
if (anImport.type === "pattern-template-demo" && typeof anImport.patternId !== "string")
|
1770
|
+
return false;
|
1771
|
+
if (anImport.type === "pattern-template-demo" && typeof anImport.templateId !== "string")
|
1772
|
+
return false;
|
1773
|
+
if (anImport.type === "pattern-template-demo" && typeof anImport.demoId !== "string")
|
1774
|
+
return false;
|
1775
|
+
if (anImport.type === "extra" && typeof anImport.importInfo !== "object")
|
1776
|
+
return false;
|
1777
|
+
if (anImport.type === "extra" && typeof anImport.importInfo.type !== "string")
|
1778
|
+
return false;
|
1779
|
+
if (anImport.type === "extra" && typeof anImport.importInfo.name !== "string")
|
1780
|
+
return false;
|
1781
|
+
if (anImport.type === "extra" && typeof anImport.importInfo.path !== "string")
|
1782
|
+
return false;
|
1783
|
+
if (anImport.type === "extra" && typeof anImport.importInfo.names !== "undefined") {
|
1784
|
+
if (!Array.isArray(anImport.importInfo.names)) return false;
|
1785
|
+
if (anImport.importInfo.names.some((name) => typeof name !== "string"))
|
1786
|
+
return false;
|
1787
|
+
}
|
1788
|
+
return true;
|
1789
|
+
}
|
1790
|
+
__name(isKsJsImports, "isKsJsImports");
|
1791
|
+
function isKsRendererClientGlobalImportedModules(mods) {
|
1792
|
+
if (!(0, import_utils.isObject)(mods)) return false;
|
1793
|
+
for (const key in mods) {
|
1794
|
+
if (typeof mods[key] !== "function") return false;
|
1795
|
+
}
|
1796
|
+
return true;
|
1797
|
+
}
|
1798
|
+
__name(isKsRendererClientGlobalImportedModules, "isKsRendererClientGlobalImportedModules");
|
1799
|
+
function isKsRendererClientGlobal(knapsack) {
|
1800
|
+
if (!(0, import_utils.isObject)(knapsack)) return false;
|
1801
|
+
if (knapsack.typeName !== "KsRendererClientGlobal") return false;
|
1802
|
+
if (typeof knapsack.getImport !== "function") return false;
|
1803
|
+
if (!Array.isArray(knapsack.allAvailableImports)) return false;
|
1804
|
+
if (!isKsRendererClientGlobalImportedModules(knapsack.importedModules)) {
|
1805
|
+
return false;
|
1806
|
+
}
|
1807
|
+
return isKsJsImports(knapsack.allAvailableImports);
|
1808
|
+
}
|
1809
|
+
__name(isKsRendererClientGlobal, "isKsRendererClientGlobal");
|
1810
|
+
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
1811
|
+
function getKsRendererClientGlobal() {
|
1812
|
+
if (!isBrowser) {
|
1813
|
+
throw new Error(
|
1814
|
+
"Cannot get KsRendererClientGlobal in a non-browser environment"
|
1815
|
+
);
|
1816
|
+
}
|
1817
|
+
const { knapsack } = window;
|
1818
|
+
if (!knapsack) {
|
1819
|
+
throw new Error(
|
1820
|
+
'Cannot get KsRendererClientGlobal: "knapsack" is not defined on the window'
|
1821
|
+
);
|
1822
|
+
}
|
1823
|
+
if (!isKsRendererClientGlobal(knapsack)) {
|
1824
|
+
console.log(`Object found at "window.knapsack":`, knapsack);
|
1825
|
+
throw new Error(
|
1826
|
+
`Cannot get KsRendererClientGlobal: knapsack is not the correct type`
|
1827
|
+
);
|
1828
|
+
}
|
1829
|
+
return knapsack;
|
1830
|
+
}
|
1831
|
+
__name(getKsRendererClientGlobal, "getKsRendererClientGlobal");
|
1760
1832
|
|
1761
1833
|
// src/renderer-client-types.ts
|
1762
1834
|
var KsRendererClientEvents = /* @__PURE__ */ ((KsRendererClientEvents2) => {
|
1763
1835
|
KsRendererClientEvents2["ready"] = "ready";
|
1764
1836
|
return KsRendererClientEvents2;
|
1765
1837
|
})(KsRendererClientEvents || {});
|
1766
|
-
var ksRendererClientMetaId = "ks-meta";
|
1767
1838
|
|
1768
1839
|
// src/web-sockets.ts
|
1769
1840
|
var WS_EVENTS = {
|
@@ -1896,6 +1967,7 @@ var roles = Object.values(rolesById);
|
|
1896
1967
|
WS_EVENTS,
|
1897
1968
|
assertTokenData,
|
1898
1969
|
customizableNavElements,
|
1970
|
+
getKsRendererClientGlobal,
|
1899
1971
|
getPrimitiveValue,
|
1900
1972
|
hasTokenReferences,
|
1901
1973
|
isArrayOfObjectsProp,
|
@@ -1909,10 +1981,13 @@ var roles = Object.values(rolesById);
|
|
1909
1981
|
isKsAppClientDataAndMetaV3,
|
1910
1982
|
isKsAppClientDataNoMeta,
|
1911
1983
|
isKsAppClientDataNoMetaV3,
|
1984
|
+
isKsJsImports,
|
1912
1985
|
isKsMetaState,
|
1913
1986
|
isKsMetaStateV3,
|
1914
1987
|
isKsRemoteChange,
|
1915
1988
|
isKsRemoteChanges,
|
1989
|
+
isKsRendererClientGlobal,
|
1990
|
+
isKsRendererClientGlobalImportedModules,
|
1916
1991
|
isNotTokenReference,
|
1917
1992
|
isNumberProp,
|
1918
1993
|
isObjKey,
|
@@ -1943,7 +2018,6 @@ var roles = Object.values(rolesById);
|
|
1943
2018
|
isTokenValueFontWeight,
|
1944
2019
|
isTokenValueShadow,
|
1945
2020
|
isTokenValueTransition,
|
1946
|
-
ksRendererClientMetaId,
|
1947
2021
|
migrations,
|
1948
2022
|
pageElements,
|
1949
2023
|
pageElementsV2,
|