@symbo.ls/scratch 2.27.16 → 2.28.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.
- package/dist/cjs/index.js +64 -10
- package/dist/cjs/set.js +64 -10
- package/dist/cjs/system/color.js +64 -10
- package/dist/cjs/system/document.js +64 -10
- package/dist/cjs/system/font.js +64 -10
- package/dist/cjs/system/index.js +64 -10
- package/dist/cjs/system/reset.js +64 -10
- package/dist/cjs/system/shadow.js +64 -10
- package/dist/cjs/system/spacing.js +64 -10
- package/dist/cjs/system/svg.js +64 -10
- package/dist/cjs/system/theme.js +64 -10
- package/dist/cjs/system/timing.js +64 -10
- package/dist/cjs/system/typography.js +64 -10
- package/dist/cjs/transforms/index.js +64 -10
- package/dist/cjs/utils/index.js +64 -10
- package/dist/cjs/utils/sequence.js +64 -10
- package/dist/cjs/utils/var.js +64 -10
- package/package.json +4 -4
|
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
|
|
|
66
66
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
67
67
|
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
68
68
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
69
|
+
loadRemoteCSS: () => loadRemoteCSS,
|
|
70
|
+
loadRemoteScript: () => loadRemoteScript,
|
|
69
71
|
removeChars: () => removeChars,
|
|
70
72
|
toCamelCase: () => toCamelCase,
|
|
71
73
|
toDashCase: () => toDashCase2,
|
|
@@ -133,10 +135,12 @@ var require_cjs = __commonJS({
|
|
|
133
135
|
});
|
|
134
136
|
});
|
|
135
137
|
scriptEle.addEventListener("error", (ev) => {
|
|
136
|
-
reject(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
reject(
|
|
139
|
+
new Error({
|
|
140
|
+
status: false,
|
|
141
|
+
message: `Failed to load the script ${FILE_URL}`
|
|
142
|
+
})
|
|
143
|
+
);
|
|
140
144
|
});
|
|
141
145
|
doc.body.appendChild(scriptEle);
|
|
142
146
|
} catch (error) {
|
|
@@ -207,6 +211,59 @@ var require_cjs = __commonJS({
|
|
|
207
211
|
console.warn(error);
|
|
208
212
|
}
|
|
209
213
|
};
|
|
214
|
+
function loadRemoteScript(url, options = {}) {
|
|
215
|
+
const { window: window3 = globalThis } = options;
|
|
216
|
+
const { document: document3 = window3.document } = options;
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
const existingScript = document3.querySelector(`script[src="${url}"]`);
|
|
219
|
+
if (existingScript) {
|
|
220
|
+
return resolve(existingScript);
|
|
221
|
+
}
|
|
222
|
+
const script = document3.createElement("script");
|
|
223
|
+
script.src = url;
|
|
224
|
+
script.async = options.async === true;
|
|
225
|
+
script.type = options.type || "text/javascript";
|
|
226
|
+
if (options.id) script.id = options.id;
|
|
227
|
+
if (options.integrity) script.integrity = options.integrity;
|
|
228
|
+
if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
|
|
229
|
+
script.onload = () => {
|
|
230
|
+
script.onerror = script.onload = null;
|
|
231
|
+
resolve(script);
|
|
232
|
+
};
|
|
233
|
+
script.onerror = () => {
|
|
234
|
+
script.onerror = script.onload = null;
|
|
235
|
+
reject(new Error(`Failed to load script: ${url}`));
|
|
236
|
+
};
|
|
237
|
+
document3.head.appendChild(script);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async function loadRemoteCSS(url, options = {}) {
|
|
241
|
+
const { window: window3 = globalThis } = options;
|
|
242
|
+
const { document: document3 = window3.document } = options;
|
|
243
|
+
return new Promise((resolve, reject) => {
|
|
244
|
+
const existingLink = document3.querySelector(`link[href="${url}"]`);
|
|
245
|
+
if (existingLink) {
|
|
246
|
+
return resolve(existingLink);
|
|
247
|
+
}
|
|
248
|
+
const link = document3.createElement("link");
|
|
249
|
+
link.href = url;
|
|
250
|
+
link.rel = options.rel || "stylesheet";
|
|
251
|
+
link.type = "text/css";
|
|
252
|
+
link.media = options.media || "all";
|
|
253
|
+
if (options.id) link.id = options.id;
|
|
254
|
+
if (options.integrity) link.integrity = options.integrity;
|
|
255
|
+
if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
|
|
256
|
+
link.onload = () => {
|
|
257
|
+
link.onerror = link.onload = null;
|
|
258
|
+
resolve(link);
|
|
259
|
+
};
|
|
260
|
+
link.onerror = () => {
|
|
261
|
+
link.onerror = link.onload = null;
|
|
262
|
+
reject(new Error(`Failed to load stylesheet: ${url}`));
|
|
263
|
+
};
|
|
264
|
+
document3.head.appendChild(link);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
210
267
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
211
268
|
var copyStringToClipboard = async (str) => {
|
|
212
269
|
try {
|
|
@@ -233,12 +290,9 @@ var require_cjs = __commonJS({
|
|
|
233
290
|
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
234
291
|
}).replaceAll(/\s+/g, "");
|
|
235
292
|
};
|
|
236
|
-
var toTitleCase = (str) => str && str.replace(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
240
|
-
}
|
|
241
|
-
);
|
|
293
|
+
var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
|
|
294
|
+
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
295
|
+
});
|
|
242
296
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
243
297
|
var toDescriptionCase = (str = "") => {
|
|
244
298
|
if (typeof str !== "string") return;
|
|
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
|
|
|
66
66
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
67
67
|
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
68
68
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
69
|
+
loadRemoteCSS: () => loadRemoteCSS,
|
|
70
|
+
loadRemoteScript: () => loadRemoteScript,
|
|
69
71
|
removeChars: () => removeChars,
|
|
70
72
|
toCamelCase: () => toCamelCase2,
|
|
71
73
|
toDashCase: () => toDashCase2,
|
|
@@ -133,10 +135,12 @@ var require_cjs = __commonJS({
|
|
|
133
135
|
});
|
|
134
136
|
});
|
|
135
137
|
scriptEle.addEventListener("error", (ev) => {
|
|
136
|
-
reject(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
reject(
|
|
139
|
+
new Error({
|
|
140
|
+
status: false,
|
|
141
|
+
message: `Failed to load the script ${FILE_URL}`
|
|
142
|
+
})
|
|
143
|
+
);
|
|
140
144
|
});
|
|
141
145
|
doc.body.appendChild(scriptEle);
|
|
142
146
|
} catch (error) {
|
|
@@ -207,6 +211,59 @@ var require_cjs = __commonJS({
|
|
|
207
211
|
console.warn(error);
|
|
208
212
|
}
|
|
209
213
|
};
|
|
214
|
+
function loadRemoteScript(url, options = {}) {
|
|
215
|
+
const { window: window3 = globalThis } = options;
|
|
216
|
+
const { document: document3 = window3.document } = options;
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
const existingScript = document3.querySelector(`script[src="${url}"]`);
|
|
219
|
+
if (existingScript) {
|
|
220
|
+
return resolve(existingScript);
|
|
221
|
+
}
|
|
222
|
+
const script = document3.createElement("script");
|
|
223
|
+
script.src = url;
|
|
224
|
+
script.async = options.async === true;
|
|
225
|
+
script.type = options.type || "text/javascript";
|
|
226
|
+
if (options.id) script.id = options.id;
|
|
227
|
+
if (options.integrity) script.integrity = options.integrity;
|
|
228
|
+
if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
|
|
229
|
+
script.onload = () => {
|
|
230
|
+
script.onerror = script.onload = null;
|
|
231
|
+
resolve(script);
|
|
232
|
+
};
|
|
233
|
+
script.onerror = () => {
|
|
234
|
+
script.onerror = script.onload = null;
|
|
235
|
+
reject(new Error(`Failed to load script: ${url}`));
|
|
236
|
+
};
|
|
237
|
+
document3.head.appendChild(script);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async function loadRemoteCSS(url, options = {}) {
|
|
241
|
+
const { window: window3 = globalThis } = options;
|
|
242
|
+
const { document: document3 = window3.document } = options;
|
|
243
|
+
return new Promise((resolve, reject) => {
|
|
244
|
+
const existingLink = document3.querySelector(`link[href="${url}"]`);
|
|
245
|
+
if (existingLink) {
|
|
246
|
+
return resolve(existingLink);
|
|
247
|
+
}
|
|
248
|
+
const link = document3.createElement("link");
|
|
249
|
+
link.href = url;
|
|
250
|
+
link.rel = options.rel || "stylesheet";
|
|
251
|
+
link.type = "text/css";
|
|
252
|
+
link.media = options.media || "all";
|
|
253
|
+
if (options.id) link.id = options.id;
|
|
254
|
+
if (options.integrity) link.integrity = options.integrity;
|
|
255
|
+
if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
|
|
256
|
+
link.onload = () => {
|
|
257
|
+
link.onerror = link.onload = null;
|
|
258
|
+
resolve(link);
|
|
259
|
+
};
|
|
260
|
+
link.onerror = () => {
|
|
261
|
+
link.onerror = link.onload = null;
|
|
262
|
+
reject(new Error(`Failed to load stylesheet: ${url}`));
|
|
263
|
+
};
|
|
264
|
+
document3.head.appendChild(link);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
210
267
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
211
268
|
var copyStringToClipboard = async (str) => {
|
|
212
269
|
try {
|
|
@@ -233,12 +290,9 @@ var require_cjs = __commonJS({
|
|
|
233
290
|
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
234
291
|
}).replaceAll(/\s+/g, "");
|
|
235
292
|
};
|
|
236
|
-
var toTitleCase = (str) => str && str.replace(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
240
|
-
}
|
|
241
|
-
);
|
|
293
|
+
var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
|
|
294
|
+
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
295
|
+
});
|
|
242
296
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
243
297
|
var toDescriptionCase = (str = "") => {
|
|
244
298
|
if (typeof str !== "string") return;
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
|
|
|
66
66
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
67
67
|
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
68
68
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
69
|
+
loadRemoteCSS: () => loadRemoteCSS,
|
|
70
|
+
loadRemoteScript: () => loadRemoteScript,
|
|
69
71
|
removeChars: () => removeChars,
|
|
70
72
|
toCamelCase: () => toCamelCase,
|
|
71
73
|
toDashCase: () => toDashCase2,
|
|
@@ -133,10 +135,12 @@ var require_cjs = __commonJS({
|
|
|
133
135
|
});
|
|
134
136
|
});
|
|
135
137
|
scriptEle.addEventListener("error", (ev) => {
|
|
136
|
-
reject(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
reject(
|
|
139
|
+
new Error({
|
|
140
|
+
status: false,
|
|
141
|
+
message: `Failed to load the script ${FILE_URL}`
|
|
142
|
+
})
|
|
143
|
+
);
|
|
140
144
|
});
|
|
141
145
|
doc.body.appendChild(scriptEle);
|
|
142
146
|
} catch (error) {
|
|
@@ -207,6 +211,59 @@ var require_cjs = __commonJS({
|
|
|
207
211
|
console.warn(error);
|
|
208
212
|
}
|
|
209
213
|
};
|
|
214
|
+
function loadRemoteScript(url, options = {}) {
|
|
215
|
+
const { window: window3 = globalThis } = options;
|
|
216
|
+
const { document: document3 = window3.document } = options;
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
const existingScript = document3.querySelector(`script[src="${url}"]`);
|
|
219
|
+
if (existingScript) {
|
|
220
|
+
return resolve(existingScript);
|
|
221
|
+
}
|
|
222
|
+
const script = document3.createElement("script");
|
|
223
|
+
script.src = url;
|
|
224
|
+
script.async = options.async === true;
|
|
225
|
+
script.type = options.type || "text/javascript";
|
|
226
|
+
if (options.id) script.id = options.id;
|
|
227
|
+
if (options.integrity) script.integrity = options.integrity;
|
|
228
|
+
if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
|
|
229
|
+
script.onload = () => {
|
|
230
|
+
script.onerror = script.onload = null;
|
|
231
|
+
resolve(script);
|
|
232
|
+
};
|
|
233
|
+
script.onerror = () => {
|
|
234
|
+
script.onerror = script.onload = null;
|
|
235
|
+
reject(new Error(`Failed to load script: ${url}`));
|
|
236
|
+
};
|
|
237
|
+
document3.head.appendChild(script);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async function loadRemoteCSS(url, options = {}) {
|
|
241
|
+
const { window: window3 = globalThis } = options;
|
|
242
|
+
const { document: document3 = window3.document } = options;
|
|
243
|
+
return new Promise((resolve, reject) => {
|
|
244
|
+
const existingLink = document3.querySelector(`link[href="${url}"]`);
|
|
245
|
+
if (existingLink) {
|
|
246
|
+
return resolve(existingLink);
|
|
247
|
+
}
|
|
248
|
+
const link = document3.createElement("link");
|
|
249
|
+
link.href = url;
|
|
250
|
+
link.rel = options.rel || "stylesheet";
|
|
251
|
+
link.type = "text/css";
|
|
252
|
+
link.media = options.media || "all";
|
|
253
|
+
if (options.id) link.id = options.id;
|
|
254
|
+
if (options.integrity) link.integrity = options.integrity;
|
|
255
|
+
if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
|
|
256
|
+
link.onload = () => {
|
|
257
|
+
link.onerror = link.onload = null;
|
|
258
|
+
resolve(link);
|
|
259
|
+
};
|
|
260
|
+
link.onerror = () => {
|
|
261
|
+
link.onerror = link.onload = null;
|
|
262
|
+
reject(new Error(`Failed to load stylesheet: ${url}`));
|
|
263
|
+
};
|
|
264
|
+
document3.head.appendChild(link);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
210
267
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
211
268
|
var copyStringToClipboard = async (str) => {
|
|
212
269
|
try {
|
|
@@ -233,12 +290,9 @@ var require_cjs = __commonJS({
|
|
|
233
290
|
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
234
291
|
}).replaceAll(/\s+/g, "");
|
|
235
292
|
};
|
|
236
|
-
var toTitleCase = (str) => str && str.replace(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
240
|
-
}
|
|
241
|
-
);
|
|
293
|
+
var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
|
|
294
|
+
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
295
|
+
});
|
|
242
296
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
243
297
|
var toDescriptionCase = (str = "") => {
|
|
244
298
|
if (typeof str !== "string") return;
|
|
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
|
|
|
66
66
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
67
67
|
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
68
68
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
69
|
+
loadRemoteCSS: () => loadRemoteCSS,
|
|
70
|
+
loadRemoteScript: () => loadRemoteScript,
|
|
69
71
|
removeChars: () => removeChars,
|
|
70
72
|
toCamelCase: () => toCamelCase,
|
|
71
73
|
toDashCase: () => toDashCase2,
|
|
@@ -133,10 +135,12 @@ var require_cjs = __commonJS({
|
|
|
133
135
|
});
|
|
134
136
|
});
|
|
135
137
|
scriptEle.addEventListener("error", (ev) => {
|
|
136
|
-
reject(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
reject(
|
|
139
|
+
new Error({
|
|
140
|
+
status: false,
|
|
141
|
+
message: `Failed to load the script ${FILE_URL}`
|
|
142
|
+
})
|
|
143
|
+
);
|
|
140
144
|
});
|
|
141
145
|
doc.body.appendChild(scriptEle);
|
|
142
146
|
} catch (error) {
|
|
@@ -207,6 +211,59 @@ var require_cjs = __commonJS({
|
|
|
207
211
|
console.warn(error);
|
|
208
212
|
}
|
|
209
213
|
};
|
|
214
|
+
function loadRemoteScript(url, options = {}) {
|
|
215
|
+
const { window: window3 = globalThis } = options;
|
|
216
|
+
const { document: document3 = window3.document } = options;
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
const existingScript = document3.querySelector(`script[src="${url}"]`);
|
|
219
|
+
if (existingScript) {
|
|
220
|
+
return resolve(existingScript);
|
|
221
|
+
}
|
|
222
|
+
const script = document3.createElement("script");
|
|
223
|
+
script.src = url;
|
|
224
|
+
script.async = options.async === true;
|
|
225
|
+
script.type = options.type || "text/javascript";
|
|
226
|
+
if (options.id) script.id = options.id;
|
|
227
|
+
if (options.integrity) script.integrity = options.integrity;
|
|
228
|
+
if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
|
|
229
|
+
script.onload = () => {
|
|
230
|
+
script.onerror = script.onload = null;
|
|
231
|
+
resolve(script);
|
|
232
|
+
};
|
|
233
|
+
script.onerror = () => {
|
|
234
|
+
script.onerror = script.onload = null;
|
|
235
|
+
reject(new Error(`Failed to load script: ${url}`));
|
|
236
|
+
};
|
|
237
|
+
document3.head.appendChild(script);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async function loadRemoteCSS(url, options = {}) {
|
|
241
|
+
const { window: window3 = globalThis } = options;
|
|
242
|
+
const { document: document3 = window3.document } = options;
|
|
243
|
+
return new Promise((resolve, reject) => {
|
|
244
|
+
const existingLink = document3.querySelector(`link[href="${url}"]`);
|
|
245
|
+
if (existingLink) {
|
|
246
|
+
return resolve(existingLink);
|
|
247
|
+
}
|
|
248
|
+
const link = document3.createElement("link");
|
|
249
|
+
link.href = url;
|
|
250
|
+
link.rel = options.rel || "stylesheet";
|
|
251
|
+
link.type = "text/css";
|
|
252
|
+
link.media = options.media || "all";
|
|
253
|
+
if (options.id) link.id = options.id;
|
|
254
|
+
if (options.integrity) link.integrity = options.integrity;
|
|
255
|
+
if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
|
|
256
|
+
link.onload = () => {
|
|
257
|
+
link.onerror = link.onload = null;
|
|
258
|
+
resolve(link);
|
|
259
|
+
};
|
|
260
|
+
link.onerror = () => {
|
|
261
|
+
link.onerror = link.onload = null;
|
|
262
|
+
reject(new Error(`Failed to load stylesheet: ${url}`));
|
|
263
|
+
};
|
|
264
|
+
document3.head.appendChild(link);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
210
267
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
211
268
|
var copyStringToClipboard = async (str) => {
|
|
212
269
|
try {
|
|
@@ -233,12 +290,9 @@ var require_cjs = __commonJS({
|
|
|
233
290
|
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
234
291
|
}).replaceAll(/\s+/g, "");
|
|
235
292
|
};
|
|
236
|
-
var toTitleCase = (str) => str && str.replace(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
240
|
-
}
|
|
241
|
-
);
|
|
293
|
+
var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
|
|
294
|
+
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
295
|
+
});
|
|
242
296
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
243
297
|
var toDescriptionCase = (str = "") => {
|
|
244
298
|
if (typeof str !== "string") return;
|
package/dist/cjs/utils/var.js
CHANGED
|
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
|
|
|
66
66
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
67
67
|
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
68
68
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
69
|
+
loadRemoteCSS: () => loadRemoteCSS,
|
|
70
|
+
loadRemoteScript: () => loadRemoteScript,
|
|
69
71
|
removeChars: () => removeChars,
|
|
70
72
|
toCamelCase: () => toCamelCase,
|
|
71
73
|
toDashCase: () => toDashCase2,
|
|
@@ -133,10 +135,12 @@ var require_cjs = __commonJS({
|
|
|
133
135
|
});
|
|
134
136
|
});
|
|
135
137
|
scriptEle.addEventListener("error", (ev) => {
|
|
136
|
-
reject(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
reject(
|
|
139
|
+
new Error({
|
|
140
|
+
status: false,
|
|
141
|
+
message: `Failed to load the script ${FILE_URL}`
|
|
142
|
+
})
|
|
143
|
+
);
|
|
140
144
|
});
|
|
141
145
|
doc.body.appendChild(scriptEle);
|
|
142
146
|
} catch (error) {
|
|
@@ -207,6 +211,59 @@ var require_cjs = __commonJS({
|
|
|
207
211
|
console.warn(error);
|
|
208
212
|
}
|
|
209
213
|
};
|
|
214
|
+
function loadRemoteScript(url, options = {}) {
|
|
215
|
+
const { window: window3 = globalThis } = options;
|
|
216
|
+
const { document: document3 = window3.document } = options;
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
const existingScript = document3.querySelector(`script[src="${url}"]`);
|
|
219
|
+
if (existingScript) {
|
|
220
|
+
return resolve(existingScript);
|
|
221
|
+
}
|
|
222
|
+
const script = document3.createElement("script");
|
|
223
|
+
script.src = url;
|
|
224
|
+
script.async = options.async === true;
|
|
225
|
+
script.type = options.type || "text/javascript";
|
|
226
|
+
if (options.id) script.id = options.id;
|
|
227
|
+
if (options.integrity) script.integrity = options.integrity;
|
|
228
|
+
if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
|
|
229
|
+
script.onload = () => {
|
|
230
|
+
script.onerror = script.onload = null;
|
|
231
|
+
resolve(script);
|
|
232
|
+
};
|
|
233
|
+
script.onerror = () => {
|
|
234
|
+
script.onerror = script.onload = null;
|
|
235
|
+
reject(new Error(`Failed to load script: ${url}`));
|
|
236
|
+
};
|
|
237
|
+
document3.head.appendChild(script);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async function loadRemoteCSS(url, options = {}) {
|
|
241
|
+
const { window: window3 = globalThis } = options;
|
|
242
|
+
const { document: document3 = window3.document } = options;
|
|
243
|
+
return new Promise((resolve, reject) => {
|
|
244
|
+
const existingLink = document3.querySelector(`link[href="${url}"]`);
|
|
245
|
+
if (existingLink) {
|
|
246
|
+
return resolve(existingLink);
|
|
247
|
+
}
|
|
248
|
+
const link = document3.createElement("link");
|
|
249
|
+
link.href = url;
|
|
250
|
+
link.rel = options.rel || "stylesheet";
|
|
251
|
+
link.type = "text/css";
|
|
252
|
+
link.media = options.media || "all";
|
|
253
|
+
if (options.id) link.id = options.id;
|
|
254
|
+
if (options.integrity) link.integrity = options.integrity;
|
|
255
|
+
if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
|
|
256
|
+
link.onload = () => {
|
|
257
|
+
link.onerror = link.onload = null;
|
|
258
|
+
resolve(link);
|
|
259
|
+
};
|
|
260
|
+
link.onerror = () => {
|
|
261
|
+
link.onerror = link.onload = null;
|
|
262
|
+
reject(new Error(`Failed to load stylesheet: ${url}`));
|
|
263
|
+
};
|
|
264
|
+
document3.head.appendChild(link);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
210
267
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
211
268
|
var copyStringToClipboard = async (str) => {
|
|
212
269
|
try {
|
|
@@ -233,12 +290,9 @@ var require_cjs = __commonJS({
|
|
|
233
290
|
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
234
291
|
}).replaceAll(/\s+/g, "");
|
|
235
292
|
};
|
|
236
|
-
var toTitleCase = (str) => str && str.replace(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
240
|
-
}
|
|
241
|
-
);
|
|
293
|
+
var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
|
|
294
|
+
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
295
|
+
});
|
|
242
296
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
243
297
|
var toDescriptionCase = (str = "") => {
|
|
244
298
|
if (typeof str !== "string") return;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@symbo.ls/scratch",
|
|
3
3
|
"description": "Φ / CSS framework and methodology.",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.28.1",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
8
8
|
"dist"
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@domql/utils": "^2.
|
|
29
|
-
"@symbo.ls/utils": "^2.
|
|
28
|
+
"@domql/utils": "^2.28.1",
|
|
29
|
+
"@symbo.ls/utils": "^2.28.1",
|
|
30
30
|
"color-contrast-checker": "^1.5.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "371cc070cdca345fcd7ea73558d336a03c847825"
|
|
33
33
|
}
|