@edifice.io/react 2.5.18-develop-b2school.20260504100711 → 2.5.18-develop-enabling.20260504105750

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 (51) hide show
  1. package/dist/components/Card/Card.js +1 -1
  2. package/dist/components/Combobox/Combobox.js +1 -1
  3. package/dist/components/Dropdown/Dropdown.js +1 -1
  4. package/dist/components/Form/FormControl.js +1 -1
  5. package/dist/components/Layout/components/WidgetApps.js +1 -1
  6. package/dist/components/Modal/Modal.js +1 -1
  7. package/dist/components/PreventPropagation/PreventPropagation.js +1 -1
  8. package/dist/components/PromotionCard/PromotionCard.js +1 -1
  9. package/dist/components/SearchBar/SearchBar.d.ts +2 -2
  10. package/dist/components/Table/components/Table.js +1 -1
  11. package/dist/hooks/useConf/useConf.d.ts +1 -1
  12. package/dist/hooks/useDropdown/useDropdown.js +2 -0
  13. package/dist/hooks/useSession/useSession.d.ts +1 -1
  14. package/dist/hooks/useThumbnail/useThumbnail.d.ts +1 -1
  15. package/dist/hooks/useThumbnail/useThumbnail.js +5 -1
  16. package/dist/hooks/useUpload/useUpload.js +2 -5
  17. package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.d.ts +12 -0
  18. package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.js +1 -1
  19. package/dist/modules/editor/components/Editor/EditorPreview.js +1 -1
  20. package/dist/modules/modals/OnboardingModal/index.d.ts +1 -1
  21. package/dist/modules/modals/ResourceModal/ResourceModal.d.ts +1 -1
  22. package/dist/modules/modals/ResourceModal/ResourceModal.js +1 -1
  23. package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.d.ts +1 -1
  24. package/dist/modules/modals/ShareModal/ShareResources.d.ts +4 -53
  25. package/dist/modules/modals/ShareModal/apps/ShareBlog.d.ts +1 -1
  26. package/dist/modules/modals/ShareModal/hooks/useShareBookmark.js +2 -1
  27. package/dist/modules/modals/ShareModal/hooks/useShareMutation.d.ts +1 -1
  28. package/dist/modules/multimedia/ImageEditor/components/ImageEditor.js +24 -10
  29. package/dist/modules/multimedia/ImageEditor/effects/blur.d.ts +7 -5
  30. package/dist/modules/multimedia/ImageEditor/effects/blur.js +26 -16
  31. package/dist/modules/multimedia/ImageEditor/effects/constants.d.ts +2 -0
  32. package/dist/modules/multimedia/ImageEditor/effects/constants.js +4 -0
  33. package/dist/modules/multimedia/ImageEditor/effects/crop.d.ts +4 -5
  34. package/dist/modules/multimedia/ImageEditor/effects/crop.js +42 -26
  35. package/dist/modules/multimedia/ImageEditor/effects/misc.d.ts +10 -16
  36. package/dist/modules/multimedia/ImageEditor/effects/misc.js +27 -12
  37. package/dist/modules/multimedia/ImageEditor/effects/resize.d.ts +3 -7
  38. package/dist/modules/multimedia/ImageEditor/effects/resize.js +31 -22
  39. package/dist/modules/multimedia/ImageEditor/effects/rotate.js +2 -3
  40. package/dist/modules/multimedia/ImageEditor/hooks/useHistoryTool.js +40 -41
  41. package/dist/modules/multimedia/ImageEditor/hooks/useImageEditor.d.ts +1 -1
  42. package/dist/modules/multimedia/ImageEditor/hooks/useImageEditor.js +9 -3
  43. package/dist/modules/multimedia/ImageEditor/hooks/useImageEffects.js +4 -1
  44. package/dist/modules/multimedia/LinkerCard/LinkerCard._.d.ts +1 -1
  45. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +1 -0
  46. package/dist/modules/multimedia/UploadCard/UploadCard._.d.ts +1 -1
  47. package/dist/modules/multimedia/UploadFiles/UploadFiles.js +4 -4
  48. package/dist/providers/EdificeClientProvider/EdificeClientProvider.context.d.ts +1 -1
  49. package/dist/utilities/react-query/react-query-utils.d.ts +1 -1
  50. package/package.json +52 -53
  51. package/dist/modules/multimedia/FileCard/FileCard._.d.ts +0 -17
