@symbo.ls/smbls-utils 3.6.4 → 3.6.7

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.
Files changed (3) hide show
  1. package/LICENSE +25 -12
  2. package/dist/iife/index.js +286 -19
  3. package/package.json +4 -4
package/LICENSE CHANGED
@@ -1,21 +1,34 @@
1
- MIT License
1
+ Creative Commons Attribution-NonCommercial 4.0 International License
2
2
 
3
3
  Copyright (c) 2023 symbo.ls
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ This work is licensed under the Creative Commons Attribution-NonCommercial
6
+ 4.0 International License. To view a copy of this license, visit
7
+ https://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
8
+ Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
11
9
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
10
+ You are free to:
14
11
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ Share copy and redistribute the material in any medium or format
13
+ Adapt — remix, transform, and build upon the material
14
+
15
+ Under the following terms:
16
+
17
+ Attribution — You must give appropriate credit, provide a link to the
18
+ license, and indicate if changes were made. You may do so in any
19
+ reasonable manner, but not in any way that suggests the licensor endorses
20
+ you or your use.
21
+
22
+ NonCommercial — You may not use the material for commercial purposes.
23
+
24
+ No additional restrictions — You may not apply legal terms or
25
+ technological measures that legally restrict others from doing anything
26
+ the license permits.
27
+
28
+ THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
29
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
30
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
31
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
32
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
33
+ OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS IN THE
34
+ WORK.
@@ -4,6 +4,9 @@ var SmblsSmblsUtils = (() => {
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
7
10
  var __export = (target, all) => {
8
11
  for (var name in all)
9
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -18,6 +21,275 @@ var SmblsSmblsUtils = (() => {
18
21
  };
19
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
23
 
24
+ // ../utils/dist/esm/globals.js
25
+ var window2, document2;
26
+ var init_globals = __esm({
27
+ "../utils/dist/esm/globals.js"() {
28
+ window2 = globalThis;
29
+ document2 = window2.document;
30
+ }
31
+ });
32
+
33
+ // ../utils/dist/esm/node.js
34
+ var init_node = __esm({
35
+ "../utils/dist/esm/node.js"() {
36
+ }
37
+ });
38
+
39
+ // ../utils/dist/esm/types.js
40
+ var isObject, isString, isNumber, isArray;
41
+ var init_types = __esm({
42
+ "../utils/dist/esm/types.js"() {
43
+ isObject = (arg) => {
44
+ if (arg === null) return false;
45
+ return typeof arg === "object" && arg.constructor === Object;
46
+ };
47
+ isString = (arg) => typeof arg === "string";
48
+ isNumber = (arg) => typeof arg === "number";
49
+ isArray = (arg) => Array.isArray(arg);
50
+ }
51
+ });
52
+
53
+ // ../utils/dist/esm/array.js
54
+ var init_array = __esm({
55
+ "../utils/dist/esm/array.js"() {
56
+ }
57
+ });
58
+
59
+ // ../utils/dist/esm/string.js
60
+ var init_string = __esm({
61
+ "../utils/dist/esm/string.js"() {
62
+ }
63
+ });
64
+
65
+ // ../utils/dist/esm/keys.js
66
+ var STATE_METHODS, PROPS_METHODS, METHODS, METHODS_EXL;
67
+ var init_keys = __esm({
68
+ "../utils/dist/esm/keys.js"() {
69
+ STATE_METHODS = /* @__PURE__ */ new Set([
70
+ "update",
71
+ "parse",
72
+ "clean",
73
+ "create",
74
+ "destroy",
75
+ "add",
76
+ "toggle",
77
+ "remove",
78
+ "apply",
79
+ "set",
80
+ "reset",
81
+ "replace",
82
+ "quietReplace",
83
+ "quietUpdate",
84
+ "applyReplace",
85
+ "applyFunction",
86
+ "keys",
87
+ "values",
88
+ "ref",
89
+ "rootUpdate",
90
+ "parentUpdate",
91
+ "parent",
92
+ "__element",
93
+ "__depends",
94
+ "__ref",
95
+ "__children",
96
+ "root",
97
+ "setByPath",
98
+ "setPathCollection",
99
+ "removeByPath",
100
+ "removePathCollection",
101
+ "getByPath"
102
+ ]);
103
+ PROPS_METHODS = /* @__PURE__ */ new Set(["update", "__element"]);
104
+ METHODS = /* @__PURE__ */ new Set([
105
+ "set",
106
+ "reset",
107
+ "update",
108
+ "remove",
109
+ "updateContent",
110
+ "removeContent",
111
+ "lookup",
112
+ "lookdown",
113
+ "lookdownAll",
114
+ "getRef",
115
+ "getPath",
116
+ "setNodeStyles",
117
+ "spotByPath",
118
+ "keys",
119
+ "parse",
120
+ "setProps",
121
+ "parseDeep",
122
+ "variables",
123
+ "if",
124
+ "log",
125
+ "verbose",
126
+ "warn",
127
+ "error",
128
+ "call",
129
+ "nextElement",
130
+ "previousElement",
131
+ "getRootState",
132
+ "getRoot",
133
+ "getRootData",
134
+ "getRootContext",
135
+ "getContext",
136
+ "getQuery",
137
+ "getDB",
138
+ "getChildren"
139
+ ]);
140
+ METHODS_EXL = /* @__PURE__ */ new Set([
141
+ "node",
142
+ "context",
143
+ "extends",
144
+ "__element",
145
+ "__ref",
146
+ ...METHODS,
147
+ ...STATE_METHODS,
148
+ ...PROPS_METHODS
149
+ ]);
150
+ }
151
+ });
152
+
153
+ // ../utils/dist/esm/object.js
154
+ var init_object = __esm({
155
+ "../utils/dist/esm/object.js"() {
156
+ }
157
+ });
158
+
159
+ // ../utils/dist/esm/key.js
160
+ var init_key = __esm({
161
+ "../utils/dist/esm/key.js"() {
162
+ }
163
+ });
164
+
165
+ // ../utils/dist/esm/env.js
166
+ var init_env = __esm({
167
+ "../utils/dist/esm/env.js"() {
168
+ }
169
+ });
170
+
171
+ // ../utils/dist/esm/function.js
172
+ var init_function = __esm({
173
+ "../utils/dist/esm/function.js"() {
174
+ }
175
+ });
176
+
177
+ // ../utils/dist/esm/if.js
178
+ var init_if = __esm({
179
+ "../utils/dist/esm/if.js"() {
180
+ }
181
+ });
182
+
183
+ // ../utils/dist/esm/log.js
184
+ var init_log = __esm({
185
+ "../utils/dist/esm/log.js"() {
186
+ }
187
+ });
188
+
189
+ // ../utils/dist/esm/cookie.js
190
+ var isMobile;
191
+ var init_cookie = __esm({
192
+ "../utils/dist/esm/cookie.js"() {
193
+ isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
194
+ }
195
+ });
196
+
197
+ // ../utils/dist/esm/tags.js
198
+ var init_tags = __esm({
199
+ "../utils/dist/esm/tags.js"() {
200
+ }
201
+ });
202
+
203
+ // ../utils/dist/esm/extends.js
204
+ var init_extends = __esm({
205
+ "../utils/dist/esm/extends.js"() {
206
+ }
207
+ });
208
+
209
+ // ../utils/dist/esm/component.js
210
+ var init_component = __esm({
211
+ "../utils/dist/esm/component.js"() {
212
+ }
213
+ });
214
+
215
+ // ../utils/dist/esm/props.js
216
+ var init_props = __esm({
217
+ "../utils/dist/esm/props.js"() {
218
+ }
219
+ });
220
+
221
+ // ../utils/dist/esm/element.js
222
+ var init_element = __esm({
223
+ "../utils/dist/esm/element.js"() {
224
+ }
225
+ });
226
+
227
+ // ../utils/dist/esm/state.js
228
+ var init_state = __esm({
229
+ "../utils/dist/esm/state.js"() {
230
+ }
231
+ });
232
+
233
+ // ../utils/dist/esm/scope.js
234
+ var init_scope = __esm({
235
+ "../utils/dist/esm/scope.js"() {
236
+ }
237
+ });
238
+
239
+ // ../utils/dist/esm/triggerEvent.js
240
+ var init_triggerEvent = __esm({
241
+ "../utils/dist/esm/triggerEvent.js"() {
242
+ }
243
+ });
244
+
245
+ // ../utils/dist/esm/cache.js
246
+ var init_cache = __esm({
247
+ "../utils/dist/esm/cache.js"() {
248
+ }
249
+ });
250
+
251
+ // ../utils/dist/esm/methods.js
252
+ var init_methods = __esm({
253
+ "../utils/dist/esm/methods.js"() {
254
+ }
255
+ });
256
+
257
+ // ../utils/dist/esm/update.js
258
+ var init_update = __esm({
259
+ "../utils/dist/esm/update.js"() {
260
+ }
261
+ });
262
+
263
+ // ../utils/dist/esm/index.js
264
+ var init_esm = __esm({
265
+ "../utils/dist/esm/index.js"() {
266
+ init_key();
267
+ init_env();
268
+ init_types();
269
+ init_object();
270
+ init_function();
271
+ init_array();
272
+ init_node();
273
+ init_if();
274
+ init_log();
275
+ init_string();
276
+ init_globals();
277
+ init_cookie();
278
+ init_tags();
279
+ init_component();
280
+ init_props();
281
+ init_extends();
282
+ init_element();
283
+ init_state();
284
+ init_keys();
285
+ init_scope();
286
+ init_methods();
287
+ init_cache();
288
+ init_update();
289
+ init_triggerEvent();
290
+ }
291
+ });
292
+
21
293
  // src/index.js
22
294
  var index_exports = {};
23
295
  __export(index_exports, {
@@ -50,15 +322,7 @@ var SmblsSmblsUtils = (() => {
50
322
  toTitleCase: () => toTitleCase,
51
323
  toggleFullscreen: () => toggleFullscreen
52
324
  });
53
-
54
- // ../utils/dist/esm/types.js
55
- var isObject = (arg) => {
56
- if (arg === null) return false;
57
- return typeof arg === "object" && arg.constructor === Object;
58
- };
59
- var isString = (arg) => typeof arg === "string";
60
- var isNumber = (arg) => typeof arg === "number";
61
- var isArray = (arg) => Array.isArray(arg);
325
+ init_esm();
62
326
 
63
327
  // src/browser.js
64
328
  async function toggleFullscreen(opts) {
@@ -74,6 +338,7 @@ var SmblsSmblsUtils = (() => {
74
338
  }
75
339
 
76
340
  // src/scaling.js
341
+ init_esm();
77
342
  var findClosestNumber = (number, arr) => {
78
343
  return (isArray(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
79
344
  return Math.abs(curr - number) < Math.abs(prev - number) ? curr : prev;
@@ -195,14 +460,14 @@ var SmblsSmblsUtils = (() => {
195
460
  }
196
461
  };
197
462
  function loadRemoteScript(url, options = {}) {
198
- const { window: window2 = globalThis } = options;
199
- const { document: document2 = window2.document } = options;
463
+ const { window: window3 = globalThis } = options;
464
+ const { document: document3 = window3.document } = options;
200
465
  return new Promise((resolve, reject) => {
201
- const existingScript = document2.querySelector(`script[src="${url}"]`);
466
+ const existingScript = document3.querySelector(`script[src="${url}"]`);
202
467
  if (existingScript) {
203
468
  return resolve(existingScript);
204
469
  }
205
- const script = document2.createElement("script");
470
+ const script = document3.createElement("script");
206
471
  script.src = url;
207
472
  script.async = options.async === true;
208
473
  script.type = options.type || "text/javascript";
@@ -217,18 +482,18 @@ var SmblsSmblsUtils = (() => {
217
482
  script.onerror = script.onload = null;
218
483
  reject(new Error(`Failed to load script: ${url}`));
219
484
  };
220
- document2.head.appendChild(script);
485
+ document3.head.appendChild(script);
221
486
  });
222
487
  }
223
488
  async function loadRemoteCSS(url, options = {}) {
224
- const { window: window2 = globalThis } = options;
225
- const { document: document2 = window2.document } = options;
489
+ const { window: window3 = globalThis } = options;
490
+ const { document: document3 = window3.document } = options;
226
491
  return new Promise((resolve, reject) => {
227
- const existingLink = document2.querySelector(`link[href="${url}"]`);
492
+ const existingLink = document3.querySelector(`link[href="${url}"]`);
228
493
  if (existingLink) {
229
494
  return resolve(existingLink);
230
495
  }
231
- const link = document2.createElement("link");
496
+ const link = document3.createElement("link");
232
497
  link.href = url;
233
498
  link.rel = options.rel || "stylesheet";
234
499
  link.type = "text/css";
@@ -244,7 +509,7 @@ var SmblsSmblsUtils = (() => {
244
509
  link.onerror = link.onload = null;
245
510
  reject(new Error(`Failed to load stylesheet: ${url}`));
246
511
  };
247
- document2.head.appendChild(link);
512
+ document3.head.appendChild(link);
248
513
  });
249
514
  }
250
515
 
@@ -312,6 +577,7 @@ var SmblsSmblsUtils = (() => {
312
577
  };
313
578
 
314
579
  // src/metadata.js
580
+ init_esm();
315
581
  var escapeHtml = (text) => {
316
582
  if (text === null || text === void 0) return "";
317
583
  const map = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#039;" };
@@ -527,3 +793,4 @@ var SmblsSmblsUtils = (() => {
527
793
  };
528
794
  return __toCommonJS(index_exports);
529
795
  })();
796
+ // @preserve-env
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/smbls-utils",
3
- "version": "3.6.4",
3
+ "version": "3.6.7",
4
4
  "author": "symbo.ls",
5
5
  "files": [
6
6
  "dist",
@@ -30,10 +30,10 @@
30
30
  "build": "node ../../build/build.js",
31
31
  "prepublish": "npm run build && npm run copy:package:cjs"
32
32
  },
33
- "license": "ISC",
33
+ "license": "CC-BY-NC-4.0",
34
34
  "dependencies": {
35
- "@domql/element": "^3.6.4",
36
- "@domql/utils": "^3.6.4"
35
+ "@domql/element": "^3.6.7",
36
+ "@domql/utils": "^3.6.7"
37
37
  },
38
38
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
39
39
  "browser": "./dist/esm/index.js",