Skip to content

Commit

Permalink
fix broken build
Browse files Browse the repository at this point in the history
  • Loading branch information
lexoyo committed Oct 18, 2024
1 parent 53b6d55 commit c71f431
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 242 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ private/
node_modules/
*.log
stats.json
*.tsbuildinfo
14 changes: 7 additions & 7 deletions dist/es5/SymbolsCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSymbolInstance = exports.unlinkSymbolInstance = exports.removeSymbol = exports.addSymbol = exports.displayError = exports.cmdCreate = exports.cmdUnlink = exports.cmdRemove = exports.cmdAdd = void 0;
exports.cmdCreate = exports.cmdUnlink = exports.cmdRemove = exports.cmdAdd = void 0;
exports.default = default_1;
exports.displayError = displayError;
exports.addSymbol = addSymbol;
exports.removeSymbol = removeSymbol;
exports.unlinkSymbolInstance = unlinkSymbolInstance;
exports.createSymbolInstance = createSymbolInstance;
var lit_html_1 = require("lit-html");
var unsafe_html_js_1 = require("lit-html/directives/unsafe-html.js");
var Symbol_1 = require("./model/Symbol");
Expand All @@ -22,7 +28,6 @@ function default_1(editor, options) {
editor.Commands.add(exports.cmdUnlink, unlinkSymbolInstance);
editor.Commands.add(exports.cmdCreate, createSymbolInstance);
}
exports.default = default_1;
// Symbol management functions
// These are exported for unit tests
function displayError(editor, title, message) {
Expand All @@ -33,7 +38,6 @@ function displayError(editor, title, message) {
});
(0, lit_html_1.render)((0, lit_html_1.html)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["<main>\n <p>", "</p>\n </main><footer style=\"\n display: flex;\n justify-content: space-between;\n margin-top: 30px;\n \">\n <div></div>\n <button class=\"gjs-btn-prim\" @click=", ">Close</button>\n </footer>"], ["<main>\n <p>", "</p>\n </main><footer style=\"\n display: flex;\n justify-content: space-between;\n margin-top: 30px;\n \">\n <div></div>\n <button class=\"gjs-btn-prim\" @click=", ">Close</button>\n </footer>"])), (0, unsafe_html_js_1.unsafeHTML)(message), function () { return editor.Modal.close(); }), content);
}
exports.displayError = displayError;
/**
* Create a new symbol
* @param options.component - the component which will become the first instance of the symbol
Expand All @@ -55,7 +59,6 @@ function addSymbol(editor, sender, _a) {
throw new Error('Can not create the symbol: missing required param');
}
}
exports.addSymbol = addSymbol;
/**
* Delete a symbol
* @param {symbolId: string} - object containing the symbolId
Expand Down Expand Up @@ -85,7 +88,6 @@ function removeSymbol(editor, sender, _a) {
throw new Error('Could not remove symbol: missing param symbolId');
}
}
exports.removeSymbol = removeSymbol;
function unlinkSymbolInstance(editor, sender, _a) {
var component = _a.component;
if (component) {
Expand All @@ -105,7 +107,6 @@ function unlinkSymbolInstance(editor, sender, _a) {
throw new Error('Can not unlink the component: missing param component');
}
}
exports.unlinkSymbolInstance = unlinkSymbolInstance;
/**
* @param {{index, indexEl, method}} pos Where to insert the component, as [defined by the Sorter](https://github.com/artf/grapesjs/blob/0842df7c2423300f772e9e6cdc88c6ae8141c732/src/utils/Sorter.js#L871)
*/
Expand Down Expand Up @@ -144,5 +145,4 @@ function createSymbolInstance(editor, sender, _a) {
throw new Error('Can not create the symbol: missing param symbol or pos or target');
}
}
exports.createSymbolInstance = createSymbolInstance;
var templateObject_1;
12 changes: 6 additions & 6 deletions dist/es5/model/Symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSymbol = exports.initSymbolChild = exports.initModel = exports.cleanup = exports.getSymbolId = exports.SYMBOL_SYNC_ATTRIBUTE = exports.SYMBOL_CHILD_ID_ATTRIBUTE = exports.SYMBOL_ID_ATTRIBUTE = void 0;
exports.SYMBOL_SYNC_ATTRIBUTE = exports.SYMBOL_CHILD_ID_ATTRIBUTE = exports.SYMBOL_ID_ATTRIBUTE = void 0;
exports.getSymbolId = getSymbolId;
exports.cleanup = cleanup;
exports.initModel = initModel;
exports.initSymbolChild = initSymbolChild;
exports.createSymbol = createSymbol;
var backbone_1 = __importDefault(require("backbone"));
var utils_1 = require("../utils");
var underscore_1 = require("underscore");
Expand Down Expand Up @@ -378,15 +383,13 @@ var Symbol = /** @class */ (function (_super) {
function getSymbolId(c) {
return c.get(exports.SYMBOL_ID_ATTRIBUTE);
}
exports.getSymbolId = getSymbolId;
/**
* remove symbols IDs from an instance
*/
function cleanup(c) {
c.set(exports.SYMBOL_ID_ATTRIBUTE);
c.set(exports.SYMBOL_CHILD_ID_ATTRIBUTE);
}
exports.cleanup = cleanup;
/**
* Init a component to be this symbol's `model`
* Also init the component's children
Expand Down Expand Up @@ -419,7 +422,6 @@ function initModel(c, _a) {
(0, utils_1.children)(c)
.forEach(function (child) { return initSymbolChild(child); });
}
exports.initModel = initModel;
/**
* Init a component to be this symbol's `model`'s child
* @param {Component} c
Expand All @@ -430,7 +432,6 @@ function initSymbolChild(c, force) {
c.set(exports.SYMBOL_CHILD_ID_ATTRIBUTE, c.cid);
}
}
exports.initSymbolChild = initSymbolChild;
/**
* create a new symbol ou of a component
* the component and its children will be init
Expand Down Expand Up @@ -477,5 +478,4 @@ function createSymbol(editor, c, attributes) {
}
return s;
}
exports.createSymbol = createSymbol;
exports.default = Symbol;
4 changes: 2 additions & 2 deletions dist/es5/model/Symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
Expand Down
3 changes: 1 addition & 2 deletions dist/es5/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTestSymbols = void 0;
exports.getTestSymbols = getTestSymbols;
var grapesjs_1 = __importDefault(require("grapesjs"));
var Symbol_1 = require("./model/Symbol");
// let's use the editor in headless mode
Expand Down Expand Up @@ -58,4 +58,3 @@ function getTestSymbols() {
.set(comp3.cid, comp3);
return { child11: child11, child12: child12, child21: child21, child22: child22, child111: child111, child211: child211, comp1: comp1, comp2: comp2, s1: s1, s2: s2, s1Data: s1Data, editor: editor };
}
exports.getTestSymbols = getTestSymbols;
37 changes: 18 additions & 19 deletions dist/es5/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
Expand Down Expand Up @@ -45,7 +45,19 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.allowDrop = exports.setCaret = exports.getCaret = exports.getNode = exports.getNodePath = exports.wait = exports.hasSymbolId = exports.closestInstance = exports.find = exports.all = exports.children = exports.getAllComponentsFromEditor = exports.setDirty = void 0;
exports.setDirty = setDirty;
exports.getAllComponentsFromEditor = getAllComponentsFromEditor;
exports.children = children;
exports.all = all;
exports.find = find;
exports.closestInstance = closestInstance;
exports.hasSymbolId = hasSymbolId;
exports.wait = wait;
exports.getNodePath = getNodePath;
exports.getNode = getNode;
exports.getCaret = getCaret;
exports.setCaret = setCaret;
exports.allowDrop = allowDrop;
var Symbol_1 = require("./model/Symbol");
/**
* set editor as dirty
Expand All @@ -59,7 +71,6 @@ function setDirty(editor) {
// this occures in headless mode and UT
}
}
exports.setDirty = setDirty;
/**
* browse all pages and retrieve all website components
*/
Expand All @@ -72,7 +83,6 @@ function getAllComponentsFromEditor(editor) {
});
return res;
}
exports.getAllComponentsFromEditor = getAllComponentsFromEditor;
/**
* Get all the children excluding symbols children
* @param {Component} c - the root component
Expand All @@ -83,7 +93,6 @@ function children(c) {
return children
.flatMap(function (child) { return all(child); });
}
exports.children = children;
/**
* Get an array of the component + its children excluding symbols children
* @param {Component} c - the root component
Expand All @@ -99,7 +108,6 @@ function all(c) {
return all(child);
}));
}
exports.all = all;
/**
* Find a component in a component's children, with a given symbolChildId or symbolId
* @param {Component} c - the root component
Expand All @@ -122,7 +130,6 @@ function find(c, symbolChildId) {
return found_1;
}
}
exports.find = find;
/**
* find the first symbol in the parents (or the element itself)
* @private
Expand All @@ -134,24 +141,21 @@ function closestInstance(c) {
}
return ptr;
}
exports.closestInstance = closestInstance;
/**
* @param {Component} c - a component
* @return {Boolean} true if the component has a symbol id
*/
function hasSymbolId(c) {
return !!c.get('symbolId');
}
exports.hasSymbolId = hasSymbolId;
function wait(ms) {
if (ms === void 0) { ms = 0; }
return __awaiter(this, void 0, void 0, function () {
function wait() {
return __awaiter(this, arguments, void 0, function (ms) {
if (ms === void 0) { ms = 0; }
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, ms); })];
});
});
}
exports.wait = wait;
/**
* Get an array of the indexes of the node in its parent nodes
* @example <div><div></div><div><div id="test"/> => returns [1, 0] for #test
Expand All @@ -168,7 +172,6 @@ function getNodePath(root, node) {
}
return path;
}
exports.getNodePath = getNodePath;
/**
* Get an array of the indexes of the node in its parent nodes
* @example <div><div></div><div><div id="test"/> => returns [1, 0] for #test
Expand All @@ -181,7 +184,6 @@ function getNode(root, path) {
}
return result;
}
exports.getNode = getNode;
/**
* Gets the caret position
*/
Expand All @@ -195,7 +197,6 @@ function getCaret(el) {
var path = getNodePath(el, caretEl);
return { path: path, pos: pos };
}
exports.getCaret = getCaret;
/**
* Sets the caret position
*/
Expand All @@ -217,7 +218,6 @@ function setCaret(el, _a) {
console.error('Could not keep the caret position', { el: el, path: path });
}
}
exports.setCaret = setCaret;
/**
* find the all the symbols in the parents (or the element itself)
* @private
Expand Down Expand Up @@ -254,4 +254,3 @@ function allowDrop(_a) {
var allChildren = allChildrenInstances(target, false);
return !allParents.find(function (p) { return allChildren.find(function (c) { return (0, Symbol_1.getSymbolId)(c) === (0, Symbol_1.getSymbolId)(p); }); });
}
exports.allowDrop = allowDrop;
3 changes: 1 addition & 2 deletions dist/es5/view/SymbolsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.confirmDialog = void 0;
exports.confirmDialog = confirmDialog;
var lit_html_1 = require("lit-html");
var unsafe_html_js_1 = require("lit-html/directives/unsafe-html.js");
var backbone_1 = __importDefault(require("backbone"));
Expand Down Expand Up @@ -56,7 +56,6 @@ function confirmDialog(_a) {
}, primaryLabel), content);
}
}
exports.confirmDialog = confirmDialog;
var default_1 = /** @class */ (function (_super) {
__extends(default_1, _super);
//initialize(model, { editor, options }) {
Expand Down
2 changes: 1 addition & 1 deletion dist/es5/view/traits.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
var lit_html_1 = require("lit-html");
var events_1 = require("../events");
var Symbol_1 = require("../model/Symbol");
Expand Down Expand Up @@ -93,5 +94,4 @@ function default_1(editor, options) {
// })
//})
}
exports.default = default_1;
var templateObject_1;
4 changes: 2 additions & 2 deletions dist/es6/model/Symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
Expand Down
10 changes: 5 additions & 5 deletions dist/es6/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
Expand Down Expand Up @@ -133,9 +133,9 @@ export function closestInstance(c) {
export function hasSymbolId(c) {
return !!c.get('symbolId');
}
export function wait(ms) {
if (ms === void 0) { ms = 0; }
return __awaiter(this, void 0, void 0, function () {
export function wait() {
return __awaiter(this, arguments, void 0, function (ms) {
if (ms === void 0) { ms = 0; }
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(resolve, ms); })];
});
Expand Down
Loading

0 comments on commit c71f431

Please sign in to comment.