@@ -8,17 +8,25 @@ function drawBackground(application, {
8
8
  spriteName
9
9
  }) {
10
10
  removeBackground(application);
11
- const sprite = application.stage.getChildByName(spriteName);
12
- if (sprite == null) return;
13
- const spriteBounds = sprite.getBounds(), stageTexture = application.renderer.generateTexture(application.stage).clone(), clonedStage = new PIXI.Sprite(stageTexture);
11
+ const sprite = application.stage.getChildByLabel(spriteName);
12
+ if (!sprite) return;
13
+ const spriteBounds = sprite.getBounds(), stageTexture = application.renderer.generateTexture(application.stage), clonedStage = new PIXI.Sprite(stageTexture);
14
14
  clonedStage.height = spriteBounds.height, clonedStage.width = spriteBounds.width, clonedStage.position = new PIXI.Point(0, 0);
15
- const background = new PIXI.Graphics();
16
- background.beginFill(16777215, 0.5), background.drawRect(0, 0, spriteBounds.width, spriteBounds.height), background.endFill(), background.name = CROP_BACKGROUND_NAME, background.position = new PIXI.Point(spriteBounds.x, spriteBounds.y);
15
+ const background = new PIXI.Container();
16
+ background.label = CROP_BACKGROUND_NAME, background.position = new PIXI.Point(spriteBounds.x, spriteBounds.y);
17
+ const backdrop = new PIXI.Graphics();
18
+ backdrop.rect(0, 0, spriteBounds.width, spriteBounds.height), backdrop.fill({
19
+ color: 16777215,
20
+ alpha: 0.5
21
+ });
17
22
  const rectMask = new PIXI.Graphics();
18
- rectMask.beginFill(0, 1), rectMask.drawRect(0, 0, spriteBounds.width - 2 * PADDING, spriteBounds.height - 2 * PADDING), rectMask.endFill(), rectMask.position = new PIXI.Point(PADDING, PADDING), rectMask.name = CROP_MASK_NAME, clonedStage.mask = rectMask, application.stage.addChild(background), background.addChild(rectMask), background.addChild(clonedStage);
23
+ rectMask.rect(0, 0, spriteBounds.width - 2 * PADDING, spriteBounds.height - 2 * PADDING), rectMask.fill({
24
+ color: 0,
25
+ alpha: 1
26
+ }), rectMask.position = new PIXI.Point(PADDING, PADDING), rectMask.label = CROP_MASK_NAME, clonedStage.mask = rectMask, application.stage.addChild(background), background.addChild(backdrop), background.addChild(rectMask), background.addChild(clonedStage);
19
27
  }
20
28
  function removeBackground(application) {
21
- const child = application.stage.getChildByName(CROP_BACKGROUND_NAME, !0);
29
+ const child = application.stage.getChildByLabel(CROP_BACKGROUND_NAME, !0);
22
30
  child == null || child.removeFromParent();
23
31
  }
24
32
  function computeCornerPosition(cornerType, bounds) {
@@ -54,10 +62,10 @@ function computeCornerPosition(cornerType, bounds) {
54
62
  }
55
63
  }
