@mcpher/gas-fakes 2.5.2 → 2.5.4
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/README.md +17 -3
- package/package.json +1 -1
- package/pngs/srv.jpg +0 -0
- package/src/cli/app.js +1 -0
- package/src/cli/togas.js +23 -14
- package/src/index.js +1 -0
- package/src/services/advslides/fakeadvslides.js +11 -5
- package/src/services/base/app.js +9 -0
- package/src/services/base/fakebase.js +28 -0
- package/src/services/common/fakeadvresource.js +3 -2
- package/src/services/content/contentservice.js +3 -2
- package/src/services/enums/baseenums.js +47 -0
- package/src/services/enums/contentenums.js +1 -3
- package/src/services/enums/scriptenums.js +31 -4
- package/src/services/enums/slidesenums.js +3 -1
- package/src/services/enums/xmlenums.js +14 -0
- package/src/services/html/serverworker.js +1 -1
- package/src/services/scriptapp/app.js +14 -7
- package/src/services/scriptapp/fakeauthorizationinfo.js +4 -4
- package/src/services/slidesapp/app.js +5 -0
- package/src/services/slidesapp/fakeautofit.js +1 -1
- package/src/services/slidesapp/fakeborder.js +106 -0
- package/src/services/slidesapp/fakecolorscheme.js +1 -1
- package/src/services/slidesapp/fakefill.js +216 -0
- package/src/services/slidesapp/fakegroup.js +35 -0
- package/src/services/slidesapp/fakeimage.js +118 -0
- package/src/services/slidesapp/fakelayout.js +351 -0
- package/src/services/slidesapp/fakeline.js +2 -2
- package/src/services/slidesapp/fakelinefill.js +15 -16
- package/src/services/slidesapp/fakelink.js +20 -3
- package/src/services/slidesapp/fakelist.js +36 -0
- package/src/services/slidesapp/fakeliststyle.js +105 -0
- package/src/services/slidesapp/fakemaster.js +358 -0
- package/src/services/slidesapp/fakenotesmaster.js +125 -0
- package/src/services/slidesapp/fakenotespage.js +102 -2
- package/src/services/slidesapp/fakepagebackground.js +109 -1
- package/src/services/slidesapp/fakepageelement.js +157 -18
- package/src/services/slidesapp/fakepageelementrange.js +28 -0
- package/src/services/slidesapp/fakepagerange.js +28 -0
- package/src/services/slidesapp/fakeparagraphstyle.js +139 -0
- package/src/services/slidesapp/fakepicturefill.js +32 -0
- package/src/services/slidesapp/fakepresentation.js +126 -2
- package/src/services/slidesapp/fakeshape.js +9 -0
- package/src/services/slidesapp/fakeslide.js +216 -24
- package/src/services/slidesapp/fakesolidfill.js +45 -0
- package/src/services/slidesapp/fakespeakerspotlight.js +18 -0
- package/src/services/slidesapp/faketable.js +55 -9
- package/src/services/slidesapp/faketablecell.js +141 -12
- package/src/services/slidesapp/faketablecellrange.js +28 -0
- package/src/services/slidesapp/faketablecolumn.js +72 -0
- package/src/services/slidesapp/faketablerow.js +31 -0
- package/src/services/slidesapp/faketextrange.js +179 -135
- package/src/services/slidesapp/faketextstyle.js +158 -0
- package/src/services/slidesapp/fakevideo.js +35 -0
- package/src/services/slidesapp/fakewordart.js +22 -0
- package/src/services/slidesapp/pageelementfactory.js +24 -1
- package/src/services/spreadsheetapp/fakeembeddedchartbuilder.js +92 -12
- package/src/services/spreadsheetapp/fakespreadsheet.js +360 -62
- package/src/services/spreadsheetapp/fakespreadsheettheme.js +53 -0
- package/src/services/urlfetchapp/app.js +216 -175
- package/src/services/xmlservice/app.js +3 -78
- package/src/services/xmlservice/fakeattribute.js +15 -0
- package/src/services/xmlservice/fakecdata.js +40 -0
- package/src/services/xmlservice/fakecomment.js +34 -0
- package/src/services/xmlservice/fakecontent.js +51 -0
- package/src/services/xmlservice/fakedoctype.js +68 -0
- package/src/services/xmlservice/fakedocument.js +110 -13
- package/src/services/xmlservice/fakeelement.js +297 -82
- package/src/services/xmlservice/fakeentityref.js +54 -0
- package/src/services/xmlservice/fakeformat.js +67 -22
- package/src/services/xmlservice/fakeprocessinginstruction.js +44 -0
- package/src/services/xmlservice/faketext.js +39 -0
- package/src/services/xmlservice/fakexmlservice.js +118 -0
- package/src/support/sxfetch.js +60 -0
- package/tools/omlx.env.example +6 -0
- package/tools/omlx_mcp_server.cjs +157 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { Proxies } from '../../support/proxies.js';
|
|
2
|
+
import { newFakeSolidFill } from './fakesolidfill.js';
|
|
3
|
+
import { FillType } from '../enums/slidesenums.js';
|
|
4
|
+
|
|
5
|
+
export const newFakeFill = (...args) => {
|
|
6
|
+
return Proxies.guard(new FakeFill(...args));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export class FakeFill {
|
|
10
|
+
constructor(element) {
|
|
11
|
+
this.__element = element;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get __fill() {
|
|
15
|
+
if (this.__element.__resource.shape) {
|
|
16
|
+
return this.__element.__resource.shape.shapeProperties?.shapeBackgroundFill || {};
|
|
17
|
+
}
|
|
18
|
+
if (this.__element.__resource.tableCellProperties) {
|
|
19
|
+
return this.__element.__resource.tableCellProperties.tableCellBackgroundFill || {};
|
|
20
|
+
}
|
|
21
|
+
return this.__element.__resource.pageProperties?.pageBackgroundFill || {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getType() {
|
|
25
|
+
const fill = this.__fill;
|
|
26
|
+
if (fill.solidFill && fill.propertyState !== 'NOT_RENDERED') {
|
|
27
|
+
return FillType.SOLID;
|
|
28
|
+
}
|
|
29
|
+
return FillType.NONE;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
isVisible() {
|
|
33
|
+
return this.getType().toString() !== 'NONE';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getSolidFill() {
|
|
37
|
+
if (this.getType().toString() !== 'SOLID') {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return newFakeSolidFill(this);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setSolidFill(...args) {
|
|
44
|
+
let rgbColor = null;
|
|
45
|
+
let themeColor = null;
|
|
46
|
+
let alpha = 1.0;
|
|
47
|
+
|
|
48
|
+
if (args.length >= 3) {
|
|
49
|
+
const r = args[0] / 255;
|
|
50
|
+
const g = args[1] / 255;
|
|
51
|
+
const b = args[2] / 255;
|
|
52
|
+
rgbColor = { red: r, green: g, blue: b };
|
|
53
|
+
if (args.length === 4) {
|
|
54
|
+
alpha = args[3];
|
|
55
|
+
}
|
|
56
|
+
} else if (args.length > 0) {
|
|
57
|
+
const colorArg = args[0];
|
|
58
|
+
if (args.length === 2) {
|
|
59
|
+
alpha = args[1];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (typeof colorArg === 'string') {
|
|
63
|
+
if (colorArg.startsWith('#') || colorArg.length === 6 || colorArg.length === 3) {
|
|
64
|
+
const hex = colorArg.startsWith('#') ? colorArg : '#' + colorArg;
|
|
65
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
66
|
+
if (result) {
|
|
67
|
+
rgbColor = {
|
|
68
|
+
red: parseInt(result[1], 16) / 255.0,
|
|
69
|
+
green: parseInt(result[2], 16) / 255.0,
|
|
70
|
+
blue: parseInt(result[3], 16) / 255.0
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
themeColor = colorArg.toString();
|
|
75
|
+
}
|
|
76
|
+
} else if (colorArg && typeof colorArg.getColorType === 'function') {
|
|
77
|
+
if (colorArg.getColorType().toString() === 'RGB') {
|
|
78
|
+
const rgb = colorArg.asRgbColor();
|
|
79
|
+
rgbColor = {
|
|
80
|
+
red: rgb.getRed() / 255,
|
|
81
|
+
green: rgb.getGreen() / 255,
|
|
82
|
+
blue: rgb.getBlue() / 255
|
|
83
|
+
};
|
|
84
|
+
} else if (colorArg.getColorType().toString() === 'THEME') {
|
|
85
|
+
themeColor = colorArg.asThemeColor().getThemeColorType().toString();
|
|
86
|
+
}
|
|
87
|
+
} else if (colorArg && colorArg.toString) {
|
|
88
|
+
themeColor = colorArg.toString();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const solidFill = {
|
|
93
|
+
color: {}
|
|
94
|
+
};
|
|
95
|
+
if (rgbColor) {
|
|
96
|
+
solidFill.color.rgbColor = rgbColor;
|
|
97
|
+
} else if (themeColor) {
|
|
98
|
+
solidFill.color.themeColor = themeColor;
|
|
99
|
+
}
|
|
100
|
+
if (alpha !== 1.0) {
|
|
101
|
+
solidFill.alpha = alpha;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const presentationId = this.__element.__presentation?.getId() || this.__element.__page?.__presentation?.getId() || this.__element.__table?.__presentation?.getId();
|
|
105
|
+
if (this.__element.__resource.shape) {
|
|
106
|
+
Slides.Presentations.batchUpdate({ requests: [{
|
|
107
|
+
updateShapeProperties: {
|
|
108
|
+
objectId: this.__element.getObjectId(),
|
|
109
|
+
shapeProperties: {
|
|
110
|
+
shapeBackgroundFill: {
|
|
111
|
+
propertyState: 'RENDERED',
|
|
112
|
+
solidFill: solidFill
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
fields: 'shapeBackgroundFill'
|
|
116
|
+
}
|
|
117
|
+
}] }, presentationId);
|
|
118
|
+
|
|
119
|
+
} else if (this.__element.__resource.tableCellProperties) {
|
|
120
|
+
Slides.Presentations.batchUpdate({ requests: [{
|
|
121
|
+
updateTableCellProperties: {
|
|
122
|
+
objectId: this.__element.getObjectId(),
|
|
123
|
+
tableCellProperties: {
|
|
124
|
+
tableCellBackgroundFill: {
|
|
125
|
+
propertyState: 'RENDERED',
|
|
126
|
+
solidFill: solidFill
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
fields: 'tableCellBackgroundFill',
|
|
130
|
+
tableRange: {
|
|
131
|
+
location: {
|
|
132
|
+
rowIndex: this.__element.getRowIndex(),
|
|
133
|
+
columnIndex: this.__element.getColumnIndex()
|
|
134
|
+
},
|
|
135
|
+
rowSpan: 1,
|
|
136
|
+
columnSpan: 1
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}] }, presentationId);
|
|
140
|
+
|
|
141
|
+
} else {
|
|
142
|
+
Slides.Presentations.batchUpdate({ requests: [{
|
|
143
|
+
updatePageProperties: {
|
|
144
|
+
objectId: this.__element.getObjectId(),
|
|
145
|
+
pageProperties: {
|
|
146
|
+
pageBackgroundFill: {
|
|
147
|
+
propertyState: 'RENDERED',
|
|
148
|
+
solidFill: solidFill
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
fields: 'pageBackgroundFill'
|
|
152
|
+
}
|
|
153
|
+
}] }, presentationId);
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
setTransparent() {
|
|
161
|
+
const presentationId = this.__element.__presentation?.getId() || this.__element.__page?.__presentation?.getId() || this.__element.__table?.__presentation?.getId();
|
|
162
|
+
if (this.__element.__resource.shape) {
|
|
163
|
+
Slides.Presentations.batchUpdate({ requests: [{
|
|
164
|
+
updateShapeProperties: {
|
|
165
|
+
objectId: this.__element.getObjectId(),
|
|
166
|
+
shapeProperties: {
|
|
167
|
+
shapeBackgroundFill: {
|
|
168
|
+
propertyState: 'NOT_RENDERED'
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
fields: 'shapeBackgroundFill'
|
|
172
|
+
}
|
|
173
|
+
}] }, presentationId);
|
|
174
|
+
|
|
175
|
+
} else if (this.__element.__resource.tableCellProperties) {
|
|
176
|
+
Slides.Presentations.batchUpdate({ requests: [{
|
|
177
|
+
updateTableCellProperties: {
|
|
178
|
+
objectId: this.__element.getObjectId(),
|
|
179
|
+
tableCellProperties: {
|
|
180
|
+
tableCellBackgroundFill: {
|
|
181
|
+
propertyState: 'NOT_RENDERED'
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
fields: 'tableCellBackgroundFill',
|
|
185
|
+
tableRange: {
|
|
186
|
+
location: {
|
|
187
|
+
rowIndex: this.__element.getRowIndex(),
|
|
188
|
+
columnIndex: this.__element.getColumnIndex()
|
|
189
|
+
},
|
|
190
|
+
rowSpan: 1,
|
|
191
|
+
columnSpan: 1
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}] }, presentationId);
|
|
195
|
+
|
|
196
|
+
} else {
|
|
197
|
+
Slides.Presentations.batchUpdate({ requests: [{
|
|
198
|
+
updatePageProperties: {
|
|
199
|
+
objectId: this.__element.getObjectId(),
|
|
200
|
+
pageProperties: {
|
|
201
|
+
pageBackgroundFill: {
|
|
202
|
+
propertyState: 'NOT_RENDERED'
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
fields: 'pageBackgroundFill'
|
|
206
|
+
}
|
|
207
|
+
}] }, presentationId);
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
return this;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
toString() {
|
|
214
|
+
return 'Fill';
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Proxies } from '../../support/proxies.js';
|
|
2
|
+
import { FakePageElement, PageElementRegistry } from './fakepageelement.js';
|
|
3
|
+
|
|
4
|
+
export const newFakeGroup = (...args) => {
|
|
5
|
+
return Proxies.guard(new FakeGroup(...args));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
PageElementRegistry.newFakeGroup = newFakeGroup;
|
|
9
|
+
|
|
10
|
+
export class FakeGroup extends FakePageElement {
|
|
11
|
+
constructor(resource, page) {
|
|
12
|
+
super(resource, page);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getChildren() {
|
|
16
|
+
const children = this.__resource.elementGroup?.children || this.__resource.group?.children || [];
|
|
17
|
+
const { newFakePageElement } = PageElementRegistry;
|
|
18
|
+
return children.map(childResource => {
|
|
19
|
+
return newFakePageElement(childResource, this.__page);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ungroup() {
|
|
24
|
+
const presentationId = this.__page.__presentation?.getId() || this.__page.__slide?.__presentation.getId();
|
|
25
|
+
Slides.Presentations.batchUpdate({ requests: [{
|
|
26
|
+
ungroupObjects: {
|
|
27
|
+
objectIds: [this.getObjectId()]
|
|
28
|
+
}
|
|
29
|
+
}] }, presentationId);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
toString() {
|
|
33
|
+
return 'Group';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Proxies } from '../../support/proxies.js';
|
|
2
|
+
import { newFakeBlob } from '../utilities/fakeblob.js';
|
|
3
|
+
import { FakePageElement, PageElementRegistry } from './fakepageelement.js';
|
|
4
|
+
import { newFakeBorder } from './fakeborder.js';
|
|
5
|
+
|
|
6
|
+
export const newFakeImage = (...args) => {
|
|
7
|
+
const image = Proxies.guard(new FakeImage(...args));
|
|
8
|
+
return image;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
PageElementRegistry.newFakeImage = newFakeImage;
|
|
12
|
+
|
|
13
|
+
export class FakeImage extends FakePageElement {
|
|
14
|
+
constructor(resource, page) {
|
|
15
|
+
super(resource, page);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns a FakeBlob representing the image content.
|
|
20
|
+
* @param {string} contentType - The MIME type.
|
|
21
|
+
* @returns {FakeBlob}
|
|
22
|
+
*/
|
|
23
|
+
getAs(contentType) {
|
|
24
|
+
// Return a dummy blob for now
|
|
25
|
+
return newFakeBlob([], contentType, 'image');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns a FakeBlob representing the image content.
|
|
30
|
+
* @returns {FakeBlob}
|
|
31
|
+
*/
|
|
32
|
+
getBlob() {
|
|
33
|
+
return this.getAs('image/png');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns a FakeBorder object.
|
|
38
|
+
* @returns {FakeBorder}
|
|
39
|
+
*/
|
|
40
|
+
getBorder() {
|
|
41
|
+
return newFakeBorder(this);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Gets the URL to the image content.
|
|
46
|
+
* @returns {string}
|
|
47
|
+
*/
|
|
48
|
+
getContentUrl() {
|
|
49
|
+
return this.__resource.image?.contentUrl || '';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Gets the inherent height of the image.
|
|
54
|
+
* @returns {number}
|
|
55
|
+
*/
|
|
56
|
+
getInherentHeight() {
|
|
57
|
+
const sourceProps = this.__resource.image?.sourceProperties;
|
|
58
|
+
if (sourceProps && sourceProps.inherentHeight) {
|
|
59
|
+
// Inherent dimensions are in EMUs. Normalize to PT.
|
|
60
|
+
// 1 PT = 12700 EMU.
|
|
61
|
+
// We don't use __normalize because it has a threshold that might skip small EMUs.
|
|
62
|
+
const val = sourceProps.inherentHeight;
|
|
63
|
+
return typeof val === 'number' ? val / 12700 : this.__normalize(val);
|
|
64
|
+
}
|
|
65
|
+
return this.getHeight();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Gets the inherent width of the image.
|
|
70
|
+
* @returns {number}
|
|
71
|
+
*/
|
|
72
|
+
getInherentWidth() {
|
|
73
|
+
const sourceProps = this.__resource.image?.sourceProperties;
|
|
74
|
+
if (sourceProps && sourceProps.inherentWidth) {
|
|
75
|
+
const val = sourceProps.inherentWidth;
|
|
76
|
+
return typeof val === 'number' ? val / 12700 : this.__normalize(val);
|
|
77
|
+
}
|
|
78
|
+
return this.getWidth();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns the parent placeholder or null.
|
|
83
|
+
* @returns {FakePageElement | null}
|
|
84
|
+
*/
|
|
85
|
+
getParentPlaceholder() {
|
|
86
|
+
// Placeholder logic usually involves finding the element referenced by parentObjectId
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Returns the placeholder index or null.
|
|
92
|
+
* @returns {number | null}
|
|
93
|
+
*/
|
|
94
|
+
getPlaceholderIndex() {
|
|
95
|
+
return this.__resource.image?.placeholder?.index ?? null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Returns the placeholder type.
|
|
100
|
+
* @returns {PlaceholderType}
|
|
101
|
+
*/
|
|
102
|
+
getPlaceholderType() {
|
|
103
|
+
const type = this.__resource.image?.placeholder?.type;
|
|
104
|
+
return type ? SlidesApp.PlaceholderType[type] : SlidesApp.PlaceholderType.NONE;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Gets the source URL of the image.
|
|
109
|
+
* @returns {string}
|
|
110
|
+
*/
|
|
111
|
+
getSourceUrl() {
|
|
112
|
+
return this.__resource.image?.sourceUrl || null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
toString() {
|
|
116
|
+
return 'Image';
|
|
117
|
+
}
|
|
118
|
+
}
|