pagiera 0.2.0-alpha.64 → 0.2.0-alpha.65
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/full-editor.js +64 -10
- package/dist/full-editor.js.map +2 -2
- package/dist/internal/app/p/editor/editor.d.ts.map +1 -1
- package/dist/internal/app/p/editor/editor.js +15 -13
- package/dist/internal/app/p/editor/editor.js.map +1 -1
- package/dist/internal/lib/editor/style.d.ts +15 -0
- package/dist/internal/lib/editor/style.d.ts.map +1 -1
- package/dist/internal/lib/editor/style.js +58 -1
- package/dist/internal/lib/editor/style.js.map +1 -1
- package/dist/internal/lib/render/css.d.ts.map +1 -1
- package/dist/internal/lib/render/css.js +6 -1
- package/dist/internal/lib/render/css.js.map +1 -1
- package/dist/internal/lib/render/marquee-runtime.d.ts +6 -0
- package/dist/internal/lib/render/marquee-runtime.d.ts.map +1 -1
- package/dist/internal/lib/render/marquee-runtime.js +36 -6
- package/dist/internal/lib/render/marquee-runtime.js.map +1 -1
- package/dist/internal/lib/render/page-render.d.ts +1 -1
- package/dist/internal/lib/render/page-render.d.ts.map +1 -1
- package/dist/internal/lib/render/page-render.js +4 -0
- package/dist/internal/lib/render/page-render.js.map +1 -1
- package/dist/runtime-marquee.js +18 -5
- package/dist/runtime-marquee.js.map +2 -2
- package/dist/runtime.js +53 -4
- package/dist/runtime.js.map +2 -2
- package/package.json +1 -1
package/dist/full-editor.js
CHANGED
|
@@ -4656,6 +4656,27 @@ var ALIGN_MAP = {
|
|
|
4656
4656
|
end: "flex-end",
|
|
4657
4657
|
stretch: "stretch"
|
|
4658
4658
|
};
|
|
4659
|
+
var TEXT_VERTICAL = {
|
|
4660
|
+
start: "start",
|
|
4661
|
+
center: "center",
|
|
4662
|
+
end: "end",
|
|
4663
|
+
between: "start",
|
|
4664
|
+
stretch: "stretch"
|
|
4665
|
+
};
|
|
4666
|
+
function textOnlyPlacementCss(selector) {
|
|
4667
|
+
return `${selector}>*{grid-column:2}${selector}::before{grid-column:1;grid-row:1}${selector}::after{grid-column:3;grid-row:1}`;
|
|
4668
|
+
}
|
|
4669
|
+
var parentIdsByMap = /* @__PURE__ */ new WeakMap();
|
|
4670
|
+
function textOnly(element, byId) {
|
|
4671
|
+
if (!isTextual(element.type)) return false;
|
|
4672
|
+
let parents = parentIdsByMap.get(byId);
|
|
4673
|
+
if (!parents) {
|
|
4674
|
+
parents = /* @__PURE__ */ new Set();
|
|
4675
|
+
for (const other of byId.values()) if (other.parentId) parents.add(other.parentId);
|
|
4676
|
+
parentIdsByMap.set(byId, parents);
|
|
4677
|
+
}
|
|
4678
|
+
return !parents.has(element.id);
|
|
4679
|
+
}
|
|
4659
4680
|
function styleToCss(style, context, element) {
|
|
4660
4681
|
const borderT = style.borderT ?? style.borderW;
|
|
4661
4682
|
const borderR = style.borderR ?? style.borderW;
|
|
@@ -4734,6 +4755,17 @@ function styleToCss(style, context, element) {
|
|
|
4734
4755
|
css2.gridTemplateColumns = `repeat(${Math.max(1, style.columns)}, minmax(0, 1fr))`;
|
|
4735
4756
|
css2.alignItems = ALIGN_MAP[style.align];
|
|
4736
4757
|
}
|
|
4758
|
+
if (context.textOnly && style.layout === "stack") {
|
|
4759
|
+
const vertical = style.direction === "row" ? style.align : style.justify;
|
|
4760
|
+
css2.display = "grid";
|
|
4761
|
+
css2.gridTemplateColumns = "auto minmax(0, 1fr) auto";
|
|
4762
|
+
css2.alignContent = TEXT_VERTICAL[vertical];
|
|
4763
|
+
css2.alignItems = "baseline";
|
|
4764
|
+
css2.justifyContent = void 0;
|
|
4765
|
+
css2.flexDirection = void 0;
|
|
4766
|
+
css2.flexWrap = void 0;
|
|
4767
|
+
css2.columnGap = void 0;
|
|
4768
|
+
}
|
|
4737
4769
|
if (style.layout === "absolute") {
|
|
4738
4770
|
css2.display = "block";
|
|
4739
4771
|
}
|
|
@@ -6466,6 +6498,21 @@ function mountDisclosures(root) {
|
|
|
6466
6498
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
6467
6499
|
var noSubscription = () => () => {
|
|
6468
6500
|
};
|
|
6501
|
+
function runInline(code) {
|
|
6502
|
+
const flag = `__pgExec${Math.random().toString(36).slice(2)}`;
|
|
6503
|
+
const host = window;
|
|
6504
|
+
const script = document.createElement("script");
|
|
6505
|
+
const nonce = document.querySelector("script[nonce]")?.nonce;
|
|
6506
|
+
if (nonce) script.nonce = nonce;
|
|
6507
|
+
script.text = `window[${JSON.stringify(flag)}]=1;(function(){
|
|
6508
|
+
${code}
|
|
6509
|
+
})();`;
|
|
6510
|
+
document.head.appendChild(script);
|
|
6511
|
+
script.remove();
|
|
6512
|
+
const ran = host[flag] === 1;
|
|
6513
|
+
delete host[flag];
|
|
6514
|
+
return ran;
|
|
6515
|
+
}
|
|
6469
6516
|
function PageScript({ name, code, page }) {
|
|
6470
6517
|
const fromServer = useSyncExternalStore(noSubscription, () => false, () => true);
|
|
6471
6518
|
useEffect3(() => {
|
|
@@ -6475,11 +6522,9 @@ function PageScript({ name, code, page }) {
|
|
|
6475
6522
|
delete ran[name];
|
|
6476
6523
|
return;
|
|
6477
6524
|
}
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
console.error(error);
|
|
6482
|
-
}
|
|
6525
|
+
if (runInline(code)) return;
|
|
6526
|
+
console.error(`Pagiera: the "${name}" page script could not run (blocked by the Content Security Policy?).`);
|
|
6527
|
+
if (name === "entrance") document.documentElement.classList.remove("pg-ready");
|
|
6483
6528
|
}, [code, name, page]);
|
|
6484
6529
|
if (!fromServer) return null;
|
|
6485
6530
|
return /* @__PURE__ */ jsx9(
|
|
@@ -7597,7 +7642,8 @@ function rulesFor(element, byId, breakpoint, rootStyle, cascade) {
|
|
|
7597
7642
|
{
|
|
7598
7643
|
parentLayout: parentStyle?.layout ?? "stack",
|
|
7599
7644
|
parentDirection: parentStyle?.direction ?? "column",
|
|
7600
|
-
parentAlign: parentStyle?.align ?? rootStyle.align
|
|
7645
|
+
parentAlign: parentStyle?.align ?? rootStyle.align,
|
|
7646
|
+
textOnly: textOnly(element, byId)
|
|
7601
7647
|
},
|
|
7602
7648
|
element
|
|
7603
7649
|
);
|
|
@@ -7628,7 +7674,8 @@ function interactionDeclarations(element, byId, breakpoint, rootStyle, cascade,
|
|
|
7628
7674
|
const context = {
|
|
7629
7675
|
parentLayout: parentStyle?.layout ?? "stack",
|
|
7630
7676
|
parentDirection: parentStyle?.direction ?? "column",
|
|
7631
|
-
parentAlign: parentStyle?.align ?? rootStyle.align
|
|
7677
|
+
parentAlign: parentStyle?.align ?? rootStyle.align,
|
|
7678
|
+
textOnly: textOnly(element, byId)
|
|
7632
7679
|
};
|
|
7633
7680
|
const resting = resolveStyle(element, breakpoint, cascade);
|
|
7634
7681
|
const restingCss = styleToCss(resting, context, element);
|
|
@@ -7804,7 +7851,9 @@ function stylesheetFor(elements, rootStyle) {
|
|
|
7804
7851
|
// element selector and leak the editor's typeface into the site.
|
|
7805
7852
|
// The shell spans the viewport; the content width is applied by each
|
|
7806
7853
|
// band's inner box, so section backgrounds reach both edges.
|
|
7807
|
-
`.pg-root{font-family:${resolveFont(rootStyle.fontFamily)}}.pg-node{box-sizing:border-box}.pg-component-root{background:transparent!important;background-image:none!important;border-width:0!important;box-shadow:none!important;overflow:visible!important}.pg-node:where(input,textarea,button){font:inherit}.pg-node:where(button){appearance:none;background-color:transparent;border-width:0;color:inherit;text-align:inherit}.pg-node:is(input,textarea){outline:none}.pg-node:is(select){outline:none;appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 fill=%27none%27 stroke=%27%23888%27 stroke-width=%271.6%27><path d=%27M4 6.5 8 10.5 12 6.5%27/></svg>");background-repeat:no-repeat;background-position:right 12px center;padding-right:34px}.pg-node[role=radiogroup]{display:flex;flex-direction:column;gap:8px}
|
|
7854
|
+
`.pg-root{font-family:${resolveFont(rootStyle.fontFamily)}}.pg-node{box-sizing:border-box}.pg-component-root{background:transparent!important;background-image:none!important;border-width:0!important;box-shadow:none!important;overflow:visible!important}.pg-node:where(input,textarea,button){font:inherit}.pg-node:where(button){appearance:none;background-color:transparent;border-width:0;color:inherit;text-align:inherit}.pg-node:is(input,textarea){outline:none}.pg-node:is(select){outline:none;appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 fill=%27none%27 stroke=%27%23888%27 stroke-width=%271.6%27><path d=%27M4 6.5 8 10.5 12 6.5%27/></svg>");background-repeat:no-repeat;background-position:right 12px center;padding-right:34px}.pg-node[role=radiogroup]{display:flex;flex-direction:column;gap:8px}` + // Text with a `::before`/`::after` from custom CSS keeps them on
|
|
7855
|
+
// the text's line (the node itself is a grid, see `textOnly`).
|
|
7856
|
+
textOnlyPlacementCss(".pg-text-only") + ".pg-choice{display:flex;align-items:center;gap:8px;cursor:pointer}.pg-choice input{accent-color:currentColor;margin:0}.pg-node:is(input[type=checkbox],input[type=radio]){accent-color:currentColor}.pg-node:is(textarea){resize:none}.pg-form-status:empty{display:none}.pg-form-status{font-size:12px;line-height:1.4}.pg-node[data-pg-state=success] .pg-form-status{color:#22c55e}.pg-node[data-pg-state=error] .pg-form-status{color:#ef4444}.pg-node img{display:block;width:100%;height:100%}.pg-node:is(ul,ol){list-style:none}.pg-list{counter-reset:pg-list}.pg-list>li{position:relative}.pg-list-bullet>li::before{content:'\\2022';position:absolute;left:-1em;opacity:.65}.pg-list-number>li::before{counter-increment:pg-list;content:counter(pg-list) '.';position:absolute;left:-1.6em;opacity:.65;font-variant-numeric:tabular-nums}.pg-node hr{border:0;width:100%;height:100%}.pg-node iframe{display:block;width:100%;height:100%;border:0}.pg-svg-glyph>svg{display:block;width:100%;height:100%}.pg-md{width:100%}.pg-md>*{margin:0}.pg-md>*+*{margin-top:1em}.pg-md h1,.pg-md h2,.pg-md h3,.pg-md h4,.pg-md h5,.pg-md h6{font-weight:600;line-height:1.25;margin-top:1.6em;text-wrap:balance}.pg-md h1{font-size:1.9em}.pg-md h2{font-size:1.55em}.pg-md h3{font-size:1.25em}.pg-md h4{font-size:1.1em}.pg-md :is(ul,ol){padding-left:1.4em}.pg-md ul{list-style:disc}.pg-md ol{list-style:decimal}.pg-md li+li{margin-top:.35em}.pg-md a{color:inherit;text-decoration:underline;text-underline-offset:2px}.pg-md img{max-width:100%;height:auto;border-radius:inherit}.pg-md blockquote{border-left:3px solid currentColor;padding-left:1em;opacity:.85}.pg-md :is(code,pre){font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em}.pg-md pre{overflow-x:auto;padding:1em;border-radius:.5em;background:rgba(127,127,127,.12)}.pg-md pre code{background:none;padding:0}.pg-md code{background:rgba(127,127,127,.15);border-radius:.3em;padding:.1em .35em}.pg-md table{width:100%;border-collapse:collapse}.pg-md :is(th,td){border:1px solid rgba(127,127,127,.35);padding:.45em .7em;text-align:left}.pg-md hr{border:0;border-top:1px solid rgba(127,127,127,.35);margin:2em 0}.pg-node[data-pg-target]{cursor:pointer}.pg-link{text-decoration:none;color:inherit}"
|
|
7808
7857
|
);
|
|
7809
7858
|
const setByRule = /* @__PURE__ */ new Map();
|
|
7810
7859
|
const record = (id, suffix, css2) => {
|
|
@@ -9640,7 +9689,9 @@ function RenderedNode({
|
|
|
9640
9689
|
const children = childrenOf(elements, element.id);
|
|
9641
9690
|
const style = resolveStyle(element, baseId, cascade);
|
|
9642
9691
|
const band = isBand(element.type, style, rootStyle);
|
|
9643
|
-
const className = `pg-node ${classFor(element.id)}` + (element.componentRole === "master" || element.componentRole === "instance" ? " pg-component-root" : "") + (band ? " pg-band" : "") +
|
|
9692
|
+
const className = `pg-node ${classFor(element.id)}` + (element.componentRole === "master" || element.componentRole === "instance" ? " pg-component-root" : "") + (band ? " pg-band" : "") + // Matches `textOnly` in the stylesheet: text with no child elements is
|
|
9693
|
+
// a grid, and this class places its text and pseudo-elements.
|
|
9694
|
+
(isTextual(element.type) && children.length === 0 ? " pg-text-only" : "") + (element.type === "List" && element.listStyle !== "none" ? ` pg-list pg-list-${element.listStyle === "number" ? "number" : "bullet"}` : "") + (style.entrance === "none" || style.scrollEffect !== "none" ? "" : style.entranceSplit === "none" ? " pg-anim" : " pg-anim pg-split");
|
|
9644
9695
|
const renderChildren = (subset = children) => element.type === "Repeat" ? rowsFor(element, data, false).flatMap(
|
|
9645
9696
|
(dataRow, index) => children.map((child) => /* @__PURE__ */ jsx11(
|
|
9646
9697
|
RenderedNode,
|
|
@@ -21343,7 +21394,8 @@ function Editor({
|
|
|
21343
21394
|
return {
|
|
21344
21395
|
parentLayout: parentStyle?.layout ?? rootStyle.layout,
|
|
21345
21396
|
parentDirection: parentStyle?.direction ?? rootStyle.direction,
|
|
21346
|
-
parentAlign: parentStyle?.align ?? rootStyle.align
|
|
21397
|
+
parentAlign: parentStyle?.align ?? rootStyle.align,
|
|
21398
|
+
textOnly: textOnly(element, byId)
|
|
21347
21399
|
};
|
|
21348
21400
|
},
|
|
21349
21401
|
[byId, breakpoint, rootStyle.align, rootStyle.direction, rootStyle.layout]
|
|
@@ -23237,6 +23289,7 @@ function Editor({
|
|
|
23237
23289
|
"div",
|
|
23238
23290
|
{
|
|
23239
23291
|
"data-canvas-element": el.id,
|
|
23292
|
+
"data-pg-text-only": textOnly(el, byId) ? "" : void 0,
|
|
23240
23293
|
...carouselControlAttributes(el.carouselControl),
|
|
23241
23294
|
...disclosureAttributes(el.disclosure),
|
|
23242
23295
|
style: split ? split.shell : css2,
|
|
@@ -24912,6 +24965,7 @@ function Editor({
|
|
|
24912
24965
|
{
|
|
24913
24966
|
dangerouslySetInnerHTML: {
|
|
24914
24967
|
__html: `${customFontCss}
|
|
24968
|
+
${textOnlyPlacementCss("[data-pg-text-only]")}
|
|
24915
24969
|
.canvas-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
|
|
24916
24970
|
.canvas-scrollbar::-webkit-scrollbar { display: none; width: 0; height: 0; }
|
|
24917
24971
|
`
|