@openpresentation/opf-editor 0.24.3 → 0.25.0
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/README.md +64 -3
- package/dist/galleries.js +2 -2
- package/dist/layout-canvas.js +748 -0
- package/dist/layout-diagram.js +25 -0
- package/dist/layout-editor-ui.js +232 -0
- package/dist/layout-editor.d.ts +212 -0
- package/dist/layout-editor.js +197 -0
- package/dist/layout-inspector.js +339 -0
- package/dist/layout-layers.js +331 -0
- package/dist/layout-model.js +299 -0
- package/dist/layout-palette.js +77 -0
- package/dist/layout-samples.js +84 -0
- package/dist/layout-templates.d.ts +32 -8
- package/dist/layout-templates.js +89 -37
- package/dist/layout-tree.d.ts +87 -0
- package/dist/layout-tree.js +704 -0
- package/dist/presenter.d.ts +4 -1
- package/dist/presenter.js +5 -3
- package/dist/slide-manager.js +3 -7
- package/dist/styles.css +852 -31
- package/package.json +15 -10
- package/dist/custom-layout-editor.d.ts +0 -7
- package/dist/custom-layout-editor.js +0 -105
package/dist/presenter.d.ts
CHANGED
|
@@ -83,16 +83,19 @@ export interface PresentButtonOptions {
|
|
|
83
83
|
density?: "comfortable" | "touch";
|
|
84
84
|
/** The accessible name (default "Present"). */
|
|
85
85
|
label?: string;
|
|
86
|
+
/** `"quiet"` (default): a transparent icon button like the toolbar's undo and redo. `"primary"`: the filled accent look of the Export trigger. */
|
|
87
|
+
variant?: "quiet" | "primary";
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
export interface PresentButton {
|
|
89
91
|
readonly element: HTMLButtonElement;
|
|
90
92
|
setDisabled(reason?: boolean | string): void;
|
|
91
93
|
setDensity(density: "comfortable" | "touch"): void;
|
|
94
|
+
setVariant(variant: "quiet" | "primary"): void;
|
|
92
95
|
destroy(): void;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
/** The icon-only Present button: a Lucide Presentation icon, `aria-label="Present"`, title "Present (F5)"
|
|
98
|
+
/** The icon-only Present button: a Lucide Presentation icon, `aria-label="Present"`, title "Present (F5)". Quiet by default (a transparent icon button like undo and redo); `variant: "primary"` styles it like the Export trigger. */
|
|
96
99
|
export declare function createPresentButton(container: HTMLElement, options?: PresentButtonOptions): PresentButton;
|
|
97
100
|
|
|
98
101
|
/**
|
package/dist/presenter.js
CHANGED
|
@@ -372,9 +372,10 @@ function isInteractiveTarget(target) {
|
|
|
372
372
|
* Mount the Present button in `container`: an icon-only button (Lucide Presentation) named "Present", titled "Present (F5)".
|
|
373
373
|
*
|
|
374
374
|
* Options: `onPresent(event)`, `disabled` (`true`, or a string that says why and is the title), `density` (`"comfortable"` 32px, or `"touch"` 40px)
|
|
375
|
-
*
|
|
375
|
+
* `label` (the accessible name, default "Present") and `variant` (`"quiet"`, the default: a transparent icon button like the toolbar's undo and redo,
|
|
376
|
+
* or `"primary"`: the filled accent look of the Export trigger). A disabled button stays focusable (`aria-disabled`) and does nothing.
|
|
376
377
|
*
|
|
377
|
-
* Returns `{ element, setDisabled(reason), setDensity(density), destroy() }`.
|
|
378
|
+
* Returns `{ element, setDisabled(reason), setDensity(density), setVariant(variant), destroy() }`.
|
|
378
379
|
*/
|
|
379
380
|
export function createPresentButton(container, options = {}) {
|
|
380
381
|
if (!container?.ownerDocument) throw new TypeError("A DOM container is required.");
|
|
@@ -384,7 +385,7 @@ export function createPresentButton(container, options = {}) {
|
|
|
384
385
|
let destroyed = false;
|
|
385
386
|
const button = el(doc, "button", {
|
|
386
387
|
type: "button", class: "opf-present-button opf-ui", "aria-label": label, title: "Present (F5)", "aria-keyshortcuts": "F5",
|
|
387
|
-
"data-density": options.density === "touch" ? "touch" : "comfortable",
|
|
388
|
+
"data-density": options.density === "touch" ? "touch" : "comfortable", "data-variant": options.variant === "primary" ? "primary" : "quiet",
|
|
388
389
|
}, icon(doc, "Presentation", 16));
|
|
389
390
|
const paint = () => {
|
|
390
391
|
if (disabledReason) { button.setAttribute("aria-disabled", "true"); button.title = disabledReason; }
|
|
@@ -404,6 +405,7 @@ export function createPresentButton(container, options = {}) {
|
|
|
404
405
|
paint();
|
|
405
406
|
},
|
|
406
407
|
setDensity(next) { button.dataset.density = next === "touch" ? "touch" : "comfortable"; },
|
|
408
|
+
setVariant(next) { button.dataset.variant = next === "primary" ? "primary" : "quiet"; },
|
|
407
409
|
destroy() { destroyed = true; button.remove(); },
|
|
408
410
|
};
|
|
409
411
|
}
|
package/dist/slide-manager.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { listSwitchOptions } from "./switches.js";
|
|
10
10
|
import { layoutRegionSummary } from "./layout-templates.js";
|
|
11
11
|
import { groupLayoutChoices } from "./layout-templates.js";
|
|
12
|
+
import { buildLayoutDiagram } from "./layout-diagram.js";
|
|
12
13
|
import { switchDimension } from "./switches.js";
|
|
13
14
|
|
|
14
15
|
let instances = 0;
|
|
@@ -521,13 +522,8 @@ export function createSlideManager(container, options) {
|
|
|
521
522
|
template.replaceChildren(); currentPreview.replaceChildren();
|
|
522
523
|
if (choice?.record?.preview && typeof choice.record.preview === "string") {
|
|
523
524
|
template.append(el("img", { src: choice.record.preview, alt: `${choice.label} template preview` }));
|
|
524
|
-
} else if (Array.isArray(choice?.record?.
|
|
525
|
-
|
|
526
|
-
diagram.style.gridTemplateAreas = choice.record.areas.map((row) => `"${row.join(" ")}"`).join(" ");
|
|
527
|
-
diagram.style.gridTemplateColumns = `repeat(${choice.record.areas[0]?.length ?? 1}, 1fr)`;
|
|
528
|
-
const areas = [...new Set(choice.record.areas.flat())].filter((area) => area !== ".");
|
|
529
|
-
for (const area of areas) { const part = el("span", { text: area }); part.style.gridArea = area; diagram.append(part); }
|
|
530
|
-
template.append(diagram);
|
|
525
|
+
} else if (Array.isArray(choice?.record?.regions)) {
|
|
526
|
+
template.append(buildLayoutDiagram(document, choice.record));
|
|
531
527
|
}
|
|
532
528
|
if (choice && options.renderLayoutPreview) {
|
|
533
529
|
try { currentPreview.innerHTML = options.renderLayoutPreview(deck(), current(), choice) ?? ""; }
|