juxscript 1.1.245 → 1.1.247
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/components/include.d.ts +86 -0
- package/dist/lib/components/include.d.ts.map +1 -0
- package/{lib/components/include.ts → dist/lib/components/include.js} +57 -100
- package/dist/lib/components/tag.d.ts +27 -0
- package/dist/lib/components/tag.d.ts.map +1 -0
- package/{lib/components/tag.ts → dist/lib/components/tag.js} +14 -25
- package/dist/lib/index.d.ts +17 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/{index.js → dist/lib/index.js} +4 -2
- package/dist/lib/utils/codeparser.d.ts +29 -0
- package/dist/lib/utils/codeparser.d.ts.map +1 -0
- package/{lib/utils/codeparser.ts → dist/lib/utils/codeparser.js} +64 -91
- package/dist/lib/utils/fetch.d.ts +176 -0
- package/dist/lib/utils/fetch.d.ts.map +1 -0
- package/{lib/utils/fetch.ts → dist/lib/utils/fetch.js} +80 -206
- package/dist/lib/utils/formatId.d.ts +16 -0
- package/dist/lib/utils/formatId.d.ts.map +1 -0
- package/{lib/utils/formatId.ts → dist/lib/utils/formatId.js} +7 -8
- package/dist/lib/utils/idgen.d.ts +2 -0
- package/dist/lib/utils/idgen.d.ts.map +1 -0
- package/{lib/utils/idgen.ts → dist/lib/utils/idgen.js} +2 -4
- package/package.json +6 -11
- package/lib/components/dataframe.ts +0 -0
- package/lib/styles/animations.css +0 -218
- package/lib/styles/foundation.css +0 -542
- package/lib/styles/gradients.css +0 -326
- package/lib/styles/link.css +0 -158
- package/lib/styles/modal.css +0 -402
- package/lib/styles/modifiers.css +0 -103
- package/lib/styles/nav.css +0 -322
- package/lib/styles/shadcn.css +0 -960
- package/lib/styles/stacks.css +0 -132
- package/lib/styles/themes.css +0 -486
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Include - Simplified resource injection for bundled and external resources
|
|
3
|
+
* Supports page-specific scoping and cleanup
|
|
4
|
+
*/
|
|
5
|
+
type ResourceType = 'css' | 'js' | 'module';
|
|
6
|
+
interface IncludeOptions {
|
|
7
|
+
type?: ResourceType;
|
|
8
|
+
target?: string;
|
|
9
|
+
async?: boolean;
|
|
10
|
+
defer?: boolean;
|
|
11
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
12
|
+
integrity?: string;
|
|
13
|
+
pageScoped?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class Include {
|
|
16
|
+
private url;
|
|
17
|
+
private options;
|
|
18
|
+
private element;
|
|
19
|
+
private pageId;
|
|
20
|
+
constructor(url: string, options?: IncludeOptions);
|
|
21
|
+
css(): this;
|
|
22
|
+
js(): this;
|
|
23
|
+
module(): this;
|
|
24
|
+
async(): this;
|
|
25
|
+
defer(): this;
|
|
26
|
+
/**
|
|
27
|
+
* Inject into specific container instead of <head>
|
|
28
|
+
* Useful for page-specific styles
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* jux.include('/css/page1.css').into('#page1-container');
|
|
32
|
+
*/
|
|
33
|
+
into(selector: string): this;
|
|
34
|
+
/**
|
|
35
|
+
* Mark as page-scoped for automatic cleanup
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* jux.include('/css/dashboard.css').forPage('dashboard');
|
|
39
|
+
* // Later: Include.cleanupPage('dashboard');
|
|
40
|
+
*/
|
|
41
|
+
forPage(pageId: string): this;
|
|
42
|
+
render(): this;
|
|
43
|
+
private createStylesheet;
|
|
44
|
+
private createScript;
|
|
45
|
+
private getContainer;
|
|
46
|
+
private isAlreadyLoaded;
|
|
47
|
+
remove(): this;
|
|
48
|
+
/**
|
|
49
|
+
* Remove all resources for a specific page
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* Include.cleanupPage('dashboard');
|
|
53
|
+
*/
|
|
54
|
+
static cleanupPage(pageId: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Remove all page-scoped resources
|
|
57
|
+
*/
|
|
58
|
+
static cleanupAll(): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Factory function - simplified usage
|
|
62
|
+
*
|
|
63
|
+
* Usage:
|
|
64
|
+
* // Basic (auto-detects from extension)
|
|
65
|
+
* jux.include('/css/styles.css');
|
|
66
|
+
* jux.include('/js/app.js');
|
|
67
|
+
*
|
|
68
|
+
* // Page-specific with cleanup
|
|
69
|
+
* jux.include('/css/dashboard.css').forPage('dashboard');
|
|
70
|
+
* jux.include('/js/dashboard.js').forPage('dashboard');
|
|
71
|
+
*
|
|
72
|
+
* // Later cleanup:
|
|
73
|
+
* Include.cleanupPage('dashboard');
|
|
74
|
+
*
|
|
75
|
+
* // Inject into specific container
|
|
76
|
+
* jux.include('/css/widget.css').into('#widget-container');
|
|
77
|
+
*
|
|
78
|
+
* // External CDN
|
|
79
|
+
* jux.include('https://cdn.tailwindcss.com').js();
|
|
80
|
+
*
|
|
81
|
+
* // Module
|
|
82
|
+
* jux.include('/js/app.mjs').module();
|
|
83
|
+
*/
|
|
84
|
+
export declare function include(url: string, options?: IncludeOptions): Include;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=include.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../../../lib/components/include.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,YAAY,GAAG,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC;AAE5C,UAAU,cAAc;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAKD,qBAAa,OAAO;IAChB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,MAAM,CAAuB;gBAEzB,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB;IAoBrD,GAAG,IAAI,IAAI;IAKX,EAAE,IAAI,IAAI;IAKV,MAAM,IAAI,IAAI;IAKd,KAAK,IAAI,IAAI;IAKb,KAAK,IAAI,IAAI;IAKb;;;;;;OAMG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAK5B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAU7B,MAAM,IAAI,IAAI;IAoDd,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,eAAe;IAKvB,MAAM,IAAI,IAAI;IAYd;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAYxC;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,IAAI;CAS5B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAItE"}
|
|
@@ -2,115 +2,87 @@
|
|
|
2
2
|
* Include - Simplified resource injection for bundled and external resources
|
|
3
3
|
* Supports page-specific scoping and cleanup
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
type ResourceType = 'css' | 'js' | 'module';
|
|
7
|
-
|
|
8
|
-
interface IncludeOptions {
|
|
9
|
-
type?: ResourceType;
|
|
10
|
-
target?: string; // CSS selector for target container (default: 'head')
|
|
11
|
-
async?: boolean;
|
|
12
|
-
defer?: boolean;
|
|
13
|
-
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
14
|
-
integrity?: string;
|
|
15
|
-
pageScoped?: boolean; // If true, tracks for cleanup
|
|
16
|
-
}
|
|
17
|
-
|
|
18
5
|
// Global registry for page-scoped resources
|
|
19
|
-
const scopedResources
|
|
20
|
-
|
|
6
|
+
const scopedResources = new Map();
|
|
21
7
|
export class Include {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
private pageId: string | null = null;
|
|
26
|
-
|
|
27
|
-
constructor(url: string, options: IncludeOptions = {}) {
|
|
8
|
+
constructor(url, options = {}) {
|
|
9
|
+
this.element = null;
|
|
10
|
+
this.pageId = null;
|
|
28
11
|
this.url = url;
|
|
29
12
|
this.options = options;
|
|
30
|
-
|
|
31
13
|
// Auto-detect type from extension if not provided
|
|
32
14
|
if (!options.type) {
|
|
33
15
|
if (url.endsWith('.css')) {
|
|
34
16
|
this.options.type = 'css';
|
|
35
|
-
}
|
|
17
|
+
}
|
|
18
|
+
else if (url.endsWith('.mjs') || url.endsWith('.module.js')) {
|
|
36
19
|
this.options.type = 'module';
|
|
37
|
-
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
38
22
|
this.options.type = 'js';
|
|
39
23
|
}
|
|
40
24
|
}
|
|
41
25
|
}
|
|
42
|
-
|
|
43
26
|
/* -------------------------
|
|
44
27
|
* Fluent API
|
|
45
28
|
* ------------------------- */
|
|
46
|
-
|
|
47
|
-
css(): this {
|
|
29
|
+
css() {
|
|
48
30
|
this.options.type = 'css';
|
|
49
31
|
return this;
|
|
50
32
|
}
|
|
51
|
-
|
|
52
|
-
js(): this {
|
|
33
|
+
js() {
|
|
53
34
|
this.options.type = 'js';
|
|
54
35
|
return this;
|
|
55
36
|
}
|
|
56
|
-
|
|
57
|
-
module(): this {
|
|
37
|
+
module() {
|
|
58
38
|
this.options.type = 'module';
|
|
59
39
|
return this;
|
|
60
40
|
}
|
|
61
|
-
|
|
62
|
-
async(): this {
|
|
41
|
+
async() {
|
|
63
42
|
this.options.async = true;
|
|
64
43
|
return this;
|
|
65
44
|
}
|
|
66
|
-
|
|
67
|
-
defer(): this {
|
|
45
|
+
defer() {
|
|
68
46
|
this.options.defer = true;
|
|
69
47
|
return this;
|
|
70
48
|
}
|
|
71
|
-
|
|
72
49
|
/**
|
|
73
50
|
* Inject into specific container instead of <head>
|
|
74
51
|
* Useful for page-specific styles
|
|
75
|
-
*
|
|
52
|
+
*
|
|
76
53
|
* @example
|
|
77
54
|
* jux.include('/css/page1.css').into('#page1-container');
|
|
78
55
|
*/
|
|
79
|
-
into(selector
|
|
56
|
+
into(selector) {
|
|
80
57
|
this.options.target = selector;
|
|
81
58
|
return this;
|
|
82
59
|
}
|
|
83
|
-
|
|
84
60
|
/**
|
|
85
61
|
* Mark as page-scoped for automatic cleanup
|
|
86
|
-
*
|
|
62
|
+
*
|
|
87
63
|
* @example
|
|
88
64
|
* jux.include('/css/dashboard.css').forPage('dashboard');
|
|
89
65
|
* // Later: Include.cleanupPage('dashboard');
|
|
90
66
|
*/
|
|
91
|
-
forPage(pageId
|
|
67
|
+
forPage(pageId) {
|
|
92
68
|
this.pageId = pageId;
|
|
93
69
|
this.options.pageScoped = true;
|
|
94
70
|
return this;
|
|
95
71
|
}
|
|
96
|
-
|
|
97
72
|
/* -------------------------
|
|
98
73
|
* Render
|
|
99
74
|
* ------------------------- */
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
75
|
+
render() {
|
|
76
|
+
if (typeof document === 'undefined')
|
|
77
|
+
return this;
|
|
104
78
|
try {
|
|
105
79
|
// Check if already loaded
|
|
106
80
|
if (this.isAlreadyLoaded()) {
|
|
107
81
|
console.log(`⚠️ Resource already loaded: ${this.url}`);
|
|
108
82
|
return this;
|
|
109
83
|
}
|
|
110
|
-
|
|
111
84
|
// Create element based on type
|
|
112
|
-
let element
|
|
113
|
-
|
|
85
|
+
let element;
|
|
114
86
|
switch (this.options.type) {
|
|
115
87
|
case 'css':
|
|
116
88
|
element = this.createStylesheet();
|
|
@@ -122,124 +94,110 @@ export class Include {
|
|
|
122
94
|
default:
|
|
123
95
|
throw new Error(`Unknown resource type: ${this.options.type}`);
|
|
124
96
|
}
|
|
125
|
-
|
|
126
97
|
// Get target container
|
|
127
98
|
const container = this.getContainer();
|
|
128
99
|
container.appendChild(element);
|
|
129
|
-
|
|
130
100
|
this.element = element;
|
|
131
|
-
|
|
132
101
|
// Register for page cleanup if needed
|
|
133
102
|
if (this.options.pageScoped && this.pageId) {
|
|
134
103
|
if (!scopedResources.has(this.pageId)) {
|
|
135
104
|
scopedResources.set(this.pageId, new Set());
|
|
136
105
|
}
|
|
137
|
-
scopedResources.get(this.pageId)
|
|
106
|
+
scopedResources.get(this.pageId).add(element);
|
|
138
107
|
}
|
|
139
|
-
|
|
140
108
|
console.log(`✓ Loaded ${this.options.type}: ${this.url}`);
|
|
141
|
-
}
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
142
111
|
console.error(`✗ Failed to load ${this.options.type}: ${this.url}`, error);
|
|
143
112
|
throw error;
|
|
144
113
|
}
|
|
145
|
-
|
|
146
114
|
return this;
|
|
147
115
|
}
|
|
148
|
-
|
|
149
116
|
/* -------------------------
|
|
150
117
|
* Element Creation
|
|
151
118
|
* ------------------------- */
|
|
152
|
-
|
|
153
|
-
private createStylesheet(): HTMLLinkElement {
|
|
119
|
+
createStylesheet() {
|
|
154
120
|
const link = document.createElement('link');
|
|
155
121
|
link.rel = 'stylesheet';
|
|
156
122
|
link.href = this.url;
|
|
157
123
|
link.dataset.juxInclude = this.url;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (this.options.integrity)
|
|
161
|
-
|
|
124
|
+
if (this.options.crossOrigin)
|
|
125
|
+
link.crossOrigin = this.options.crossOrigin;
|
|
126
|
+
if (this.options.integrity)
|
|
127
|
+
link.integrity = this.options.integrity;
|
|
162
128
|
link.onload = () => console.log(`✓ Stylesheet loaded: ${this.url}`);
|
|
163
129
|
link.onerror = () => {
|
|
164
130
|
throw new Error(`Failed to load stylesheet: ${this.url}`);
|
|
165
131
|
};
|
|
166
|
-
|
|
167
132
|
return link;
|
|
168
133
|
}
|
|
169
|
-
|
|
170
|
-
private createScript(): HTMLScriptElement {
|
|
134
|
+
createScript() {
|
|
171
135
|
const script = document.createElement('script');
|
|
172
136
|
script.src = this.url;
|
|
173
137
|
script.dataset.juxInclude = this.url;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (this.options.async)
|
|
177
|
-
|
|
178
|
-
if (this.options.
|
|
179
|
-
|
|
180
|
-
|
|
138
|
+
if (this.options.type === 'module')
|
|
139
|
+
script.type = 'module';
|
|
140
|
+
if (this.options.async)
|
|
141
|
+
script.async = true;
|
|
142
|
+
if (this.options.defer)
|
|
143
|
+
script.defer = true;
|
|
144
|
+
if (this.options.crossOrigin)
|
|
145
|
+
script.crossOrigin = this.options.crossOrigin;
|
|
146
|
+
if (this.options.integrity)
|
|
147
|
+
script.integrity = this.options.integrity;
|
|
181
148
|
script.onload = () => console.log(`✓ Script loaded: ${this.url}`);
|
|
182
149
|
script.onerror = () => {
|
|
183
150
|
throw new Error(`Failed to load script: ${this.url}`);
|
|
184
151
|
};
|
|
185
|
-
|
|
186
152
|
return script;
|
|
187
153
|
}
|
|
188
|
-
|
|
189
154
|
/* -------------------------
|
|
190
155
|
* Helpers
|
|
191
156
|
* ------------------------- */
|
|
192
|
-
|
|
193
|
-
private getContainer(): HTMLElement {
|
|
157
|
+
getContainer() {
|
|
194
158
|
if (this.options.target) {
|
|
195
159
|
const container = document.querySelector(this.options.target);
|
|
196
160
|
if (!container) {
|
|
197
161
|
throw new Error(`Target container not found: ${this.options.target}`);
|
|
198
162
|
}
|
|
199
|
-
return container
|
|
163
|
+
return container;
|
|
200
164
|
}
|
|
201
165
|
return document.head;
|
|
202
166
|
}
|
|
203
|
-
|
|
204
|
-
private isAlreadyLoaded(): boolean {
|
|
167
|
+
isAlreadyLoaded() {
|
|
205
168
|
const selector = `[data-jux-include="${this.url}"]`;
|
|
206
169
|
return document.querySelector(selector) !== null;
|
|
207
170
|
}
|
|
208
|
-
|
|
209
|
-
remove(): this {
|
|
171
|
+
remove() {
|
|
210
172
|
if (this.element?.parentNode) {
|
|
211
173
|
this.element.parentNode.removeChild(this.element);
|
|
212
174
|
this.element = null;
|
|
213
175
|
}
|
|
214
176
|
return this;
|
|
215
177
|
}
|
|
216
|
-
|
|
217
178
|
/* -------------------------
|
|
218
179
|
* Static Page Cleanup
|
|
219
180
|
* ------------------------- */
|
|
220
|
-
|
|
221
181
|
/**
|
|
222
182
|
* Remove all resources for a specific page
|
|
223
|
-
*
|
|
183
|
+
*
|
|
224
184
|
* @example
|
|
225
185
|
* Include.cleanupPage('dashboard');
|
|
226
186
|
*/
|
|
227
|
-
static cleanupPage(pageId
|
|
187
|
+
static cleanupPage(pageId) {
|
|
228
188
|
const resources = scopedResources.get(pageId);
|
|
229
|
-
if (!resources)
|
|
230
|
-
|
|
189
|
+
if (!resources)
|
|
190
|
+
return;
|
|
231
191
|
resources.forEach(element => {
|
|
232
192
|
element.parentNode?.removeChild(element);
|
|
233
193
|
});
|
|
234
|
-
|
|
235
194
|
scopedResources.delete(pageId);
|
|
236
195
|
console.log(`✓ Cleaned up page resources: ${pageId}`);
|
|
237
196
|
}
|
|
238
|
-
|
|
239
197
|
/**
|
|
240
198
|
* Remove all page-scoped resources
|
|
241
199
|
*/
|
|
242
|
-
static cleanupAll()
|
|
200
|
+
static cleanupAll() {
|
|
243
201
|
scopedResources.forEach((resources, pageId) => {
|
|
244
202
|
resources.forEach(element => {
|
|
245
203
|
element.parentNode?.removeChild(element);
|
|
@@ -249,33 +207,32 @@ export class Include {
|
|
|
249
207
|
console.log('✓ Cleaned up all page-scoped resources');
|
|
250
208
|
}
|
|
251
209
|
}
|
|
252
|
-
|
|
253
210
|
/**
|
|
254
211
|
* Factory function - simplified usage
|
|
255
|
-
*
|
|
212
|
+
*
|
|
256
213
|
* Usage:
|
|
257
214
|
* // Basic (auto-detects from extension)
|
|
258
215
|
* jux.include('/css/styles.css');
|
|
259
216
|
* jux.include('/js/app.js');
|
|
260
|
-
*
|
|
217
|
+
*
|
|
261
218
|
* // Page-specific with cleanup
|
|
262
219
|
* jux.include('/css/dashboard.css').forPage('dashboard');
|
|
263
220
|
* jux.include('/js/dashboard.js').forPage('dashboard');
|
|
264
|
-
*
|
|
221
|
+
*
|
|
265
222
|
* // Later cleanup:
|
|
266
223
|
* Include.cleanupPage('dashboard');
|
|
267
|
-
*
|
|
224
|
+
*
|
|
268
225
|
* // Inject into specific container
|
|
269
226
|
* jux.include('/css/widget.css').into('#widget-container');
|
|
270
|
-
*
|
|
227
|
+
*
|
|
271
228
|
* // External CDN
|
|
272
229
|
* jux.include('https://cdn.tailwindcss.com').js();
|
|
273
|
-
*
|
|
230
|
+
*
|
|
274
231
|
* // Module
|
|
275
232
|
* jux.include('/js/app.mjs').module();
|
|
276
233
|
*/
|
|
277
|
-
export function include(url
|
|
234
|
+
export function include(url, options) {
|
|
278
235
|
const inc = new Include(url, options);
|
|
279
236
|
inc.render();
|
|
280
237
|
return inc;
|
|
281
|
-
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface TagProps {
|
|
2
|
+
id: string;
|
|
3
|
+
tagName: string;
|
|
4
|
+
content?: string;
|
|
5
|
+
options?: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
declare class Tag extends HTMLElement {
|
|
8
|
+
content: string;
|
|
9
|
+
options: Record<string, string>;
|
|
10
|
+
constructor(data: Partial<TagProps>);
|
|
11
|
+
modify(): this;
|
|
12
|
+
render(): HTMLElement;
|
|
13
|
+
}
|
|
14
|
+
export declare function tag(data: Partial<TagProps>): Tag;
|
|
15
|
+
export declare function div(data: Partial<TagProps>): Tag;
|
|
16
|
+
export declare function span(data: Partial<TagProps>): Tag;
|
|
17
|
+
export declare function p(data: Partial<TagProps>): Tag;
|
|
18
|
+
export declare function code(data: Partial<TagProps>): Tag;
|
|
19
|
+
export declare function pre(data: Partial<TagProps>): Tag;
|
|
20
|
+
export declare function h1(data: Partial<TagProps>): Tag;
|
|
21
|
+
export declare function h2(data: Partial<TagProps>): Tag;
|
|
22
|
+
export declare function h3(data: Partial<TagProps>): Tag;
|
|
23
|
+
export declare function h4(data: Partial<TagProps>): Tag;
|
|
24
|
+
export declare function h5(data: Partial<TagProps>): Tag;
|
|
25
|
+
export declare function h6(data: Partial<TagProps>): Tag;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../lib/components/tag.ts"],"names":[],"mappings":"AAEA,UAAU,QAAQ;IACd,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AACD,cAAM,GAAI,SAAQ,WAAW;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBACpB,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;IAMnC,MAAM;IAIN,MAAM;CAQT;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAGhD;AACD,wBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAEhD;AACD,wBAAgB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAEjD;AACD,wBAAgB,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAE9C;AACD,wBAAgB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAEjD;AACD,wBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAEhD;AACD,wBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAE/C;AACD,wBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAE/C;AACD,wBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAE/C;AACD,wBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAE/C;AACD,wBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAE/C;AACD,wBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,GAAG,CAE/C"}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import generateId from '../utils/idgen';
|
|
2
|
-
|
|
3
|
-
interface TagProps {
|
|
4
|
-
id: string;
|
|
5
|
-
tagName: string;
|
|
6
|
-
content?: string;
|
|
7
|
-
options?: Record<string, string>;
|
|
8
|
-
}
|
|
9
2
|
class Tag extends HTMLElement {
|
|
10
|
-
|
|
11
|
-
options: Record<string, string>;
|
|
12
|
-
constructor(data: Partial<TagProps>) {
|
|
3
|
+
constructor(data) {
|
|
13
4
|
super();
|
|
14
5
|
this.id = generateId();
|
|
15
6
|
this.content = data.content || '';
|
|
@@ -18,7 +9,6 @@ class Tag extends HTMLElement {
|
|
|
18
9
|
modify() {
|
|
19
10
|
return this;
|
|
20
11
|
}
|
|
21
|
-
|
|
22
12
|
render() {
|
|
23
13
|
const el = document.createElement(this.tagName);
|
|
24
14
|
el.textContent = this.content;
|
|
@@ -28,41 +18,40 @@ class Tag extends HTMLElement {
|
|
|
28
18
|
return el;
|
|
29
19
|
}
|
|
30
20
|
}
|
|
31
|
-
|
|
32
|
-
export function tag(data: Partial<TagProps>): Tag {
|
|
21
|
+
export function tag(data) {
|
|
33
22
|
const t = new Tag(data);
|
|
34
23
|
return t;
|
|
35
24
|
}
|
|
36
|
-
export function div(data
|
|
25
|
+
export function div(data) {
|
|
37
26
|
return tag({ ...data, tagName: 'div' });
|
|
38
27
|
}
|
|
39
|
-
export function span(data
|
|
28
|
+
export function span(data) {
|
|
40
29
|
return tag({ ...data, tagName: 'span' });
|
|
41
30
|
}
|
|
42
|
-
export function p(data
|
|
31
|
+
export function p(data) {
|
|
43
32
|
return tag({ ...data, tagName: 'p' });
|
|
44
33
|
}
|
|
45
|
-
export function code(data
|
|
34
|
+
export function code(data) {
|
|
46
35
|
return tag({ ...data, tagName: 'code' });
|
|
47
36
|
}
|
|
48
|
-
export function pre(data
|
|
37
|
+
export function pre(data) {
|
|
49
38
|
return tag({ ...data, tagName: 'pre' });
|
|
50
39
|
}
|
|
51
|
-
export function h1(data
|
|
40
|
+
export function h1(data) {
|
|
52
41
|
return tag({ ...data, tagName: 'h1' });
|
|
53
42
|
}
|
|
54
|
-
export function h2(data
|
|
43
|
+
export function h2(data) {
|
|
55
44
|
return tag({ ...data, tagName: 'h2' });
|
|
56
45
|
}
|
|
57
|
-
export function h3(data
|
|
46
|
+
export function h3(data) {
|
|
58
47
|
return tag({ ...data, tagName: 'h3' });
|
|
59
48
|
}
|
|
60
|
-
export function h4(data
|
|
49
|
+
export function h4(data) {
|
|
61
50
|
return tag({ ...data, tagName: 'h4' });
|
|
62
51
|
}
|
|
63
|
-
export function h5(data
|
|
52
|
+
export function h5(data) {
|
|
64
53
|
return tag({ ...data, tagName: 'h5' });
|
|
65
54
|
}
|
|
66
|
-
export function h6(data
|
|
55
|
+
export function h6(data) {
|
|
67
56
|
return tag({ ...data, tagName: 'h6' });
|
|
68
|
-
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { tag, div, h1, h2, h3, h4, h5, h6, p, span, pre } from "./components/tag";
|
|
2
|
+
import { include } from "./components/include";
|
|
3
|
+
export declare const jux: {
|
|
4
|
+
tag: typeof tag;
|
|
5
|
+
div: typeof div;
|
|
6
|
+
h1: typeof h1;
|
|
7
|
+
h2: typeof h2;
|
|
8
|
+
h3: typeof h3;
|
|
9
|
+
h4: typeof h4;
|
|
10
|
+
h5: typeof h5;
|
|
11
|
+
h6: typeof h6;
|
|
12
|
+
p: typeof p;
|
|
13
|
+
span: typeof span;
|
|
14
|
+
pre: typeof pre;
|
|
15
|
+
include: typeof include;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,eAAO,MAAM,GAAG;;;;;;;;;;;;;CASf,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { tag, div, h1, h2, h3, h4, h5, h6, p, span, pre } from "./
|
|
1
|
+
import { tag, div, h1, h2, h3, h4, h5, h6, p, span, pre } from "./components/tag";
|
|
2
|
+
import { include } from "./components/include";
|
|
2
3
|
export const jux = {
|
|
3
4
|
tag,
|
|
4
5
|
div,
|
|
5
6
|
h1, h2, h3, h4, h5, h6,
|
|
6
7
|
p,
|
|
7
8
|
span,
|
|
8
|
-
pre
|
|
9
|
+
pre,
|
|
10
|
+
include
|
|
9
11
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ParsedLine {
|
|
2
|
+
lineNumber: number;
|
|
3
|
+
html: string;
|
|
4
|
+
raw: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Escape HTML entities
|
|
8
|
+
*/
|
|
9
|
+
declare function escapeHtml(text: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Parse code into lines - CHARACTER-BY-CHARACTER TOKENIZATION
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseCode(code: string, language?: string): ParsedLine[];
|
|
14
|
+
/**
|
|
15
|
+
* Render a parsed line
|
|
16
|
+
*/
|
|
17
|
+
export declare function renderLineWithTokens(parsedLine: ParsedLine): string;
|
|
18
|
+
/**
|
|
19
|
+
* Generate CSS for syntax highlighting
|
|
20
|
+
*/
|
|
21
|
+
export declare function getSyntaxHighlightCSS(): string;
|
|
22
|
+
declare const _default: {
|
|
23
|
+
parse: typeof parseCode;
|
|
24
|
+
renderLine: typeof renderLineWithTokens;
|
|
25
|
+
getCSS: typeof getSyntaxHighlightCSS;
|
|
26
|
+
escapeHtml: typeof escapeHtml;
|
|
27
|
+
};
|
|
28
|
+
export default _default;
|
|
29
|
+
//# sourceMappingURL=codeparser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeparser.d.ts","sourceRoot":"","sources":["../../../lib/utils/codeparser.ts"],"names":[],"mappings":"AA2DA,MAAM,WAAW,UAAU;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOxC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAqB,GAAG,UAAU,EAAE,CAQrF;AAwOD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAkG9C;;;;;;;AAED,wBAKE"}
|