@officedk/pptxdk 0.2.0 → 0.2.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/dist/build.d.ts +5 -8
- package/dist/build.js +44 -52
- package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
- package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
- package/dist/core/dist/capabilities/audio/entry.js +122 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box-codegen.js +7 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box-declaration.js +8 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +14 -15
- package/dist/core/dist/capabilities/box/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +11 -18
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +891 -468
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +1 -1
- package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +73 -79
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +175 -113
- package/dist/core/dist/capabilities/chart/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
- package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +28 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +7 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +3 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
- package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
- package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
- package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
- package/dist/core/dist/capabilities/comment/comment.js +141 -0
- package/dist/core/dist/capabilities/comment/entry.js +1 -0
- package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
- package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
- package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +113 -50
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
- package/dist/core/dist/capabilities/group/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-codegen.js +6 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-declaration.js +8 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-import.js +36 -77
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group.js +17 -17
- package/dist/core/dist/capabilities/image/entry.js +4 -0
- package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
- package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
- package/dist/core/dist/capabilities/image/image-import.js +26 -0
- package/dist/core/dist/capabilities/image/image.js +57 -0
- package/dist/core/dist/capabilities/line/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-codegen.js +6 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-declaration.js +15 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-import.js +15 -95
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line.js +41 -43
- package/dist/core/dist/capabilities/masters/entry.js +1 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters-codegen.js +7 -26
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +23 -35
- package/dist/core/dist/capabilities/motion/entry.js +5 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +15 -35
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +25 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +17 -14
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +79 -75
- package/dist/core/dist/capabilities/notes/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +4 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +6 -6
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +16 -41
- package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
- package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-codegen.js +5 -15
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-schemas.js +7 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder.js +50 -107
- package/dist/core/dist/capabilities/shape/entry.js +6 -0
- package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
- package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +44 -30
- package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
- package/dist/core/dist/capabilities/shared/date-time.js +98 -0
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-embedding.js +5 -6
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-engine.js +34 -13
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-import.js +62 -23
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font.js +4 -4
- package/dist/core/dist/capabilities/shared/geometry-codegen.js +101 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +47 -44
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
- package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -79
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +16 -26
- package/dist/core/dist/capabilities/shared/line-match.js +78 -0
- package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
- package/dist/core/dist/capabilities/shared/media-import.js +156 -0
- package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
- package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
- package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
- package/dist/core/dist/capabilities/shared/media-source.js +107 -0
- package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
- package/dist/core/dist/capabilities/shared/media.js +134 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
- package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-api.js +112 -99
- package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-schemas.js +19 -5
- package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +97 -158
- package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
- package/dist/core/dist/capabilities/shared/picture.js +510 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/placeholder-import.js +50 -20
- package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1 -1
- package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
- package/dist/{capabilities/dist/text/text-codegen.js → core/dist/capabilities/shared/rich-text-codegen.js} +23 -102
- package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
- package/dist/{capabilities/dist/shape → core/dist/capabilities/shared}/shape-declaration.js +14 -14
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +12 -5
- package/dist/{capabilities/dist/text → core/dist/capabilities/shared}/text-declaration.js +7 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-schemas.js +77 -77
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-service.js +571 -260
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +137 -112
- package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
- package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +5 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-xml.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +27 -33
- package/dist/core/dist/capabilities/table/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-codegen.js +6 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +22 -57
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-schemas.js +40 -37
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +9 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +60 -45
- package/dist/core/dist/capabilities/text/entry.js +3 -0
- package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
- package/dist/core/dist/capabilities/text/text-import.js +468 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +61 -54
- package/dist/core/dist/capabilities/transition/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
- package/dist/core/dist/capabilities/video/entry.js +77 -0
- package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
- package/dist/core/dist/capabilities/video/video-source.js +42 -0
- package/dist/{codegen/dist → core/dist/codegen}/assets.js +13 -8
- package/dist/{codegen/dist → core/dist/codegen}/codegen.js +54 -122
- package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +17 -1
- package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
- package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
- package/dist/core/dist/document/all.js +41 -0
- package/dist/core/dist/document/default.js +10 -0
- package/dist/core/dist/document/document.js +218 -0
- package/dist/core/dist/document/index.js +62 -0
- package/dist/core/dist/document/stages.js +54 -0
- package/dist/{emit/dist → core/dist/emit}/emit.js +122 -60
- package/dist/core/dist/emit/index.js +6 -0
- package/dist/core/dist/emit/ooxml.js +241 -0
- package/dist/{import/dist → core/dist/import}/import.js +221 -187
- package/dist/core/dist/import/index.js +19 -0
- package/dist/{import/dist → core/dist/import}/masters.js +253 -317
- package/dist/core/dist/import/media-timing.js +233 -0
- package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
- package/dist/core/dist/index.js +47 -15
- package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +1 -1
- package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +59 -98
- package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +109 -78
- package/dist/core/dist/kernel/build.js +4 -0
- package/dist/core/dist/kernel/capability.js +17 -0
- package/dist/{codegen/dist/types.js → core/dist/kernel/codegen.js} +22 -2
- package/dist/core/dist/kernel/container-slots.js +104 -0
- package/dist/core/dist/kernel/date-time-format.js +18 -0
- package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
- package/dist/core/dist/{declaration.js → kernel/declaration.js} +1 -1
- package/dist/core/dist/{diagnostics.js → kernel/diagnostics.js} +22 -5
- package/dist/core/dist/{document-internals.js → kernel/document-internals.js} +1 -1
- package/dist/core/dist/{document.js → kernel/document.js} +6 -5
- package/dist/core/dist/kernel/drawing-units.js +14 -0
- package/dist/core/dist/{font-seal.js → kernel/font-seal.js} +2 -2
- package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +2 -6
- package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +156 -55
- package/dist/core/dist/{host.js → kernel/host.js} +1 -1
- package/dist/core/dist/kernel/index.js +24 -0
- package/dist/core/dist/{input-values.js → kernel/input-values.js} +4 -3
- package/dist/core/dist/kernel/layout-definition.js +7 -0
- package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +1 -1
- package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +2 -6
- package/dist/core/dist/{layout.js → kernel/layout.js} +37 -38
- package/dist/core/dist/{masters.js → kernel/masters.js} +32 -55
- package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
- package/dist/core/dist/{placeholders.js → kernel/placeholders.js} +23 -9
- package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
- package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +1 -1
- package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +1 -1
- package/dist/core/dist/kernel/pptx-read/index.js +15 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
- package/dist/core/dist/kernel/pptx-read/media.js +26 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +5 -7
- package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
- package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +40 -5
- package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +94 -67
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-fragments.js +56 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
- package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
- package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
- package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +62 -274
- package/dist/core/dist/{query.js → kernel/query.js} +5 -1
- package/dist/core/dist/{resolution.js → kernel/resolution.js} +1 -1
- package/dist/core/dist/kernel/resolve-work.js +58 -0
- package/dist/core/dist/{resolve.js → kernel/resolve.js} +226 -257
- package/dist/core/dist/kernel/resource-source.js +11 -0
- package/dist/core/dist/{stage-options.js → kernel/stage-options.js} +23 -11
- package/dist/core/dist/{theme.js → kernel/theme.js} +54 -36
- package/dist/core/dist/{transform-geometry.js → kernel/transform-geometry.js} +1 -1
- package/dist/core/dist/kernel/xml-values.js +13 -0
- package/dist/{document-41spD7bq.d.ts → document-C0lPlH-L.d.ts} +614 -522
- package/dist/{capability-BbKW9w4O.d.ts → index-B9_OUeA-.d.ts} +660 -553
- package/dist/{index-BEwhk7c8.d.ts → index-BJEzQxWV.d.ts} +27 -24
- package/dist/{index-cK2KtukZ.d.ts → index-DA9flrlR.d.ts} +2 -17
- package/dist/{index-v77CTJev.d.ts → index-GSt0t9VO.d.ts} +3 -4
- package/dist/index.d.ts +7 -8
- package/dist/index.js +68 -66
- package/dist/node.d.ts +16 -14
- package/dist/node.js +86 -43
- package/dist/pptxdk/src/cli-commands.js +9 -5
- package/dist/pptxdk/src/compose.js +28 -29
- package/dist/pptxdk/src/preview-result.js +24 -0
- package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
- package/dist/preview/dist/index.js +84 -34
- package/dist/preview/dist/options.js +8 -4
- package/dist/preview/dist/raster.js +66 -0
- package/dist/preview/dist/svg-guard.js +8 -7
- package/dist/preview.d.ts +3 -9
- package/dist/preview.js +7 -25
- package/dist/react/dist/append.js +3 -3
- package/dist/react/dist/author/audio-elements.js +14 -0
- package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
- package/dist/react/dist/author/chart-elements.js +14 -0
- package/dist/react/dist/author/comment-elements.js +15 -0
- package/dist/react/dist/author/group-elements.js +14 -0
- package/dist/react/dist/author/image-elements.js +14 -0
- package/dist/react/dist/author/line-elements.js +14 -0
- package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
- package/dist/react/dist/author/notes-elements.js +14 -0
- package/dist/react/dist/author/placeholder-elements.js +14 -0
- package/dist/react/dist/author/shape-elements.js +14 -0
- package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
- package/dist/{capabilities/dist/text → react/dist/author}/text-elements.js +15 -5
- package/dist/react/dist/author/video-elements.js +14 -0
- package/dist/react/dist/document-adapter.js +4 -4
- package/dist/react/dist/elements.js +7 -4
- package/dist/react/dist/from-vanilla.js +3 -3
- package/dist/react/dist/index.js +17 -3
- package/dist/react/dist/reconciler.js +3 -3
- package/dist/react.d.ts +103 -69
- package/dist/react.js +28 -28
- package/dist/{index-1ag7U9Jt.d.ts → stages-DYHSHKt4.d.ts} +23 -6
- package/dist/vanilla.d.ts +4 -4
- package/dist/vanilla.js +14 -15
- package/package.json +2 -5
- package/dist/build-zrZuX4fK.d.ts +0 -3
- package/dist/capabilities/dist/all.js +0 -34
- package/dist/capabilities/dist/chart/chart-elements.js +0 -12
- package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
- package/dist/capabilities/dist/document.js +0 -168
- package/dist/capabilities/dist/group/group-elements.js +0 -12
- package/dist/capabilities/dist/image/image-codegen.js +0 -164
- package/dist/capabilities/dist/image/image-declaration.js +0 -8
- package/dist/capabilities/dist/image/image-elements.js +0 -12
- package/dist/capabilities/dist/image/image-xml.js +0 -12
- package/dist/capabilities/dist/image/image.js +0 -552
- package/dist/capabilities/dist/line/line-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-xml.js +0 -38
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -13
- package/dist/capabilities/dist/shape/shape-codegen.js +0 -236
- package/dist/capabilities/dist/shape/shape-elements.js +0 -12
- package/dist/capabilities/dist/shape/shape-import.js +0 -628
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
- package/dist/capabilities/dist/text/text-import.js +0 -1224
- package/dist/core/dist/build.js +0 -4
- package/dist/core/dist/capability.js +0 -15
- package/dist/emit/dist/index.js +0 -5
- package/dist/import/dist/index.js +0 -16
- package/dist/pptxdk/src/slide.js +0 -9
- package/dist/transition-6n8GZxSg.d.ts +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuildError, toBuildDiagnostic } from "./diagnostics.js";
|
|
2
2
|
import { expandedSpacing, resolvePercent } from "./layout-protocol.js";
|
|
3
|
-
// ../core/dist/grid-layout.js
|
|
3
|
+
// ../core/dist/kernel/grid-layout.js
|
|
4
4
|
const gridContainerProperties = [
|
|
5
5
|
"gridTemplateColumns",
|
|
6
6
|
"gridTemplateRows",
|
|
@@ -15,29 +15,29 @@ const gridItemProperties = [
|
|
|
15
15
|
function fail(path, code, message, details) {
|
|
16
16
|
throw new BuildError([toBuildDiagnostic(path, code, message, details)]);
|
|
17
17
|
}
|
|
18
|
-
function gridTokens(input, path) {
|
|
18
|
+
function gridTokens(input, path, field) {
|
|
19
19
|
const tokens = [];
|
|
20
20
|
let depth = 0;
|
|
21
21
|
let current = "";
|
|
22
22
|
for (const character of input.trim()) {
|
|
23
23
|
if (character === "(") depth += 1;
|
|
24
24
|
if (character === ")") depth -= 1;
|
|
25
|
-
if (depth < 0) fail(path, "invalid-grid-tracks", "Mismatched parentheses in grid tracks");
|
|
25
|
+
if (depth < 0) fail(path, "invalid-grid-tracks", "Mismatched parentheses in grid tracks", { field });
|
|
26
26
|
if (/\s/u.test(character) && depth === 0) {
|
|
27
27
|
if (current !== "") tokens.push(current);
|
|
28
28
|
current = "";
|
|
29
29
|
} else current += character;
|
|
30
30
|
}
|
|
31
|
-
if (depth !== 0) fail(path, "invalid-grid-tracks", "Mismatched parentheses in grid tracks");
|
|
31
|
+
if (depth !== 0) fail(path, "invalid-grid-tracks", "Mismatched parentheses in grid tracks", { field });
|
|
32
32
|
if (current !== "") tokens.push(current);
|
|
33
33
|
return tokens;
|
|
34
34
|
}
|
|
35
|
-
function parseGridPixels(token, path) {
|
|
35
|
+
function parseGridPixels(token, path, field) {
|
|
36
36
|
const match = /^(\d+(?:\.\d+)?)(?:px)?$/u.exec(token);
|
|
37
|
-
if (match === null) fail(path, "invalid-grid-tracks", `Unsupported grid track ${token}
|
|
37
|
+
if (match === null) fail(path, "invalid-grid-tracks", `Unsupported grid track ${token}`, { field });
|
|
38
38
|
return Number(match[1]);
|
|
39
39
|
}
|
|
40
|
-
function parseGridBasicTrack(token, path) {
|
|
40
|
+
function parseGridBasicTrack(token, path, field) {
|
|
41
41
|
if (token === "auto") return {
|
|
42
42
|
kind: "auto",
|
|
43
43
|
min: 0
|
|
@@ -45,7 +45,7 @@ function parseGridBasicTrack(token, path) {
|
|
|
45
45
|
const fraction = /^(\d+(?:\.\d+)?)fr$/u.exec(token);
|
|
46
46
|
if (fraction !== null) {
|
|
47
47
|
const value = Number(fraction[1]);
|
|
48
|
-
if (value <= 0) fail(path, "invalid-grid-tracks", "fr track fraction must be greater than 0");
|
|
48
|
+
if (value <= 0) fail(path, "invalid-grid-tracks", "fr track fraction must be greater than 0", { field });
|
|
49
49
|
return {
|
|
50
50
|
kind: "fr",
|
|
51
51
|
value,
|
|
@@ -54,10 +54,10 @@ function parseGridBasicTrack(token, path) {
|
|
|
54
54
|
}
|
|
55
55
|
return {
|
|
56
56
|
kind: "px",
|
|
57
|
-
value: parseGridPixels(token, path)
|
|
57
|
+
value: parseGridPixels(token, path, field)
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function gridTracks(input, path, defaultFr) {
|
|
60
|
+
function gridTracks(input, path, defaultFr, field) {
|
|
61
61
|
if (input === void 0 || input.trim() === "") return defaultFr ? [{
|
|
62
62
|
kind: "fr",
|
|
63
63
|
value: 1,
|
|
@@ -67,34 +67,37 @@ function gridTracks(input, path, defaultFr) {
|
|
|
67
67
|
const repeat = /^repeat\(\s*(\d+)\s*,\s*(.+)\)$/u.exec(token);
|
|
68
68
|
if (repeat !== null) {
|
|
69
69
|
const count = Number(repeat[1]);
|
|
70
|
-
if (!Number.isInteger(count) || count < 1 || count > 128) fail(path, "invalid-grid-tracks", "repeat count must be an integer between 1 and 128");
|
|
71
|
-
const repeated = gridTokens(repeat[2], path).flatMap(parseOne);
|
|
72
|
-
if (repeated.length * count > 128) fail(path, "invalid-grid-tracks", "Expanded grid tracks cannot exceed 128 tracks");
|
|
70
|
+
if (!Number.isInteger(count) || count < 1 || count > 128) fail(path, "invalid-grid-tracks", "repeat count must be an integer between 1 and 128", { field });
|
|
71
|
+
const repeated = gridTokens(repeat[2], path, field).flatMap(parseOne);
|
|
72
|
+
if (repeated.length * count > 128) fail(path, "invalid-grid-tracks", "Expanded grid tracks cannot exceed 128 tracks", { field });
|
|
73
73
|
return Array.from({ length: count }, () => repeated).flat();
|
|
74
74
|
}
|
|
75
75
|
const minmax = /^minmax\(\s*([^,]+?)\s*,\s*([^)]+?)\s*\)$/u.exec(token);
|
|
76
76
|
if (minmax !== null) {
|
|
77
77
|
const lower = minmax[1].trim();
|
|
78
|
-
const minValue = lower === "auto" ? 0 : parseGridPixels(lower, path);
|
|
79
|
-
const maximum = parseGridBasicTrack(minmax[2].trim(), path);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
const minValue = lower === "auto" ? 0 : parseGridPixels(lower, path, field);
|
|
79
|
+
const maximum = parseGridBasicTrack(minmax[2].trim(), path, field);
|
|
80
|
+
switch (maximum.kind) {
|
|
81
|
+
case "fr": return [{
|
|
82
|
+
...maximum,
|
|
83
|
+
min: Math.max(minValue, maximum.min),
|
|
84
|
+
contentMinimum: lower === "auto"
|
|
85
|
+
}];
|
|
86
|
+
case "auto": return [{
|
|
87
|
+
kind: "auto",
|
|
88
|
+
min: minValue
|
|
89
|
+
}];
|
|
90
|
+
case "px": return [{
|
|
91
|
+
kind: "px",
|
|
92
|
+
value: Math.max(minValue, maximum.value)
|
|
93
|
+
}];
|
|
94
|
+
default: return maximum;
|
|
95
|
+
}
|
|
93
96
|
}
|
|
94
|
-
return [parseGridBasicTrack(token, path)];
|
|
97
|
+
return [parseGridBasicTrack(token, path, field)];
|
|
95
98
|
};
|
|
96
|
-
const tracks = gridTokens(input, path).flatMap(parseOne);
|
|
97
|
-
if (tracks.length === 0 || tracks.length > 128) fail(path, "invalid-grid-tracks", "Grid tracks must contain between 1 and 128 tracks");
|
|
99
|
+
const tracks = gridTokens(input, path, field).flatMap(parseOne);
|
|
100
|
+
if (tracks.length === 0 || tracks.length > 128) fail(path, "invalid-grid-tracks", "Grid tracks must contain between 1 and 128 tracks", { field });
|
|
98
101
|
return tracks;
|
|
99
102
|
}
|
|
100
103
|
function gridAutoRowTracks(input, path) {
|
|
@@ -102,8 +105,8 @@ function gridAutoRowTracks(input, path) {
|
|
|
102
105
|
kind: "auto",
|
|
103
106
|
min: 0
|
|
104
107
|
}];
|
|
105
|
-
const tracks = gridTracks(input, path, false);
|
|
106
|
-
if (tracks.length === 0) fail(path, "invalid-grid-tracks", "gridAutoRows must contain at least 1 track");
|
|
108
|
+
const tracks = gridTracks(input, path, false, "style.gridAutoRows");
|
|
109
|
+
if (tracks.length === 0) fail(path, "invalid-grid-tracks", "gridAutoRows must contain at least 1 track", { field: "style.gridAutoRows" });
|
|
107
110
|
return tracks;
|
|
108
111
|
}
|
|
109
112
|
function rowTrackGrowsWithContent(track) {
|
|
@@ -186,11 +189,18 @@ function gridPlacement(value, path) {
|
|
|
186
189
|
};
|
|
187
190
|
return fail(path, "invalid-grid-placement", `Unsupported grid placement ${value}`);
|
|
188
191
|
}
|
|
192
|
+
const gridAlignments = {
|
|
193
|
+
auto: "start",
|
|
194
|
+
baseline: "start",
|
|
195
|
+
start: "start",
|
|
196
|
+
"flex-start": "start",
|
|
197
|
+
end: "end",
|
|
198
|
+
"flex-end": "end",
|
|
199
|
+
center: "center",
|
|
200
|
+
stretch: "stretch"
|
|
201
|
+
};
|
|
189
202
|
function gridAlignment(value) {
|
|
190
|
-
|
|
191
|
-
if (value === "end" || value === "flex-end") return "end";
|
|
192
|
-
if (value === "stretch") return "stretch";
|
|
193
|
-
return "start";
|
|
203
|
+
return gridAlignments[value ?? "start"];
|
|
194
204
|
}
|
|
195
205
|
function validateGridContainerStyle(value, resolvedDisplay, path) {
|
|
196
206
|
if (resolvedDisplay === "grid" && value["alignItems"] === "baseline") fail(path, "unsupported-grid-alignment", "Grid containers do not support baseline alignment");
|
|
@@ -258,9 +268,9 @@ function computeGridPlacements(node, explicitColumns) {
|
|
|
258
268
|
columns
|
|
259
269
|
};
|
|
260
270
|
}
|
|
261
|
-
function buildGridModel(node, innerWidth, innerHeight, port) {
|
|
262
|
-
const columnTracks = gridTracks(node.style.gridTemplateColumns, node.path, true);
|
|
263
|
-
const rowTracks = gridTracks(node.style.gridTemplateRows, node.path, false);
|
|
271
|
+
function buildGridModel(node, innerWidth, innerHeight, port, naturalHeightMap) {
|
|
272
|
+
const columnTracks = gridTracks(node.style.gridTemplateColumns, node.path, true, "style.gridTemplateColumns");
|
|
273
|
+
const rowTracks = gridTracks(node.style.gridTemplateRows, node.path, false, "style.gridTemplateRows");
|
|
264
274
|
const autoRowTracks = gridAutoRowTracks(node.style.gridAutoRows, node.path);
|
|
265
275
|
const { placements, columns } = computeGridPlacements(node, columnTracks);
|
|
266
276
|
const columnGap = node.style.columnGap ?? node.style.gap ?? 0;
|
|
@@ -286,6 +296,20 @@ function buildGridModel(node, innerWidth, innerHeight, port) {
|
|
|
286
296
|
}
|
|
287
297
|
if (innerWidth !== void 0) distributeFrTracks(columnWidths, columns, innerWidth, columnGap);
|
|
288
298
|
const spanWidth = (start, span) => columnWidths.slice(start, start + span).reduce((sum, width) => sum + width, 0) + columnGap * Math.max(0, span - 1);
|
|
299
|
+
const measureChildNaturalSize = (item, availableWidth) => {
|
|
300
|
+
const declaredHeight = item.style.height;
|
|
301
|
+
const isAutoHeight = declaredHeight === void 0 || declaredHeight === "auto";
|
|
302
|
+
if (isAutoHeight && item.style.display !== "grid") port.setChildConstraints(item, { height: "auto" });
|
|
303
|
+
const size = port.measureNaturalSize(item, availableWidth);
|
|
304
|
+
if (isAutoHeight && item.style.display === "grid") {
|
|
305
|
+
const naturalGridHeight = naturalHeightMap?.get(item);
|
|
306
|
+
if (naturalGridHeight !== void 0) return {
|
|
307
|
+
width: size.width,
|
|
308
|
+
height: naturalGridHeight
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return size;
|
|
312
|
+
};
|
|
289
313
|
const rowHeights = Array.from({ length: rowCount }, (_, index) => {
|
|
290
314
|
const track = rowTrackAt(index);
|
|
291
315
|
return track.kind === "px" ? track.value : track.min;
|
|
@@ -295,13 +319,13 @@ function buildGridModel(node, innerWidth, innerHeight, port) {
|
|
|
295
319
|
const track = rowTrackAt(placement.row);
|
|
296
320
|
if (!rowTrackGrowsWithContent(track)) continue;
|
|
297
321
|
const margin = expandedSpacing(placement.node.style, "margin");
|
|
298
|
-
const size =
|
|
322
|
+
const size = measureChildNaturalSize(placement.node, spanWidth(placement.column, placement.columnSpan));
|
|
299
323
|
rowHeights[placement.row] = Math.max(rowHeights[placement.row] ?? 0, track.min, size.height + margin.top + margin.bottom);
|
|
300
324
|
}
|
|
301
325
|
const spanHeight = (start, span) => rowHeights.slice(start, start + span).reduce((sum, height) => sum + height, 0) + rowGap * Math.max(0, span - 1);
|
|
302
326
|
for (const placement of placements) {
|
|
303
327
|
if (placement.rowSpan === 1) continue;
|
|
304
|
-
const natural =
|
|
328
|
+
const natural = measureChildNaturalSize(placement.node, spanWidth(placement.column, placement.columnSpan));
|
|
305
329
|
const margin = expandedSpacing(placement.node.style, "margin");
|
|
306
330
|
const missing = natural.height + margin.top + margin.bottom - spanHeight(placement.row, placement.rowSpan);
|
|
307
331
|
if (missing <= 0) continue;
|
|
@@ -309,24 +333,69 @@ function buildGridModel(node, innerWidth, innerHeight, port) {
|
|
|
309
333
|
if (growable.length === 0) continue;
|
|
310
334
|
for (const index of growable) rowHeights[index] = (rowHeights[index] ?? 0) + missing / growable.length;
|
|
311
335
|
}
|
|
312
|
-
|
|
313
|
-
const
|
|
336
|
+
const naturalHeight = rowCount === 0 ? 0 : rowHeights.reduce((sum, height) => sum + height, 0) + rowGap * Math.max(0, rowCount - 1);
|
|
337
|
+
const resolvedRowTracks = Array.from({ length: rowCount }, (_, index) => rowTrackAt(index));
|
|
338
|
+
if (innerHeight !== void 0) distributeFrTracks(rowHeights, resolvedRowTracks, innerHeight, rowGap);
|
|
339
|
+
const hasFrRow = resolvedRowTracks.some((track) => track.kind === "fr");
|
|
340
|
+
const alignContent = node.style.alignContent;
|
|
341
|
+
let remainingHeight = innerHeight !== void 0 && rowCount > 0 ? innerHeight - rowHeights.reduce((sum, height) => sum + height, 0) - rowGap * Math.max(0, rowCount - 1) : 0;
|
|
342
|
+
if (remainingHeight > 0 && !hasFrRow && (alignContent === void 0 || alignContent === "stretch")) {
|
|
343
|
+
const autoRowIndices = resolvedRowTracks.flatMap((track, index) => track.kind === "auto" ? [index] : []);
|
|
344
|
+
if (autoRowIndices.length > 0) {
|
|
345
|
+
const extraPerRow = remainingHeight / autoRowIndices.length;
|
|
346
|
+
for (const index of autoRowIndices) rowHeights[index] = (rowHeights[index] ?? 0) + extraPerRow;
|
|
347
|
+
remainingHeight = 0;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
let rowOffsetY = 0;
|
|
351
|
+
let extraRowGap = 0;
|
|
352
|
+
if (remainingHeight > 0) switch (alignContent) {
|
|
353
|
+
case "center":
|
|
354
|
+
rowOffsetY = remainingHeight / 2;
|
|
355
|
+
break;
|
|
356
|
+
case "end":
|
|
357
|
+
case "flex-end":
|
|
358
|
+
rowOffsetY = remainingHeight;
|
|
359
|
+
break;
|
|
360
|
+
case "space-between":
|
|
361
|
+
if (rowCount > 1) extraRowGap = remainingHeight / (rowCount - 1);
|
|
362
|
+
break;
|
|
363
|
+
case "space-around":
|
|
364
|
+
rowOffsetY = remainingHeight / (2 * rowCount);
|
|
365
|
+
extraRowGap = remainingHeight / rowCount;
|
|
366
|
+
break;
|
|
367
|
+
case "space-evenly":
|
|
368
|
+
rowOffsetY = remainingHeight / (rowCount + 1);
|
|
369
|
+
extraRowGap = remainingHeight / (rowCount + 1);
|
|
370
|
+
break;
|
|
371
|
+
case void 0:
|
|
372
|
+
case "stretch":
|
|
373
|
+
case "start":
|
|
374
|
+
case "flex-start": break;
|
|
375
|
+
default: throw new Error(`Unsupported grid alignContent: ${String(alignContent)}`);
|
|
376
|
+
}
|
|
377
|
+
const effectiveRowGap = rowGap + extraRowGap;
|
|
378
|
+
const spanHeightFinal = (start, span) => rowHeights.slice(start, start + span).reduce((sum, height) => sum + height, 0) + effectiveRowGap * Math.max(0, span - 1);
|
|
314
379
|
return {
|
|
315
380
|
placements,
|
|
316
381
|
widths: columnWidths,
|
|
317
382
|
heights: rowHeights,
|
|
318
383
|
columnGap,
|
|
319
|
-
rowGap,
|
|
384
|
+
rowGap: effectiveRowGap,
|
|
385
|
+
rowOffsetY,
|
|
320
386
|
spanWidth,
|
|
321
387
|
spanHeight: spanHeightFinal,
|
|
322
388
|
width: spanWidth(0, columnWidths.length),
|
|
323
|
-
height: rowCount === 0 ? 0 : spanHeightFinal(0, rowCount)
|
|
389
|
+
height: rowCount === 0 ? 0 : spanHeightFinal(0, rowCount),
|
|
390
|
+
naturalHeight
|
|
324
391
|
};
|
|
325
392
|
}
|
|
326
393
|
/**
|
|
327
394
|
* Creates the Grid container solver collaborating strictly through `LayoutSolverPort`.
|
|
328
395
|
*/
|
|
329
396
|
function createGridContainerSolver() {
|
|
397
|
+
const contentSizedHeightNodes = /* @__PURE__ */ new WeakSet();
|
|
398
|
+
const naturalHeightMap = /* @__PURE__ */ new WeakMap();
|
|
330
399
|
return {
|
|
331
400
|
handlesDisplay(display) {
|
|
332
401
|
return display === "grid";
|
|
@@ -339,16 +408,44 @@ function createGridContainerSolver() {
|
|
|
339
408
|
placeContainer(node, port) {
|
|
340
409
|
if (node.style.display !== "grid") return;
|
|
341
410
|
const padding = expandedSpacing(node.style, "padding");
|
|
411
|
+
const paddingY = padding.top + padding.bottom;
|
|
342
412
|
const computed = port.getComputedSize(node);
|
|
343
413
|
const outerWidth = computed.width;
|
|
344
|
-
const
|
|
414
|
+
const allocatedHeight = port.getAllocatedHeight(node);
|
|
415
|
+
const outerHeight = computed.height || allocatedHeight || 0;
|
|
345
416
|
const hasWidth = node.isRoot || node.style.width !== void 0 && node.style.width !== "auto";
|
|
346
|
-
const
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
417
|
+
const topOffset = node.style.top ?? node.style.inset;
|
|
418
|
+
const bottomOffset = node.style.bottom ?? node.style.inset;
|
|
419
|
+
const hasOppositeVerticalOffsets = node.style.position === "absolute" && topOffset !== void 0 && topOffset !== "auto" && bottomOffset !== void 0 && bottomOffset !== "auto";
|
|
420
|
+
const isPercentHeight = typeof node.style.height === "string" && node.style.height.endsWith("%");
|
|
421
|
+
const hasExplicitDefiniteHeight = node.isRoot || node.style.height !== void 0 && node.style.height !== "auto" && (!isPercentHeight || !contentSizedHeightNodes.has(node) && computed.height > paddingY) || hasOppositeVerticalOffsets && outerHeight > 0;
|
|
422
|
+
const hasAllocatedDefiniteHeight = allocatedHeight !== void 0;
|
|
423
|
+
const flexHeightRole = port.participatesInParentFlexHeight(node);
|
|
424
|
+
const hasFlexDefiniteHeight = !hasExplicitDefiniteHeight && !hasAllocatedDefiniteHeight && !contentSizedHeightNodes.has(node) && computed.height > paddingY;
|
|
425
|
+
const hasDefiniteHeight = hasExplicitDefiniteHeight || hasAllocatedDefiniteHeight || hasFlexDefiniteHeight;
|
|
426
|
+
if (!hasDefiniteHeight && flexHeightRole === false) contentSizedHeightNodes.add(node);
|
|
427
|
+
const model = buildGridModel(node, outerWidth > 0 ? Math.max(0, outerWidth - padding.left - padding.right) : void 0, hasDefiniteHeight ? Math.max(0, outerHeight - paddingY) : void 0, port, naturalHeightMap);
|
|
428
|
+
let naturalOuterHeight = model.naturalHeight + paddingY;
|
|
429
|
+
if (typeof node.style.maxHeight === "number") naturalOuterHeight = Math.min(naturalOuterHeight, node.style.maxHeight);
|
|
430
|
+
if (typeof node.style.minHeight === "number") naturalOuterHeight = Math.max(naturalOuterHeight, node.style.minHeight);
|
|
431
|
+
naturalHeightMap.set(node, naturalOuterHeight);
|
|
432
|
+
if (!hasWidth && outerWidth <= 0) port.setContainerSize(node, { width: model.width + padding.left + padding.right });
|
|
433
|
+
if (!hasDefiniteHeight) {
|
|
434
|
+
if (flexHeightRole === false) port.setContainerSize(node, { height: model.height + paddingY });
|
|
435
|
+
else {
|
|
436
|
+
const minHeight = flexHeightRole === "cross-stretch" && !port.hasDefiniteParentHeight(node) ? typeof node.style.minHeight === "number" ? Math.max(node.style.minHeight, naturalOuterHeight) : naturalOuterHeight : void 0;
|
|
437
|
+
port.setChildConstraints(node, {
|
|
438
|
+
height: "auto",
|
|
439
|
+
...minHeight === void 0 ? {} : { minHeight }
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
} else if (flexHeightRole === "cross-stretch" && !hasExplicitDefiniteHeight && !hasAllocatedDefiniteHeight && !port.hasDefiniteParentHeight(node)) {
|
|
443
|
+
const minHeight = typeof node.style.minHeight === "number" ? Math.max(node.style.minHeight, naturalOuterHeight) : naturalOuterHeight;
|
|
444
|
+
port.setChildConstraints(node, {
|
|
445
|
+
height: "auto",
|
|
446
|
+
minHeight
|
|
447
|
+
});
|
|
448
|
+
}
|
|
352
449
|
port.setGridTracks?.(node, {
|
|
353
450
|
columnWidths: [...model.widths],
|
|
354
451
|
rowHeights: [...model.heights]
|
|
@@ -359,7 +456,7 @@ function createGridContainerSolver() {
|
|
|
359
456
|
const cellWidth = model.spanWidth(placement.column, placement.columnSpan);
|
|
360
457
|
const cellHeight = model.spanHeight(placement.row, placement.rowSpan);
|
|
361
458
|
const cellX = padding.left + model.spanWidth(0, placement.column) + (placement.column > 0 ? model.columnGap : 0);
|
|
362
|
-
const cellY = padding.top + model.spanHeight(0, placement.row) + (placement.row > 0 ? model.rowGap : 0);
|
|
459
|
+
const cellY = padding.top + model.rowOffsetY + model.spanHeight(0, placement.row) + (placement.row > 0 ? model.rowGap : 0);
|
|
363
460
|
port.setGridCellArea?.(child, {
|
|
364
461
|
x: cellX,
|
|
365
462
|
y: cellY,
|
|
@@ -411,7 +508,10 @@ function createGridContainerSolver() {
|
|
|
411
508
|
width: Math.max(0, usedWidth),
|
|
412
509
|
height: Math.max(0, usedHeight)
|
|
413
510
|
});
|
|
414
|
-
|
|
511
|
+
const childPadding = expandedSpacing(childStyle, "padding");
|
|
512
|
+
const childPaddingY = childPadding.top + childPadding.bottom;
|
|
513
|
+
const canAllocateGridHeight = childStyle.display !== "grid" || naturalHeightMap.has(child) || height > childPaddingY;
|
|
514
|
+
if (child.isContainer && !heightSpecified && align === "stretch" && childStyle.aspectRatio === void 0 && canAllocateGridHeight) port.setAllocatedHeight(child, height);
|
|
415
515
|
const xAlign = justify === "center" ? Math.max(0, (availableWidth - usedWidth) / 2) : justify === "end" ? Math.max(0, availableWidth - usedWidth) : 0;
|
|
416
516
|
const yAlign = align === "center" ? Math.max(0, (availableHeight - usedHeight) / 2) : align === "end" ? Math.max(0, availableHeight - usedHeight) : 0;
|
|
417
517
|
const relative = (start, end, basis) => {
|
|
@@ -437,6 +537,7 @@ const gridLayoutMode = {
|
|
|
437
537
|
itemStyleKeys: gridItemProperties,
|
|
438
538
|
sharedContainerProperties: [
|
|
439
539
|
"alignItems",
|
|
540
|
+
"alignContent",
|
|
440
541
|
"gap",
|
|
441
542
|
"rowGap",
|
|
442
543
|
"columnGap"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { validateAuthorIdScopes } from "./author-ids.js";
|
|
2
2
|
import { insertDeclarationChild as insertDeclarationChild$1, removeDeclarationChild as removeDeclarationChild$1, replaceDeclarationProps as replaceDeclarationProps$1, setDeclarationText as setDeclarationText$1 } from "./document-internals.js";
|
|
3
|
-
// ../core/dist/host.js
|
|
3
|
+
// ../core/dist/kernel/host.js
|
|
4
4
|
/**
|
|
5
5
|
* Internal React host prop carrying the editable-node creator for one declaration type.
|
|
6
6
|
*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "./document-internals.js";
|
|
2
|
+
import "./date-time-format.js";
|
|
3
|
+
import { externalResourceSourceSchema, resourceSourceSchema } from "./resource-source.js";
|
|
4
|
+
import { authorIdSchema, validateAuthorIdScopes } from "./author-ids.js";
|
|
5
|
+
import { isSlideLayoutDefinition } from "./layout-definition.js";
|
|
6
|
+
import { backgroundRefSchema, linkTargetSchema, sectionPropsSchema, slideBackgroundSchema, slideDateTimeValueSchema, slideFooterValueSchema, slideNumberValueSchema } from "./author-schemas.js";
|
|
7
|
+
import { BuildError, CapabilityError, toBuildDiagnostic } from "./diagnostics.js";
|
|
8
|
+
import { bytesSha256, isImmutableBytes, markImmutableBytes } from "./font-seal.js";
|
|
9
|
+
import { createMorphScope, isMorphKey } from "./morph.js";
|
|
10
|
+
import { geometrySchema } from "./geometry-schemas.js";
|
|
11
|
+
import { layoutLengthSchema, layoutSpacingSchema, layoutStyleSchema, paddingStyleSchema } from "./layout-schemas.js";
|
|
12
|
+
import { AuthorQuery, AuthorQueryError, CommonContainer, CommonNode, DeckContainer, RichTextContainer, SlideContainer, SlideLayoutContainer, SlideMasterContainer, createDeckNode, createSectionNode, createSlideLayoutNode, createSlideMasterNode, createSlideNode } from "./document.js";
|
|
13
|
+
import { dateTimeFooterPlaceholderSpecSchema, footerPlaceholderSpecSchema, footerPlaceholdersSchema, headerFooterSchema, resolvedMasterSchema, resolvedPlaceholderSchema, resolvedSlideLayoutSchema, slideLayoutTypeSchema, slideLayoutTypeValues } from "./masters.js";
|
|
14
|
+
import { allocatePlaceholderAuthorKeys, contentPlaceholderRoles, layoutPlaceholderSpecSchema, masterPlaceholderSpecSchema, masterTextStyleCategoryForRole, masterTextStylesSchema, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, placeholderLevelStyleSchema, placeholderOrientSchema, placeholderRoleSchema, placeholderSizeSchema, placeholderStyleSchema } from "./placeholders.js";
|
|
15
|
+
import { assertValidLang, backgroundValueSchema, borderObjectSchema, borderStyleSchema, borderValueSchema, boxShadowValueSchema, colorMapOverrideSchema, colorMapSchema, darker, defaultColorMap, defaultTheme, defineTheme, formatSchemeSchema, imageBackgroundFitSchema, imageBackgroundPositionKeywordSchema, imageBackgroundPositionSchema, imageBackgroundSchema, isNativeColorSlot, isSchemeColorName, isSchemeColorSlot, isTheme, isThemeFontSlot, lighter, linearGradientSchema, nativeColorSlots, radialGradientSchema, schemeColorNameSchema, schemeColorNames, schemeColorSlots, textStyleSchema, themeDataSchema, themeFontSlotSchema, themeFontSlots, themeInputSchema, themeOverrideSchema, themeSchema } from "./theme.js";
|
|
16
|
+
import "./layout.js";
|
|
17
|
+
import "./block-flex-layout.js";
|
|
18
|
+
import { PreviewPageRangeError, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, buildOptionsShape, emitOptionsSchema, extensionSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, previewErrorOptionSchemas, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, resolveOptionsShape, targetNameSchema, targetSchema, targets } from "./stage-options.js";
|
|
19
|
+
import { BuildQueryError } from "./query.js";
|
|
20
|
+
import { validateResolveOptions } from "./resolve.js";
|
|
21
|
+
import { captureDeclaration, isCapturedDeclaration } from "./declaration-snapshot.js";
|
|
22
|
+
import { HostTextNode, hostNodeCreator, insertDeclarationChild, removeDeclarationChild, replaceDeclarationProps, setDeclarationText } from "./host.js";
|
|
23
|
+
import { getInternalResolution } from "./resolution.js";
|
|
24
|
+
export { AuthorQuery, AuthorQueryError, BuildError, BuildQueryError, CapabilityError, CommonContainer, CommonNode, DeckContainer, HostTextNode, PreviewPageRangeError, RichTextContainer, SlideContainer, SlideLayoutContainer, SlideMasterContainer, allocatePlaceholderAuthorKeys, assertValidLang, authorIdSchema, backgroundRefSchema, backgroundValueSchema, borderObjectSchema, borderStyleSchema, borderValueSchema, boxShadowValueSchema, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, buildOptionsShape, bytesSha256, captureDeclaration, colorMapOverrideSchema, colorMapSchema, contentPlaceholderRoles, createDeckNode, createMorphScope, createSectionNode, createSlideLayoutNode, createSlideMasterNode, createSlideNode, darker, dateTimeFooterPlaceholderSpecSchema, defaultColorMap, defaultTheme, defineTheme, emitOptionsSchema, extensionSchema, externalResourceSourceSchema, fontEmbeddingModeSchema, footerPlaceholderSpecSchema, footerPlaceholdersSchema, formatBaseline, formatBaselineSchema, formatSchemeSchema, geometrySchema, getInternalResolution, headerFooterSchema, hostNodeCreator, imageBackgroundFitSchema, imageBackgroundPositionKeywordSchema, imageBackgroundPositionSchema, imageBackgroundSchema, insertDeclarationChild, isCapturedDeclaration, isImmutableBytes, isMorphKey, isNativeColorSlot, isSchemeColorName, isSchemeColorSlot, isSlideLayoutDefinition, isTheme, isThemeFontSlot, layoutLengthSchema, layoutPlaceholderSpecSchema, layoutSpacingSchema, layoutStyleSchema, lighter, linearGradientSchema, linkTargetSchema, markImmutableBytes, masterPlaceholderSpecSchema, masterTextStyleCategoryForRole, masterTextStylesSchema, matchLayoutPlaceholderKey, matchMasterPlaceholderSpec, nativeColorSlots, paddingStyleSchema, placeholderLevelStyleSchema, placeholderOrientSchema, placeholderRoleSchema, placeholderSizeSchema, placeholderStyleSchema, previewErrorOptionSchemas, previewErrorSchema, previewPlaceholderSchema, radialGradientSchema, removeDeclarationChild, replaceDeclarationProps, resolveOptionsSchema, resolveOptionsShape, resolvedMasterSchema, resolvedPlaceholderSchema, resolvedSlideLayoutSchema, resourceSourceSchema, schemeColorNameSchema, schemeColorNames, schemeColorSlots, sectionPropsSchema, setDeclarationText, slideBackgroundSchema, slideDateTimeValueSchema, slideFooterValueSchema, slideLayoutTypeSchema, slideLayoutTypeValues, slideNumberValueSchema, targetNameSchema, targetSchema, targets, textStyleSchema, themeDataSchema, themeFontSlotSchema, themeFontSlots, themeInputSchema, themeOverrideSchema, themeSchema, toBuildDiagnostic, validateAuthorIdScopes, validateResolveOptions };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { replaceDeclarationProps } from "./document-internals.js";
|
|
2
2
|
import { isImmutableBytes, isSealedFont, markImmutableBytes } from "./font-seal.js";
|
|
3
3
|
import { isMorphKey } from "./morph.js";
|
|
4
|
-
// ../core/dist/input-values.js
|
|
4
|
+
// ../core/dist/kernel/input-values.js
|
|
5
5
|
const slideLayoutDefinitionSymbol = Symbol.for("@pptxdk/core/slide-layout-definition");
|
|
6
|
-
const themeBrandSymbol = Symbol.for("
|
|
6
|
+
const themeBrandSymbol = Symbol.for("#/kernel/theme.ts");
|
|
7
7
|
function isRecord(value) {
|
|
8
8
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9
9
|
}
|
|
@@ -23,6 +23,7 @@ function copyValue(value, cloneImmutableBytes) {
|
|
|
23
23
|
return cloneImmutableBytes ? copy : markImmutableBytes(copy);
|
|
24
24
|
}
|
|
25
25
|
if (value instanceof ArrayBuffer) return value.slice(0);
|
|
26
|
+
if (value instanceof Date) return new Date(value.getTime());
|
|
26
27
|
if (value instanceof URL) return new URL(value.href);
|
|
27
28
|
if (Array.isArray(value)) return Object.freeze(value.map((item) => copyValue(item, cloneImmutableBytes)));
|
|
28
29
|
if (preservesIdentity(value)) return value;
|
|
@@ -43,7 +44,7 @@ function copyValue(value, cloneImmutableBytes) {
|
|
|
43
44
|
/**
|
|
44
45
|
* Copies author-owned values received by a declaration entry.
|
|
45
46
|
*
|
|
46
|
-
* Record values, arrays, URLs, and byte views are isolated recursively. Enumerable getters are read
|
|
47
|
+
* Record values, arrays, dates, URLs, and byte views are isolated recursively. Enumerable getters are read
|
|
47
48
|
* at receipt, while behavior handles, sealed fonts, already-immutable bytes, and opaque objects
|
|
48
49
|
* keep their identity. This is a field-level authoring rule, not a general document clone.
|
|
49
50
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// ../core/dist/kernel/layout-definition.js
|
|
2
|
+
const slideLayoutDefinitionSymbol = Symbol.for("@pptxdk/core/slide-layout-definition");
|
|
3
|
+
/** Checks whether a runtime value was produced by `defineSlideLayout`. */
|
|
4
|
+
function isSlideLayoutDefinition(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && slideLayoutDefinitionSymbol in value;
|
|
6
|
+
}
|
|
7
|
+
export { isSlideLayoutDefinition, slideLayoutDefinitionSymbol };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildError, toBuildDiagnostic } from "./diagnostics.js";
|
|
2
|
-
// ../core/dist/layout-protocol.js
|
|
2
|
+
// ../core/dist/kernel/layout-protocol.js
|
|
3
3
|
function failLayoutProtocol(path, code, message, field) {
|
|
4
4
|
throw new BuildError([toBuildDiagnostic(path, code, message, field === void 0 ? void 0 : { field })]);
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuildError } from "./diagnostics.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
// ../core/dist/layout-schemas.js
|
|
3
|
+
// ../core/dist/kernel/layout-schemas.js
|
|
4
4
|
const percentPattern = /^(-?(?:\d+(?:\.\d*)?|\.\d+))%$/u;
|
|
5
5
|
const nonNegativePercentPattern = /^(\d+(?:\.\d*)?|\.\d+)%$/u;
|
|
6
6
|
const percentLengthSchema = z.string().regex(percentPattern, "must be a pixel number, percentage, or auto");
|
|
@@ -143,11 +143,7 @@ const layoutStyleObjectSchema = z.strictObject({
|
|
|
143
143
|
marginRight: z.number().finite().optional(),
|
|
144
144
|
marginBottom: z.number().finite().optional(),
|
|
145
145
|
marginLeft: z.number().finite().optional(),
|
|
146
|
-
|
|
147
|
-
paddingTop: z.number().finite().nonnegative().optional(),
|
|
148
|
-
paddingRight: z.number().finite().nonnegative().optional(),
|
|
149
|
-
paddingBottom: z.number().finite().nonnegative().optional(),
|
|
150
|
-
paddingLeft: z.number().finite().nonnegative().optional(),
|
|
146
|
+
...paddingStyleShape,
|
|
151
147
|
gap: z.number().finite().nonnegative().optional(),
|
|
152
148
|
rowGap: z.number().finite().nonnegative().optional(),
|
|
153
149
|
columnGap: z.number().finite().nonnegative().optional(),
|