@neoloopy/cld-canvas 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/dist/engine/analysis.d.ts +15 -0
- package/dist/engine/analysis.js +30 -0
- package/dist/engine/engine.d.ts +203 -0
- package/dist/engine/engine.js +7 -0
- package/dist/engine/exporters.d.ts +45 -0
- package/dist/engine/exporters.js +110 -0
- package/dist/engine/layout.d.ts +19 -0
- package/dist/engine/layout.js +142 -0
- package/dist/engine/loopGraph.d.ts +51 -0
- package/dist/engine/loopGraph.js +0 -0
- package/dist/engine/loopKey.d.ts +24 -0
- package/dist/engine/loopKey.js +32 -0
- package/dist/engine/loopNote.d.ts +40 -0
- package/dist/engine/loopNote.js +130 -0
- package/dist/engine/nativeEngine.d.ts +175 -0
- package/dist/engine/nativeEngine.js +1120 -0
- package/dist/engine/noteCodec.d.ts +29 -0
- package/dist/engine/noteCodec.js +254 -0
- package/dist/engine/noteNaming.d.ts +18 -0
- package/dist/engine/noteNaming.js +28 -0
- package/dist/engine/specHash.d.ts +37 -0
- package/dist/engine/specHash.js +86 -0
- package/dist/engine/storage.d.ts +49 -0
- package/dist/engine/storage.js +116 -0
- package/dist/engine/subsystemLinks.d.ts +29 -0
- package/dist/engine/subsystemLinks.js +55 -0
- package/dist/engine/types.d.ts +103 -0
- package/dist/engine/types.js +155 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/view/camera.d.ts +42 -0
- package/dist/view/camera.js +75 -0
- package/dist/view/geometry.d.ts +83 -0
- package/dist/view/geometry.js +408 -0
- package/dist/view/painter.d.ts +63 -0
- package/dist/view/painter.js +471 -0
- package/dist/view/sceneCache.d.ts +61 -0
- package/dist/view/sceneCache.js +134 -0
- package/dist/view/theme.d.ts +57 -0
- package/dist/view/theme.js +90 -0
- package/package.json +17 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas color tokens — a direct port of `app/lib/theme/tokens.dart`
|
|
3
|
+
* (`LoopyTokens.light` / `.dark`). Teal = reinforcing (R), amber = balancing
|
|
4
|
+
* (B); violet (`live`) is the external-edit signal, plum (`claDepth`) is the
|
|
5
|
+
* CLA worldview/myth marker. The active set follows Obsidian's theme.
|
|
6
|
+
*/
|
|
7
|
+
export interface Theme {
|
|
8
|
+
dark: boolean;
|
|
9
|
+
paper: string;
|
|
10
|
+
surface: string;
|
|
11
|
+
surface2: string;
|
|
12
|
+
ink: string;
|
|
13
|
+
ink2: string;
|
|
14
|
+
ink3: string;
|
|
15
|
+
line: string;
|
|
16
|
+
line2: string;
|
|
17
|
+
graphite: string;
|
|
18
|
+
teal: string;
|
|
19
|
+
tealSoft: string;
|
|
20
|
+
tealInk: string;
|
|
21
|
+
amber: string;
|
|
22
|
+
amberSoft: string;
|
|
23
|
+
amberInk: string;
|
|
24
|
+
live: string;
|
|
25
|
+
liveSoft: string;
|
|
26
|
+
claDepth: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const LIGHT: Theme;
|
|
29
|
+
export declare const DARK: Theme;
|
|
30
|
+
/** Pick the token set matching the document's current theme. */
|
|
31
|
+
export declare function resolveTheme(): Theme;
|
|
32
|
+
/**
|
|
33
|
+
* Curated **group** palette — a direct port of `app/lib/theme/group_palette.dart`.
|
|
34
|
+
* Eight soft fills that tint a variable by the *part of the system* it belongs
|
|
35
|
+
* to. Every hue dodges the reserved bands (teal·R, amber·B, violet·live) so a
|
|
36
|
+
* tinted node can never be mistaken for a loop or a live edit. `name` is the
|
|
37
|
+
* controlled vocabulary stored on the node (lowercase), matching the app + MCP.
|
|
38
|
+
*/
|
|
39
|
+
export interface GroupSwatch {
|
|
40
|
+
name: string;
|
|
41
|
+
fillLight: string;
|
|
42
|
+
inkLight: string;
|
|
43
|
+
borderLight: string;
|
|
44
|
+
fillDark: string;
|
|
45
|
+
inkDark: string;
|
|
46
|
+
borderDark: string;
|
|
47
|
+
}
|
|
48
|
+
/** Ordered 8-slot palette. Slot order is part of the vocabulary's identity. */
|
|
49
|
+
export declare const GROUP_PALETTE: GroupSwatch[];
|
|
50
|
+
/** Look up a swatch by stored group name (case-insensitive); null = no group. */
|
|
51
|
+
export declare function groupSwatch(name?: string | null): GroupSwatch | null;
|
|
52
|
+
/** Resolve a swatch's fill/ink/border for the active theme. */
|
|
53
|
+
export declare function swatchFill(s: GroupSwatch, dark: boolean): string;
|
|
54
|
+
export declare function swatchInk(s: GroupSwatch, dark: boolean): string;
|
|
55
|
+
export declare function swatchBorder(s: GroupSwatch, dark: boolean): string;
|
|
56
|
+
/** "#RRGGBB" + alpha[0..1] -> "rgba(r,g,b,a)". */
|
|
57
|
+
export declare function withAlpha(hex: string, a: number): string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas color tokens — a direct port of `app/lib/theme/tokens.dart`
|
|
3
|
+
* (`LoopyTokens.light` / `.dark`). Teal = reinforcing (R), amber = balancing
|
|
4
|
+
* (B); violet (`live`) is the external-edit signal, plum (`claDepth`) is the
|
|
5
|
+
* CLA worldview/myth marker. The active set follows Obsidian's theme.
|
|
6
|
+
*/
|
|
7
|
+
export const LIGHT = {
|
|
8
|
+
dark: false,
|
|
9
|
+
paper: "#FBFAF7",
|
|
10
|
+
surface: "#FFFEFD",
|
|
11
|
+
surface2: "#F4F3F0",
|
|
12
|
+
ink: "#1F2329",
|
|
13
|
+
ink2: "#585B61",
|
|
14
|
+
ink3: "#6E7176",
|
|
15
|
+
line: "#E0E0DC",
|
|
16
|
+
line2: "#D0CFCB",
|
|
17
|
+
graphite: "#4A4D53",
|
|
18
|
+
teal: "#1C7E7E",
|
|
19
|
+
tealSoft: "#D7F4F3",
|
|
20
|
+
tealInk: "#005C5C",
|
|
21
|
+
amber: "#B07412",
|
|
22
|
+
amberSoft: "#FFEED3",
|
|
23
|
+
amberInk: "#965719",
|
|
24
|
+
live: "#756DCB",
|
|
25
|
+
liveSoft: "#EEEEFF",
|
|
26
|
+
claDepth: "#9B4FA6",
|
|
27
|
+
};
|
|
28
|
+
export const DARK = {
|
|
29
|
+
dark: true,
|
|
30
|
+
paper: "#14171D",
|
|
31
|
+
surface: "#1F2329",
|
|
32
|
+
surface2: "#0E1217",
|
|
33
|
+
ink: "#EBEDEF",
|
|
34
|
+
ink2: "#AEB1B6",
|
|
35
|
+
ink3: "#83868C",
|
|
36
|
+
line: "#32363C",
|
|
37
|
+
line2: "#43484F",
|
|
38
|
+
graphite: "#A0A5AC",
|
|
39
|
+
teal: "#44BCBC",
|
|
40
|
+
tealSoft: "#143D3C",
|
|
41
|
+
tealInk: "#72D0D0",
|
|
42
|
+
amber: "#EBAE51",
|
|
43
|
+
amberSoft: "#4C3211",
|
|
44
|
+
amberInk: "#F5C076",
|
|
45
|
+
live: "#9690F1",
|
|
46
|
+
liveSoft: "#33324E",
|
|
47
|
+
claDepth: "#C481D2",
|
|
48
|
+
};
|
|
49
|
+
/** Pick the token set matching the document's current theme. */
|
|
50
|
+
export function resolveTheme() {
|
|
51
|
+
const dark = typeof activeDocument !== "undefined" &&
|
|
52
|
+
activeDocument.body.classList.contains("theme-dark");
|
|
53
|
+
return dark ? DARK : LIGHT;
|
|
54
|
+
}
|
|
55
|
+
/** Ordered 8-slot palette. Slot order is part of the vocabulary's identity. */
|
|
56
|
+
export const GROUP_PALETTE = [
|
|
57
|
+
{ name: "rose", fillLight: "#FFE8E5", inkLight: "#883C38", borderLight: "#EDC2BD", fillDark: "#512E2B", inkDark: "#FAADA6", borderDark: "#764B47" },
|
|
58
|
+
{ name: "magenta", fillLight: "#FFE7F3", inkLight: "#803B5F", borderLight: "#E8C1D2", fillDark: "#4E2E3D", inkDark: "#F2ACCC", borderDark: "#724A5D" },
|
|
59
|
+
{ name: "orchid", fillLight: "#FBE9FE", inkLight: "#714179", borderLight: "#DEC3E2", fillDark: "#463049", inkDark: "#E1B1E8", borderDark: "#684D6C" },
|
|
60
|
+
{ name: "blue", fillLight: "#E1F2FF", inkLight: "#2A5790", borderLight: "#B8D0EF", fillDark: "#263A54", inkDark: "#9CC7FF", borderDark: "#415A79" },
|
|
61
|
+
{ name: "azure", fillLight: "#DAF5FF", inkLight: "#006084", borderLight: "#ADD5E8", fillDark: "#173E4E", inkDark: "#81D0F3", borderDark: "#305F72" },
|
|
62
|
+
{ name: "green", fillLight: "#E1F7E4", inkLight: "#206635", borderLight: "#B8D8BD", fillDark: "#24412B", inkDark: "#99D5A5", borderDark: "#3F6246" },
|
|
63
|
+
{ name: "fern", fillLight: "#E9F5DD", inkLight: "#456117", borderLight: "#C4D5B2", fillDark: "#313E20", inkDark: "#B3D08F", borderDark: "#4E5F3A" },
|
|
64
|
+
{ name: "lime", fillLight: "#F2F2D8", inkLight: "#5D5A00", borderLight: "#D0D1AB", fillDark: "#3C3B19", inkDark: "#C9C982", borderDark: "#5B5B32" },
|
|
65
|
+
];
|
|
66
|
+
/** Look up a swatch by stored group name (case-insensitive); null = no group. */
|
|
67
|
+
export function groupSwatch(name) {
|
|
68
|
+
if (!name)
|
|
69
|
+
return null;
|
|
70
|
+
const k = name.toLowerCase();
|
|
71
|
+
return GROUP_PALETTE.find((g) => g.name === k) ?? null;
|
|
72
|
+
}
|
|
73
|
+
/** Resolve a swatch's fill/ink/border for the active theme. */
|
|
74
|
+
export function swatchFill(s, dark) {
|
|
75
|
+
return dark ? s.fillDark : s.fillLight;
|
|
76
|
+
}
|
|
77
|
+
export function swatchInk(s, dark) {
|
|
78
|
+
return dark ? s.inkDark : s.inkLight;
|
|
79
|
+
}
|
|
80
|
+
export function swatchBorder(s, dark) {
|
|
81
|
+
return dark ? s.borderDark : s.borderLight;
|
|
82
|
+
}
|
|
83
|
+
/** "#RRGGBB" + alpha[0..1] -> "rgba(r,g,b,a)". */
|
|
84
|
+
export function withAlpha(hex, a) {
|
|
85
|
+
const h = hex.replace("#", "");
|
|
86
|
+
const r = parseInt(h.substring(0, 2), 16);
|
|
87
|
+
const g = parseInt(h.substring(2, 4), 16);
|
|
88
|
+
const b = parseInt(h.substring(4, 6), 16);
|
|
89
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
90
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neoloopy/cld-canvas",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Framework-agnostic CLD canvas renderer + in-memory edit engine (shared by the neoloopy Obsidian plugin and neoloopy.com).",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } },
|
|
11
|
+
"files": ["dist"],
|
|
12
|
+
"publishConfig": { "access": "public" },
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.json",
|
|
15
|
+
"prepublishOnly": "tsc -p tsconfig.json"
|
|
16
|
+
}
|
|
17
|
+
}
|