@innovastudio/contentbox 1.5.78 → 1.5.80

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.5.78",
4
+ "version": "1.5.80",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -51,7 +51,7 @@
51
51
  "ws": "^8.13.0"
52
52
  },
53
53
  "dependencies": {
54
- "@innovastudio/contentbuilder": "^1.4.99",
54
+ "@innovastudio/contentbuilder": "^1.4.101",
55
55
  "js-beautify": "^1.14.0"
56
56
  }
57
57
  }
@@ -94584,6 +94584,7 @@ class ContentBuilder {
94584
94584
  useMediaRecorder: true,
94585
94585
  // do not change
94586
94586
  encoderPath: '',
94587
+ imageAutoUpscale: true,
94587
94588
  headlineList: ['We create simple and effective designs.', 'Ultimate Experiences With Story, Emotion, And Purpose.', 'Build Anything Beautifully', 'With Less Stuff and More Compassion', 'We\'re [CompanyName]. Full stack development with a spark of creativity.', 'Transforming your digital experience with [CompanyName]. Achieve your online goals with our customized solutions.', 'Revolutionizing web development with [CompanyName]. Unleash your digital potential with our high-performance solutions.', 'Creative and Inspiring'],
94588
94589
  shortCommandList: {
94589
94590
  undo: ['undo'],
@@ -97131,31 +97132,56 @@ class ContentBuilder {
97131
97132
  }
97132
97133
  }
97133
97134
  }
