@design-edito/tools 0.1.53 → 0.1.54
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/agnostic/arrays/find-duplicates/index.js +1 -1
- package/agnostic/arrays/index.js +8 -8
- package/agnostic/arrays/is-array-of/index.js +1 -1
- package/agnostic/arrays/make/index.js +1 -1
- package/agnostic/arrays/random-pick/index.js +5 -5
- package/agnostic/arrays/shuffle/index.js +1 -1
- package/agnostic/booleans/index.js +1 -1
- package/agnostic/booleans/is-falsy/index.js +1 -1
- package/agnostic/css/bem/index.js +1 -1
- package/agnostic/css/generate-nice-color/index.js +1 -1
- package/agnostic/css/index.js +9 -9
- package/agnostic/css/is-valid-css-class-name/index.js +1 -1
- package/agnostic/css/styles-set/index.js +7 -7
- package/agnostic/errors/index.js +1 -1
- package/agnostic/errors/register/index.js +1 -1
- package/agnostic/errors/unknown-to-string/index.js +1 -1
- package/agnostic/html/get-node-ancestors/index.js +1 -1
- package/agnostic/html/get-position-inside-parent/index.js +1 -1
- package/agnostic/html/hyper-json/cast/index.js +5 -5
- package/agnostic/html/hyper-json/index.js +6 -6
- package/agnostic/html/hyper-json/method/index.js +1 -1
- package/agnostic/html/hyper-json/serialize/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/any/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/array/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/null/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +5 -5
- package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +5 -5
- package/agnostic/html/hyper-json/transformer/index.js +1 -1
- package/agnostic/html/hyper-json/tree/index.js +5 -5
- package/agnostic/html/hyper-json/types/index.js +1 -1
- package/agnostic/html/hyper-json/utils/index.js +5 -5
- package/agnostic/html/index.js +19 -19
- package/agnostic/html/insert-node/index.js +1 -1
- package/agnostic/html/placeholders/index.js +1 -1
- package/agnostic/html/replace-in-element/index.js +1 -1
- package/agnostic/html/sanitize/index.js +5 -5
- package/agnostic/html/selector-to-element/index.js +5 -5
- package/agnostic/html/string-to-nodes/index.js +6 -6
- package/agnostic/misc/assert/index.js +1 -1
- package/agnostic/misc/cast/index.js +1 -1
- package/agnostic/misc/crawler/index.js +1 -1
- package/agnostic/misc/crossenv/detect-runtime/index.js +1 -1
- package/agnostic/misc/crossenv/index.js +3 -3
- package/agnostic/misc/crossenv/types/index.js +1 -1
- package/agnostic/misc/crossenv/window/index.js +1 -1
- package/agnostic/misc/data-size/index.js +1 -1
- package/agnostic/misc/elo/index.js +1 -1
- package/agnostic/misc/get-current-downlink/index.js +1 -1
- package/agnostic/misc/index.js +28 -28
- package/agnostic/misc/is-constructor-function/index.js +1 -1
- package/agnostic/misc/is-nullish/index.js +1 -1
- package/agnostic/misc/logs/index.js +3 -3
- package/agnostic/misc/logs/logger/index.js +1 -1
- package/agnostic/misc/logs/make-text-block/index.js +1 -1
- package/agnostic/misc/logs/styles/index.js +1 -1
- package/agnostic/misc/lorem-ipsum/index.js +13 -13
- package/agnostic/misc/outcome/index.js +1 -1
- package/agnostic/numbers/absolute-modulo/index.js +1 -1
- package/agnostic/numbers/clamp/index.js +1 -1
- package/agnostic/numbers/index.js +5 -5
- package/agnostic/numbers/interpolate/index.js +1 -1
- package/agnostic/numbers/responsive-harmonics/index.js +1 -1
- package/agnostic/numbers/round/index.js +1 -1
- package/agnostic/objects/deep-get-property/index.js +1 -1
- package/agnostic/objects/enums/index.js +1 -1
- package/agnostic/objects/enums/is-in-enum/index.js +1 -1
- package/agnostic/objects/flatten-getters/index.js +1 -1
- package/agnostic/objects/index.js +13 -13
- package/agnostic/objects/is-object/index.js +1 -1
- package/agnostic/objects/is-record/index.js +1 -1
- package/agnostic/objects/record-format/index.js +1 -1
- package/agnostic/objects/record-map/index.js +1 -1
- package/agnostic/objects/validation/index.js +1 -1
- package/agnostic/optim/index.js +1 -1
- package/agnostic/optim/memoize/index.js +1 -1
- package/agnostic/optim/throttle-debounce/index.js +1 -1
- package/agnostic/random/hex-char/index.js +1 -1
- package/agnostic/random/index.js +3 -3
- package/agnostic/random/random/index.js +1 -1
- package/agnostic/random/uuid/index.js +1 -1
- package/agnostic/regexps/index.js +1 -1
- package/agnostic/strings/char-codes/index.js +1 -1
- package/agnostic/strings/index.js +7 -7
- package/agnostic/strings/matches/index.js +1 -1
- package/agnostic/strings/normalize-indent/index.js +1 -1
- package/agnostic/strings/replace-all/index.js +1 -1
- package/agnostic/strings/to-alphanum/index.js +1 -1
- package/agnostic/strings/trim/index.js +1 -1
- package/agnostic/time/dates/format-date/index.js +1 -1
- package/agnostic/time/dates/index.js +1 -1
- package/agnostic/time/duration/index.js +1 -1
- package/agnostic/time/index.js +4 -4
- package/agnostic/time/timeout/index.js +1 -1
- package/agnostic/time/transitions/index.js +1 -1
- package/agnostic/time/wait/index.js +1 -1
- package/chunks/chunk-35W7XRC3.js +173 -0
- package/chunks/chunk-3GTGE66Y.js +32 -0
- package/chunks/chunk-422KBDRV.js +203 -0
- package/chunks/chunk-4OH2EX3D.js +191 -0
- package/chunks/chunk-4WOYAD35.js +31 -0
- package/chunks/chunk-5JMTDJWX.js +37 -0
- package/chunks/chunk-5RGHYFQH.js +70 -0
- package/chunks/chunk-5VHFXWFM.js +31 -0
- package/chunks/chunk-6DA4S65P.js +37 -0
- package/chunks/chunk-7DDXALPH.js +49 -0
- package/chunks/chunk-7YSTZ7GY.js +31 -0
- package/chunks/chunk-A4FSJC46.js +58 -0
- package/chunks/chunk-BNNAZPI2.js +191 -0
- package/chunks/chunk-BONBND7I.js +239 -0
- package/chunks/chunk-EM37BFXO.js +35 -0
- package/chunks/chunk-ERAFJXWH.js +20 -0
- package/chunks/chunk-FEFY3V6P.js +31 -0
- package/chunks/chunk-FJTOFK3C.js +203 -0
- package/chunks/chunk-G66DWXF3.js +31 -0
- package/chunks/chunk-GP44TBRI.js +39 -0
- package/chunks/chunk-HTNLTDQT.js +28 -0
- package/chunks/chunk-I66DPQN2.js +31 -0
- package/chunks/chunk-JBDWHJ4Q.js +31 -0
- package/chunks/chunk-JJWKHBXD.js +68 -0
- package/chunks/chunk-MOA6JFUQ.js +2369 -0
- package/chunks/chunk-MUYZV5F3.js +2369 -0
- package/chunks/chunk-N4BZJOGW.js +56 -0
- package/chunks/chunk-N4LMP4UM.js +31 -0
- package/chunks/chunk-Q7HA7IAA.js +20 -0
- package/chunks/chunk-QTTNO4T6.js +37 -0
- package/chunks/chunk-QVIRBFMQ.js +31 -0
- package/chunks/chunk-ROJZUEYL.js +37 -0
- package/chunks/chunk-SPMF4X5X.js +31 -0
- package/chunks/chunk-UVSTFYSD.js +28 -0
- package/chunks/chunk-VQEP2EQF.js +100 -0
- package/chunks/chunk-VV72XGJJ.js +58 -0
- package/chunks/chunk-VXSOUAUT.js +100 -0
- package/chunks/chunk-W6BFU7Y5.js +56 -0
- package/chunks/chunk-WOGRENMM.js +31 -0
- package/chunks/chunk-X5FAZBWL.js +130 -0
- package/chunks/chunk-YMRAUWRW.js +20 -0
- package/chunks/chunk-ZNA7SWFK.js +29 -0
- package/components/Comp/index.js +1 -1
- package/node/@design-edito/index.js +6 -6
- package/node/@design-edito/thumbnails/colors/index.js +2 -2
- package/node/@design-edito/thumbnails/common/index.js +2 -2
- package/node/@design-edito/thumbnails/easings/index.js +2 -2
- package/node/@design-edito/thumbnails/index.js +6 -6
- package/node/@design-edito/thumbnails/layout/index.js +4 -4
- package/node/@express/@multer/index.js +2 -3
- package/node/@express/index.js +2 -3
- package/node/@google-cloud/index.js +17 -17
- package/node/@google-cloud/storage/bucket/get-metadata/index.js +2 -2
- package/node/@google-cloud/storage/bucket/index.js +6 -6
- package/node/@google-cloud/storage/bucket/list/index.js +2 -2
- package/node/@google-cloud/storage/file/copy/index.js +2 -2
- package/node/@google-cloud/storage/file/download/index.js +2 -2
- package/node/@google-cloud/storage/file/erase/index.js +2 -2
- package/node/@google-cloud/storage/file/exists/index.js +2 -2
- package/node/@google-cloud/storage/file/generate-signed-url/index.js +2 -2
- package/node/@google-cloud/storage/file/get-metadata/index.js +2 -2
- package/node/@google-cloud/storage/file/get-permissions/index.js +2 -2
- package/node/@google-cloud/storage/file/index.js +21 -21
- package/node/@google-cloud/storage/file/move/index.js +2 -2
- package/node/@google-cloud/storage/file/revoke-signed-urls/index.js +5 -5
- package/node/@google-cloud/storage/file/update-metadata/index.js +2 -2
- package/node/@google-cloud/storage/file/upload/index.js +2 -2
- package/node/@google-cloud/storage/index.js +17 -17
- package/node/encryption/buffer/index.js +1 -1
- package/node/encryption/generate-key/index.js +1 -1
- package/node/encryption/index.js +1 -1
- package/node/encryption/uint8-array/index.js +1 -1
- package/node/files/index.js +4 -4
- package/node/files/is-in-directory/index.js +1 -1
- package/node/files/read-write/index.js +1 -1
- package/node/files/subpaths/index.js +1 -1
- package/node/images/exports/index.js +2 -4
- package/node/images/index.js +10 -12
- package/node/images/prepare/index.js +10 -12
- package/node/images/transform/area-composition/index.js +7 -8
- package/node/images/transform/index.js +8 -9
- package/node/process/index.js +1 -1
- package/node/process/on-exit/index.js +1 -1
- package/package.json +2 -4
@@ -1,25 +1,25 @@
|
|
1
1
|
import {
|
2
2
|
CharCodes
|
3
3
|
} from "../../chunks/chunk-34U4HX4V.js";
|
4
|
-
import {
|
5
|
-
normalizeIndent
|
6
|
-
} from "../../chunks/chunk-JQXNEJAP.js";
|
7
4
|
import {
|
8
5
|
matches,
|
9
6
|
matchesEvery,
|
10
7
|
matchesSome
|
11
8
|
} from "../../chunks/chunk-LQFKUNVQ.js";
|
9
|
+
import {
|
10
|
+
toAlphanum
|
11
|
+
} from "../../chunks/chunk-COVPTTAD.js";
|
12
12
|
import {
|
13
13
|
replaceAll
|
14
14
|
} from "../../chunks/chunk-ZTDVUXPR.js";
|
15
|
+
import {
|
16
|
+
normalizeIndent
|
17
|
+
} from "../../chunks/chunk-JQXNEJAP.js";
|
15
18
|
import {
|
16
19
|
trimEnd,
|
17
20
|
trimStart
|
18
21
|
} from "../../chunks/chunk-6XL25OZX.js";
|
19
|
-
import
|
20
|
-
toAlphanum
|
21
|
-
} from "../../chunks/chunk-COVPTTAD.js";
|
22
|
-
import "../../chunks/chunk-XCBH6NLF.js";
|
22
|
+
import "../../chunks/chunk-WSFCRVEQ.js";
|
23
23
|
|
24
24
|
// src/agnostic/strings/index.ts
|
25
25
|
var Strings;
|
package/agnostic/time/index.js
CHANGED
@@ -2,19 +2,19 @@ import {
|
|
2
2
|
Dates
|
3
3
|
} from "../../chunks/chunk-FZOU4OAW.js";
|
4
4
|
import "../../chunks/chunk-YQWZ3EP2.js";
|
5
|
-
import {
|
6
|
-
timeout
|
7
|
-
} from "../../chunks/chunk-Z7ZDDBV5.js";
|
8
5
|
import {
|
9
6
|
Duration
|
10
7
|
} from "../../chunks/chunk-6NYUQXJT.js";
|
8
|
+
import {
|
9
|
+
timeout
|
10
|
+
} from "../../chunks/chunk-Z7ZDDBV5.js";
|
11
11
|
import {
|
12
12
|
Transitions
|
13
13
|
} from "../../chunks/chunk-ENMBK6H7.js";
|
14
14
|
import {
|
15
15
|
wait
|
16
16
|
} from "../../chunks/chunk-4CIS3R7T.js";
|
17
|
-
import "../../chunks/chunk-
|
17
|
+
import "../../chunks/chunk-WSFCRVEQ.js";
|
18
18
|
|
19
19
|
// src/agnostic/time/index.ts
|
20
20
|
var Time;
|
@@ -0,0 +1,173 @@
|
|
1
|
+
import {
|
2
|
+
Random
|
3
|
+
} from "./chunk-DCKTGQOX.js";
|
4
|
+
import {
|
5
|
+
register
|
6
|
+
} from "./chunk-P2H6PV4O.js";
|
7
|
+
|
8
|
+
// src/agnostic/css/styles-set/index.tsx
|
9
|
+
import { Component } from "react";
|
10
|
+
import { createRoot as reactCreateRoot } from "react-dom/client";
|
11
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
12
|
+
var StylesSet = class _StylesSet {
|
13
|
+
static defaultPrivateIDAttribute = "data-styleset-private-id";
|
14
|
+
static defaultPublicIDAttribute = "data-styleset-public-id";
|
15
|
+
tagsPrivateIDAttribute = _StylesSet.defaultPrivateIDAttribute;
|
16
|
+
tagsPublicIDAttribute = _StylesSet.defaultPublicIDAttribute;
|
17
|
+
_items = /* @__PURE__ */ new Map();
|
18
|
+
get items() {
|
19
|
+
const sortedItemsArray = Array.from(this._items).map(([privateId, item]) => {
|
20
|
+
const targetPosition = this.getTargetPosition(privateId) ?? 0;
|
21
|
+
return { targetPosition, privateId, item };
|
22
|
+
}).sort((a, b) => a.targetPosition - b.targetPosition).map(({ item, privateId }) => [privateId, item]);
|
23
|
+
const sortedItemsMap = new Map(sortedItemsArray);
|
24
|
+
return sortedItemsMap;
|
25
|
+
}
|
26
|
+
getTargetPosition(privateId) {
|
27
|
+
const orderedStyles = Array.from(this._items).map(([privateId2, data]) => ({ privateId: privateId2, data })).sort((a, b) => {
|
28
|
+
const aPos = a.data.position ?? 0;
|
29
|
+
const bPos = b.data.position ?? 0;
|
30
|
+
return aPos - bPos;
|
31
|
+
});
|
32
|
+
const foundIndex = orderedStyles.findIndex((item) => item.privateId === privateId);
|
33
|
+
return foundIndex === -1 ? null : foundIndex;
|
34
|
+
}
|
35
|
+
setTagsPrivateIDAttribute(str) {
|
36
|
+
this.tagsPrivateIDAttribute = str;
|
37
|
+
return this;
|
38
|
+
}
|
39
|
+
setTagsPublicIDAttribute(str) {
|
40
|
+
this.tagsPublicIDAttribute = str;
|
41
|
+
return this;
|
42
|
+
}
|
43
|
+
getById(id) {
|
44
|
+
const found = Array.from(this._items.values()).find((entry) => entry.id === id);
|
45
|
+
if (found === void 0) return void 0;
|
46
|
+
return found;
|
47
|
+
}
|
48
|
+
generateUniquePrivateId() {
|
49
|
+
const existingIds = Array.from(this._items.keys());
|
50
|
+
const generated = Random.randomHash(12);
|
51
|
+
if (existingIds.includes(generated)) return this.generateUniquePrivateId();
|
52
|
+
return generated;
|
53
|
+
}
|
54
|
+
_rendered = /* @__PURE__ */ new Map();
|
55
|
+
render(element) {
|
56
|
+
const root = reactCreateRoot(element);
|
57
|
+
const items = this.items;
|
58
|
+
root.render(/* @__PURE__ */ jsx(
|
59
|
+
StylesSetComp,
|
60
|
+
{
|
61
|
+
items,
|
62
|
+
privateIDAttribute: this.tagsPrivateIDAttribute,
|
63
|
+
publicIDAttribute: this.tagsPublicIDAttribute
|
64
|
+
}
|
65
|
+
));
|
66
|
+
this._rendered.set(element, root);
|
67
|
+
return this;
|
68
|
+
}
|
69
|
+
unmount(element) {
|
70
|
+
if (!this._rendered.has(element)) return this;
|
71
|
+
const root = this._rendered.get(element);
|
72
|
+
if (root === void 0) return this;
|
73
|
+
root.unmount();
|
74
|
+
this._rendered.delete(element);
|
75
|
+
return this;
|
76
|
+
}
|
77
|
+
updateRendered() {
|
78
|
+
const { items } = this;
|
79
|
+
this._rendered.forEach((root) => root.render(/* @__PURE__ */ jsx(
|
80
|
+
StylesSetComp,
|
81
|
+
{
|
82
|
+
items,
|
83
|
+
privateIDAttribute: this.tagsPrivateIDAttribute,
|
84
|
+
publicIDAttribute: this.tagsPublicIDAttribute
|
85
|
+
}
|
86
|
+
)));
|
87
|
+
return this;
|
88
|
+
}
|
89
|
+
addItem(item, abortIfIdExists = true) {
|
90
|
+
const existing = Array.from(this._items.entries()).map(([privateId2, entry]) => ({ privateId: privateId2, entry })).find(({ entry }) => entry.id !== void 0 && entry.id === item.id);
|
91
|
+
if (existing !== void 0) {
|
92
|
+
if (abortIfIdExists) return this;
|
93
|
+
this._items.delete(existing.privateId);
|
94
|
+
}
|
95
|
+
const privateId = this.generateUniquePrivateId();
|
96
|
+
this._items.set(privateId, item);
|
97
|
+
this.updateRendered();
|
98
|
+
return this;
|
99
|
+
}
|
100
|
+
removeItem(idOrPosition) {
|
101
|
+
if (typeof idOrPosition === "string") {
|
102
|
+
const existing = Array.from(this._items.entries()).map(([privateId, entry]) => ({ privateId, entry })).find(({ entry }) => entry.id !== void 0 && entry.id === idOrPosition);
|
103
|
+
if (existing === void 0) return this;
|
104
|
+
this._items.delete(existing.privateId);
|
105
|
+
this.updateRendered();
|
106
|
+
return this;
|
107
|
+
}
|
108
|
+
const toRemove = Array.from(this._items).map(([privateId, entry]) => ({ privateId, entry })).at(idOrPosition);
|
109
|
+
if (toRemove === void 0) return this;
|
110
|
+
this._items.delete(toRemove.privateId);
|
111
|
+
this.updateRendered();
|
112
|
+
return this;
|
113
|
+
}
|
114
|
+
async getDomString(documentObj) {
|
115
|
+
const actualDocumentObj = documentObj ?? window.document;
|
116
|
+
if (actualDocumentObj === null) throw register.getError("no-window-document-on-runtime" /* NO_DOCUMENT */);
|
117
|
+
return new Promise((resolve) => {
|
118
|
+
const tempElt = actualDocumentObj.createElement("div");
|
119
|
+
const tempRoot = reactCreateRoot(tempElt);
|
120
|
+
const { items } = this;
|
121
|
+
const onRendered = () => {
|
122
|
+
resolve(tempElt.innerHTML);
|
123
|
+
tempRoot.unmount();
|
124
|
+
tempElt.remove();
|
125
|
+
};
|
126
|
+
tempRoot.render(/* @__PURE__ */ jsx(
|
127
|
+
StylesSetComp,
|
128
|
+
{
|
129
|
+
items,
|
130
|
+
privateIDAttribute: this.tagsPrivateIDAttribute,
|
131
|
+
publicIDAttribute: this.tagsPublicIDAttribute,
|
132
|
+
onRendered
|
133
|
+
}
|
134
|
+
));
|
135
|
+
});
|
136
|
+
}
|
137
|
+
};
|
138
|
+
var StylesSetComp = class extends Component {
|
139
|
+
componentDidMount() {
|
140
|
+
const { props } = this;
|
141
|
+
const { onRendered } = props;
|
142
|
+
if (onRendered !== void 0) onRendered();
|
143
|
+
}
|
144
|
+
componentDidUpdate() {
|
145
|
+
const { props } = this;
|
146
|
+
const { onRendered } = props;
|
147
|
+
if (onRendered !== void 0) onRendered();
|
148
|
+
}
|
149
|
+
render() {
|
150
|
+
const { props } = this;
|
151
|
+
const items = props.items ?? /* @__PURE__ */ new Map();
|
152
|
+
const pidAttr = props.privateIDAttribute ?? StylesSet.defaultPrivateIDAttribute;
|
153
|
+
const idAttr = props.publicIDAttribute ?? StylesSet.defaultPublicIDAttribute;
|
154
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Array.from(items).map(([privateId, itemData]) => {
|
155
|
+
const customAttributes = { [pidAttr]: privateId, [idAttr]: itemData.id };
|
156
|
+
if (itemData.type === "url") return /* @__PURE__ */ jsx(
|
157
|
+
"link",
|
158
|
+
{
|
159
|
+
onLoad: itemData.onLoad,
|
160
|
+
rel: "stylesheet",
|
161
|
+
href: itemData.content,
|
162
|
+
...customAttributes
|
163
|
+
}
|
164
|
+
);
|
165
|
+
return /* @__PURE__ */ jsx("style", { ...customAttributes, children: itemData.content });
|
166
|
+
}) });
|
167
|
+
}
|
168
|
+
};
|
169
|
+
|
170
|
+
export {
|
171
|
+
StylesSet,
|
172
|
+
StylesSetComp
|
173
|
+
};
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import {
|
2
|
+
Outcome
|
3
|
+
} from "./chunk-JMU5PDBD.js";
|
4
|
+
import {
|
5
|
+
unknownToString
|
6
|
+
} from "./chunk-FENXVJYO.js";
|
7
|
+
import {
|
8
|
+
__export
|
9
|
+
} from "./chunk-WSFCRVEQ.js";
|
10
|
+
|
11
|
+
// src/node/@google-cloud/storage/file/move/index.ts
|
12
|
+
var move_exports = {};
|
13
|
+
__export(move_exports, {
|
14
|
+
move: () => move
|
15
|
+
});
|
16
|
+
async function move(sourcePath, destinationPath, bucket, options) {
|
17
|
+
const { fileOptions, copyOptions, deleteOptions } = options ?? {};
|
18
|
+
try {
|
19
|
+
const file = bucket.file(sourcePath, fileOptions);
|
20
|
+
await file.copy(destinationPath, copyOptions);
|
21
|
+
await file.delete(deleteOptions);
|
22
|
+
return Outcome.makeSuccess(true);
|
23
|
+
} catch (err) {
|
24
|
+
const errStr = unknownToString(err);
|
25
|
+
return Outcome.makeFailure(errStr);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export {
|
30
|
+
move,
|
31
|
+
move_exports
|
32
|
+
};
|
@@ -0,0 +1,203 @@
|
|
1
|
+
import {
|
2
|
+
thumbnails_exports
|
3
|
+
} from "./chunk-UVSTFYSD.js";
|
4
|
+
|
5
|
+
// src/node/images/transform/area-composition/index.ts
|
6
|
+
import sharp from "sharp";
|
7
|
+
var DEFAULT_GENERATE_OPTIONS = {
|
8
|
+
formats: ["jpeg"],
|
9
|
+
nbOutputs: 1,
|
10
|
+
imagePosition: "center",
|
11
|
+
imageOccupation: 60,
|
12
|
+
dimensions: { w: 300, h: 500 },
|
13
|
+
palette: ["default"],
|
14
|
+
maxPaletteDensity: 100,
|
15
|
+
extractPaletteDensity: 8,
|
16
|
+
lightenIntensity: 20,
|
17
|
+
saturateIntensity: 20,
|
18
|
+
colorFilterApply: "all",
|
19
|
+
tileDensityA: { min: 1, max: 1 },
|
20
|
+
tileDensityB: { min: 1, max: 1 },
|
21
|
+
tileCoverage: 50,
|
22
|
+
tileFormat: "default",
|
23
|
+
tileXEasing: "none",
|
24
|
+
tileYEasing: "none"
|
25
|
+
};
|
26
|
+
async function areaCompose(inputSharp, customOptions) {
|
27
|
+
const options = getOptions(customOptions);
|
28
|
+
const inputMetadata = await inputSharp.metadata();
|
29
|
+
const initialDimensions = {
|
30
|
+
w: inputMetadata.width || 0,
|
31
|
+
h: inputMetadata.height || 0
|
32
|
+
};
|
33
|
+
const inputBufferData = await inputSharp.raw().toBuffer();
|
34
|
+
const imagePalette = thumbnails_exports.Colors.extractPaletteFromImage(inputBufferData, initialDimensions, options);
|
35
|
+
const composedPalette = composePalette(imagePalette, options.palette, options.maxPaletteDensity);
|
36
|
+
inputSharp.png({ quality: 100 });
|
37
|
+
const outputDimensions = {
|
38
|
+
w: options.dimensions.w,
|
39
|
+
h: options.dimensions.h
|
40
|
+
};
|
41
|
+
const resizeInputDimensions = getNewInputImageDimensions(outputDimensions, options.imageOccupation);
|
42
|
+
const resizedInput = inputSharp.resize({
|
43
|
+
width: resizeInputDimensions.w,
|
44
|
+
height: resizeInputDimensions.h,
|
45
|
+
fit: "contain",
|
46
|
+
background: { r: 255, g: 255, b: 255, alpha: 0 }
|
47
|
+
// Add a transparent background
|
48
|
+
}).toFormat("png");
|
49
|
+
const resizedInputPositions = getImagePositions(options.imagePosition, resizeInputDimensions, resizeInputDimensions, outputDimensions);
|
50
|
+
const shapesLayout = thumbnails_exports.Layout.packAreasAndTiles(
|
51
|
+
{
|
52
|
+
...resizedInputPositions,
|
53
|
+
...resizeInputDimensions
|
54
|
+
},
|
55
|
+
outputDimensions,
|
56
|
+
options.tileCoverage,
|
57
|
+
{ A: options.tileDensityA, B: options.tileDensityB },
|
58
|
+
{ X: options.tileXEasing, Y: options.tileYEasing }
|
59
|
+
);
|
60
|
+
const sharpShapes = getSharpTilesInputs(shapesLayout, composedPalette);
|
61
|
+
const sharpShapesForComposite = [];
|
62
|
+
for await (const sharpShape of sharpShapes) {
|
63
|
+
;
|
64
|
+
sharpShapesForComposite.push({
|
65
|
+
input: await sharpShape.input.toFormat("png").toBuffer(),
|
66
|
+
left: sharpShape.left,
|
67
|
+
top: sharpShape.top
|
68
|
+
});
|
69
|
+
}
|
70
|
+
const background = composedPalette[0] || [255, 255, 255];
|
71
|
+
const outputSharp = await createSharpShape(outputDimensions, background).toFormat("webp");
|
72
|
+
const composedSharp = outputSharp.composite([
|
73
|
+
{
|
74
|
+
input: await resizedInput.toFormat("webp").toBuffer(),
|
75
|
+
/* Converting to png to handle alpha */
|
76
|
+
left: Math.round(resizedInputPositions.x),
|
77
|
+
top: Math.round(resizedInputPositions.y)
|
78
|
+
},
|
79
|
+
...sharpShapesForComposite
|
80
|
+
]);
|
81
|
+
return await composedSharp.flatten();
|
82
|
+
}
|
83
|
+
function getOptions(customOptions) {
|
84
|
+
if (!customOptions) {
|
85
|
+
return DEFAULT_GENERATE_OPTIONS;
|
86
|
+
}
|
87
|
+
;
|
88
|
+
const options = {
|
89
|
+
...DEFAULT_GENERATE_OPTIONS,
|
90
|
+
...customOptions
|
91
|
+
};
|
92
|
+
return options;
|
93
|
+
}
|
94
|
+
function getNewInputImageDimensions(formatDimensions, imageOccupation) {
|
95
|
+
const placeRatio = imageOccupation / 100;
|
96
|
+
return {
|
97
|
+
w: Math.round(formatDimensions.w * placeRatio),
|
98
|
+
h: Math.round(formatDimensions.h * placeRatio)
|
99
|
+
};
|
100
|
+
}
|
101
|
+
function composePalette(palette, paletteOption, maxPaletteDensity) {
|
102
|
+
let composedPalette = [];
|
103
|
+
if (paletteOption.includes("default-lighten")) {
|
104
|
+
composedPalette = [...composedPalette, ...palette.default.lighten];
|
105
|
+
}
|
106
|
+
if (paletteOption.includes("default-saturate")) {
|
107
|
+
composedPalette = [...composedPalette, ...palette.default.saturate];
|
108
|
+
}
|
109
|
+
if (paletteOption.includes("complementary")) {
|
110
|
+
composedPalette = [...composedPalette, ...palette.complementary.default];
|
111
|
+
}
|
112
|
+
if (paletteOption.includes("complementary-lighten")) {
|
113
|
+
composedPalette = [...composedPalette, ...palette.complementary.lighten];
|
114
|
+
}
|
115
|
+
if (paletteOption.includes("complementary-saturate")) {
|
116
|
+
composedPalette = [...composedPalette, ...palette.complementary.saturate];
|
117
|
+
}
|
118
|
+
if (paletteOption.includes("default") || !composedPalette.length) {
|
119
|
+
composedPalette = [...composedPalette, ...palette.default.default];
|
120
|
+
}
|
121
|
+
const shuffledPalette = thumbnails_exports.Common.shuffleArray(composedPalette);
|
122
|
+
const outputPalette = composedPalette.length > maxPaletteDensity ? shuffledPalette.splice(0, maxPaletteDensity) : shuffledPalette;
|
123
|
+
return outputPalette;
|
124
|
+
}
|
125
|
+
function getImagePositions(position, resizedImageDimensions, containedImageDimensions, wrapperDimensions) {
|
126
|
+
switch (position) {
|
127
|
+
case "top-left":
|
128
|
+
return thumbnails_exports.Layout.alignTopLeft(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
129
|
+
case "top-center":
|
130
|
+
return thumbnails_exports.Layout.alignTopCenter(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
131
|
+
case "top-right":
|
132
|
+
return thumbnails_exports.Layout.alignTopRight(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
133
|
+
case "left-center":
|
134
|
+
return thumbnails_exports.Layout.alignLeftCenter(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
135
|
+
case "center":
|
136
|
+
return thumbnails_exports.Layout.alignCenter(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
137
|
+
case "right-center":
|
138
|
+
return thumbnails_exports.Layout.alignRightCenter(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
139
|
+
case "bottom-left":
|
140
|
+
return thumbnails_exports.Layout.alignBottomLeft(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
141
|
+
case "bottom-center":
|
142
|
+
return thumbnails_exports.Layout.alignBottomCenter(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
143
|
+
case "bottom-right":
|
144
|
+
return thumbnails_exports.Layout.alignBottomRight(resizedImageDimensions, containedImageDimensions, wrapperDimensions);
|
145
|
+
default:
|
146
|
+
return { x: 0, y: 0 };
|
147
|
+
}
|
148
|
+
}
|
149
|
+
function createSharpShape(dimensions, background) {
|
150
|
+
return sharp(
|
151
|
+
{
|
152
|
+
create: getCreateSharpShape(dimensions, background)
|
153
|
+
}
|
154
|
+
);
|
155
|
+
}
|
156
|
+
function getCreateSharpShape(dimensions, background) {
|
157
|
+
return {
|
158
|
+
width: Math.round(dimensions.w),
|
159
|
+
height: Math.round(dimensions.h),
|
160
|
+
channels: 4,
|
161
|
+
background: { r: background[0], g: background[1], b: background[2], alpha: 1 }
|
162
|
+
};
|
163
|
+
}
|
164
|
+
function getSharpTilesInputs(tiles, palette) {
|
165
|
+
let usedColorsIndexes = [];
|
166
|
+
const paletteLength = palette.length;
|
167
|
+
const getUnusedColorIndex = () => {
|
168
|
+
const paletteIndex = thumbnails_exports.Common.randomInt(paletteLength);
|
169
|
+
resetUnusedColorIndexesIfNeeded();
|
170
|
+
if (usedColorsIndexes.includes(paletteIndex)) {
|
171
|
+
return getUnusedColorIndex();
|
172
|
+
}
|
173
|
+
usedColorsIndexes.push(paletteIndex);
|
174
|
+
return paletteIndex;
|
175
|
+
};
|
176
|
+
const resetUnusedColorIndexesIfNeeded = () => {
|
177
|
+
if (usedColorsIndexes.length !== paletteLength) {
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
usedColorsIndexes = [];
|
181
|
+
};
|
182
|
+
return tiles.map((tile) => {
|
183
|
+
const paletteIndex = getUnusedColorIndex();
|
184
|
+
const color = palette[paletteIndex];
|
185
|
+
if (!color) {
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
return {
|
189
|
+
top: Math.round(tile.y),
|
190
|
+
left: Math.round(tile.x),
|
191
|
+
input: sharp(
|
192
|
+
{
|
193
|
+
create: getCreateSharpShape(tile, color)
|
194
|
+
}
|
195
|
+
)
|
196
|
+
};
|
197
|
+
}).filter((sharpShape) => sharpShape !== void 0);
|
198
|
+
}
|
199
|
+
|
200
|
+
export {
|
201
|
+
areaCompose,
|
202
|
+
getSharpTilesInputs
|
203
|
+
};
|