56
64
  function refreshCorners(application) {
57
- const mask = application.stage.getChildByName(CROP_MASK_NAME, !0);
58
- mask != null && CORNERS.forEach((cornerType) => {
59
- const corner = application.stage.getChildByName(getCornerName(cornerType), !0);
60
- if (corner == null) return;
65
+ const mask = application.stage.getChildByLabel(CROP_MASK_NAME, !0);
66
+ mask && CORNERS.forEach((cornerType) => {
67
+ const corner = application.stage.getChildByLabel(getCornerName(cornerType), !0);
68
+ if (!corner) return;
61
69
  const position = computeCornerPosition(cornerType, {
62
70
  height: mask.height,
63
71
  width: mask.width,
@@ -70,10 +78,10 @@ function refreshCorners(application) {
70
78
  function drawCorner(application, cornerType, {
71
79
  spriteName
72
80
  }) {
73
- const previous = application.stage.getChildByName(getCornerName(cornerType), !0), scale = getApplicationScale(application);
81
+ const previous = application.stage.getChildByLabel(getCornerName(cornerType), !0), scale = getApplicationScale(application);
74
82
  previous == null || previous.removeFromParent();
75
- const background = application.stage.getChildByName(CROP_BACKGROUND_NAME, !0), mask = application.stage.getChildByName(CROP_MASK_NAME, !0), sprite = application.stage.getChildByName(spriteName);
76
- if (sprite == null || background === null || background === void 0 || mask === void 0 || mask === null)
83
+ const background = application.stage.getChildByLabel(CROP_BACKGROUND_NAME, !0), mask = application.stage.getChildByLabel(CROP_MASK_NAME, !0);
84
+ if (!application.stage.getChildByLabel(spriteName) || !background || !mask)
77
85
  return;
78
86
  const position = computeCornerPosition(cornerType, {
79
87
  height: mask.height,
@@ -81,13 +89,17 @@ function drawCorner(application, cornerType, {
81
89
  x: mask.x,
82
90
  y: mask.y
83
91
  }), corner = new PIXI.Graphics();
84
- corner.beginFill(4960213, 1), corner.arc(0, 0, POINT_RADIUS / scale, position.start, position.end), corner.lineTo(0, 0), corner.endFill(), corner.position = new PIXI.Point(position.x, position.y), corner.name = getCornerName(cornerType), corner.interactive = !0;
92
+ corner.arc(0, 0, POINT_RADIUS / scale, position.start, position.end), corner.lineTo(0, 0), corner.fill({
93
+ color: 4960213,
94
+ alpha: 1
95
+ }), corner.position = new PIXI.Point(position.x, position.y), corner.label = getCornerName(cornerType), corner.interactive = !0;
85
96
  let enable = !1;
86
- application.stage.on("pointermove", (event) => {
87
- if (enable === !1) return;
97
+ const handlePointerMove = (event) => {
98
+ if (!enable) return;
88
99
  const localPosition = background.toLocal(event.global);
89
100
  corner.position.x = localPosition.x, corner.position.y = localPosition.y, moveMask(application, cornerType, localPosition);
90
- });
101
+ };
102
+ application.stage.on("pointermove", handlePointerMove);
91
103
  const handlePointerDown = () => {
92
104
  enable = !0;
93
105
  };
@@ -96,12 +108,12 @@ function drawCorner(application, cornerType, {
96
108
  enable = !1;
97
109
  };
98
110
  globalThis.addEventListener("pointerup", handlePointerUp), corner.once("destroyed", () => {
99
- corner.off("pointerdown"), globalThis.removeEventListener("pointerup", handlePointerUp);
111
+ corner.off("pointerdown"), application.stage.off("pointermove", handlePointerMove), globalThis.removeEventListener("pointerup", handlePointerUp);
100
112
  }), background.addChild(corner);
101
113
  }
102
114
  function moveMask(application, cornerType, position) {
103
- const mask = application.stage.getChildByName(CROP_MASK_NAME, !0);
104
- if (mask == null) return;
115
+ const mask = application.stage.getChildByLabel(CROP_MASK_NAME, !0);
116
+ if (!mask) return;
105
117
  const right = mask.position.x + mask.width, bottom = mask.position.y + mask.height;
106
118
  switch (cornerType) {
107
119
  case "TOP_LEFT": {
@@ -142,11 +154,15 @@ function stop(application) {
142
154
  removeBackground(application), application.stage.off("pointermove"), application.render();
143
155
  }
144
156
  function save(application) {
145
- const mask = application.stage.getChildByName(CROP_MASK_NAME, !0);
146
- if (mask == null) return;
147
- stop(application);
148
- const stageTexture = application.renderer.generateTexture(application.stage).clone(), clonedStage = new PIXI.Sprite(stageTexture), maskBounds = mask.getBounds(), bounds = new PIXI.Rectangle(Math.floor(maskBounds.x), Math.floor(maskBounds.y), Math.floor(maskBounds.width), Math.floor(maskBounds.height)), cropped = new PIXI.Texture(clonedStage.texture.baseTexture, bounds);
149
- return new PIXI.Sprite(cropped);
157
+ const mask = application.stage.getChildByLabel(CROP_MASK_NAME, !0);
158
+ if (!mask) return;
159
+ const background = application.stage.getChildByLabel(CROP_BACKGROUND_NAME, !0), offsetX = (background == null ? void 0 : background.x) ?? 0, offsetY = (background == null ? void 0 : background.y) ?? 0, frame = new PIXI.Rectangle(Math.floor(offsetX + mask.x), Math.floor(offsetY + mask.y), Math.floor(mask.width), Math.floor(mask.height));
160
+ background && (background.visible = !1);
161
+ const croppedTexture = application.renderer.generateTexture({
162
+ target: application.stage,
163
+ frame
164
+ });
165
+ return removeBackground(application), application.stage.off("pointermove"), new PIXI.Sprite(croppedTexture);
150
166
  }
151
167
  export {
152
168
  save,
@@ -1,11 +1,8 @@
1
1
  import * as PIXI from 'pixi.js';
2
2
  export declare const DEFAULT_SPRITE_NAME = "image";
3
3
  /**
4
- * A structure that define all setting of an image
5
- * - positon
6
- * - scale
7
- * - size
8
- * - size of the stage
4
+ * A structure that defines all settings of an image:
5
+ * position, scale, size, and size of the stage
9
6
  */
10
7
  export interface ImageSettings {
11
8
  stage: {
@@ -39,13 +36,12 @@ export interface ImageSettings {
39
36
  };
40
37
  }
41
38
  /**
42
- * This function update the image content using Blob datasource
39
+ * Update the image content using a Blob datasource
43
40
  *
44
41
  * @param application the PIXI.Application context
45
42
  * @param param.spriteName the name of the sprite in the context
46
- * @param param.imgDatasource the img data could be one of: string url, HTMLImageElement, PIXI.Sprite
47
- * @param param.stageSize?: { width: number; height: number };
48
- * @param param.spriteSize?: { width: number; height: number };
43
+ * @param param.imgDatasource the Blob data to load as image
44
+ * @param param.settings optional image settings to restore position/scale/rotation
49
45
  */
50
46
  export declare function updateImageFromBlob(application: PIXI.Application, { spriteName, imgDatasource, settings, }: {
51
47
  spriteName: string;
@@ -53,13 +49,12 @@ export declare function updateImageFromBlob(application: PIXI.Application, { spr
53
49
  settings?: ImageSettings;
54
50
  }): Promise<PIXI.Sprite | null>;
55
51
  /**
56
- * This function update the image content for the sprite in the PIXI.Application context
52
+ * Update the image content for the sprite in the PIXI.Application context
57
53
  *
58
54
  * @param application the PIXI.Application context
59
55
  * @param param.spriteName the name of the sprite in the context
60
- * @param param.imgDatasource the img data could be one of: string url, HTMLImageElement, PIXI.Sprite
61
- * @param param.spriteSize
62
- * @param param.stageSize
56
+ * @param param.imgDatasource the image source: a URL string, HTMLImageElement, or PIXI.Sprite
57
+ * @param param.settings optional image settings to restore position/scale/rotation
63
58
  */
64
59
  export declare function updateImage(application: PIXI.Application, { spriteName, imgDatasource, settings, }: {
65
60
  spriteName: string;
@@ -104,10 +99,9 @@ export declare function saveAsBlob(application: PIXI.Application): Promise<Blob>
104
99
  */
105
100
  export declare function saveAsDataURL(application: PIXI.Application): string | undefined;
106
101
  /**
107
- * Calculates the scale percentage for a PIXI.Sprite or the application view based on the parent container's dimensions.
102
+ * Calculates the scale ratio between the CSS display size and the actual canvas size.
108
103
  * @param application - The PIXI.Application instance.
109
- * @param sprite - The PIXI.Sprite instance (optional).
110
- * @returns The scale percentage.
104
+ * @returns The scale ratio (CSS width / canvas width).
111
105
  */
112
106
  export declare function getApplicationScale(application: PIXI.Application): number;
113
107
  export declare function toBlob(application: PIXI.Application): Promise<Blob>;
@@ -1,4 +1,5 @@
1
1
  import * as PIXI from "pixi.js";
2
+ import { BLUR_LAYER_NAME } from "./constants.js";
2
3
  const MIN_HEIGHT = 100, MIN_WIDTH = 100, MODAL_VERTICAL_PADDING = 450, MODAL_HORIZONTAL_PADDING = 64, DEFAULT_QUALITY = 0.5, DEFAULT_SPRITE_NAME = "image";
3
4
  function updateImageFromBlob(application, {
4
5
  spriteName,
@@ -6,15 +7,17 @@ function updateImageFromBlob(application, {
6
7
  settings
7
8
  }) {
8
9
  const imageUrl = URL.createObjectURL(imgDatasource), image = new Image();
9
- return image.src = imageUrl, new Promise((resolve) => {
10
+ return image.src = imageUrl, new Promise((resolve, reject) => {
10
11
  image.onload = async () => {
11
- await updateImage(application, {
12
+ URL.revokeObjectURL(imageUrl), await updateImage(application, {
12
13
  spriteName,
13
14
  imgDatasource: image,
14
15
  settings
15
16
  });
16
- const newSprite = application == null ? void 0 : application.stage.getChildByName(spriteName, !0);
17
+ const newSprite = application == null ? void 0 : application.stage.getChildByLabel(spriteName, !0);
17
18
  resolve(newSprite);
19
+ }, image.onerror = () => {
20
+ URL.revokeObjectURL(imageUrl), reject(new Error("Failed to load image from Blob"));
18
21
  };
19
22
  });
20
23
  }
@@ -25,10 +28,22 @@ async function updateImage(application, {
25
28
  }) {
26
29
  if (application === void 0 || application.stage === null)
27
30
  return;
28
- const previous = application.stage.getChildByName(spriteName, !0);
31
+ const previous = application.stage.getChildByLabel(spriteName, !0);
29
32
  previous == null || previous.removeFromParent();
30
- const texture = imgDatasource instanceof HTMLImageElement ? PIXI.Texture.from(imgDatasource) : imgDatasource instanceof PIXI.Sprite ? imgDatasource : await PIXI.Texture.fromURL(imgDatasource), sprite = texture instanceof PIXI.Sprite ? texture : PIXI.Sprite.from(texture, {});
31
- if (sprite.interactive = !0, sprite.name = spriteName, settings) {
33
+ const blurLayer = application.stage.getChildByLabel(BLUR_LAYER_NAME);
34
+ blurLayer == null || blurLayer.removeFromParent();
35
+ let sprite;
36
+ if (imgDatasource instanceof PIXI.Sprite)
37
+ sprite = imgDatasource;
38
+ else if (imgDatasource instanceof HTMLImageElement)
39
+ sprite = new PIXI.Sprite(PIXI.Texture.from(imgDatasource));
40
+ else {
41
+ const img = new Image();
42
+ img.crossOrigin = "anonymous", img.src = imgDatasource, await new Promise((resolve, reject) => {
43
+ img.complete ? resolve() : (img.onload = () => resolve(), img.onerror = reject);
44
+ }), sprite = new PIXI.Sprite(PIXI.Texture.from(img));
45
+ }
46
+ if (sprite.interactive = !0, sprite.label = spriteName, settings) {
32
47
  const {
33
48
  sprite: {
34
49
  anchor,
@@ -48,7 +63,7 @@ async function updateImage(application, {
48
63
  }
49
64
  function autoResize(application, sprite) {
50
65
  var _a;
51
- const parent = application.view.parentNode, maxMobileWidth = window.innerWidth - MODAL_HORIZONTAL_PADDING, parentWidth = Math.max((parent == null ? void 0 : parent.offsetWidth) ?? 0, MIN_WIDTH), newSize = constraintSize({
66
+ const parent = application.canvas.parentNode, maxMobileWidth = window.innerWidth - MODAL_HORIZONTAL_PADDING, parentWidth = Math.max((parent == null ? void 0 : parent.offsetWidth) ?? 0, MIN_WIDTH), newSize = constraintSize({
52
67
  width: sprite.width,
53
68
  height: sprite.height
54
69
  }, {
@@ -64,7 +79,7 @@ function autoResize(application, sprite) {
64
79
  height: newHeight,
65
80
  width: newWidth
66
81
  } = newSize;
67
- (_a = application.view) != null && _a.style && (application.view.style.width = `${newWidth}px`, application.view.style.height = `${newHeight}px`);
82
+ (_a = application.canvas) != null && _a.style && (application.canvas.style.width = `${newWidth}px`, application.canvas.style.height = `${newHeight}px`);
68
83
  }
69
84
  function constraintSize(size, constraints) {
70
85
  const {
@@ -83,22 +98,22 @@ function constraintSize(size, constraints) {
83
98
  function saveAsBlob(application) {
84
99
  return new Promise((resolve, reject) => {
85
100
  var _a;
86
- (_a = application == null ? void 0 : application.view) != null && _a.toBlob ? application.view.toBlob((blob) => {
101
+ (_a = application == null ? void 0 : application.canvas) != null && _a.toBlob ? application.canvas.toBlob((blob) => {
87
102
  blob ? resolve(blob) : reject("EXTRACT_FAILED");
88
103
  }, "image/jpeg", DEFAULT_QUALITY) : reject("EXTRACT_FAILED");
89
104
  });
90
105
  }
91
106
  function saveAsDataURL(application) {
92
107
  var _a, _b;
93
- return (_b = (_a = application.view).toDataURL) == null ? void 0 : _b.call(_a);
108
+ return (_b = (_a = application.canvas).toDataURL) == null ? void 0 : _b.call(_a);
94
109
  }
95
110
  function getApplicationScale(application) {
96
- return application.view.getBoundingClientRect ? application.view.getBoundingClientRect().width / application.view.width : 1;
111
+ return application.canvas.getBoundingClientRect ? application.canvas.getBoundingClientRect().width / application.canvas.width : 1;
97
112
  }
98
113
  function toBlob(application) {
99
114
  return new Promise((resolve, reject) => {
100
115
  var _a, _b;
101
- (_b = (_a = application.view).toBlob) == null || _b.call(_a, (blob) => {
116
+ (_b = (_a = application.canvas).toBlob) == null || _b.call(_a, (blob) => {
102
117
  blob ? resolve(blob) : reject("EXTRACT_FAIL");
103
118
  }, "image/png", 1);
104
119
  });
@@ -7,19 +7,15 @@ import * as PIXI from 'pixi.js';
7
7
  */
8
8
  export declare function start(application: PIXI.Application, spriteName: string): void;
9
9
  /**
10
- * If {saveChanges} is true remove all graphical controls then resize the sprite
11
- * If {saveChanges} is false remove all graphical controls and keep original size
10
+ * Remove all graphical controls and mouse event listeners
12
11
  *
13
12
  * @param application the PIXI.Application context
14
- * @param param.saveChanges true if we should save the resize
15
- * @param param.spriteName the name of the sprite representing the original image
16
13
  */
17
14
  export declare function stop(application: PIXI.Application): void;
18
15
  /**
16
+ * Apply the resize and return the result as a PIXI.Sprite
19
17
  *
20
18
  * @param application the PIXI.Application context
21
- * @param spriteName the name of the sprite representing the image
22
- * @param size the target size of the image {width, height}
23
- * @returns a PIXI.Sprite with a image resized or undefined if not found
19
+ * @returns a PIXI.Sprite with the resized image or undefined if no resize was applied
24
20
  */
25
21
  export declare function save(application: PIXI.Application): PIXI.Sprite | undefined;
@@ -42,8 +42,8 @@ function resizeContainer(application, {
42
42
  position,
43
43
  spriteName
44
44
  }) {
45
- const sprite = application.stage.getChildByName(spriteName, !0);
46
- if (sprite == null) return;
45
+ const sprite = application.stage.getChildByLabel(spriteName, !0);
46
+ if (!sprite) return;
47
47
  const isRotated = sprite.rotation % Math.PI !== 0, spriteWidth = isRotated ? sprite.height : sprite.width, spriteHeight = isRotated ? sprite.width : sprite.height;
48
48
  switch (cornerType) {
49
49
  case "TOP_LEFT": {
@@ -68,20 +68,23 @@ function resizeContainer(application, {
68
68
  }
69
69
  }
70
70
  function removeCorner(application, cornerType) {
71
- const previous = application.stage.getChildByName(getCornerName(cornerType), !0);
71
+ const previous = application.stage.getChildByLabel(getCornerName(cornerType), !0);
72
72
  previous == null || previous.removeFromParent();
73
73
  }
74
74
  function drawCorner(application, cornerType, {
75
75
  spriteName
76
76
  }) {
77
77
  removeCorner(application, cornerType);
78
- const sprite = application.stage.getChildByName(spriteName, !0), container = application.stage.getChildByName(CONTROL_NAME, !0);
79
- if (sprite == null || container === null || container === void 0) return;
78
+ const sprite = application.stage.getChildByLabel(spriteName, !0), container = application.stage.getChildByLabel(CONTROL_NAME, !0);
79
+ if (!sprite || !container) return;
80
80
  const position = computeCornerPosition(cornerType, container), corner = new PIXI.Graphics();
81
- corner.beginFill(4960213, 1), corner.arc(0, 0, POINT_RADIUS, position.start, position.end), corner.lineTo(0, 0), corner.endFill(), corner.position = new PIXI.Point(position.x, position.y), corner.name = getCornerName(cornerType), corner.interactive = !0;
81
+ corner.arc(0, 0, POINT_RADIUS, position.start, position.end), corner.lineTo(0, 0), corner.fill({
82
+ color: 4960213,
83
+ alpha: 1
84
+ }), corner.position = new PIXI.Point(position.x, position.y), corner.label = getCornerName(cornerType), corner.interactive = !0;
82
85
  let enable = !1;
83
- application.stage.on("pointermove", (event) => {
84
- if (enable === !1) return;
86
+ const handlePointerMove = (event) => {
87
+ if (!enable) return;
85
88
  const localPosition = application.stage.toLocal(event.global);
86
89
  resizeContainer(application, {
87
90
  cornerType,
@@ -89,31 +92,37 @@ function drawCorner(application, cornerType, {
89
92
  container,
90
93
  spriteName
91
94
  });
92
- });
93
- const handlePointerUp = () => {
94
- enable = !1;
95
95
  };
96
- globalThis.addEventListener("pointerup", handlePointerUp), corner.once("destroyed", () => {
97
- corner.off("pointerdown"), globalThis.removeEventListener("pointerup", handlePointerUp);
98
- });
96
+ application.stage.on("pointermove", handlePointerMove);
99
97
  const handlePointerDown = () => {
100
98
  enable = !0;
101
99
  };
102
- corner.on("pointerdown", handlePointerDown), container.addChild(corner);
100
+ corner.on("pointerdown", handlePointerDown);
101
+ const handlePointerUp = () => {
102
+ enable = !1;
103
+ };
104
+ globalThis.addEventListener("pointerup", handlePointerUp), corner.once("destroyed", () => {
105
+ corner.off("pointerdown"), application.stage.off("pointermove", handlePointerMove), globalThis.removeEventListener("pointerup", handlePointerUp);
106
+ }), container.addChild(corner);
103
107
  }
104
108
  function drawContainer(application, spriteName) {
105
109
  removeContainer(application);
106
- const sprite = application.stage.getChildByName(spriteName, !0);
107
- if (sprite == null) return;
110
+ const sprite = application.stage.getChildByLabel(spriteName, !0);
111
+ if (!sprite) return;
108
112
  const stageTexture = application.renderer.generateTexture(application.stage), clonedStage = new PIXI.Sprite(stageTexture);
109
113
  application.stage.children.forEach((child) => {
110
114
  child.alpha = 0;
111
115
  });
112
- const container = new PIXI.Graphics();
113
- container.drawRect(0, 0, sprite.width, sprite.height), container.name = CONTROL_NAME, container.interactive = !0, container.interactiveChildren = !0, application.stage.interactive = !0, application.stage.interactiveChildren = !0, application.stage.addChild(container), container.addChild(clonedStage);
116
+ const container = new PIXI.Container();
117
+ container.label = CONTROL_NAME, container.interactive = !0, container.interactiveChildren = !0;
118
+ const bounds = new PIXI.Graphics();
119
+ bounds.rect(0, 0, sprite.width, sprite.height), bounds.fill({
120
+ color: 0,
121
+ alpha: 0
122
+ }), application.stage.interactive = !0, application.stage.interactiveChildren = !0, application.stage.addChild(container), container.addChild(bounds), container.addChild(clonedStage);
114
123
  }
115
124
  function removeContainer(application) {
116
- const container = application.stage.getChildByName(CONTROL_NAME, !0);
125
+ const container = application.stage.getChildByLabel(CONTROL_NAME, !0);
117
126
  container == null || container.removeFromParent(), application.stage.children.forEach((child) => {
118
127
  child.alpha = 1;
119
128
  });
@@ -140,12 +149,12 @@ function stop(application) {
140
149
  }
141
150
  function save(application) {
142
151
  var _a;
143
- const container = (_a = application == null ? void 0 : application.stage) == null ? void 0 : _a.getChildByName(CONTROL_NAME, !0), size = container ? {
152
+ const container = (_a = application == null ? void 0 : application.stage) == null ? void 0 : _a.getChildByLabel(CONTROL_NAME, !0), size = container ? {
144
153
  height: container.height,
145
154
  width: container.width
146
155
  } : void 0;
147
156
  if (removeControl(application), size) {
148
- const stageTexture = application.renderer.generateTexture(application.stage).clone(), clonedStage = new PIXI.Sprite(stageTexture);
157
+ const stageTexture = application.renderer.generateTexture(application.stage), clonedStage = new PIXI.Sprite(stageTexture);
149
158
  return clonedStage.width = size.width, clonedStage.height = size.height, clonedStage;
150
159
  } else
151
160
  return;
@@ -1,8 +1,7 @@
1
1
  import { toBlob, updateImageFromBlob, createImageSettings, resizeStage } from "./misc.js";
2
2
  async function rotate(application, spriteName) {
3
- const sprite = application == null ? void 0 : application.stage.getChildByName(spriteName, !0);
3
+ const sprite = application == null ? void 0 : application.stage.getChildByLabel(spriteName, !0);
4
4
  if (application && sprite) {
5
- if (!application) return;
6
5
  const blobBefore = await toBlob(application), mergedSprite = await updateImageFromBlob(application, {
7
6
  imgDatasource: blobBefore,
8
7
  spriteName,
@@ -14,7 +13,7 @@ async function rotate(application, spriteName) {
14
13
  if (!mergedSprite)
15
14
  return;
16
15
  let backupOldMaxHeight, backupOldVisibility;
17
- const canvas = application.view;
16
+ const canvas = application.canvas;
18
17
  canvas.style && (backupOldMaxHeight = canvas.style.maxHeight ?? "", backupOldVisibility = canvas.style.visibility ?? "", canvas.style.maxHeight = `${canvas.clientHeight}px`, canvas.style.visibility = "hidden"), mergedSprite.rotation += Math.PI / 2, resizeStage({
19
18
  application,
20
19
  sprite: mergedSprite,
@@ -11,49 +11,48 @@ const DEFAULT_MAX_HISTORY = 20, useHistoryTool = ({
11
11
  setHistory([]);
12
12
  }, [application]);
13
13
  const restore = async () => {
14
- const imgData = history.pop();
15
- imgData && (onRestore(await imgData.backup, imgData), setHistory(history.filter((current) => current !== imgData)));
16
- }, listSize = (arr) => (arr.length > maxSize && arr.splice(0, arr.length - maxSize), arr), historize = async (callback) => {
17
- {
18
- if (!application)
19
- return;
20
- const sprite = application.stage.getChildByName(spriteName, !0);
21
- if (sprite == null)
22
- return;
23
- const promise = toBlob(application), state = {
24
- backup: promise,
25
- sprite: {
26
- rotation: sprite.rotation,
27
- size: {
28
- width: sprite.width,
29
- height: sprite.height
30
- },
31
- position: {
32
- x: sprite.position.x,
33
- y: sprite.position.y
34
- },
35
- scale: {
36
- x: sprite.scale.x,
37
- y: sprite.scale.y
38
- },
39
- anchor: {
40
- x: sprite.anchor.x,
41
- y: sprite.anchor.y
42
- }
14
+ if (history.length === 0) return;
15
+ const imgData = history[history.length - 1];
16
+ onRestore(await imgData.backup, imgData), setHistory(history.slice(0, -1));
17
+ }, trimHistory = (arr) => arr.length > maxSize ? arr.slice(arr.length - maxSize) : arr, historize = async (callback) => {
18
+ if (!application)
19
+ return;
20
+ const sprite = application.stage.getChildByLabel(spriteName, !0);
21
+ if (!sprite)
22
+ return;
23
+ const promise = toBlob(application), state = {
24
+ backup: promise,
25
+ sprite: {
26
+ rotation: sprite.rotation,
27
+ size: {
28
+ width: sprite.width,
29
+ height: sprite.height
43
30
  },
44
- stage: {
45
- size: {
46
- width: application.stage.width,
47
- height: application.stage.height
48
- },
49
- scale: {
50
- x: application.stage.scale.x,
51
- y: application.stage.scale.y
52
- }
31
+ position: {
32
+ x: sprite.position.x,
33
+ y: sprite.position.y
34
+ },
35
+ scale: {
36
+ x: sprite.scale.x,
37
+ y: sprite.scale.y
38
+ },
39
+ anchor: {
40
+ x: sprite.anchor.x,
41
+ y: sprite.anchor.y
42
+ }
43
+ },
44
+ stage: {
45
+ size: {
46
+ width: application.stage.width,
47
+ height: application.stage.height
48
+ },
49
+ scale: {
50
+ x: application.stage.scale.x,
51
+ y: application.stage.scale.y
53
52
  }
54
- };
55
- return setHistory([...listSize(history), state]), await promise, callback.call(callback);
56
- }
53
+ }
54
+ };
55
+ return setHistory(trimHistory([...history, state])), await promise, callback.call(callback);
57
56
  };
58
57
  return {
59
58
  historyCount: history.length,
@@ -14,7 +14,7 @@ export default function useImageEditor({ imageSrc, spriteName, }: {
14
14
  spriteName?: string;
15
15
  }): {
16
16
  historyCount: number;
17
- setApplication: import('react').Dispatch<import('react').SetStateAction<PIXI.Application<PIXI.ICanvas> | undefined>>;
17
+ setApplication: import('react').Dispatch<import('react').SetStateAction<PIXI.Application<PIXI.Renderer> | undefined>>;
18
18
  restore: () => Promise<void>;
19
19
  stopCrop: (save: boolean) => void;
20
20
  stopBlur: () => void;
@@ -1,8 +1,7 @@
1
1
  import { useState, useEffect } from "react";
2
- import "@pixi/mixin-get-child-by-name";
3
2
  import useHistoryTool from "./useHistoryTool.js";
4
3
  import useImageEffects from "./useImageEffects.js";
5
- import { updateImage, DEFAULT_SPRITE_NAME, saveAsBlob, saveAsDataURL, updateImageFromBlob } from "../effects/misc.js";
4
+ import { updateImage, DEFAULT_SPRITE_NAME, saveAsBlob, saveAsDataURL, autoResize, updateImageFromBlob } from "../effects/misc.js";
6
5
  function useImageEditor({
7
6
  imageSrc,
8
7
  spriteName = DEFAULT_SPRITE_NAME
@@ -47,7 +46,14 @@ function useImageEditor({
47
46
  spriteName,
48
47
  imgDatasource: imageSrc
49
48
  }).finally(() => setLoading(!1)));
50
- }, [application, imageSrc, spriteName]), {
49
+ }, [application, imageSrc, spriteName]), useEffect(() => {
50
+ if (!application) return;
51
+ const handleResize = () => {
52
+ const sprite = application.stage.getChildByLabel(spriteName, !0);
53
+ sprite && autoResize(application, sprite);
54
+ };
55
+ return window.addEventListener("resize", handleResize), () => window.removeEventListener("resize", handleResize);
56
+ }, [application, spriteName]), {
51
57
  historyCount,
52
58
  setApplication,
53
59
  restore,
@@ -20,7 +20,10 @@ function useImageEffects({
20
20
  if (application) {
21
21
  if (save$12) {
22
22
  const result = save(application);
23
- result && onSave(result);
23
+ if (result) {
24
+ onSave(result);
25
+ return;
26
+ }
24
27
  }
25
28
  stop(application);
26
29
  }
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from '@storybook/react';
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { default as LinkerCard } from './LinkerCard';
3
3
  declare const meta: Meta<typeof LinkerCard>;
4
4
  export default meta;
@@ -220,6 +220,7 @@ const orderedTabs = [
220
220
  ] })
221
221
  ] }) });
222
222
  });
223
+ Object.assign(MediaLibrary, InnerTabs);
223
224
  export {
224
225
  MediaLibrary as default
225
226
  };
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from '@storybook/react';
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { default as UploadCard } from './UploadCard';
3
3
  declare const meta: Meta<typeof UploadCard>;
4
4
  export default meta;
@@ -1,10 +1,10 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { customSize } from "@edifice.io/utilities";
3
- import { useRef, useEffect } from "react";
3
+ import { useRef, useEffect, Suspense, lazy } from "react";
4
4
  import useUploadFiles from "../../../hooks/useUploadFiles/useUploadFiles.js";
5
5
  import UploadCard from "../UploadCard/UploadCard.js";
6
- import ImageEditor from "../ImageEditor/components/ImageEditor.js";
7
- const UploadFiles = ({
6
+ import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
7
+ const ImageEditor = /* @__PURE__ */ lazy(async () => await import("../ImageEditor/components/ImageEditor.js")), UploadFiles = ({
8
8
  onFilesChange,
9
9
  visibility = "protected"
10
10
  }) => {
@@ -48,7 +48,7 @@ const UploadFiles = ({
48
48
  const resource = uploadedFiles.find((uploadedFile) => uploadedFile.name === file.name);
49
49
  return /* @__PURE__ */ jsx(UploadCard, { status: getUploadStatus(file), item: renderItem(file), onEdit: () => setEditingImage(resource), onRetry: () => uploadFile(file), onDelete: () => handleRemoveFile(file) }, file.name);
50
50
  }),
51
- editingImage && /* @__PURE__ */ jsx(ImageEditor, { altText: editingImage.alt, legend: editingImage.title, image: getUrl(editingImage, !0), isOpen: !!editingImage, onCancel: () => setEditingImage(void 0), onSave: updateImage, onError: console.error })
51
+ editingImage && /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, { position: !1 }), children: /* @__PURE__ */ jsx(ImageEditor, { altText: editingImage.alt, legend: editingImage.title, image: getUrl(editingImage, !0), isOpen: !!editingImage, onCancel: () => setEditingImage(void 0), onSave: updateImage, onError: console.error }) })
52
52
  ] });
53
53
  };
54
54
  export {
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { App, IGetConf, IGetSession, IUserDescription, IUserInfo, IWebApp, UserProfile } from '@edifice.io/client';
3
- import { UseQueryResult } from '../../../node_modules/@tanstack/react-query';
3
+ import { UseQueryResult } from '@tanstack/react-query';
4
4
  export interface EdificeClientParams {
5
5
  alternativeApp?: boolean;
6
6
  app: App;
@@ -1,4 +1,4 @@
1
- import { InvalidateQueryFilters, QueryClient } from '../../../node_modules/@tanstack/react-query';
1
+ import { InvalidateQueryFilters, QueryClient } from '@tanstack/react-query';
2
2
  /**
3
3
  * Invalidates queries and resets infinite query data to only contain the first page.
4
4
  *