@panphora/clayjs 1.5.3 → 1.6.1
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 +5 -3
- package/THIRD-PARTY-NOTICES.md +6 -0
- package/dist/clay.standalone.js +15041 -10657
- package/package.json +9 -4
- package/src/core/conflict-download.js +91 -0
- package/src/core/conflict-notice.js +720 -0
- package/src/core/conflict-presentation.js +301 -0
- package/src/core/save-conflict-notice.js +2 -192
- package/src/core/save-core.js +35 -2
- package/src/core/save-feedback.js +6 -0
- package/src/core/save.js +157 -3
- package/src/core/snapshot.js +21 -0
- package/src/core/stale-host-notice.js +21 -24
- package/src/core/unsaved-warning.js +64 -16
- package/src/lib/content-dom.js +4 -2
- package/src/lib/dirty-gate.js +37 -1
- package/src/lib/unsaved-state.js +55 -0
- package/src/loader-logic.js +26 -15
- package/src/loader.js +10 -3
- package/src/plugins/ai-edit.js +489 -179
- package/src/plugins/cms.js +12 -0
- package/src/plugins/indicator.js +35 -16
- package/src/plugins/quickcrop.js +103 -0
- package/src/plugins/richclay.js +21 -0
- package/src/plugins/source.js +13 -6
- package/src/plugins/wire.js +4 -0
- package/src/sync/conflict-revert.js +1138 -0
- package/src/sync/conflicts.js +159 -0
- package/src/sync/live-sync.js +130 -109
- package/src/sync/presence.js +42 -36
- package/src/sync/section-notice.js +53 -28
- package/src/ui/bevel-controls.js +277 -0
- package/src/ui/bevel-dialog.js +112 -0
- package/src/ui/bevel.js +247 -0
- package/src/ui/dialogs.js +63 -86
- package/src/ui/index.js +22 -11
- package/src/ui/modal.js +80 -387
- package/src/ui/skins/cms-toggle.js +15 -0
- package/src/ui/skins/cms.js +4 -0
- package/src/ui/skins/quickcrop.js +4 -0
- package/src/ui/skins/richclay.js +4 -0
- package/src/ui/toast.js +116 -401
- package/src/ui/vendor-skin.js +65 -0
- package/src/vendor/hyper-morph.vendor.js +4 -4
- package/src/vendor/quickcrop.vendor.js +14 -8
- package/src/vendor/richclay.vendor.js +22 -41
|
@@ -24,6 +24,12 @@ function el(tag, cls = '', text = '') {
|
|
|
24
24
|
return n;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// Geometry goes on inline and !important: a host page's `img { width: auto !important }`
|
|
28
|
+
// beats a plain inline style, and the crop math assumes the sizes written here.
|
|
29
|
+
function pin(node, prop, value) {
|
|
30
|
+
node.style.setProperty(prop, value, 'important');
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
function escapeHtml(str) {
|
|
28
34
|
return String(str).replace(/[&<>"']/g, c => ({
|
|
29
35
|
'&': '&', '<': '<', '>': '>', '"': '"', "'": ''',
|
|
@@ -229,8 +235,8 @@ function quickcrop(file, options = {}) {
|
|
|
229
235
|
ensureStyles();
|
|
230
236
|
|
|
231
237
|
const stage = el('div', 'qc-stage');
|
|
232
|
-
img
|
|
233
|
-
img
|
|
238
|
+
pin(img, 'width', dispW + 'px');
|
|
239
|
+
pin(img, 'height', dispH + 'px');
|
|
234
240
|
const dim = el('div', 'qc-dim');
|
|
235
241
|
const box = el('div', 'qc-box');
|
|
236
242
|
for (const c of ['nw', 'ne', 'sw', 'se']) box.appendChild(el('div', 'qc-handle qc-' + c));
|
|
@@ -251,15 +257,15 @@ function quickcrop(file, options = {}) {
|
|
|
251
257
|
render();
|
|
252
258
|
|
|
253
259
|
function render() {
|
|
254
|
-
box
|
|
255
|
-
box
|
|
256
|
-
box
|
|
257
|
-
box
|
|
260
|
+
pin(box, 'left', x + 'px');
|
|
261
|
+
pin(box, 'top', y + 'px');
|
|
262
|
+
pin(box, 'width', w + 'px');
|
|
263
|
+
pin(box, 'height', h + 'px');
|
|
258
264
|
// dim the image outside the box: one donut polygon. The outer ring winds
|
|
259
265
|
// clockwise and the inner counter-clockwise, so the default nonzero fill
|
|
260
266
|
// rule punches the hole without the (less supported) evenodd keyword.
|
|
261
|
-
dim
|
|
262
|
-
`${x}px ${y}px, ${x}px ${y + h}px, ${x + w}px ${y + h}px, ${x + w}px ${y}px, ${x}px ${y}px)
|
|
267
|
+
pin(dim, 'clip-path', `polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 0, ` +
|
|
268
|
+
`${x}px ${y}px, ${x}px ${y + h}px, ${x + w}px ${y + h}px, ${x + w}px ${y}px, ${x}px ${y}px)`);
|
|
263
269
|
}
|
|
264
270
|
const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
|
|
265
271
|
|