textmode.overlay.js 1.0.0 → 1.0.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
var t="[textmode.overlay.js]",i=1e-8;function s(s){if(!s||"none"===s)return;const e=/^matrix\(([^)]+)\)$/.exec(s);if(e){const t=e[1].split(",").map(Number);if(6===t.length&&Math.abs(t[1])<=i&&Math.abs(t[2])<=i)return}const n=/^matrix3d\(([^)]+)\)$/.exec(s);if(n){const t=n[1].split(",").map(Number);if(16===t.length&&[1,2,3,4,6,7,8,9,11].every(s=>Math.abs(t[s])<=i))return}throw new Error(`${t} Rotated and skewed overlay targets are not supported.`)}function e(t){return Math.round(100*t)/100}var n=class{t;i;h;o;l;u;v=!0;m;p;_=!1;M;
|
|
1
|
+
var t="[textmode.overlay.js]",i=1e-8;function s(s){if(!s||"none"===s)return;const e=/^matrix\(([^)]+)\)$/.exec(s);if(e){const t=e[1].split(",").map(Number);if(6===t.length&&Math.abs(t[1])<=i&&Math.abs(t[2])<=i)return}const n=/^matrix3d\(([^)]+)\)$/.exec(s);if(n){const t=n[1].split(",").map(Number);if(16===t.length&&[1,2,3,4,6,7,8,9,11].every(s=>Math.abs(t[s])<=i))return}throw new Error(`${t} Rotated and skewed overlay targets are not supported.`)}function e(t){return Math.round(100*t)/100}var n=class{t;i;h;o;l;u;v=!0;m;p;_=!1;T;M;L=()=>this.request();constructor(t,i){var s;this.t=t,this.i=i,this.h=t.parentNode,this.o=t.nextSibling,this.l={position:(s=t).style.position,left:s.style.left,top:s.style.top,width:s.style.width,height:s.style.height,zIndex:s.style.zIndex,display:s.style.display,pointerEvents:s.style.pointerEvents}}bind(t,i){this.u=t,this.v=i,this.C()&&this.H(),this.request()}request(){this.u&&void 0===this.T&&(this.u.isConnected?this.T=window.requestAnimationFrame(()=>{this.T=void 0,this.O()}):this.S())}setVisible(t){this.v=t,t?(this.V("display",this.l.display),this.C(),this.request()):this.V("display","none")}clear(t){this.$(),this.N(),this.u=void 0,this.M=void 0,t.restoreCanvas&&this.j()}dispose(){this.clear({restoreCanvas:!0})}O(){const t=this.u;if(!t||!this.C())return;const i=function(t,i){s(getComputedStyle(t).transform);const n=t.getBoundingClientRect(),h=t instanceof HTMLCanvasElement?t.width:t.videoWidth,o=t instanceof HTMLCanvasElement?t.height:t.videoHeight,r=e(n.width>0?n.width:h),a=e(n.height>0?n.height:o);if(r<=0||a<=0)return;const d=function(t,i){const s=i.offsetParent;if(s instanceof HTMLElement&&s!==document.body&&s!==document.documentElement){const i=s.getBoundingClientRect();return{left:t.left-i.left+s.scrollLeft-s.clientLeft,top:t.top-i.top+s.scrollTop-s.clientTop}}return{left:t.left+window.scrollX,top:t.top+window.scrollY}}(n,i);return{left:e(d.left),top:e(d.top),width:r,height:a}}(t,this.t);if(!i||(h=i,(n=this.M)&&n.left===h.left&&n.top===h.top&&n.width===h.width&&n.height===h.height))return;var n,h;const o=this.M,r=!o||o.width!==i.width||o.height!==i.height;this.M=i,this.V("left",`${i.left}px`),this.V("top",`${i.top}px`),r&&this.i(i.width,i.height)}H(){const t=this.u;t&&!this._&&(this._=!0,"undefined"!=typeof ResizeObserver&&(this.m=new ResizeObserver(this.L),this.m.observe(t,{box:"border-box"})),window.addEventListener("resize",this.L),window.addEventListener("scroll",this.L,!0),t instanceof HTMLVideoElement&&(t.addEventListener("loadedmetadata",this.L),t.addEventListener("resize",this.L)))}C(){const t=this.u;if(!t)return!1;if(!t.isConnected||!t.parentNode)return this.S(),!1;this.p?.disconnect(),this.p=void 0,this.t.previousSibling===t&&this.t.parentNode===t.parentNode||t.parentNode.insertBefore(this.t,t.nextSibling);const i=Number.parseFloat(getComputedStyle(t).zIndex);return this.V("position","absolute"),this.V("zIndex",String((Number.isFinite(i)?i:0)+1)),this.V("pointerEvents","auto"),this.V("display",this.v?this.l.display:"none"),!0}S(){if(this.p||"undefined"==typeof MutationObserver)return;const t=document.documentElement;t&&(this.p=new MutationObserver(()=>{this.u?.isConnected&&(this.C()&&this.H(),this.request())}),this.p.observe(t,{childList:!0,subtree:!0}))}N(){this.m?.disconnect(),this.m=void 0,this.p?.disconnect(),this.p=void 0;const t=this.u;this._=!1,window.removeEventListener("resize",this.L),window.removeEventListener("scroll",this.L,!0),t instanceof HTMLVideoElement&&(t.removeEventListener("loadedmetadata",this.L),t.removeEventListener("resize",this.L))}$(){void 0!==this.T&&(window.cancelAnimationFrame(this.T),this.T=void 0)}j(){if(this.t.isConnected&&this.h){const t=this.o;this.h.insertBefore(this.t,t?.parentNode===this.h?t:null)}Object.assign(this.t.style,this.l)}V(t,i){this.t.style[t]!==i&&(this.t.style[t]=i)}},h=class{F;t;q;u;A;v=!0;R=!1;constructor(t){this.F=t,this.t=t.canvas,this.q=new n(this.t,(t,i)=>this.F.resizeCanvas(t,i))}get target(){return this.I(),this.u}get source(){return this.I(),this.A}setTarget(i){return this.I(),function(i,e){const n="undefined"!=typeof HTMLCanvasElement&&i instanceof HTMLCanvasElement,h="undefined"!=typeof HTMLVideoElement&&i instanceof HTMLVideoElement;if(!n&&!h)throw new TypeError(`${t} setTarget() requires an HTMLCanvasElement or HTMLVideoElement.`);if(i===e)throw new TypeError(`${t} The textmode output canvas cannot be used as its own overlay target.`);s(getComputedStyle(i).transform)}(i,this.t),i===this.u&&this.A?(this.requestSynchronization(),this.A):(this.P(!1),this.u=i,this.A=this.F.createTexture(i),this.q.bind(i,this.v),this.A)}clearTarget(){this.I(),this.P(!0)}show(){this.I(),this.v=!0,this.q.setVisible(!0)}hide(){this.I(),this.v&&(this.v=!1,this.q.setVisible(!1))}toggle(){this.I(),this.v?this.hide():this.show()}isVisible(){return this.I(),this.v}requestSynchronization(){this.I(),this.q.request()}dispose(){this.R||(this.P(!0),this.q.dispose(),this.R=!0)}I(){if(this.R)throw new Error("[textmode.overlay.js] This overlay controller has been disposed.")}P(t){this.q.clear({restoreCanvas:t}),this.A?.dispose(),this.A=void 0,this.u=void 0}},o={name:"textmode.overlay.js",install(t,i){const s=new h(t),e=i.on("postDraw",()=>s.requestSynchronization());try{i.defineExtension("textmodifier","overlay",{get:()=>s})}catch(n){throw s.dispose(),e(),n}return()=>{s.dispose(),e()}}};"undefined"!=typeof window&&(window.OverlayPlugin=o);export{o as OverlayPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).textmodeOverlay={})}(this,function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var i="[textmode.overlay.js]",e=1e-8;function s(t){if(!t||"none"===t)return;const s=/^matrix\(([^)]+)\)$/.exec(t);if(s){const t=s[1].split(",").map(Number);if(6===t.length&&Math.abs(t[1])<=e&&Math.abs(t[2])<=e)return}const n=/^matrix3d\(([^)]+)\)$/.exec(t);if(n){const t=n[1].split(",").map(Number);if(16===t.length&&[1,2,3,4,6,7,8,9,11].every(i=>Math.abs(t[i])<=e))return}throw new Error(`${i} Rotated and skewed overlay targets are not supported.`)}function n(t){return Math.round(100*t)/100}var o=class{t;i;o;h;l;u;v=!0;p;m;_=!1;T;M;L=()=>this.request();constructor(t,i){var e;this.t=t,this.i=i,this.o=t.parentNode,this.h=t.nextSibling,this.l={position:(e=t).style.position,left:e.style.left,top:e.style.top,width:e.style.width,height:e.style.height,zIndex:e.style.zIndex,display:e.style.display,pointerEvents:e.style.pointerEvents}}bind(t,i){this.u=t,this.v=i,this.C()&&this.H(),this.request()}request(){this.u&&void 0===this.T&&(this.u.isConnected?this.T=window.requestAnimationFrame(()=>{this.T=void 0,this.O()}):this.S())}setVisible(t){this.v=t,t?(this.V("display",this.l.display),this.C(),this.request()):this.V("display","none")}clear(t){this.$(),this.j(),this.u=void 0,this.M=void 0,t.restoreCanvas&&this.N()}dispose(){this.clear({restoreCanvas:!0})}O(){const t=this.u;if(!t||!this.C())return;const i=function(t,i){s(getComputedStyle(t).transform);const e=t.getBoundingClientRect(),o=t instanceof HTMLCanvasElement?t.width:t.videoWidth,h=t instanceof HTMLCanvasElement?t.height:t.videoHeight,r=n(e.width>0?e.width:o),a=n(e.height>0?e.height:h);if(r<=0||a<=0)return;const d=function(t,i){const e=i.offsetParent;if(e instanceof HTMLElement&&e!==document.body&&e!==document.documentElement){const i=e.getBoundingClientRect();return{left:t.left-i.left+e.scrollLeft-e.clientLeft,top:t.top-i.top+e.scrollTop-e.clientTop}}return{left:t.left+window.scrollX,top:t.top+window.scrollY}}(e,i);return{left:n(d.left),top:n(d.top),width:r,height:a}}(t,this.t);if(!i||(o=i,(e=this.M)&&e.left===o.left&&e.top===o.top&&e.width===o.width&&e.height===o.height))return;var e,o;const h=this.M,r=!h||h.width!==i.width||h.height!==i.height;this.M=i,this.V("left",`${i.left}px`),this.V("top",`${i.top}px`),r&&this.i(i.width,i.height)}H(){const t=this.u;t&&!this._&&(this._=!0,"undefined"!=typeof ResizeObserver&&(this.p=new ResizeObserver(this.L),this.p.observe(t,{box:"border-box"})),window.addEventListener("resize",this.L),window.addEventListener("scroll",this.L,!0),t instanceof HTMLVideoElement&&(t.addEventListener("loadedmetadata",this.L),t.addEventListener("resize",this.L)))}C(){const t=this.u;if(!t)return!1;if(!t.isConnected||!t.parentNode)return this.S(),!1;this.m?.disconnect(),this.m=void 0,this.t.previousSibling===t&&this.t.parentNode===t.parentNode||t.parentNode.insertBefore(this.t,t.nextSibling);const i=Number.parseFloat(getComputedStyle(t).zIndex);return this.V("position","absolute"),this.V("zIndex",String((Number.isFinite(i)?i:0)+1)),this.V("pointerEvents","auto"),this.V("display",this.v?this.l.display:"none"),!0}S(){if(this.m||"undefined"==typeof MutationObserver)return;const t=document.documentElement;t&&(this.m=new MutationObserver(()=>{this.u?.isConnected&&(this.C()&&this.H(),this.request())}),this.m.observe(t,{childList:!0,subtree:!0}))}j(){this.p?.disconnect(),this.p=void 0,this.m?.disconnect(),this.m=void 0;const t=this.u;this._=!1,window.removeEventListener("resize",this.L),window.removeEventListener("scroll",this.L,!0),t instanceof HTMLVideoElement&&(t.removeEventListener("loadedmetadata",this.L),t.removeEventListener("resize",this.L))}$(){void 0!==this.T&&(window.cancelAnimationFrame(this.T),this.T=void 0)}N(){if(this.t.isConnected&&this.o){const t=this.h;this.o.insertBefore(this.t,t?.parentNode===this.o?t:null)}Object.assign(this.t.style,this.l)}V(t,i){this.t.style[t]!==i&&(this.t.style[t]=i)}},h=class{F;t;q;u;A;v=!0;R=!1;constructor(t){this.F=t,this.t=t.canvas,this.q=new o(this.t,(t,i)=>this.F.resizeCanvas(t,i))}get target(){return this.
|
|
1
|
+
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).textmodeOverlay={})}(this,function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});var i="[textmode.overlay.js]",e=1e-8;function s(t){if(!t||"none"===t)return;const s=/^matrix\(([^)]+)\)$/.exec(t);if(s){const t=s[1].split(",").map(Number);if(6===t.length&&Math.abs(t[1])<=e&&Math.abs(t[2])<=e)return}const n=/^matrix3d\(([^)]+)\)$/.exec(t);if(n){const t=n[1].split(",").map(Number);if(16===t.length&&[1,2,3,4,6,7,8,9,11].every(i=>Math.abs(t[i])<=e))return}throw new Error(`${i} Rotated and skewed overlay targets are not supported.`)}function n(t){return Math.round(100*t)/100}var o=class{t;i;o;h;l;u;v=!0;p;m;_=!1;T;M;L=()=>this.request();constructor(t,i){var e;this.t=t,this.i=i,this.o=t.parentNode,this.h=t.nextSibling,this.l={position:(e=t).style.position,left:e.style.left,top:e.style.top,width:e.style.width,height:e.style.height,zIndex:e.style.zIndex,display:e.style.display,pointerEvents:e.style.pointerEvents}}bind(t,i){this.u=t,this.v=i,this.C()&&this.H(),this.request()}request(){this.u&&void 0===this.T&&(this.u.isConnected?this.T=window.requestAnimationFrame(()=>{this.T=void 0,this.O()}):this.S())}setVisible(t){this.v=t,t?(this.V("display",this.l.display),this.C(),this.request()):this.V("display","none")}clear(t){this.$(),this.j(),this.u=void 0,this.M=void 0,t.restoreCanvas&&this.N()}dispose(){this.clear({restoreCanvas:!0})}O(){const t=this.u;if(!t||!this.C())return;const i=function(t,i){s(getComputedStyle(t).transform);const e=t.getBoundingClientRect(),o=t instanceof HTMLCanvasElement?t.width:t.videoWidth,h=t instanceof HTMLCanvasElement?t.height:t.videoHeight,r=n(e.width>0?e.width:o),a=n(e.height>0?e.height:h);if(r<=0||a<=0)return;const d=function(t,i){const e=i.offsetParent;if(e instanceof HTMLElement&&e!==document.body&&e!==document.documentElement){const i=e.getBoundingClientRect();return{left:t.left-i.left+e.scrollLeft-e.clientLeft,top:t.top-i.top+e.scrollTop-e.clientTop}}return{left:t.left+window.scrollX,top:t.top+window.scrollY}}(e,i);return{left:n(d.left),top:n(d.top),width:r,height:a}}(t,this.t);if(!i||(o=i,(e=this.M)&&e.left===o.left&&e.top===o.top&&e.width===o.width&&e.height===o.height))return;var e,o;const h=this.M,r=!h||h.width!==i.width||h.height!==i.height;this.M=i,this.V("left",`${i.left}px`),this.V("top",`${i.top}px`),r&&this.i(i.width,i.height)}H(){const t=this.u;t&&!this._&&(this._=!0,"undefined"!=typeof ResizeObserver&&(this.p=new ResizeObserver(this.L),this.p.observe(t,{box:"border-box"})),window.addEventListener("resize",this.L),window.addEventListener("scroll",this.L,!0),t instanceof HTMLVideoElement&&(t.addEventListener("loadedmetadata",this.L),t.addEventListener("resize",this.L)))}C(){const t=this.u;if(!t)return!1;if(!t.isConnected||!t.parentNode)return this.S(),!1;this.m?.disconnect(),this.m=void 0,this.t.previousSibling===t&&this.t.parentNode===t.parentNode||t.parentNode.insertBefore(this.t,t.nextSibling);const i=Number.parseFloat(getComputedStyle(t).zIndex);return this.V("position","absolute"),this.V("zIndex",String((Number.isFinite(i)?i:0)+1)),this.V("pointerEvents","auto"),this.V("display",this.v?this.l.display:"none"),!0}S(){if(this.m||"undefined"==typeof MutationObserver)return;const t=document.documentElement;t&&(this.m=new MutationObserver(()=>{this.u?.isConnected&&(this.C()&&this.H(),this.request())}),this.m.observe(t,{childList:!0,subtree:!0}))}j(){this.p?.disconnect(),this.p=void 0,this.m?.disconnect(),this.m=void 0;const t=this.u;this._=!1,window.removeEventListener("resize",this.L),window.removeEventListener("scroll",this.L,!0),t instanceof HTMLVideoElement&&(t.removeEventListener("loadedmetadata",this.L),t.removeEventListener("resize",this.L))}$(){void 0!==this.T&&(window.cancelAnimationFrame(this.T),this.T=void 0)}N(){if(this.t.isConnected&&this.o){const t=this.h;this.o.insertBefore(this.t,t?.parentNode===this.o?t:null)}Object.assign(this.t.style,this.l)}V(t,i){this.t.style[t]!==i&&(this.t.style[t]=i)}},h=class{F;t;q;u;A;v=!0;R=!1;constructor(t){this.F=t,this.t=t.canvas,this.q=new o(this.t,(t,i)=>this.F.resizeCanvas(t,i))}get target(){return this.I(),this.u}get source(){return this.I(),this.A}setTarget(t){return this.I(),function(t,e){const n="undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement,o="undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement;if(!n&&!o)throw new TypeError(`${i} setTarget() requires an HTMLCanvasElement or HTMLVideoElement.`);if(t===e)throw new TypeError(`${i} The textmode output canvas cannot be used as its own overlay target.`);s(getComputedStyle(t).transform)}(t,this.t),t===this.u&&this.A?(this.requestSynchronization(),this.A):(this.P(!1),this.u=t,this.A=this.F.createTexture(t),this.q.bind(t,this.v),this.A)}clearTarget(){this.I(),this.P(!0)}show(){this.I(),this.v=!0,this.q.setVisible(!0)}hide(){this.I(),this.v&&(this.v=!1,this.q.setVisible(!1))}toggle(){this.I(),this.v?this.hide():this.show()}isVisible(){return this.I(),this.v}requestSynchronization(){this.I(),this.q.request()}dispose(){this.R||(this.P(!0),this.q.dispose(),this.R=!0)}I(){if(this.R)throw new Error("[textmode.overlay.js] This overlay controller has been disposed.")}P(t){this.q.clear({restoreCanvas:t}),this.A?.dispose(),this.A=void 0,this.u=void 0}},r={name:"textmode.overlay.js",install(t,i){const e=new h(t),s=i.on("postDraw",()=>e.requestSynchronization());try{i.defineExtension("textmodifier","overlay",{get:()=>e})}catch(n){throw e.dispose(),s(),n}return()=>{e.dispose(),s()}}};"undefined"!=typeof window&&(window.OverlayPlugin=r),t.OverlayPlugin=r});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @packageDocumentation
|
|
3
|
+
*
|
|
3
4
|
* DOM overlay target capture and geometry synchronization for textmode.js.
|
|
5
|
+
*
|
|
6
|
+
* ## Sketch workflow
|
|
7
|
+
*
|
|
8
|
+
* 1. Add {@link OverlayPlugin} to the sketch's plugins.
|
|
9
|
+
* 2. Bind a live canvas or video with `t.overlay.setTarget()`.
|
|
10
|
+
* 3. Shape the returned texture with the standard character, color, conversion,
|
|
11
|
+
* and transform settings.
|
|
12
|
+
* 4. Show, hide, or toggle the output canvas while drawing continues.
|
|
13
|
+
*
|
|
14
|
+
* @categoryDescription Workflow
|
|
15
|
+
* The plugin that installs the overlay controller on textmode.js layers.
|
|
16
|
+
*
|
|
17
|
+
* @categoryDescription Overlay controller
|
|
18
|
+
* The per-instance controller that samples a target and keeps the output aligned.
|
|
19
|
+
*
|
|
20
|
+
* @categoryDescription Target types
|
|
21
|
+
* The live browser media elements the overlay can sample.
|
|
22
|
+
*
|
|
23
|
+
* @showCategories
|
|
4
24
|
*/
|
|
5
25
|
import './augmentations';
|
|
6
26
|
export { OverlayPlugin } from './OverlayPlugin';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { TextmodeTexture } from 'textmode.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* A live browser media element that can be sampled by the overlay controller.
|
|
4
4
|
*
|
|
5
|
+
* @category Target types
|
|
6
|
+
*
|
|
5
7
|
* @see {@link https://code.textmode.art/api/textmode.overlay.js/type-aliases/TextmodeOverlayTarget | TextmodeOverlayTarget API reference}
|
|
6
8
|
*/
|
|
7
9
|
export type TextmodeOverlayTarget = HTMLCanvasElement | HTMLVideoElement;
|
|
@@ -11,24 +13,41 @@ export type TextmodeOverlayTarget = HTMLCanvasElement | HTMLVideoElement;
|
|
|
11
13
|
* The controller never owns the output canvas. Clearing or uninstalling the plugin
|
|
12
14
|
* restores the canvas to its original DOM location and inline styles.
|
|
13
15
|
*
|
|
16
|
+
* @category Overlay controller
|
|
17
|
+
*
|
|
18
|
+
* @categoryDescription Controller state
|
|
19
|
+
* The current sampled target, its configurable texture source, and output visibility state.
|
|
20
|
+
*
|
|
21
|
+
* @categoryDescription Target binding
|
|
22
|
+
* Attach a target to sample and release it to restore the output canvas.
|
|
23
|
+
*
|
|
24
|
+
* @categoryDescription Visibility
|
|
25
|
+
* Show, hide, and toggle only the output canvas while sampling continues.
|
|
26
|
+
*
|
|
14
27
|
* @see {@link https://code.textmode.art/api/textmode.overlay.js/interfaces/TextmodeOverlayController | TextmodeOverlayController API reference}
|
|
15
28
|
*/
|
|
16
29
|
export interface TextmodeOverlayController {
|
|
17
30
|
/**
|
|
18
31
|
* The currently sampled canvas or video.
|
|
19
32
|
*
|
|
33
|
+
* @category Controller state
|
|
34
|
+
*
|
|
20
35
|
* @see {@link https://code.textmode.art/api/textmode.overlay.js/interfaces/TextmodeOverlayController#target | TextmodeOverlayController.target API reference}
|
|
21
36
|
*/
|
|
22
37
|
readonly target: TextmodeOverlayTarget | undefined;
|
|
23
38
|
/**
|
|
24
39
|
* The configurable texture created from {@link target}.
|
|
25
40
|
*
|
|
41
|
+
* @category Controller state
|
|
42
|
+
*
|
|
26
43
|
* @see {@link https://code.textmode.art/api/textmode.overlay.js/interfaces/TextmodeOverlayController#source | TextmodeOverlayController.source API reference}
|
|
27
44
|
*/
|
|
28
45
|
readonly source: TextmodeTexture | undefined;
|
|
29
46
|
/**
|
|
30
47
|
* Sample a target and align the textmode output canvas above it.
|
|
31
48
|
*
|
|
49
|
+
* @category Target binding
|
|
50
|
+
*
|
|
32
51
|
* @param target Canvas or video to sample.
|
|
33
52
|
* @returns The configurable texture source.
|
|
34
53
|
*
|
|
@@ -44,6 +63,8 @@ export interface TextmodeOverlayController {
|
|
|
44
63
|
/**
|
|
45
64
|
* Stop sampling and restore the output canvas.
|
|
46
65
|
*
|
|
66
|
+
* @category Target binding
|
|
67
|
+
*
|
|
47
68
|
* @example
|
|
48
69
|
* ```ts
|
|
49
70
|
* t.overlay.clearTarget();
|
|
@@ -55,6 +76,8 @@ export interface TextmodeOverlayController {
|
|
|
55
76
|
/**
|
|
56
77
|
* Show the output canvas and request a fresh geometry synchronization.
|
|
57
78
|
*
|
|
79
|
+
* @category Visibility
|
|
80
|
+
*
|
|
58
81
|
* @example
|
|
59
82
|
* ```ts
|
|
60
83
|
* t.overlay.show();
|
|
@@ -66,6 +89,8 @@ export interface TextmodeOverlayController {
|
|
|
66
89
|
/**
|
|
67
90
|
* Hide only the output canvas. Sampling and sketch execution continue.
|
|
68
91
|
*
|
|
92
|
+
* @category Visibility
|
|
93
|
+
*
|
|
69
94
|
* @example
|
|
70
95
|
* ```ts
|
|
71
96
|
* t.overlay.hide();
|
|
@@ -77,6 +102,8 @@ export interface TextmodeOverlayController {
|
|
|
77
102
|
/**
|
|
78
103
|
* Toggle output-canvas visibility.
|
|
79
104
|
*
|
|
105
|
+
* @category Visibility
|
|
106
|
+
*
|
|
80
107
|
* @example
|
|
81
108
|
* ```ts
|
|
82
109
|
* t.overlay.toggle();
|
|
@@ -88,6 +115,8 @@ export interface TextmodeOverlayController {
|
|
|
88
115
|
/**
|
|
89
116
|
* Report the controller's intended output visibility.
|
|
90
117
|
*
|
|
118
|
+
* @category Visibility
|
|
119
|
+
*
|
|
91
120
|
* @returns Whether the output canvas is shown.
|
|
92
121
|
*
|
|
93
122
|
* @example
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textmode.overlay.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "DOM overlay target plugin for textmode.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"devEngines": {
|
|
@@ -60,16 +60,16 @@
|
|
|
60
60
|
"test:integration": "textmode-build test --project integration"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"textmode.js": "
|
|
63
|
+
"textmode.js": "^0.17.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@textmode/build": "^0.1.0",
|
|
67
67
|
"@textmode/docs": "^0.3.0",
|
|
68
68
|
"@textmode/lint": "^0.1.0",
|
|
69
|
-
"@textmode/release": "^0.
|
|
69
|
+
"@textmode/release": "^0.2.0",
|
|
70
70
|
"@textmode/tsconfig": "^0.2.0",
|
|
71
71
|
"@types/node": "^24.0.0",
|
|
72
|
-
"textmode.js": "
|
|
72
|
+
"textmode.js": "^0.17.2",
|
|
73
73
|
"typescript": "^6.0.3",
|
|
74
74
|
"vitest": "^4.1.10"
|
|
75
75
|
},
|