@panphora/bevel 0.2.0 → 0.2.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/examples/setup-peers.mjs
CHANGED
|
@@ -7,7 +7,7 @@ const distributions = {
|
|
|
7
7
|
richclay: ["richclay.js", "richclay.css", "LICENSE", "THIRD-PARTY-NOTICES.md", "vendor/squire.js", "vendor/squire.provenance.json", "vendor/SQUIRE-LICENSE", "vendor/purify.min.js", "vendor/DOMPURIFY-LICENSE", "vendor/DOMPURIFY-LICENSE-MPL"],
|
|
8
8
|
quickcrop: ["quickcrop.js", "quickcrop.css", "LICENSE"],
|
|
9
9
|
hypercms: ["dist/hypercms.min.js", "LICENSE"],
|
|
10
|
-
"clay-mutation": ["src/lib/mutation.js", "src/lib/extension-noise.js", "src/lib/region-policy.js", "src/lib/region-capabilities.js", "src/lib/root-attrs.js", "src/lib/user-gesture.js", "LICENSE"]
|
|
10
|
+
"clay-mutation": ["src/lib/mutation.js", "src/lib/extension-noise.js", "src/lib/region-policy.js", "src/lib/region-capabilities.js", "src/lib/root-attrs.js", "src/lib/user-gesture.js", "src/lib/ephemeral.js", "LICENSE"]
|
|
11
11
|
};
|
|
12
12
|
const packageNames = { hypercms: "@panphora/hyper-cms", "clay-mutation": "@panphora/clayjs" };
|
|
13
13
|
const [name, source] = process.argv.slice(2);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "richclay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"source": "Explicitly supplied local distribution; hashes identify the exact tested bytes, not a published release claim.",
|
|
5
5
|
"files": {
|
|
6
|
-
"richclay.js": "
|
|
6
|
+
"richclay.js": "3efdc37689e640e0c3fddcef41617243dca186679a8f799cde16db7aa245f2c7",
|
|
7
7
|
"richclay.css": "fc44ab9e71f8b66950fbda5a535774c7acb97d7e54aff2521ea4122d21422d47",
|
|
8
8
|
"LICENSE": "5312a8ef6ff9a844697b8b112612467efd12957e8afba098ce600dec0f8396c4",
|
|
9
9
|
"THIRD-PARTY-NOTICES.md": "3659529614b62297b8336ac7f6189ef9f67425911265bff1cde8d136df21562b",
|
|
@@ -1568,7 +1568,8 @@ var RichClayBundle = (() => {
|
|
|
1568
1568
|
"no-undo",
|
|
1569
1569
|
"no-data",
|
|
1570
1570
|
"freeze",
|
|
1571
|
-
"editor-ui"
|
|
1571
|
+
"editor-ui",
|
|
1572
|
+
"live"
|
|
1572
1573
|
]);
|
|
1573
1574
|
function hasPolicyToken(element, token) {
|
|
1574
1575
|
if (!element || element.nodeType !== 1) return false;
|
|
@@ -1609,9 +1610,6 @@ var RichClayBundle = (() => {
|
|
|
1609
1610
|
if ("value" in source && "value" in copy && source.tagName !== "OPTION" && type !== "checkbox" && type !== "radio" && type !== "file") copy.value = source.value;
|
|
1610
1611
|
if (source.tagName === "INPUT" && (type === "checkbox" || type === "radio")) copy.checked = source.checked;
|
|
1611
1612
|
if (source.tagName === "OPTION") copy.selected = source.selected;
|
|
1612
|
-
if (source.tagName === "SELECT") {
|
|
1613
|
-
for (let i = 0; i < source.options.length; i++) copy.options[i].selected = source.options[i].selected;
|
|
1614
|
-
}
|
|
1615
1613
|
if ("indeterminate" in source && "indeterminate" in copy) copy.indeterminate = source.indeterminate;
|
|
1616
1614
|
}
|
|
1617
1615
|
function matchesWithin(node, selector, boundary, inherit) {
|
|
@@ -1624,40 +1622,60 @@ var RichClayBundle = (() => {
|
|
|
1624
1622
|
}
|
|
1625
1623
|
return false;
|
|
1626
1624
|
}
|
|
1627
|
-
function
|
|
1628
|
-
|
|
1629
|
-
|
|
1625
|
+
function excluded(source, capability, capabilityMatch, exclude, boundary, inherit) {
|
|
1626
|
+
return (inherit ? hasCapability(source, capability) : matchesWithin(source, capabilityMatch, boundary, false)) || !!(exclude && (inherit && source !== boundary ? source.matches(exclude) : matchesWithin(source, exclude, boundary, inherit)));
|
|
1627
|
+
}
|
|
1628
|
+
function hasOwnCapability(element, capability) {
|
|
1629
|
+
const definition = CAPABILITIES[capability];
|
|
1630
|
+
return definition.tokens.some((token) => expandsTo(element, token)) || definition.bundles.some((bundle) => hasPolicyToken(element, bundle));
|
|
1631
|
+
}
|
|
1632
|
+
var CONTROL_TAGS = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT", "OPTION"]);
|
|
1633
|
+
function pairTree(source, copy, maps, drop) {
|
|
1634
|
+
if (source.nodeType === 1 && drop(source)) {
|
|
1635
|
+
maps.dropped.push(copy);
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1630
1638
|
maps.cloneToLive.set(copy, source);
|
|
1631
1639
|
maps.liveToClone.set(source, copy);
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
if (
|
|
1635
|
-
maps.
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1640
|
+
let sourceChildren = source;
|
|
1641
|
+
let copyChildren = copy;
|
|
1642
|
+
if (source.nodeType === 1) {
|
|
1643
|
+
if (CONTROL_TAGS.has(source.tagName)) maps.controls.push(source, copy);
|
|
1644
|
+
if (source.tagName === "TEMPLATE") {
|
|
1645
|
+
while (copy.firstChild) copy.removeChild(copy.firstChild);
|
|
1646
|
+
sourceChildren = source.content;
|
|
1647
|
+
copyChildren = copy.content;
|
|
1648
|
+
maps.cloneToLive.set(copyChildren, sourceChildren);
|
|
1649
|
+
maps.liveToClone.set(sourceChildren, copyChildren);
|
|
1650
|
+
}
|
|
1651
|
+
} else if (source.nodeType !== 11) return;
|
|
1652
|
+
let c = copyChildren.firstChild;
|
|
1653
|
+
for (let s = sourceChildren.firstChild; s && c; s = s.nextSibling) {
|
|
1654
|
+
pairTree(s, c, maps, drop);
|
|
1655
|
+
c = c.nextSibling;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
function createContentView(context, { capability = "data", exclude = null, inherit = true, provenance = null } = {}) {
|
|
1649
1659
|
if (!context) throw new TypeError("createContentView requires a DOM context");
|
|
1650
1660
|
const sourceDocument = context.nodeType === 9 ? context : context.ownerDocument;
|
|
1651
1661
|
if (!sourceDocument?.implementation?.createHTMLDocument) {
|
|
1652
1662
|
throw new TypeError("createContentView requires an HTML DOM implementation");
|
|
1653
1663
|
}
|
|
1654
1664
|
const inertDocument = sourceDocument.implementation.createHTMLDocument("");
|
|
1655
|
-
const cloneToLive = /* @__PURE__ */ new WeakMap();
|
|
1665
|
+
const cloneToLive = provenance || /* @__PURE__ */ new WeakMap();
|
|
1656
1666
|
const liveToClone = /* @__PURE__ */ new WeakMap();
|
|
1657
1667
|
const sourceRoot = context.nodeType === 9 ? context.documentElement : context;
|
|
1658
1668
|
if (exclude) inertDocument.documentElement.matches(exclude);
|
|
1659
1669
|
const capabilityMatch = capabilitySelector(capability);
|
|
1660
|
-
const
|
|
1670
|
+
const drop = inherit ? (el) => hasOwnCapability(el, capability) || !!(exclude && el.matches(exclude)) : (el) => excluded(el, capability, capabilityMatch, exclude, sourceRoot, false);
|
|
1671
|
+
let root = null;
|
|
1672
|
+
if (sourceRoot.nodeType !== 1 || !excluded(sourceRoot, capability, capabilityMatch, exclude, sourceRoot, inherit)) {
|
|
1673
|
+
root = inertDocument.importNode(sourceRoot, true);
|
|
1674
|
+
const maps = { cloneToLive, liveToClone, dropped: [], controls: [] };
|
|
1675
|
+
pairTree(sourceRoot, root, maps, drop);
|
|
1676
|
+
for (const node of maps.dropped) node.remove();
|
|
1677
|
+
for (let i = 0; i < maps.controls.length; i += 2) copyControlState(maps.controls[i], maps.controls[i + 1]);
|
|
1678
|
+
}
|
|
1661
1679
|
if (context.nodeType === 9 && root) {
|
|
1662
1680
|
inertDocument.replaceChild(root, inertDocument.documentElement);
|
|
1663
1681
|
liveToClone.set(context, inertDocument);
|
|
@@ -2001,18 +2019,18 @@ var RichClayBundle = (() => {
|
|
|
2001
2019
|
editor._mutation?.takeRecords();
|
|
2002
2020
|
},
|
|
2003
2021
|
onMutations: (records, editor) => {
|
|
2004
|
-
const
|
|
2022
|
+
const excluded2 = (node, capability) => {
|
|
2005
2023
|
const boundary = closestWithCapability(node, capability);
|
|
2006
2024
|
return !!boundary && boundary !== this.element && this.element.contains(boundary);
|
|
2007
2025
|
};
|
|
2008
2026
|
let authored = false;
|
|
2009
2027
|
let local = false;
|
|
2010
2028
|
for (const record of records) {
|
|
2011
|
-
if (
|
|
2029
|
+
if (excluded2(record.target, "history")) continue;
|
|
2012
2030
|
const nodes = record.type === "childList" ? [...record.addedNodes, ...record.removedNodes] : [record.target];
|
|
2013
2031
|
for (const node of nodes) {
|
|
2014
|
-
if (
|
|
2015
|
-
if (
|
|
2032
|
+
if (excluded2(node, "history")) continue;
|
|
2033
|
+
if (excluded2(record.target, "undo") || excluded2(node, "undo")) local = true;
|
|
2016
2034
|
else authored = true;
|
|
2017
2035
|
}
|
|
2018
2036
|
}
|