customized-fabric 1.9.0 → 1.9.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/lib/GroupLayoutObject/constants.d.ts +4 -4
 - package/lib/GroupLayoutObject/constants.js +7 -7
 - package/lib/GroupLayoutObject/index.d.ts +19 -19
 - package/lib/GroupLayoutObject/index.js +26 -26
 - package/lib/GroupLayoutObject/interfaces.d.ts +3 -3
 - package/lib/GroupLayoutObject/interfaces.js +2 -2
 - package/lib/ImagePlaceholderObject/index.js +3 -2
 - package/lib/constants/index.d.ts +6 -6
 - package/lib/constants/index.js +12 -12
 - package/package.json +25 -25
 
| 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            export declare const GROUP_LAYOUT_OBJECT_ATTRIBUTES: {
         
     | 
| 
       2 
     | 
    
         
            -
                name: string;
         
     | 
| 
       3 
     | 
    
         
            -
                type: string;
         
     | 
| 
       4 
     | 
    
         
            -
            };
         
     | 
| 
      
 1 
     | 
    
         
            +
            export declare const GROUP_LAYOUT_OBJECT_ATTRIBUTES: {
         
     | 
| 
      
 2 
     | 
    
         
            +
                name: string;
         
     | 
| 
      
 3 
     | 
    
         
            +
                type: string;
         
     | 
| 
      
 4 
     | 
    
         
            +
            };
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            "use strict";
         
     | 
| 
       2 
     | 
    
         
            -
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       3 
     | 
    
         
            -
            exports.GROUP_LAYOUT_OBJECT_ATTRIBUTES = void 0;
         
     | 
| 
       4 
     | 
    
         
            -
            exports.GROUP_LAYOUT_OBJECT_ATTRIBUTES = {
         
     | 
| 
       5 
     | 
    
         
            -
                name: "Group layout",
         
     | 
| 
       6 
     | 
    
         
            -
                type: "GROUP_LAYOUT",
         
     | 
| 
       7 
     | 
    
         
            -
            };
         
     | 
| 
      
 1 
     | 
    
         
            +
            "use strict";
         
     | 
| 
      
 2 
     | 
    
         
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 3 
     | 
    
         
            +
            exports.GROUP_LAYOUT_OBJECT_ATTRIBUTES = void 0;
         
     | 
| 
      
 4 
     | 
    
         
            +
            exports.GROUP_LAYOUT_OBJECT_ATTRIBUTES = {
         
     | 
| 
      
 5 
     | 
    
         
            +
                name: "Group layout",
         
     | 
| 
      
 6 
     | 
    
         
            +
                type: "GROUP_LAYOUT",
         
     | 
| 
      
 7 
     | 
    
         
            +
            };
         
     | 
| 
         @@ -1,19 +1,19 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { fabric } from "fabric";
         
     | 
| 
       2 
     | 
    
         
            -
            import { ObjectId } from "../utils/objectId";
         
     | 
| 
       3 
     | 
    
         
            -
            import { IGroupLayoutOptions } from "./interfaces";
         
     | 
| 
       4 
     | 
    
         
            -
            export declare const toGroupLayoutObject: (groupLayoutObject: GroupLayout) => {
         
     | 
| 
       5 
     | 
    
         
            -
                _id: ObjectId | undefined;
         
     | 
| 
       6 
     | 
    
         
            -
                id: ObjectId | undefined;
         
     | 
| 
       7 
     | 
    
         
            -
                personalizeId: number | undefined;
         
     | 
| 
       8 
     | 
    
         
            -
                layerId: number | undefined;
         
     | 
| 
       9 
     | 
    
         
            -
                name: string | undefined;
         
     | 
| 
       10 
     | 
    
         
            -
                locked: boolean | undefined;
         
     | 
| 
       11 
     | 
    
         
            -
                isAdditional: boolean | undefined;
         
     | 
| 
       12 
     | 
    
         
            -
            };
         
     | 
