coralite 0.30.0 → 0.31.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coralite.d.ts","sourceRoot":"","sources":["../../lib/coralite.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH,2IAXW,cAAc,QAmMxB;;IA3ND;;;;;;;;;;;;;;;;OAgBG;IAEH;;OAEG;IAEH;;;;;;;;;;;;OAYG;IACH,8HAXW,cAAc,EAmMxB;IA1JC,6DAA+B;IAG/B;;;;;;;;;;;;;;MAWC;IAED,oDAAoD;IACpD,eADW,GAAG,CAAC,MAAM,EAAE,sBAAsB,EAAE,CAAC,CAClB;IAG9B;;;;;;;;;;;;;;MAcC;IAGD,8BAAqD;IAGrD;;;;;;;;
|
|
1
|
+
{"version":3,"file":"coralite.d.ts","sourceRoot":"","sources":["../../lib/coralite.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH,2IAXW,cAAc,QAmMxB;;IA3ND;;;;;;;;;;;;;;;;OAgBG;IAEH;;OAEG;IAEH;;;;;;;;;;;;OAYG;IACH,8HAXW,cAAc,EAmMxB;IA1JC,6DAA+B;IAG/B;;;;;;;;;;;;;;MAWC;IAED,oDAAoD;IACpD,eADW,GAAG,CAAC,MAAM,EAAE,sBAAsB,EAAE,CAAC,CAClB;IAG9B;;;;;;;;;;;;;;MAcC;IAGD,8BAAqD;IAGrD;;;;;;;;8BA4wCS,qBAAqB,GAAG,eAAe,GAAG,eAAe,EAAE,YAC3D,oBAAoB,KAClB,MAAM;;;;;;;;;;;;MAvvChB;IA6FH;;;OAGG;IACH,cAFa,OAAO,CAAC,IAAI,CAAC,CA0PzB;IAvPC,+BA2CE;IAWF;;OAEG;IACH;;MAA6C;IAC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C,GAAU,OAAO,CAAC,oBAAoB,CAAC,CA4EzC;IAED;;;;;;;;;;;;;OAaG;IACH,sFATG;QAA6B,MAAM,EAA3B,cAAc;QACa,MAAM,EAAjC,oBAAoB;QACE,OAAO,EAA7B,eAAe;QACS,SAAS,EAAjC,iBAAiB;QACJ,SAAS,EAAtB,MAAM;QACO,aAAa;KAElC,GAAU,OAAO,CAAC,oBAAoB,CAAC,CAiHzC;IAED;;;;;;;;;;;;;OAaG;IACH,yBAFa,OAAO,CAAC,oBAAoB,CAAC,CAOzC;IAED;;;;;;;;;;OAUG;IACH,mBAVsB,CAAC,wBAMZ,WAAW,GAAC,cAAc,GAAC,cAAc,GAAC,gBAAgB,GAAC,mBAAmB,GAAC,mBAAmB,GAAC,oBAAoB,GAAC,mBAAmB,GAAC,eAAe,GAAC,cAAc,QAC1K,CAAC,GACA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAc5B;IAED;;;;;;;OAOG;IACH,qBAHW,WAAW,GAAC,cAAc,GAAC,cAAc,GAAC,gBAAgB,GAAC,mBAAmB,GAAC,mBAAmB,GAAC,oBAAoB,GAAC,mBAAmB,GAAC,eAAe,GAAC,cAAc,4BAapL;;;wCAzsCU,cAAc,KACZ,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG;oCAlmCN,mBAAmB;4CAAnB,mBAAmB;8BA/Bd,qBAAqB;6BAHT,WAAW;4BAAX,WAAW;+BACiB,YAAY;2CAiCzD,mBAAmB;qCAAnB,mBAAmB;0CAIL,gBAAgB;+BAvBxB,iBAAiB;oCAmBvB,mBAAmB;uCAAnB,mBAAmB;0CAAnB,mBAAmB;qCAAnB,mBAAmB;oCAAnB,mBAAmB"}
|
package/dist/lib/index.js
CHANGED
|
@@ -6735,7 +6735,7 @@ function findAndExtractScript(code) {
|
|
|
6735
6735
|
}
|
|
6736
6736
|
} else if (imports || setupContent) {
|
|
6737
6737
|
result = {
|
|
6738
|
-
content: "
|
|
6738
|
+
content: "function(){}",
|
|
6739
6739
|
lineOffset: 0
|
|
6740
6740
|
};
|
|
6741
6741
|
if (imports) {
|
|
@@ -6750,7 +6750,7 @@ function findAndExtractScript(code) {
|
|
|
6750
6750
|
}
|
|
6751
6751
|
} else if (tokens.length > 0) {
|
|
6752
6752
|
result = {
|
|
6753
|
-
content: "
|
|
6753
|
+
content: "function(){}",
|
|
6754
6754
|
lineOffset: 0,
|
|
6755
6755
|
tokens
|
|
6756
6756
|
};
|
|
@@ -9564,7 +9564,7 @@ ScriptManager.prototype.compileAllInstances = async function(instances, mode) {
|
|
|
9564
9564
|
for (const [componentId, fnData] of Object.entries(this.sharedFunctions)) {
|
|
9565
9565
|
if (fnData.script && fnData.script.content) {
|
|
9566
9566
|
const scriptContent = fnData.script.content.replace(/\s+/g, "");
|
|
9567
|
-
if (scriptContent !== "
|
|
9567
|
+
if (scriptContent !== "function(){}") {
|
|
9568
9568
|
processedComponent[componentId] = true;
|
|
9569
9569
|
}
|
|
9570
9570
|
} else if (fnData.script && fnData.script.components && fnData.script.components.length > 0) {
|
|
@@ -9646,7 +9646,7 @@ ScriptManager.prototype.compileAllInstances = async function(instances, mode) {
|
|
|
9646
9646
|
`;
|
|
9647
9647
|
hasImports = true;
|
|
9648
9648
|
}
|
|
9649
|
-
if (this.sharedFunctions[componentId].script && this.sharedFunctions[componentId].script.content && this.sharedFunctions[componentId].script.content.trim() !== "
|
|
9649
|
+
if (this.sharedFunctions[componentId].script && this.sharedFunctions[componentId].script.content && this.sharedFunctions[componentId].script.content.trim() !== "function(){}" && this.sharedFunctions[componentId].script.content.trim() !== "function() {}" && this.sharedFunctions[componentId].script.content.trim() !== "function() { }") {
|
|
9650
9650
|
componentEntryCode += `import componentScript from "${namespace}${componentId}";
|
|
9651
9651
|
`;
|
|
9652
9652
|
} else {
|
|
@@ -11139,7 +11139,6 @@ const globalSetupValuesPromise = getSetups(globalContext);
|
|
|
11139
11139
|
constructor() {
|
|
11140
11140
|
super();
|
|
11141
11141
|
this.componentId = module.default.componentId;
|
|
11142
|
-
this.attachShadow({ mode: 'open' });
|
|
11143
11142
|
this._abortController = null;
|
|
11144
11143
|
|
|
11145
11144
|
const randomID = typeof crypto !== 'undefined' && crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).substring(2, 15);
|
|
@@ -11149,7 +11148,7 @@ const globalSetupValuesPromise = getSetups(globalContext);
|
|
|
11149
11148
|
|
|
11150
11149
|
this._styles = ''
|
|
11151
11150
|
if (module.default.styles) {
|
|
11152
|
-
this._styles += \`<style
|
|
11151
|
+
this._styles += \`<style>[data-style-selector="\${this.componentId}"] {\\n\${module.default.styles}\\n}</style>\`;
|
|
11153
11152
|
}
|
|
11154
11153
|
}
|
|
11155
11154
|
|
|
@@ -11183,7 +11182,7 @@ const globalSetupValuesPromise = getSetups(globalContext);
|
|
|
11183
11182
|
instanceId: this._instanceId,
|
|
11184
11183
|
componentId: this.componentId,
|
|
11185
11184
|
values: this._values,
|
|
11186
|
-
root: this
|
|
11185
|
+
root: this,
|
|
11187
11186
|
helpers: {},
|
|
11188
11187
|
signal: this._abortController.signal
|
|
11189
11188
|
};
|
|
@@ -11300,11 +11299,22 @@ const globalSetupValuesPromise = getSetups(globalContext);
|
|
|
11300
11299
|
_render() {
|
|
11301
11300
|
let content = this._styles;
|
|
11302
11301
|
const ast = this._replaceTokens(module.default.templateAST, module.default.templateValues);
|
|
11302
|
+
|
|
11303
|
+
if (this._styles) {
|
|
11304
|
+
for (let i = 0; i < ast.length; i++) {
|
|
11305
|
+
const node = ast[i];
|
|
11306
|
+
if (node.type === 'tag') {
|
|
11307
|
+
if (!node.attribs) node.attribs = {};
|
|
11308
|
+
node.attribs['data-style-selector'] = this.componentId;
|
|
11309
|
+
}
|
|
11310
|
+
}
|
|
11311
|
+
}
|
|
11312
|
+
|
|
11303
11313
|
content += render(ast, { decodeEntities: false });
|
|
11304
11314
|
|
|
11305
|
-
this.
|
|
11315
|
+
this.innerHTML = content;
|
|
11306
11316
|
|
|
11307
|
-
const refElements = this.
|
|
11317
|
+
const refElements = this.querySelectorAll('[ref]');
|
|
11308
11318
|
for (let i = 0; i < refElements.length; i++) {
|
|
11309
11319
|
const element = refElements[i];
|
|
11310
11320
|
const refName = element.getAttribute('ref');
|
|
@@ -11630,9 +11640,14 @@ Coralite.prototype._processDependentComponents = async function(componentIds, re
|
|
|
11630
11640
|
}
|
|
11631
11641
|
const templateAST = moduleComponent.result.template.children;
|
|
11632
11642
|
const templateValues = moduleComponent.result.values;
|
|
11633
|
-
|
|
11643
|
+
if (module.styles.length && !moduleComponent.result._processedCss) {
|
|
11644
|
+
const rawCss = module.styles.join("\n");
|
|
11645
|
+
const { rootClasses, descendantClasses } = moduleComponent.result;
|
|
11646
|
+
moduleComponent.result._processedCss = await transformCss(rawCss, rootClasses, descendantClasses, (errorData) => this._handleError(errorData));
|
|
11647
|
+
}
|
|
11648
|
+
const stylesHTML = moduleComponent.result._processedCss || "";
|
|
11634
11649
|
let scriptObj = {
|
|
11635
|
-
content: "
|
|
11650
|
+
content: "function(){}",
|
|
11636
11651
|
values: {}
|
|
11637
11652
|
};
|
|
11638
11653
|
let nestedComponents = [];
|
|
@@ -11734,9 +11749,9 @@ Coralite.prototype.createComponentElement = async function({
|
|
|
11734
11749
|
scriptResult.__script__.content = extractedScript.content;
|
|
11735
11750
|
} else {
|
|
11736
11751
|
scriptResult.__script__.lineOffset = module.lineOffset || 0;
|
|
11737
|
-
scriptResult.__script__.content = "
|
|
11752
|
+
scriptResult.__script__.content = "function(){}";
|
|
11738
11753
|
}
|
|
11739
|
-
const stylesHTML =
|
|
11754
|
+
const stylesHTML = moduleComponent.result._processedCss || "";
|
|
11740
11755
|
const templateAST = moduleComponent.result.template.children;
|
|
11741
11756
|
const templateValues = moduleComponent.result.values;
|
|
11742
11757
|
const componentTokens = {};
|