97135
+ async upscaleImage(src, callback) {
97136
+ const width = 512;
97137
+ const height = 512;
97138
+ const img = new Image();
97139
+ img.src = src;
97140
+ img.onload = async () => {
97141
+ const canvas = document.createElement('canvas');
97142
+ canvas.width = width;
97143
+ canvas.height = height;
97144
+ const ctx = canvas.getContext('2d');
97145
+ ctx.drawImage(img, 0, 0, width, height);
97146
+ const resizedBase64 = canvas.toDataURL('image/jpeg');
97147
+ let image = resizedBase64;
97148
+ image = image.replace(/^data:image\/(png|jpeg);base64,/, '');
97149
+ const messages = {
97150
+ image: image,
97151
+ folder_path: ''
97152
+ };
97153
+ const response = await fetch(this.upscaleImageUrl, {
97154
+ signal: this.signal,
97155
+ // Abort
97156
+ method: 'POST',
97157
+ headers: {
97158
+ 'Content-Type': 'application/json'
97159
+ },
97160
+ body: JSON.stringify(messages)
97161
+ });
97162
+ const result = await response.json();
97163
+ callback([result.url]);
97164
+ };
97165
+ }
97134
97166
  async generateImage(prompt, callback) {
97135
97167
  this.controller = new AbortController(); // Create a new AbortController
97136
97168
  this.signal = this.controller.signal; // Get a new signal object
97137
97169
 
97138
- let model = 'realistic-vision-v3';
97139
- let negative_prompt = '';
97140
- if (model.includes('realistic-vision')) {
97141
- if (negative_prompt === '') negative_prompt = 'duplicate, (deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4), text, close up, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, bad_prompt_version2, bad-hands-5, badhandv4, bad anatomy, deformed, mutated, amputated, missing finger, extra finger, fused fingers, missing leg, extra leg, fused legs, missing digit, extra digit, fused digits, missing hand, extra hand, fused hands, missing arm, extra arm, fused arms, missing limb, extra limb, fused limbs, fused bodies, merged bodies, extra bodies, dual bodies, extra navel, elongated body, missing joint, extra joint, fused joints, deformed hip, twisted limbs, twisted legs, twisted arms, missing head, extra head, double head, twins, missing ear, extra ear, deformed ear, black and white, monochrome, multiple views, blurry, text, signature, head out of frame, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, grayscale, glans, bad hands, error, extra digit, fewer digits, cropped, jpeg artifacts, watermark, username, bad feet, poorly drawn hands, poorly drawn face, mutation, too many fingers, long neck, long body, long arms, cross-eyed, mutated hands, polar lowres, bad body, bad proportions, gross proportions, cropped head , bad eyes, extra breast, missing breast, fused breasts, unnatural proportions, necklace';
97142
- }
97143
- let width = 1024;
97144
- let height = 1024;
97145
- let steps = 25;
97146
- let guidance = 7.5;
97147
- let scheduler = 'dpmsolver++';
97148
- let output_format = 'jpeg';
97170
+ let model = this.imageModel || 'realistic-vision-v3';
97171
+ let negative_prompt = this.imageNegativePrompt || 'duplicate, (deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4), text, close up, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, bad_prompt_version2, bad-hands-5, badhandv4, bad anatomy, deformed, mutated, amputated, missing finger, extra finger, fused fingers, missing leg, extra leg, fused legs, missing digit, extra digit, fused digits, missing hand, extra hand, fused hands, missing arm, extra arm, fused arms, missing limb, extra limb, fused limbs, fused bodies, merged bodies, extra bodies, dual bodies, extra navel, elongated body, missing joint, extra joint, fused joints, deformed hip, twisted limbs, twisted legs, twisted arms, missing head, extra head, double head, twins, missing ear, extra ear, deformed ear, black and white, monochrome, multiple views, blurry, text, signature, head out of frame, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, grayscale, glans, bad hands, error, extra digit, fewer digits, cropped, jpeg artifacts, watermark, username, bad feet, poorly drawn hands, poorly drawn face, mutation, too many fingers, long neck, long body, long arms, cross-eyed, mutated hands, polar lowres, bad body, bad proportions, gross proportions, cropped head , bad eyes, extra breast, missing breast, fused breasts, unnatural proportions, necklace';
97172
+ let steps = this.imageSteps || 25;
97173
+ let guidance = this.imageGuidance || 7.5;
97174
+ let scheduler = this.imageScheduler || 'dpmsolver++';
97149
97175
  const messages = {
97150
- model: 'realistic-vision-v3',
97176
+ model,
97151
97177
  prompt: prompt,
97152
- negative_prompt: negative_prompt,
97153
- width: width,
97154
- height: height,
97155
- steps: steps,
97156
- guidance: guidance,
97157
- scheduler: scheduler,
97158
- output_format: output_format,
97178
+ negative_prompt,
97179
+ width: 512,
97180
+ height: 512,
97181
+ steps,
97182
+ guidance,
97183
+ scheduler,
97184
+ output_format: 'jpeg',
97159
97185
  folder_path: ''
97160
97186
  };
97161
97187
  try {
@@ -97175,7 +97201,11 @@ class ContentBuilder {
97175
97201
  return;
97176
97202
  }
97177
97203
  const imageUrl = result.url;
97178
- callback([imageUrl]);
97204
+ if (this.imageAutoUpscale) {
97205
+ this.upscaleImage(imageUrl, callback);
97206
+ } else {
97207
+ callback([imageUrl]);
97208
+ }
97179
97209
  } catch (error) {
97180
97210
  if (error.name === 'AbortError') ; else {
97181
97211
  // CORS or code errors goes here
@@ -111430,6 +111460,12 @@ ${blockContent}
111430
111460
 
111431
111461
  if (tagName === 'img') {
111432
111462
  this.builder.editor.saveForUndo();
111463
+
111464
+ elm.onload = async () => {
111465
+ let divImageResizer = document.querySelector('#divImageResizer');
111466
+ if (divImageResizer) divImageResizer.click();
111467
+ };
111468
+
111433
111469
  elm.setAttribute('src', src); //Trigger Change event
111434
111470
 
111435
111471
  this.builder.onChange();
@@ -117820,8 +117856,16 @@ class ContentBox {
117820
117856
  // renameFileUrl: '',
117821
117857
  // getMmodelsUrl: '',
117822
117858
  // textToImageUrl: '', // To enable AI image generation
117823
- // upscaleImageUrl: '',
117859
+ // upscaleImageUrl: '', // To enable AI image generation
117824
117860
  // controlNetUrl: '',
117861
+ // saveTextUrl: '',
117862
+ // viewImageUrl: '',
117863
+ // imageModel: 'realistic-vision-v3',
117864
+ // imageNegativePrompt: '',
117865
+ // imageSteps: 25,
117866
+ // imageGuidance: 7.5,
117867
+ // imageScheduler: 'dpmsolver++',
117868
+ imageAutoUpscale: true,
117825
117869
  speechTranscribeUrl: '',
117826
117870
  // http://localhost:8081
117827
117871
  autoSendDelay: 4000,
@@ -118386,7 +118430,14 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
118386
118430
  textToImageUrl: this.settings.textToImageUrl,
118387
118431
  upscaleImageUrl: this.settings.upscaleImageUrl,
118388
118432
  controlNetUrl: this.settings.controlNetUrl,
118389
- imageViewUrl: this.settings.imageViewUrl,
118433
+ saveTextUrl: this.settings.saveTextUrl,
118434
+ viewImageUrl: this.settings.viewImageUrl,
118435
+ imageModel: this.settings.imageModel,
118436
+ imageNegativePrompt: this.settings.imageNegativePrompt,
118437
+ imageSteps: this.settings.imageSteps,
118438
+ imageGuidance: this.settings.imageGuidance,
118439
+ imageScheduler: this.settings.imageScheduler,
118440
+ imageAutoUpscale: this.settings.imageAutoUpscale,
118390
118441
  assetPanelReverse: this.settings.assetPanelReverse,
118391
118442
  assetFilesOnly: this.settings.assetFilesOnly,
118392
118443
  assetRefreshButton: this.settings.assetRefreshButton,