| 
       13 
     | 
    
         
            -
            export default class GroupLayout extends fabric.ActiveSelection {
         
     | 
| 
       14 
     | 
    
         
            -
                _id?: ObjectId;
         
     | 
| 
       15 
     | 
    
         
            -
                layerId?: number;
         
     | 
| 
       16 
     | 
    
         
            -
                locked?: boolean;
         
     | 
| 
       17 
     | 
    
         
            -
                isAdditional?: boolean;
         
     | 
| 
       18 
     | 
    
         
            -
                constructor(options?: IGroupLayoutOptions);
         
     | 
| 
       19 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            import { fabric } from "fabric";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { ObjectId } from "../utils/objectId";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { IGroupLayoutOptions } from "./interfaces";
         
     | 
| 
      
 4 
     | 
    
         
            +
            export declare const toGroupLayoutObject: (groupLayoutObject: GroupLayout) => {
         
     | 
| 
      
 5 
     | 
    
         
            +
                _id: ObjectId | undefined;
         
     | 
| 
      
 6 
     | 
    
         
            +
                id: ObjectId | undefined;
         
     | 
| 
      
 7 
     | 
    
         
            +
                personalizeId: number | undefined;
         
     | 
| 
      
 8 
     | 
    
         
            +
                layerId: number | undefined;
         
     | 
| 
      
 9 
     | 
    
         
            +
                name: string | undefined;
         
     | 
| 
      
 10 
     | 
    
         
            +
                locked: boolean | undefined;
         
     | 
| 
      
 11 
     | 
    
         
            +
                isAdditional: boolean | undefined;
         
     | 
| 
      
 12 
     | 
    
         
            +
            };
         
     | 
| 
      
 13 
     | 
    
         
            +
            export default class GroupLayout extends fabric.ActiveSelection {
         
     | 
| 
      
 14 
     | 
    
         
            +
                _id?: ObjectId;
         
     | 
| 
      
 15 
     | 
    
         
            +
                layerId?: number;
         
     | 
| 
      
 16 
     | 
    
         
            +
                locked?: boolean;
         
     | 
| 
      
 17 
     | 
    
         
            +
                isAdditional?: boolean;
         
     | 
| 
      
 18 
     | 
    
         
            +
                constructor(options?: IGroupLayoutOptions);
         
     | 
| 
      
 19 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,26 +1,26 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            "use strict";
         
     | 
| 
       2 
     | 
    
         
            -
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       3 
     | 
    
         
            -
            exports.toGroupLayoutObject = void 0;
         
     | 
| 
       4 
     | 
    
         
            -
            const fabric_1 = require("fabric");
         
     | 
| 
       5 
     | 
    
         
            -
            const GroupLayoutClass = fabric_1.fabric.util.createClass(fabric_1.fabric.ActiveSelection, {
         
     | 
| 
       6 
     | 
    
         
            -
                initialize: async function (options) { },
         
     | 
| 
       7 
     | 
    
         
            -
            });
         
     | 
| 
       8 
     | 
    
         
            -
            const toGroupLayoutObject = (groupLayoutObject) => {
         
     | 
| 
       9 
     | 
    
         
            -
                return {
         
     | 
| 
       10 
     | 
    
         
            -
                    _id: groupLayoutObject._id,
         
     | 
| 
       11 
     | 
    
         
            -
                    id: groupLayoutObject._id,
         
     | 
| 
       12 
     | 
    
         
            -
                    personalizeId: groupLayoutObject.layerId,
         
     | 
| 
       13 
     | 
    
         
            -
                    layerId: groupLayoutObject.layerId,
         
     | 
| 
       14 
     | 
    
         
            -
                    name: groupLayoutObject.name,
         
     | 
| 
       15 
     | 
    
         
            -
                    locked: groupLayoutObject.locked,
         
     | 
| 
       16 
     | 
    
         
            -
                    isAdditional: groupLayoutObject?.isAdditional,
         
     | 
| 
       17 
     | 
    
         
            -
                };
         
     | 
| 
       18 
     | 
    
         
            -
            };
         
     | 
| 
       19 
     | 
    
         
            -
            exports.toGroupLayoutObject = toGroupLayoutObject;
         
     | 
| 
       20 
     | 
    
         
            -
            class GroupLayout extends fabric_1.fabric.ActiveSelection {
         
     | 
| 
       21 
     | 
    
         
            -
                constructor(options) {
         
     | 
| 
       22 
     | 
    
         
            -
                    super();
         
     | 
| 
       23 
     | 
    
         
            -
                    return new GroupLayoutClass(options);
         
     | 
| 
       24 
     | 
    
         
            -
                }
         
     | 
| 
       25 
     | 
    
         
            -
            }
         
     | 
| 
       26 
     | 
    
         
            -
            exports.default = GroupLayout;
         
     | 
| 
      
 1 
     | 
    
         
            +
            "use strict";
         
     | 
| 
      
 2 
     | 
    
         
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 3 
     | 
    
         
            +
            exports.toGroupLayoutObject = void 0;
         
     | 
| 
      
 4 
     | 
    
         
            +
            const fabric_1 = require("fabric");
         
     | 
| 
      
 5 
     | 
    
         
            +
            const GroupLayoutClass = fabric_1.fabric.util.createClass(fabric_1.fabric.ActiveSelection, {
         
     | 
| 
      
 6 
     | 
    
         
            +
                initialize: async function (options) { },
         
     | 
| 
      
 7 
     | 
    
         
            +
            });
         
     | 
| 
      
 8 
     | 
    
         
            +
            const toGroupLayoutObject = (groupLayoutObject) => {
         
     | 
| 
      
 9 
     | 
    
         
            +
                return {
         
     | 
| 
      
 10 
     | 
    
         
            +
                    _id: groupLayoutObject._id,
         
     | 
| 
      
 11 
     | 
    
         
            +
                    id: groupLayoutObject._id,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    personalizeId: groupLayoutObject.layerId,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    layerId: groupLayoutObject.layerId,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    name: groupLayoutObject.name,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    locked: groupLayoutObject.locked,
         
     | 
| 
      
 16 
     | 
    
         
            +
                    isAdditional: groupLayoutObject?.isAdditional,
         
     | 
| 
      
 17 
     | 
    
         
            +
                };
         
     | 
| 
      
 18 
     | 
    
         
            +
            };
         
     | 
| 
      
 19 
     | 
    
         
            +
            exports.toGroupLayoutObject = toGroupLayoutObject;
         
     | 
| 
      
 20 
     | 
    
         
            +
            class GroupLayout extends fabric_1.fabric.ActiveSelection {
         
     | 
| 
      
 21 
     | 
    
         
            +
                constructor(options) {
         
     | 
| 
      
 22 
     | 
    
         
            +
                    super();
         
     | 
| 
      
 23 
     | 
    
         
            +
                    return new GroupLayoutClass(options);
         
     | 
| 
      
 24 
     | 
    
         
            +
                }
         
     | 
| 
      
 25 
     | 
    
         
            +
            }
         
     | 
| 
      
 26 
     | 
    
         
            +
            exports.default = GroupLayout;
         
     | 
| 
         @@ -1,3 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            export interface IGroupLayoutOptions extends fabric.IObjectOptions {
         
     | 
| 
       2 
     | 
    
         
            -
                objects?: fabric.Object[];
         
     | 
| 
       3 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            export interface IGroupLayoutOptions extends fabric.IObjectOptions {
         
     | 
| 
      
 2 
     | 
    
         
            +
                objects?: fabric.Object[];
         
     | 
| 
      
 3 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,2 +1,2 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            "use strict";
         
     | 
| 
       2 
     | 
    
         
            -
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 1 
     | 
    
         
            +
            "use strict";
         
     | 
| 
      
 2 
     | 
    
         
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
         @@ -245,8 +245,9 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G 
     | 
|
| 
       245 
245 
     | 
    
         
             
                loadCustomizedImage: async function (image) {
         
     | 
| 
       246 
246 
     | 
    
         
             
                    if (image) {
         
     | 
| 
       247 
247 
     | 
    
         
             
                        const { url, filteredUrl, data, clipPath } = image;
         
     | 
| 
       248 
     | 
    
         
            -
                         
     | 
| 
       249 
     | 
    
         
            -
             
     | 
| 
      
 248 
     | 
    
         
            +
                        const imageUrl = filteredUrl ?? url;
         
     | 
| 
      
 249 
     | 
    
         
            +
                        if (imageUrl && data && clipPath) {
         
     | 
| 
      
 250 
     | 
    
         
            +
                            const loadedImage = await (0, utils_1.loadImageFromUrl)(imageUrl);
         
     | 
| 
       250 
251 
     | 
    
         
             
                            if (loadedImage) {
         
     | 
| 
       251 
252 
     | 
    
         
             
                                const mask = await this.getMask();
         
     | 
| 
       252 
253 
     | 
    
         
             
                                const { top, left, scaleX, width, angle, flipX, flipY, settings = {}, } = data;
         
     | 
    
        package/lib/constants/index.d.ts
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            export declare const OBJECT_TYPES: {
         
     | 
| 
       2 
     | 
    
         
            -
                textInput: string;
         
     | 
| 
       3 
     | 
    
         
            -
                clipart: string;
         
     | 
| 
       4 
     | 
    
         
            -
                imagePlaceHolder: string;
         
     | 
| 
       5 
     | 
    
         
            -
                activeSelection: string;
         
     | 
| 
       6 
     | 
    
         
            -
            };
         
     | 
| 
      
 1 
     | 
    
         
            +
            export declare const OBJECT_TYPES: {
         
     | 
| 
      
 2 
     | 
    
         
            +
                textInput: string;
         
     | 
| 
      
 3 
     | 
    
         
            +
                clipart: string;
         
     | 
| 
      
 4 
     | 
    
         
            +
                imagePlaceHolder: string;
         
     | 
| 
      
 5 
     | 
    
         
            +
                activeSelection: string;
         
     | 
| 
      
 6 
     | 
    
         
            +
            };
         
     | 
    
        package/lib/constants/index.js
    CHANGED
    
    | 
         @@ -1,12 +1,12 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            "use strict";
         
     | 
| 
       2 
     | 
    
         
            -
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       3 
     | 
    
         
            -
            exports.OBJECT_TYPES = void 0;
         
     | 
| 
       4 
     | 
    
         
            -
            const constants_1 = require("../ClipartObject/constants");
         
     | 
| 
       5 
     | 
    
         
            -
            const constants_2 = require("../ImagePlaceholderObject/constants");
         
     | 
| 
       6 
     | 
    
         
            -
            const constants_3 = require("../TextInputObject/constants");
         
     | 
| 
       7 
     | 
    
         
            -
            exports.OBJECT_TYPES = {
         
     | 
| 
       8 
     | 
    
         
            -
                textInput: constants_3.TEXT_INPUT_OBJECT_ATTRIBUTES.type,
         
     | 
| 
       9 
     | 
    
         
            -
                clipart: constants_1.CLIPART_OBJECT_ATTRIBUTES.type,
         
     | 
| 
       10 
     | 
    
         
            -
                imagePlaceHolder: constants_2.IMAGE_PLACEHOLDER_OBJECT_ATTRIBUTES.type,
         
     | 
| 
       11 
     | 
    
         
            -
                activeSelection: "activeSelection",
         
     | 
| 
       12 
     | 
    
         
            -
            };
         
     | 
| 
      
 1 
     | 
    
         
            +
            "use strict";
         
     | 
| 
      
 2 
     | 
    
         
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 3 
     | 
    
         
            +
            exports.OBJECT_TYPES = void 0;
         
     | 
| 
      
 4 
     | 
    
         
            +
            const constants_1 = require("../ClipartObject/constants");
         
     | 
| 
      
 5 
     | 
    
         
            +
            const constants_2 = require("../ImagePlaceholderObject/constants");
         
     | 
| 
      
 6 
     | 
    
         
            +
            const constants_3 = require("../TextInputObject/constants");
         
     | 
| 
      
 7 
     | 
    
         
            +
            exports.OBJECT_TYPES = {
         
     | 
| 
      
 8 
     | 
    
         
            +
                textInput: constants_3.TEXT_INPUT_OBJECT_ATTRIBUTES.type,
         
     | 
| 
      
 9 
     | 
    
         
            +
                clipart: constants_1.CLIPART_OBJECT_ATTRIBUTES.type,
         
     | 
| 
      
 10 
     | 
    
         
            +
                imagePlaceHolder: constants_2.IMAGE_PLACEHOLDER_OBJECT_ATTRIBUTES.type,
         
     | 
| 
      
 11 
     | 
    
         
            +
                activeSelection: "activeSelection",
         
     | 
| 
      
 12 
     | 
    
         
            +
            };
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,25 +1,25 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {
         
     | 
| 
       2 
     | 
    
         
            -
              "name": "customized-fabric",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "1.9. 
     | 
| 
       4 
     | 
    
         
            -
              "description": "Customized fabric",
         
     | 
| 
       5 
     | 
    
         
            -
              "main": "lib/index.js",
         
     | 
| 
       6 
     | 
    
         
            -
              "types": "lib/index.d.ts",
         
     | 
| 
       7 
     | 
    
         
            -
              "files": [
         
     | 
| 
       8 
     | 
    
         
            -
                "lib"
         
     | 
| 
       9 
     | 
    
         
            -
              ],
         
     | 
| 
       10 
     | 
    
         
            -
              "scripts": {
         
     | 
| 
       11 
     | 
    
         
            -
                "test": "echo \"Error: no test specified\" && exit 1",
         
     | 
| 
       12 
     | 
    
         
            -
                "build": "tsc",
         
     | 
| 
       13 
     | 
    
         
            -
                "prepare": "npm run build"
         
     | 
| 
       14 
     | 
    
         
            -
              },
         
     | 
| 
       15 
     | 
    
         
            -
              "author": "",
         
     | 
| 
       16 
     | 
    
         
            -
              "license": "ISC",
         
     | 
| 
       17 
     | 
    
         
            -
              "dependencies": {
         
     | 
| 
       18 
     | 
    
         
            -
                "@types/node": "^20.6.0",
         
     | 
| 
       19 
     | 
    
         
            -
                "fabric": "^5.3.0"
         
     | 
| 
       20 
     | 
    
         
            -
              },
         
     | 
| 
       21 
     | 
    
         
            -
              "devDependencies": {
         
     | 
| 
       22 
     | 
    
         
            -
                "@types/fabric": "^5.3.3",
         
     | 
| 
       23 
     | 
    
         
            -
                "typescript": "^5.2.2"
         
     | 
| 
       24 
     | 
    
         
            -
              }
         
     | 
| 
       25 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "name": "customized-fabric",
         
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "1.9.1",
         
     | 
| 
      
 4 
     | 
    
         
            +
              "description": "Customized fabric",
         
     | 
| 
      
 5 
     | 
    
         
            +
              "main": "lib/index.js",
         
     | 
| 
      
 6 
     | 
    
         
            +
              "types": "lib/index.d.ts",
         
     | 
| 
      
 7 
     | 
    
         
            +
              "files": [
         
     | 
| 
      
 8 
     | 
    
         
            +
                "lib"
         
     | 
| 
      
 9 
     | 
    
         
            +
              ],
         
     | 
| 
      
 10 
     | 
    
         
            +
              "scripts": {
         
     | 
| 
      
 11 
     | 
    
         
            +
                "test": "echo \"Error: no test specified\" && exit 1",
         
     | 
| 
      
 12 
     | 
    
         
            +
                "build": "tsc",
         
     | 
| 
      
 13 
     | 
    
         
            +
                "prepare": "npm run build"
         
     | 
| 
      
 14 
     | 
    
         
            +
              },
         
     | 
| 
      
 15 
     | 
    
         
            +
              "author": "",
         
     | 
| 
      
 16 
     | 
    
         
            +
              "license": "ISC",
         
     | 
| 
      
 17 
     | 
    
         
            +
              "dependencies": {
         
     | 
| 
      
 18 
     | 
    
         
            +
                "@types/node": "^20.6.0",
         
     | 
| 
      
 19 
     | 
    
         
            +
                "fabric": "^5.3.0"
         
     | 
| 
      
 20 
     | 
    
         
            +
              },
         
     | 
| 
      
 21 
     | 
    
         
            +
              "devDependencies": {
         
     | 
| 
      
 22 
     | 
    
         
            +
                "@types/fabric": "^5.3.3",
         
     | 
| 
      
 23 
     | 
    
         
            +
                "typescript": "^5.2.2"
         
     | 
| 
      
 24 
     | 
    
         
            +
              }
         
     | 
| 
      
 25 
     | 
    
         
            +
            }
         
     |