@sitecore-feaas/clientside 0.0.1 → 0.0.3
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/README.md +4 -4
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.d.ts +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/browser/react.cjs +3 -3
- package/dist/browser/react.d.ts +2 -2
- package/dist/browser/react.js +3 -3
- package/dist/browser/{webcomponent-189a307d.d.ts → webcomponent-7a0e7c34.d.ts} +8 -8
- package/dist/node/index.cjs +15 -13
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +15 -13
- package/dist/node/react.cjs +17 -15
- package/dist/node/react.d.ts +2 -2
- package/dist/node/react.js +17 -15
- package/dist/node/{webcomponent-189a307d.d.ts → webcomponent-7a0e7c34.d.ts} +8 -8
- package/examples/index.html +2 -2
- package/index.cjs +2 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +7 -1
- package/react.cjs +3 -3
- package/react.d.ts +2 -2
- package/react.js +3 -3
- package/src/cloud.ts +9 -9
- package/src/dom.ts +4 -2
- package/src/react.ts +2 -2
- package/src/webcomponent.ts +8 -8
- package/test/render.ts +4 -1
- package/tsconfig.json +1 -1
- package/{webcomponent-189a307d.d.ts → webcomponent-7a0e7c34.d.ts} +8 -8
|
@@ -2,16 +2,16 @@ interface CloudTemplate {
|
|
|
2
2
|
hostname?: string;
|
|
3
3
|
library: string;
|
|
4
4
|
component: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
version: string;
|
|
6
|
+
revision?: string;
|
|
7
7
|
}
|
|
8
8
|
interface CloudStylesheet {
|
|
9
9
|
hostname?: string;
|
|
10
10
|
library: string;
|
|
11
|
-
|
|
11
|
+
revision?: string;
|
|
12
12
|
}
|
|
13
|
-
declare function getComponentURL({ hostname, library, component,
|
|
14
|
-
declare function getStylesheetURL({ hostname, library,
|
|
13
|
+
declare function getComponentURL({ hostname, library, component, version, revision }: CloudTemplate): string;
|
|
14
|
+
declare function getStylesheetURL({ hostname, library, revision }: CloudStylesheet): string;
|
|
15
15
|
declare function fetchComponent(props: CloudTemplate, callback: (html: string) => void): Promise<Response>;
|
|
16
16
|
declare function fetchStylesheet(props: CloudStylesheet, callback: (css: string) => void): Promise<Response>;
|
|
17
17
|
|
|
@@ -51,8 +51,8 @@ declare global {
|
|
|
51
51
|
data?: any;
|
|
52
52
|
library: string;
|
|
53
53
|
component: string;
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
version: string;
|
|
55
|
+
revision?: string;
|
|
56
56
|
hostname?: string;
|
|
57
57
|
template?: string;
|
|
58
58
|
children?: any;
|
|
@@ -95,7 +95,7 @@ declare class HTMLFeaasStylesheet extends WebComponent {
|
|
|
95
95
|
render(): void;
|
|
96
96
|
getProps(): {
|
|
97
97
|
library: string;
|
|
98
|
-
|
|
98
|
+
revision: string;
|
|
99
99
|
hostname: string;
|
|
100
100
|
};
|
|
101
101
|
}
|
package/dist/node/index.cjs
CHANGED
|
@@ -834,17 +834,17 @@ function getComponentURL({
|
|
|
834
834
|
hostname = "https://feaascomponentsapidev.blob.core.windows.net",
|
|
835
835
|
library,
|
|
836
836
|
component,
|
|
837
|
-
|
|
838
|
-
|
|
837
|
+
version,
|
|
838
|
+
revision = "published"
|
|
839
839
|
}) {
|
|
840
|
-
return `${hostname}/components/${
|
|
840
|
+
return `${hostname}/components/${library}/${component}/${version}/${revision}.html`;
|
|
841
841
|
}
|
|
842
842
|
function getStylesheetURL({
|
|
843
843
|
hostname = `https://feaascomponentsapidev.blob.core.windows.net`,
|
|
844
844
|
library,
|
|
845
|
-
|
|
845
|
+
revision = "published"
|
|
846
846
|
}) {
|
|
847
|
-
return `${hostname}/styles/${library}/${
|
|
847
|
+
return `${hostname}/styles/${library}/${revision}.css`;
|
|
848
848
|
}
|
|
849
849
|
function fetchComponent(props, callback) {
|
|
850
850
|
return __async(this, null, function* () {
|
|
@@ -852,7 +852,7 @@ function fetchComponent(props, callback) {
|
|
|
852
852
|
getComponentURL(props),
|
|
853
853
|
{},
|
|
854
854
|
(response) => {
|
|
855
|
-
return response.headers.get("x-ms-meta-
|
|
855
|
+
return response.headers.get("x-ms-meta-versionDeletedAt") == null;
|
|
856
856
|
},
|
|
857
857
|
(response) => {
|
|
858
858
|
response.text().then(callback);
|
|
@@ -959,7 +959,7 @@ function queryScopes(scopes, datapath, singleValue = false, json = scopes) {
|
|
|
959
959
|
path,
|
|
960
960
|
json
|
|
961
961
|
});
|
|
962
|
-
if (singleValue && collection) {
|
|
962
|
+
if (singleValue && collection && Array.isArray(collection)) {
|
|
963
963
|
return collection[0];
|
|
964
964
|
} else {
|
|
965
965
|
return collection;
|
|
@@ -978,6 +978,8 @@ function setDOMAttribute(element, attribute, value, config) {
|
|
|
978
978
|
target = element.tagName == "IMG" ? element : element.querySelector("img, video");
|
|
979
979
|
} else if (attribute == "data-path-href") {
|
|
980
980
|
target = element.querySelector("a") || element.closest("a");
|
|
981
|
+
} else if (attribute == "data-path-alt") {
|
|
982
|
+
target = element.querySelector("img, picture");
|
|
981
983
|
} else if (attribute == "data-path-hidden") {
|
|
982
984
|
value = !value ? true : null;
|
|
983
985
|
} else if (attribute == "data-path" || attribute == "data-embed-html" || attribute == "html") {
|
|
@@ -1169,7 +1171,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1169
1171
|
this.isFetching = false;
|
|
1170
1172
|
}
|
|
1171
1173
|
static get observedAttributes() {
|
|
1172
|
-
return ["data", "library", "component", "
|
|
1174
|
+
return ["data", "library", "component", "version", "revision", "hostname", "template"];
|
|
1173
1175
|
}
|
|
1174
1176
|
connectedCallback() {
|
|
1175
1177
|
this.connected = true;
|
|
@@ -1232,7 +1234,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1232
1234
|
const newProps = this.getProps();
|
|
1233
1235
|
if (this.template == null) {
|
|
1234
1236
|
if (!this.isFetching) {
|
|
1235
|
-
if (newProps.component != null && newProps.
|
|
1237
|
+
if (newProps.component != null && newProps.version != null) {
|
|
1236
1238
|
this.isFetching = true;
|
|
1237
1239
|
fetchComponent(newProps, (template) => {
|
|
1238
1240
|
this.template = template;
|
|
@@ -1240,7 +1242,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1240
1242
|
renderDOMContent(this, this.template, newProps.data);
|
|
1241
1243
|
}).catch(() => {
|
|
1242
1244
|
console.error(
|
|
1243
|
-
`FEAAS: Could not fetch component: ${newProps.component}/${newProps.
|
|
1245
|
+
`FEAAS: Could not fetch component: ${newProps.component}/${newProps.version}/${newProps.revision}`
|
|
1244
1246
|
);
|
|
1245
1247
|
});
|
|
1246
1248
|
}
|
|
@@ -1254,8 +1256,8 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1254
1256
|
data: this.getData(),
|
|
1255
1257
|
library: this.getAttribute("library") || void 0,
|
|
1256
1258
|
component: this.getAttribute("component") || void 0,
|
|
1257
|
-
variant: this.getAttribute("variant") || void 0,
|
|
1258
1259
|
version: this.getAttribute("version") || void 0,
|
|
1260
|
+
revision: this.getAttribute("revision") || void 0,
|
|
1259
1261
|
hostname: this.getAttribute("hostname") || void 0
|
|
1260
1262
|
};
|
|
1261
1263
|
}
|
|
@@ -1266,7 +1268,7 @@ var HTMLFeaasStylesheet = class extends WebComponent {
|
|
|
1266
1268
|
this.connected = false;
|
|
1267
1269
|
}
|
|
1268
1270
|
static get observedAttributes() {
|
|
1269
|
-
return ["library", "
|
|
1271
|
+
return ["library", "revision", "hostname"];
|
|
1270
1272
|
}
|
|
1271
1273
|
connectedCallback() {
|
|
1272
1274
|
this.connected = true;
|
|
@@ -1287,7 +1289,7 @@ var HTMLFeaasStylesheet = class extends WebComponent {
|
|
|
1287
1289
|
getProps() {
|
|
1288
1290
|
return {
|
|
1289
1291
|
library: this.getAttribute("library") || void 0,
|
|
1290
|
-
|
|
1292
|
+
revision: this.getAttribute("revision") || void 0,
|
|
1291
1293
|
hostname: this.getAttribute("hostname") || void 0
|
|
1292
1294
|
};
|
|
1293
1295
|
}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HTMLFeaasComponent, a as HTMLFeaasStylesheet, D as Datascopes, F as FEAASCustomizations, C as CloudStylesheet, b as FEAASComponentProps } from './webcomponent-
|
|
2
|
-
export { D as Datascopes, E as ExplicitTemplate, b as FEAASComponentProps, F as FEAASCustomizations, H as HTMLFeaasComponent, a as HTMLFeaasStylesheet, d as autoloadScripts, c as cleanCollectionBit, l as loadScript, n as normalizeCollectionScope, o as observeDOMElement, q as queryScopes, i as renderComponent, r as renderComponentElement, j as renderComponentPromise, f as renderDOMContent, e as renderDOMElement, g as renderStylesheet, h as renderStylesheetPromise, s as setDOMAttribute } from './webcomponent-
|
|
1
|
+
import { H as HTMLFeaasComponent, a as HTMLFeaasStylesheet, D as Datascopes, F as FEAASCustomizations, C as CloudStylesheet, b as FEAASComponentProps } from './webcomponent-7a0e7c34.js';
|
|
2
|
+
export { D as Datascopes, E as ExplicitTemplate, b as FEAASComponentProps, F as FEAASCustomizations, H as HTMLFeaasComponent, a as HTMLFeaasStylesheet, d as autoloadScripts, c as cleanCollectionBit, l as loadScript, n as normalizeCollectionScope, o as observeDOMElement, q as queryScopes, i as renderComponent, r as renderComponentElement, j as renderComponentPromise, f as renderDOMContent, e as renderDOMElement, g as renderStylesheet, h as renderStylesheetPromise, s as setDOMAttribute } from './webcomponent-7a0e7c34.js';
|
|
3
3
|
|
|
4
4
|
declare function fetchAndRevalidate(url: Parameters<typeof fetch>[0], options: Parameters<typeof fetch>[1], validator: (resposne: Response) => boolean, callback: (response: Response, status: 'cached' | 'valid') => void): Promise<Response>;
|
|
5
5
|
|
package/dist/node/index.js
CHANGED
|
@@ -799,17 +799,17 @@ function getComponentURL({
|
|
|
799
799
|
hostname = "https://feaascomponentsapidev.blob.core.windows.net",
|
|
800
800
|
library,
|
|
801
801
|
component,
|
|
802
|
-
|
|
803
|
-
|
|
802
|
+
version,
|
|
803
|
+
revision = "published"
|
|
804
804
|
}) {
|
|
805
|
-
return `${hostname}/components/${
|
|
805
|
+
return `${hostname}/components/${library}/${component}/${version}/${revision}.html`;
|
|
806
806
|
}
|
|
807
807
|
function getStylesheetURL({
|
|
808
808
|
hostname = `https://feaascomponentsapidev.blob.core.windows.net`,
|
|
809
809
|
library,
|
|
810
|
-
|
|
810
|
+
revision = "published"
|
|
811
811
|
}) {
|
|
812
|
-
return `${hostname}/styles/${library}/${
|
|
812
|
+
return `${hostname}/styles/${library}/${revision}.css`;
|
|
813
813
|
}
|
|
814
814
|
function fetchComponent(props, callback) {
|
|
815
815
|
return __async(this, null, function* () {
|
|
@@ -817,7 +817,7 @@ function fetchComponent(props, callback) {
|
|
|
817
817
|
getComponentURL(props),
|
|
818
818
|
{},
|
|
819
819
|
(response) => {
|
|
820
|
-
return response.headers.get("x-ms-meta-
|
|
820
|
+
return response.headers.get("x-ms-meta-versionDeletedAt") == null;
|
|
821
821
|
},
|
|
822
822
|
(response) => {
|
|
823
823
|
response.text().then(callback);
|
|
@@ -924,7 +924,7 @@ function queryScopes(scopes, datapath, singleValue = false, json = scopes) {
|
|
|
924
924
|
path,
|
|
925
925
|
json
|
|
926
926
|
});
|
|
927
|
-
if (singleValue && collection) {
|
|
927
|
+
if (singleValue && collection && Array.isArray(collection)) {
|
|
928
928
|
return collection[0];
|
|
929
929
|
} else {
|
|
930
930
|
return collection;
|
|
@@ -943,6 +943,8 @@ function setDOMAttribute(element, attribute, value, config) {
|
|
|
943
943
|
target = element.tagName == "IMG" ? element : element.querySelector("img, video");
|
|
944
944
|
} else if (attribute == "data-path-href") {
|
|
945
945
|
target = element.querySelector("a") || element.closest("a");
|
|
946
|
+
} else if (attribute == "data-path-alt") {
|
|
947
|
+
target = element.querySelector("img, picture");
|
|
946
948
|
} else if (attribute == "data-path-hidden") {
|
|
947
949
|
value = !value ? true : null;
|
|
948
950
|
} else if (attribute == "data-path" || attribute == "data-embed-html" || attribute == "html") {
|
|
@@ -1134,7 +1136,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1134
1136
|
this.isFetching = false;
|
|
1135
1137
|
}
|
|
1136
1138
|
static get observedAttributes() {
|
|
1137
|
-
return ["data", "library", "component", "
|
|
1139
|
+
return ["data", "library", "component", "version", "revision", "hostname", "template"];
|
|
1138
1140
|
}
|
|
1139
1141
|
connectedCallback() {
|
|
1140
1142
|
this.connected = true;
|
|
@@ -1197,7 +1199,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1197
1199
|
const newProps = this.getProps();
|
|
1198
1200
|
if (this.template == null) {
|
|
1199
1201
|
if (!this.isFetching) {
|
|
1200
|
-
if (newProps.component != null && newProps.
|
|
1202
|
+
if (newProps.component != null && newProps.version != null) {
|
|
1201
1203
|
this.isFetching = true;
|
|
1202
1204
|
fetchComponent(newProps, (template) => {
|
|
1203
1205
|
this.template = template;
|
|
@@ -1205,7 +1207,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1205
1207
|
renderDOMContent(this, this.template, newProps.data);
|
|
1206
1208
|
}).catch(() => {
|
|
1207
1209
|
console.error(
|
|
1208
|
-
`FEAAS: Could not fetch component: ${newProps.component}/${newProps.
|
|
1210
|
+
`FEAAS: Could not fetch component: ${newProps.component}/${newProps.version}/${newProps.revision}`
|
|
1209
1211
|
);
|
|
1210
1212
|
});
|
|
1211
1213
|
}
|
|
@@ -1219,8 +1221,8 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1219
1221
|
data: this.getData(),
|
|
1220
1222
|
library: this.getAttribute("library") || void 0,
|
|
1221
1223
|
component: this.getAttribute("component") || void 0,
|
|
1222
|
-
variant: this.getAttribute("variant") || void 0,
|
|
1223
1224
|
version: this.getAttribute("version") || void 0,
|
|
1225
|
+
revision: this.getAttribute("revision") || void 0,
|
|
1224
1226
|
hostname: this.getAttribute("hostname") || void 0
|
|
1225
1227
|
};
|
|
1226
1228
|
}
|
|
@@ -1231,7 +1233,7 @@ var HTMLFeaasStylesheet = class extends WebComponent {
|
|
|
1231
1233
|
this.connected = false;
|
|
1232
1234
|
}
|
|
1233
1235
|
static get observedAttributes() {
|
|
1234
|
-
return ["library", "
|
|
1236
|
+
return ["library", "revision", "hostname"];
|
|
1235
1237
|
}
|
|
1236
1238
|
connectedCallback() {
|
|
1237
1239
|
this.connected = true;
|
|
@@ -1252,7 +1254,7 @@ var HTMLFeaasStylesheet = class extends WebComponent {
|
|
|
1252
1254
|
getProps() {
|
|
1253
1255
|
return {
|
|
1254
1256
|
library: this.getAttribute("library") || void 0,
|
|
1255
|
-
|
|
1257
|
+
revision: this.getAttribute("revision") || void 0,
|
|
1256
1258
|
hostname: this.getAttribute("hostname") || void 0
|
|
1257
1259
|
};
|
|
1258
1260
|
}
|
package/dist/node/react.cjs
CHANGED
|
@@ -128,17 +128,17 @@ function getComponentURL({
|
|
|
128
128
|
hostname = "https://feaascomponentsapidev.blob.core.windows.net",
|
|
129
129
|
library,
|
|
130
130
|
component,
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
version,
|
|
132
|
+
revision = "published"
|
|
133
133
|
}) {
|
|
134
|
-
return `${hostname}/components/${
|
|
134
|
+
return `${hostname}/components/${library}/${component}/${version}/${revision}.html`;
|
|
135
135
|
}
|
|
136
136
|
function getStylesheetURL({
|
|
137
137
|
hostname = `https://feaascomponentsapidev.blob.core.windows.net`,
|
|
138
138
|
library,
|
|
139
|
-
|
|
139
|
+
revision = "published"
|
|
140
140
|
}) {
|
|
141
|
-
return `${hostname}/styles/${library}/${
|
|
141
|
+
return `${hostname}/styles/${library}/${revision}.css`;
|
|
142
142
|
}
|
|
143
143
|
function fetchComponent(props, callback) {
|
|
144
144
|
return __async(this, null, function* () {
|
|
@@ -146,7 +146,7 @@ function fetchComponent(props, callback) {
|
|
|
146
146
|
getComponentURL(props),
|
|
147
147
|
{},
|
|
148
148
|
(response) => {
|
|
149
|
-
return response.headers.get("x-ms-meta-
|
|
149
|
+
return response.headers.get("x-ms-meta-versionDeletedAt") == null;
|
|
150
150
|
},
|
|
151
151
|
(response) => {
|
|
152
152
|
response.text().then(callback);
|
|
@@ -971,7 +971,7 @@ function queryScopes(scopes, datapath, singleValue = false, json = scopes) {
|
|
|
971
971
|
path,
|
|
972
972
|
json
|
|
973
973
|
});
|
|
974
|
-
if (singleValue && collection) {
|
|
974
|
+
if (singleValue && collection && Array.isArray(collection)) {
|
|
975
975
|
return collection[0];
|
|
976
976
|
} else {
|
|
977
977
|
return collection;
|
|
@@ -990,6 +990,8 @@ function setDOMAttribute(element, attribute, value, config) {
|
|
|
990
990
|
target = element.tagName == "IMG" ? element : element.querySelector("img, video");
|
|
991
991
|
} else if (attribute == "data-path-href") {
|
|
992
992
|
target = element.querySelector("a") || element.closest("a");
|
|
993
|
+
} else if (attribute == "data-path-alt") {
|
|
994
|
+
target = element.querySelector("img, picture");
|
|
993
995
|
} else if (attribute == "data-path-hidden") {
|
|
994
996
|
value = !value ? true : null;
|
|
995
997
|
} else if (attribute == "data-path" || attribute == "data-embed-html" || attribute == "html") {
|
|
@@ -1181,7 +1183,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1181
1183
|
this.isFetching = false;
|
|
1182
1184
|
}
|
|
1183
1185
|
static get observedAttributes() {
|
|
1184
|
-
return ["data", "library", "component", "
|
|
1186
|
+
return ["data", "library", "component", "version", "revision", "hostname", "template"];
|
|
1185
1187
|
}
|
|
1186
1188
|
connectedCallback() {
|
|
1187
1189
|
this.connected = true;
|
|
@@ -1244,7 +1246,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1244
1246
|
const newProps = this.getProps();
|
|
1245
1247
|
if (this.template == null) {
|
|
1246
1248
|
if (!this.isFetching) {
|
|
1247
|
-
if (newProps.component != null && newProps.
|
|
1249
|
+
if (newProps.component != null && newProps.version != null) {
|
|
1248
1250
|
this.isFetching = true;
|
|
1249
1251
|
fetchComponent(newProps, (template) => {
|
|
1250
1252
|
this.template = template;
|
|
@@ -1252,7 +1254,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1252
1254
|
renderDOMContent(this, this.template, newProps.data);
|
|
1253
1255
|
}).catch(() => {
|
|
1254
1256
|
console.error(
|
|
1255
|
-
`FEAAS: Could not fetch component: ${newProps.component}/${newProps.
|
|
1257
|
+
`FEAAS: Could not fetch component: ${newProps.component}/${newProps.version}/${newProps.revision}`
|
|
1256
1258
|
);
|
|
1257
1259
|
});
|
|
1258
1260
|
}
|
|
@@ -1266,8 +1268,8 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1266
1268
|
data: this.getData(),
|
|
1267
1269
|
library: this.getAttribute("library") || void 0,
|
|
1268
1270
|
component: this.getAttribute("component") || void 0,
|
|
1269
|
-
variant: this.getAttribute("variant") || void 0,
|
|
1270
1271
|
version: this.getAttribute("version") || void 0,
|
|
1272
|
+
revision: this.getAttribute("revision") || void 0,
|
|
1271
1273
|
hostname: this.getAttribute("hostname") || void 0
|
|
1272
1274
|
};
|
|
1273
1275
|
}
|
|
@@ -1278,7 +1280,7 @@ var HTMLFeaasStylesheet = class extends WebComponent {
|
|
|
1278
1280
|
this.connected = false;
|
|
1279
1281
|
}
|
|
1280
1282
|
static get observedAttributes() {
|
|
1281
|
-
return ["library", "
|
|
1283
|
+
return ["library", "revision", "hostname"];
|
|
1282
1284
|
}
|
|
1283
1285
|
connectedCallback() {
|
|
1284
1286
|
this.connected = true;
|
|
@@ -1299,7 +1301,7 @@ var HTMLFeaasStylesheet = class extends WebComponent {
|
|
|
1299
1301
|
getProps() {
|
|
1300
1302
|
return {
|
|
1301
1303
|
library: this.getAttribute("library") || void 0,
|
|
1302
|
-
|
|
1304
|
+
revision: this.getAttribute("revision") || void 0,
|
|
1303
1305
|
hostname: this.getAttribute("hostname") || void 0
|
|
1304
1306
|
};
|
|
1305
1307
|
}
|
|
@@ -1319,12 +1321,12 @@ function Component(props) {
|
|
|
1319
1321
|
if (template == null && !("template" in props)) {
|
|
1320
1322
|
fetchComponent(props, setTemplate).catch(() => {
|
|
1321
1323
|
console.error(
|
|
1322
|
-
`FEAAS: Could not fetch component: ${props.library}/${props.component}/${props.
|
|
1324
|
+
`FEAAS: Could not fetch component: ${props.library}/${props.component}/${props.version}/${props.revision}`
|
|
1323
1325
|
);
|
|
1324
1326
|
});
|
|
1325
1327
|
}
|
|
1326
1328
|
},
|
|
1327
|
-
"template" in props ? [props.template, null, null, null] : [props.library, props.component, props.
|
|
1329
|
+
"template" in props ? [props.template, null, null, null] : [props.library, props.component, props.version, props.revision, props.hostname]
|
|
1328
1330
|
);
|
|
1329
1331
|
import_react.default.useEffect(() => {
|
|
1330
1332
|
if (ref.current && template) {
|
package/dist/node/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { b as FEAASComponentProps, C as CloudStylesheet, H as HTMLFeaasComponent, a as HTMLFeaasStylesheet, D as Datascopes, F as FEAASCustomizations } from './webcomponent-
|
|
3
|
-
export { C as CloudStylesheet, k as CloudTemplate, D as Datascopes, E as ExplicitTemplate, b as FEAASComponentProps, F as FEAASCustomizations, H as HTMLFeaasComponent, a as HTMLFeaasStylesheet, d as autoloadScripts, c as cleanCollectionBit, t as fetchComponent, u as fetchStylesheet, m as getComponentURL, p as getStylesheetURL, l as loadScript, n as normalizeCollectionScope, o as observeDOMElement, q as queryScopes, i as renderComponent, r as renderComponentElement, j as renderComponentPromise, f as renderDOMContent, e as renderDOMElement, g as renderStylesheet, h as renderStylesheetPromise, s as setDOMAttribute } from './webcomponent-
|
|
2
|
+
import { b as FEAASComponentProps, C as CloudStylesheet, H as HTMLFeaasComponent, a as HTMLFeaasStylesheet, D as Datascopes, F as FEAASCustomizations } from './webcomponent-7a0e7c34.js';
|
|
3
|
+
export { C as CloudStylesheet, k as CloudTemplate, D as Datascopes, E as ExplicitTemplate, b as FEAASComponentProps, F as FEAASCustomizations, H as HTMLFeaasComponent, a as HTMLFeaasStylesheet, d as autoloadScripts, c as cleanCollectionBit, t as fetchComponent, u as fetchStylesheet, m as getComponentURL, p as getStylesheetURL, l as loadScript, n as normalizeCollectionScope, o as observeDOMElement, q as queryScopes, i as renderComponent, r as renderComponentElement, j as renderComponentPromise, f as renderDOMContent, e as renderDOMElement, g as renderStylesheet, h as renderStylesheetPromise, s as setDOMAttribute } from './webcomponent-7a0e7c34.js';
|
|
4
4
|
|
|
5
5
|
declare function Component(props: FEAASComponentProps): React.DetailedReactHTMLElement<{
|
|
6
6
|
ref: React.MutableRefObject<HTMLElement>;
|
package/dist/node/react.js
CHANGED
|
@@ -84,17 +84,17 @@ function getComponentURL({
|
|
|
84
84
|
hostname = "https://feaascomponentsapidev.blob.core.windows.net",
|
|
85
85
|
library,
|
|
86
86
|
component,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
version,
|
|
88
|
+
revision = "published"
|
|
89
89
|
}) {
|
|
90
|
-
return `${hostname}/components/${
|
|
90
|
+
return `${hostname}/components/${library}/${component}/${version}/${revision}.html`;
|
|
91
91
|
}
|
|
92
92
|
function getStylesheetURL({
|
|
93
93
|
hostname = `https://feaascomponentsapidev.blob.core.windows.net`,
|
|
94
94
|
library,
|
|
95
|
-
|
|
95
|
+
revision = "published"
|
|
96
96
|
}) {
|
|
97
|
-
return `${hostname}/styles/${library}/${
|
|
97
|
+
return `${hostname}/styles/${library}/${revision}.css`;
|
|
98
98
|
}
|
|
99
99
|
function fetchComponent(props, callback) {
|
|
100
100
|
return __async(this, null, function* () {
|
|
@@ -102,7 +102,7 @@ function fetchComponent(props, callback) {
|
|
|
102
102
|
getComponentURL(props),
|
|
103
103
|
{},
|
|
104
104
|
(response) => {
|
|
105
|
-
return response.headers.get("x-ms-meta-
|
|
105
|
+
return response.headers.get("x-ms-meta-versionDeletedAt") == null;
|
|
106
106
|
},
|
|
107
107
|
(response) => {
|
|
108
108
|
response.text().then(callback);
|
|
@@ -927,7 +927,7 @@ function queryScopes(scopes, datapath, singleValue = false, json = scopes) {
|
|
|
927
927
|
path,
|
|
928
928
|
json
|
|
929
929
|
});
|
|
930
|
-
if (singleValue && collection) {
|
|
930
|
+
if (singleValue && collection && Array.isArray(collection)) {
|
|
931
931
|
return collection[0];
|
|
932
932
|
} else {
|
|
933
933
|
return collection;
|
|
@@ -946,6 +946,8 @@ function setDOMAttribute(element, attribute, value, config) {
|
|
|
946
946
|
target = element.tagName == "IMG" ? element : element.querySelector("img, video");
|
|
947
947
|
} else if (attribute == "data-path-href") {
|
|
948
948
|
target = element.querySelector("a") || element.closest("a");
|
|
949
|
+
} else if (attribute == "data-path-alt") {
|
|
950
|
+
target = element.querySelector("img, picture");
|
|
949
951
|
} else if (attribute == "data-path-hidden") {
|
|
950
952
|
value = !value ? true : null;
|
|
951
953
|
} else if (attribute == "data-path" || attribute == "data-embed-html" || attribute == "html") {
|
|
@@ -1137,7 +1139,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1137
1139
|
this.isFetching = false;
|
|
1138
1140
|
}
|
|
1139
1141
|
static get observedAttributes() {
|
|
1140
|
-
return ["data", "library", "component", "
|
|
1142
|
+
return ["data", "library", "component", "version", "revision", "hostname", "template"];
|
|
1141
1143
|
}
|
|
1142
1144
|
connectedCallback() {
|
|
1143
1145
|
this.connected = true;
|
|
@@ -1200,7 +1202,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1200
1202
|
const newProps = this.getProps();
|
|
1201
1203
|
if (this.template == null) {
|
|
1202
1204
|
if (!this.isFetching) {
|
|
1203
|
-
if (newProps.component != null && newProps.
|
|
1205
|
+
if (newProps.component != null && newProps.version != null) {
|
|
1204
1206
|
this.isFetching = true;
|
|
1205
1207
|
fetchComponent(newProps, (template) => {
|
|
1206
1208
|
this.template = template;
|
|
@@ -1208,7 +1210,7 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1208
1210
|
renderDOMContent(this, this.template, newProps.data);
|
|
1209
1211
|
}).catch(() => {
|
|
1210
1212
|
console.error(
|
|
1211
|
-
`FEAAS: Could not fetch component: ${newProps.component}/${newProps.
|
|
1213
|
+
`FEAAS: Could not fetch component: ${newProps.component}/${newProps.version}/${newProps.revision}`
|
|
1212
1214
|
);
|
|
1213
1215
|
});
|
|
1214
1216
|
}
|
|
@@ -1222,8 +1224,8 @@ var HTMLFeaasComponent = class extends WebComponent {
|
|
|
1222
1224
|
data: this.getData(),
|
|
1223
1225
|
library: this.getAttribute("library") || void 0,
|
|
1224
1226
|
component: this.getAttribute("component") || void 0,
|
|
1225
|
-
variant: this.getAttribute("variant") || void 0,
|
|
1226
1227
|
version: this.getAttribute("version") || void 0,
|
|
1228
|
+
revision: this.getAttribute("revision") || void 0,
|
|
1227
1229
|
hostname: this.getAttribute("hostname") || void 0
|
|
1228
1230
|
};
|
|
1229
1231
|
}
|
|
@@ -1234,7 +1236,7 @@ var HTMLFeaasStylesheet = class extends WebComponent {
|
|
|
1234
1236
|
this.connected = false;
|
|
1235
1237
|
}
|
|
1236
1238
|
static get observedAttributes() {
|
|
1237
|
-
return ["library", "
|
|
1239
|
+
return ["library", "revision", "hostname"];
|
|
1238
1240
|
}
|
|
1239
1241
|
connectedCallback() {
|
|
1240
1242
|
this.connected = true;
|
|
@@ -1255,7 +1257,7 @@ var HTMLFeaasStylesheet = class extends WebComponent {
|
|
|
1255
1257
|
getProps() {
|
|
1256
1258
|
return {
|
|
1257
1259
|
library: this.getAttribute("library") || void 0,
|
|
1258
|
-
|
|
1260
|
+
revision: this.getAttribute("revision") || void 0,
|
|
1259
1261
|
hostname: this.getAttribute("hostname") || void 0
|
|
1260
1262
|
};
|
|
1261
1263
|
}
|
|
@@ -1275,12 +1277,12 @@ function Component(props) {
|
|
|
1275
1277
|
if (template == null && !("template" in props)) {
|
|
1276
1278
|
fetchComponent(props, setTemplate).catch(() => {
|
|
1277
1279
|
console.error(
|
|
1278
|
-
`FEAAS: Could not fetch component: ${props.library}/${props.component}/${props.
|
|
1280
|
+
`FEAAS: Could not fetch component: ${props.library}/${props.component}/${props.version}/${props.revision}`
|
|
1279
1281
|
);
|
|
1280
1282
|
});
|
|
1281
1283
|
}
|
|
1282
1284
|
},
|
|
1283
|
-
"template" in props ? [props.template, null, null, null] : [props.library, props.component, props.
|
|
1285
|
+
"template" in props ? [props.template, null, null, null] : [props.library, props.component, props.version, props.revision, props.hostname]
|
|
1284
1286
|
);
|
|
1285
1287
|
React.useEffect(() => {
|
|
1286
1288
|
if (ref.current && template) {
|
|
@@ -2,16 +2,16 @@ interface CloudTemplate {
|
|
|
2
2
|
hostname?: string;
|
|
3
3
|
library: string;
|
|
4
4
|
component: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
version: string;
|
|
6
|
+
revision?: string;
|
|
7
7
|
}
|
|
8
8
|
interface CloudStylesheet {
|
|
9
9
|
hostname?: string;
|
|
10
10
|
library: string;
|
|
11
|
-
|
|
11
|
+
revision?: string;
|
|
12
12
|
}
|
|
13
|
-
declare function getComponentURL({ hostname, library, component,
|
|
14
|
-
declare function getStylesheetURL({ hostname, library,
|
|
13
|
+
declare function getComponentURL({ hostname, library, component, version, revision }: CloudTemplate): string;
|
|
14
|
+
declare function getStylesheetURL({ hostname, library, revision }: CloudStylesheet): string;
|
|
15
15
|
declare function fetchComponent(props: CloudTemplate, callback: (html: string) => void): Promise<Response>;
|
|
16
16
|
declare function fetchStylesheet(props: CloudStylesheet, callback: (css: string) => void): Promise<Response>;
|
|
17
17
|
|
|
@@ -51,8 +51,8 @@ declare global {
|
|
|
51
51
|
data?: any;
|
|
52
52
|
library: string;
|
|
53
53
|
component: string;
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
version: string;
|
|
55
|
+
revision?: string;
|
|
56
56
|
hostname?: string;
|
|
57
57
|
template?: string;
|
|
58
58
|
children?: any;
|
|
@@ -95,7 +95,7 @@ declare class HTMLFeaasStylesheet extends WebComponent {
|
|
|
95
95
|
render(): void;
|
|
96
96
|
getProps(): {
|
|
97
97
|
library: string;
|
|
98
|
-
|
|
98
|
+
revision: string;
|
|
99
99
|
hostname: string;
|
|
100
100
|
};
|
|
101
101
|
}
|
package/examples/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
FEAAS.renderComponent(
|
|
5
5
|
{
|
|
6
6
|
componentId: 'our-dominator1',
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
versionId: 'dominator1-version2',
|
|
8
|
+
revision: 'staged',
|
|
9
9
|
hostname: 'https://feaascomponentsapidev.blob.core.windows.net',
|
|
10
10
|
data: data
|
|
11
11
|
},
|