coralite 0.31.3 → 0.31.4
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/dist/lib/coralite.d.ts.map +1 -1
- package/dist/lib/index.js +157 -32
- package/dist/lib/index.js.map +2 -2
- package/dist/lib/parse.d.ts.map +1 -1
- package/dist/lib/script-manager.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +22 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/plugins/define-component.d.ts.map +1 -1
- package/dist/plugins/define-component.js +11 -7
- package/dist/plugins/metadata.d.ts.map +1 -1
- package/dist/plugins/metadata.js +7 -1
- package/package.json +1 -1
|
@@ -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;IACp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qCAAnB,mBAAmB;0CAIL,gBAAgB;+BAvBxB,iBAAiB;oCAmBvB,mBAAmB;uCAAnB,mBAAmB;0CAAnB,mBAAmB;qCAAnB,mBAAmB;oCAAnB,mBAAmB"}
|
package/dist/lib/index.js
CHANGED
|
@@ -6447,6 +6447,39 @@ function cleanKeys(object) {
|
|
|
6447
6447
|
}
|
|
6448
6448
|
return result;
|
|
6449
6449
|
}
|
|
6450
|
+
function normalizeObjectFunctions(target) {
|
|
6451
|
+
if (Array.isArray(target)) {
|
|
6452
|
+
target.forEach(normalizeObjectFunctions);
|
|
6453
|
+
} else if (typeof target === "object" && target !== null) {
|
|
6454
|
+
for (const key in target) {
|
|
6455
|
+
if (typeof target[key] === "function") {
|
|
6456
|
+
if (target[key].__normalized) continue;
|
|
6457
|
+
const normalizedString = normalizeFunction(target[key]);
|
|
6458
|
+
const originalFunction = target[key];
|
|
6459
|
+
target[key] = function() {
|
|
6460
|
+
return originalFunction.apply(this, arguments);
|
|
6461
|
+
};
|
|
6462
|
+
target[key].toString = () => normalizedString;
|
|
6463
|
+
target[key].__normalized = true;
|
|
6464
|
+
} else {
|
|
6465
|
+
normalizeObjectFunctions(target[key]);
|
|
6466
|
+
}
|
|
6467
|
+
}
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
function hasObjectKeys(obj) {
|
|
6471
|
+
return obj && typeof obj === "object" && Object.keys(obj).length > 0;
|
|
6472
|
+
}
|
|
6473
|
+
function mergeUniqueObjects(arr1, arr2) {
|
|
6474
|
+
const all = [...arr1 || [], ...arr2 || []];
|
|
6475
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6476
|
+
return all.filter((item) => {
|
|
6477
|
+
const key = typeof item === "object" ? JSON.stringify(item) : item;
|
|
6478
|
+
if (seen.has(key)) return false;
|
|
6479
|
+
seen.add(key);
|
|
6480
|
+
return true;
|
|
6481
|
+
});
|
|
6482
|
+
}
|
|
6450
6483
|
function normalizeFunction(func) {
|
|
6451
6484
|
const original = func.toString().trim();
|
|
6452
6485
|
const firstBrace = original.indexOf("{");
|
|
@@ -9211,10 +9244,11 @@ function createElement({
|
|
|
9211
9244
|
if (!VALID_TAGS[sanitisedName]) {
|
|
9212
9245
|
const specUrl = "https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name";
|
|
9213
9246
|
try {
|
|
9214
|
-
|
|
9247
|
+
element.name = name;
|
|
9248
|
+
if (isValidCustomElementName(name)) {
|
|
9215
9249
|
element.slots = [];
|
|
9216
9250
|
} else {
|
|
9217
|
-
const message = 'Invalid custom element tag name: "' +
|
|
9251
|
+
const message = 'Invalid custom element tag name: "' + name + '" (' + specUrl + ")";
|
|
9218
9252
|
if (typeof onError === "function") {
|
|
9219
9253
|
onError({
|
|
9220
9254
|
level: "WARN",
|
|
@@ -9462,19 +9496,68 @@ ScriptManager.prototype.getHelpers = function() {
|
|
|
9462
9496
|
}
|
|
9463
9497
|
return `{${helpers}}`;
|
|
9464
9498
|
};
|
|
9465
|
-
ScriptManager.prototype.registerComponent = function({
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9499
|
+
ScriptManager.prototype.registerComponent = function({
|
|
9500
|
+
id,
|
|
9501
|
+
script = {},
|
|
9502
|
+
filePath,
|
|
9503
|
+
templateAST = null,
|
|
9504
|
+
templateValues = null,
|
|
9505
|
+
defaultValues = {},
|
|
9506
|
+
styles = "",
|
|
9507
|
+
slots = {}
|
|
9508
|
+
}) {
|
|
9509
|
+
if (!this.sharedFunctions[id]) {
|
|
9510
|
+
this.sharedFunctions[id] = {
|
|
9511
|
+
id,
|
|
9512
|
+
imports: [],
|
|
9513
|
+
components: [],
|
|
9514
|
+
filePath: `/component-${id}.js`
|
|
9515
|
+
};
|
|
9516
|
+
}
|
|
9517
|
+
const target = this.sharedFunctions[id];
|
|
9518
|
+
if (hasObjectKeys(script)) {
|
|
9519
|
+
target.script = script;
|
|
9520
|
+
}
|
|
9521
|
+
if (templateAST) {
|
|
9522
|
+
target.templateAST = templateAST;
|
|
9523
|
+
}
|
|
9524
|
+
if (templateValues) {
|
|
9525
|
+
target.templateValues = templateValues;
|
|
9526
|
+
}
|
|
9527
|
+
if (styles) {
|
|
9528
|
+
target.styles = styles;
|
|
9529
|
+
}
|
|
9530
|
+
if (filePath) {
|
|
9531
|
+
target.filePath = resolve(filePath);
|
|
9532
|
+
}
|
|
9533
|
+
if (hasObjectKeys(defaultValues)) {
|
|
9534
|
+
if (target.defaultValues) {
|
|
9535
|
+
target.defaultValues = {
|
|
9536
|
+
...target.defaultValues,
|
|
9537
|
+
...defaultValues
|
|
9538
|
+
};
|
|
9539
|
+
} else {
|
|
9540
|
+
target.defaultValues = defaultValues;
|
|
9541
|
+
}
|
|
9542
|
+
}
|
|
9543
|
+
if (hasObjectKeys(slots)) {
|
|
9544
|
+
if (target.slots) {
|
|
9545
|
+
target.slots = {
|
|
9546
|
+
...target.slots,
|
|
9547
|
+
...slots
|
|
9548
|
+
};
|
|
9549
|
+
} else {
|
|
9550
|
+
target.slots = slots;
|
|
9551
|
+
}
|
|
9552
|
+
}
|
|
9553
|
+
if (script) {
|
|
9554
|
+
if (script.imports?.length) {
|
|
9555
|
+
target.imports = mergeUniqueObjects(target.imports, script.imports);
|
|
9556
|
+
}
|
|
9557
|
+
if (script.components?.length) {
|
|
9558
|
+
target.components = mergeUniqueObjects(target.components, script.components);
|
|
9559
|
+
}
|
|
9560
|
+
}
|
|
9478
9561
|
};
|
|
9479
9562
|
ScriptManager.prototype.generateInstanceWrapper = function(id, instanceContext) {
|
|
9480
9563
|
const values = instanceContext.values ? serialize(instanceContext.values) : "{}";
|
|
@@ -9608,6 +9691,7 @@ ScriptManager.prototype.compileAllInstances = async function(instances, mode) {
|
|
|
9608
9691
|
entryCodeParts.push("const coraliteComponentDefaults = {\n");
|
|
9609
9692
|
for (const key of processedComponentKeys) {
|
|
9610
9693
|
if (this.sharedFunctions[key] && this.sharedFunctions[key].defaultValues) {
|
|
9694
|
+
normalizeObjectFunctions(this.sharedFunctions[key].defaultValues);
|
|
9611
9695
|
entryCodeParts.push(` "${key}": (() => {
|
|
9612
9696
|
`);
|
|
9613
9697
|
entryCodeParts.push(` const defaults = ${serialize(this.sharedFunctions[key].defaultValues)};
|
|
@@ -9708,6 +9792,9 @@ ScriptManager.prototype.compileAllInstances = async function(instances, mode) {
|
|
|
9708
9792
|
refs: []
|
|
9709
9793
|
});
|
|
9710
9794
|
const styles = JSON.stringify(this.sharedFunctions[componentId].styles || "");
|
|
9795
|
+
if (this.sharedFunctions[componentId].defaultValues) {
|
|
9796
|
+
normalizeObjectFunctions(this.sharedFunctions[componentId].defaultValues);
|
|
9797
|
+
}
|
|
9711
9798
|
const defaults = serialize(this.sharedFunctions[componentId].defaultValues || {});
|
|
9712
9799
|
const dependencies = JSON.stringify(this.sharedFunctions[componentId].components || []);
|
|
9713
9800
|
const slots = serialize(this.sharedFunctions[componentId].slots || {});
|
|
@@ -10139,12 +10226,14 @@ var defineComponent = createPlugin({
|
|
|
10139
10226
|
const computedSlot = slots[name];
|
|
10140
10227
|
const slotContent = [];
|
|
10141
10228
|
const elementSlots = [];
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10229
|
+
if (element && element.slots) {
|
|
10230
|
+
for (let i = 0; i < element.slots.length; i++) {
|
|
10231
|
+
const slot = element.slots[i];
|
|
10232
|
+
if (slot.name === name) {
|
|
10233
|
+
slotContent.push(slot.node);
|
|
10234
|
+
} else {
|
|
10235
|
+
elementSlots.push(slot);
|
|
10236
|
+
}
|
|
10148
10237
|
}
|
|
10149
10238
|
}
|
|
10150
10239
|
const result = computedSlot(slotContent, results) || slotContent;
|
|
@@ -10183,7 +10272,9 @@ var defineComponent = createPlugin({
|
|
|
10183
10272
|
}
|
|
10184
10273
|
}
|
|
10185
10274
|
}
|
|
10186
|
-
element
|
|
10275
|
+
if (element) {
|
|
10276
|
+
element.slots = elementSlots;
|
|
10277
|
+
}
|
|
10187
10278
|
}
|
|
10188
10279
|
}
|
|
10189
10280
|
}
|
|
@@ -10270,7 +10361,13 @@ var metadataPlugin = createPlugin({
|
|
|
10270
10361
|
id: element.name,
|
|
10271
10362
|
values,
|
|
10272
10363
|
element,
|
|
10273
|
-
component:
|
|
10364
|
+
component: (
|
|
10365
|
+
/** @type {any} */
|
|
10366
|
+
{
|
|
10367
|
+
...elements,
|
|
10368
|
+
path: data2.path
|
|
10369
|
+
}
|
|
10370
|
+
),
|
|
10274
10371
|
contextId: data2.path.pathname + i3 + element.name,
|
|
10275
10372
|
index: i3
|
|
10276
10373
|
});
|
|
@@ -11200,6 +11297,13 @@ const globalSetupValuesPromise = getSetups(globalContext);
|
|
|
11200
11297
|
// Merge defaults
|
|
11201
11298
|
this._values = Object.assign({}, module.default.defaultValues, this._values);
|
|
11202
11299
|
|
|
11300
|
+
if (module.default.templateValues && module.default.templateValues.refs) {
|
|
11301
|
+
for (let i = 0; i < module.default.templateValues.refs.length; i++) {
|
|
11302
|
+
const ref = module.default.templateValues.refs[i];
|
|
11303
|
+
this._values['ref_' + ref.name] = this.componentId + '__' + ref.name + '-' + this._index;
|
|
11304
|
+
}
|
|
11305
|
+
}
|
|
11306
|
+
|
|
11203
11307
|
;(async () => {
|
|
11204
11308
|
const deps = module.default.dependencies || [];
|
|
11205
11309
|
if (deps.length > 0) {
|
|
@@ -11732,6 +11836,7 @@ Coralite.prototype._processDependentComponents = async function(componentIds, re
|
|
|
11732
11836
|
};
|
|
11733
11837
|
let nestedComponents = [];
|
|
11734
11838
|
let defaultValues = {};
|
|
11839
|
+
let slots = {};
|
|
11735
11840
|
if (scriptResult.__script__) {
|
|
11736
11841
|
const extractedScript = findAndExtractScript(module.script);
|
|
11737
11842
|
if (extractedScript) {
|
|
@@ -11744,6 +11849,7 @@ Coralite.prototype._processDependentComponents = async function(componentIds, re
|
|
|
11744
11849
|
nestedComponents = Array.from(/* @__PURE__ */ new Set([...scriptComponents, ...declarativeComponents]));
|
|
11745
11850
|
scriptObj.components = nestedComponents;
|
|
11746
11851
|
defaultValues = scriptResult.__script__.defaultValues || {};
|
|
11852
|
+
slots = scriptResult.__script__.slots || {};
|
|
11747
11853
|
delete scriptResult.__script__;
|
|
11748
11854
|
} else {
|
|
11749
11855
|
const declarativeComponents = (module.customElements || []).map((el) => el.name);
|
|
@@ -11768,6 +11874,22 @@ Coralite.prototype._processDependentComponents = async function(componentIds, re
|
|
|
11768
11874
|
defaultValues[token] = scriptResult[token];
|
|
11769
11875
|
}
|
|
11770
11876
|
}
|
|
11877
|
+
if (templateValues && templateValues.refs) {
|
|
11878
|
+
for (let i = 0; i < templateValues.refs.length; i++) {
|
|
11879
|
+
const ref2 = templateValues.refs[i];
|
|
11880
|
+
defaultValues[`ref_${ref2.name}`] = "";
|
|
11881
|
+
if (!scriptObj.values) {
|
|
11882
|
+
scriptObj.values = {};
|
|
11883
|
+
}
|
|
11884
|
+
scriptObj.values[`ref_${ref2.name}`] = "";
|
|
11885
|
+
}
|
|
11886
|
+
}
|
|
11887
|
+
if (!scriptResult.__script__) {
|
|
11888
|
+
scriptResult.__script__ = { defaultValues };
|
|
11889
|
+
} else {
|
|
11890
|
+
scriptResult.__script__.defaultValues = defaultValues;
|
|
11891
|
+
}
|
|
11892
|
+
scriptObj.defaultValues = defaultValues;
|
|
11771
11893
|
this._scriptManager.registerComponent({
|
|
11772
11894
|
id: module.id,
|
|
11773
11895
|
script: scriptObj,
|
|
@@ -11776,7 +11898,7 @@ Coralite.prototype._processDependentComponents = async function(componentIds, re
|
|
|
11776
11898
|
templateValues,
|
|
11777
11899
|
defaultValues,
|
|
11778
11900
|
styles: stylesHTML,
|
|
11779
|
-
slots
|
|
11901
|
+
slots
|
|
11780
11902
|
});
|
|
11781
11903
|
if (nestedComponents.length > 0) {
|
|
11782
11904
|
await this._processDependentComponents(nestedComponents, renderContext, parentComponent);
|
|
@@ -11995,23 +12117,23 @@ Coralite.prototype.createComponentElement = async function({
|
|
|
11995
12117
|
contextId: childContextId,
|
|
11996
12118
|
index,
|
|
11997
12119
|
renderContext
|
|
11998
|
-
}, false).then((
|
|
11999
|
-
|
|
12120
|
+
}, false).then((childComponentElement) => ({
|
|
12121
|
+
childComponentElement,
|
|
12000
12122
|
customElement
|
|
12001
12123
|
}))
|
|
12002
12124
|
);
|
|
12003
12125
|
}
|
|
12004
12126
|
const results = await Promise.all(createComponentTasks);
|
|
12005
12127
|
for (let i = 0; i < results.length; i++) {
|
|
12006
|
-
const {
|
|
12128
|
+
const { childComponentElement, customElement } = results[i];
|
|
12007
12129
|
const children = customElement.parent.children;
|
|
12008
12130
|
if (!childIndex) {
|
|
12009
12131
|
childIndex = customElement.parentChildIndex;
|
|
12010
12132
|
} else {
|
|
12011
12133
|
childIndex = children.indexOf(customElement, customElement.parentChildIndex);
|
|
12012
12134
|
}
|
|
12013
|
-
if (
|
|
12014
|
-
children.splice(childIndex, 1, ...
|
|
12135
|
+
if (childComponentElement && typeof childComponentElement === "object") {
|
|
12136
|
+
children.splice(childIndex, 1, ...childComponentElement.children);
|
|
12015
12137
|
}
|
|
12016
12138
|
}
|
|
12017
12139
|
const slots = module.slotElements[id];
|
|
@@ -12050,8 +12172,8 @@ Coralite.prototype.createComponentElement = async function({
|
|
|
12050
12172
|
for (let i2 = startIndex; i2 > -1; i2--) {
|
|
12051
12173
|
const node = slotNodes[i2];
|
|
12052
12174
|
if (node.name) {
|
|
12053
|
-
const
|
|
12054
|
-
if (
|
|
12175
|
+
const slotComponentItem = this.components.getItem(node.name);
|
|
12176
|
+
if (slotComponentItem) {
|
|
12055
12177
|
const slotContextId = contextId + slotName + i2 + node.name;
|
|
12056
12178
|
const currentValues = renderContext.values[slotContextId] || {};
|
|
12057
12179
|
const attribValues = cleanKeys(node.attribs);
|
|
@@ -12068,7 +12190,7 @@ Coralite.prototype.createComponentElement = async function({
|
|
|
12068
12190
|
id: node.name,
|
|
12069
12191
|
values: renderContext.values[slotContextId],
|
|
12070
12192
|
element: node,
|
|
12071
|
-
component
|
|
12193
|
+
component,
|
|
12072
12194
|
contextId: slotContextId,
|
|
12073
12195
|
index,
|
|
12074
12196
|
renderContext
|
|
@@ -12363,6 +12485,7 @@ export {
|
|
|
12363
12485
|
getHtmlFile,
|
|
12364
12486
|
getHtmlFileSync,
|
|
12365
12487
|
getHtmlFiles,
|
|
12488
|
+
hasObjectKeys,
|
|
12366
12489
|
hasValidCommentStructure,
|
|
12367
12490
|
hasValidElementStructure,
|
|
12368
12491
|
hasValidTextNodeStructure,
|
|
@@ -12378,8 +12501,10 @@ export {
|
|
|
12378
12501
|
isRemovableNode,
|
|
12379
12502
|
isValidChildNode,
|
|
12380
12503
|
kebabToCamel,
|
|
12504
|
+
mergeUniqueObjects,
|
|
12381
12505
|
metadataPlugin,
|
|
12382
12506
|
normalizeFunction,
|
|
12507
|
+
normalizeObjectFunctions,
|
|
12383
12508
|
parseHTML,
|
|
12384
12509
|
parseModule,
|
|
12385
12510
|
refsPlugin,
|