@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.
Files changed (46) hide show
  1. package/README.md +5 -3
  2. package/THIRD-PARTY-NOTICES.md +6 -0
  3. package/dist/clay.standalone.js +15041 -10657
  4. package/package.json +9 -4
  5. package/src/core/conflict-download.js +91 -0
  6. package/src/core/conflict-notice.js +720 -0
  7. package/src/core/conflict-presentation.js +301 -0
  8. package/src/core/save-conflict-notice.js +2 -192
  9. package/src/core/save-core.js +35 -2
  10. package/src/core/save-feedback.js +6 -0
  11. package/src/core/save.js +157 -3
  12. package/src/core/snapshot.js +21 -0
  13. package/src/core/stale-host-notice.js +21 -24
  14. package/src/core/unsaved-warning.js +64 -16
  15. package/src/lib/content-dom.js +4 -2
  16. package/src/lib/dirty-gate.js +37 -1
  17. package/src/lib/unsaved-state.js +55 -0
  18. package/src/loader-logic.js +26 -15
  19. package/src/loader.js +10 -3
  20. package/src/plugins/ai-edit.js +489 -179
  21. package/src/plugins/cms.js +12 -0
  22. package/src/plugins/indicator.js +35 -16
  23. package/src/plugins/quickcrop.js +103 -0
  24. package/src/plugins/richclay.js +21 -0
  25. package/src/plugins/source.js +13 -6
  26. package/src/plugins/wire.js +4 -0
  27. package/src/sync/conflict-revert.js +1138 -0
  28. package/src/sync/conflicts.js +159 -0
  29. package/src/sync/live-sync.js +130 -109
  30. package/src/sync/presence.js +42 -36
  31. package/src/sync/section-notice.js +53 -28
  32. package/src/ui/bevel-controls.js +277 -0
  33. package/src/ui/bevel-dialog.js +112 -0
  34. package/src/ui/bevel.js +247 -0
  35. package/src/ui/dialogs.js +63 -86
  36. package/src/ui/index.js +22 -11
  37. package/src/ui/modal.js +80 -387
  38. package/src/ui/skins/cms-toggle.js +15 -0
  39. package/src/ui/skins/cms.js +4 -0
  40. package/src/ui/skins/quickcrop.js +4 -0
  41. package/src/ui/skins/richclay.js +4 -0
  42. package/src/ui/toast.js +116 -401
  43. package/src/ui/vendor-skin.js +65 -0
  44. package/src/vendor/hyper-morph.vendor.js +4 -4
  45. package/src/vendor/quickcrop.vendor.js +14 -8
  46. 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
  '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;',
@@ -229,8 +235,8 @@ function quickcrop(file, options = {}) {
229
235
  ensureStyles();
230
236
 
231
237
  const stage = el('div', 'qc-stage');
232
- img.style.width = dispW + 'px';
233
- img.style.height = dispH + 'px';
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.style.left = x + 'px';
255
- box.style.top = y + 'px';
256
- box.style.width = w + 'px';
257
- box.style.height = h + 'px';
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.style.clipPath = `polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 0, ` +
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