@trebired/frontend 29.5.0 → 29.5.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/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/dist/media/frames.d.ts.map +1 -1
- package/dist/media/frames.js +2 -1
- package/dist/media/frames.js.map +1 -1
- package/dist/src/media/frames.d.ts.map +1 -1
- package/dist/src/media/frames.js +2 -1
- package/dist/src/media/frames.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ All notable changes to `@trebired/frontend` will be documented here.
|
|
|
4
4
|
|
|
5
5
|
This project follows semantic versioning once published.
|
|
6
6
|
|
|
7
|
+
## 29.5.1
|
|
8
|
+
|
|
9
|
+
- Fixed an unverified frame staying in the page, hidden, when a script appended it to `body` before the page had finished parsing. A frame placed straight into `body`, `html` or `head` belongs to no island, so it is removed whenever it arrives; only a frame inside the markup, which React may hydrate, stays hidden in place.
|
|
10
|
+
|
|
7
11
|
## 29.5.0
|
|
8
12
|
|
|
9
13
|
- Added unverified frames. An `iframe`, `frame`, `object` or `embed` is shown only when it carries `data-tbf-frame`. `frontendBoot()` adds a head script that hides every frame without it before the first paint and removes one that a script other than React inserts after the page has parsed, such as a frame the host appends; a frame in the server markup or rendered by React stays in place hidden, so hydration is never broken. Each one is reported in the browser console as removed or hidden. `EmbedFrame`, `MapEmbed` and the editor surface carry the attribute; an app's own frame spreads the new `frontendFrameAttrs()`, and `FRAME_ATTRIBUTE` names it. `frontendBoot({ frames: false })` turns the script off.
|
package/README.md
CHANGED
|
@@ -127,7 +127,7 @@ It returns `{ bootScripts, bodyScripts }`: the head scripts that restore the scr
|
|
|
127
127
|
|
|
128
128
|
### Unverified frames
|
|
129
129
|
|
|
130
|
-
A page shows only the frames it declares. Every `iframe`, `frame`, `object` and `embed` must carry `data-tbf-frame`; one without it is unverified. `frontendBoot()` adds a head script that hides every unverified frame with a stylesheet before the first paint, so none is ever seen, and watches the document for the rest of the page's life. An unverified frame
|
|
130
|
+
A page shows only the frames it declares. Every `iframe`, `frame`, `object` and `embed` must carry `data-tbf-frame`; one without it is unverified. `frontendBoot()` adds a head script that hides every unverified frame with a stylesheet before the first paint, so none is ever seen, and watches the document for the rest of the page's life. An unverified frame that anything other than React inserts after the page has parsed, or places straight into `body`, such as a frame a script appends to the page, is removed. One inside the server markup or rendered by React stays in place, hidden, because React owns it and would fail to hydrate or update a node taken from under it. Either way the console gets a warning naming the frame and whether it was removed or hidden, so an app frame that lacks the attribute is found in the browser's console.
|
|
131
131
|
|
|
132
132
|
`EmbedFrame`, `MapEmbed` and the editor surface carry the attribute already. A frame an app renders itself spreads `frontendFrameAttrs()` onto the element, and `FRAME_ATTRIBUTE` names the attribute for code that builds frames by hand:
|
|
133
133
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/media/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,QAAA,MAAM,eAAe,kBAA4B,CAAC;AAIlD,iBAAS,kBAAkB,IAAI,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAElE;AAMD,iBAAS,+BAA+B,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/media/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,QAAA,MAAM,eAAe,kBAA4B,CAAC;AAIlD,iBAAS,kBAAkB,IAAI,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAElE;AAMD,iBAAS,+BAA+B,IAAI,MAAM,CAkBjD;AAED,OAAO,EAAE,eAAe,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/media/frames.js
CHANGED
|
@@ -15,7 +15,8 @@ function createUnverifiedFrameBootScript() {
|
|
|
15
15
|
"s.textContent=Q+'{display:none!important}';(d.head||d.documentElement).appendChild(s);",
|
|
16
16
|
"function r(f){for(var k in f)if(k.indexOf('__react')===0)return true;return false}",
|
|
17
17
|
"var w=new WeakSet();function v(f){if(w.has(f))return;w.add(f);",
|
|
18
|
-
"var
|
|
18
|
+
"var p=f.parentNode,top=p===d.body||p===d.documentElement||p===d.head;",
|
|
19
|
+
"var keep=r(f)||(d.readyState==='loading'&&!top);if(!keep)f.remove();",
|
|
19
20
|
"console.warn('[tbf] Unverified '+f.tagName.toLowerCase()+' '+(keep?'hidden':'removed')",
|
|
20
21
|
`+': it has no ${FRAME_ATTRIBUTE} attribute.',f)}`,
|
|
21
22
|
"function x(n){if(n.nodeType!==1)return;if(n.matches(Q)){v(n);return}",
|
package/dist/media/frames.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../src/media/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,eAAe,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAElD,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAE1D,SAAS,kBAAkB;IACzB,OAAO,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,uBAAuB;IAC9B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,SAAS,eAAe,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,+BAA+B;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAC;IAC3D,OAAO;QACL,kBAAkB;QAClB,SAAS,QAAQ,yCAAyC;QAC1D,wFAAwF;QACxF,oFAAoF;QACpF,gEAAgE;QAChE,
|
|
1
|
+
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../src/media/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,eAAe,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAElD,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAE1D,SAAS,kBAAkB;IACzB,OAAO,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,uBAAuB;IAC9B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,SAAS,eAAe,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,+BAA+B;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAC;IAC3D,OAAO;QACL,kBAAkB;QAClB,SAAS,QAAQ,yCAAyC;QAC1D,wFAAwF;QACxF,oFAAoF;QACpF,gEAAgE;QAChE,uEAAuE;QACvE,sEAAsE;QACtE,wFAAwF;QACxF,iBAAiB,eAAe,kBAAkB;QAClD,sEAAsE;QACtE,0DAA0D;QAC1D,0FAA0F;QAC1F,4DAA4D;QAC5D,kBAAkB;KACnB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/media/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,QAAA,MAAM,eAAe,kBAA4B,CAAC;AAIlD,iBAAS,kBAAkB,IAAI,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAElE;AAMD,iBAAS,+BAA+B,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/media/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,QAAA,MAAM,eAAe,kBAA4B,CAAC;AAIlD,iBAAS,kBAAkB,IAAI,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAElE;AAMD,iBAAS,+BAA+B,IAAI,MAAM,CAkBjD;AAED,OAAO,EAAE,eAAe,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/src/media/frames.js
CHANGED
|
@@ -15,7 +15,8 @@ function createUnverifiedFrameBootScript() {
|
|
|
15
15
|
"s.textContent=Q+'{display:none!important}';(d.head||d.documentElement).appendChild(s);",
|
|
16
16
|
"function r(f){for(var k in f)if(k.indexOf('__react')===0)return true;return false}",
|
|
17
17
|
"var w=new WeakSet();function v(f){if(w.has(f))return;w.add(f);",
|
|
18
|
-
"var
|
|
18
|
+
"var p=f.parentNode,top=p===d.body||p===d.documentElement||p===d.head;",
|
|
19
|
+
"var keep=r(f)||(d.readyState==='loading'&&!top);if(!keep)f.remove();",
|
|
19
20
|
"console.warn('[tbf] Unverified '+f.tagName.toLowerCase()+' '+(keep?'hidden':'removed')",
|
|
20
21
|
`+': it has no ${FRAME_ATTRIBUTE} attribute.',f)}`,
|
|
21
22
|
"function x(n){if(n.nodeType!==1)return;if(n.matches(Q)){v(n);return}",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frames.js","sourceRoot":"","sources":["../../../src/media/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,eAAe,GAAG,gBAAgB,CAAC,OAA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