@homepages/concrete 11.0.0 → 13.0.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/CHANGELOG.md +203 -0
- package/README.md +8 -10
- package/codemods/fixtures-are-data.mjs +7 -0
- package/codemods/fixtures-list-properties.mjs +6 -0
- package/codemods/manifest.json +17 -0
- package/codemods/steps/fixtures-list-properties.mjs +16 -0
- package/codemods/steps/fixtures-to-data.mjs +41 -0
- package/dist/artifact/playground/client/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
- package/dist/artifact/playground/client/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
- package/dist/artifact/playground/client/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
- package/dist/artifact/playground/client/assets/index-Bmvcss4B.js +1338 -0
- package/dist/artifact/playground/client/assets/index-C01UCAWD.css +1 -0
- package/dist/artifact/playground/client/index.html +2 -2
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
- package/dist/artifact/playground/host.mjs +110 -60
- package/dist/base.css +19 -59
- package/dist/cli/build/icons.js +1 -1
- package/dist/cli/build/index.js +11 -10
- package/dist/cli/build/manifest.js +44 -0
- package/dist/cli/build/record.js +123 -0
- package/dist/cli/build/sections.js +28 -18
- package/dist/cli/build/source.js +1 -1
- package/dist/cli/build/static.js +8 -5
- package/dist/cli/build/template-build.js +614 -0
- package/dist/cli/check/analyze.js +18 -1
- package/dist/cli/check/load-workspace.js +2 -2
- package/dist/cli/check/portable-names.js +1 -1
- package/dist/cli/check/render/corpus.js +119 -0
- package/dist/cli/check/render/invariants.js +1 -0
- package/dist/cli/check/stages/bundles.js +15 -18
- package/dist/cli/check/stages/composition.js +8 -25
- package/dist/cli/check/stages/fixtures.js +14 -10
- package/dist/cli/check/stages/logic.js +7 -23
- package/dist/cli/check/stages/render.js +12 -14
- package/dist/cli/check/stages/sections.js +22 -66
- package/dist/cli/check/stages/stylesheet.js +4 -26
- package/dist/cli/check/stages/workspace.js +27 -22
- package/dist/cli/commands.js +51 -23
- package/dist/cli/currency/preamble.js +1 -1
- package/dist/cli/currency/resolve-latest.js +3 -2
- package/dist/cli/dev/capture-browser.js +26 -0
- package/dist/cli/dev/fixture-schema.js +441 -0
- package/dist/cli/dev/folder-files.js +244 -0
- package/dist/cli/dev/index.js +7 -3
- package/dist/cli/dev/playground-server.js +34 -0
- package/dist/cli/dev/section-ladders.js +76 -0
- package/dist/cli/dev/server.js +120 -304
- package/dist/cli/install/background.js +16 -0
- package/dist/cli/install/index.js +45 -0
- package/dist/cli/install/tools.js +27 -0
- package/dist/cli/media/derive.js +19 -13
- package/dist/cli/media/deriver-plugin.js +14 -3
- package/dist/cli/property/fixture-list.js +46 -0
- package/dist/cli/property/index.js +12 -9
- package/dist/cli/property/library.js +12 -10
- package/dist/cli/publish/artifact.js +90 -0
- package/dist/cli/publish/captures.js +61 -0
- package/dist/cli/publish/fixtures.js +17 -0
- package/dist/cli/publish/index.js +10 -18
- package/dist/cli/{build → publish}/playground.js +3 -3
- package/dist/cli/publish/report.js +15 -33
- package/dist/cli/upgrade/codemod.d.ts +14 -0
- package/dist/cli/upgrade/fixture-conversion.d.ts +11 -0
- package/dist/cli/upgrade/fixture-conversion.js +54 -0
- package/dist/cli/upgrade/fixture-modules.js +125 -0
- package/dist/cli/upgrade/fixtures-to-data.d.ts +40 -0
- package/dist/cli/upgrade/fixtures-to-data.js +498 -0
- package/dist/cli/upgrade/index.js +18 -2
- package/dist/cli/upgrade/legacy-fixtures.d.ts +34 -0
- package/dist/cli/upgrade/legacy-fixtures.js +22 -0
- package/dist/cli/upgrade/stage.js +1 -1
- package/dist/cli/workspace-fixtures.js +80 -0
- package/dist/cli.js +1 -0
- package/dist/css/compile.js +9 -3
- package/dist/fixtures/bundle-rule.js +16 -16
- package/dist/fixtures/media-plugin.js +12 -33
- package/dist/fixtures/synthesize-empties.js +3 -2
- package/dist/index.d.ts +7 -7
- package/dist/{playground-island-runtime.d.ts → island-runtime.d.ts} +1 -2
- package/dist/{playground-island-runtime.js → island-runtime.js} +1 -2
- package/dist/islands/client-module.js +1 -1
- package/dist/{cli/dev → islands}/tsconfig-paths.js +2 -14
- package/dist/islands/wrap.js +40 -0
- package/dist/node_modules/.pnpm/acorn@8.18.0/node_modules/acorn/dist/acorn.js +5119 -0
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/bundle-evaluation/dist/cache.js +36 -0
- package/dist/packages/internal/bundle-evaluation/dist/evaluate.js +174 -0
- package/dist/packages/internal/bundle-evaluation/dist/index.js +5 -0
- package/dist/packages/internal/bundle-evaluation/dist/section-code.js +10 -0
- package/dist/packages/internal/capture-settle/dist/index.js +2 -2
- package/dist/packages/internal/capture-settle/dist/settle.js +88 -13
- package/dist/packages/internal/code-fingerprint/dist/index.js +57 -0
- package/dist/packages/internal/content-doc-ops/dist/index.js +176 -0
- package/dist/packages/internal/content-doc-ops/dist/made-rows.js +15 -0
- package/dist/packages/internal/deliverable-reads/dist/bootstrap.js +81 -0
- package/dist/packages/internal/deliverable-reads/dist/display.js +21 -0
- package/dist/packages/internal/deliverable-reads/dist/format.js +15 -0
- package/dist/packages/internal/deliverable-reads/dist/index.js +7 -0
- package/dist/packages/internal/deliverable-reads/dist/pages.js +29 -0
- package/dist/packages/internal/deliverable-reads/dist/requirements.js +72 -0
- package/dist/{cli/capture → packages/internal/download-files/dist}/bundle.js +8 -4
- package/dist/packages/internal/download-files/dist/capture-origin.js +126 -0
- package/dist/packages/internal/download-files/dist/capture-routes.js +139 -0
- package/dist/packages/internal/download-files/dist/capture-shell.js +38 -0
- package/dist/packages/internal/download-files/dist/capture.js +74 -0
- package/dist/packages/internal/download-files/dist/egress-watch.js +38 -0
- package/dist/packages/internal/download-files/dist/files.js +7 -0
- package/dist/packages/internal/download-files/dist/finish.js +35 -0
- package/dist/packages/internal/download-files/dist/fleet.js +94 -0
- package/dist/packages/internal/download-files/dist/format.js +40 -0
- package/dist/packages/internal/download-files/dist/make.js +105 -0
- package/dist/packages/internal/download-files/dist/master-tally.js +32 -0
- package/dist/packages/internal/download-files/dist/names.js +24 -0
- package/dist/packages/internal/download-files/dist/pdf-boxes.js +33 -0
- package/dist/packages/internal/download-files/dist/pdf-image-placements.js +194 -0
- package/dist/packages/internal/download-files/dist/pdf-images.js +289 -0
- package/dist/packages/internal/file-store/dist/files.js +8 -0
- package/dist/packages/internal/file-store/dist/lru.js +40 -0
- package/dist/packages/internal/file-store/dist/refusal.js +12 -0
- package/dist/packages/internal/file-store/dist/trees.js +151 -0
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +48 -22
- package/dist/packages/internal/fill-bake/dist/held-rows.js +2 -0
- package/dist/packages/internal/fill-bake/dist/index.js +6 -1
- package/dist/packages/internal/fill-bake/dist/item-merge.js +4 -3
- package/dist/packages/internal/fill-bake/dist/resolve-instance.js +9 -0
- package/dist/packages/internal/fill-bake/dist/resolve.js +3 -0
- package/dist/packages/internal/fill-bake/dist/round-trip.js +2 -0
- package/dist/packages/internal/fill-bake/dist/strip.js +6 -0
- package/dist/packages/internal/fill-vocabulary/dist/holder.js +1 -1
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
- package/dist/packages/internal/fill-vocabulary/dist/verbs.js +1 -1
- package/dist/packages/internal/format-geometry/dist/capture.js +3 -11
- package/dist/packages/internal/format-geometry/dist/format.d.ts +2 -8
- package/dist/packages/internal/format-geometry/dist/geometry.js +2 -13
- package/dist/packages/internal/island-runtime/dist/index.js +1 -10
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +5 -0
- package/dist/packages/internal/lead-fields/dist/ingest.js +72 -0
- package/dist/packages/internal/media-resolution/dist/video.js +6 -2
- package/dist/packages/internal/page-render/dist/addresses.js +57 -0
- package/dist/packages/internal/page-render/dist/index.js +6 -0
- package/dist/packages/internal/page-render/dist/kept.js +30 -0
- package/dist/packages/internal/page-render/dist/nav.js +42 -0
- package/dist/packages/internal/page-render/dist/render.js +152 -0
- package/dist/packages/internal/page-shell/dist/assemble.js +161 -0
- package/dist/packages/internal/page-shell/dist/escape.js +10 -0
- package/dist/packages/internal/page-shell/dist/frame.js +23 -0
- package/dist/packages/internal/page-shell/dist/index.js +26 -0
- package/dist/packages/internal/playground/dist/build-fingerprint.js +18 -0
- package/dist/packages/internal/playground/dist/fixture-conversions/list-names-properties.js +76 -0
- package/dist/packages/internal/playground/dist/fixture-formats.d.ts +37 -0
- package/dist/packages/internal/playground/dist/fixture-formats.js +20 -0
- package/dist/packages/internal/playground/dist/host/bootstrap.js +108 -0
- package/dist/packages/internal/playground/dist/host/built.js +202 -0
- package/dist/packages/internal/playground/dist/host/catalog-fixture.js +53 -0
- package/dist/packages/internal/playground/dist/host/download.js +34 -0
- package/dist/packages/internal/playground/dist/host/env.js +11 -0
- package/dist/packages/internal/playground/dist/host/everywhere-saves.js +353 -0
- package/dist/packages/internal/playground/dist/host/fixture-addresses.js +52 -0
- package/dist/packages/internal/playground/dist/host/fixture-documents.js +494 -0
- package/dist/packages/internal/playground/dist/host/fixture-operations.js +364 -0
- package/dist/packages/internal/playground/dist/host/fixture-units.js +93 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/image-dimensions.js +1 -1
- package/dist/packages/internal/playground/dist/host/leads.js +41 -0
- package/dist/packages/internal/playground/dist/host/media-saves.js +309 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/media-store.js +79 -26
- package/dist/packages/internal/playground/dist/host/overridable.js +9 -0
- package/dist/packages/internal/playground/dist/host/owned-saves.js +203 -0
- package/dist/{playground → packages/internal/playground/dist}/host/page-state.js +1 -1
- package/dist/packages/internal/playground/dist/host/program.js +54 -0
- package/dist/packages/internal/playground/dist/host/property-derive.js +216 -0
- package/dist/packages/internal/playground/dist/host/property-saves.js +74 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/property.js +88 -229
- package/dist/packages/internal/playground/dist/host/provenance.js +49 -0
- package/dist/packages/internal/playground/dist/host/resolve.js +553 -0
- package/dist/packages/internal/playground/dist/host/row-images.js +41 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/rows.js +1 -1
- package/dist/packages/internal/playground/dist/host/save.js +429 -0
- package/dist/packages/internal/playground/dist/host/serve.js +952 -0
- package/dist/packages/internal/playground/dist/host/site.js +79 -0
- package/dist/packages/internal/playground/dist/host/slots.js +202 -0
- package/dist/packages/internal/playground/dist/host/stated-content.js +93 -0
- package/dist/packages/internal/playground/dist/host/stored-fixtures.js +135 -0
- package/dist/packages/internal/playground/dist/host/violations.js +7 -0
- package/dist/packages/internal/playground/dist/jobs/lanes.js +24 -0
- package/dist/packages/internal/playground/dist/jobs/memory-queue.js +112 -0
- package/dist/packages/internal/playground/dist/jobs/probe.js +37 -0
- package/dist/packages/internal/playground/dist/jobs/queue.js +28 -0
- package/dist/packages/internal/playground/dist/jobs/runner.js +207 -0
- package/dist/packages/internal/playground/dist/layout.js +14 -0
- package/dist/packages/internal/playground/dist/platform.js +33 -0
- package/dist/packages/internal/playground/dist/server/changes.js +57 -0
- package/dist/packages/internal/playground/dist/server/crop.js +47 -0
- package/dist/packages/internal/playground/dist/server/derived-files.js +88 -0
- package/dist/packages/internal/playground/dist/server/download.js +158 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/http.js +4 -12
- package/dist/packages/internal/playground/dist/server/jobs.js +29 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/listen.js +4 -11
- package/dist/packages/internal/playground/dist/server/playground-server.js +424 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/request-error.js +1 -1
- package/dist/packages/internal/playground/dist/server/size-ladders.js +170 -0
- package/dist/packages/internal/playground/dist/server/verification.js +75 -0
- package/dist/packages/internal/playground/dist/server/verify-build.js +139 -0
- package/dist/packages/internal/playground/dist/wire.js +78 -0
- package/dist/packages/internal/property-facts/dist/registry-facts.js +1 -1
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
- package/dist/packages/internal/site-files/dist/head.js +59 -0
- package/dist/packages/internal/site-files/dist/index.js +4 -0
- package/dist/packages/internal/site-files/dist/site.js +211 -0
- package/dist/packages/internal/static-assets-binding/dist/index.js +32 -0
- package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +38 -5
- package/dist/packages/internal/template-artifact/dist/asset-mime.js +8 -1
- package/dist/packages/internal/template-artifact/dist/build.js +148 -0
- package/dist/packages/internal/template-artifact/dist/composition.js +62 -0
- package/dist/packages/internal/template-artifact/dist/index.js +2 -2
- package/dist/packages/internal/template-artifact/dist/layout.js +48 -12
- package/dist/packages/internal/template-artifact/dist/manifest.js +3 -10
- package/dist/packages/internal/template-artifact/dist/verify.js +51 -31
- package/dist/packages/internal/template-contracts/dist/address-value.js +6 -1
- package/dist/packages/internal/template-contracts/dist/content-categories.js +10 -1
- package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +59 -32
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +14 -1
- package/dist/packages/internal/template-contracts/dist/list.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/media-candidates.js +67 -2
- package/dist/packages/internal/template-contracts/dist/media-offer.js +180 -0
- package/dist/packages/internal/template-contracts/dist/object.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +9 -2
- package/dist/packages/internal/template-contracts/dist/read-graph.js +36 -2
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +16 -1
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +9 -10
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +12 -1
- package/dist/packages/internal/template-contracts/dist/registry-graph.js +112 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +15 -2
- package/dist/packages/internal/template-contracts/dist/require-graph.js +300 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/row.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +1 -1
- package/dist/{schema → packages/internal/template-contracts/dist}/section-nav.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +4 -4
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +3 -1
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +24 -1
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +26 -1
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/table-members.js +7 -2
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
- package/dist/packages/internal/upload-formats/dist/heic.js +35 -0
- package/dist/packages/internal/upload-formats/dist/index.js +80 -0
- package/dist/packages/internal/upload-formats/dist/magic-bytes.js +293 -0
- package/dist/platform/paths.js +1 -0
- package/dist/platform/process.js +49 -1
- package/dist/primitives/FrameShell.d.ts +5 -2
- package/dist/primitives/FrameShell.js +2 -1
- package/dist/rules/registry.js +28 -4
- package/dist/schema/fact.d.ts +2 -2
- package/dist/schema/facts-view.d.ts +1 -1
- package/dist/schema/format.d.ts +0 -1
- package/dist/schema/format.js +1 -2
- package/dist/schema/manifest.js +18 -24
- package/dist/schema/section-props.d.ts +1 -1
- package/dist/schema/section-schema.d.ts +1 -1
- package/dist/schema/section-schema.js +1 -0
- package/dist/section/declare.d.ts +1 -1
- package/dist/section/discovery.js +6 -2
- package/dist/section/publish-shape.js +38 -0
- package/dist/section/section.d.ts +1 -1
- package/dist/site-analytics.js +6 -1
- package/dist/site-runtime/window-height.js +19 -0
- package/dist/template/define-template.d.ts +25 -4
- package/dist/template/define-template.js +3 -0
- package/dist/template/logic-shim.d.ts +1 -1
- package/dist/template/materialize.js +3 -1
- package/dist/template/running-copy.js +0 -1
- package/dist/template/section-reads.js +1 -1
- package/guide/reference/cli/INDEX.md +6 -5
- package/guide/reference/cli/build.md +10 -8
- package/guide/reference/cli/check.md +4 -2
- package/guide/reference/cli/dev.md +6 -2
- package/guide/reference/cli/install.md +41 -0
- package/guide/reference/cli/property-add.md +5 -4
- package/guide/reference/cli/property-list.md +2 -2
- package/guide/reference/cli/publish.md +5 -5
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +9 -5
- package/package.json +14 -30
- package/dist/artifact/playground/client/assets/index-ByeGGedv.js +0 -1259
- package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +0 -1
- package/dist/cli/build/artifact.js +0 -220
- package/dist/cli/build/captures.js +0 -48
- package/dist/cli/build/fixtures.js +0 -92
- package/dist/cli/capture/capture-browser.js +0 -37
- package/dist/cli/capture/capture.js +0 -113
- package/dist/cli/check/render/inputs.js +0 -60
- package/dist/cli/check/render/nav.js +0 -31
- package/dist/cli/dev/crop.js +0 -20
- package/dist/cli/dev/fixture-ladders.js +0 -96
- package/dist/cli/dev/hmr.js +0 -26
- package/dist/cli/dev/islands.js +0 -234
- package/dist/cli/dev/load-template.js +0 -52
- package/dist/cli/dev/vite.js +0 -114
- package/dist/cli/dev/workspace-reader.js +0 -248
- package/dist/cli/publish/freshness.js +0 -64
- package/dist/fixtures/brand.d.ts +0 -4
- package/dist/fixtures/brand.js +0 -8
- package/dist/fixtures/load.js +0 -159
- package/dist/fixtures/resolve.js +0 -392
- package/dist/fixtures.d.ts +0 -429
- package/dist/fixtures.js +0 -23
- package/dist/packages/internal/canvas-core/dist/island-host.js +0 -62
- package/dist/packages/internal/canvas-core/dist/island-shields.js +0 -30
- package/dist/playground/canvas-island-host.d.ts +0 -11
- package/dist/playground/canvas-island-host.js +0 -29
- package/dist/playground/canvas-markers.js +0 -14
- package/dist/playground/host/paths.js +0 -8
- package/dist/playground/layout.js +0 -17
- package/dist/playground/wire.js +0 -28
|
@@ -207,6 +207,29 @@ function mediaDeclarationProblem(declaration) {
|
|
|
207
207
|
}
|
|
208
208
|
return null;
|
|
209
209
|
}
|
|
210
|
+
const DOCUMENT_MIMES = /* @__PURE__ */ new Set([
|
|
211
|
+
"application/pdf",
|
|
212
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
213
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
214
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
215
|
+
"application/msword",
|
|
216
|
+
"application/vnd.ms-excel",
|
|
217
|
+
"application/vnd.ms-powerpoint",
|
|
218
|
+
"text/plain",
|
|
219
|
+
"text/csv"
|
|
220
|
+
]);
|
|
221
|
+
function kindOfMime(mime) {
|
|
222
|
+
const type = (mime.split(";")[0] ?? "").trim().toLowerCase();
|
|
223
|
+
if (type.startsWith("image/")) return "image";
|
|
224
|
+
if (type.startsWith("video/")) return "video";
|
|
225
|
+
return DOCUMENT_MIMES.has(type) ? "document" : null;
|
|
226
|
+
}
|
|
227
|
+
function kindOfLink(url) {
|
|
228
|
+
const provider = matchLinkProvider(url);
|
|
229
|
+
if (provider === null) return null;
|
|
230
|
+
const kind = LINK_PROVIDERS[provider].kind;
|
|
231
|
+
return kind === "tour" || kind === "video" ? kind : null;
|
|
232
|
+
}
|
|
210
233
|
const DISPLAY_ENTRIES = ["visibility", "variant"];
|
|
211
234
|
const VISIBILITY_CASES = ["visible", "hidden"];
|
|
212
235
|
const LINK_KINDS = [
|
|
@@ -385,4 +408,4 @@ const PASSTHROUGH_TOUR_PROVIDERS = /* @__PURE__ */ new Set([
|
|
|
385
408
|
]);
|
|
386
409
|
|
|
387
410
|
//#endregion
|
|
388
|
-
export { CONTENT_SLOT_TYPES, DISPLAY_ENTRIES, HOLDER_PROCESS_VERBS, LINK_KINDS, LINK_PROVIDERS, LIST_SLOT_TYPES, MEDIA_KINDS, OBJECT_BINDING_OWN_KEYS, PROCESS_CATALOG, PROCESS_VERBS, REF_SLOT_TYPES, SLOT_TYPES, VISIBILITY_CASES, acceptsLink, declaredKinds, isEmailValue, isIsoDateValue, isLinkAccepts, isListSlotType, isMediaKind, isMediaType, isPhoneValue, isProcessVerb, matchLinkProvider, mediaDeclarationProblem, processBindingOf, processOptionsProblem, tourEmbedUrl, videoEmbedUrl };
|
|
411
|
+
export { CONTENT_SLOT_TYPES, DISPLAY_ENTRIES, HOLDER_PROCESS_VERBS, LINK_KINDS, LINK_PROVIDERS, LIST_SLOT_TYPES, MEDIA_KINDS, OBJECT_BINDING_OWN_KEYS, PROCESS_CATALOG, PROCESS_VERBS, REF_SLOT_TYPES, SLOT_TYPES, VISIBILITY_CASES, acceptsLink, declaredKinds, isEmailValue, isIsoDateValue, isLinkAccepts, isListSlotType, isMediaKind, isMediaType, isPhoneValue, isProcessVerb, kindOfLink, kindOfMime, matchLinkProvider, mediaDeclarationProblem, processBindingOf, processOptionsProblem, tourEmbedUrl, videoEmbedUrl };
|
|
@@ -16,9 +16,34 @@ function objectFieldOf(slotId) {
|
|
|
16
16
|
field: slotId.slice(dot + 1)
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
function slotValueOf(slots, slotId) {
|
|
20
|
+
const field = objectFieldOf(slotId);
|
|
21
|
+
if (field === null) return slots[slotId];
|
|
22
|
+
const object = slots[field.object];
|
|
23
|
+
return object !== null && typeof object === "object" && !Array.isArray(object) ? object[field.field] : void 0;
|
|
24
|
+
}
|
|
25
|
+
function withSlotValue(slots, slotId, value) {
|
|
26
|
+
const field = objectFieldOf(slotId);
|
|
27
|
+
if (field === null) return {
|
|
28
|
+
...slots,
|
|
29
|
+
[slotId]: value
|
|
30
|
+
};
|
|
31
|
+
const current = slots[field.object];
|
|
32
|
+
const object = current !== null && typeof current === "object" && !Array.isArray(current) ? current : {};
|
|
33
|
+
return {
|
|
34
|
+
...slots,
|
|
35
|
+
[field.object]: {
|
|
36
|
+
...object,
|
|
37
|
+
[field.field]: value
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
19
41
|
function itemOverridesForSlot(overrides, slotId) {
|
|
20
42
|
return { ...overrides?.items?.[slotId] ?? {} };
|
|
21
43
|
}
|
|
44
|
+
function removedItemsForSlot(overrides, slotId) {
|
|
45
|
+
return { ...overrides?.items_removed?.[slotId] ?? {} };
|
|
46
|
+
}
|
|
22
47
|
|
|
23
48
|
//#endregion
|
|
24
|
-
export { isOrderOverridden, isSlotOverridden, itemOverridesForSlot, objectFieldOf, objectFieldSlotId };
|
|
49
|
+
export { isOrderOverridden, isSlotOverridden, itemOverridesForSlot, objectFieldOf, objectFieldSlotId, removedItemsForSlot, slotValueOf, withSlotValue };
|
|
@@ -2,9 +2,9 @@ import { DocumentValue } from "./document-value.js";
|
|
|
2
2
|
import { TourValue } from "./tour-value.js";
|
|
3
3
|
import { VideoValue } from "./video-value.js";
|
|
4
4
|
import { ImageValue } from "./runtime-values.js";
|
|
5
|
-
import { SlotValue } from "./slot-value.js";
|
|
6
5
|
import { Slot } from "./slot-types.js";
|
|
7
6
|
import { DocumentMedia, DocumentMediaValue, ImageMedia, Media, TourMedia, VideoMedia } from "./registry-facts.js";
|
|
7
|
+
import { SlotValue } from "./slot-value.js";
|
|
8
8
|
//#region ../../internal/template-contracts/dist/slot-ref.d.ts
|
|
9
9
|
/** The reserved `slot` prefix a display entry's ref is addressed by. */
|
|
10
10
|
declare const DISPLAY_REF_PREFIX = "display.";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { MediaKind } from "./slot-catalog.js";
|
|
1
2
|
import { AddressValue } from "./address-value.js";
|
|
2
3
|
import { DocumentValue } from "./document-value.js";
|
|
3
|
-
import { MediaKind } from "./slot-catalog.js";
|
|
4
4
|
import { TourValue } from "./tour-value.js";
|
|
5
5
|
import { VideoValue } from "./video-value.js";
|
|
6
6
|
import { PoiRow } from "./poi-row.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ADDRESS_MEMBERS, isAddressMember } from "./address-value.js";
|
|
2
|
-
import { addressPartValueType, fieldOf, isDerived, memberListOfKey, memberValueType, stampTableBounds, tableBounds, tableColumnOfKey, tableFieldsIn, tableForSlot, tableHome, tableKey, tableMemberValueType, tableNames, tableOf, tableOfSource } from "./registry-shape.js";
|
|
2
|
+
import { addressPartValueType, fieldOf, isDerived, memberListOfKey, memberMediaFilter, memberValueType, stampTableBounds, tableBounds, tableColumnOfKey, tableFieldsIn, tableForSlot, tableHome, tableKey, tableMemberValueType, tableNames, tableOf, tableOfSource } from "./registry-shape.js";
|
|
3
3
|
import { libraryFacts, propertyFacts } from "./fact-registry.js";
|
|
4
4
|
import { isRegistryFactKey, registryFactValueType } from "./fact-keys.js";
|
|
5
5
|
|
|
@@ -55,6 +55,11 @@ function isStorable(keyOrTable, path) {
|
|
|
55
55
|
const declaration = tableField(keyOrTable, path);
|
|
56
56
|
return declaration !== void 0 && !isDerived(declaration);
|
|
57
57
|
}
|
|
58
|
+
function rowFieldMember(table, field) {
|
|
59
|
+
const source = field.source;
|
|
60
|
+
if (source?.kind !== "row" || typeof source.field !== "string") return null;
|
|
61
|
+
return tableRowMember(table, source.field).kind === "unknown" ? null : source.field;
|
|
62
|
+
}
|
|
58
63
|
|
|
59
64
|
//#endregion
|
|
60
|
-
export { isStorable, memberListOfKey, memberValueType, registryMemberNames, stampTableBounds, tableBounds, tableColumnOfKey, tableField, tableFields, tableForSlot, tableKey, tableNames, tableOf, tableRowMember };
|
|
65
|
+
export { isStorable, memberListOfKey, memberMediaFilter, memberValueType, registryMemberNames, rowFieldMember, stampTableBounds, tableBounds, tableColumnOfKey, tableField, tableFields, tableForSlot, tableHome, tableKey, tableNames, tableOf, tableRowMember };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ResponsiveImage } from "./responsive-image.js";
|
|
2
1
|
import { VideoSource } from "./slot-catalog.js";
|
|
2
|
+
import { ResponsiveImage } from "./responsive-image.js";
|
|
3
3
|
//#region ../../internal/template-contracts/dist/video-value.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* A video slot's runtime value after resolution. Has no cropping or
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region ../../internal/upload-formats/dist/heic.js
|
|
2
|
+
const HEIC_REFUSAL = "We can’t read HEIC photos yet. Save it as a JPEG (on a Mac, open it in Preview and choose File > Export), then upload that.";
|
|
3
|
+
const HEIC_EXTENSIONS = /* @__PURE__ */ new Set([".heic", ".heif"]);
|
|
4
|
+
const HEIC_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
5
|
+
"image/heic",
|
|
6
|
+
"image/heif",
|
|
7
|
+
"image/heic-sequence",
|
|
8
|
+
"image/heif-sequence"
|
|
9
|
+
]);
|
|
10
|
+
const HEVC_BRANDS = /* @__PURE__ */ new Set([
|
|
11
|
+
"heic",
|
|
12
|
+
"heix",
|
|
13
|
+
"heim",
|
|
14
|
+
"heis",
|
|
15
|
+
"hevc",
|
|
16
|
+
"hevx",
|
|
17
|
+
"hevm",
|
|
18
|
+
"hevs"
|
|
19
|
+
]);
|
|
20
|
+
function isHeicClaim(extension, mime) {
|
|
21
|
+
return HEIC_EXTENSIONS.has(extension) || HEIC_MIME_TYPES.has(mime);
|
|
22
|
+
}
|
|
23
|
+
function hasHevcBrand(bytes) {
|
|
24
|
+
if (bytes.length < 12) return false;
|
|
25
|
+
const ascii = (at) => String.fromCharCode(bytes[at], bytes[at + 1], bytes[at + 2], bytes[at + 3]);
|
|
26
|
+
if (ascii(4) !== "ftyp") return false;
|
|
27
|
+
if (HEVC_BRANDS.has(ascii(8))) return true;
|
|
28
|
+
const boxSize = (bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3]) >>> 0;
|
|
29
|
+
const end = Math.min(boxSize, bytes.length);
|
|
30
|
+
for (let at = 16; at + 4 <= end; at += 4) if (HEVC_BRANDS.has(ascii(at))) return true;
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { HEIC_REFUSAL, HEVC_BRANDS, hasHevcBrand, isHeicClaim };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { HEIC_REFUSAL, isHeicClaim } from "./heic.js";
|
|
2
|
+
import { MAGIC_PREFIX_BYTES, verifyMagicBytes } from "./magic-bytes.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../internal/upload-formats/dist/index.js
|
|
5
|
+
const MAX_UPLOAD_BYTES = 500 * 1024 * 1024;
|
|
6
|
+
const DOCUMENT_FORMATS = [
|
|
7
|
+
{
|
|
8
|
+
extension: ".pdf",
|
|
9
|
+
mimeTypes: ["application/pdf"],
|
|
10
|
+
family: "pdf"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
extension: ".csv",
|
|
14
|
+
mimeTypes: ["text/csv", "application/vnd.ms-excel"],
|
|
15
|
+
family: "spreadsheet"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
extension: ".xlsx",
|
|
19
|
+
mimeTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
20
|
+
family: "spreadsheet"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
extension: ".docx",
|
|
24
|
+
mimeTypes: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
25
|
+
family: "text-document"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
extension: ".doc",
|
|
29
|
+
mimeTypes: ["application/msword"],
|
|
30
|
+
family: "text-document"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
extension: ".txt",
|
|
34
|
+
mimeTypes: ["text/plain"],
|
|
35
|
+
family: "text-document"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
extension: ".pptx",
|
|
39
|
+
mimeTypes: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
40
|
+
family: "presentation"
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
const DOCUMENT_EXTENSIONS = new Set(DOCUMENT_FORMATS.map((format) => format.extension));
|
|
44
|
+
const DOCUMENT_MIME_TYPES = new Set(DOCUMENT_FORMATS.flatMap((format) => format.mimeTypes));
|
|
45
|
+
function normalizeMime(mime) {
|
|
46
|
+
const parameterStart = mime.indexOf(";");
|
|
47
|
+
return (parameterStart === -1 ? mime : mime.slice(0, parameterStart)).trim().toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
function extensionOf(filename) {
|
|
50
|
+
const separator = Math.max(filename.lastIndexOf("/"), filename.lastIndexOf("\\"));
|
|
51
|
+
const basename = filename.slice(separator + 1);
|
|
52
|
+
const dot = basename.lastIndexOf(".");
|
|
53
|
+
return dot <= 0 ? "" : basename.slice(dot).toLowerCase();
|
|
54
|
+
}
|
|
55
|
+
function isImageMime(mime) {
|
|
56
|
+
return normalizeMime(mime).startsWith("image/");
|
|
57
|
+
}
|
|
58
|
+
function isVideoMime(mime) {
|
|
59
|
+
return normalizeMime(mime).startsWith("video/");
|
|
60
|
+
}
|
|
61
|
+
function isAcceptedDocument(filename, mime) {
|
|
62
|
+
return DOCUMENT_EXTENSIONS.has(extensionOf(filename)) && DOCUMENT_MIME_TYPES.has(normalizeMime(mime));
|
|
63
|
+
}
|
|
64
|
+
function isAcceptedUpload(filename, mime) {
|
|
65
|
+
if (heicRefusal(filename, mime) !== null) return false;
|
|
66
|
+
return isImageMime(mime) || isVideoMime(mime) || isAcceptedDocument(filename, mime);
|
|
67
|
+
}
|
|
68
|
+
function heicRefusal(filename, mime) {
|
|
69
|
+
return isHeicClaim(extensionOf(filename), normalizeMime(mime)) ? HEIC_REFUSAL : null;
|
|
70
|
+
}
|
|
71
|
+
const DOCUMENT_ACCEPT_ATTRIBUTE = [...DOCUMENT_MIME_TYPES, ...DOCUMENT_EXTENSIONS].join(",");
|
|
72
|
+
const UPLOAD_ACCEPT_ATTRIBUTE = [
|
|
73
|
+
"image/*",
|
|
74
|
+
"video/*",
|
|
75
|
+
DOCUMENT_ACCEPT_ATTRIBUTE
|
|
76
|
+
].join(",");
|
|
77
|
+
const ACCEPTED_UPLOAD_SUMMARY = "an image, a video, or a document (PDF, Word, Excel .xlsx, PowerPoint .pptx, CSV, or text)";
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
export { ACCEPTED_UPLOAD_SUMMARY, DOCUMENT_ACCEPT_ATTRIBUTE, DOCUMENT_FORMATS, MAGIC_PREFIX_BYTES, MAX_UPLOAD_BYTES, extensionOf, heicRefusal, isAcceptedDocument, isAcceptedUpload, isImageMime, isVideoMime, normalizeMime, verifyMagicBytes };
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { HEIC_REFUSAL, hasHevcBrand } from "./heic.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../internal/upload-formats/dist/magic-bytes.js
|
|
4
|
+
const MAGIC_PREFIX_BYTES = 4096;
|
|
5
|
+
const OOXML_MIME = /* @__PURE__ */ new Set([
|
|
6
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
7
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
8
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
9
|
+
]);
|
|
10
|
+
const LEGACY_OFFICE_MIME = /* @__PURE__ */ new Set([
|
|
11
|
+
"application/msword",
|
|
12
|
+
"application/vnd.ms-excel",
|
|
13
|
+
"application/vnd.ms-powerpoint"
|
|
14
|
+
]);
|
|
15
|
+
const PLAIN_TEXT_MIME = /* @__PURE__ */ new Set(["text/plain", "text/csv"]);
|
|
16
|
+
const CSV_MIME = /* @__PURE__ */ new Set([...PLAIN_TEXT_MIME, "application/vnd.ms-excel"]);
|
|
17
|
+
const isImageMime = (mime) => mime.startsWith("image/");
|
|
18
|
+
const isVideoMime = (mime) => mime.startsWith("video/");
|
|
19
|
+
function bytesAt(bytes, offset, expected) {
|
|
20
|
+
if (bytes.length < offset + expected.length) return false;
|
|
21
|
+
return expected.every((byte, i) => bytes[offset + i] === byte);
|
|
22
|
+
}
|
|
23
|
+
function asciiAt(bytes, offset, expected) {
|
|
24
|
+
return bytesAt(bytes, offset, Array.from(expected, (ch) => ch.charCodeAt(0)));
|
|
25
|
+
}
|
|
26
|
+
const isIsoBaseMedia = (bytes) => asciiAt(bytes, 4, "ftyp");
|
|
27
|
+
const QUICKTIME_BOXES = [
|
|
28
|
+
"moov",
|
|
29
|
+
"mdat",
|
|
30
|
+
"wide",
|
|
31
|
+
"free",
|
|
32
|
+
"skip",
|
|
33
|
+
"pnot"
|
|
34
|
+
];
|
|
35
|
+
function isMpegTransportStream(bytes) {
|
|
36
|
+
const syncsAt = (start, stride) => bytes.length > start + stride * 2 && bytes[start] === 71 && bytes[start + stride] === 71 && bytes[start + stride * 2] === 71;
|
|
37
|
+
return syncsAt(0, 188) || syncsAt(4, 192);
|
|
38
|
+
}
|
|
39
|
+
const PDF_HEADER_SEARCH_BYTES = 1024;
|
|
40
|
+
function hasPdfHeader(bytes) {
|
|
41
|
+
const limit = Math.min(bytes.length, PDF_HEADER_SEARCH_BYTES);
|
|
42
|
+
for (let i = 0; i + 5 <= limit; i++) if (asciiAt(bytes, i, "%PDF-")) return true;
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
function looksLikeText(bytes) {
|
|
46
|
+
if (bytes.length === 0) return false;
|
|
47
|
+
return bytes.every((byte) => byte >= 32 || byte === 9 || byte === 10 || byte === 13 || byte === 12);
|
|
48
|
+
}
|
|
49
|
+
function looksLikeSvgOrXml(bytes) {
|
|
50
|
+
if (!looksLikeText(bytes)) return false;
|
|
51
|
+
const head = new TextDecoder("utf-8", { fatal: false }).decode(bytes).toLowerCase();
|
|
52
|
+
return head.trimStart().startsWith("<?xml") || head.includes("<svg");
|
|
53
|
+
}
|
|
54
|
+
const SIGNATURES = [
|
|
55
|
+
{
|
|
56
|
+
label: "a JPEG image",
|
|
57
|
+
test: (b) => bytesAt(b, 0, [
|
|
58
|
+
255,
|
|
59
|
+
216,
|
|
60
|
+
255
|
|
61
|
+
]),
|
|
62
|
+
satisfies: isImageMime
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: "a PNG image",
|
|
66
|
+
test: (b) => bytesAt(b, 0, [
|
|
67
|
+
137,
|
|
68
|
+
80,
|
|
69
|
+
78,
|
|
70
|
+
71,
|
|
71
|
+
13,
|
|
72
|
+
10,
|
|
73
|
+
26,
|
|
74
|
+
10
|
|
75
|
+
]),
|
|
76
|
+
satisfies: isImageMime
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: "a GIF image",
|
|
80
|
+
test: (b) => asciiAt(b, 0, "GIF87a") || asciiAt(b, 0, "GIF89a"),
|
|
81
|
+
satisfies: isImageMime
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "a WebP image",
|
|
85
|
+
test: (b) => asciiAt(b, 0, "RIFF") && asciiAt(b, 8, "WEBP"),
|
|
86
|
+
satisfies: isImageMime
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: "a BMP image",
|
|
90
|
+
test: (b) => asciiAt(b, 0, "BM"),
|
|
91
|
+
satisfies: isImageMime
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "a TIFF image",
|
|
95
|
+
test: (b) => bytesAt(b, 0, [
|
|
96
|
+
73,
|
|
97
|
+
73,
|
|
98
|
+
42,
|
|
99
|
+
0
|
|
100
|
+
]) || bytesAt(b, 0, [
|
|
101
|
+
77,
|
|
102
|
+
77,
|
|
103
|
+
0,
|
|
104
|
+
42
|
|
105
|
+
]),
|
|
106
|
+
satisfies: isImageMime
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
label: "a Windows icon",
|
|
110
|
+
test: (b) => bytesAt(b, 0, [
|
|
111
|
+
0,
|
|
112
|
+
0,
|
|
113
|
+
1,
|
|
114
|
+
0
|
|
115
|
+
]) || bytesAt(b, 0, [
|
|
116
|
+
0,
|
|
117
|
+
0,
|
|
118
|
+
2,
|
|
119
|
+
0
|
|
120
|
+
]),
|
|
121
|
+
satisfies: isImageMime
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: "a JPEG 2000 image",
|
|
125
|
+
test: (b) => bytesAt(b, 0, [
|
|
126
|
+
0,
|
|
127
|
+
0,
|
|
128
|
+
0,
|
|
129
|
+
12,
|
|
130
|
+
106,
|
|
131
|
+
80,
|
|
132
|
+
32,
|
|
133
|
+
32
|
|
134
|
+
]) || bytesAt(b, 0, [
|
|
135
|
+
255,
|
|
136
|
+
79,
|
|
137
|
+
255,
|
|
138
|
+
81
|
|
139
|
+
]),
|
|
140
|
+
satisfies: isImageMime
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
label: "a JPEG XL image",
|
|
144
|
+
test: (b) => bytesAt(b, 0, [255, 10]) || bytesAt(b, 0, [
|
|
145
|
+
0,
|
|
146
|
+
0,
|
|
147
|
+
0,
|
|
148
|
+
12,
|
|
149
|
+
74,
|
|
150
|
+
88,
|
|
151
|
+
76,
|
|
152
|
+
32
|
|
153
|
+
]),
|
|
154
|
+
satisfies: isImageMime
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: "an ISO base media file (MP4, MOV or AVIF)",
|
|
158
|
+
test: isIsoBaseMedia,
|
|
159
|
+
satisfies: (mime) => isImageMime(mime) || isVideoMime(mime)
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
label: "a QuickTime video",
|
|
163
|
+
test: (b) => QUICKTIME_BOXES.some((box) => asciiAt(b, 4, box)),
|
|
164
|
+
satisfies: isVideoMime
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
label: "a Matroska or WebM video",
|
|
168
|
+
test: (b) => bytesAt(b, 0, [
|
|
169
|
+
26,
|
|
170
|
+
69,
|
|
171
|
+
223,
|
|
172
|
+
163
|
|
173
|
+
]),
|
|
174
|
+
satisfies: isVideoMime
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
label: "an AVI video",
|
|
178
|
+
test: (b) => asciiAt(b, 0, "RIFF") && asciiAt(b, 8, "AVI "),
|
|
179
|
+
satisfies: isVideoMime
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
label: "an MPEG video stream",
|
|
183
|
+
test: (b) => bytesAt(b, 0, [
|
|
184
|
+
0,
|
|
185
|
+
0,
|
|
186
|
+
1,
|
|
187
|
+
186
|
|
188
|
+
]) || bytesAt(b, 0, [
|
|
189
|
+
0,
|
|
190
|
+
0,
|
|
191
|
+
1,
|
|
192
|
+
179
|
|
193
|
+
]),
|
|
194
|
+
satisfies: isVideoMime
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: "an MPEG transport stream",
|
|
198
|
+
test: isMpegTransportStream,
|
|
199
|
+
satisfies: isVideoMime
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
label: "a Flash video",
|
|
203
|
+
test: (b) => asciiAt(b, 0, "FLV") && b[3] === 1,
|
|
204
|
+
satisfies: isVideoMime
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
label: "an Ogg video",
|
|
208
|
+
test: (b) => asciiAt(b, 0, "OggS"),
|
|
209
|
+
satisfies: isVideoMime
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
label: "a Windows Media video",
|
|
213
|
+
test: (b) => bytesAt(b, 0, [
|
|
214
|
+
48,
|
|
215
|
+
38,
|
|
216
|
+
178,
|
|
217
|
+
117,
|
|
218
|
+
142,
|
|
219
|
+
102,
|
|
220
|
+
207,
|
|
221
|
+
17
|
|
222
|
+
]),
|
|
223
|
+
satisfies: isVideoMime
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
label: "a PDF",
|
|
227
|
+
test: hasPdfHeader,
|
|
228
|
+
satisfies: (mime) => mime === "application/pdf"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
label: "a ZIP archive (the container Word, Excel and PowerPoint files use)",
|
|
232
|
+
test: (b) => bytesAt(b, 0, [
|
|
233
|
+
80,
|
|
234
|
+
75,
|
|
235
|
+
3,
|
|
236
|
+
4
|
|
237
|
+
]) || bytesAt(b, 0, [
|
|
238
|
+
80,
|
|
239
|
+
75,
|
|
240
|
+
5,
|
|
241
|
+
6
|
|
242
|
+
]) || bytesAt(b, 0, [
|
|
243
|
+
80,
|
|
244
|
+
75,
|
|
245
|
+
7,
|
|
246
|
+
8
|
|
247
|
+
]),
|
|
248
|
+
satisfies: (mime) => OOXML_MIME.has(mime)
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: "a legacy Office document",
|
|
252
|
+
test: (b) => bytesAt(b, 0, [
|
|
253
|
+
208,
|
|
254
|
+
207,
|
|
255
|
+
17,
|
|
256
|
+
224,
|
|
257
|
+
161,
|
|
258
|
+
177,
|
|
259
|
+
26,
|
|
260
|
+
225
|
|
261
|
+
]),
|
|
262
|
+
satisfies: (mime) => LEGACY_OFFICE_MIME.has(mime)
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
label: "SVG or XML markup",
|
|
266
|
+
test: looksLikeSvgOrXml,
|
|
267
|
+
satisfies: (mime) => mime === "image/svg+xml" || PLAIN_TEXT_MIME.has(mime)
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
label: "plain text",
|
|
271
|
+
test: looksLikeText,
|
|
272
|
+
satisfies: (mime) => CSV_MIME.has(mime)
|
|
273
|
+
}
|
|
274
|
+
];
|
|
275
|
+
function verifyMagicBytes(prefix, declaredMime) {
|
|
276
|
+
if (hasHevcBrand(prefix)) return {
|
|
277
|
+
ok: false,
|
|
278
|
+
detail: HEIC_REFUSAL
|
|
279
|
+
};
|
|
280
|
+
const signature = SIGNATURES.find((candidate) => candidate.test(prefix));
|
|
281
|
+
if (!signature) return {
|
|
282
|
+
ok: false,
|
|
283
|
+
detail: `This file's contents don't look like ${declaredMime}. It may be corrupt, empty, or saved in a format we don't accept.`
|
|
284
|
+
};
|
|
285
|
+
if (!signature.satisfies(declaredMime)) return {
|
|
286
|
+
ok: false,
|
|
287
|
+
detail: `This file was uploaded as ${declaredMime}, but its contents are ${signature.label}. Rename or re-export the file so its type matches, then try again.`
|
|
288
|
+
};
|
|
289
|
+
return { ok: true };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
//#endregion
|
|
293
|
+
export { MAGIC_PREFIX_BYTES, verifyMagicBytes };
|
package/dist/platform/paths.js
CHANGED
|
@@ -26,6 +26,7 @@ function replaceRoot(text, root, replacement, paths = nodePath) {
|
|
|
26
26
|
function withoutRoot(text, root, paths = nodePath) {
|
|
27
27
|
return replaceRoot(text, root.endsWith(paths.sep) ? root : root + paths.sep, "", paths);
|
|
28
28
|
}
|
|
29
|
+
const recordedPath = nodePath.posix;
|
|
29
30
|
function normalizePosix(path) {
|
|
30
31
|
return nodePath.posix.normalize(path);
|
|
31
32
|
}
|
package/dist/platform/process.js
CHANGED
|
@@ -12,6 +12,54 @@ function spawnNpm(args, options) {
|
|
|
12
12
|
shell: npmNeedsShell()
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
function spawnNode(args, options) {
|
|
16
|
+
return spawn(process.execPath, [...args], {
|
|
17
|
+
...options,
|
|
18
|
+
shell: false
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function failureLine(output) {
|
|
22
|
+
const lines = output.split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "" && !line.startsWith("at "));
|
|
23
|
+
return [...lines].reverse().find((line) => /^\w*Error\b/.test(line)) ?? lines.at(-1);
|
|
24
|
+
}
|
|
25
|
+
function runNodeScript(args, { cwd, env, sink } = {}) {
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
let child;
|
|
28
|
+
try {
|
|
29
|
+
child = spawnNode(args, {
|
|
30
|
+
...cwd === void 0 ? {} : { cwd },
|
|
31
|
+
...env === void 0 ? {} : { env: { ...env } },
|
|
32
|
+
stdio: [
|
|
33
|
+
"ignore",
|
|
34
|
+
"pipe",
|
|
35
|
+
"pipe"
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
} catch (cause) {
|
|
39
|
+
resolve(cause instanceof Error ? cause.message : String(cause));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let tail = "";
|
|
43
|
+
for (const stream of [child.stdout, child.stderr]) {
|
|
44
|
+
stream?.on("data", (chunk) => {
|
|
45
|
+
tail = (tail + chunk.toString("utf8")).slice(-2e3);
|
|
46
|
+
});
|
|
47
|
+
if (sink !== void 0) stream?.pipe(sink, { end: false });
|
|
48
|
+
}
|
|
49
|
+
child.once("error", (cause) => {
|
|
50
|
+
resolve(cause.message);
|
|
51
|
+
});
|
|
52
|
+
child.once("close", (code, signal) => {
|
|
53
|
+
if (code === 0) {
|
|
54
|
+
resolve(null);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const exit = signal === null ? `exited ${String(code)}` : `was killed by ${signal}`;
|
|
58
|
+
const said = failureLine(tail);
|
|
59
|
+
resolve(said === void 0 ? exit : `${exit}: ${said}`);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
15
63
|
function killTree(child, platform = process.platform, start = spawn) {
|
|
16
64
|
if (child.pid === void 0 || child.exitCode !== null) return;
|
|
17
65
|
if (platform !== "win32") {
|
|
@@ -94,4 +142,4 @@ function invokedAsBin(moduleUrl, argv1 = process.argv[1]) {
|
|
|
94
142
|
}
|
|
95
143
|
|
|
96
144
|
//#endregion
|
|
97
|
-
export { SHUTDOWN_SIGNALS, execBounded, execGit, execNpm, invokedAsBin, killTree, npmNeedsShell, onShutdown, spawnNpm };
|
|
145
|
+
export { SHUTDOWN_SIGNALS, execBounded, execGit, execNpm, failureLine, invokedAsBin, killTree, npmNeedsShell, onShutdown, runNodeScript, spawnNode, spawnNpm };
|
|
@@ -4,6 +4,8 @@ import { ReactNode } from "react";
|
|
|
4
4
|
//#region src/primitives/FrameShell.d.ts
|
|
5
5
|
type Props = {
|
|
6
6
|
format: ImageFormat | DocumentFormat;
|
|
7
|
+
/** The page's declared direction; a row page stamps `data-direction="row"`, a column page nothing. */
|
|
8
|
+
direction?: "column" | "row";
|
|
7
9
|
children: ReactNode;
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
@@ -12,7 +14,8 @@ type Props = {
|
|
|
12
14
|
* document a window that is exactly the format's bleed box, and the static
|
|
13
15
|
* half of the contract (`.concrete-frame`, from the base stylesheet) fills
|
|
14
16
|
* that window, clips at the shell's own edge, and lays sections out as a
|
|
15
|
-
* rigid flex column
|
|
17
|
+
* rigid flex column, or a rigid flex row on a page declaring
|
|
18
|
+
* `direction: "row"` (`flex-shrink: 0` on every direct child, so an
|
|
16
19
|
* overflowing stack overflows measurably instead of being silently
|
|
17
20
|
* compressed). The shell sets the three geometry tokens
|
|
18
21
|
* (`--frame-w`/`--frame-h`/`--frame-bleed`) — the declared geometry, for
|
|
@@ -24,6 +27,6 @@ type Props = {
|
|
|
24
27
|
* shell draws nothing: trim and bleed guides are host chrome, never markup, so
|
|
25
28
|
* rendered bytes are identical in every host.
|
|
26
29
|
*/
|
|
27
|
-
declare function FrameShell({ format, children }: Props): import("react").JSX.Element;
|
|
30
|
+
declare function FrameShell({ format, direction, children }: Props): import("react").JSX.Element;
|
|
28
31
|
//#endregion
|
|
29
32
|
export { FrameShell };
|
|
@@ -2,10 +2,11 @@ import { FRAME_ROOT_CLASS, frameTokens } from "../packages/internal/format-geome
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/primitives/FrameShell.tsx
|
|
5
|
-
function FrameShell({ format, children }) {
|
|
5
|
+
function FrameShell({ format, direction = "column", children }) {
|
|
6
6
|
return /* @__PURE__ */ jsx("div", {
|
|
7
7
|
className: FRAME_ROOT_CLASS,
|
|
8
8
|
"data-format": format.id,
|
|
9
|
+
"data-direction": direction === "row" ? "row" : void 0,
|
|
9
10
|
style: frameTokens(format),
|
|
10
11
|
children
|
|
11
12
|
});
|