coralite 0.30.0 → 0.31.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.
|
@@ -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;;;;;;;;8BAuzCS,qBAAqB,GAAG,eAAe,GAAG,eAAe,EAAE,YAC3D,oBAAoB,KAClB,MAAM;;;;;;;;;;;;MAlyChB;IA6FH;;;OAGG;IACH,cAFa,OAAO,CAAC,IAAI,CAAC,CA0PzB;IAvPC,+BA2CE;IAWF;;OAEG;IACH;;MAA6C;IAC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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;oCA7oCN,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,13 +11148,31 @@ 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
|
|
|
11156
11155
|
connectedCallback() {
|
|
11157
11156
|
this._abortController = new AbortController();
|
|
11158
11157
|
|
|
11158
|
+
if (!this._lightDomSlotsCaptured) {
|
|
11159
|
+
this._lightDomSlotsCaptured = true;
|
|
11160
|
+
this._lightDomSlots = {};
|
|
11161
|
+
|
|
11162
|
+
// Capture light DOM children
|
|
11163
|
+
const childNodes = Array.from(this.childNodes);
|
|
11164
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
11165
|
+
const child = childNodes[i];
|
|
11166
|
+
const slotName = (child.getAttribute && child.getAttribute('slot')) || 'default';
|
|
11167
|
+
if (!this._lightDomSlots[slotName]) {
|
|
11168
|
+
this._lightDomSlots[slotName] = [];
|
|
11169
|
+
}
|
|
11170
|
+
this._lightDomSlots[slotName].push(child);
|
|
11171
|
+
}
|
|
11172
|
+
// Clear the innerHTML to detach the captured nodes so they aren't destroyed
|
|
11173
|
+
this.innerHTML = '';
|
|
11174
|
+
}
|
|
11175
|
+
|
|
11159
11176
|
// Extract attributes to values
|
|
11160
11177
|
const attributes = this.attributes;
|
|
11161
11178
|
for (let i = 0; i < attributes.length; i++) {
|
|
@@ -11183,7 +11200,7 @@ const globalSetupValuesPromise = getSetups(globalContext);
|
|
|
11183
11200
|
instanceId: this._instanceId,
|
|
11184
11201
|
componentId: this.componentId,
|
|
11185
11202
|
values: this._values,
|
|
11186
|
-
root: this
|
|
11203
|
+
root: this,
|
|
11187
11204
|
helpers: {},
|
|
11188
11205
|
signal: this._abortController.signal
|
|
11189
11206
|
};
|
|
@@ -11300,11 +11317,47 @@ const globalSetupValuesPromise = getSetups(globalContext);
|
|
|
11300
11317
|
_render() {
|
|
11301
11318
|
let content = this._styles;
|
|
11302
11319
|
const ast = this._replaceTokens(module.default.templateAST, module.default.templateValues);
|
|
11320
|
+
|
|
11321
|
+
if (this._styles) {
|
|
11322
|
+
for (let i = 0; i < ast.length; i++) {
|
|
11323
|
+
const node = ast[i];
|
|
11324
|
+
if (node.type === 'tag') {
|
|
11325
|
+
if (!node.attribs) node.attribs = {};
|
|
11326
|
+
node.attribs['data-style-selector'] = this.componentId;
|
|
11327
|
+
}
|
|
11328
|
+
}
|
|
11329
|
+
}
|
|
11330
|
+
|
|
11303
11331
|
content += render(ast, { decodeEntities: false });
|
|
11304
11332
|
|
|
11305
|
-
this.
|
|
11333
|
+
this.innerHTML = content;
|
|
11334
|
+
|
|
11335
|
+
// Handle slots projection
|
|
11336
|
+
const slots = this.querySelectorAll('slot');
|
|
11337
|
+
for (let i = 0; i < slots.length; i++) {
|
|
11338
|
+
const slot = slots[i];
|
|
11339
|
+
const slotName = slot.getAttribute('name') || 'default';
|
|
11340
|
+
const projectedNodes = this._lightDomSlots[slotName];
|
|
11306
11341
|
|
|
11307
|
-
|
|
11342
|
+
if (projectedNodes && projectedNodes.length > 0) {
|
|
11343
|
+
// We have content to project, clear the fallback content
|
|
11344
|
+
slot.innerHTML = '';
|
|
11345
|
+
// Append original nodes
|
|
11346
|
+
for (let j = 0; j < projectedNodes.length; j++) {
|
|
11347
|
+
// Re-insert original nodes to preserve their state and event listeners across re-renders
|
|
11348
|
+
slot.parentNode.insertBefore(projectedNodes[j], slot);
|
|
11349
|
+
}
|
|
11350
|
+
slot.parentNode.removeChild(slot);
|
|
11351
|
+
} else {
|
|
11352
|
+
// Use fallback content: unwrap the slot tag
|
|
11353
|
+
while (slot.firstChild) {
|
|
11354
|
+
slot.parentNode.insertBefore(slot.firstChild, slot);
|
|
11355
|
+
}
|
|
11356
|
+
slot.parentNode.removeChild(slot);
|
|
11357
|
+
}
|
|
11358
|
+
}
|
|
11359
|
+
|
|
11360
|
+
const refElements = this.querySelectorAll('[ref]');
|
|
11308
11361
|
for (let i = 0; i < refElements.length; i++) {
|
|
11309
11362
|
const element = refElements[i];
|
|
11310
11363
|
const refName = element.getAttribute('ref');
|
|
@@ -11630,9 +11683,14 @@ Coralite.prototype._processDependentComponents = async function(componentIds, re
|
|
|
11630
11683
|
}
|
|
11631
11684
|
const templateAST = moduleComponent.result.template.children;
|
|
11632
11685
|
const templateValues = moduleComponent.result.values;
|
|
11633
|
-
|
|
11686
|
+
if (module.styles.length && !moduleComponent.result._processedCss) {
|
|
11687
|
+
const rawCss = module.styles.join("\n");
|
|
11688
|
+
const { rootClasses, descendantClasses } = moduleComponent.result;
|
|
11689
|
+
moduleComponent.result._processedCss = await transformCss(rawCss, rootClasses, descendantClasses, (errorData) => this._handleError(errorData));
|
|
11690
|
+
}
|
|
11691
|
+
const stylesHTML = moduleComponent.result._processedCss || "";
|
|
11634
11692
|
let scriptObj = {
|
|
11635
|
-
content: "
|
|
11693
|
+
content: "function(){}",
|
|
11636
11694
|
values: {}
|
|
11637
11695
|
};
|
|
11638
11696
|
let nestedComponents = [];
|
|
@@ -11734,9 +11792,9 @@ Coralite.prototype.createComponentElement = async function({
|
|
|
11734
11792
|
scriptResult.__script__.content = extractedScript.content;
|
|
11735
11793
|
} else {
|
|
11736
11794
|
scriptResult.__script__.lineOffset = module.lineOffset || 0;
|
|
11737
|
-
scriptResult.__script__.content = "
|
|
11795
|
+
scriptResult.__script__.content = "function(){}";
|
|
11738
11796
|
}
|
|
11739
|
-
const stylesHTML =
|
|
11797
|
+
const stylesHTML = moduleComponent.result._processedCss || "";
|
|
11740
11798
|
const templateAST = moduleComponent.result.template.children;
|
|
11741
11799
|
const templateValues = moduleComponent.result.values;
|
|
11742
11800
|
const componentTokens = {};
|