veleta-templates 0.0.21 → 0.0.22
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/types/types/interfaces.d.ts +1 -0
- package/dist/veleta-templates/index-DwwvSqLV.js +4582 -0
- package/dist/veleta-templates/index.esm.js +1 -0
- package/dist/{esm → veleta-templates}/veleta-default-template.entry.js +64 -4
- package/dist/{esm → veleta-templates}/veleta-menu-tabs.entry.js +3 -3
- package/dist/veleta-templates/veleta-templates.css +8 -1
- package/dist/veleta-templates/veleta-templates.esm.js +47 -1
- package/package.json +1 -1
- package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -5
- package/dist/cjs/index-DuBg4oOk.js +0 -1496
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -13
- package/dist/cjs/veleta-default-template.cjs.entry.js +0 -155
- package/dist/cjs/veleta-menu-tabs.cjs.entry.js +0 -48
- package/dist/cjs/veleta-templates.cjs.js +0 -25
- package/dist/collection/collection-manifest.json +0 -14
- package/dist/collection/components/default-template/components/menu-tabs/menu-tabs.css +0 -68
- package/dist/collection/components/default-template/components/menu-tabs/menu-tabs.js +0 -110
- package/dist/collection/components/default-template/default-template.css +0 -213
- package/dist/collection/components/default-template/default-template.js +0 -183
- package/dist/collection/components.js +0 -2
- package/dist/collection/index.js +0 -1
- package/dist/collection/types/index.js +0 -1
- package/dist/collection/types/interfaces.js +0 -1
- package/dist/collection/utils/data-helpers.js +0 -7
- package/dist/collection/utils/prop-parser.js +0 -81
- package/dist/components/index.js +0 -1
- package/dist/components/p-Bn5G3Oo7.js +0 -1
- package/dist/components/veleta-default-template.js +0 -1
- package/dist/components/veleta-menu-tabs.js +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js +0 -3
- package/dist/esm/index-fw0ZKjNE.js +0 -1470
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -11
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/veleta-templates.js +0 -21
- package/dist/esm-es5/app-globals-DQuL1Twl.js +0 -1
- package/dist/esm-es5/index-fw0ZKjNE.js +0 -1
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +0 -1
- package/dist/esm-es5/veleta-default-template.entry.js +0 -1
- package/dist/esm-es5/veleta-menu-tabs.entry.js +0 -1
- package/dist/esm-es5/veleta-templates.js +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/veleta-templates/p-1ef4fdaa.system.entry.js +0 -1
- package/dist/veleta-templates/p-24ad7b94.entry.js +0 -1
- package/dist/veleta-templates/p-31ab2ac4.entry.js +0 -1
- package/dist/veleta-templates/p-8bcdfedb.system.entry.js +0 -1
- package/dist/veleta-templates/p-BPEIAwuB.system.js +0 -2
- package/dist/veleta-templates/p-BbPAtVJG.system.js +0 -1
- package/dist/veleta-templates/p-BbeGEl3Z.system.js +0 -1
- package/dist/veleta-templates/p-DQuL1Twl.js +0 -1
- package/dist/veleta-templates/p-YWpyar7R.system.js +0 -1
- package/dist/veleta-templates/p-fw0ZKjNE.js +0 -2
- package/dist/veleta-templates/veleta-templates.js +0 -127
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,9 +1,69 @@
|
|
|
1
|
-
import { r as registerInstance, h,
|
|
1
|
+
import { r as registerInstance, h, a as getElement } from './index-DwwvSqLV.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Parsea un prop que puede ser un string JSON o un array/objeto directo.
|
|
5
5
|
* Compatible con Angular/Ionic (objetos directos) y Astro/vanilla JS (strings JSON).
|
|
6
6
|
*/
|
|
7
|
+
function parseList(json) {
|
|
8
|
+
try {
|
|
9
|
+
// Si ya es un array (Angular/Ionic pasa objetos directamente), devolverlo directamente
|
|
10
|
+
if (Array.isArray(json)) {
|
|
11
|
+
return json;
|
|
12
|
+
}
|
|
13
|
+
// Si es string, parsearlo (Astro, vanilla JS, etc. pasan strings JSON)
|
|
14
|
+
if (typeof json === 'string') {
|
|
15
|
+
const cleaned = json.trim();
|
|
16
|
+
// Si está vacío o es el valor por defecto, retornar array vacío
|
|
17
|
+
if (!cleaned || cleaned === '[]' || cleaned === '{}') {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const res = JSON.parse(cleaned);
|
|
21
|
+
return Array.isArray(res) ? res : [];
|
|
22
|
+
}
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
catch (_a) {
|
|
26
|
+
// Intentar parsear sin las comillas externas si están escapadas
|
|
27
|
+
if (typeof json === 'string') {
|
|
28
|
+
try {
|
|
29
|
+
const unescaped = json.replace(/"/g, '"').replace(/'/g, "'");
|
|
30
|
+
const res = JSON.parse(unescaped);
|
|
31
|
+
return Array.isArray(res) ? res : [];
|
|
32
|
+
}
|
|
33
|
+
catch (_b) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Parsea un prop de tema que puede ser un string JSON o un objeto directo.
|
|
42
|
+
* Compatible con Angular/Ionic (objetos directos) y Astro/vanilla JS (strings JSON).
|
|
43
|
+
*/
|
|
44
|
+
function parseTheme(themeJson) {
|
|
45
|
+
try {
|
|
46
|
+
// Si ya es un objeto (Angular/Ionic pasa objetos directamente), devolverlo
|
|
47
|
+
if (typeof themeJson === 'object' && themeJson !== null && !Array.isArray(themeJson)) {
|
|
48
|
+
return themeJson;
|
|
49
|
+
}
|
|
50
|
+
// Si es string, parsearlo (Astro, vanilla JS, etc. pasan strings JSON)
|
|
51
|
+
if (typeof themeJson === 'string') {
|
|
52
|
+
const cleaned = themeJson.trim();
|
|
53
|
+
if (!cleaned || cleaned === '{}') {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const res = JSON.parse(cleaned);
|
|
57
|
+
return res && typeof res === 'object' && !Array.isArray(res)
|
|
58
|
+
? res
|
|
59
|
+
: null;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
catch (_a) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
7
67
|
/**
|
|
8
68
|
* Parsea los props de un menú (objeto directo o string JSON).
|
|
9
69
|
*/
|
|
@@ -30,7 +90,7 @@ function formatPrice(price) {
|
|
|
30
90
|
return (price % 1 === 0 ? price.toString() : price.toFixed(2)) + '€';
|
|
31
91
|
}
|
|
32
92
|
|
|
33
|
-
const defaultTemplateCss = () => `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"); .menu-tabs-container{position
|
|
93
|
+
const defaultTemplateCss = () => `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"); .menu-tabs-container{position:sticky;top:0;z-index:100;background-color:white;backdrop-filter:blur(10px);padding:0;margin-bottom:24px}.menu-tabs-scroll{display:flex;gap:12px;overflow-x:auto;padding:0 20px;scrollbar-width:none;-ms-overflow-style:none;scroll-behavior:smooth;-webkit-overflow-scrolling:touch}.menu-tabs-scroll::after{content:"";padding-right:20px}.menu-tabs-scroll::-webkit-scrollbar{display:none}.menu-tab-item{white-space:nowrap;padding:1rem;border:none;box-shadow:inset 0 -2px 0 0 transparent;background-color:transparent;color:#71717a;font-size:1rem;font-weight:500;cursor:pointer;transition:color 0.3s ease, box-shadow 0.3s ease;font-family:inherit;flex-shrink:0;outline:none}.menu-tab-item:hover{color:#18181b}.menu-tab-item.active{color:#18181b;box-shadow:inset 0 -2px 0 0 #18181b}.menu-tabs-container::after{content:"";position:absolute;right:0;top:0;bottom:0;width:40px;background:linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8));pointer-events:none;opacity:0;}.menu-wrapper{font-family:"Poppins", sans-serif;max-width:800px;margin:0 auto;padding:20px 0;background-color:#ffffff;min-height:100vh}.menu-header{text-align:center;margin-bottom:24px;padding:0 20px;}.business-name{font-size:2.5rem;font-weight:700;margin-bottom:8px;letter-spacing:-0.02em}.business-description{font-size:1.1rem;color:#71717a;margin:0 auto;padding-left:1px;padding-right:1px;line-height:1.5rem}.menu-section{margin-bottom:48px}.section-title{font-size:1.3rem;font-weight:600;padding-bottom:8px;margin-bottom:1rem}.section-description{font-size:1rem;color:#71717a;margin-bottom:20px;margin-top:-16px;line-height:1.25rem}.dishes-list{display:flex;flex-direction:column;gap:16px}.dish-item{padding:1rem 0.2rem;border-bottom:1px solid #e4e4e7;transition:all 0.2s ease}.dish-item:hover{border-color:#e4e4e7}.dish-header{display:flex;justify-content:space-between;align-items:baseline;gap:12px}.dish-name{font-weight:500;font-size:1rem;color:#18181b}.dish-price{font-weight:400;font-size:0.9rem;color:#18181b}.dish-details{max-height:1.35rem;overflow:hidden;margin-top:4px;opacity:1;transition:max-height 0.6s cubic-bezier(0.25, 1, 0.5, 1)}.dish-item.expanded .dish-details{max-height:400px;margin-top:4px}.dish-description{font-size:0.9rem;color:#71717a;line-height:1.5;margin:0;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical}.dish-item.expanded .dish-description{-webkit-line-clamp:10}.menu-content{padding:0.1rem 20px}.menu-footer{margin-top:80px;text-align:center;padding:0 20px}.social-link{display:inline-block;padding:12px 24px;border-radius:99px;color:white;text-decoration:none;font-weight:500;transition:opacity 0.2s}.social-link:hover{opacity:0.9}.menu-loading{display:flex;justify-content:center;align-items:center;height:200px;color:#71717a}`;
|
|
34
94
|
|
|
35
95
|
const DefaultTemplate = class {
|
|
36
96
|
constructor(hostRef) {
|
|
@@ -137,11 +197,11 @@ const DefaultTemplate = class {
|
|
|
137
197
|
if (!menuData) {
|
|
138
198
|
return h("div", { class: "menu-loading" }, "Loading...");
|
|
139
199
|
}
|
|
140
|
-
const {
|
|
200
|
+
const { sections, templateData, menu } = menuData;
|
|
141
201
|
const theme = templateData === null || templateData === void 0 ? void 0 : templateData.theme;
|
|
142
202
|
const primaryColor = (theme === null || theme === void 0 ? void 0 : theme.primaryColor) || '#18181b';
|
|
143
203
|
const sortedSections = [...(sections || [])].sort((a, b) => a.order - b.order);
|
|
144
|
-
return (h("div", { class: "menu-wrapper" }, h("header", { class: "menu-header" }, (
|
|
204
|
+
return (h("div", { class: "menu-wrapper" }, h("header", { class: "menu-header" }, (menu === null || menu === void 0 ? void 0 : menu.name) && h("h1", { class: "business-name" }, menu.name), (menu === null || menu === void 0 ? void 0 : menu.description) && (h("p", { class: "business-description" }, menu.description))), h("veleta-menu-tabs", { sections: sortedSections.map((s) => ({ id: s.id, title: s.title })), activeSectionId: this.activeSectionId || ((_a = sortedSections[0]) === null || _a === void 0 ? void 0 : _a.id), onTabClick: (ev) => this.handleTabClick(ev.detail) }), h("main", { class: "menu-content" }, sortedSections.map((section) => {
|
|
145
205
|
var _a;
|
|
146
206
|
return (h("section", { key: section.id, id: `section-${section.id}`, class: "menu-section" }, h("h2", { class: "section-title", style: { borderColor: primaryColor } }, section.title), section.description && (h("p", { class: "section-description" }, section.description)), h("div", { class: "dishes-list" }, (_a = section.dishes) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.order - b.order).map((dish) => (h("div", { key: dish.id, class: `dish-item ${this.expandedDishes[dish.id] ? 'expanded' : ''}`, onClick: () => this.toggleDish(dish.id) }, h("div", { class: "dish-header" }, h("span", { class: "dish-name" }, dish.name), h("span", { class: "dish-price" }, formatPrice(dish.price))), dish.description && (h("div", { class: "dish-details" }, h("p", { class: "dish-description" }, dish.description)))))))));
|
|
147
207
|
}))));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
1
|
+
import { r as registerInstance, d as createEvent, h, a as getElement } from './index-DwwvSqLV.js';
|
|
2
2
|
|
|
3
|
-
const menuTabsCss = () => `.menu-tabs-container{position
|
|
3
|
+
const menuTabsCss = () => `.menu-tabs-container{position:sticky;top:0;z-index:100;background-color:white;backdrop-filter:blur(10px);padding:0;margin-bottom:24px}.menu-tabs-scroll{display:flex;gap:12px;overflow-x:auto;padding:0 20px;scrollbar-width:none;-ms-overflow-style:none;scroll-behavior:smooth;-webkit-overflow-scrolling:touch}.menu-tabs-scroll::after{content:"";padding-right:20px}.menu-tabs-scroll::-webkit-scrollbar{display:none}.menu-tab-item{white-space:nowrap;padding:1rem;border:none;box-shadow:inset 0 -2px 0 0 transparent;background-color:transparent;color:#71717a;font-size:1rem;font-weight:500;cursor:pointer;transition:color 0.3s ease, box-shadow 0.3s ease;font-family:inherit;flex-shrink:0;outline:none}.menu-tab-item:hover{color:#18181b}.menu-tab-item.active{color:#18181b;box-shadow:inset 0 -2px 0 0 #18181b}.menu-tabs-container::after{content:"";position:absolute;right:0;top:0;bottom:0;width:40px;background:linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8));pointer-events:none;opacity:0;}`;
|
|
4
4
|
|
|
5
5
|
const MenuTabs = class {
|
|
6
6
|
constructor(hostRef) {
|
|
7
7
|
registerInstance(this, hostRef);
|
|
8
|
-
this.tabClick = createEvent(this, "tabClick");
|
|
8
|
+
this.tabClick = createEvent(this, "tabClick", 7);
|
|
9
9
|
this.sections = [];
|
|
10
10
|
this.activeSectionId = '';
|
|
11
11
|
}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
2
|
+
:root {
|
|
3
|
+
font-family: "Poppins", sans-serif;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
body {
|
|
7
|
+
font-family: "Poppins", sans-serif;
|
|
8
|
+
}
|
|
@@ -1 +1,47 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { B as BUILD, c as consoleDevInfo, H, w as win, N as NAMESPACE, p as promiseResolve, g as globalScripts, b as bootstrapLazy } from './index-DwwvSqLV.js';
|
|
2
|
+
export { s as setNonce } from './index-DwwvSqLV.js';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Stencil Client Patch Browser v4.43.3 | MIT Licensed | https://stenciljs.com
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var patchBrowser = () => {
|
|
9
|
+
if (BUILD.isDev && !BUILD.isTesting) {
|
|
10
|
+
consoleDevInfo("Running in development mode.");
|
|
11
|
+
}
|
|
12
|
+
if (BUILD.cloneNodeFix) {
|
|
13
|
+
patchCloneNodeFix(H.prototype);
|
|
14
|
+
}
|
|
15
|
+
const scriptElm = BUILD.scriptDataOpts ? win.document && Array.from(win.document.querySelectorAll("script")).find(
|
|
16
|
+
(s) => new RegExp(`/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute("data-stencil-namespace") === NAMESPACE
|
|
17
|
+
) : null;
|
|
18
|
+
const importMeta = import.meta.url;
|
|
19
|
+
const opts = BUILD.scriptDataOpts ? (scriptElm || {})["data-opts"] || {} : {};
|
|
20
|
+
if (importMeta !== "") {
|
|
21
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
22
|
+
}
|
|
23
|
+
return promiseResolve(opts);
|
|
24
|
+
};
|
|
25
|
+
var patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
26
|
+
const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
|
|
27
|
+
HTMLElementPrototype.cloneNode = function(deep) {
|
|
28
|
+
if (this.nodeName === "TEMPLATE") {
|
|
29
|
+
return nativeCloneNodeFn.call(this, deep);
|
|
30
|
+
}
|
|
31
|
+
const clonedNode = nativeCloneNodeFn.call(this, false);
|
|
32
|
+
const srcChildNodes = this.childNodes;
|
|
33
|
+
if (deep) {
|
|
34
|
+
for (let i = 0; i < srcChildNodes.length; i++) {
|
|
35
|
+
if (srcChildNodes[i].nodeType !== 2) {
|
|
36
|
+
clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return clonedNode;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
patchBrowser().then(async (options) => {
|
|
45
|
+
await globalScripts();
|
|
46
|
+
return bootstrapLazy([["veleta-menu-tabs",[[0,"veleta-menu-tabs",{"sections":[16],"activeSectionId":[1,"active-section-id"]},null,{"activeSectionId":[{"handleActiveSectionChange":0}]}]]],["veleta-default-template",[[0,"veleta-default-template",{"data":[16],"dataJson":[1,"data-json"],"expandedDishes":[32],"activeSectionId":[32]}]]]], options);
|
|
47
|
+
});
|
package/package.json
CHANGED