@drawnagency/primitives 0.1.93 → 0.1.94
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/{chunk-LQQY2RW6.js → chunk-DJAJRBPD.js} +1 -0
- package/dist/{chunk-RBKBNQGB.js → chunk-GDLH3LVH.js} +4 -4
- package/dist/{chunk-YI2HUFE3.js → chunk-RQPHPAT2.js} +1 -1
- package/dist/chunk-VAOW4WXQ.js +15 -0
- package/dist/{chunk-HLKAQLTV.js → chunk-ZKGMLLUQ.js} +1 -1
- package/dist/components/primitives/ResolvedMedia.d.ts.map +1 -1
- package/dist/components/primitives/index.js +2 -2
- package/dist/components/sections/Video/VideoBlock.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +2 -2
- package/dist/components/sections/register-schemas.js +4 -4
- package/dist/components/sections/register.js +4 -4
- package/dist/hooks/useMediaPipeline.d.ts.map +1 -1
- package/dist/index.js +5 -10
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +9 -0
- package/dist/storage/types.d.ts +14 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/components/primitives/ResolvedMedia.tsx +6 -0
- package/src/components/sections/Video/VideoBlock.tsx +9 -1
- package/src/hooks/useMediaPipeline.ts +4 -0
- package/src/storage/index.ts +1 -1
- package/src/storage/types.ts +15 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
pluralize,
|
|
4
4
|
stripHtmlToPlainText,
|
|
5
5
|
truncate
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZKGMLLUQ.js";
|
|
7
7
|
import {
|
|
8
8
|
DeleteButton,
|
|
9
9
|
DragHandle,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
EditableRichText,
|
|
23
23
|
defineHeadingSection
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RQPHPAT2.js";
|
|
25
25
|
import {
|
|
26
26
|
EditablePlainText,
|
|
27
27
|
ImageDropZone,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
containerGridClass,
|
|
32
32
|
masonryColumnsClass,
|
|
33
33
|
spacerHiddenClass
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-DJAJRBPD.js";
|
|
35
35
|
import {
|
|
36
36
|
useMediaLibrary,
|
|
37
37
|
useResolvedMedia
|
|
@@ -265,7 +265,7 @@ function VideoBlock({ source, caption, options, isEditMode, onSourceChange, onCa
|
|
|
265
265
|
const width = bakedWidth ?? resolved.width;
|
|
266
266
|
const height = bakedHeight ?? resolved.height;
|
|
267
267
|
aspect = width && height ? `${width} / ${height}` : void 0;
|
|
268
|
-
const playbackProps = playback === "ambient" ? { autoPlay: true, muted: true, loop: true, playsInline: true } : { controls: true, preload: "metadata" };
|
|
268
|
+
const playbackProps = playback === "ambient" ? { autoPlay: true, muted: true, loop: true, playsInline: true, preload: "none" } : { controls: true, preload: "metadata" };
|
|
269
269
|
const videoEl = imageId ? /* @__PURE__ */ jsx7(
|
|
270
270
|
"video",
|
|
271
271
|
{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/storage/types.ts
|
|
2
|
+
var StorageConflictError = class extends Error {
|
|
3
|
+
constructor(currentVersion) {
|
|
4
|
+
super("Draft has been modified since it was loaded");
|
|
5
|
+
this.currentVersion = currentVersion;
|
|
6
|
+
this.name = "StorageConflictError";
|
|
7
|
+
}
|
|
8
|
+
currentVersion;
|
|
9
|
+
};
|
|
10
|
+
var ASSET_CACHE_CONTROL = "max-age=31536000, immutable";
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
StorageConflictError,
|
|
14
|
+
ASSET_CACHE_CONTROL
|
|
15
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolvedMedia.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/ResolvedMedia.tsx"],"names":[],"mappings":"AAKA,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,UAAU,EAClB,SAAS,EACT,YAAY,EACZ,UAAU,GACX,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ResolvedMedia.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/ResolvedMedia.tsx"],"names":[],"mappings":"AAKA,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,UAAU,EAClB,SAAS,EACT,YAAY,EACZ,UAAU,GACX,EAAE,kBAAkB,2CAiFpB"}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
EditableRichText,
|
|
3
3
|
LinkPopover,
|
|
4
4
|
defineHeadingSection
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-RQPHPAT2.js";
|
|
6
6
|
import {
|
|
7
7
|
EditableGrid,
|
|
8
8
|
EditablePlainText,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
MediaBlock,
|
|
11
11
|
ResolvedMedia,
|
|
12
12
|
useEditableCollection
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-DJAJRBPD.js";
|
|
14
14
|
import "../../chunk-ZSPCE6MZ.js";
|
|
15
15
|
import {
|
|
16
16
|
DeleteIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoBlock.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Video/VideoBlock.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACzF;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEN,UAAU,eAAe;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QAAE,QAAQ,CA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,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,EAAE,eAAe,2CAwIpH"}
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ColorItemSchema,
|
|
3
3
|
ColorSpaceSchema,
|
|
4
4
|
brandGuideSectionDefs
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-ZKGMLLUQ.js";
|
|
6
6
|
import "../../chunk-5THS4K5D.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-DJAJRBPD.js";
|
|
8
8
|
import "../../chunk-CI624HRS.js";
|
|
9
9
|
import "../../chunk-SOILPZ7U.js";
|
|
10
10
|
import "../../chunk-PZJL2S3Z.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
allSectionDefs
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-GDLH3LVH.js";
|
|
4
|
+
import "../../chunk-ZKGMLLUQ.js";
|
|
5
5
|
import "../../chunk-XYFZ57AS.js";
|
|
6
6
|
import "../../chunk-5THS4K5D.js";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-RQPHPAT2.js";
|
|
8
|
+
import "../../chunk-DJAJRBPD.js";
|
|
9
9
|
import "../../chunk-ZSPCE6MZ.js";
|
|
10
10
|
import "../../chunk-CI624HRS.js";
|
|
11
11
|
import "../../chunk-Y4JQGO6G.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
allSectionDefs
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-GDLH3LVH.js";
|
|
4
|
+
import "../../chunk-ZKGMLLUQ.js";
|
|
5
5
|
import "../../chunk-XYFZ57AS.js";
|
|
6
6
|
import "../../chunk-5THS4K5D.js";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-RQPHPAT2.js";
|
|
8
|
+
import "../../chunk-DJAJRBPD.js";
|
|
9
9
|
import "../../chunk-ZSPCE6MZ.js";
|
|
10
10
|
import "../../chunk-CI624HRS.js";
|
|
11
11
|
import "../../chunk-Y4JQGO6G.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMediaPipeline.d.ts","sourceRoot":"","sources":["../../src/hooks/useMediaPipeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,gBAAgB,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"useMediaPipeline.d.ts","sourceRoot":"","sources":["../../src/hooks/useMediaPipeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,gBAAgB,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE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M,OAAO,MAAM;+BAiBnB,MAAM,YAAY,MAAM,GAAG,IAAI,KAAG,MAAM;6BAW1C,MAAM,QAAQ,MAAM;2BAWtB,MAAM,YAAY,MAAM,GAAG,IAAI;6BA4BvB,MAAM,YAAY,MAAM,GAAG,QAAQ;2BAd3C,MAAM,EAAE,YAAY,MAAM,GAAG,IAAI;kCA4DhE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,mBAC9B,MAAM,GAAG,IAAI;;;wBAkCO,IAAI,eAAe,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,SAAS;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE;EAqFjH"}
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,10 @@ import {
|
|
|
33
33
|
sanitizeMediaName,
|
|
34
34
|
setMediaProvider
|
|
35
35
|
} from "./chunk-SOILPZ7U.js";
|
|
36
|
+
import {
|
|
37
|
+
ASSET_CACHE_CONTROL,
|
|
38
|
+
StorageConflictError
|
|
39
|
+
} from "./chunk-VAOW4WXQ.js";
|
|
36
40
|
import {
|
|
37
41
|
CollabPeerSchema,
|
|
38
42
|
HEARTBEAT_INTERVAL_MS,
|
|
@@ -155,17 +159,8 @@ import {
|
|
|
155
159
|
env
|
|
156
160
|
} from "./chunk-WKZ7OENC.js";
|
|
157
161
|
import "./chunk-JSBRDJBE.js";
|
|
158
|
-
|
|
159
|
-
// src/storage/types.ts
|
|
160
|
-
var StorageConflictError = class extends Error {
|
|
161
|
-
constructor(currentVersion) {
|
|
162
|
-
super("Draft has been modified since it was loaded");
|
|
163
|
-
this.currentVersion = currentVersion;
|
|
164
|
-
this.name = "StorageConflictError";
|
|
165
|
-
}
|
|
166
|
-
currentVersion;
|
|
167
|
-
};
|
|
168
162
|
export {
|
|
163
|
+
ASSET_CACHE_CONTROL,
|
|
169
164
|
AUDIENCE_COOKIE,
|
|
170
165
|
AUDIENCE_MAX_AGE_SECONDS,
|
|
171
166
|
AudienceColorSchema,
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/storage/types.d.ts
CHANGED
|
@@ -30,6 +30,20 @@ export type FileWrite = {
|
|
|
30
30
|
content: string | Uint8Array | null;
|
|
31
31
|
encoding?: "utf-8" | "base64";
|
|
32
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* `Cache-Control` every bucket upload must set. Object paths are content-hashed
|
|
35
|
+
* ("media/{hash}/original.mp4"), so a given URL's bytes never change — replacing
|
|
36
|
+
* a video mints a new hash and therefore a new URL. That makes `immutable` safe
|
|
37
|
+
* and a one-year max-age correct.
|
|
38
|
+
*
|
|
39
|
+
* This is NOT cosmetic. A bucket upload sent with no `cache-control` request
|
|
40
|
+
* header is stored as `no-cache`, which means neither the browser nor a CDN will
|
|
41
|
+
* ever reuse a response — every play of every video becomes origin egress,
|
|
42
|
+
* including a plain page reload. That default is what exhausted the Supabase
|
|
43
|
+
* project's egress quota while the bucket sat at 46% of its size limit. Any new
|
|
44
|
+
* upload path MUST send this header.
|
|
45
|
+
*/
|
|
46
|
+
export declare const ASSET_CACHE_CONTROL = "max-age=31536000, immutable";
|
|
33
47
|
/**
|
|
34
48
|
* Optional large-asset store (Supabase Storage bucket). Holds video originals
|
|
35
49
|
* too big for the git path; deliberately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M,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC/E;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,eAAe,CACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,GAC5B,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEnE,oEAAoE;IACpE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEnC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC,sDAAsD;IACtD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;CACpF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawnagency/primitives",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.94",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -96,6 +96,10 @@
|
|
|
96
96
|
"types": "./dist/media/index.d.ts",
|
|
97
97
|
"default": "./dist/media/index.js"
|
|
98
98
|
},
|
|
99
|
+
"./storage": {
|
|
100
|
+
"types": "./dist/storage/index.d.ts",
|
|
101
|
+
"default": "./dist/storage/index.js"
|
|
102
|
+
},
|
|
99
103
|
"./types/database": {
|
|
100
104
|
"types": "./dist/types/database.d.ts",
|
|
101
105
|
"default": "./dist/types/database.js"
|
|
@@ -74,6 +74,12 @@ export function ResolvedMedia({
|
|
|
74
74
|
playsInline
|
|
75
75
|
loop
|
|
76
76
|
autoPlay
|
|
77
|
+
// Defer the fetch until the loop nears the viewport. Without
|
|
78
|
+
// this, every media-section video on a page downloads in full
|
|
79
|
+
// during initial load. `autoplay` still overrides the hint when
|
|
80
|
+
// the browser decides to play, so playback is unchanged — see
|
|
81
|
+
// the matching note in sections/Video/VideoBlock.tsx.
|
|
82
|
+
preload="none"
|
|
77
83
|
className={mediaClass}
|
|
78
84
|
onLoadedData={() => setLoaded(true)}
|
|
79
85
|
/>
|
|
@@ -90,9 +90,17 @@ export function VideoBlock({ source, caption, options, isEditMode, onSourceChang
|
|
|
90
90
|
const height = bakedHeight ?? resolved.height;
|
|
91
91
|
aspect = width && height ? `${width} / ${height}` : undefined;
|
|
92
92
|
|
|
93
|
+
// `preload="none"` on the ambient branch is deliberate and load-bearing.
|
|
94
|
+
// An autoplaying loop with no preload hint fetches the whole file during
|
|
95
|
+
// initial page load, even far below the fold — on the Siete portal that was
|
|
96
|
+
// 246 MB of video downloading before the viewer scrolled to any of it.
|
|
97
|
+
// `preload` is only a hint and `autoplay` overrides it once the browser
|
|
98
|
+
// decides to play, so playback is unaffected; what changes is that the
|
|
99
|
+
// fetch is deferred until the element approaches the viewport instead of
|
|
100
|
+
// racing everything else on the page. The poster still renders immediately.
|
|
93
101
|
const playbackProps =
|
|
94
102
|
playback === "ambient"
|
|
95
|
-
? { autoPlay: true, muted: true, loop: true, playsInline: true }
|
|
103
|
+
? { autoPlay: true, muted: true, loop: true, playsInline: true, preload: "none" as const }
|
|
96
104
|
: { controls: true, preload: "metadata" as const };
|
|
97
105
|
|
|
98
106
|
const videoEl = imageId ? (
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
removePendingMediaDeletion,
|
|
14
14
|
} from "../lib/dexie";
|
|
15
15
|
import { generateVideoPoster } from "../media/videoPoster";
|
|
16
|
+
import { ASSET_CACHE_CONTROL } from "../storage/types";
|
|
16
17
|
import { tallyImageIds, collectImageIds, clearImageIds, applyLogoDeletion } from "../lib/image-refs";
|
|
17
18
|
import {
|
|
18
19
|
createFolderId, uniqueFolderName, effectiveParentId, canMoveFolder,
|
|
@@ -285,6 +286,9 @@ export function useMediaPipeline({
|
|
|
285
286
|
const xhr = new XMLHttpRequest();
|
|
286
287
|
xhr.open("PUT", uploadUrl);
|
|
287
288
|
xhr.setRequestHeader("Content-Type", file.type);
|
|
289
|
+
// Without this the object is stored as `no-cache` and every later
|
|
290
|
+
// play is billed origin egress — see ASSET_CACHE_CONTROL.
|
|
291
|
+
xhr.setRequestHeader("Cache-Control", ASSET_CACHE_CONTROL);
|
|
288
292
|
xhr.upload.onprogress = (e) => {
|
|
289
293
|
if (e.lengthComputable) setUploadProgress((prev) => ({ ...prev, [hash as string]: e.loaded / e.total }));
|
|
290
294
|
};
|
package/src/storage/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { StorageProvider, FileWrite, AssetStore } from "./types";
|
|
2
|
-
export { StorageConflictError } from "./types";
|
|
2
|
+
export { StorageConflictError, ASSET_CACHE_CONTROL } from "./types";
|
package/src/storage/types.ts
CHANGED
|
@@ -39,6 +39,21 @@ export type FileWrite = {
|
|
|
39
39
|
encoding?: "utf-8" | "base64";
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* `Cache-Control` every bucket upload must set. Object paths are content-hashed
|
|
44
|
+
* ("media/{hash}/original.mp4"), so a given URL's bytes never change — replacing
|
|
45
|
+
* a video mints a new hash and therefore a new URL. That makes `immutable` safe
|
|
46
|
+
* and a one-year max-age correct.
|
|
47
|
+
*
|
|
48
|
+
* This is NOT cosmetic. A bucket upload sent with no `cache-control` request
|
|
49
|
+
* header is stored as `no-cache`, which means neither the browser nor a CDN will
|
|
50
|
+
* ever reuse a response — every play of every video becomes origin egress,
|
|
51
|
+
* including a plain page reload. That default is what exhausted the Supabase
|
|
52
|
+
* project's egress quota while the bucket sat at 46% of its size limit. Any new
|
|
53
|
+
* upload path MUST send this header.
|
|
54
|
+
*/
|
|
55
|
+
export const ASSET_CACHE_CONTROL = "max-age=31536000, immutable";
|
|
56
|
+
|
|
42
57
|
/**
|
|
43
58
|
* Optional large-asset store (Supabase Storage bucket). Holds video originals
|
|
44
59
|
* too big for the git path; deliberately generic so future large kinds (zips)
|