beam-alpha 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -0
- package/bin/blueprint.mjs +7 -0
- package/dist/beam.js +3272 -0
- package/dist/canvas/assets/AzeretMono-C5fM7CrN.woff2 +0 -0
- package/dist/canvas/assets/OpenRunde-Bold-DS-_1xH5.woff2 +0 -0
- package/dist/canvas/assets/OpenRunde-Medium-Krf-ZDqK.woff2 +0 -0
- package/dist/canvas/assets/OpenRunde-Regular-BZVnpUN1.woff2 +0 -0
- package/dist/canvas/assets/OpenRunde-Semibold-Nru5tuSm.woff2 +0 -0
- package/dist/canvas/assets/index-BIsbDeNY.css +1 -0
- package/dist/canvas/assets/index.embed-CE8oqNgH.js +230 -0
- package/dist/canvas/index.html +16 -0
- package/dist/cli.js +678 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +8663 -0
- package/dist/next/pin-loader.cjs +120 -0
- package/dist/next/source-loader.cjs +137 -0
- package/dist/next.d.ts +60 -0
- package/dist/next.js +8896 -0
- package/dist/overlay/overlay.css +1 -0
- package/dist/overlay/overlay.js +219 -0
- package/dist/probe.js +3084 -0
- package/dist/runtime/core.d.ts +43 -0
- package/dist/runtime/core.js +36 -0
- package/dist/runtime/core.prod.js +19 -0
- package/dist/runtime/react.d.ts +16 -0
- package/dist/runtime/react.js +48 -0
- package/dist/runtime/react.prod.js +17 -0
- package/package.json +67 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Public types for `@blueprint/dev/runtime` — see types/index.d.ts's note. */
|
|
2
|
+
|
|
3
|
+
export type ParamValue = number | string | boolean | [number, number] | [number, number, number, number]
|
|
4
|
+
|
|
5
|
+
export interface DeclareOptions {
|
|
6
|
+
label?: string
|
|
7
|
+
/** Panel section; defaults from the name (`orbit.speed` → "Orbit"). */
|
|
8
|
+
group?: string
|
|
9
|
+
min?: number
|
|
10
|
+
max?: number
|
|
11
|
+
step?: number
|
|
12
|
+
unit?: 'ms' | 's' | 'px' | 'rem' | 'em' | '%' | 'vh' | 'vw' | 'vmin' | 'vmax' | 'ch' | 'ex' | 'pt' | 'pc' | 'cm' | 'mm' | 'in' | 'fr' | 'deg' | 'rad' | 'turn'
|
|
13
|
+
/** Enum choices; their presence renders a segmented/select control. */
|
|
14
|
+
options?: string[]
|
|
15
|
+
/**
|
|
16
|
+
* Only where the fallback alone can't say which control this is: a string
|
|
17
|
+
* may be a `color`, a `font` family, or plain `text`; a 2-array is a
|
|
18
|
+
* `vector2` unless declared a `spring`; a 4-array is a `bezier` unless
|
|
19
|
+
* declared a `box`.
|
|
20
|
+
*/
|
|
21
|
+
kind?: 'color' | 'text' | 'font' | 'spring' | 'vector2' | 'box'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Declare a tunable and get its reader. Reading is total: with Blueprint
|
|
26
|
+
* absent, attached-but-untouched, or holding before/after, the answer is the
|
|
27
|
+
* page's own `fallback`. In production builds this resolves to an inert
|
|
28
|
+
* passthrough.
|
|
29
|
+
*/
|
|
30
|
+
export declare function declareParam<T extends ParamValue>(
|
|
31
|
+
name: string,
|
|
32
|
+
fallback: T,
|
|
33
|
+
options?: DeclareOptions
|
|
34
|
+
): () => T
|
|
35
|
+
|
|
36
|
+
/** One read of a declared parameter's current value. */
|
|
37
|
+
export declare function readParam<T extends ParamValue>(name: string, fallback: T): T
|
|
38
|
+
|
|
39
|
+
/** Register a declaration without reading. Idempotent per shape. */
|
|
40
|
+
export declare function register(name: string, fallback: ParamValue, options?: DeclareOptions): void
|
|
41
|
+
|
|
42
|
+
/** Run `fn` whenever Blueprint pushes values; returns an unsubscribe. */
|
|
43
|
+
export declare function onParams(fn: () => void): () => void
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// runtime/core.ts
|
|
2
|
+
function declareParam(name, fallback, options) {
|
|
3
|
+
register(name, fallback, options);
|
|
4
|
+
return () => readParam(name, fallback);
|
|
5
|
+
}
|
|
6
|
+
function readParam(name, fallback) {
|
|
7
|
+
if (typeof window === "undefined") return fallback;
|
|
8
|
+
const params = window.__bpParams;
|
|
9
|
+
return params ? params.get(name, fallback) : fallback;
|
|
10
|
+
}
|
|
11
|
+
function register(name, fallback, options) {
|
|
12
|
+
if (typeof window === "undefined") return;
|
|
13
|
+
const reg = window.__bpDecl ??= { params: {}, rev: 0 };
|
|
14
|
+
const entry = { name, fallback, ...options };
|
|
15
|
+
const previous = reg.params[name];
|
|
16
|
+
if (previous && JSON.stringify(previous) === JSON.stringify(entry)) return;
|
|
17
|
+
reg.params[name] = entry;
|
|
18
|
+
reg.rev++;
|
|
19
|
+
try {
|
|
20
|
+
window.dispatchEvent(new CustomEvent("bp:declare", { detail: { name } }));
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function onParams(fn) {
|
|
25
|
+
if (typeof window === "undefined") return () => {
|
|
26
|
+
};
|
|
27
|
+
const handler = () => fn();
|
|
28
|
+
window.addEventListener("bp:params", handler);
|
|
29
|
+
return () => window.removeEventListener("bp:params", handler);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
declareParam,
|
|
33
|
+
onParams,
|
|
34
|
+
readParam,
|
|
35
|
+
register
|
|
36
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// runtime/core.prod.ts
|
|
2
|
+
function declareParam(_name, fallback, _options) {
|
|
3
|
+
return () => fallback;
|
|
4
|
+
}
|
|
5
|
+
function readParam(_name, fallback) {
|
|
6
|
+
return fallback;
|
|
7
|
+
}
|
|
8
|
+
function register(_name, _fallback, _options) {
|
|
9
|
+
}
|
|
10
|
+
function onParams(_fn) {
|
|
11
|
+
return () => {
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
declareParam,
|
|
16
|
+
onParams,
|
|
17
|
+
readParam,
|
|
18
|
+
register
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Public types for `@blueprint/dev/react` — see types/index.d.ts's note. */
|
|
2
|
+
import type { DeclareOptions, ParamValue } from './core'
|
|
3
|
+
|
|
4
|
+
export type { DeclareOptions, ParamValue }
|
|
5
|
+
export { declareParam, readParam } from './core'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Declare a tunable and subscribe: the component re-renders when Blueprint
|
|
9
|
+
* pushes a value. In production builds this resolves to a passthrough that
|
|
10
|
+
* returns `fallback` and doesn't import React.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useParam<T extends ParamValue>(
|
|
13
|
+
name: string,
|
|
14
|
+
fallback: T,
|
|
15
|
+
options?: DeclareOptions
|
|
16
|
+
): T
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// runtime/react.ts
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
|
|
4
|
+
// runtime/core.ts
|
|
5
|
+
function declareParam(name, fallback, options) {
|
|
6
|
+
register(name, fallback, options);
|
|
7
|
+
return () => readParam(name, fallback);
|
|
8
|
+
}
|
|
9
|
+
function readParam(name, fallback) {
|
|
10
|
+
if (typeof window === "undefined") return fallback;
|
|
11
|
+
const params = window.__bpParams;
|
|
12
|
+
return params ? params.get(name, fallback) : fallback;
|
|
13
|
+
}
|
|
14
|
+
function register(name, fallback, options) {
|
|
15
|
+
if (typeof window === "undefined") return;
|
|
16
|
+
const reg = window.__bpDecl ??= { params: {}, rev: 0 };
|
|
17
|
+
const entry = { name, fallback, ...options };
|
|
18
|
+
const previous = reg.params[name];
|
|
19
|
+
if (previous && JSON.stringify(previous) === JSON.stringify(entry)) return;
|
|
20
|
+
reg.params[name] = entry;
|
|
21
|
+
reg.rev++;
|
|
22
|
+
try {
|
|
23
|
+
window.dispatchEvent(new CustomEvent("bp:declare", { detail: { name } }));
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function onParams(fn) {
|
|
28
|
+
if (typeof window === "undefined") return () => {
|
|
29
|
+
};
|
|
30
|
+
const handler = () => fn();
|
|
31
|
+
window.addEventListener("bp:params", handler);
|
|
32
|
+
return () => window.removeEventListener("bp:params", handler);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// runtime/react.ts
|
|
36
|
+
function useParam(name, fallback, options) {
|
|
37
|
+
register(name, fallback, options);
|
|
38
|
+
return useSyncExternalStore(
|
|
39
|
+
onParams,
|
|
40
|
+
() => readParam(name, fallback),
|
|
41
|
+
() => fallback
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
declareParam,
|
|
46
|
+
readParam,
|
|
47
|
+
useParam
|
|
48
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// runtime/core.prod.ts
|
|
2
|
+
function declareParam(_name, fallback, _options) {
|
|
3
|
+
return () => fallback;
|
|
4
|
+
}
|
|
5
|
+
function readParam(_name, fallback) {
|
|
6
|
+
return fallback;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// runtime/react.prod.ts
|
|
10
|
+
function useParam(_name, fallback, _options) {
|
|
11
|
+
return fallback;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
declareParam,
|
|
15
|
+
readParam,
|
|
16
|
+
useParam
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "beam-alpha",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Blueprint in your own dev server: add the Vite plugin or the Next.js host, open /__blueprint.",
|
|
5
|
+
"license": "PolyForm-Shield-1.0.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/cronjob4/beam.git",
|
|
9
|
+
"directory": "packages/dev"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"bin": {
|
|
15
|
+
"blueprint": "./bin/blueprint.mjs"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./next": {
|
|
23
|
+
"types": "./dist/next.d.ts",
|
|
24
|
+
"default": "./dist/next.js"
|
|
25
|
+
},
|
|
26
|
+
"./runtime": {
|
|
27
|
+
"types": "./dist/runtime/core.d.ts",
|
|
28
|
+
"development": "./dist/runtime/core.js",
|
|
29
|
+
"default": "./dist/runtime/core.prod.js"
|
|
30
|
+
},
|
|
31
|
+
"./react": {
|
|
32
|
+
"types": "./dist/runtime/react.d.ts",
|
|
33
|
+
"development": "./dist/runtime/react.js",
|
|
34
|
+
"default": "./dist/runtime/react.prod.js"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"bin",
|
|
41
|
+
"README.md"
|
|
42
|
+
],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@babel/parser": "^7.28.0",
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
46
|
+
"magic-string": "^0.30.17",
|
|
47
|
+
"postcss": "^8.5.0",
|
|
48
|
+
"postcss-selector-parser": "^7.1.0",
|
|
49
|
+
"zod": "^4.4.3"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"next": ">=16",
|
|
53
|
+
"react": ">=18",
|
|
54
|
+
"vite": ">=5"
|
|
55
|
+
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"next": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"react": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"vite": {
|
|
64
|
+
"optional": true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|