@preprio/prepr-nextjs 1.3.2 → 2.0.0-alpha.5
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 +2 -2
- package/dist/chunk-E7ATRJ2F.js +2 -0
- package/dist/chunk-E7ATRJ2F.js.map +1 -0
- package/dist/index.css +1 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/middleware/index.cjs +2 -0
- package/dist/middleware/index.cjs.map +1 -0
- package/dist/middleware/index.d.cts +10 -0
- package/dist/middleware/index.d.ts +10 -0
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/react/index.cjs +3 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +42 -0
- package/dist/react/index.d.ts +42 -0
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -0
- package/dist/server/index.cjs +7 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/{index.d.mts → server/index.d.cts} +6 -17
- package/dist/{index.d.ts → server/index.d.ts} +6 -17
- package/dist/server/index.js +7 -0
- package/dist/server/index.js.map +1 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +14 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.cjs +2 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +138 -0
- package/dist/utils/index.d.ts +138 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +104 -59
- package/dist/chunk-IQXHJV5O.mjs +0 -25
- package/dist/chunk-IQXHJV5O.mjs.map +0 -1
- package/dist/components.css +0 -430
- package/dist/components.css.map +0 -1
- package/dist/components.d.mts +0 -10
- package/dist/components.d.ts +0 -10
- package/dist/components.js +0 -415
- package/dist/components.js.map +0 -1
- package/dist/components.mjs +0 -388
- package/dist/components.mjs.map +0 -1
- package/dist/index.js +0 -325
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -279
- package/dist/index.mjs.map +0 -1
- package/dist/types-DmITW6Tn.d.mts +0 -6
- package/dist/types-DmITW6Tn.d.ts +0 -6
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
|
|
3
|
+
declare const StegaError: {
|
|
4
|
+
readonly DECODE_FAILED: "STEGA_DECODE_FAILED";
|
|
5
|
+
readonly INVALID_FORMAT: "STEGA_INVALID_FORMAT";
|
|
6
|
+
readonly DOM_MANIPULATION_FAILED: "DOM_MANIPULATION_FAILED";
|
|
7
|
+
readonly CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND";
|
|
8
|
+
};
|
|
9
|
+
type StegaErrorType = (typeof StegaError)[keyof typeof StegaError];
|
|
10
|
+
interface ErrorAdditionalData {
|
|
11
|
+
input?: string;
|
|
12
|
+
element?: HTMLElement;
|
|
13
|
+
context?: string;
|
|
14
|
+
[key: string]: string | HTMLElement | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface ErrorInfo {
|
|
17
|
+
type: StegaErrorType;
|
|
18
|
+
context: string;
|
|
19
|
+
message: string;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
stack?: string;
|
|
22
|
+
additionalData?: ErrorAdditionalData;
|
|
23
|
+
}
|
|
24
|
+
declare function createErrorInfo(type: StegaErrorType, context: string, error: Error, additionalData?: ErrorAdditionalData): ErrorInfo;
|
|
25
|
+
declare function handleStegaError(error: Error, context: string, additionalData?: ErrorAdditionalData): ErrorInfo;
|
|
26
|
+
declare function handleDOMError(error: Error, context: string): ErrorInfo;
|
|
27
|
+
declare function handleContextError(contextName: string): void;
|
|
28
|
+
|
|
29
|
+
declare class DOMService {
|
|
30
|
+
/**
|
|
31
|
+
* Creates an HTML element with specified tag and class name
|
|
32
|
+
*/
|
|
33
|
+
static createElement(tag: string, className: string): HTMLElement;
|
|
34
|
+
/**
|
|
35
|
+
* Appends an element to the document body
|
|
36
|
+
*/
|
|
37
|
+
static appendToBody(element: HTMLElement): void;
|
|
38
|
+
/**
|
|
39
|
+
* Removes an element from the document body
|
|
40
|
+
*/
|
|
41
|
+
static removeFromBody(element: HTMLElement): void;
|
|
42
|
+
/**
|
|
43
|
+
* Sets multiple CSS properties on an element
|
|
44
|
+
*/
|
|
45
|
+
static setElementStyles(element: HTMLElement, styles: Record<string, string>): void;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the bounding rectangle of an element
|
|
48
|
+
*/
|
|
49
|
+
static getElementRect(element: HTMLElement): DOMRect;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if an element is in the viewport
|
|
52
|
+
*/
|
|
53
|
+
static isElementInViewport(element: HTMLElement): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Calculates distance between two points
|
|
56
|
+
*/
|
|
57
|
+
static calculateDistance(x1: number, y1: number, x2: number, y2: number): number;
|
|
58
|
+
/**
|
|
59
|
+
* Finds the closest element to a point from a list of elements
|
|
60
|
+
*/
|
|
61
|
+
static findClosestElement(pointX: number, pointY: number, elements: NodeListOf<Element>): HTMLElement | null;
|
|
62
|
+
/**
|
|
63
|
+
* Safely adds event listeners
|
|
64
|
+
*/
|
|
65
|
+
static addEventListener(element: EventTarget, event: string, handler: EventListener, options?: AddEventListenerOptions): void;
|
|
66
|
+
/**
|
|
67
|
+
* Safely removes event listeners
|
|
68
|
+
*/
|
|
69
|
+
static removeEventListener(element: EventTarget, event: string, handler: EventListener, options?: EventListenerOptions): void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Debug utility for Prepr Next.js package
|
|
74
|
+
* Provides centralized debug logging with performance optimizations
|
|
75
|
+
*/
|
|
76
|
+
type DebugArg = string | number | boolean | null | undefined | object;
|
|
77
|
+
interface DebugOptions {
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
prefix?: string;
|
|
80
|
+
}
|
|
81
|
+
declare class DebugLogger {
|
|
82
|
+
private options;
|
|
83
|
+
constructor(options: DebugOptions);
|
|
84
|
+
/**
|
|
85
|
+
* Log a debug message if debug is enabled
|
|
86
|
+
*/
|
|
87
|
+
log(message: string, ...args: DebugArg[]): void;
|
|
88
|
+
/**
|
|
89
|
+
* Log a debug warning if debug is enabled
|
|
90
|
+
*/
|
|
91
|
+
warn(message: string, ...args: DebugArg[]): void;
|
|
92
|
+
/**
|
|
93
|
+
* Log a debug error if debug is enabled
|
|
94
|
+
*/
|
|
95
|
+
error(message: string, ...args: DebugArg[]): void;
|
|
96
|
+
/**
|
|
97
|
+
* Create a scoped logger with additional context
|
|
98
|
+
*/
|
|
99
|
+
scope(scopeName: string): DebugLogger;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Initialize the debug logger
|
|
103
|
+
*/
|
|
104
|
+
declare function initDebugLogger(enabled?: boolean): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get the debug logger instance
|
|
107
|
+
*/
|
|
108
|
+
declare function getDebugLogger(): DebugLogger;
|
|
109
|
+
/**
|
|
110
|
+
* Convenience function for logging
|
|
111
|
+
*/
|
|
112
|
+
declare function debugLog(message: string, ...args: DebugArg[]): void;
|
|
113
|
+
/**
|
|
114
|
+
* Convenience function for warning
|
|
115
|
+
*/
|
|
116
|
+
declare function debugWarn(message: string, ...args: DebugArg[]): void;
|
|
117
|
+
/**
|
|
118
|
+
* Convenience function for errors
|
|
119
|
+
*/
|
|
120
|
+
declare function debugError(message: string, ...args: DebugArg[]): void;
|
|
121
|
+
/**
|
|
122
|
+
* Create a scoped debug logger
|
|
123
|
+
*/
|
|
124
|
+
declare function createScopedLogger(scopeName: string): DebugLogger;
|
|
125
|
+
|
|
126
|
+
declare function throttle<T extends (...args: any[]) => any>(func: T, delay: number): T;
|
|
127
|
+
declare function createElementCache<T extends Element = Element>(query: string, ttl?: number): () => NodeListOf<T>;
|
|
128
|
+
|
|
129
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
130
|
+
interface PreprEventData {
|
|
131
|
+
segment?: string;
|
|
132
|
+
variant?: string;
|
|
133
|
+
editMode?: boolean;
|
|
134
|
+
[key: string]: string | boolean | number | undefined;
|
|
135
|
+
}
|
|
136
|
+
declare function sendPreprEvent(event: string, data?: PreprEventData): void;
|
|
137
|
+
|
|
138
|
+
export { DOMService, type DebugArg, type ErrorAdditionalData, type ErrorInfo, type PreprEventData, StegaError, type StegaErrorType, cn, createElementCache, createErrorInfo, createScopedLogger, debugError, debugLog, debugWarn, getDebugLogger, handleContextError, handleDOMError, handleStegaError, initDebugLogger, sendPreprEvent, throttle };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
|
|
3
|
+
declare const StegaError: {
|
|
4
|
+
readonly DECODE_FAILED: "STEGA_DECODE_FAILED";
|
|
5
|
+
readonly INVALID_FORMAT: "STEGA_INVALID_FORMAT";
|
|
6
|
+
readonly DOM_MANIPULATION_FAILED: "DOM_MANIPULATION_FAILED";
|
|
7
|
+
readonly CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND";
|
|
8
|
+
};
|
|
9
|
+
type StegaErrorType = (typeof StegaError)[keyof typeof StegaError];
|
|
10
|
+
interface ErrorAdditionalData {
|
|
11
|
+
input?: string;
|
|
12
|
+
element?: HTMLElement;
|
|
13
|
+
context?: string;
|
|
14
|
+
[key: string]: string | HTMLElement | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface ErrorInfo {
|
|
17
|
+
type: StegaErrorType;
|
|
18
|
+
context: string;
|
|
19
|
+
message: string;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
stack?: string;
|
|
22
|
+
additionalData?: ErrorAdditionalData;
|
|
23
|
+
}
|
|
24
|
+
declare function createErrorInfo(type: StegaErrorType, context: string, error: Error, additionalData?: ErrorAdditionalData): ErrorInfo;
|
|
25
|
+
declare function handleStegaError(error: Error, context: string, additionalData?: ErrorAdditionalData): ErrorInfo;
|
|
26
|
+
declare function handleDOMError(error: Error, context: string): ErrorInfo;
|
|
27
|
+
declare function handleContextError(contextName: string): void;
|
|
28
|
+
|
|
29
|
+
declare class DOMService {
|
|
30
|
+
/**
|
|
31
|
+
* Creates an HTML element with specified tag and class name
|
|
32
|
+
*/
|
|
33
|
+
static createElement(tag: string, className: string): HTMLElement;
|
|
34
|
+
/**
|
|
35
|
+
* Appends an element to the document body
|
|
36
|
+
*/
|
|
37
|
+
static appendToBody(element: HTMLElement): void;
|
|
38
|
+
/**
|
|
39
|
+
* Removes an element from the document body
|
|
40
|
+
*/
|
|
41
|
+
static removeFromBody(element: HTMLElement): void;
|
|
42
|
+
/**
|
|
43
|
+
* Sets multiple CSS properties on an element
|
|
44
|
+
*/
|
|
45
|
+
static setElementStyles(element: HTMLElement, styles: Record<string, string>): void;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the bounding rectangle of an element
|
|
48
|
+
*/
|
|
49
|
+
static getElementRect(element: HTMLElement): DOMRect;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if an element is in the viewport
|
|
52
|
+
*/
|
|
53
|
+
static isElementInViewport(element: HTMLElement): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Calculates distance between two points
|
|
56
|
+
*/
|
|
57
|
+
static calculateDistance(x1: number, y1: number, x2: number, y2: number): number;
|
|
58
|
+
/**
|
|
59
|
+
* Finds the closest element to a point from a list of elements
|
|
60
|
+
*/
|
|
61
|
+
static findClosestElement(pointX: number, pointY: number, elements: NodeListOf<Element>): HTMLElement | null;
|
|
62
|
+
/**
|
|
63
|
+
* Safely adds event listeners
|
|
64
|
+
*/
|
|
65
|
+
static addEventListener(element: EventTarget, event: string, handler: EventListener, options?: AddEventListenerOptions): void;
|
|
66
|
+
/**
|
|
67
|
+
* Safely removes event listeners
|
|
68
|
+
*/
|
|
69
|
+
static removeEventListener(element: EventTarget, event: string, handler: EventListener, options?: EventListenerOptions): void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Debug utility for Prepr Next.js package
|
|
74
|
+
* Provides centralized debug logging with performance optimizations
|
|
75
|
+
*/
|
|
76
|
+
type DebugArg = string | number | boolean | null | undefined | object;
|
|
77
|
+
interface DebugOptions {
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
prefix?: string;
|
|
80
|
+
}
|
|
81
|
+
declare class DebugLogger {
|
|
82
|
+
private options;
|
|
83
|
+
constructor(options: DebugOptions);
|
|
84
|
+
/**
|
|
85
|
+
* Log a debug message if debug is enabled
|
|
86
|
+
*/
|
|
87
|
+
log(message: string, ...args: DebugArg[]): void;
|
|
88
|
+
/**
|
|
89
|
+
* Log a debug warning if debug is enabled
|
|
90
|
+
*/
|
|
91
|
+
warn(message: string, ...args: DebugArg[]): void;
|
|
92
|
+
/**
|
|
93
|
+
* Log a debug error if debug is enabled
|
|
94
|
+
*/
|
|
95
|
+
error(message: string, ...args: DebugArg[]): void;
|
|
96
|
+
/**
|
|
97
|
+
* Create a scoped logger with additional context
|
|
98
|
+
*/
|
|
99
|
+
scope(scopeName: string): DebugLogger;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Initialize the debug logger
|
|
103
|
+
*/
|
|
104
|
+
declare function initDebugLogger(enabled?: boolean): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get the debug logger instance
|
|
107
|
+
*/
|
|
108
|
+
declare function getDebugLogger(): DebugLogger;
|
|
109
|
+
/**
|
|
110
|
+
* Convenience function for logging
|
|
111
|
+
*/
|
|
112
|
+
declare function debugLog(message: string, ...args: DebugArg[]): void;
|
|
113
|
+
/**
|
|
114
|
+
* Convenience function for warning
|
|
115
|
+
*/
|
|
116
|
+
declare function debugWarn(message: string, ...args: DebugArg[]): void;
|
|
117
|
+
/**
|
|
118
|
+
* Convenience function for errors
|
|
119
|
+
*/
|
|
120
|
+
declare function debugError(message: string, ...args: DebugArg[]): void;
|
|
121
|
+
/**
|
|
122
|
+
* Create a scoped debug logger
|
|
123
|
+
*/
|
|
124
|
+
declare function createScopedLogger(scopeName: string): DebugLogger;
|
|
125
|
+
|
|
126
|
+
declare function throttle<T extends (...args: any[]) => any>(func: T, delay: number): T;
|
|
127
|
+
declare function createElementCache<T extends Element = Element>(query: string, ttl?: number): () => NodeListOf<T>;
|
|
128
|
+
|
|
129
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
130
|
+
interface PreprEventData {
|
|
131
|
+
segment?: string;
|
|
132
|
+
variant?: string;
|
|
133
|
+
editMode?: boolean;
|
|
134
|
+
[key: string]: string | boolean | number | undefined;
|
|
135
|
+
}
|
|
136
|
+
declare function sendPreprEvent(event: string, data?: PreprEventData): void;
|
|
137
|
+
|
|
138
|
+
export { DOMService, type DebugArg, type ErrorAdditionalData, type ErrorInfo, type PreprEventData, StegaError, type StegaErrorType, cn, createElementCache, createErrorInfo, createScopedLogger, debugError, debugLog, debugWarn, getDebugLogger, handleContextError, handleDOMError, handleStegaError, initDebugLogger, sendPreprEvent, throttle };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a,b as b$1}from'../chunk-E7ATRJ2F.js';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';var u={DECODE_FAILED:"STEGA_DECODE_FAILED",INVALID_FORMAT:"STEGA_INVALID_FORMAT",DOM_MANIPULATION_FAILED:"DOM_MANIPULATION_FAILED",CONTEXT_NOT_FOUND:"CONTEXT_NOT_FOUND"};function p(n,e,t,r){return {type:n,context:e,message:t.message,timestamp:new Date().toISOString(),stack:t.stack,additionalData:r}}function b(n,e,t){let r=p(u.DECODE_FAILED,e,n,t);return console.error("Stega Error:",r),process.env.NODE_ENV,r}function s(n,e){let t=p(u.DOM_MANIPULATION_FAILED,e,n);return console.error("DOM Error:",t),t}function L(n){let e=new Error(`${n} must be used within its provider`),t=p(u.CONTEXT_NOT_FOUND,n,e);throw console.error("Context Error:",t),e}var D=class{static createElement(e,t){try{let r=document.createElement(e);return r.className=t,r}catch(r){throw s(r,"createElement"),r}}static appendToBody(e){try{document.body.appendChild(e);}catch(t){throw s(t,"appendToBody"),t}}static removeFromBody(e){try{e.parentNode&&e.parentNode.removeChild(e);}catch(t){throw s(t,"removeFromBody"),t}}static setElementStyles(e,t){try{Object.entries(t).forEach(([r,o])=>{e.style.setProperty(r,o);});}catch(r){throw s(r,"setElementStyles"),r}}static getElementRect(e){try{return e.getBoundingClientRect()}catch(t){throw s(t,"getElementRect"),t}}static isElementInViewport(e){try{let t=this.getElementRect(e);return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}catch(t){return s(t,"isElementInViewport"),false}}static calculateDistance(e,t,r,o){return Math.sqrt(Math.pow(r-e,2)+Math.pow(o-t,2))}static findClosestElement(e,t,r){try{let o=null,i=1/0;return r.forEach(d=>{let c=this.getElementRect(d),m=this.calculateDistance(e,t,c.left+c.width/2,c.top+c.height/2);m<i&&(i=m,o=d);}),o}catch(o){return s(o,"findClosestElement"),null}}static addEventListener(e,t,r,o){try{e.addEventListener(t,r,o);}catch(i){throw s(i,"addEventListener"),i}}static removeEventListener(e,t,r,o){try{e.removeEventListener(t,r,o);}catch(i){throw s(i,"removeEventListener"),i}}};var g=class n{constructor(e){this.options=a({prefix:"[Prepr]"},e);}log(e,...t){if(!this.options.enabled)return;let r=this.options.prefix;console.log(`${r} ${e}`,...t);}warn(e,...t){if(!this.options.enabled)return;let r=this.options.prefix;console.warn(`${r} ${e}`,...t);}error(e,...t){if(!this.options.enabled)return;let r=this.options.prefix;console.error(`${r} ${e}`,...t);}scope(e){return new n(b$1(a({},this.options),{prefix:`${this.options.prefix}[${e}]`}))}},l=null;function O(n=false){l=new g({enabled:n});}function E(){return l||(l=new g({enabled:false})),l}function y(n,...e){E().log(n,...e);}function A(n,...e){E().warn(n,...e);}function M(n,...e){E().error(n,...e);}function I(n){return E().scope(n)}function C(n,e){let t=null,r=0;return (...o)=>{let i=Date.now();i-r>e?(n(...o),r=i):(t&&clearTimeout(t),t=setTimeout(()=>{n(...o),r=Date.now();},e-(i-r)));}}function S(n,e=1e3){let t=null,r=0;return ()=>{let o=Date.now();return (!t||o-r>e)&&(t=document.querySelectorAll(n),r=o),t}}function $(...n){return twMerge(clsx(n))}function k(n,e){window.parent.postMessage(a({name:"prepr_preview_bar",event:n},e));}export{D as DOMService,u as StegaError,$ as cn,S as createElementCache,p as createErrorInfo,I as createScopedLogger,M as debugError,y as debugLog,A as debugWarn,E as getDebugLogger,L as handleContextError,s as handleDOMError,b as handleStegaError,O as initDebugLogger,k as sendPreprEvent,C as throttle};//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/errors.ts","../../src/utils/dom.ts","../../src/utils/debug.ts","../../src/utils/performance.ts","../../src/utils/index.ts"],"names":["StegaError","createErrorInfo","type","context","error","additionalData","handleStegaError","errorInfo","handleDOMError","handleContextError","contextName","DOMService","tag","className","element","styles","property","value","rect","x1","y1","x2","y2","pointX","pointY","elements","closestElement","minDistance","distance","event","handler","options","DebugLogger","_DebugLogger","__spreadValues","message","args","prefix","scopeName","__spreadProps","globalDebugLogger","initDebugLogger","enabled","getDebugLogger","debugLog","debugWarn","debugError","createScopedLogger","throttle","func","delay","timeoutId","lastExecTime","currentTime","createElementCache","query","ttl","cache","lastCacheTime","now","cn","inputs","twMerge","clsx","sendPreprEvent","data"],"mappings":"2GAAO,IAAMA,CAAAA,CAAa,CACxB,aAAA,CAAe,qBAAA,CACf,eAAgB,sBAAA,CAChB,uBAAA,CAAyB,0BACzB,iBAAA,CAAmB,mBACrB,EAqBO,SAASC,CAAAA,CACdC,EACAC,CAAAA,CACAC,CAAAA,CACAC,EACW,CACX,OAAO,CACL,IAAA,CAAAH,CAAAA,CACA,QAAAC,CAAAA,CACA,OAAA,CAASC,EAAM,OAAA,CACf,SAAA,CAAW,IAAI,IAAA,EAAK,CAAE,aAAY,CAClC,K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ASE,CAAAA,CAAMD,CAAAA,CAAgBF,KAClCC,CAAAA,CAAQ,QAAA,CAAS,iBAAoBF,CAAK,CAAA,CAC1CG,EAAgBC,CAAAA,CAAAA,CAEXF,CACT,CACF,CCxCO,SAASG,KAAMC,CAAAA,CAAsB,CAC1C,OAAOC,OAAAA,CAAQC,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CAUO,SAASG,CAAAA,CAAenC,EAAeoC,CAAAA,CAAuB,CACnE,OAAO,MAAA,CAAO,WAAA,CAAY/B,EAAA,CACxB,IAAA,CAAM,oBACN,KAAA,CAAAL,CAAAA,CAAAA,CACGoC,EACJ,EACH","file":"index.js","sourcesContent":["export const StegaError = {\n DECODE_FAILED: 'STEGA_DECODE_FAILED',\n INVALID_FORMAT: 'STEGA_INVALID_FORMAT',\n DOM_MANIPULATION_FAILED: 'DOM_MANIPULATION_FAILED',\n CONTEXT_NOT_FOUND: 'CONTEXT_NOT_FOUND',\n} as const;\n\nexport type StegaErrorType = (typeof StegaError)[keyof typeof StegaError];\n\n// Define specific types for error additional data\nexport interface ErrorAdditionalData {\n input?: string;\n element?: HTMLElement;\n context?: string;\n [key: string]: string | HTMLElement | undefined;\n}\n\nexport interface ErrorInfo {\n type: StegaErrorType;\n context: string;\n message: string;\n timestamp: string;\n stack?: string;\n additionalData?: ErrorAdditionalData;\n}\n\nexport function createErrorInfo(\n type: StegaErrorType,\n context: string,\n error: Error,\n additionalData?: ErrorAdditionalData\n): ErrorInfo {\n return {\n type,\n context,\n message: error.message,\n timestamp: new Date().toISOString(),\n stack: error.stack,\n additionalData,\n };\n}\n\nexport function handleStegaError(\n error: Error,\n context: string,\n additionalData?: ErrorAdditionalData\n) {\n const errorInfo = createErrorInfo(\n StegaError.DECODE_FAILED,\n context,\n error,\n additionalData\n );\n\n console.error('Stega Error:', errorInfo);\n\n // In production, you might want to send this to an error tracking service\n if (process.env.NODE_ENV === 'production') {\n // sendToErrorTrackingService(errorInfo);\n }\n\n return errorInfo;\n}\n\nexport function handleDOMError(error: Error, context: string) {\n const errorInfo = createErrorInfo(\n StegaError.DOM_MANIPULATION_FAILED,\n context,\n error\n );\n\n console.error('DOM Error:', errorInfo);\n return errorInfo;\n}\n\nexport function handleContextError(contextName: string) {\n const error = new Error(`${contextName} must be used within its provider`);\n const errorInfo = createErrorInfo(\n StegaError.CONTEXT_NOT_FOUND,\n contextName,\n error\n );\n\n console.error('Context Error:', errorInfo);\n throw error;\n}\n","import { handleDOMError } from './errors';\n\nexport class DOMService {\n /**\n * Creates an HTML element with specified tag and class name\n */\n static createElement(tag: string, className: string): HTMLElement {\n try {\n const element = document.createElement(tag);\n element.className = className;\n return element;\n } catch (error) {\n handleDOMError(error as Error, 'createElement');\n throw error;\n }\n }\n\n /**\n * Appends an element to the document body\n */\n static appendToBody(element: HTMLElement): void {\n try {\n document.body.appendChild(element);\n } catch (error) {\n handleDOMError(error as Error, 'appendToBody');\n throw error;\n }\n }\n\n /**\n * Removes an element from the document body\n */\n static removeFromBody(element: HTMLElement): void {\n try {\n if (element.parentNode) {\n element.parentNode.removeChild(element);\n }\n } catch (error) {\n handleDOMError(error as Error, 'removeFromBody');\n throw error;\n }\n }\n\n /**\n * Sets multiple CSS properties on an element\n */\n static setElementStyles(\n element: HTMLElement,\n styles: Record<string, string>\n ): void {\n try {\n Object.entries(styles).forEach(([property, value]) => {\n element.style.setProperty(property, value);\n });\n } catch (error) {\n handleDOMError(error as Error, 'setElementStyles');\n throw error;\n }\n }\n\n /**\n * Gets the bounding rectangle of an element\n */\n static getElementRect(element: HTMLElement): DOMRect {\n try {\n return element.getBoundingClientRect();\n } catch (error) {\n handleDOMError(error as Error, 'getElementRect');\n throw error;\n }\n }\n\n /**\n * Checks if an element is in the viewport\n */\n static isElementInViewport(element: HTMLElement): boolean {\n try {\n const rect = this.getElementRect(element);\n return (\n rect.top >= 0 &&\n rect.left >= 0 &&\n rect.bottom <=\n (window.innerHeight || document.documentElement.clientHeight) &&\n rect.right <=\n (window.innerWidth || document.documentElement.clientWidth)\n );\n } catch (error) {\n handleDOMError(error as Error, 'isElementInViewport');\n return false;\n }\n }\n\n /**\n * Calculates distance between two points\n */\n static calculateDistance(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n ): number {\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n }\n\n /**\n * Finds the closest element to a point from a list of elements\n */\n static findClosestElement(\n pointX: number,\n pointY: number,\n elements: NodeListOf<Element>\n ): HTMLElement | null {\n try {\n let closestElement: HTMLElement | null = null;\n let minDistance = Infinity;\n\n elements.forEach(element => {\n const rect = this.getElementRect(element as HTMLElement);\n const distance = this.calculateDistance(\n pointX,\n pointY,\n rect.left + rect.width / 2,\n rect.top + rect.height / 2\n );\n\n if (distance < minDistance) {\n minDistance = distance;\n closestElement = element as HTMLElement;\n }\n });\n\n return closestElement;\n } catch (error) {\n handleDOMError(error as Error, 'findClosestElement');\n return null;\n }\n }\n\n /**\n * Safely adds event listeners\n */\n static addEventListener(\n element: EventTarget,\n event: string,\n handler: EventListener,\n options?: AddEventListenerOptions\n ): void {\n try {\n element.addEventListener(event, handler, options);\n } catch (error) {\n handleDOMError(error as Error, 'addEventListener');\n throw error;\n }\n }\n\n /**\n * Safely removes event listeners\n */\n static removeEventListener(\n element: EventTarget,\n event: string,\n handler: EventListener,\n options?: EventListenerOptions\n ): void {\n try {\n element.removeEventListener(event, handler, options);\n } catch (error) {\n handleDOMError(error as Error, 'removeEventListener');\n throw error;\n }\n }\n}\n","/**\n * Debug utility for Prepr Next.js package\n * Provides centralized debug logging with performance optimizations\n */\n\n// Define specific types for debug arguments\nexport type DebugArg = string | number | boolean | null | undefined | object;\n\ninterface DebugOptions {\n enabled: boolean;\n prefix?: string;\n}\n\nclass DebugLogger {\n private options: DebugOptions;\n\n constructor(options: DebugOptions) {\n this.options = {\n prefix: '[Prepr]',\n ...options,\n };\n }\n\n /**\n * Log a debug message if debug is enabled\n */\n log(message: string, ...args: DebugArg[]): void {\n if (!this.options.enabled) return;\n\n const prefix = this.options.prefix;\n console.log(`${prefix} ${message}`, ...args);\n }\n\n /**\n * Log a debug warning if debug is enabled\n */\n warn(message: string, ...args: DebugArg[]): void {\n if (!this.options.enabled) return;\n\n const prefix = this.options.prefix;\n console.warn(`${prefix} ${message}`, ...args);\n }\n\n /**\n * Log a debug error if debug is enabled\n */\n error(message: string, ...args: DebugArg[]): void {\n if (!this.options.enabled) return;\n\n const prefix = this.options.prefix;\n console.error(`${prefix} ${message}`, ...args);\n }\n\n /**\n * Create a scoped logger with additional context\n */\n scope(scopeName: string): DebugLogger {\n return new DebugLogger({\n ...this.options,\n prefix: `${this.options.prefix}[${scopeName}]`,\n });\n }\n}\n\n// Global debug instance\nlet globalDebugLogger: DebugLogger | null = null;\n\n/**\n * Initialize the debug logger\n */\nexport function initDebugLogger(enabled: boolean = false): void {\n globalDebugLogger = new DebugLogger({ enabled });\n}\n\n/**\n * Get the debug logger instance\n */\nexport function getDebugLogger(): DebugLogger {\n if (!globalDebugLogger) {\n // Fallback to disabled logger if not initialized\n globalDebugLogger = new DebugLogger({ enabled: false });\n }\n return globalDebugLogger;\n}\n\n/**\n * Convenience function for logging\n */\nexport function debugLog(message: string, ...args: DebugArg[]): void {\n getDebugLogger().log(message, ...args);\n}\n\n/**\n * Convenience function for warning\n */\nexport function debugWarn(message: string, ...args: DebugArg[]): void {\n getDebugLogger().warn(message, ...args);\n}\n\n/**\n * Convenience function for errors\n */\nexport function debugError(message: string, ...args: DebugArg[]): void {\n getDebugLogger().error(message, ...args);\n}\n\n/**\n * Create a scoped debug logger\n */\nexport function createScopedLogger(scopeName: string): DebugLogger {\n return getDebugLogger().scope(scopeName);\n}\n","// Performance utilities\n\n// TODO: Refine the type for args and return value if possible\nexport function throttle<T extends (...args: any[]) => any>(\n func: T,\n delay: number\n): T {\n let timeoutId: NodeJS.Timeout | null = null;\n let lastExecTime = 0;\n\n return ((...args: unknown[]) => {\n const currentTime = Date.now();\n if (currentTime - lastExecTime > delay) {\n func(...(args as Parameters<T>));\n lastExecTime = currentTime;\n } else {\n if (timeoutId) clearTimeout(timeoutId);\n timeoutId = setTimeout(\n () => {\n func(...(args as Parameters<T>));\n lastExecTime = Date.now();\n },\n delay - (currentTime - lastExecTime)\n );\n }\n }) as T;\n}\n\n// Simple DOM element cache for querySelectorAll\nexport function createElementCache<T extends Element = Element>(\n query: string,\n ttl: number = 1000\n) {\n let cache: NodeListOf<T> | null = null;\n let lastCacheTime = 0;\n return () => {\n const now = Date.now();\n if (!cache || now - lastCacheTime > ttl) {\n cache = document.querySelectorAll<T>(query);\n lastCacheTime = now;\n }\n return cache;\n };\n}\n","import { ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n// Define specific types for Prepr events\nexport interface PreprEventData {\n segment?: string;\n variant?: string;\n editMode?: boolean;\n [key: string]: string | boolean | number | undefined;\n}\n\nexport function sendPreprEvent(event: string, data?: PreprEventData) {\n window.parent.postMessage({\n name: 'prepr_preview_bar',\n event,\n ...data,\n });\n}\n\n// Export error handling utilities\nexport * from './errors';\n\n// Export DOM service\nexport * from './dom';\n\n// Export debug utilities\nexport * from './debug';\n\n// Export performance utilities\nexport * from './performance';\n"]}
|
package/package.json
CHANGED
|
@@ -1,72 +1,117 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@preprio/prepr-nextjs",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"module": "./dist/index.
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
3
|
+
"version": "2.0.0-alpha.5",
|
|
4
|
+
"description": "Next.js package for Prepr CMS preview functionality with advanced debugging and visual editing capabilities",
|
|
5
|
+
"main": "dist/react/index.cjs",
|
|
6
|
+
"types": "./dist/react/index.d.ts",
|
|
7
|
+
"module": "./dist/react/index.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsup",
|
|
11
|
+
"dev": "tsup --watch",
|
|
12
|
+
"dev:css": "postcss ./src/globals.css -o ./src/output.css --watch",
|
|
13
|
+
"build:css": "NODE_ENV=production postcss ./src/globals.css -o ./dist/index.css",
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
|
+
"clean": "rm -rf dist",
|
|
16
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
17
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
18
|
+
"release": "node scripts/release.js",
|
|
19
|
+
"check": "npm run type-check && npm run lint:check && npm run format:check",
|
|
20
|
+
"type-check": "tsc --noEmit",
|
|
21
|
+
"lint": "eslint src --ext .ts,.tsx --fix",
|
|
22
|
+
"lint:check": "eslint src --ext .ts,.tsx",
|
|
23
|
+
"prepublishOnly": "npm run check && npm run build"
|
|
24
|
+
},
|
|
12
25
|
"exports": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"require": "./dist/index.
|
|
26
|
+
"./middleware": {
|
|
27
|
+
"import": "./dist/middleware/index.js",
|
|
28
|
+
"types": "./dist/middleware/index.d.ts",
|
|
29
|
+
"require": "./dist/middleware/index.cjs"
|
|
17
30
|
},
|
|
18
|
-
"./
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"require": "./dist/
|
|
31
|
+
"./server": {
|
|
32
|
+
"import": "./dist/server/index.js",
|
|
33
|
+
"types": "./dist/server/index.d.ts",
|
|
34
|
+
"require": "./dist/server/index.cjs"
|
|
22
35
|
},
|
|
23
|
-
"./
|
|
24
|
-
"import": "./dist/
|
|
25
|
-
"
|
|
36
|
+
"./react": {
|
|
37
|
+
"import": "./dist/react/index.js",
|
|
38
|
+
"types": "./dist/react/index.d.ts",
|
|
39
|
+
"require": "./dist/react/index.cjs"
|
|
26
40
|
},
|
|
27
|
-
"./
|
|
28
|
-
"import": "./dist/
|
|
29
|
-
"
|
|
41
|
+
"./contexts": {
|
|
42
|
+
"import": "./dist/contexts/index.js",
|
|
43
|
+
"types": "./dist/contexts/index.d.ts",
|
|
44
|
+
"require": "./dist/contexts/index.cjs"
|
|
45
|
+
},
|
|
46
|
+
"./utils": {
|
|
47
|
+
"import": "./dist/utils/index.js",
|
|
48
|
+
"types": "./dist/utils/index.d.ts",
|
|
49
|
+
"require": "./dist/utils/index.cjs"
|
|
50
|
+
},
|
|
51
|
+
"./types": {
|
|
52
|
+
"import": "./dist/types/index.js",
|
|
53
|
+
"types": "./dist/types/index.d.ts",
|
|
54
|
+
"require": "./dist/types/index.cjs"
|
|
55
|
+
},
|
|
56
|
+
"./index.css": {
|
|
57
|
+
"import": "./dist/index.css",
|
|
58
|
+
"require": "./dist/index.css"
|
|
30
59
|
}
|
|
31
60
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
"author": "Prepr",
|
|
37
|
-
"license": "ISC",
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@types/react": "^18.3.3",
|
|
40
|
-
"autoprefixer": "^10.4.20",
|
|
41
|
-
"postcss": "^8.4.47",
|
|
42
|
-
"prettier": "3.3.3",
|
|
43
|
-
"tailwindcss": "^3.4.13",
|
|
44
|
-
"ts-node": "^10.9.2",
|
|
45
|
-
"tsup": "^8.2.4",
|
|
46
|
-
"typescript": "^5.5.4"
|
|
47
|
-
},
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"@headlessui/react": "^2.1.8",
|
|
50
|
-
"@vercel/functions": "^1.6.0",
|
|
51
|
-
"classnames": "^2.5.1",
|
|
52
|
-
"clsx": "^2.1.1",
|
|
53
|
-
"micromatch": "^4.0.8",
|
|
54
|
-
"next": "^15.2.2",
|
|
55
|
-
"react": "^19.0.0",
|
|
56
|
-
"react-dom": "^19.0.0",
|
|
57
|
-
"react-icons": "^5.3.0",
|
|
58
|
-
"rollup": "^4.22.4"
|
|
59
|
-
},
|
|
60
|
-
"repository": {
|
|
61
|
-
"type": "git",
|
|
62
|
-
"url": "git+https://github.com/preprio/prepr-nextjs.git"
|
|
63
|
-
},
|
|
61
|
+
"files": [
|
|
62
|
+
"dist",
|
|
63
|
+
"package.json"
|
|
64
|
+
],
|
|
64
65
|
"keywords": [
|
|
65
66
|
"prepr",
|
|
66
|
-
"
|
|
67
|
+
"cms",
|
|
68
|
+
"nextjs",
|
|
69
|
+
"preview",
|
|
70
|
+
"visual-editing",
|
|
71
|
+
"headless-cms",
|
|
72
|
+
"react",
|
|
73
|
+
"typescript",
|
|
74
|
+
"debug",
|
|
75
|
+
"stega"
|
|
67
76
|
],
|
|
68
|
-
"
|
|
69
|
-
|
|
77
|
+
"author": "Preprio",
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"packageManager": "pnpm@10.5.2",
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@eslint/js": "^9.25.1",
|
|
82
|
+
"@types/node": "^20.11.5",
|
|
83
|
+
"@types/react": "19.1.0",
|
|
84
|
+
"@types/react-dom": "19.1.2",
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^8.31.1",
|
|
86
|
+
"@typescript-eslint/parser": "^8.31.1",
|
|
87
|
+
"autoprefixer": "^10.4.21",
|
|
88
|
+
"cssnano": "^7.0.7",
|
|
89
|
+
"eslint": "^9.25.1",
|
|
90
|
+
"eslint-config-prettier": "^10.1.2",
|
|
91
|
+
"eslint-plugin-prettier": "^5.2.6",
|
|
92
|
+
"eslint-plugin-react": "^7.37.2",
|
|
93
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
94
|
+
"next": "15.3.1",
|
|
95
|
+
"postcss": "^8",
|
|
96
|
+
"prettier": "^3.5.3",
|
|
97
|
+
"prettier-plugin-tailwindcss": "^0.5.12",
|
|
98
|
+
"react": "^19.1.0",
|
|
99
|
+
"react-dom": "^19.1.0",
|
|
100
|
+
"tailwindcss": "^3.4.17",
|
|
101
|
+
"tsup": "^8.5.0",
|
|
102
|
+
"typescript": "^5.8.3"
|
|
70
103
|
},
|
|
71
|
-
"
|
|
104
|
+
"peerDependencies": {
|
|
105
|
+
"next": "^15.0.0 || ^14.0.0 || ^13.0.0",
|
|
106
|
+
"react": "^19.0.0 || ^18.0.0 || ^17.0.0 ",
|
|
107
|
+
"react-dom": "^19.0.0 || ^18.0.0 || ^17.0.0"
|
|
108
|
+
},
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"@headlessui/react": "^2.2.0",
|
|
111
|
+
"@vercel/functions": "^2.0.0",
|
|
112
|
+
"@vercel/stega": "^0.1.2",
|
|
113
|
+
"clsx": "^2.1.1",
|
|
114
|
+
"postcss-cli": "^11.0.1",
|
|
115
|
+
"tailwind-merge": "^3.0.1"
|
|
116
|
+
}
|
|
72
117
|
}
|
package/dist/chunk-IQXHJV5O.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
__async
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chunk-IQXHJV5O.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|