@interdead/framework 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/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/browser/interdead-framework.global.js +319 -0
- package/dist/cjs/adapters/hugo-config-source-adapter.js +51 -0
- package/dist/cjs/adapters/hugo-config-source-adapter.js.map +1 -0
- package/dist/cjs/adapters/js-object-config-source-adapter.js +13 -0
- package/dist/cjs/adapters/js-object-config-source-adapter.js.map +1 -0
- package/dist/cjs/contracts/framework-config.js +3 -0
- package/dist/cjs/contracts/framework-config.js.map +1 -0
- package/dist/cjs/contracts/framework-feature.js +3 -0
- package/dist/cjs/contracts/framework-feature.js.map +1 -0
- package/dist/cjs/core/feature-registry.js +28 -0
- package/dist/cjs/core/feature-registry.js.map +1 -0
- package/dist/cjs/core/framework-runtime.js +64 -0
- package/dist/cjs/core/framework-runtime.js.map +1 -0
- package/dist/cjs/features/membrane/membrane-feature.js +87 -0
- package/dist/cjs/features/membrane/membrane-feature.js.map +1 -0
- package/dist/cjs/features/membrane/membrane-renderer.js +64 -0
- package/dist/cjs/features/membrane/membrane-renderer.js.map +1 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/ports/config-source-port.js +3 -0
- package/dist/cjs/ports/config-source-port.js.map +1 -0
- package/dist/esm/adapters/hugo-config-source-adapter.js +47 -0
- package/dist/esm/adapters/hugo-config-source-adapter.js.map +1 -0
- package/dist/esm/adapters/js-object-config-source-adapter.js +9 -0
- package/dist/esm/adapters/js-object-config-source-adapter.js.map +1 -0
- package/dist/esm/contracts/framework-config.js +2 -0
- package/dist/esm/contracts/framework-config.js.map +1 -0
- package/dist/esm/contracts/framework-feature.js +2 -0
- package/dist/esm/contracts/framework-feature.js.map +1 -0
- package/dist/esm/core/feature-registry.js +24 -0
- package/dist/esm/core/feature-registry.js.map +1 -0
- package/dist/esm/core/framework-runtime.js +59 -0
- package/dist/esm/core/framework-runtime.js.map +1 -0
- package/dist/esm/features/membrane/membrane-feature.js +83 -0
- package/dist/esm/features/membrane/membrane-feature.js.map +1 -0
- package/dist/esm/features/membrane/membrane-renderer.js +60 -0
- package/dist/esm/features/membrane/membrane-renderer.js.map +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/ports/config-source-port.js +2 -0
- package/dist/esm/ports/config-source-port.js.map +1 -0
- package/dist/types/adapters/hugo-config-source-adapter.d.ts +7 -0
- package/dist/types/adapters/js-object-config-source-adapter.d.ts +7 -0
- package/dist/types/contracts/framework-config.d.ts +21 -0
- package/dist/types/contracts/framework-feature.d.ts +7 -0
- package/dist/types/core/feature-registry.d.ts +7 -0
- package/dist/types/core/framework-runtime.d.ts +18 -0
- package/dist/types/features/membrane/membrane-feature.d.ts +21 -0
- package/dist/types/features/membrane/membrane-renderer.d.ts +15 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/ports/config-source-port.d.ts +4 -0
- package/package.json +51 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MembraneFeature = void 0;
|
|
4
|
+
const membrane_renderer_js_1 = require("./membrane-renderer.js");
|
|
5
|
+
class MembraneFeature {
|
|
6
|
+
constructor(windowRef = window, documentRef = document) {
|
|
7
|
+
this.windowRef = windowRef;
|
|
8
|
+
this.documentRef = documentRef;
|
|
9
|
+
this.key = "membrane";
|
|
10
|
+
this.animationFrame = 0;
|
|
11
|
+
this.canvas = null;
|
|
12
|
+
this.renderer = null;
|
|
13
|
+
this.boundInteractions = [];
|
|
14
|
+
this.config = {};
|
|
15
|
+
this.appliedBodyClass = null;
|
|
16
|
+
this.handleResize = () => {
|
|
17
|
+
this.renderer?.resize();
|
|
18
|
+
};
|
|
19
|
+
this.tick = () => {
|
|
20
|
+
this.animationFrame = this.windowRef.requestAnimationFrame(this.tick);
|
|
21
|
+
this.renderer?.draw(this.windowRef.performance.now(), this.config);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
mount() {
|
|
25
|
+
if (this.canvas) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.canvas = this.documentRef.createElement("canvas");
|
|
29
|
+
this.canvas.className = this.config.canvasClassName || "gm-membrane-canvas";
|
|
30
|
+
this.documentRef.body.appendChild(this.canvas);
|
|
31
|
+
this.renderer = new membrane_renderer_js_1.MembraneRenderer(this.canvas, this.windowRef);
|
|
32
|
+
this.windowRef.addEventListener("resize", this.handleResize);
|
|
33
|
+
this.bindInteractions();
|
|
34
|
+
this.appliedBodyClass = this.config.activeBodyClass || "gm-membrane-active";
|
|
35
|
+
this.documentRef.body.classList.add(this.appliedBodyClass);
|
|
36
|
+
this.tick();
|
|
37
|
+
}
|
|
38
|
+
updateConfig(config) {
|
|
39
|
+
this.config = config.featureOptions?.membrane || {};
|
|
40
|
+
}
|
|
41
|
+
destroy() {
|
|
42
|
+
if (this.animationFrame) {
|
|
43
|
+
this.windowRef.cancelAnimationFrame(this.animationFrame);
|
|
44
|
+
this.animationFrame = 0;
|
|
45
|
+
}
|
|
46
|
+
this.windowRef.removeEventListener("resize", this.handleResize);
|
|
47
|
+
this.unbindInteractions();
|
|
48
|
+
this.canvas?.remove();
|
|
49
|
+
this.canvas = null;
|
|
50
|
+
this.renderer = null;
|
|
51
|
+
if (this.appliedBodyClass) {
|
|
52
|
+
this.documentRef.body.classList.remove(this.appliedBodyClass);
|
|
53
|
+
this.appliedBodyClass = null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
bindInteractions() {
|
|
57
|
+
const selectors = this.config.interactionSelectors || [];
|
|
58
|
+
const uniqueNodes = new Set();
|
|
59
|
+
for (const selector of selectors) {
|
|
60
|
+
for (const node of this.documentRef.querySelectorAll(selector)) {
|
|
61
|
+
uniqueNodes.add(node);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (const node of uniqueNodes) {
|
|
65
|
+
const handler = () => {
|
|
66
|
+
const rect = node.getBoundingClientRect();
|
|
67
|
+
this.renderer?.triggerPulse((rect.left + rect.width * 0.5) / this.windowRef.innerWidth, (rect.top + rect.height * 0.5) / this.windowRef.innerHeight);
|
|
68
|
+
};
|
|
69
|
+
node.addEventListener("mouseenter", handler);
|
|
70
|
+
node.addEventListener("focus", handler);
|
|
71
|
+
node.addEventListener("click", handler);
|
|
72
|
+
node.addEventListener("touchstart", handler, { passive: true });
|
|
73
|
+
this.boundInteractions.push({ node, handler });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
unbindInteractions() {
|
|
77
|
+
for (const bound of this.boundInteractions) {
|
|
78
|
+
bound.node.removeEventListener("mouseenter", bound.handler);
|
|
79
|
+
bound.node.removeEventListener("focus", bound.handler);
|
|
80
|
+
bound.node.removeEventListener("click", bound.handler);
|
|
81
|
+
bound.node.removeEventListener("touchstart", bound.handler);
|
|
82
|
+
}
|
|
83
|
+
this.boundInteractions = [];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.MembraneFeature = MembraneFeature;
|
|
87
|
+
//# sourceMappingURL=membrane-feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"membrane-feature.js","sourceRoot":"","sources":["../../../../src/features/membrane/membrane-feature.ts"],"names":[],"mappings":";;;AAKA,iEAA0D;AAE1D,MAAa,eAAe;IAW1B,YACmB,YAAoB,MAAM,EAC1B,cAAwB,QAAQ;QADhC,cAAS,GAAT,SAAS,CAAiB;QAC1B,gBAAW,GAAX,WAAW,CAAqB;QAZ1C,QAAG,GAAG,UAAmB,CAAC;QAE3B,mBAAc,GAAG,CAAC,CAAC;QACnB,WAAM,GAA6B,IAAI,CAAC;QACxC,aAAQ,GAA4B,IAAI,CAAC;QACzC,sBAAiB,GACvB,EAAE,CAAC;QACG,WAAM,GAAmB,EAAE,CAAC;QAC5B,qBAAgB,GAAkB,IAAI,CAAC;QA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
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MembraneRenderer = void 0;
|
|
4
|
+
const DEFAULT_CONFIG = {
|
|
5
|
+
lineCount: 18,
|
|
6
|
+
lineColor: "rgba(138, 229, 144, 0.26)",
|
|
7
|
+
pulseColor: "rgba(198, 110, 72, 0.45)",
|
|
8
|
+
pulseDecay: 0.9,
|
|
9
|
+
amplitude: 5,
|
|
10
|
+
};
|
|
11
|
+
class MembraneRenderer {
|
|
12
|
+
constructor(canvas, windowRef) {
|
|
13
|
+
this.canvas = canvas;
|
|
14
|
+
this.windowRef = windowRef;
|
|
15
|
+
this.width = 0;
|
|
16
|
+
this.height = 0;
|
|
17
|
+
this.pulse = 0;
|
|
18
|
+
this.pulseX = 0.5;
|
|
19
|
+
this.pulseY = 0.5;
|
|
20
|
+
const context = this.canvas.getContext("2d");
|
|
21
|
+
if (!context) {
|
|
22
|
+
throw new Error("MembraneRenderer requires 2D canvas context.");
|
|
23
|
+
}
|
|
24
|
+
this.ctx = context;
|
|
25
|
+
this.resize();
|
|
26
|
+
}
|
|
27
|
+
resize() {
|
|
28
|
+
this.width = this.windowRef.innerWidth;
|
|
29
|
+
this.height = this.windowRef.innerHeight;
|
|
30
|
+
this.canvas.width = this.width;
|
|
31
|
+
this.canvas.height = this.height;
|
|
32
|
+
}
|
|
33
|
+
triggerPulse(xRatio, yRatio) {
|
|
34
|
+
this.pulse = 1;
|
|
35
|
+
this.pulseX = Math.min(1, Math.max(0, xRatio));
|
|
36
|
+
this.pulseY = Math.min(1, Math.max(0, yRatio));
|
|
37
|
+
}
|
|
38
|
+
draw(time, config = {}) {
|
|
39
|
+
const merged = { ...DEFAULT_CONFIG, ...config };
|
|
40
|
+
const { lineCount, lineColor, pulseColor, pulseDecay, amplitude } = merged;
|
|
41
|
+
this.pulse *= pulseDecay;
|
|
42
|
+
this.ctx.clearRect(0, 0, this.width, this.height);
|
|
43
|
+
const phase = time * 0.0012;
|
|
44
|
+
for (let index = 0; index < lineCount; index += 1) {
|
|
45
|
+
const y = ((index + 1) / (lineCount + 1)) * this.height;
|
|
46
|
+
const distance = Math.abs(y - this.height * this.pulseY) / this.height;
|
|
47
|
+
const pulseWeight = Math.max(0, 1 - distance * 3) * this.pulse;
|
|
48
|
+
const wobble = Math.sin(phase + index * 0.54) * amplitude * (0.3 + pulseWeight);
|
|
49
|
+
const gradient = this.ctx.createLinearGradient(0, y, this.width, y);
|
|
50
|
+
gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
|
|
51
|
+
gradient.addColorStop(0.5, pulseWeight > 0.01 ? pulseColor : lineColor);
|
|
52
|
+
gradient.addColorStop(1, "rgba(0, 0, 0, 0)");
|
|
53
|
+
this.ctx.strokeStyle = gradient;
|
|
54
|
+
this.ctx.lineWidth = 1 + pulseWeight * 2;
|
|
55
|
+
this.ctx.beginPath();
|
|
56
|
+
this.ctx.moveTo(0, y + wobble);
|
|
57
|
+
this.ctx.lineTo(this.width, y - wobble * 0.2);
|
|
58
|
+
this.ctx.stroke();
|
|
59
|
+
}
|
|
60
|
+
this.ctx.lineWidth = 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.MembraneRenderer = MembraneRenderer;
|
|
64
|
+
//# sourceMappingURL=membrane-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"membrane-renderer.js","sourceRoot":"","sources":["../../../../src/features/membrane/membrane-renderer.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAKhB;IACF,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,2BAA2B;IACtC,UAAU,EAAE,0BAA0B;IACtC,UAAU,EAAE,GAAG;IACf,SAAS,EAAE,CAAC;CACb,CAAC;AAEF,MAAa,gBAAgB;IAQ3B,YACmB,MAAyB,EACzB,SAAiB;QADjB,WAAM,GAAN,MAAM,CAAmB;QACzB,cAAS,GAAT,SAAS,CAAQ;QAR5B,UAAK,GAAG,CAAC,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7C,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,QAAQ,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC;YACzC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC;IACzB,CAAC;CACF;AAhED,4CAgEC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./contracts/framework-config.js"), exports);
|
|
18
|
+
__exportStar(require("./contracts/framework-feature.js"), exports);
|
|
19
|
+
__exportStar(require("./ports/config-source-port.js"), exports);
|
|
20
|
+
__exportStar(require("./adapters/js-object-config-source-adapter.js"), exports);
|
|
21
|
+
__exportStar(require("./adapters/hugo-config-source-adapter.js"), exports);
|
|
22
|
+
__exportStar(require("./features/membrane/membrane-feature.js"), exports);
|
|
23
|
+
__exportStar(require("./core/feature-registry.js"), exports);
|
|
24
|
+
__exportStar(require("./core/framework-runtime.js"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD;AAChD,mEAAiD;AACjD,gEAA8C;AAC9C,gFAA8D;AAC9D,2EAAyD;AACzD,0EAAwD;AACxD,6DAA2C;AAC3C,8DAA4C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-source-port.js","sourceRoot":"","sources":["../../../src/ports/config-source-port.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const DEFAULT_SELECTORS = [
|
|
2
|
+
"[data-modal-trigger]",
|
|
3
|
+
"[data-cta-anchor]",
|
|
4
|
+
"[data-auth-button]",
|
|
5
|
+
".gm-slider__arrow",
|
|
6
|
+
];
|
|
7
|
+
export class HugoConfigSourceAdapter {
|
|
8
|
+
constructor(documentRef = document) {
|
|
9
|
+
this.documentRef = documentRef;
|
|
10
|
+
}
|
|
11
|
+
load() {
|
|
12
|
+
const bodyMarker = this.documentRef.body?.hasAttribute("data-interdead-framework")
|
|
13
|
+
? this.documentRef.body
|
|
14
|
+
: null;
|
|
15
|
+
const marker = bodyMarker ||
|
|
16
|
+
this.documentRef.querySelector("[data-interdead-framework]");
|
|
17
|
+
if (!marker) {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
const membraneEnabled = marker.dataset.frameworkMembrane !== "false";
|
|
21
|
+
const selectors = marker.dataset.frameworkMembraneSelectors
|
|
22
|
+
? marker.dataset.frameworkMembraneSelectors
|
|
23
|
+
.split(",")
|
|
24
|
+
.map((item) => item.trim())
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
: DEFAULT_SELECTORS;
|
|
27
|
+
const membraneConfig = {
|
|
28
|
+
canvasClassName: marker.dataset.frameworkMembraneCanvasClass || "gm-membrane-canvas",
|
|
29
|
+
activeBodyClass: marker.dataset.frameworkMembraneActiveClass || "gm-membrane-active",
|
|
30
|
+
interactionSelectors: selectors,
|
|
31
|
+
reducedMotionMode: marker.dataset.frameworkReducedMotionMode === "disable"
|
|
32
|
+
? "disable"
|
|
33
|
+
: marker.dataset.frameworkReducedMotionMode === "full"
|
|
34
|
+
? "full"
|
|
35
|
+
: "minimal",
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
enabledFeatures: {
|
|
39
|
+
membrane: membraneEnabled,
|
|
40
|
+
},
|
|
41
|
+
featureOptions: {
|
|
42
|
+
membrane: membraneConfig,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=hugo-config-source-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hugo-config-source-adapter.js","sourceRoot":"","sources":["../../../src/adapters/hugo-config-source-adapter.ts"],"names":[],"mappings":"AAMA,MAAM,iBAAiB,GAAG;IACxB,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;CACpB,CAAC;AAEF,MAAM,OAAO,uBAAuB;IAClC,YAA6B,cAAwB,QAAQ;QAAhC,gBAAW,GAAX,WAAW,CAAqB;IAAG,CAAC;IAEjE,IAAI;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,YAAY,CACpD,0BAA0B,CAC3B;YACC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI;YACvB,CAAC,CAAC,IAAI,CAAC;QACT,MAAM,MAAM,GACV,UAAU;YACV,IAAI,CAAC,WAAW,CAAC,aAAa,CAAc,4BAA4B,CAAC,CAAC;QAE5E,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,KAAK,OAAO,CAAC;QACrE,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,0BAA0B;YACzD,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,0BAA0B;iBACtC,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBAC1B,MAAM,CAAC,OAAO,CAAC;YACpB,CAAC,CAAC,iBAAiB,CAAC;QAEtB,MAAM,cAAc,GAAmB;YACrC,eAAe,EACb,MAAM,CAAC,OAAO,CAAC,4BAA4B,IAAI,oBAAoB;YACrE,eAAe,EACb,MAAM,CAAC,OAAO,CAAC,4BAA4B,IAAI,oBAAoB;YACrE,oBAAoB,EAAE,SAAS;YAC/B,iBAAiB,EACf,MAAM,CAAC,OAAO,CAAC,0BAA0B,KAAK,SAAS;gBACrD,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,0BAA0B,KAAK,MAAM;oBACpD,CAAC,CAAC,MAAM;oBACR,CAAC,CAAC,SAAS;SAClB,CAAC;QAEF,OAAO;YACL,eAAe,EAAE;gBACf,QAAQ,EAAE,eAAe;aAC1B;YACD,cAAc,EAAE;gBACd,QAAQ,EAAE,cAAc;aACzB;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js-object-config-source-adapter.js","sourceRoot":"","sources":["../../../src/adapters/js-object-config-source-adapter.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,2BAA2B;IACtC,YAA6B,SAA0B,EAAE;QAA5B,WAAM,GAAN,MAAM,CAAsB;IAAG,CAAC;IAE7D,IAAI;QACF,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-config.js","sourceRoot":"","sources":["../../../src/contracts/framework-config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-feature.js","sourceRoot":"","sources":["../../../src/contracts/framework-feature.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class FeatureRegistry {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.factories = new Map();
|
|
4
|
+
}
|
|
5
|
+
register(key, factory) {
|
|
6
|
+
this.factories.set(key, factory);
|
|
7
|
+
}
|
|
8
|
+
createEnabled(config = {}) {
|
|
9
|
+
const features = [];
|
|
10
|
+
const keys = Object.keys(config);
|
|
11
|
+
for (const key of keys) {
|
|
12
|
+
if (!config[key]) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const factory = this.factories.get(key);
|
|
16
|
+
if (!factory) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
features.push(factory());
|
|
20
|
+
}
|
|
21
|
+
return features;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=feature-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-registry.js","sourceRoot":"","sources":["../../../src/core/feature-registry.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,eAAe;IAA5B;QACmB,cAAS,GAAG,IAAI,GAAG,EAGjC,CAAC;IAyBN,CAAC;IAvBC,QAAQ,CAAC,GAAwB,EAAE,OAA+B;QAChE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,aAAa,CAAC,SAAgC,EAAE;QAC9C,MAAM,QAAQ,GAAuB,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAA0B,CAAC;QAE1D,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjB,SAAS;YACX,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,SAAS;YACX,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3B,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { JsObjectConfigSourceAdapter } from "../adapters/js-object-config-source-adapter.js";
|
|
2
|
+
import { MembraneFeature } from "../features/membrane/membrane-feature.js";
|
|
3
|
+
import { FeatureRegistry } from "./feature-registry.js";
|
|
4
|
+
export class FrameworkRuntime {
|
|
5
|
+
constructor(configSource, options = {}) {
|
|
6
|
+
this.configSource = configSource;
|
|
7
|
+
this.options = options;
|
|
8
|
+
this.registry = new FeatureRegistry();
|
|
9
|
+
this.features = [];
|
|
10
|
+
this.config = {};
|
|
11
|
+
const windowRef = this.options.windowRef || window;
|
|
12
|
+
const documentRef = this.options.documentRef || document;
|
|
13
|
+
this.registry.register("membrane", () => new MembraneFeature(windowRef, documentRef));
|
|
14
|
+
}
|
|
15
|
+
boot() {
|
|
16
|
+
this.config = this.configSource.load();
|
|
17
|
+
const windowRef = this.options.windowRef || window;
|
|
18
|
+
const reducedMotionPreferred = windowRef.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches;
|
|
19
|
+
const reducedMode = this.config.featureOptions?.membrane?.reducedMotionMode || "minimal";
|
|
20
|
+
if (reducedMotionPreferred && reducedMode === "disable") {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (reducedMotionPreferred && reducedMode === "minimal") {
|
|
24
|
+
this.applyMinimalMembraneProfile();
|
|
25
|
+
}
|
|
26
|
+
const instances = this.registry.createEnabled(this.config.enabledFeatures || {});
|
|
27
|
+
this.features.push(...instances);
|
|
28
|
+
for (const feature of this.features) {
|
|
29
|
+
feature.updateConfig(this.config);
|
|
30
|
+
feature.mount();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
destroy() {
|
|
34
|
+
while (this.features.length > 0) {
|
|
35
|
+
const feature = this.features.pop();
|
|
36
|
+
feature?.destroy();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
applyMinimalMembraneProfile() {
|
|
40
|
+
const membraneConfig = this.config.featureOptions?.membrane || {};
|
|
41
|
+
const reducedConfig = {
|
|
42
|
+
...membraneConfig,
|
|
43
|
+
lineCount: Math.max(8, Math.round((membraneConfig.lineCount || 18) * 0.55)),
|
|
44
|
+
amplitude: (membraneConfig.amplitude || 5) * 0.45,
|
|
45
|
+
pulseDecay: Math.min(0.95, (membraneConfig.pulseDecay || 0.9) + 0.04),
|
|
46
|
+
};
|
|
47
|
+
this.config = {
|
|
48
|
+
...this.config,
|
|
49
|
+
featureOptions: {
|
|
50
|
+
...this.config.featureOptions,
|
|
51
|
+
membrane: reducedConfig,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function createInterdeadFramework(config = {}, options = {}) {
|
|
57
|
+
return new FrameworkRuntime(new JsObjectConfigSourceAdapter(config), options);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=framework-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-runtime.js","sourceRoot":"","sources":["../../../src/core/framework-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAM7F,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAAE,e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O,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { MembraneRenderer } from "./membrane-renderer.js";
|
|
2
|
+
export class MembraneFeature {
|
|
3
|
+
constructor(windowRef = window, documentRef = document) {
|
|
4
|
+
this.windowRef = windowRef;
|
|
5
|
+
this.documentRef = documentRef;
|
|
6
|
+
this.key = "membrane";
|
|
7
|
+
this.animationFrame = 0;
|
|
8
|
+
this.canvas = null;
|
|
9
|
+
this.renderer = null;
|
|
10
|
+
this.boundInteractions = [];
|
|
11
|
+
this.config = {};
|
|
12
|
+
this.appliedBodyClass = null;
|
|
13
|
+
this.handleResize = () => {
|
|
14
|
+
this.renderer?.resize();
|
|
15
|
+
};
|
|
16
|
+
this.tick = () => {
|
|
17
|
+
this.animationFrame = this.windowRef.requestAnimationFrame(this.tick);
|
|
18
|
+
this.renderer?.draw(this.windowRef.performance.now(), this.config);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
mount() {
|
|
22
|
+
if (this.canvas) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.canvas = this.documentRef.createElement("canvas");
|
|
26
|
+
this.canvas.className = this.config.canvasClassName || "gm-membrane-canvas";
|
|
27
|
+
this.documentRef.body.appendChild(this.canvas);
|
|
28
|
+
this.renderer = new MembraneRenderer(this.canvas, this.windowRef);
|
|
29
|
+
this.windowRef.addEventListener("resize", this.handleResize);
|
|
30
|
+
this.bindInteractions();
|
|
31
|
+
this.appliedBodyClass = this.config.activeBodyClass || "gm-membrane-active";
|
|
32
|
+
this.documentRef.body.classList.add(this.appliedBodyClass);
|
|
33
|
+
this.tick();
|
|
34
|
+
}
|
|
35
|
+
updateConfig(config) {
|
|
36
|
+
this.config = config.featureOptions?.membrane || {};
|
|
37
|
+
}
|
|
38
|
+
destroy() {
|
|
39
|
+
if (this.animationFrame) {
|
|
40
|
+
this.windowRef.cancelAnimationFrame(this.animationFrame);
|
|
41
|
+
this.animationFrame = 0;
|
|
42
|
+
}
|
|
43
|
+
this.windowRef.removeEventListener("resize", this.handleResize);
|
|
44
|
+
this.unbindInteractions();
|
|
45
|
+
this.canvas?.remove();
|
|
46
|
+
this.canvas = null;
|
|
47
|
+
this.renderer = null;
|
|
48
|
+
if (this.appliedBodyClass) {
|
|
49
|
+
this.documentRef.body.classList.remove(this.appliedBodyClass);
|
|
50
|
+
this.appliedBodyClass = null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
bindInteractions() {
|
|
54
|
+
const selectors = this.config.interactionSelectors || [];
|
|
55
|
+
const uniqueNodes = new Set();
|
|
56
|
+
for (const selector of selectors) {
|
|
57
|
+
for (const node of this.documentRef.querySelectorAll(selector)) {
|
|
58
|
+
uniqueNodes.add(node);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (const node of uniqueNodes) {
|
|
62
|
+
const handler = () => {
|
|
63
|
+
const rect = node.getBoundingClientRect();
|
|
64
|
+
this.renderer?.triggerPulse((rect.left + rect.width * 0.5) / this.windowRef.innerWidth, (rect.top + rect.height * 0.5) / this.windowRef.innerHeight);
|
|
65
|
+
};
|
|
66
|
+
node.addEventListener("mouseenter", handler);
|
|
67
|
+
node.addEventListener("focus", handler);
|
|
68
|
+
node.addEventListener("click", handler);
|
|
69
|
+
node.addEventListener("touchstart", handler, { passive: true });
|
|
70
|
+
this.boundInteractions.push({ node, handler });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
unbindInteractions() {
|
|
74
|
+
for (const bound of this.boundInteractions) {
|
|
75
|
+
bound.node.removeEventListener("mouseenter", bound.handler);
|
|
76
|
+
bound.node.removeEventListener("focus", bound.handler);
|
|
77
|
+
bound.node.removeEventListener("click", bound.handler);
|
|
78
|
+
bound.node.removeEventListener("touchstart", bound.handler);
|
|
79
|
+
}
|
|
80
|
+
this.boundInteractions = [];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=membrane-feature.js.map
|
|
@@ -0,0 +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AAM,KAAK,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3C,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5D,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const DEFAULT_CONFIG = {
|
|
2
|
+
lineCount: 18,
|
|
3
|
+
lineColor: "rgba(138, 229, 144, 0.26)",
|
|
4
|
+
pulseColor: "rgba(198, 110, 72, 0.45)",
|
|
5
|
+
pulseDecay: 0.9,
|
|
6
|
+
amplitude: 5,
|
|
7
|
+
};
|
|
8
|
+
export class MembraneRenderer {
|
|
9
|
+
constructor(canvas, windowRef) {
|
|
10
|
+
this.canvas = canvas;
|
|
11
|
+
this.windowRef = windowRef;
|
|
12
|
+
this.width = 0;
|
|
13
|
+
this.height = 0;
|
|
14
|
+
this.pulse = 0;
|
|
15
|
+
this.pulseX = 0.5;
|
|
16
|
+
this.pulseY = 0.5;
|
|
17
|
+
const context = this.canvas.getContext("2d");
|
|
18
|
+
if (!context) {
|
|
19
|
+
throw new Error("MembraneRenderer requires 2D canvas context.");
|
|
20
|
+
}
|
|
21
|
+
this.ctx = context;
|
|
22
|
+
this.resize();
|
|
23
|
+
}
|
|
24
|
+
resize() {
|
|
25
|
+
this.width = this.windowRef.innerWidth;
|
|
26
|
+
this.height = this.windowRef.innerHeight;
|
|
27
|
+
this.canvas.width = this.width;
|
|
28
|
+
this.canvas.height = this.height;
|
|
29
|
+
}
|
|
30
|
+
triggerPulse(xRatio, yRatio) {
|
|
31
|
+
this.pulse = 1;
|
|
32
|
+
this.pulseX = Math.min(1, Math.max(0, xRatio));
|
|
33
|
+
this.pulseY = Math.min(1, Math.max(0, yRatio));
|
|
34
|
+
}
|
|
35
|
+
draw(time, config = {}) {
|
|
36
|
+
const merged = { ...DEFAULT_CONFIG, ...config };
|
|
37
|
+
const { lineCount, lineColor, pulseColor, pulseDecay, amplitude } = merged;
|
|
38
|
+
this.pulse *= pulseDecay;
|
|
39
|
+
this.ctx.clearRect(0, 0, this.width, this.height);
|
|
40
|
+
const phase = time * 0.0012;
|
|
41
|
+
for (let index = 0; index < lineCount; index += 1) {
|
|
42
|
+
const y = ((index + 1) / (lineCount + 1)) * this.height;
|
|
43
|
+
const distance = Math.abs(y - this.height * this.pulseY) / this.height;
|
|
44
|
+
const pulseWeight = Math.max(0, 1 - distance * 3) * this.pulse;
|
|
45
|
+
const wobble = Math.sin(phase + index * 0.54) * amplitude * (0.3 + pulseWeight);
|
|
46
|
+
const gradient = this.ctx.createLinearGradient(0, y, this.width, y);
|
|
47
|
+
gradient.addColorStop(0, "rgba(0, 0, 0, 0)");
|
|
48
|
+
gradient.addColorStop(0.5, pulseWeight > 0.01 ? pulseColor : lineColor);
|
|
49
|
+
gradient.addColorStop(1, "rgba(0, 0, 0, 0)");
|
|
50
|
+
this.ctx.strokeStyle = gradient;
|
|
51
|
+
this.ctx.lineWidth = 1 + pulseWeight * 2;
|
|
52
|
+
this.ctx.beginPath();
|
|
53
|
+
this.ctx.moveTo(0, y + wobble);
|
|
54
|
+
this.ctx.lineTo(this.width, y - wobble * 0.2);
|
|
55
|
+
this.ctx.stroke();
|
|
56
|
+
}
|
|
57
|
+
this.ctx.lineWidth = 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=membrane-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACpE,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;YAC7C,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YACxE,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;YAE7C,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,QAAQ,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC;YACzC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./contracts/framework-config.js";
|
|
2
|
+
export * from "./contracts/framework-feature.js";
|
|
3
|
+
export * from "./ports/config-source-port.js";
|
|
4
|
+
export * from "./adapters/js-object-config-source-adapter.js";
|
|
5
|
+
export * from "./adapters/hugo-config-source-adapter.js";
|
|
6
|
+
export * from "./features/membrane/membrane-feature.js";
|
|
7
|
+
export * from "./core/feature-registry.js";
|
|
8
|
+
export * from "./core/framework-runtime.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-source-port.js","sourceRoot":"","sources":["../../../src/ports/config-source-port.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FrameworkConfig } from "../contracts/framework-config.js";
|
|
2
|
+
import type { ConfigSourcePort } from "../ports/config-source-port.js";
|
|
3
|
+
export declare class HugoConfigSourceAdapter implements ConfigSourcePort {
|
|
4
|
+
private readonly documentRef;
|
|
5
|
+
constructor(documentRef?: Document);
|
|
6
|
+
load(): FrameworkConfig;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FrameworkConfig } from "../contracts/framework-config.js";
|
|
2
|
+
import type { ConfigSourcePort } from "../ports/config-source-port.js";
|
|
3
|
+
export declare class JsObjectConfigSourceAdapter implements ConfigSourcePort {
|
|
4
|
+
private readonly config;
|
|
5
|
+
constructor(config?: FrameworkConfig);
|
|
6
|
+
load(): FrameworkConfig;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type FrameworkFeatureKey = "membrane";
|
|
2
|
+
export type ReducedMotionMode = "disable" | "minimal" | "full";
|
|
3
|
+
export interface MembraneConfig {
|
|
4
|
+
canvasClassName?: string;
|
|
5
|
+
activeBodyClass?: string;
|
|
6
|
+
interactionSelectors?: string[];
|
|
7
|
+
lineCount?: number;
|
|
8
|
+
lineColor?: string;
|
|
9
|
+
pulseColor?: string;
|
|
10
|
+
pulseDecay?: number;
|
|
11
|
+
amplitude?: number;
|
|
12
|
+
reducedMotionMode?: ReducedMotionMode;
|
|
13
|
+
}
|
|
14
|
+
export type FrameworkFeatureFlags = Partial<Record<FrameworkFeatureKey, boolean>>;
|
|
15
|
+
export interface FrameworkFeatureOptions {
|
|
16
|
+
membrane?: MembraneConfig;
|
|
17
|
+
}
|
|
18
|
+
export interface FrameworkConfig {
|
|
19
|
+
enabledFeatures?: FrameworkFeatureFlags;
|
|
20
|
+
featureOptions?: FrameworkFeatureOptions;
|
|
21
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FrameworkFeatureFlags, FrameworkFeatureKey } from "../contracts/framework-config.js";
|
|
2
|
+
import type { FrameworkFeature } from "../contracts/framework-feature.js";
|
|
3
|
+
export declare class FeatureRegistry {
|
|
4
|
+
private readonly factories;
|
|
5
|
+
register(key: FrameworkFeatureKey, factory: () => FrameworkFeature): void;
|
|
6
|
+
createEnabled(config?: FrameworkFeatureFlags): FrameworkFeature[];
|
|
7
|
+
}
|