hyperframes 0.8.136 → 0.8.138
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/{add-MD4CNRQV.js → add-IZQPSHT5.js} +15 -15
- package/dist/{animatedGifPrep-3AKQSXPU.js → animatedGifPrep-MQF3GRFW.js} +6 -6
- package/dist/appHistory-TH3TL6N6.js +31 -0
- package/dist/{asset-UPNW7262.js → asset-RNZX4ISG.js} +2 -2
- package/dist/{assetCataloger-KBN5LNK4.js → assetCataloger-5YRUY3PJ.js} +2 -2
- package/dist/{auth-63PKUA76.js → auth-LUELYGJ4.js} +2 -2
- package/dist/{autoUpdate-CLB47L2W.js → autoUpdate-ECMQWUU5.js} +2 -2
- package/dist/{backgroundChecks-JW7XF7JA.js → backgroundChecks-PBEJMSA3.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-VFXGGGJG.js → batchRender-2GXKBPFQ.js} +3 -3
- package/dist/{beats-3CO6EGBG.js → beats-AAAZVDOY.js} +14 -14
- package/dist/{benchmark-CYTMATA7.js → benchmark-EI767IB4.js} +12 -12
- package/dist/{browser-QMLZJM2K.js → browser-KAA2VXYH.js} +9 -9
- package/dist/{bundleWithLocalizedFonts-5ATL25BF.js → bundleWithLocalizedFonts-MWDYAPGB.js} +2 -2
- package/dist/{capture-UEJG6BUX.js → capture-IRRHK6BT.js} +2 -2
- package/dist/{capture-DYBK5LGE.js → capture-VYT5NQQI.js} +13 -13
- package/dist/{catalog-G773J4K4.js → catalog-FYTZ2ET6.js} +22 -22
- package/dist/catch-up-XH3OAKQR.js +123 -0
- package/dist/{check-NCXITJWK.js → check-MUMIOK5K.js} +38 -38
- package/dist/{checkBrowser-IJQ2WCOB.js → checkBrowser-LKSZFOU6.js} +36 -36
- package/dist/{chunk-2EAXUCCE.js → chunk-2NCHQUPX.js} +1 -1
- package/dist/{chunk-XT5P4QMO.js → chunk-3DKN5WKL.js} +31 -11
- package/dist/{chunk-XLO327OK.js → chunk-3F6YLT72.js} +11 -11
- package/dist/{chunk-V2J2ZWPR.js → chunk-5K33TNUJ.js} +2 -2
- package/dist/{chunk-JBI43NRR.js → chunk-7OLMGFDN.js} +3 -3
- package/dist/{chunk-N3KRRPL7.js → chunk-7Y5SMPRV.js} +3 -3
- package/dist/{chunk-SXE656MT.js → chunk-APMG37MX.js} +1 -1
- package/dist/{chunk-37EDNWLQ.js → chunk-ASPTQ6DT.js} +1 -1
- package/dist/chunk-DCAI5DBR.js +218 -0
- package/dist/{chunk-KZJPREW7.js → chunk-DJMXTKKK.js} +1 -1
- package/dist/{chunk-YDBQRLRI.js → chunk-DXHYACUC.js} +3 -3
- package/dist/{chunk-GULOKZLI.js → chunk-EDUBJPGL.js} +14 -9
- package/dist/{chunk-527WRFUQ.js → chunk-FSSMOTMS.js} +1 -1
- package/dist/{chunk-FTR6KLIG.js → chunk-GJGVYREG.js} +59 -226
- package/dist/{chunk-V26IB6L2.js → chunk-GNHJ4ONK.js} +2 -2
- package/dist/{chunk-BQIFI4GV.js → chunk-HUZYBV2Z.js} +1 -1
- package/dist/{chunk-ECAXTQGU.js → chunk-HXXX6N2G.js} +2 -2
- package/dist/{chunk-2BJCQN7K.js → chunk-I3BRUEKD.js} +1 -1
- package/dist/{chunk-BSU7EOWJ.js → chunk-IC5L6L7K.js} +1 -1
- package/dist/{chunk-P3UNVJXX.js → chunk-IRYC5BRO.js} +4 -4
- package/dist/{chunk-V32SGDX7.js → chunk-JCRJBB4E.js} +10 -10
- package/dist/{chunk-H4UIYRZZ.js → chunk-JOUVZO7M.js} +1 -1
- package/dist/{chunk-XZABUQTX.js → chunk-JYYOAKHS.js} +1 -1
- package/dist/{chunk-Z3EFUXL5.js → chunk-KBUUCAIZ.js} +6 -6
- package/dist/{chunk-RTURM45Q.js → chunk-KRLYIT22.js} +1 -1
- package/dist/{chunk-5K573LFX.js → chunk-L5E5ZN6G.js} +1 -1
- package/dist/{chunk-4AXZWUQ6.js → chunk-MIOBYUXT.js} +1 -1
- package/dist/{chunk-ZBNFAZQB.js → chunk-MKVKVMUH.js} +7 -7
- package/dist/{chunk-XE6S5CE6.js → chunk-OBC75KXL.js} +1 -1
- package/dist/{chunk-PGFP4FLW.js → chunk-P5WDMFBB.js} +405 -205
- package/dist/{chunk-WFZEW4AC.js → chunk-P75OFLZN.js} +2 -2
- package/dist/{chunk-OSSVNAI5.js → chunk-PHRWQQOJ.js} +1 -1
- package/dist/{chunk-5ALWCRBU.js → chunk-PHXBLIKK.js} +10 -10
- package/dist/{chunk-OAF4XJOW.js → chunk-PXSM4HPB.js} +7 -2
- package/dist/{chunk-3E3WVNVP.js → chunk-QPOK6I32.js} +2 -2
- package/dist/{chunk-GK5W3SIJ.js → chunk-R6C6URKB.js} +3 -3
- package/dist/{chunk-EXNGSOQG.js → chunk-RH5VML6E.js} +12 -12
- package/dist/{chunk-BHOKLX4F.js → chunk-RLNB3JCY.js} +1 -1
- package/dist/{chunk-IQ3OUQ5Z.js → chunk-S3S2LSZX.js} +22 -2
- package/dist/{chunk-LO7L5PJ3.js → chunk-SDRKEYZV.js} +5 -5
- package/dist/{chunk-T5LPCY6I.js → chunk-SIMYRD5P.js} +27 -41
- package/dist/{chunk-VDQCNWQI.js → chunk-STA43FMY.js} +1 -1
- package/dist/{chunk-VNC6YQOC.js → chunk-SZITAGRK.js} +1 -1
- package/dist/chunk-UINDCCO7.js +3742 -0
- package/dist/{chunk-BWJ27MQP.js → chunk-UUMK6VME.js} +1 -1
- package/dist/{chunk-CG6OUDMX.js → chunk-VR5UQWGV.js} +3 -3
- package/dist/{chunk-RVG35AL2.js → chunk-W3KQCJVP.js} +217 -6
- package/dist/{chunk-X5HWXQPU.js → chunk-WCJGTLPF.js} +22 -10
- package/dist/{chunk-M5WGAAML.js → chunk-WH6PRFNX.js} +3 -3
- package/dist/{chunk-WTMA6JQD.js → chunk-XQODEVF3.js} +1 -1
- package/dist/{chunk-32QEFPDS.js → chunk-YGXLBX3N.js} +1 -1
- package/dist/{chunk-CYG3HXBE.js → chunk-YNBXJWSD.js} +1 -1
- package/dist/{clean-UCLCH4YA.js → clean-LZPDOAV4.js} +21 -21
- package/dist/cli.js +62 -52
- package/dist/{cloud-LVP33D4N.js → cloud-RVAH5NNL.js} +4 -4
- package/dist/{cloudrun-FA4XHPZS.js → cloudrun-NFGM6TRT.js} +3 -3
- package/dist/{compare-TOTN2CVX.js → compare-S3M5OAL2.js} +29 -29
- package/dist/{compiler-XZ654ZH2.js → compiler-SZ4GTYFB.js} +3 -3
- package/dist/{component-B5QZZJJA.js → component-PR2WZTQ4.js} +3 -3
- package/dist/{compositions-REMCVXXP.js → compositions-6RYXH2UA.js} +11 -11
- package/dist/{delete-H2P6PYT5.js → delete-EO7C3LQ6.js} +3 -3
- package/dist/{deterministicFonts-U2EXY2KQ.js → deterministicFonts-GTITFRSJ.js} +2 -2
- package/dist/{dist-QS5WEGBE.js → dist-OJTEVNJR.js} +1 -1
- package/dist/{dist-HVJAGLHF.js → dist-RVC3JTID.js} +2 -2
- package/dist/{doctor-HCGHEJDN.js → doctor-UTCCMN32.js} +12 -12
- package/dist/{events-2LS5WRYL.js → events-RCGWL4LI.js} +9 -9
- package/dist/{events-V5QLQAN4.js → events-RE3OR6KY.js} +8 -8
- package/dist/{feedback-WBOC7SAW.js → feedback-V7C64JIR.js} +12 -12
- package/dist/{figma-HRUWQ5FO.js → figma-26LOX5PV.js} +3 -3
- package/dist/fontLocalizeCli.js +10 -10
- package/dist/{get-FS5GMKBK.js → get-E2K2JRTV.js} +3 -3
- package/dist/{gpuPolicy-ON3RMSWD.js → gpuPolicy-Z3PQN6ZK.js} +6 -6
- package/dist/{grade-compare-G7Z5DWKW.js → grade-compare-OTZDU463.js} +26 -26
- package/dist/{help-27P7K7JZ.js → help-IRSQLNI5.js} +3 -2
- package/dist/{history-5E46VSDM.js → history-G44U6762.js} +18 -18
- package/dist/hyperframe-runtime.js +64 -182
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +64 -182
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-2ZYYJL3I.js → info-KXQ2TAHX.js} +11 -11
- package/dist/{init-ZI75FWLJ.js → init-7SXMLHJE.js} +27 -27
- package/dist/{inspect-YLQN7QL6.js → inspect-7JTINR25.js} +27 -27
- package/dist/{installer-DDJVY4TO.js → installer-RH4E6WXT.js} +4 -4
- package/dist/{keyframes-JONXVQWD.js → keyframes-PIV573S6.js} +12 -12
- package/dist/{lambda-LPLYOEYY.js → lambda-GO5HAA4S.js} +4 -4
- package/dist/{layout-ZP4WDRSA.js → layout-N2736OO3.js} +27 -27
- package/dist/{lint-XGMUBMLE.js → lint-WUXZ5WWZ.js} +14 -14
- package/dist/{lintProject-EPVG2EFE.js → lintProject-ANMPLBIT.js} +1 -1
- package/dist/{list-NBXJMDON.js → list-QF7AMX5F.js} +3 -3
- package/dist/{login-XIH4H4RH.js → login-6RGSXHQJ.js} +4 -4
- package/dist/{manager-GFN75DM4.js → manager-524RPYO7.js} +2 -2
- package/dist/{manager-67P2XFXQ.js → manager-DXB7JDHU.js} +2 -2
- package/dist/{media-treatment-QYKJDWHD.js → media-treatment-T4KDEDYW.js} +14 -14
- package/dist/{models-54NL5PRB.js → models-6JMNK3XI.js} +19 -12
- package/dist/{motionShot-Y4D7LHU4.js → motionShot-74WM7KF6.js} +12 -12
- package/dist/{normalize-audio-6RR6UGAJ.js → normalize-audio-ZZU36ZMD.js} +14 -14
- package/dist/{open-TYFT2DQC.js → open-G523K45B.js} +20 -13
- package/dist/{pipeline-P7QRGI5H.js → pipeline-AKDGCWRE.js} +10 -10
- package/dist/{play-IZXA4GO3.js → play-SHIGXVON.js} +30 -30
- package/dist/{preflight-X3XFRJPQ.js → preflight-6ERLORWK.js} +7 -7
- package/dist/{present-JS2KNZLT.js → present-QOYYNZCE.js} +19 -19
- package/dist/{preview-M6PED6DU.js → preview-KUXTDJL3.js} +26 -24
- package/dist/{producer-KQNJKM7F.js → producer-CH33JXHK.js} +1 -1
- package/dist/{projectConfig-EAAQYRMP.js → projectConfig-NKIPRWAE.js} +6 -6
- package/dist/{publication-H3G346EX.js → publication-4RBVVR5Z.js} +2 -2
- package/dist/{publish-NEGKIS35.js → publish-OLHR4Z4U.js} +12 -11
- package/dist/{remove-background-HU4S4HH5.js → remove-background-NPKZSIPY.js} +12 -12
- package/dist/{render-24OQFSYB.js → render-GYYGWYQC.js} +17 -17
- package/dist/{render-IZHBGVPP.js → render-P4NWFUS7.js} +29 -27
- package/dist/{render-F3CNO2IE.js → render-UOKPAJNH.js} +3 -3
- package/dist/{render-batch-63CBIJYR.js → render-batch-ZDG3EXSD.js} +3 -3
- package/dist/{renderCancellation-FT3JJ7GB.js → renderCancellation-QYQLWHZY.js} +6 -6
- package/dist/renderSetupWorker.js +1 -1
- package/dist/{resolver-YJJKOGQF.js → resolver-CWH3VVB7.js} +4 -4
- package/dist/{sherpa-3BQDMJPJ.js → sherpa-WEQE23S5.js} +130 -47
- package/dist/sherpaWorker.js +4 -8
- package/dist/skills/hyperframes/SKILL.md +2 -0
- package/dist/skills/hyperframes-cli/SKILL.md +1 -1
- package/dist/{skills-T2O7PD6Q.js → skills-BVONI6TC.js} +14 -14
- package/dist/{skillsUpdateCheck-VYEGOAEI.js → skillsUpdateCheck-KKDPTFM7.js} +3 -3
- package/dist/{snapshot-NLTL7ZOM.js → snapshot-PWZFJEDR.js} +36 -36
- package/dist/{src-ZPAJ44CP.js → src-HH4C5GZV.js} +9 -9
- package/dist/{src-CUR36DBE.js → src-YO7MAWGD.js} +5 -5
- package/dist/{staticProjectServer-WN4BSLI3.js → staticProjectServer-PR5INXSA.js} +14 -14
- package/dist/{status-6CGT2PJT.js → status-AK67DTED.js} +6 -6
- package/dist/studio/assets/{hyperframes-player-ukvUFqdg.js → hyperframes-player-B30apksz.js} +1 -1
- package/dist/studio/assets/{index-C-pD9_xY.js → index-BdjA0CLD.js} +147 -147
- package/dist/studio/assets/{index-syMK0_9C.css → index-CVd4O6eH.css} +1 -1
- package/dist/studio/assets/{index-CRRgIxsS.js → index-DIJuIBwI.js} +1 -1
- package/dist/studio/assets/{index-BY_myArg.js → index-DXVvWfQG.js} +1 -1
- package/dist/studio/{chunk-QRLKWENQ.js → chunk-4S3AYCOG.js} +2 -2
- package/dist/studio/{chunk-NM7BXNZ7.js → chunk-LOVBLSMR.js} +10 -4
- package/dist/studio/chunk-LOVBLSMR.js.map +1 -0
- package/dist/studio/index.html +2 -2
- package/dist/studio/index.js +2852 -2852
- package/dist/studio/index.js.map +1 -1
- package/dist/studio/player.js +2 -2
- package/dist/studio/styles.css +1 -1
- package/dist/studio/ui.d.ts +2 -1
- package/dist/studio/ui.js +1 -1
- package/dist/{studio-api-KTRRONOC.js → studio-api-NFJMFAB7.js} +13 -11
- package/dist/{studioServer-O6P3TBDJ.js → studioServer-TQZVCIEL.js} +51 -50
- package/dist/{synthesize-K62TIZWI.js → synthesize-77PTU6C5.js} +6 -6
- package/dist/{system-3BTZGJNK.js → system-ZWIBWWE6.js} +6 -6
- package/dist/{telemetry-G4QOG4OF.js → telemetry-63L2ORO3.js} +9 -9
- package/dist/templates/_shared/AGENTS.md +2 -0
- package/dist/templates/_shared/CLAUDE.md +2 -0
- package/dist/{timeline-JS5QNPLA.js → timeline-QKZQL5DJ.js} +18 -18
- package/dist/{tokens-JKLDRW7A.js → tokens-ELK62U4A.js} +2 -2
- package/dist/{transcribe-HC35FL6W.js → transcribe-OSK7HEOJ.js} +9 -9
- package/dist/{transcribe-CP6ZCDVR.js → transcribe-VKSXTM7K.js} +80 -24
- package/dist/{tts-P3LIPIL5.js → tts-FU35O6YB.js} +3 -3
- package/dist/{updateCheck-L2UJCCL4.js → updateCheck-PM4FEI7P.js} +2 -2
- package/dist/{upgrade-NW7YFVUM.js → upgrade-G635QCNO.js} +2 -2
- package/dist/{urlDownloader-A5TT3AFE.js → urlDownloader-MVYQTP73.js} +5 -5
- package/dist/{validate-D3ZH3JQ7.js → validate-AZTMI3HR.js} +16 -16
- package/dist/{video-USXMJDEZ.js → video-H56FK33V.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-SRXQEQWZ.js +0 -3742
- package/dist/studio/chunk-NM7BXNZ7.js.map +0 -1
- package/dist/{chunk-WJFCDDP7.js → chunk-R4QIE6UY.js} +3 -3
- /package/dist/studio/{chunk-QRLKWENQ.js.map → chunk-4S3AYCOG.js.map} +0 -0
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
stripEmbeddedRuntimeScripts,
|
|
33
33
|
styleElementsFor,
|
|
34
34
|
warnUnknownEnumValues
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-UINDCCO7.js";
|
|
36
36
|
import {
|
|
37
37
|
cssVariableName
|
|
38
38
|
} from "./chunk-VC76R6W2.js";
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
} from "./chunk-OFQWTKPW.js";
|
|
43
43
|
import {
|
|
44
44
|
lintHyperframeHtml
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-STA43FMY.js";
|
|
46
46
|
import {
|
|
47
47
|
CSS_URL_RE,
|
|
48
48
|
checkSubCompositionUsability,
|
|
@@ -250,6 +250,12 @@ import { readFileSync, existsSync, statSync } from "fs";
|
|
|
250
250
|
import { resolve as resolve2, relative, dirname, isAbsolute, sep } from "path";
|
|
251
251
|
import { transformSync } from "esbuild";
|
|
252
252
|
|
|
253
|
+
// ../core/dist/generated/svg-selector-aliases-inline.js
|
|
254
|
+
var SVG_SELECTOR_ALIASES_IIFE = '"use strict";(()=>{function I(e){return e?/[\\w-]/.test(e)||e.charCodeAt(0)>=128:!1}function _(e){return e===" "||e===" "||e===`\n`||e==="\\r"||e==="\\f"}var j=/^[0-9a-fA-F]{1,6}/;function G(e){let n=e>=55296&&e<=57343;return e===0||e>1114111||n?65533:e}function $(e,n){return e[n]==="\\r"&&e[n+1]===`\n`?n+2:_(e[n])?n+1:n}function R(e,n){let t=e[n+1];if(t===void 0||/[\\n\\r\\f]/.test(t))return null;let i=j.exec(e.slice(n+1,n+7));if(!i)return{value:t,end:n+2};let o=G(Number.parseInt(i[0],16));return{value:String.fromCodePoint(o),end:$(e,n+1+i[0].length)}}function H(e,n){let t=o=>I(o)&&!/[0-9-]/.test(o),i=o=>e[o]==="\\\\"&&R(e,o)!==null;return e[n]==="-"?e[n+1]==="-"||t(e[n+1])||i(n+1):t(e[n])||i(n)}function y(e,n){let t=n;for(;e.startsWith("/*",t);){let i=e.indexOf("*/",t+2);t=i<0?e.length:i+2}return t}function A(e,n){let t=y(e,n);for(;_(e[t]);)t=y(e,t+1);return t}function h(e,n){if(!H(e,n))return null;let t=n,i="";for(;t<e.length;){let o=e[t];if(o==="\\\\"){let a=R(e,t);if(!a)break;i+=a.value,t=a.end;continue}if(!I(o))break;i+=o,t+=1}return t===n?null:{value:i,end:t}}var C=45;function T(e){return e>=48&&e<=57}function z(e){return e>=128||e===C||e===95||T(e)||e>=65&&e<=90||e>=97&&e<=122}function J(e,n){let t=e.charCodeAt(n);return t>=1&&t<=31||t===127?!0:T(t)?n===0||n===1&&e.charCodeAt(0)===C:!1}function k(e){let n="";for(let t=0;t<e.length;t+=1){let i=e.charCodeAt(t),o=e[t];i===0?n+="\\uFFFD":J(e,t)?n+=`\\\\${i.toString(16)} `:t===0&&e.length===1&&i===C?n+=`\\\\${o}`:z(i)?n+=o:n+=`\\\\${o}`}return n}var W=/\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|\\\\(?:[0-9a-fA-F]{1,6}(?:\\r\\n|[ \\t\\r\\n\\f])?|[\\s\\S])|"(?:[^"\\\\]|\\\\[\\s\\S])*"|\'(?:[^\'\\\\]|\\\\[\\s\\S])*\'|\\[(?:\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|\\\\[\\s\\S]|"(?:[^"\\\\]|\\\\[\\s\\S])*"|\'(?:[^\'\\\\]|\\\\[\\s\\S])*\'|[^\\]"\'\\\\/]|\\/(?!\\*))*\\]/g;function Q(e){let n=new Array(e.length).fill(!0);for(let t of e.matchAll(W)){let i=t.index;n.fill(!1,i,i+t[0].length)}return n}function q(e,n,t){if(n.length===0||!e.includes("#"))return e;let i=new Set(n),o=Q(e),a="",u=0;for(;u<e.length;){let d=o[u]&&e[u]==="#"?h(e,u+1):null;d&&i.has(d.value)?(a+=t(d.value),u=d.end):(a+=e[u],u+=1)}return a}function X(e){let n="";for(let t=0;t<e.length;t+=1){if(e[t]==="\\\\"){let i=e[t+1];if(i!==void 0&&/[\\n\\r\\f]/.test(i)){t=$(e,t+1)-1;continue}let o=R(e,t);if(o){n+=o.value,t=o.end-1;continue}}n+=e[t]}return n}function N(e){return Array.from(e,n=>{let t=n.charCodeAt(0);return t===0?"\\uFFFD":t<32||t===127?`\\\\${t.toString(16)} `:n===\'"\'||n==="\\\\"?`\\\\${n}`:n}).join("")}function Y(e,n){return e?{kind:"any"}:n===void 0?{kind:"none"}:{kind:"named",prefix:n}}function Z(e,n){return e[n]==="|"&&e[n+1]!=="="}function B(e,n){let t=e[n]==="*",i=t?{value:"*",end:n+1}:h(e,n),o=y(e,i?.end??n);if(!Z(e,o))return t?null:i?{token:i,namespace:{kind:"none"}}:null;let a=h(e,y(e,o+1));return a?{token:a,namespace:Y(t,i?.value)}:null}function K(e){if(e[0]!=="[")return null;let n=A(e,1),t=B(e,n);if(!t)return null;let{token:i,namespace:o}=t;return{name:i.value,rawName:e.slice(n,i.end),namespace:o,end:i.end}}function ee(e,n){let t=/^(?:"((?:\\\\[\\s\\S]|[^"\\\\])*)"|\'((?:\\\\[\\s\\S]|[^\'\\\\])*)\')/.exec(e.slice(n));return t?{value:X(t[1]??t[2]),end:n+t[0].length}:h(e,n)}function ne(e,n){let t=A(e,n),i=h(e,t);if(i){if(!/^[is]$/i.test(i.value))return null;t=A(e,i.end)}return e[t]!=="]"||t!==e.length-1?null:{flag:i?.value}}function F(e){let n=K(e);if(!n)return null;let t=A(e,n.end),o=["=","~=","|=","^=","$=","*="].find(d=>e.startsWith(d,t));if(!o)return null;let a=ee(e,A(e,t+o.length));if(!a)return null;let u=ne(e,a.end);return u?{name:n.name,rawName:n.rawName,namespace:n.namespace,operator:o,value:a.value,flag:u.flag}:null}function E(e,n){return e.replace(W,t=>t.startsWith("[")?n(t):t)}var re="data-hf-svg-reference-aliases";function O(e,n,t,i){let o={"=":(s,r)=>s===r,"~=":(s,r)=>s.split(/[ \\t\\r\\n\\f]+/).includes(r),"|=":(s,r)=>s===r||s.startsWith(r+"-"),"^=":(s,r)=>s.startsWith(r),"$=":(s,r)=>s.endsWith(r),"*=":(s,r)=>s.includes(r)},a=(s,r,l)=>!r&&l!=="="&&l!=="|="?!1:o[l](s,r),u=s=>s.replace(/[A-Z]/g,r=>r.toLowerCase()),d=s=>{let r=F(s);if(!r)return s;let{name:l,rawName:g,namespace:m,operator:b,value:D,flag:w}=r;if(m.kind==="named"!=(i!==void 0))return s;let x=w?.toLowerCase()==="i"?u:S=>S,L=u(l),P=t.filter(S=>{let V=m.kind==="none"?S.name:S.localName,U=m.kind==="named"?i.get(m.prefix):null;return(m.kind==="any"||S.namespaceURI===U)&&u(V)===L}),v=new Set([s]);for(let S of P)a(x(S.before),x(D),b)&&v.add(`[${g}="${N(S.after)}"${w?` ${w}`:""}]`);return v.size===1?s:`:is(${[...v].join(", ")})`};if(i)return E(e,d);let p=new Map(n.map(({id:s,replacement:r})=>[s,r])),f=new Map;for(let s of t){if(s.name!=="id"||s.before===s.after||p.has(s.before))continue;let r=f.get(s.before);r||(r=new Set([`#${k(s.before)}`]),f.set(s.before,r)),r.add(`#${k(s.after)}`)}for(let[s,r]of f)p.set(s,`:is(${[...r].join(", ")})`);let c=q(e,[...p.keys()],s=>p.get(s));return E(c,d)}function se(e,n,t=!0){let i=[],a=(t?[...e.querySelectorAll(`[${n}]`)]:[]).map(d=>d.getAttribute(n)),u=e.getAttribute?.(n);u&&a.unshift(u);for(let d of a){let p;try{p=JSON.parse(d)}catch{continue}if(!Array.isArray(p))continue;let f=p;for(let c of f){if(!ie(c))continue;let{name:s,localName:r,namespaceURI:l,before:g,after:m}=c;i.push({name:s,localName:r,namespaceURI:l,before:g,after:m})}}return i}function ie(e){if(!e||typeof e!="object")return!1;let{name:n,localName:t,namespaceURI:i,before:o,after:a}=e;return typeof n=="string"&&typeof t=="string"&&(i===null||typeof i=="string")&&typeof o=="string"&&typeof a=="string"}function oe(e){let n=[],t=[],i=!1,o,a=new WeakMap,u=(f,c)=>{for(let s of f){if("selectorText"in s){let r=s,l=a.get(r),g=r.selectorText,m=l?.applied===g?l.authored:g,b=O(m,[],t,c);b!==g&&(r.selectorText=b),b===m?a.delete(r):a.set(r,{authored:m,applied:r.selectorText})}"cssRules"in s&&u(s.cssRules,c)}},d=()=>{if(t.length)for(let f of e.document.styleSheets){let c;try{c=f.cssRules}catch{continue}let s=new Map;for(let r of c){if(!("namespaceURI"in r))continue;let{prefix:l,namespaceURI:g}=r;l&&s.set(l,g||null)}s.size&&u(c,s)}},p={rewrite:(f,c=[])=>{if(typeof f!="string"||!f.includes("#")&&!f.includes("["))return f;let s=O(f,c.length?[...c,...n]:n,t);if(s!==f){if(!o){let r=e.document.createElement("div");o=r.matches.bind(r)}o(f)}return s},refresh(){t=se(e.document,re).filter(r=>r.before!==r.after);let f=new Set(t.filter(r=>r.name==="id").map(r=>r.before)),c=new Set;n=[];for(let r of e.document.querySelectorAll("[data-hf-authored-id][id]")){let l=r.getAttribute("data-hf-authored-id");if(!l||l===r.id||c.has(l)||f.has(l))continue;c.add(l);let g=N(l);n.push({id:l,replacement:`:is(#${k(l)}, [data-hf-authored-id="${g}"])`})}if(d(),i||!n.length&&!t.length)return;let s=e.Element.prototype;s.querySelector=new Proxy(s.querySelector,{apply(r,l,g){return Reflect.apply(r,l,[p.rewrite(g[0])])}}),s.querySelectorAll=new Proxy(s.querySelectorAll,{apply(r,l,g){return Reflect.apply(r,l,[p.rewrite(g[0])])}}),i=!0}};e.__hfSvgSelectorAliases=p,p.refresh()}function M(){let e=window;e.__hfSvgSelectorAliases||oe(e)}M();})();\n';
|
|
255
|
+
function getSvgSelectorAliasesScript() {
|
|
256
|
+
return SVG_SELECTOR_ALIASES_IIFE;
|
|
257
|
+
}
|
|
258
|
+
|
|
253
259
|
// ../core/dist/compiler/compositionScoping.js
|
|
254
260
|
import postcss from "postcss";
|
|
255
261
|
|
|
@@ -274,7 +280,7 @@ function skipEscapeWhitespace(text, index) {
|
|
|
274
280
|
}
|
|
275
281
|
function consumeCssEscape(text, index) {
|
|
276
282
|
const next = text[index + 1];
|
|
277
|
-
if (next === void 0 ||
|
|
283
|
+
if (next === void 0 || /[\n\r\f]/.test(next))
|
|
278
284
|
return null;
|
|
279
285
|
const hex = HEX_ESCAPE_RE.exec(text.slice(index + 1, index + 7));
|
|
280
286
|
if (!hex)
|
|
@@ -285,7 +291,30 @@ function consumeCssEscape(text, index) {
|
|
|
285
291
|
end: skipEscapeWhitespace(text, index + 1 + hex[0].length)
|
|
286
292
|
};
|
|
287
293
|
}
|
|
294
|
+
function startsCssIdentifier(text, start) {
|
|
295
|
+
const isStart = (char) => isNameChar(char) && !/[0-9-]/.test(char);
|
|
296
|
+
const escape = (index) => text[index] === "\\" && consumeCssEscape(text, index) !== null;
|
|
297
|
+
if (text[start] === "-")
|
|
298
|
+
return text[start + 1] === "-" || isStart(text[start + 1]) || escape(start + 1);
|
|
299
|
+
return isStart(text[start]) || escape(start);
|
|
300
|
+
}
|
|
301
|
+
function skipCssComments(text, start) {
|
|
302
|
+
let index = start;
|
|
303
|
+
while (text.startsWith("/*", index)) {
|
|
304
|
+
const end = text.indexOf("*/", index + 2);
|
|
305
|
+
index = end < 0 ? text.length : end + 2;
|
|
306
|
+
}
|
|
307
|
+
return index;
|
|
308
|
+
}
|
|
309
|
+
function skipCssTrivia(text, start) {
|
|
310
|
+
let index = skipCssComments(text, start);
|
|
311
|
+
while (isCssWhitespace(text[index]))
|
|
312
|
+
index = skipCssComments(text, index + 1);
|
|
313
|
+
return index;
|
|
314
|
+
}
|
|
288
315
|
function decodeCssIdentifierAt(text, start) {
|
|
316
|
+
if (!startsCssIdentifier(text, start))
|
|
317
|
+
return null;
|
|
289
318
|
let index = start;
|
|
290
319
|
let value = "";
|
|
291
320
|
while (index < text.length) {
|
|
@@ -338,7 +367,7 @@ function escapeCssIdentifier(value) {
|
|
|
338
367
|
}
|
|
339
368
|
return result;
|
|
340
369
|
}
|
|
341
|
-
var GUARDED_SELECTOR_SEGMENT_RE =
|
|
370
|
+
var GUARDED_SELECTOR_SEGMENT_RE = /\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:[0-9a-fA-F]{1,6}(?:\r\n|[ \t\r\n\f])?|[\s\S])|"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'|\[(?:\/\*(?:[^*]|\*(?!\/))*\*\/|\\[\s\S]|"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'|[^\]"'\\/]|\/(?!\*))*\]/g;
|
|
342
371
|
function markUnguardedOffsets(selector) {
|
|
343
372
|
const mask = new Array(selector.length).fill(true);
|
|
344
373
|
for (const match of selector.matchAll(GUARDED_SELECTOR_SEGMENT_RE)) {
|
|
@@ -366,6 +395,118 @@ function replaceSelectorIdTokens(selector, candidateIds, resolveReplacement) {
|
|
|
366
395
|
}
|
|
367
396
|
return result;
|
|
368
397
|
}
|
|
398
|
+
function decodeCssString(value) {
|
|
399
|
+
let result = "";
|
|
400
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
401
|
+
if (value[index] === "\\") {
|
|
402
|
+
const next = value[index + 1];
|
|
403
|
+
if (next !== void 0 && /[\n\r\f]/.test(next)) {
|
|
404
|
+
index = skipEscapeWhitespace(value, index + 1) - 1;
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
const escaped = consumeCssEscape(value, index);
|
|
408
|
+
if (escaped) {
|
|
409
|
+
result += escaped.value;
|
|
410
|
+
index = escaped.end - 1;
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
result += value[index];
|
|
415
|
+
}
|
|
416
|
+
return result;
|
|
417
|
+
}
|
|
418
|
+
function escapeCssAttributeValue(value) {
|
|
419
|
+
return Array.from(value, (char) => {
|
|
420
|
+
const code = char.charCodeAt(0);
|
|
421
|
+
if (code === 0)
|
|
422
|
+
return "\uFFFD";
|
|
423
|
+
if (code < 32 || code === 127)
|
|
424
|
+
return `\\${code.toString(16)} `;
|
|
425
|
+
return char === '"' || char === "\\" ? `\\${char}` : char;
|
|
426
|
+
}).join("");
|
|
427
|
+
}
|
|
428
|
+
function attributeNamespace(wildcard, prefix) {
|
|
429
|
+
if (wildcard)
|
|
430
|
+
return { kind: "any" };
|
|
431
|
+
return prefix === void 0 ? { kind: "none" } : { kind: "named", prefix };
|
|
432
|
+
}
|
|
433
|
+
function isNamespaceSeparator(text, offset) {
|
|
434
|
+
return text[offset] === "|" && text[offset + 1] !== "=";
|
|
435
|
+
}
|
|
436
|
+
function readQualifiedAttributeName(text, start) {
|
|
437
|
+
const wildcard = text[start] === "*";
|
|
438
|
+
const first = wildcard ? { value: "*", end: start + 1 } : decodeCssIdentifierAt(text, start);
|
|
439
|
+
const separator = skipCssComments(text, first?.end ?? start);
|
|
440
|
+
if (!isNamespaceSeparator(text, separator)) {
|
|
441
|
+
if (wildcard)
|
|
442
|
+
return null;
|
|
443
|
+
return first ? { token: first, namespace: { kind: "none" } } : null;
|
|
444
|
+
}
|
|
445
|
+
const token = decodeCssIdentifierAt(text, skipCssComments(text, separator + 1));
|
|
446
|
+
if (!token)
|
|
447
|
+
return null;
|
|
448
|
+
return { token, namespace: attributeNamespace(wildcard, first?.value) };
|
|
449
|
+
}
|
|
450
|
+
function readAttributeName(predicate) {
|
|
451
|
+
if (predicate[0] !== "[")
|
|
452
|
+
return null;
|
|
453
|
+
const start = skipCssTrivia(predicate, 1);
|
|
454
|
+
const qualified = readQualifiedAttributeName(predicate, start);
|
|
455
|
+
if (!qualified)
|
|
456
|
+
return null;
|
|
457
|
+
const { token, namespace } = qualified;
|
|
458
|
+
return {
|
|
459
|
+
name: token.value,
|
|
460
|
+
rawName: predicate.slice(start, token.end),
|
|
461
|
+
namespace,
|
|
462
|
+
end: token.end
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
function readAttributeValue(predicate, start) {
|
|
466
|
+
const quoted = /^(?:"((?:\\[\s\S]|[^"\\])*)"|'((?:\\[\s\S]|[^'\\])*)')/.exec(predicate.slice(start));
|
|
467
|
+
if (quoted)
|
|
468
|
+
return { value: decodeCssString(quoted[1] ?? quoted[2]), end: start + quoted[0].length };
|
|
469
|
+
return decodeCssIdentifierAt(predicate, start);
|
|
470
|
+
}
|
|
471
|
+
function readAttributeEnding(predicate, start) {
|
|
472
|
+
let offset = skipCssTrivia(predicate, start);
|
|
473
|
+
const token = decodeCssIdentifierAt(predicate, offset);
|
|
474
|
+
if (token) {
|
|
475
|
+
if (!/^[is]$/i.test(token.value))
|
|
476
|
+
return null;
|
|
477
|
+
offset = skipCssTrivia(predicate, token.end);
|
|
478
|
+
}
|
|
479
|
+
if (predicate[offset] !== "]" || offset !== predicate.length - 1)
|
|
480
|
+
return null;
|
|
481
|
+
return { flag: token?.value };
|
|
482
|
+
}
|
|
483
|
+
function parseAttributeSelector(predicate) {
|
|
484
|
+
const name = readAttributeName(predicate);
|
|
485
|
+
if (!name)
|
|
486
|
+
return null;
|
|
487
|
+
const offset = skipCssTrivia(predicate, name.end);
|
|
488
|
+
const operators = ["=", "~=", "|=", "^=", "$=", "*="];
|
|
489
|
+
const operator = operators.find((candidate) => predicate.startsWith(candidate, offset));
|
|
490
|
+
if (!operator)
|
|
491
|
+
return null;
|
|
492
|
+
const value = readAttributeValue(predicate, skipCssTrivia(predicate, offset + operator.length));
|
|
493
|
+
if (!value)
|
|
494
|
+
return null;
|
|
495
|
+
const ending = readAttributeEnding(predicate, value.end);
|
|
496
|
+
if (!ending)
|
|
497
|
+
return null;
|
|
498
|
+
return {
|
|
499
|
+
name: name.name,
|
|
500
|
+
rawName: name.rawName,
|
|
501
|
+
namespace: name.namespace,
|
|
502
|
+
operator,
|
|
503
|
+
value: value.value,
|
|
504
|
+
flag: ending.flag
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
function replaceSelectorAttributeTokens(selector, rewrite) {
|
|
508
|
+
return selector.replace(GUARDED_SELECTOR_SEGMENT_RE, (segment) => segment.startsWith("[") ? rewrite(segment) : segment);
|
|
509
|
+
}
|
|
369
510
|
|
|
370
511
|
// ../core/dist/compiler/compositionScoping.js
|
|
371
512
|
var AUTHORED_ROOT_ID_ATTR = "data-hf-authored-id";
|
|
@@ -373,7 +514,7 @@ var INNER_ROOT_ATTR = "data-hf-inner-root";
|
|
|
373
514
|
function escapeRegExp(value) {
|
|
374
515
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
375
516
|
}
|
|
376
|
-
function
|
|
517
|
+
function escapeCssAttributeValue2(value) {
|
|
377
518
|
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
378
519
|
}
|
|
379
520
|
function getAuthoredRootIdSelectorForms(authoredRootId) {
|
|
@@ -390,7 +531,7 @@ function normalizeAuthoredRootIdSelector(selector, authoredRootId) {
|
|
|
390
531
|
const trimmed = authoredRootId?.trim();
|
|
391
532
|
if (!trimmed)
|
|
392
533
|
return selector;
|
|
393
|
-
return replaceAuthoredRootIdSelectors(selector, trimmed, `[${AUTHORED_ROOT_ID_ATTR}="${
|
|
534
|
+
return replaceAuthoredRootIdSelectors(selector, trimmed, `[${AUTHORED_ROOT_ID_ATTR}="${escapeCssAttributeValue2(trimmed)}"]`);
|
|
394
535
|
}
|
|
395
536
|
function compositionBoxSelector(scope) {
|
|
396
537
|
return `${scope}:not(:has([${INNER_ROOT_ATTR}])), ${scope} > [${INNER_ROOT_ATTR}]`;
|
|
@@ -417,7 +558,7 @@ function scopeSelector(selector, scope, compositionId, authoredRootId, compoundA
|
|
|
417
558
|
const leading = selectorWithoutRootTiming.match(/^\s*/)?.[0] ?? "";
|
|
418
559
|
const trailing = selectorWithoutRootTiming.match(/\s*$/)?.[0] ?? "";
|
|
419
560
|
if (compoundAuthoredRoot) {
|
|
420
|
-
const authoredRootAttr = authoredRootId ? `[${AUTHORED_ROOT_ID_ATTR}="${
|
|
561
|
+
const authoredRootAttr = authoredRootId ? `[${AUTHORED_ROOT_ID_ATTR}="${escapeCssAttributeValue2(authoredRootId)}"]` : null;
|
|
421
562
|
if (authoredRootAttr && trimmed.startsWith(authoredRootAttr)) {
|
|
422
563
|
const rest = trimmed.slice(authoredRootAttr.length);
|
|
423
564
|
return `${leading}${scope}${authoredRootAttr}${rest}${trailing}`;
|
|
@@ -458,7 +599,7 @@ function scopeCssToComposition(css, compositionId, scopeSelectorOverride, author
|
|
|
458
599
|
const trimmedCompositionId = compositionId.trim();
|
|
459
600
|
if (!css || !trimmedCompositionId)
|
|
460
601
|
return css;
|
|
461
|
-
const scope = scopeSelectorOverride || `[data-composition-id="${
|
|
602
|
+
const scope = scopeSelectorOverride || `[data-composition-id="${escapeCssAttributeValue2(trimmedCompositionId)}"]`;
|
|
462
603
|
let root;
|
|
463
604
|
try {
|
|
464
605
|
root = postcss.parse(css);
|
|
@@ -543,7 +684,9 @@ function wrapScopedCompositionScript(source, compositionId, errorLabel = "[Hyper
|
|
|
543
684
|
const scopeSelectorLiteral = jsonScriptLiteral(scopeSelectorOverride ?? null);
|
|
544
685
|
const rootSelectorPatternLiteral = jsonScriptLiteral(String.raw`\[\s*data-composition-id\s*=\s*(?:"${escapedCompositionId}"|'${escapedCompositionId}')\s*\]`);
|
|
545
686
|
const timingSelectorPatternLiteral = jsonScriptLiteral(String.raw`\s*\[\s*data-(?:start|duration)\s*=\s*(?:"[^"]*"|'[^']*')\s*\]`);
|
|
687
|
+
const aliasInstallerOutsideAuthoredStrictness = `(function(){ ${getSvgSelectorAliasesScript()} })();`;
|
|
546
688
|
return `(function(){
|
|
689
|
+
${aliasInstallerOutsideAuthoredStrictness}
|
|
547
690
|
var __hfCompId = ${compositionIdLiteral};
|
|
548
691
|
var __hfTimelineCompId = ${timelineCompositionIdLiteral};
|
|
549
692
|
var __hfErrorLabel = ${errorLabelLiteral};
|
|
@@ -562,131 +705,15 @@ function wrapScopedCompositionScript(source, compositionId, errorLabel = "[Hyper
|
|
|
562
705
|
var __hfAuthoredRootSelector = __hfAuthoredRootId
|
|
563
706
|
? "[" + __hfAuthoredRootAttr + '="' + __hfEscapeAttr(__hfAuthoredRootId) + '"]'
|
|
564
707
|
: "";
|
|
565
|
-
var __hfCssEscape = function(value) {
|
|
566
|
-
var text = value + "";
|
|
567
|
-
if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {
|
|
568
|
-
try { return CSS.escape(text); } catch {}
|
|
569
|
-
}
|
|
570
|
-
return text.replace(/[^a-zA-Z0-9_-]/g, function(char) { return "\\\\" + char; });
|
|
571
|
-
};
|
|
572
|
-
// Decode complete CSS identifiers before comparing authored ids.
|
|
573
|
-
var __hfRewriteIdSelectors = function(selector, entries) {
|
|
574
|
-
if (!entries || !entries.length || typeof selector !== "string" || selector.indexOf("#") === -1) {
|
|
575
|
-
return selector;
|
|
576
|
-
}
|
|
577
|
-
var result = "";
|
|
578
|
-
var bracketDepth = 0;
|
|
579
|
-
var quote = null;
|
|
580
|
-
for (var index = 0; index < selector.length; index += 1) {
|
|
581
|
-
var char = selector[index];
|
|
582
|
-
if (char === "\\\\") {
|
|
583
|
-
var escape = selector.slice(index).match(/^\\\\(?:[0-9a-fA-F]{1,6}(?:\\r\\n|[ \\t\\r\\n\\f])?|[\\s\\S])/);
|
|
584
|
-
if (escape) {
|
|
585
|
-
result += escape[0];
|
|
586
|
-
index += escape[0].length - 1;
|
|
587
|
-
continue;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
if (quote) {
|
|
591
|
-
result += char;
|
|
592
|
-
if (char === quote) {
|
|
593
|
-
quote = null;
|
|
594
|
-
}
|
|
595
|
-
continue;
|
|
596
|
-
}
|
|
597
|
-
if (char === '"' || char === "'") {
|
|
598
|
-
quote = char;
|
|
599
|
-
result += char;
|
|
600
|
-
continue;
|
|
601
|
-
}
|
|
602
|
-
if (char === "[") {
|
|
603
|
-
bracketDepth += 1;
|
|
604
|
-
result += char;
|
|
605
|
-
continue;
|
|
606
|
-
}
|
|
607
|
-
if (char === "]") {
|
|
608
|
-
bracketDepth = Math.max(0, bracketDepth - 1);
|
|
609
|
-
result += char;
|
|
610
|
-
continue;
|
|
611
|
-
}
|
|
612
|
-
if (char === "#" && bracketDepth === 0) {
|
|
613
|
-
var token = selector.slice(index + 1).match(/^(?:[\\w\\u0080-\\uffff-]|\\\\(?:[0-9a-fA-F]{1,6}(?:\\r\\n|[ \\t\\r\\n\\f])?|[^\\r\\n\\f]))+/);
|
|
614
|
-
if (token) {
|
|
615
|
-
var decoded = token[0].replace(/\\\\([0-9a-fA-F]{1,6})(?:\\r\\n|[ \\t\\r\\n\\f])?|\\\\([^\\r\\n\\f])/g, function(_, hex, escaped) {
|
|
616
|
-
if (!hex) return escaped;
|
|
617
|
-
var code = parseInt(hex, 16);
|
|
618
|
-
return String.fromCodePoint(!code || code > 0x10ffff || (code >= 0xd800 && code <= 0xdfff) ? 0xfffd : code);
|
|
619
|
-
});
|
|
620
|
-
var matched = entries.find(function(entry) { return entry.id === decoded; });
|
|
621
|
-
result += matched ? matched.replacement : "#" + token[0];
|
|
622
|
-
index += token[0].length;
|
|
623
|
-
continue;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
result += char;
|
|
627
|
-
}
|
|
628
|
-
return result;
|
|
629
|
-
};
|
|
630
708
|
var __hfAuthoredRootEntries = __hfAuthoredRootSelector
|
|
631
709
|
? [{ id: __hfAuthoredRootId, replacement: __hfAuthoredRootSelector }]
|
|
632
710
|
: [];
|
|
633
|
-
// Include both renamed and untouched instances. Each wrapper refreshes this
|
|
634
|
-
// document-wide cache because preview scene swaps can introduce new ids.
|
|
635
|
-
var __hfRenamedIdEntries = function() {
|
|
636
|
-
if (window.__hfRenamedIdSelectorEntries) return window.__hfRenamedIdSelectorEntries;
|
|
637
|
-
var entries = [];
|
|
638
|
-
var seen = Object.create(null);
|
|
639
|
-
var nodes;
|
|
640
|
-
try {
|
|
641
|
-
nodes = window.document.querySelectorAll("[" + __hfAuthoredRootAttr + "][id]");
|
|
642
|
-
} catch {
|
|
643
|
-
nodes = [];
|
|
644
|
-
}
|
|
645
|
-
for (var i = 0; i < nodes.length; i += 1) {
|
|
646
|
-
var authored = nodes[i].getAttribute(__hfAuthoredRootAttr);
|
|
647
|
-
if (!authored || seen[authored] || authored === nodes[i].id) continue;
|
|
648
|
-
seen[authored] = true;
|
|
649
|
-
var escaped = __hfCssEscape(authored);
|
|
650
|
-
entries.push({
|
|
651
|
-
id: authored,
|
|
652
|
-
replacement: ":is(#" + escaped + ", [" + __hfAuthoredRootAttr + '="' + __hfEscapeAttr(authored) + '"])',
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
window.__hfRenamedIdSelectorEntries = entries;
|
|
656
|
-
return window.__hfRenamedIdSelectorEntries;
|
|
657
|
-
};
|
|
658
|
-
// element.querySelector("#authored") on an arbitrary Element never passes
|
|
659
|
-
// through the scoped document proxy, so the same rewrite is installed once
|
|
660
|
-
// per document on Element.prototype \u2014 only when at least one id was
|
|
661
|
-
// actually renamed, so a document without collisions runs untouched
|
|
662
|
-
// natives. Document.prototype is deliberately NOT patched: an unscoped
|
|
663
|
-
// document-wide lookup cannot know which instance it means, and rewriting
|
|
664
|
-
// it would only widen the ambiguity.
|
|
665
|
-
var __hfInstallRenamedIdSelectorShim = function() {
|
|
666
|
-
if (window.__hfRenamedIdSelectorShim) return;
|
|
667
|
-
var entries = __hfRenamedIdEntries();
|
|
668
|
-
if (!entries.length) return;
|
|
669
|
-
var proto = window.Element && window.Element.prototype;
|
|
670
|
-
if (!proto || typeof proto.querySelector !== "function" || typeof proto.querySelectorAll !== "function") {
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
var nativeQuerySelector = proto.querySelector;
|
|
674
|
-
var nativeQuerySelectorAll = proto.querySelectorAll;
|
|
675
|
-
proto.querySelector = function(selector) {
|
|
676
|
-
return nativeQuerySelector.call(this, __hfRewriteIdSelectors(selector, __hfRenamedIdEntries()));
|
|
677
|
-
};
|
|
678
|
-
proto.querySelectorAll = function(selector) {
|
|
679
|
-
return nativeQuerySelectorAll.call(this, __hfRewriteIdSelectors(selector, __hfRenamedIdEntries()));
|
|
680
|
-
};
|
|
681
|
-
window.__hfRenamedIdSelectorShim = true;
|
|
682
|
-
};
|
|
683
711
|
var __hfNormalizeSelector = function(selector) {
|
|
684
712
|
if (!__hfCompId || typeof selector !== "string") return selector;
|
|
685
713
|
var normalized = selector
|
|
686
714
|
.replace(new RegExp(__hfRootSelectorPattern + '(?:' + __hfTimingSelectorPattern + ')+', 'g'), __hfRootSelector)
|
|
687
715
|
.replace(new RegExp('(?:' + __hfTimingSelectorPattern + ')+' + __hfRootSelectorPattern, 'g'), __hfRootSelector);
|
|
688
|
-
|
|
689
|
-
return __hfRewriteIdSelectors(normalized, __hfRenamedIdEntries());
|
|
716
|
+
return window.__hfSvgSelectorAliases.rewrite(normalized, __hfAuthoredRootEntries);
|
|
690
717
|
};
|
|
691
718
|
var __hfFindRoot = function() {
|
|
692
719
|
if (!__hfRoot && __hfRootSelector) {
|
|
@@ -949,8 +976,6 @@ ${source.replace(/<\/(script)/gi, "<\\/$1")}
|
|
|
949
976
|
});
|
|
950
977
|
};
|
|
951
978
|
__hfFindRoot();
|
|
952
|
-
window.__hfRenamedIdSelectorEntries = null;
|
|
953
|
-
__hfInstallRenamedIdSelectorShim();
|
|
954
979
|
__hfRecordAnimations(__hfRun);
|
|
955
980
|
})();`;
|
|
956
981
|
}
|
|
@@ -985,6 +1010,97 @@ async function validateHyperframeHtmlContract(html) {
|
|
|
985
1010
|
return { isValid: false, missingKeys, failureReason };
|
|
986
1011
|
}
|
|
987
1012
|
|
|
1013
|
+
// ../core/dist/compiler/svgSelectorAliases.js
|
|
1014
|
+
var SVG_REFERENCE_ALIASES_ATTR = "data-hf-svg-reference-aliases";
|
|
1015
|
+
function rewriteSvgSelectors(selector, ids, references, namespaces) {
|
|
1016
|
+
const attributeOperators = {
|
|
1017
|
+
"=": (before, value) => before === value,
|
|
1018
|
+
"~=": (before, value) => before.split(/[ \t\r\n\f]+/).includes(value),
|
|
1019
|
+
"|=": (before, value) => before === value || before.startsWith(value + "-"),
|
|
1020
|
+
"^=": (before, value) => before.startsWith(value),
|
|
1021
|
+
"$=": (before, value) => before.endsWith(value),
|
|
1022
|
+
"*=": (before, value) => before.includes(value)
|
|
1023
|
+
};
|
|
1024
|
+
const matchesValue = (before, value, operator) => {
|
|
1025
|
+
if (!value && operator !== "=" && operator !== "|=")
|
|
1026
|
+
return false;
|
|
1027
|
+
return attributeOperators[operator](before, value);
|
|
1028
|
+
};
|
|
1029
|
+
const lower = (text) => text.replace(/[A-Z]/g, (char) => char.toLowerCase());
|
|
1030
|
+
const rewriteAttribute = (predicate) => {
|
|
1031
|
+
const parsed = parseAttributeSelector(predicate);
|
|
1032
|
+
if (!parsed)
|
|
1033
|
+
return predicate;
|
|
1034
|
+
const { name, rawName, namespace, operator, value, flag } = parsed;
|
|
1035
|
+
if (namespace.kind === "named" !== (namespaces !== void 0))
|
|
1036
|
+
return predicate;
|
|
1037
|
+
const fold = flag?.toLowerCase() === "i" ? lower : (text) => text;
|
|
1038
|
+
const attributeName = lower(name);
|
|
1039
|
+
const candidates = references.filter((reference) => {
|
|
1040
|
+
const actualName = namespace.kind === "none" ? reference.name : reference.localName;
|
|
1041
|
+
const uri = namespace.kind === "named" ? namespaces.get(namespace.prefix) : null;
|
|
1042
|
+
return (namespace.kind === "any" || reference.namespaceURI === uri) && lower(actualName) === attributeName;
|
|
1043
|
+
});
|
|
1044
|
+
const alternatives = /* @__PURE__ */ new Set([predicate]);
|
|
1045
|
+
for (const reference of candidates) {
|
|
1046
|
+
if (!matchesValue(fold(reference.before), fold(value), operator))
|
|
1047
|
+
continue;
|
|
1048
|
+
alternatives.add(`[${rawName}="${escapeCssAttributeValue(reference.after)}"${flag ? ` ${flag}` : ""}]`);
|
|
1049
|
+
}
|
|
1050
|
+
return alternatives.size === 1 ? predicate : `:is(${[...alternatives].join(", ")})`;
|
|
1051
|
+
};
|
|
1052
|
+
if (namespaces)
|
|
1053
|
+
return replaceSelectorAttributeTokens(selector, rewriteAttribute);
|
|
1054
|
+
const replacements = new Map(ids.map(({ id, replacement }) => [id, replacement]));
|
|
1055
|
+
const targets = /* @__PURE__ */ new Map();
|
|
1056
|
+
for (const reference of references) {
|
|
1057
|
+
if (reference.name !== "id" || reference.before === reference.after || replacements.has(reference.before))
|
|
1058
|
+
continue;
|
|
1059
|
+
let alternatives = targets.get(reference.before);
|
|
1060
|
+
if (!alternatives) {
|
|
1061
|
+
alternatives = /* @__PURE__ */ new Set([`#${escapeCssIdentifier(reference.before)}`]);
|
|
1062
|
+
targets.set(reference.before, alternatives);
|
|
1063
|
+
}
|
|
1064
|
+
alternatives.add(`#${escapeCssIdentifier(reference.after)}`);
|
|
1065
|
+
}
|
|
1066
|
+
for (const [id, alternatives] of targets)
|
|
1067
|
+
replacements.set(id, `:is(${[...alternatives].join(", ")})`);
|
|
1068
|
+
const rewrittenIds = replaceSelectorIdTokens(selector, [...replacements.keys()], (id) => replacements.get(id));
|
|
1069
|
+
return replaceSelectorAttributeTokens(rewrittenIds, rewriteAttribute);
|
|
1070
|
+
}
|
|
1071
|
+
function readSvgReferenceAliases(root, attribute, includeDescendants = true) {
|
|
1072
|
+
const aliases = [];
|
|
1073
|
+
const nodes = includeDescendants ? [...root.querySelectorAll(`[${attribute}]`)] : [];
|
|
1074
|
+
const texts = nodes.map((node) => node.getAttribute(attribute));
|
|
1075
|
+
const own = root.getAttribute?.(attribute);
|
|
1076
|
+
if (own)
|
|
1077
|
+
texts.unshift(own);
|
|
1078
|
+
for (const text of texts) {
|
|
1079
|
+
let value;
|
|
1080
|
+
try {
|
|
1081
|
+
value = JSON.parse(text);
|
|
1082
|
+
} catch {
|
|
1083
|
+
continue;
|
|
1084
|
+
}
|
|
1085
|
+
if (!Array.isArray(value))
|
|
1086
|
+
continue;
|
|
1087
|
+
const entries = value;
|
|
1088
|
+
for (const entry of entries) {
|
|
1089
|
+
if (!isSvgReferenceAlias(entry))
|
|
1090
|
+
continue;
|
|
1091
|
+
const { name, localName, namespaceURI, before, after } = entry;
|
|
1092
|
+
aliases.push({ name, localName, namespaceURI, before, after });
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return aliases;
|
|
1096
|
+
}
|
|
1097
|
+
function isSvgReferenceAlias(entry) {
|
|
1098
|
+
if (!entry || typeof entry !== "object")
|
|
1099
|
+
return false;
|
|
1100
|
+
const { name, localName, namespaceURI, before, after } = entry;
|
|
1101
|
+
return typeof name === "string" && typeof localName === "string" && (namespaceURI === null || typeof namespaceURI === "string") && typeof before === "string" && typeof after === "string";
|
|
1102
|
+
}
|
|
1103
|
+
|
|
988
1104
|
// ../core/dist/compiler/svgIdNamespacing.js
|
|
989
1105
|
import postcss2 from "postcss";
|
|
990
1106
|
var ID_ATTR = "id";
|
|
@@ -1004,31 +1120,60 @@ function rewriteUrlHashRefs(value, idMap) {
|
|
|
1004
1120
|
return mapped ? `${pre}${quote}#${mapped}${quote}${post}` : full;
|
|
1005
1121
|
});
|
|
1006
1122
|
}
|
|
1007
|
-
function
|
|
1008
|
-
if (
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1123
|
+
function nativeReferenceValue(name, value, idMap) {
|
|
1124
|
+
if (isHrefAttrName(name) && value.startsWith("#")) {
|
|
1125
|
+
const mapped = idMap.get(value.slice(1));
|
|
1126
|
+
return mapped ? `#${mapped}` : value;
|
|
1127
|
+
}
|
|
1128
|
+
URL_HASH_REF_RE.lastIndex = 0;
|
|
1129
|
+
const hasUrl = URL_HASH_REF_RE.test(value);
|
|
1130
|
+
URL_HASH_REF_RE.lastIndex = 0;
|
|
1131
|
+
return hasUrl ? rewriteUrlHashRefs(value, idMap) : null;
|
|
1132
|
+
}
|
|
1133
|
+
function decideReferenceWrite(attr, previous, idMap) {
|
|
1134
|
+
if (attr.name === SVG_REFERENCE_ALIASES_ATTR || attr.name === ID_ATTR)
|
|
1135
|
+
return { kind: "skip" };
|
|
1136
|
+
const before = previous && attr.value === previous.after ? previous.before : attr.value;
|
|
1137
|
+
const after = nativeReferenceValue(attr.name, before, idMap);
|
|
1138
|
+
if (after !== null)
|
|
1139
|
+
return { kind: "managed", before, after };
|
|
1140
|
+
return previous ? { kind: "retain", alias: previous } : { kind: "skip" };
|
|
1141
|
+
}
|
|
1142
|
+
function referenceAlias(attr, before, after, inSvg) {
|
|
1143
|
+
const serializedXlink = attr.namespaceURI === void 0 && attr.name === "xlink:href" && inSvg;
|
|
1144
|
+
return {
|
|
1145
|
+
name: attr.name,
|
|
1146
|
+
localName: serializedXlink ? "href" : attr.localName,
|
|
1147
|
+
namespaceURI: serializedXlink ? "http://www.w3.org/1999/xlink" : attr.namespaceURI ?? null,
|
|
1148
|
+
before,
|
|
1149
|
+
after
|
|
1150
|
+
};
|
|
1012
1151
|
}
|
|
1013
1152
|
function rewriteElementIdReferences(el, idMap) {
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1153
|
+
const prior = new Map(readSvgReferenceAliases(el, SVG_REFERENCE_ALIASES_ATTR, false).map((alias) => [
|
|
1154
|
+
alias.name,
|
|
1155
|
+
alias
|
|
1156
|
+
]));
|
|
1157
|
+
const aliases = [...prior.values()].filter((alias) => alias.name === ID_ATTR);
|
|
1158
|
+
const inSvg = !!el.closest("svg");
|
|
1159
|
+
for (const attr of el.attributes ? Array.from(el.attributes) : []) {
|
|
1160
|
+
const decision = decideReferenceWrite(attr, prior.get(attr.name), idMap);
|
|
1161
|
+
if (decision.kind === "skip")
|
|
1162
|
+
continue;
|
|
1163
|
+
if (decision.kind === "retain") {
|
|
1164
|
+
aliases.push(decision.alias);
|
|
1018
1165
|
continue;
|
|
1019
|
-
if (isHrefAttrName(name)) {
|
|
1020
|
-
const rewritten = rewriteHrefValue(value, idMap);
|
|
1021
|
-
if (rewritten) {
|
|
1022
|
-
el.setAttribute(name, rewritten);
|
|
1023
|
-
continue;
|
|
1024
|
-
}
|
|
1025
1166
|
}
|
|
1026
|
-
if (
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1167
|
+
if (decision.after !== attr.value) {
|
|
1168
|
+
if (attr.namespaceURI)
|
|
1169
|
+
el.setAttributeNS(attr.namespaceURI, attr.name, decision.after);
|
|
1170
|
+
else
|
|
1171
|
+
el.setAttribute(attr.name, decision.after);
|
|
1030
1172
|
}
|
|
1173
|
+
aliases.push(referenceAlias(attr, decision.before, decision.after, inSvg));
|
|
1031
1174
|
}
|
|
1175
|
+
if (aliases.length)
|
|
1176
|
+
el.setAttribute(SVG_REFERENCE_ALIASES_ATTR, JSON.stringify(aliases));
|
|
1032
1177
|
}
|
|
1033
1178
|
function collectUrlHashRefsFromText(text, filter, out) {
|
|
1034
1179
|
let m;
|
|
@@ -1050,7 +1195,7 @@ function collectNativelyReferencedIds(elements, cssTexts, svgIds) {
|
|
|
1050
1195
|
const referenced = /* @__PURE__ */ new Set();
|
|
1051
1196
|
for (const el of elements) {
|
|
1052
1197
|
for (const attr of el.attributes ? Array.from(el.attributes) : []) {
|
|
1053
|
-
if (!attr.value)
|
|
1198
|
+
if (!attr.value || attr.name === SVG_REFERENCE_ALIASES_ATTR)
|
|
1054
1199
|
continue;
|
|
1055
1200
|
collectHrefFragmentRef(attr, svgIds, referenced);
|
|
1056
1201
|
if (attr.value.toLowerCase().includes("url("))
|
|
@@ -1099,6 +1244,14 @@ function resolveScope(scope) {
|
|
|
1099
1244
|
}
|
|
1100
1245
|
return { elements, renamable };
|
|
1101
1246
|
}
|
|
1247
|
+
function currentAuthoredSvgId(el) {
|
|
1248
|
+
if (!el.closest("svg"))
|
|
1249
|
+
return null;
|
|
1250
|
+
const idWrite = readSvgReferenceAliases(el, SVG_REFERENCE_ALIASES_ATTR, false).find((alias) => alias.name === ID_ATTR);
|
|
1251
|
+
if (idWrite)
|
|
1252
|
+
return el.getAttribute(ID_ATTR) === idWrite.after ? idWrite.before : null;
|
|
1253
|
+
return el.getAttribute(SVG_AUTHORED_ID_ATTR);
|
|
1254
|
+
}
|
|
1102
1255
|
function buildIdCensus(document) {
|
|
1103
1256
|
const elementsById = /* @__PURE__ */ new Map();
|
|
1104
1257
|
const usedIds = /* @__PURE__ */ new Set();
|
|
@@ -1112,16 +1265,17 @@ function buildIdCensus(document) {
|
|
|
1112
1265
|
list.push(el);
|
|
1113
1266
|
else
|
|
1114
1267
|
elementsById.set(id, [el]);
|
|
1268
|
+
const authored = currentAuthoredSvgId(el);
|
|
1269
|
+
if (authored && authored !== id) {
|
|
1270
|
+
const aliases = elementsById.get(authored);
|
|
1271
|
+
if (aliases)
|
|
1272
|
+
aliases.push(el);
|
|
1273
|
+
else
|
|
1274
|
+
elementsById.set(authored, [el]);
|
|
1275
|
+
}
|
|
1115
1276
|
}
|
|
1116
1277
|
return { elementsById, usedIds };
|
|
1117
1278
|
}
|
|
1118
|
-
function hasAnyCollision(census) {
|
|
1119
|
-
for (const elements of census.elementsById.values()) {
|
|
1120
|
-
if (elements.length > 1)
|
|
1121
|
-
return true;
|
|
1122
|
-
}
|
|
1123
|
-
return false;
|
|
1124
|
-
}
|
|
1125
1279
|
function mintNamespacedId(namespace, originalId, usedIds) {
|
|
1126
1280
|
const base = `${sanitizeNamespaceSegment(namespace)}--${originalId}`;
|
|
1127
1281
|
let candidate = base;
|
|
@@ -1130,81 +1284,109 @@ function mintNamespacedId(namespace, originalId, usedIds) {
|
|
|
1130
1284
|
usedIds.add(candidate);
|
|
1131
1285
|
return candidate;
|
|
1132
1286
|
}
|
|
1287
|
+
function collisionScopes(id, elements, scopeIndexByRenamable) {
|
|
1288
|
+
const keeper = elements.find((el) => !scopeIndexByRenamable.has(el)) ?? elements[0];
|
|
1289
|
+
const candidates = elements.filter((el) => el !== keeper && el.getAttribute(ID_ATTR) === id);
|
|
1290
|
+
const indices = candidates.map((el) => scopeIndexByRenamable.get(el));
|
|
1291
|
+
return new Set(indices.filter((index) => index !== void 0));
|
|
1292
|
+
}
|
|
1133
1293
|
function planRenames(census, scopes, scopeIndexByRenamable) {
|
|
1134
1294
|
const idMaps = scopes.map(() => /* @__PURE__ */ new Map());
|
|
1135
1295
|
for (const [id, elements] of census.elementsById) {
|
|
1136
1296
|
if (elements.length < 2)
|
|
1137
1297
|
continue;
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1140
|
-
if (el === keeper)
|
|
1141
|
-
continue;
|
|
1142
|
-
const scopeIndex = scopeIndexByRenamable.get(el);
|
|
1143
|
-
if (scopeIndex === void 0)
|
|
1144
|
-
continue;
|
|
1145
|
-
const idMap = idMaps[scopeIndex];
|
|
1146
|
-
if (!idMap.has(id)) {
|
|
1147
|
-
idMap.set(id, mintNamespacedId(scopes[scopeIndex].namespace, id, census.usedIds));
|
|
1148
|
-
}
|
|
1298
|
+
for (const index of collisionScopes(id, elements, scopeIndexByRenamable)) {
|
|
1299
|
+
idMaps[index].set(id, mintNamespacedId(scopes[index].namespace, id, census.usedIds));
|
|
1149
1300
|
}
|
|
1150
1301
|
}
|
|
1151
1302
|
return idMaps;
|
|
1152
1303
|
}
|
|
1304
|
+
function documentReferenceTargets(census, idMaps, scopeIndexByRenamable) {
|
|
1305
|
+
const targets = /* @__PURE__ */ new Map();
|
|
1306
|
+
for (const [id, elements] of census.elementsById) {
|
|
1307
|
+
const target = elements[0];
|
|
1308
|
+
const actual = target.getAttribute(ID_ATTR);
|
|
1309
|
+
if (actual !== id) {
|
|
1310
|
+
targets.set(id, actual);
|
|
1311
|
+
continue;
|
|
1312
|
+
}
|
|
1313
|
+
const index = scopeIndexByRenamable.get(target);
|
|
1314
|
+
const renamed = index === void 0 ? void 0 : idMaps[index].get(id);
|
|
1315
|
+
if (renamed)
|
|
1316
|
+
targets.set(id, renamed);
|
|
1317
|
+
}
|
|
1318
|
+
return targets;
|
|
1319
|
+
}
|
|
1320
|
+
function localReferenceBindings(elements) {
|
|
1321
|
+
const ids = new Set(elements.map((el) => el.getAttribute(ID_ATTR)));
|
|
1322
|
+
const renamed = /* @__PURE__ */ new Map();
|
|
1323
|
+
for (const el of elements) {
|
|
1324
|
+
const authored = currentAuthoredSvgId(el);
|
|
1325
|
+
const current = el.getAttribute(ID_ATTR);
|
|
1326
|
+
if (!authored || !current)
|
|
1327
|
+
continue;
|
|
1328
|
+
ids.add(authored);
|
|
1329
|
+
renamed.set(authored, current);
|
|
1330
|
+
}
|
|
1331
|
+
return { ids, renamed };
|
|
1332
|
+
}
|
|
1153
1333
|
function applyRenames(resolved, idMap) {
|
|
1154
1334
|
for (const el of resolved.elements) {
|
|
1155
1335
|
const currentId = el.getAttribute(ID_ATTR);
|
|
1156
1336
|
if (currentId && resolved.renamable.has(el) && idMap.has(currentId)) {
|
|
1157
1337
|
if (!el.hasAttribute(SVG_AUTHORED_ID_ATTR))
|
|
1158
1338
|
el.setAttribute(SVG_AUTHORED_ID_ATTR, currentId);
|
|
1159
|
-
|
|
1339
|
+
const after = idMap.get(currentId);
|
|
1340
|
+
const aliases = readSvgReferenceAliases(el, SVG_REFERENCE_ALIASES_ATTR, false);
|
|
1341
|
+
aliases.push({
|
|
1342
|
+
name: ID_ATTR,
|
|
1343
|
+
localName: ID_ATTR,
|
|
1344
|
+
namespaceURI: null,
|
|
1345
|
+
before: currentId,
|
|
1346
|
+
after
|
|
1347
|
+
});
|
|
1348
|
+
el.setAttribute(SVG_REFERENCE_ALIASES_ATTR, JSON.stringify(aliases));
|
|
1349
|
+
el.setAttribute(ID_ATTR, after);
|
|
1160
1350
|
}
|
|
1161
1351
|
rewriteElementIdReferences(el, idMap);
|
|
1162
1352
|
}
|
|
1163
1353
|
}
|
|
1164
|
-
function namespaceCollidingSvgIds(document, scopes) {
|
|
1165
|
-
const untouched = scopes.map(() => /* @__PURE__ */ new Map());
|
|
1354
|
+
function namespaceCollidingSvgIds(document, scopes, finalizedIds) {
|
|
1166
1355
|
if (scopes.length === 0)
|
|
1167
|
-
return
|
|
1356
|
+
return [];
|
|
1168
1357
|
const census = buildIdCensus(document);
|
|
1169
|
-
if (!hasAnyCollision(census))
|
|
1170
|
-
return untouched;
|
|
1171
1358
|
const resolved = scopes.map(resolveScope);
|
|
1359
|
+
const newlyEligible = resolved.flatMap(({ renamable }) => [...renamable]);
|
|
1360
|
+
if (finalizedIds) {
|
|
1361
|
+
for (const scope of resolved) {
|
|
1362
|
+
for (const el of scope.renamable)
|
|
1363
|
+
if (finalizedIds.has(el))
|
|
1364
|
+
scope.renamable.delete(el);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1172
1367
|
const scopeIndexByRenamable = /* @__PURE__ */ new Map();
|
|
1173
1368
|
resolved.forEach(({ renamable }, index) => {
|
|
1174
1369
|
for (const el of renamable)
|
|
1175
1370
|
scopeIndexByRenamable.set(el, index);
|
|
1176
1371
|
});
|
|
1177
|
-
if (scopeIndexByRenamable.size === 0)
|
|
1178
|
-
return untouched;
|
|
1179
1372
|
const idMaps = planRenames(census, scopes, scopeIndexByRenamable);
|
|
1373
|
+
const documentTargets = documentReferenceTargets(census, idMaps, scopeIndexByRenamable);
|
|
1180
1374
|
const referenceMaps = resolved.map((scope, index) => {
|
|
1181
|
-
const
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
if (localIds.has(id))
|
|
1185
|
-
continue;
|
|
1186
|
-
const targetScope = scopeIndexByRenamable.get(elements[0]);
|
|
1187
|
-
if (targetScope === void 0)
|
|
1188
|
-
continue;
|
|
1189
|
-
const mapped = idMaps[targetScope].get(id);
|
|
1190
|
-
if (mapped)
|
|
1191
|
-
references.set(id, mapped);
|
|
1192
|
-
}
|
|
1193
|
-
return references;
|
|
1375
|
+
const local = localReferenceBindings(scopes[index].referenceTarget === "document" ? [] : scope.elements);
|
|
1376
|
+
const inherited = [...documentTargets].filter(([id]) => !local.ids.has(id));
|
|
1377
|
+
return new Map([...inherited, ...local.renamed, ...idMaps[index]]);
|
|
1194
1378
|
});
|
|
1195
1379
|
referenceMaps.forEach((idMap, index) => {
|
|
1196
|
-
|
|
1197
|
-
applyRenames(resolved[index], idMap);
|
|
1380
|
+
applyRenames(resolved[index], idMap);
|
|
1198
1381
|
});
|
|
1382
|
+
for (const el of newlyEligible)
|
|
1383
|
+
finalizedIds?.add(el);
|
|
1199
1384
|
return referenceMaps;
|
|
1200
1385
|
}
|
|
1201
|
-
function
|
|
1202
|
-
|
|
1203
|
-
}
|
|
1204
|
-
function rewriteSvgIdReferencesInCss(css, idMap) {
|
|
1205
|
-
if (!css || idMap.size === 0)
|
|
1386
|
+
function rewriteSvgIdReferencesInCss(css, idMap, references = []) {
|
|
1387
|
+
if (!css || idMap.size === 0 && references.length === 0)
|
|
1206
1388
|
return css;
|
|
1207
|
-
if (!css.includes("#") && !css.toLowerCase().includes("url("))
|
|
1389
|
+
if (!css.includes("#") && !css.includes("[") && !css.toLowerCase().includes("url("))
|
|
1208
1390
|
return css;
|
|
1209
1391
|
let root;
|
|
1210
1392
|
try {
|
|
@@ -1213,8 +1395,13 @@ function rewriteSvgIdReferencesInCss(css, idMap) {
|
|
|
1213
1395
|
return css;
|
|
1214
1396
|
}
|
|
1215
1397
|
let mutated = false;
|
|
1398
|
+
const recordedIds = new Set(references.filter((alias) => alias.name === ID_ATTR).map((alias) => alias.before));
|
|
1399
|
+
const ids = [...idMap].filter(([id]) => !recordedIds.has(id)).map(([id, renamed]) => ({
|
|
1400
|
+
id,
|
|
1401
|
+
replacement: `:is(#${escapeCssIdentifier(id)}, #${escapeCssIdentifier(renamed)})`
|
|
1402
|
+
}));
|
|
1216
1403
|
root.walkRules((rule) => {
|
|
1217
|
-
const rewritten = rule.selectors.map((selector) =>
|
|
1404
|
+
const rewritten = rule.selectors.map((selector) => rewriteSvgSelectors(selector, ids, references));
|
|
1218
1405
|
if (rewritten.some((selector, index) => selector !== rule.selectors[index])) {
|
|
1219
1406
|
rule.selectors = rewritten;
|
|
1220
1407
|
mutated = true;
|
|
@@ -1365,6 +1552,7 @@ function defaultBuildScopeSelector(compId) {
|
|
|
1365
1552
|
}
|
|
1366
1553
|
function inlineSubCompositions(document, hosts, options) {
|
|
1367
1554
|
const { resolveHtml, parseHtml, hostIdentityMap, rewriteInlineStyles = false, flattenInnerRoot, compoundAuthoredRoot, readVariableDefaults, parseHostVariables, buildScopeSelector = defaultBuildScopeSelector, scriptErrorLabel = "[HyperFrames] composition script error:", onMissingComposition, assetExists, tagScenes = false } = options;
|
|
1555
|
+
const rootStyles = [...document.querySelectorAll("style")];
|
|
1368
1556
|
const styles = [];
|
|
1369
1557
|
const styleScenes = [];
|
|
1370
1558
|
const scripts = [];
|
|
@@ -1583,20 +1771,32 @@ function inlineSubCompositions(document, hosts, options) {
|
|
|
1583
1771
|
styleEnd
|
|
1584
1772
|
});
|
|
1585
1773
|
}
|
|
1586
|
-
const svgIdMaps = namespaceCollidingSvgIds(document,
|
|
1587
|
-
root,
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1774
|
+
const svgIdMaps = namespaceCollidingSvgIds(document, [
|
|
1775
|
+
...svgIdScopes.map(({ root, namespace, exclude, styleStart, styleEnd }) => ({
|
|
1776
|
+
root,
|
|
1777
|
+
namespace,
|
|
1778
|
+
exclude,
|
|
1779
|
+
cssTexts: styles.slice(styleStart, styleEnd).map((style) => style.css)
|
|
1780
|
+
})),
|
|
1781
|
+
{
|
|
1782
|
+
root: document.documentElement,
|
|
1783
|
+
namespace: "",
|
|
1784
|
+
referenceTarget: "document",
|
|
1785
|
+
exclude: svgIdScopes.map(({ root }) => root),
|
|
1786
|
+
cssTexts: rootStyles.map((style) => style.textContent ?? "")
|
|
1787
|
+
}
|
|
1788
|
+
]);
|
|
1789
|
+
svgIdMaps.slice(0, svgIdScopes.length).forEach((idMap, index) => {
|
|
1595
1790
|
const { styleStart, styleEnd } = svgIdScopes[index];
|
|
1791
|
+
const references = readSvgReferenceAliases(svgIdScopes[index].root, SVG_REFERENCE_ALIASES_ATTR);
|
|
1596
1792
|
for (let i = styleStart; i < styleEnd; i += 1) {
|
|
1597
|
-
styles[i].css = rewriteSvgIdReferencesInCss(styles[i].css, idMap);
|
|
1793
|
+
styles[i].css = rewriteSvgIdReferencesInCss(styles[i].css, idMap, references);
|
|
1598
1794
|
}
|
|
1599
1795
|
});
|
|
1796
|
+
const rootReferences = readSvgReferenceAliases(document.documentElement, SVG_REFERENCE_ALIASES_ATTR);
|
|
1797
|
+
for (const style of rootStyles) {
|
|
1798
|
+
style.textContent = rewriteSvgIdReferencesInCss(style.textContent ?? "", svgIdMaps[svgIdScopes.length], rootReferences);
|
|
1799
|
+
}
|
|
1600
1800
|
return {
|
|
1601
1801
|
styles,
|
|
1602
1802
|
styleScenes,
|