@buffcore/config 0.8.41 → 0.8.43
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/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/product.d.ts +12 -0
- package/dist/product.js +11 -0
- package/dist/scenes.d.ts +13 -3
- package/dist/scenes.js +10 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export type { AgentLimits } from './agents.ts';
|
|
|
2
2
|
export { type CoreEnv, coreEnvSchema, defineEnv, ENVIRONMENTS, EnvError, productionSetup, } from './env.ts';
|
|
3
3
|
export { isUploadKind, uploadKindsFit } from './extension-grants.ts';
|
|
4
4
|
export { type ContainerProcess, DEFAULT_PROCESS_SIZE, isContainer, type NodeProcess, type ProcessSize, type ProductProcess, } from './processes.ts';
|
|
5
|
-
export { CATALOG_KEY, type ConnectConfig, defineProduct, type ExtensionGrant, FEATURES, type Feature, isEnabled, LEAKED_PASSWORDS, type LeakedPasswords, OPERATOR_PASSKEYS, type OperatorPasskeys, PLATFORMS, type Platform, type ProductConfig, ProductConfigError, type SessionLength, SIGN_IN_METHODS, type SignInConfig, type SignInMethod, sessionHours, signInSettings, } from './product.ts';
|
|
6
|
-
export { defineScenes, type Flow, FRAME_SIZES, FRAMES, type Frame, type Scene, type SceneInput, type Scenes, ScenesError, type SceneViews, SURFACES, type Surface, sceneUrl, } from './scenes.ts';
|
|
5
|
+
export { CATALOG_KEY, type ConnectConfig, defineProduct, type ExtensionGrant, FEATURES, type Feature, isEnabled, LEAKED_PASSWORDS, type LeakedPasswords, OPERATOR_PASSKEYS, type OperatorPasskeys, PLATFORMS, type Platform, type ProductConfig, ProductConfigError, type PrototypeConfig, type SessionLength, SIGN_IN_METHODS, type SignInConfig, type SignInMethod, sessionHours, signInSettings, } from './product.ts';
|
|
6
|
+
export { defineScenes, type Flow, FRAME_SIZES, FRAMES, type Frame, type FrameSize, frameSizes, type Scene, type SceneInput, type Scenes, ScenesError, type SceneViews, SURFACES, type Surface, sceneUrl, } from './scenes.ts';
|
package/dist/index.js
CHANGED
|
@@ -2,4 +2,4 @@ export { coreEnvSchema, defineEnv, ENVIRONMENTS, EnvError, productionSetup, } fr
|
|
|
2
2
|
export { isUploadKind, uploadKindsFit } from './extension-grants.js';
|
|
3
3
|
export { DEFAULT_PROCESS_SIZE, isContainer, } from './processes.js';
|
|
4
4
|
export { CATALOG_KEY, defineProduct, FEATURES, isEnabled, LEAKED_PASSWORDS, OPERATOR_PASSKEYS, PLATFORMS, ProductConfigError, SIGN_IN_METHODS, sessionHours, signInSettings, } from './product.js';
|
|
5
|
-
export { defineScenes, FRAME_SIZES, FRAMES, ScenesError, SURFACES, sceneUrl, } from './scenes.js';
|
|
5
|
+
export { defineScenes, FRAME_SIZES, FRAMES, frameSizes, ScenesError, SURFACES, sceneUrl, } from './scenes.js';
|
package/dist/product.d.ts
CHANGED
|
@@ -186,6 +186,18 @@ export interface ProductConfig {
|
|
|
186
186
|
};
|
|
187
187
|
/** The limits for coding agents: what they may not read, what a person approves at merge (`agents.ts`). */
|
|
188
188
|
agents?: AgentLimits;
|
|
189
|
+
/** How the prototype shows its scenes (PROTOTYPE.md). */
|
|
190
|
+
prototype?: PrototypeConfig;
|
|
191
|
+
}
|
|
192
|
+
export interface PrototypeConfig {
|
|
193
|
+
/**
|
|
194
|
+
* The desktop scene frame in CSS pixels: what `ape prototype snapshot` shoots a `desktop` scene
|
|
195
|
+
* at, so the compare and the critique see it too. Default 1440 by 900.
|
|
196
|
+
*/
|
|
197
|
+
frame?: {
|
|
198
|
+
width: number;
|
|
199
|
+
height: number;
|
|
200
|
+
};
|
|
189
201
|
}
|
|
190
202
|
export interface ConnectConfig {
|
|
191
203
|
/**
|
package/dist/product.js
CHANGED
|
@@ -48,6 +48,16 @@ export const SIGN_IN_METHODS = ['password', 'email-code'];
|
|
|
48
48
|
export const LEAKED_PASSWORDS = ['refuse', 'warn', 'off'];
|
|
49
49
|
/** Operators' passkeys in the console: beside the password, or in its place (`SignInConfig`). */
|
|
50
50
|
export const OPERATOR_PASSKEYS = ['offer', 'require'];
|
|
51
|
+
/** A frame from 320 by 320 to 3840 by 2400 whole pixels. */
|
|
52
|
+
function prototypeProblems(prototype) {
|
|
53
|
+
const frame = prototype?.frame;
|
|
54
|
+
if (!frame)
|
|
55
|
+
return [];
|
|
56
|
+
const fits = (value, max) => Number.isInteger(value) && value >= 320 && value <= max;
|
|
57
|
+
return fits(frame.width, 3840) && fits(frame.height, 2400)
|
|
58
|
+
? []
|
|
59
|
+
: ['prototype.frame needs a whole width from 320 to 3840 and a height from 320 to 2400'];
|
|
60
|
+
}
|
|
51
61
|
function proxyProblems(value) {
|
|
52
62
|
if (value === undefined)
|
|
53
63
|
return [];
|
|
@@ -172,6 +182,7 @@ export function defineProduct(config) {
|
|
|
172
182
|
problems.push(...proxyProblems(config.trustedProxies));
|
|
173
183
|
if (config.agents)
|
|
174
184
|
problems.push(...agentProblems(config.agents));
|
|
185
|
+
problems.push(...prototypeProblems(config.prototype));
|
|
175
186
|
if (problems.length > 0) {
|
|
176
187
|
throw new ProductConfigError(`buffcore.config.ts:\n${problems.map((p) => ` ${p}`).join('\n')}`);
|
|
177
188
|
}
|
package/dist/scenes.d.ts
CHANGED
|
@@ -20,11 +20,21 @@ export type Surface = (typeof SURFACES)[number];
|
|
|
20
20
|
/** Where a scene shows: the app on a phone, a tablet or a desktop browser, or the admin console. */
|
|
21
21
|
export declare const FRAMES: readonly ['phone', 'tablet', 'desktop', 'admin'];
|
|
22
22
|
export type Frame = (typeof FRAMES)[number];
|
|
23
|
-
|
|
24
|
-
export declare const FRAME_SIZES: Record<Frame, {
|
|
23
|
+
export type FrameSize = {
|
|
25
24
|
width: number;
|
|
26
25
|
height: number;
|
|
27
|
-
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Each frame in CSS pixels: a common phone, tablet and desktop, and a usual console window. A
|
|
29
|
+
* product sets its own desktop frame (`prototype.frame` in `buffcore.config.ts`; `frameSizes`).
|
|
30
|
+
*/
|
|
31
|
+
export declare const FRAME_SIZES: Record<Frame, FrameSize>;
|
|
32
|
+
/** The frames a product's scenes show in: the presets, with its own desktop frame when it sets one. */
|
|
33
|
+
export declare function frameSizes(product?: {
|
|
34
|
+
prototype?: {
|
|
35
|
+
frame?: FrameSize;
|
|
36
|
+
};
|
|
37
|
+
}): Record<Frame, FrameSize>;
|
|
28
38
|
/**
|
|
29
39
|
* The bare page that shows one scene in a theme, mode and language, on its surface's server
|
|
30
40
|
* (`base` empty: the page's own): the viewer frames it, `ape prototype snapshot` screenshots it.
|
package/dist/scenes.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
export const SURFACES = ['app', 'admin'];
|
|
2
2
|
/** Where a scene shows: the app on a phone, a tablet or a desktop browser, or the admin console. */
|
|
3
3
|
export const FRAMES = ['phone', 'tablet', 'desktop', 'admin'];
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Each frame in CSS pixels: a common phone, tablet and desktop, and a usual console window. A
|
|
6
|
+
* product sets its own desktop frame (`prototype.frame` in `buffcore.config.ts`; `frameSizes`).
|
|
7
|
+
*/
|
|
5
8
|
export const FRAME_SIZES = {
|
|
6
9
|
phone: { width: 390, height: 844 },
|
|
7
10
|
tablet: { width: 820, height: 1180 },
|
|
8
|
-
desktop: { width:
|
|
11
|
+
desktop: { width: 1440, height: 900 },
|
|
9
12
|
admin: { width: 1440, height: 900 },
|
|
10
13
|
};
|
|
14
|
+
/** The frames a product's scenes show in: the presets, with its own desktop frame when it sets one. */
|
|
15
|
+
export function frameSizes(product) {
|
|
16
|
+
const desktop = product?.prototype?.frame;
|
|
17
|
+
return desktop ? { ...FRAME_SIZES, desktop: { ...desktop } } : FRAME_SIZES;
|
|
18
|
+
}
|
|
11
19
|
/**
|
|
12
20
|
* The bare page that shows one scene in a theme, mode and language, on its surface's server
|
|
13
21
|
* (`base` empty: the page's own): the viewer frames it, `ape prototype snapshot` screenshots it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buffcore/config",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.43",
|
|
4
4
|
"description": "TypeScript, Biome and Vitest presets, the environment schema helper and `defineProduct` for BuffCore products.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "BuffApe",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"zod": "4.6.5",
|
|
32
|
-
"@buffcore/tokens": "0.8.
|
|
32
|
+
"@buffcore/tokens": "0.8.43"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "node ../../scripts/build-package.mjs",
|