@joryio/web-sdk 1.4.0-beta.5 → 1.4.0-beta.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.
- package/CHANGELOG.md +12 -0
- package/dist/core/config.d.ts +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/page-edits.d.ts +1 -1
- package/dist/core/page-edits.d.ts.map +1 -1
- package/dist/core/sdk-host-files.d.ts +1 -1
- package/dist/core/sdk-host-files.d.ts.map +1 -1
- package/dist/editor/editor-model.d.ts +21 -0
- package/dist/editor/editor-model.d.ts.map +1 -0
- package/dist/editor/editor-strings.d.ts +89 -0
- package/dist/editor/editor-strings.d.ts.map +1 -0
- package/dist/editor/editor-ui.d.ts +26 -0
- package/dist/editor/editor-ui.d.ts.map +1 -0
- package/dist/editor/liquid-field.d.ts +22 -0
- package/dist/editor/liquid-field.d.ts.map +1 -0
- package/dist/editor/visual-editor.d.ts +65 -8
- package/dist/editor/visual-editor.d.ts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/joryio-cards-ui.min.js +1 -1
- package/dist/joryio-editor.min.js +2 -2
- package/dist/joryio-editor.min.js.map +1 -1
- package/dist/joryio-sw.js +1 -1
- package/dist/joryio.cjs.js +48 -31
- package/dist/joryio.min.js +2 -2
- package/dist/joryio.min.js.map +1 -1
- package/dist/joryio.mjs +48 -31
- package/dist/joryio.umd.js +48 -31
- package/package.json +1 -1
- package/src/core/config.ts +1 -1
- package/src/core/page-edits.ts +43 -22
- package/src/core/sdk-host-files.ts +15 -10
- package/src/editor/editor-model.ts +153 -0
- package/src/editor/editor-strings.ts +112 -0
- package/src/editor/editor-ui.ts +173 -0
- package/src/editor/liquid-field.ts +301 -0
- package/src/editor/visual-editor.ts +1032 -105
package/dist/joryio-sw.js
CHANGED
package/dist/joryio.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Joryio Web SDK v1.4.0-beta.
|
|
2
|
+
* Joryio Web SDK v1.4.0-beta.7
|
|
3
3
|
* (c) 2026 Joryio. All rights reserved.
|
|
4
4
|
* @license Commercial - see https://github.com/joryio/joryio-web-sdk/blob/main/LICENSE
|
|
5
5
|
*/
|
|
@@ -29,7 +29,7 @@ function bucketHash(input) {
|
|
|
29
29
|
return fmix32(hash >>> 0);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const SDK_VERSION = '1.4.0';
|
|
32
|
+
const SDK_VERSION = '1.4.0-beta.7';
|
|
33
33
|
const SDK_PLATFORM_HEADER = 'X-Joryio-SDK';
|
|
34
34
|
const SDK_VERSION_HEADER = 'X-Joryio-SDK-Version';
|
|
35
35
|
const SDK_PLATFORM = 'web';
|
|
@@ -550,7 +550,7 @@ function pageTriggerMet(trigger, signal, progress) {
|
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
const PAGE_EDIT_POSITIONS = ['before', 'after', 'prepend', 'append'];
|
|
553
|
+
const PAGE_EDIT_POSITIONS = ['before', 'after', 'prepend', 'append', 'replace'];
|
|
554
554
|
const PAGE_EDITS_CAPABILITY = 'page_edits';
|
|
555
555
|
const PAGE_EDIT_ANTI_FLICKER_MS = 300;
|
|
556
556
|
const MAX_SELECTOR_LENGTH = 500;
|
|
@@ -606,6 +606,27 @@ function safeRestoredUrl(v) {
|
|
|
606
606
|
}
|
|
607
607
|
const safeRestoredSrcset = (v) => typeof v === 'string' && v.split(',').every((c) => !c.trim() || safeRestoredUrl(c.trim().split(/\s+/)[0]) !== null) ? v : null;
|
|
608
608
|
const HIDE_DECLARATION = 'display:none !important';
|
|
609
|
+
function hideElement(h) {
|
|
610
|
+
const display = h.style.getPropertyValue('display');
|
|
611
|
+
const priority = h.style.getPropertyPriority('display');
|
|
612
|
+
h.style.setProperty('display', 'none', 'important');
|
|
613
|
+
return () => (display ? h.style.setProperty('display', display, priority) : h.style.removeProperty('display'));
|
|
614
|
+
}
|
|
615
|
+
function undoServerHide(el, orig) {
|
|
616
|
+
var _a;
|
|
617
|
+
const current = el.getAttribute('style') || '';
|
|
618
|
+
const before = typeof orig.style === 'string' ? orig.style : null;
|
|
619
|
+
const base = before === null ? '' : before.trim().replace(/;+$/, '');
|
|
620
|
+
if (current === (base ? base + ';' : '') + HIDE_DECLARATION) {
|
|
621
|
+
if (before === null)
|
|
622
|
+
el.removeAttribute('style');
|
|
623
|
+
else
|
|
624
|
+
el.setAttribute('style', before);
|
|
625
|
+
}
|
|
626
|
+
else if (((_a = el.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue('display')) === 'none') {
|
|
627
|
+
el.style.removeProperty('display');
|
|
628
|
+
}
|
|
629
|
+
}
|
|
609
630
|
const RESTORE_ELEMENTS = new Set(['A', 'ABBR', 'B', 'BDI', 'BDO', 'BR', 'CITE', 'CODE', 'DATA', 'DEL', 'DFN', 'EM', 'I', 'IMG', 'INS', 'KBD', 'MARK', 'Q', 'S', 'SAMP', 'SMALL', 'SPAN', 'STRONG', 'SUB', 'SUP', 'TIME', 'U', 'VAR', 'WBR']);
|
|
610
631
|
const RESTORE_ATTRIBUTES = new Set(['class', 'id', 'title', 'lang', 'dir', 'alt', 'width', 'height', 'datetime', 'href', 'src', 'srcset', 'rel', 'target']);
|
|
611
632
|
const MAX_RESTORE_NODES = 500;
|
|
@@ -1067,19 +1088,21 @@ class PageEditManager {
|
|
|
1067
1088
|
el.setAttribute('href', edit.value);
|
|
1068
1089
|
return () => (href === null ? el.removeAttribute('href') : el.setAttribute('href', href));
|
|
1069
1090
|
}
|
|
1070
|
-
case 'hide':
|
|
1071
|
-
|
|
1072
|
-
const priority = h.style.getPropertyPriority('display');
|
|
1073
|
-
h.style.setProperty('display', 'none', 'important');
|
|
1074
|
-
return () => (display ? h.style.setProperty('display', display, priority) : h.style.removeProperty('display'));
|
|
1075
|
-
}
|
|
1091
|
+
case 'hide':
|
|
1092
|
+
return hideElement(h);
|
|
1076
1093
|
case 'insert_placement': {
|
|
1077
1094
|
const spot = document.createElement('div');
|
|
1078
1095
|
spot.setAttribute('data-joryio-placement', edit.placementKey);
|
|
1079
1096
|
spot.setAttribute('data-joryio-edit', edit.id);
|
|
1080
1097
|
const where = edit.position === 'before' ? 'beforebegin' : edit.position === 'prepend' ? 'afterbegin' : edit.position === 'append' ? 'beforeend' : 'afterend';
|
|
1081
1098
|
el.insertAdjacentElement(where, spot);
|
|
1082
|
-
|
|
1099
|
+
if (edit.position !== 'replace')
|
|
1100
|
+
return () => spot.remove();
|
|
1101
|
+
const show = hideElement(h);
|
|
1102
|
+
return () => {
|
|
1103
|
+
spot.remove();
|
|
1104
|
+
show();
|
|
1105
|
+
};
|
|
1083
1106
|
}
|
|
1084
1107
|
default:
|
|
1085
1108
|
return null;
|
|
@@ -1260,7 +1283,6 @@ class PageEditManager {
|
|
|
1260
1283
|
}
|
|
1261
1284
|
}
|
|
1262
1285
|
undoServerEdit(token, edit) {
|
|
1263
|
-
var _a;
|
|
1264
1286
|
for (const el of Array.from(document.querySelectorAll(`[${SERVER_APPLIED_ATTR}]`))) {
|
|
1265
1287
|
const tokens = tokensOf(el);
|
|
1266
1288
|
if (!tokens.includes(token))
|
|
@@ -1269,7 +1291,7 @@ class PageEditManager {
|
|
|
1269
1291
|
try {
|
|
1270
1292
|
all = JSON.parse(el.getAttribute(SERVER_ORIG_ATTR) || '{}') || {};
|
|
1271
1293
|
}
|
|
1272
|
-
catch (
|
|
1294
|
+
catch (_a) {
|
|
1273
1295
|
all = {};
|
|
1274
1296
|
}
|
|
1275
1297
|
const orig = all[token] || {};
|
|
@@ -1305,26 +1327,18 @@ class PageEditManager {
|
|
|
1305
1327
|
el.setAttribute('href', href);
|
|
1306
1328
|
}
|
|
1307
1329
|
break;
|
|
1308
|
-
case 'hide':
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1314
|
-
el.removeAttribute('style');
|
|
1315
|
-
else
|
|
1316
|
-
el.setAttribute('style', before);
|
|
1317
|
-
}
|
|
1318
|
-
else if (((_a = el.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue('display')) === 'none') {
|
|
1319
|
-
el.style.removeProperty('display');
|
|
1320
|
-
}
|
|
1330
|
+
case 'hide':
|
|
1331
|
+
undoServerHide(el, orig);
|
|
1332
|
+
break;
|
|
1333
|
+
case 'insert_placement':
|
|
1334
|
+
if (edit.position === 'replace')
|
|
1335
|
+
undoServerHide(el, orig);
|
|
1321
1336
|
break;
|
|
1322
|
-
}
|
|
1323
1337
|
default:
|
|
1324
1338
|
break;
|
|
1325
1339
|
}
|
|
1326
1340
|
}
|
|
1327
|
-
catch (
|
|
1341
|
+
catch (_b) {
|
|
1328
1342
|
}
|
|
1329
1343
|
const left = tokens.filter((t) => t !== token);
|
|
1330
1344
|
if (left.length)
|
|
@@ -1417,13 +1431,16 @@ function readOwnFolder() {
|
|
|
1417
1431
|
return null;
|
|
1418
1432
|
}
|
|
1419
1433
|
const OWN_FOLDER = readOwnFolder();
|
|
1420
|
-
function sdkHostFileUrls(file, override, ownFolder = OWN_FOLDER) {
|
|
1434
|
+
function sdkHostFileUrls(file, override, ownFolder = OWN_FOLDER, version = SDK_VERSION) {
|
|
1421
1435
|
if (override)
|
|
1422
1436
|
return [override];
|
|
1423
|
-
const major =
|
|
1424
|
-
const exact = `${SDK_HOST}/web/${
|
|
1437
|
+
const major = version.split('.')[0];
|
|
1438
|
+
const exact = `${SDK_HOST}/web/${version}/${file}`;
|
|
1425
1439
|
const channel = `${SDK_HOST}/web/${major}/${file}`;
|
|
1426
|
-
const
|
|
1440
|
+
const prerelease = version.includes('-');
|
|
1441
|
+
let urls = ownFolder && ownFolder !== `${SDK_HOST}/web/${major}/` ? [`${ownFolder}${file}`, exact, channel] : [exact, channel];
|
|
1442
|
+
if (prerelease)
|
|
1443
|
+
urls = urls.filter((u) => u !== channel);
|
|
1427
1444
|
return urls.filter((u, i) => urls.indexOf(u) === i);
|
|
1428
1445
|
}
|
|
1429
1446
|
function loadSdkScript(src, marker) {
|