@hyperframes/core 0.10.7 → 0.10.8
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/dist/compiler/compositionScoping.js +21 -6
- package/dist/generated/runtime-inline.js +1 -1
- package/dist/hyperframe.runtime.iife.js +70 -70
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/previewProxyBox.d.ts +7 -0
- package/dist/previewProxyBox.js +23 -0
- package/dist/runtime/editingDraft.js +5 -0
- package/dist/runtime/editingPort.d.ts +7 -11
- package/dist/runtime/editingPort.js +29 -53
- package/dist/runtime/hfProtocol.d.ts +1 -0
- package/dist/runtime/mediaProxy.d.ts +8 -1
- package/dist/runtime/mediaProxy.js +186 -41
- package/dist/runtime/previewCopies.d.ts +1 -0
- package/dist/runtime/previewCopies.js +5 -0
- package/dist/runtime/proxyWait.d.ts +1 -1
- package/dist/runtime/proxyWait.js +11 -8
- package/dist/runtime/runtimePort.d.ts +4 -4
- package/dist/runtime/runtimePort.js +5 -5
- package/dist/studioPreviewMark.d.ts +1 -0
- package/dist/studioPreviewMark.js +1 -0
- package/package.json +4 -4
|
@@ -91,8 +91,8 @@ function scopeSelectorOnce(selector, scope, compositionId, authoredRootId, compo
|
|
|
91
91
|
}
|
|
92
92
|
return selectorWithoutRootTiming.replace(compositionIdPattern, () => scope);
|
|
93
93
|
}
|
|
94
|
-
const leading = selectorWithoutRootTiming.
|
|
95
|
-
const trailing = selectorWithoutRootTiming.
|
|
94
|
+
const leading = selectorWithoutRootTiming.slice(0, selectorWithoutRootTiming.length - selectorWithoutRootTiming.trimStart().length);
|
|
95
|
+
const trailing = selectorWithoutRootTiming.slice(selectorWithoutRootTiming.trimEnd().length);
|
|
96
96
|
if (compoundAuthoredRoot) {
|
|
97
97
|
const authoredRootAttr = authoredRootId
|
|
98
98
|
? `[${AUTHORED_ROOT_ID_ATTR}="${escapeCssAttributeValue(authoredRootId)}"]`
|
|
@@ -107,10 +107,25 @@ function scopeSelectorOnce(selector, scope, compositionId, authoredRootId, compo
|
|
|
107
107
|
function normalizeCompositionRootSelector(selector, scope, compositionId) {
|
|
108
108
|
const quotedCompId = escapeRegExp(compositionId);
|
|
109
109
|
const compAttr = String.raw `\[\s*data-composition-id\s*=\s*(?:"${quotedCompId}"|'${quotedCompId}')\s*\]`;
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
const firstTimingAttr = String.raw `\[\s*data-(?:start|duration)\s*=\s*(?:"[^"]*"|'[^']*')\s*\]`;
|
|
111
|
+
const timingAttr = String.raw `\s*${firstTimingAttr}`;
|
|
112
|
+
const rootThenTiming = selector.replace(new RegExp(`${compAttr}(?:${timingAttr})+`, "g"), () => scope);
|
|
113
|
+
// A pattern that needs the root at the end starts again at every attribute and space of a run with no root.
|
|
114
|
+
const timingRunThenMaybeRoot = new RegExp(`${firstTimingAttr}(?:${timingAttr})*(${compAttr})?`, "g");
|
|
115
|
+
let scoped = "";
|
|
116
|
+
let kept = 0;
|
|
117
|
+
for (const run of rootThenTiming.matchAll(timingRunThenMaybeRoot)) {
|
|
118
|
+
const rootFollows = run[1] !== undefined;
|
|
119
|
+
if (!rootFollows)
|
|
120
|
+
continue;
|
|
121
|
+
let replaceFrom = run.index;
|
|
122
|
+
while (replaceFrom > kept && rootThenTiming[replaceFrom - 1]?.trim() === "") {
|
|
123
|
+
replaceFrom -= 1;
|
|
124
|
+
}
|
|
125
|
+
scoped += rootThenTiming.slice(kept, replaceFrom) + scope;
|
|
126
|
+
kept = run.index + run[0].length;
|
|
127
|
+
}
|
|
128
|
+
return kept === 0 ? rootThenTiming : scoped + rootThenTiming.slice(kept);
|
|
114
129
|
}
|
|
115
130
|
const GLOBAL_AT_RULES = new Set(["keyframes", "-webkit-keyframes", "font-face"]);
|
|
116
131
|
function isAtRuleNode(node) {
|