@woodylab/payload 0.0.123 → 0.0.126

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,5 +1,5 @@
1
1
  // uims/resolveInlineComponent.ts
2
- import { componentRegistry } from '../react';
2
+ import { componentRegistry } from '../../react';
3
3
  export function resolveInlineComponent(block) {
4
4
  const { definition, viewMode } = block;
5
5
  if (!definition)
@@ -1,5 +1,5 @@
1
1
  // uims/resolveViewRow.ts
2
- import { componentRegistry } from '../react';
2
+ import { componentRegistry } from '../../react';
3
3
  export function resolveViewRow({ item, rowComponent, rowViewMode, rowPropsMapping }) {
4
4
  const Row = componentRegistry[rowComponent.componentName];
5
5
  console.log(rowComponent);
package/dist/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./config/index.cjs.js"),o=require("./utils/index.cjs.js");require("./userRoles-BqQg1D6Q.js"),exports.ComponentInstance=e.ComponentInstance,exports.blockView=e.blockView,exports.collectionComponentDefinitions=e.collectionComponentDefinitions,exports.collectionMenus=e.collectionMenus,exports.collectionViewModes=e.collectionViewModes,exports.concatCssFields=e.concatCssFields,exports.configFooter=e.configFooter,exports.configHeader=e.configHeader,exports.configSettings=e.configSettings,exports.fieldCss=e.fieldCss,exports.tailwindField=e.tailwindField,exports.tailwindFieldsSelectors=e.tailwindFieldsSelectors,exports.generateCssVars=o.generateCssVars,exports.iconsList=o.iconsList;
1
+ "use strict";var e=require("./config/index.cjs.js"),o=require("./utils/index.cjs.js");require("./userRoles-BqQg1D6Q.js"),exports.ComponentInstance=e.ComponentInstance,exports.blockView=e.blockView,exports.collectionComponentDefinitions=e.collectionComponentDefinitions,exports.collectionMenus=e.collectionMenus,exports.collectionViewModes=e.collectionViewModes,exports.concatCssFields=e.concatCssFields,exports.configFooter=e.configFooter,exports.configHeader=e.configHeader,exports.configSettings=e.configSettings,exports.fieldCss=e.fieldCss,exports.tailwindField=e.tailwindField,exports.tailwindFieldsSelectors=e.tailwindFieldsSelectors,exports.generateCssVars=o.generateCssVars,exports.iconsList=o.iconsList,exports.resolveViewData=o.resolveViewData;
2
2
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- export{ComponentInstance,blockView,collectionComponentDefinitions,collectionMenus,collectionViewModes,concatCssFields,configFooter,configHeader,configSettings,fieldCss,tailwindField,tailwindFieldsSelectors}from"./config/index.esm.js";export{generateCssVars,iconsList}from"./utils/index.esm.js";import"./userRoles-CL8SQUFs.js";
1
+ export{ComponentInstance,blockView,collectionComponentDefinitions,collectionMenus,collectionViewModes,concatCssFields,configFooter,configHeader,configSettings,fieldCss,tailwindField,tailwindFieldsSelectors}from"./config/index.esm.js";export{generateCssVars,iconsList,resolveViewData}from"./utils/index.esm.js";import"./userRoles-CL8SQUFs.js";
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  // #TODO Gestire doppio caricamento dati:
3
3
  // 1 lato payload usando come già fatto api interne di payload mappando i campi in un blocco di tipo view dedicato
4
- import { resolveInlineComponent } from '../utils/resolveInlineComponent';
4
+ import { resolveInlineComponent } from '../config/utils/resolveInlineComponent';
5
5
  import { ViewBlock } from './ViewBlock';
6
6
  // 2 recupero dati sempre lato server chiamando un EP in maniera asincrona e gestendo il corretto binding
7
7
  export async function PageRenderer({ layout, serverData, }) {
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("react/jsx-runtime");const o=({children:o})=>e.jsx("div",{children:o??"Card works"}),r={Card:o};function n(e){return Array.isArray(e)&&e.length>0?e.map(e=>e?.css.className).filter(Boolean).join(" "):e?.css.className??""}function t(o){const{component:t,viewMode:s,rowComponent:c,rowViewMode:i,containerProps:a={},rowPropsMapping:l={},rowChildren:p=[],_resolvedData:m=[],_resolvedOk:d=!0}=o,u=r[t.componentName],w=r[c.componentName];if(!u||!w)return null;if(!d)return e.jsx(u,{className:n(s),children:e.jsx("div",{className:"text-red-600",children:"Impossibile caricare i dati"})});const f=(o,t)=>o.map((o,s)=>{const c=r[o.definition?.componentName];if(!c)return null;const i=Array.isArray(o.viewMode)?o.viewMode[0]:o.viewMode;let a={};if(o.sourceProps&&"object"==typeof o.sourceProps&&Object.keys(o.sourceProps).length>0)for(const[e,r]of Object.entries(o.sourceProps))a[e]=r.toString().split(".").reduce((e,o)=>e?.[o],t);else a=o.staticProps||{};return e.jsx(c,{...a,className:n(i)},s)});return e.jsx(u,{className:n(s),...a,children:m.map((o,r)=>{const t={};for(const[e,r]of Object.entries(l))t[e]=r.toString().split(".").reduce((e,o)=>e?.[o],o);return e.jsx(w,{...t,className:n(i),children:p?.length>0?f(p,o):null},r)})})}function s(e,o){return o.split(".").reduce((e,o)=>e?.[o],e)}exports.Card=o,exports.ComponentRenderer=function({type:o,view:n,data:t}){if("view"!==o)return null;const c=t[n.dataSet],i=r[n.component.componentName],a=r[n.rowComponent.componentName];if(!i||!a)return null;const l=Array.isArray(n.viewMode)?n.viewMode.map(e=>e?.className||"").join(" "):"";return e.jsx(i,{className:l,children:c.map((o,r)=>{const t={};for(const[e,r]of Object.entries(n.rowPropsMapping??{}))t[e]=s(o,r);const c=Array.isArray(n.rowViewMode)?n.rowViewMode.map(e=>e?.className||"").join(" "):"";return e.jsx(a,{...t,className:c},r)})})},exports.PageRenderer=async function({layout:o,serverData:n}){const s=o.map((e,o)=>"view"!==e.blockType?e:(console.log(e),console.log(n),{blockType:e.blockType,component:e.component,viewMode:e.viewMode,containerProps:e.containerProps,rowComponent:e.rowComponent,rowViewMode:e.rowViewMode,rowPropsMapping:e.rowPropsMapping,rowChildren:e.rowChildren,_resolvedData:n[o]??[],_resolvedOk:!0}));return e.jsx(e.Fragment,{children:s.map((o,n)=>{if("view"===o.blockType)return e.jsx(t,{...o},n);const s=function(e){const{definition:o,viewMode:n}=e;if(!o)return null;const t=r[o.componentName];return t?"cta-block"===e.blockType?{Component:t,props:{title:e.title,description:e.description,action:e.actionLabel?{label:e.actionLabel,href:e.actionHref}:void 0,className:n?.css.className??o.defaultStyle}}:{Component:t,props:{...e.props??{},className:n?.css.className??o.defaultStyle}}:null}(o);if(!s)return null;const{Component:c,props:i}=s;return e.jsx(c,{...i},n)})})},exports.ViewBlock=t,exports.componentRegistry=r;
2
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../../src/react/Card.tsx","../../src/react/registry.ts","../../src/react/ViewBlock.tsx","../../src/react/ComponentRenderer.tsx","../../src/react/PageRenderer.tsx","../../src/config/utils/resolveInlineComponent.ts"],"sourcesContent":["import type { ReactNode } from 'react'\n\ntype CardProps = {\n children?: ReactNode\n}\n\nexport const Card = ({ children }: CardProps) => {\n return <div>{children ?? 'Card works'}</div>\n}\n","// components/registry.ts\nimport { Card } from './Card'\n\nexport const componentRegistry: Record<string, any> = {\n Card,\n}\n","'use client'\n\nimport { componentRegistry } from './registry'\n\nfunction resolveClassName(viewMode: any[] | any | undefined) {\n if (Array.isArray(viewMode) && viewMode.length > 0) {\n return viewMode\n .map((vm) => vm?.css.className)\n .filter(Boolean)\n .join(' ')\n }\n return viewMode?.css.className ?? ''\n}\n\nexport function ViewBlock(block: any) {\n const {\n component,\n viewMode,\n rowComponent,\n rowViewMode,\n containerProps = {},\n rowPropsMapping = {},\n rowChildren = [],\n _resolvedData = [],\n _resolvedOk = true,\n } = block\n const Container = componentRegistry[component.componentName]\n const Row = componentRegistry[rowComponent.componentName]\n if (!Container || !Row) return null\n\n if (!_resolvedOk) {\n return (\n <Container className={resolveClassName(viewMode)}>\n <div className=\"text-red-600\">Impossibile caricare i dati</div>\n </Container>\n )\n }\n\n //#TODO gestire rendering di molteplici rowChildren al mometno stampa solo il primo elemento dell'array\n // --- helper per render figli di riga (con sourceProps mapping) ---\n const renderRowChildren = (children: any[], item: any) => {\n return children.map((child, idx) => {\n const ChildComp = componentRegistry[child.definition?.componentName]\n\n if (!ChildComp) return null\n\n const childVM = Array.isArray(child.viewMode) ? child.viewMode[0] : child.viewMode\n\n const hasSourceProps =\n child.sourceProps &&\n typeof child.sourceProps === 'object' &&\n Object.keys(child.sourceProps).length > 0\n\n let finalProps: any = {}\n\n if (hasSourceProps) {\n for (const [key, path] of Object.entries(child.sourceProps)) {\n // @ts-ignore\n finalProps[key] = path\n .toString()\n .split('.')\n .reduce((acc: any, k: string) => acc?.[k], item)\n }\n } else {\n // fallback ai props statici\n finalProps = child.staticProps || {}\n }\n\n return <ChildComp key={idx} {...finalProps} className={resolveClassName(childVM)} />\n })\n }\n\n return (\n <Container className={resolveClassName(viewMode)} {...containerProps}>\n {_resolvedData.map((item: any, i: number) => {\n const props: any = {}\n\n // mapping valori verso props della card\n for (const [key, path] of Object.entries(rowPropsMapping)) {\n // @ts-ignore\n props[key] = path\n .toString()\n .split('.')\n .reduce((acc: { [x: string]: any }, k: string | number) => acc?.[k], item)\n }\n\n return (\n <Row key={i} {...props} className={resolveClassName(rowViewMode)}>\n {rowChildren?.length > 0 ? renderRowChildren(rowChildren, item) : null}\n </Row>\n )\n })}\n </Container>\n )\n}\n","// components/ComponentRenderer.tsx\n'use client'\nimport { componentRegistry } from './registry'\n\nfunction getValueByPath(obj: any, path: string) {\n return path.split('.').reduce((acc, key) => acc?.[key], obj)\n}\n\nexport function ComponentRenderer({ type, view, data }: any) {\n if (type !== 'view') return null\n const rows = data[view.dataSet]\n const Container = componentRegistry[view.component.componentName]\n\n const Row = componentRegistry[view.rowComponent.componentName]\n if (!Container || !Row) return null\n\n const containerClassNames = Array.isArray(view.viewMode)\n ? view.viewMode.map((mode: { className: string }) => mode?.className || '').join(' ')\n : ''\n\n return (\n <Container className={containerClassNames}>\n {rows.map((item: any, i: number) => {\n const props: any = {}\n\n for (const [k, v] of Object.entries(view.rowPropsMapping ?? {})) {\n props[k] = getValueByPath(item, v as string)\n }\n const rowClassNames = Array.isArray(view.rowViewMode)\n ? view.rowViewMode.map((mode: { className: string }) => mode?.className || '').join(' ')\n : ''\n\n return <Row key={i} {...props} className={rowClassNames} />\n })}\n </Container>\n )\n}\n","// #TODO Gestire doppio caricamento dati:\n// 1 lato payload usando come già fatto api interne di payload mappando i campi in un blocco di tipo view dedicato\n\nimport { resolveInlineComponent } from '../config/utils/resolveInlineComponent'\nimport { ViewBlock } from './ViewBlock'\n\n// 2 recupero dati sempre lato server chiamando un EP in maniera asincrona e gestendo il corretto binding\nexport async function PageRenderer({\n layout,\n serverData,\n}: {\n layout: any[]\n serverData: Record<number, any[]>\n}) {\n const resolvedLayout = layout.map((block, index) => {\n if (block.blockType !== 'view') return block\n console.log(block)\n console.log(serverData)\n return {\n blockType: block.blockType,\n component: block.component,\n viewMode: block.viewMode,\n containerProps: block.containerProps,\n rowComponent: block.rowComponent,\n rowViewMode: block.rowViewMode,\n rowPropsMapping: block.rowPropsMapping,\n rowChildren: block.rowChildren,\n _resolvedData: serverData[index] ?? [],\n _resolvedOk: true,\n }\n })\n\n return (\n <>\n {resolvedLayout.map((block, i) => {\n if (block.blockType === 'view') {\n return <ViewBlock key={i} {...block} />\n }\n\n const resolved = resolveInlineComponent(block)\n if (!resolved) return null\n\n const { Component, props } = resolved\n return <Component key={i} {...props} />\n })}\n </>\n )\n}\n","// uims/resolveInlineComponent.ts\n\nimport { componentRegistry } from '../../react'\n\nexport function resolveInlineComponent(block: any) {\n const { definition, viewMode } = block\n\n if (!definition) return null\n\n const Component = componentRegistry[definition.componentName]\n if (!Component) return null\n\n /* Caso CTA (inline typed) */\n if (block.blockType === 'cta-block') {\n return {\n Component,\n props: {\n title: block.title,\n description: block.description,\n action: block.actionLabel\n ? {\n label: block.actionLabel,\n href: block.actionHref,\n }\n : undefined,\n className: viewMode?.css.className ?? definition.defaultStyle,\n },\n }\n }\n\n /* Caso component-instance generico */\n return {\n Component,\n props: {\n ...(block.props ?? {}),\n className: viewMode?.css.className ?? definition.defaultStyle,\n },\n }\n}\n"],"names":["Card","children","_jsx","componentRegistry","resolveClassName","viewMode","Array","isArray","length","map","vm","css","className","filter","Boolean","join","ViewBlock","block","component","rowComponent","rowViewMode","containerProps","rowPropsMapping","rowChildren","_resolvedData","_resolvedOk","Container","componentName","Row","renderRowChildren","item","child","idx","ChildComp","definition","childVM","finalProps","sourceProps","Object","keys","key","path","entries","toString","split","reduce","acc","k","staticProps","i","props","getValueByPath","obj","type","view","data","rows","dataSet","containerClassNames","mode","v","rowClassNames","async","layout","serverData","resolvedLayout","index","blockType","console","log","_Fragment","resolved","Component","title","description","action","actionLabel","label","href","actionHref","undefined","defaultStyle","resolveInlineComponent"],"mappings":"sDAMaA,EAAO,EAAGC,cACdC,EAAAA,IAAA,MAAA,CAAAD,SAAMA,GAAY,eCJdE,EAAyC,CACpDH,QCAF,SAASI,EAAiBC,GACxB,OAAIC,MAAMC,QAAQF,IAAaA,EAASG,OAAS,EACxCH,EACJI,IAAKC,GAAOA,GAAIC,IAAIC,WACpBC,OAAOC,SACPC,KAAK,KAEHV,GAAUM,IAAIC,WAAa,EACpC,CAEM,SAAUI,EAAUC,GACxB,MAAMC,UACJA,EAASb,SACTA,EAAQc,aACRA,EAAYC,YACZA,EAAWC,eACXA,EAAiB,GAAEC,gBACnBA,EAAkB,CAAA,EAAEC,YACpBA,EAAc,GAAEC,cAChBA,EAAgB,GAAEC,YAClBA,GAAc,GACZR,EACES,EAAYvB,EAAkBe,EAAUS,eACxCC,EAAMzB,EAAkBgB,EAAaQ,eAC3C,IAAKD,IAAcE,EAAK,OAAO,KAE/B,IAAKH,EACH,OACEvB,EAAAA,IAACwB,GAAUd,UAAWR,EAAiBC,GAASJ,SAC9CC,EAAAA,WAAKU,UAAU,eAAcX,SAAA,kCAOnC,MAAM4B,EAAoB,CAAC5B,EAAiB6B,IACnC7B,EAASQ,IAAI,CAACsB,EAAOC,KAC1B,MAAMC,EAAY9B,EAAkB4B,EAAMG,YAAYP,eAEtD,IAAKM,EAAW,OAAO,KAEvB,MAAME,EAAU7B,MAAMC,QAAQwB,E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,OAAK6C,EAGmB,cAApBvD,EAAMkD,UACD,CACLK,YACAtB,MAAO,CACLuB,MAAOxD,EAAMwD,MACbC,YAAazD,EAAMyD,YACnBC,OAAQ1D,EAAM2D,YACV,CACEC,MAAO5D,EAAM2D,YACbE,KAAM7D,EAAM8D,iBAEdC,EACJpE,UAAWP,GAAUM,IAAIC,WAAasB,EAAW+C,eAMhD,CACLT,YACAtB,MAAO,IACDjC,EAAMiC,OAAS,GACnBtC,UAAWP,GAAUM,IAAIC,WAAasB,EAAW+C,eAzB9B,IA4BzB,CDCyBC,CAAuBjE,GACxC,IAAKsD,EAAU,OAAO,KAEtB,MAAMC,UAAEA,EAAStB,MAAEA,GAAUqB,EAC7B,OAAOrE,EAAAA,IAACsE,EAAS,IAAatB,GAAPD,MAI/B"}
@@ -0,0 +1,2 @@
1
+ import{jsx as e,Fragment as o}from"react/jsx-runtime";const n=({children:o})=>e("div",{children:o??"Card works"}),r={Card:n};function t(e){return Array.isArray(e)&&e.length>0?e.map(e=>e?.css.className).filter(Boolean).join(" "):e?.css.className??""}function s(o){const{component:n,viewMode:s,rowComponent:c,rowViewMode:i,containerProps:a={},rowPropsMapping:l={},rowChildren:p=[],_resolvedData:m=[],_resolvedOk:d=!0}=o,u=r[n.componentName],w=r[c.componentName];if(!u||!w)return null;if(!d)return e(u,{className:t(s),children:e("div",{className:"text-red-600",children:"Impossibile caricare i dati"})});const f=(o,n)=>o.map((o,s)=>{const c=r[o.definition?.componentName];if(!c)return null;const i=Array.isArray(o.viewMode)?o.viewMode[0]:o.viewMode;let a={};if(o.sourceProps&&"object"==typeof o.sourceProps&&Object.keys(o.sourceProps).length>0)for(const[e,r]of Object.entries(o.sourceProps))a[e]=r.toString().split(".").reduce((e,o)=>e?.[o],n);else a=o.staticProps||{};return e(c,{...a,className:t(i)},s)});return e(u,{className:t(s),...a,children:m.map((o,n)=>{const r={};for(const[e,n]of Object.entries(l))r[e]=n.toString().split(".").reduce((e,o)=>e?.[o],o);return e(w,{...r,className:t(i),children:p?.length>0?f(p,o):null},n)})})}function c(e,o){return o.split(".").reduce((e,o)=>e?.[o],e)}function i({type:o,view:n,data:t}){if("view"!==o)return null;const s=t[n.dataSet],i=r[n.component.componentName],a=r[n.rowComponent.componentName];if(!i||!a)return null;const l=Array.isArray(n.viewMode)?n.viewMode.map(e=>e?.className||"").join(" "):"";return e(i,{className:l,children:s.map((o,r)=>{const t={};for(const[e,r]of Object.entries(n.rowPropsMapping??{}))t[e]=c(o,r);const s=Array.isArray(n.rowViewMode)?n.rowViewMode.map(e=>e?.className||"").join(" "):"";return e(a,{...t,className:s},r)})})}async function a({layout:n,serverData:t}){const c=n.map((e,o)=>"view"!==e.blockType?e:(console.log(e),console.log(t),{blockType:e.blockType,component:e.component,viewMode:e.viewMode,containerProps:e.containerProps,rowComponent:e.rowComponent,rowViewMode:e.rowViewMode,rowPropsMapping:e.rowPropsMapping,rowChildren:e.rowChildren,_resolvedData:t[o]??[],_resolvedOk:!0}));return e(o,{children:c.map((o,n)=>{if("view"===o.blockType)return e(s,{...o},n);const t=function(e){const{definition:o,viewMode:n}=e;if(!o)return null;const t=r[o.componentName];return t?"cta-block"===e.blockType?{Component:t,props:{title:e.title,description:e.description,action:e.actionLabel?{label:e.actionLabel,href:e.actionHref}:void 0,className:n?.css.className??o.defaultStyle}}:{Component:t,props:{...e.props??{},className:n?.css.className??o.defaultStyle}}:null}(o);if(!t)return null;const{Component:c,props:i}=t;return e(c,{...i},n)})})}export{n as Card,i as ComponentRenderer,a as PageRenderer,s as ViewBlock,r as componentRegistry};
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/react/Card.tsx","../../src/react/registry.ts","../../src/react/ViewBlock.tsx","../../src/react/ComponentRenderer.tsx","../../src/react/PageRenderer.tsx","../../src/config/utils/resolveInlineComponent.ts"],"sourcesContent":["import type { ReactNode } from 'react'\n\ntype CardProps = {\n children?: ReactNode\n}\n\nexport const Card = ({ children }: CardProps) => {\n return <div>{children ?? 'Card works'}</div>\n}\n","// components/registry.ts\nimport { Card } from './Card'\n\nexport const componentRegistry: Record<string, any> = {\n Card,\n}\n","'use client'\n\nimport { componentRegistry } from './registry'\n\nfunction resolveClassName(viewMode: any[] | any | undefined) {\n if (Array.isArray(viewMode) && viewMode.length > 0) {\n return viewMode\n .map((vm) => vm?.css.className)\n .filter(Boolean)\n .join(' ')\n }\n return viewMode?.css.className ?? ''\n}\n\nexport function ViewBlock(block: any) {\n const {\n component,\n viewMode,\n rowComponent,\n rowViewMode,\n containerProps = {},\n rowPropsMapping = {},\n rowChildren = [],\n _resolvedData = [],\n _resolvedOk = true,\n } = block\n const Container = componentRegistry[component.componentName]\n const Row = componentRegistry[rowComponent.componentName]\n if (!Container || !Row) return null\n\n if (!_resolvedOk) {\n return (\n <Container className={resolveClassName(viewMode)}>\n <div className=\"text-red-600\">Impossibile caricare i dati</div>\n </Container>\n )\n }\n\n //#TODO gestire rendering di molteplici rowChildren al mometno stampa solo il primo elemento dell'array\n // --- helper per render figli di riga (con sourceProps mapping) ---\n const renderRowChildren = (children: any[], item: any) => {\n return children.map((child, idx) => {\n const ChildComp = componentRegistry[child.definition?.componentName]\n\n if (!ChildComp) return null\n\n const childVM = Array.isArray(child.viewMode) ? child.viewMode[0] : child.viewMode\n\n const hasSourceProps =\n child.sourceProps &&\n typeof child.sourceProps === 'object' &&\n Object.keys(child.sourceProps).length > 0\n\n let finalProps: any = {}\n\n if (hasSourceProps) {\n for (const [key, path] of Object.entries(child.sourceProps)) {\n // @ts-ignore\n finalProps[key] = path\n .toString()\n .split('.')\n .reduce((acc: any, k: string) => acc?.[k], item)\n }\n } else {\n // fallback ai props statici\n finalProps = child.staticProps || {}\n }\n\n return <ChildComp key={idx} {...finalProps} className={resolveClassName(childVM)} />\n })\n }\n\n return (\n <Container className={resolveClassName(viewMode)} {...containerProps}>\n {_resolvedData.map((item: any, i: number) => {\n const props: any = {}\n\n // mapping valori verso props della card\n for (const [key, path] of Object.entries(rowPropsMapping)) {\n // @ts-ignore\n props[key] = path\n .toString()\n .split('.')\n .reduce((acc: { [x: string]: any }, k: string | number) => acc?.[k], item)\n }\n\n return (\n <Row key={i} {...props} className={resolveClassName(rowViewMode)}>\n {rowChildren?.length > 0 ? renderRowChildren(rowChildren, item) : null}\n </Row>\n )\n })}\n </Container>\n )\n}\n","// components/ComponentRenderer.tsx\n'use client'\nimport { componentRegistry } from './registry'\n\nfunction getValueByPath(obj: any, path: string) {\n return path.split('.').reduce((acc, key) => acc?.[key], obj)\n}\n\nexport function ComponentRenderer({ type, view, data }: any) {\n if (type !== 'view') return null\n const rows = data[view.dataSet]\n const Container = componentRegistry[view.component.componentName]\n\n const Row = componentRegistry[view.rowComponent.componentName]\n if (!Container || !Row) return null\n\n const containerClassNames = Array.isArray(view.viewMode)\n ? view.viewMode.map((mode: { className: string }) => mode?.className || '').join(' ')\n : ''\n\n return (\n <Container className={containerClassNames}>\n {rows.map((item: any, i: number) => {\n const props: any = {}\n\n for (const [k, v] of Object.entries(view.rowPropsMapping ?? {})) {\n props[k] = getValueByPath(item, v as string)\n }\n const rowClassNames = Array.isArray(view.rowViewMode)\n ? view.rowViewMode.map((mode: { className: string }) => mode?.className || '').join(' ')\n : ''\n\n return <Row key={i} {...props} className={rowClassNames} />\n })}\n </Container>\n )\n}\n","// #TODO Gestire doppio caricamento dati:\n// 1 lato payload usando come già fatto api interne di payload mappando i campi in un blocco di tipo view dedicato\n\nimport { resolveInlineComponent } from '../config/utils/resolveInlineComponent'\nimport { ViewBlock } from './ViewBlock'\n\n// 2 recupero dati sempre lato server chiamando un EP in maniera asincrona e gestendo il corretto binding\nexport async function PageRenderer({\n layout,\n serverData,\n}: {\n layout: any[]\n serverData: Record<number, any[]>\n}) {\n const resolvedLayout = layout.map((block, index) => {\n if (block.blockType !== 'view') return block\n console.log(block)\n console.log(serverData)\n return {\n blockType: block.blockType,\n component: block.component,\n viewMode: block.viewMode,\n containerProps: block.containerProps,\n rowComponent: block.rowComponent,\n rowViewMode: block.rowViewMode,\n rowPropsMapping: block.rowPropsMapping,\n rowChildren: block.rowChildren,\n _resolvedData: serverData[index] ?? [],\n _resolvedOk: true,\n }\n })\n\n return (\n <>\n {resolvedLayout.map((block, i) => {\n if (block.blockType === 'view') {\n return <ViewBlock key={i} {...block} />\n }\n\n const resolved = resolveInlineComponent(block)\n if (!resolved) return null\n\n const { Component, props } = resolved\n return <Component key={i} {...props} />\n })}\n </>\n )\n}\n","// uims/resolveInlineComponent.ts\n\nimport { componentRegistry } from '../../react'\n\nexport function resolveInlineComponent(block: any) {\n const { definition, viewMode } = block\n\n if (!definition) return null\n\n const Component = componentRegistry[definition.componentName]\n if (!Component) return null\n\n /* Caso CTA (inline typed) */\n if (block.blockType === 'cta-block') {\n return {\n Component,\n props: {\n title: block.title,\n description: block.description,\n action: block.actionLabel\n ? {\n label: block.actionLabel,\n href: block.actionHref,\n }\n : undefined,\n className: viewMode?.css.className ?? definition.defaultStyle,\n },\n }\n }\n\n /* Caso component-instance generico */\n return {\n Component,\n props: {\n ...(block.props ?? {}),\n className: viewMode?.css.className ?? definition.defaultStyle,\n },\n }\n}\n"],"names":["Card","children","_jsx","componentRegistry","resolveClassName","viewMode","Array","isArray","length","map","vm","css","className","filter","Boolean","join","ViewBlock","block","component","rowComponent","rowViewMode","containerProps","rowPropsMapping","rowChildren","_resolvedData","_resolvedOk","Container","componentName","Row","renderRowChildren","item","child","idx","ChildComp","definition","childVM","finalProps","sourceProps","Object","keys","key","path","entries","toString","split","reduce","acc","k","staticProps","i","props","getValueByPath","obj","ComponentRenderer","type","view","data","rows","dataSet","containerClassNames","mode","v","rowClassNames","async","PageRenderer","layout","serverData","resolvedLayout","index","blockType","console","log","_Fragment","resolved","Component","title","description","action","actionLabel","label","href","actionHref","undefined","defaultStyle","resolveInlineComponent"],"mappings":"4DAMaA,EAAO,EAAGC,cACdC,EAAA,MAAA,CAAAD,SAAMA,GAAY,eCJdE,EAAyC,CACp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e=>{const l=e.replace(/^#/,"");if(!/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(l))throw new Error(`Colore HEX non valido: ${e}`);const a=3===l.length?l.split("").map(e=>e+e).join(""):l;return{r:parseInt(a.slice(0,2),16),g:parseInt(a.slice(2,4),16),b:parseInt(a.slice(4,6),16)}};exports.generateCssVars=function(l){const a=[300,400,500,600,700,800],o=[l.headingFont,l.textFont].filter(Boolean).map(e=>e?`@import url('https://fonts.googleapis.com/css2?family=${e.replace(/ /g,"+")}:wght@${a.join(";")}&display=swap');`:"").join("\n"),n=(l,a)=>{if(!l)return"";try{const o=e(l);if(!o||"number"!=typeof o.r||"number"!=typeof o.g||"number"!=typeof o.b)return console.warn(`Impossibile convertire il colore ${a}: ${l}`),"";const{r:n,g:r,b:c}=o,i=Array.from({length:9},(e,l)=>{const o=10*(l+1);return`--color-${a}-${o}: rgba(${n}, ${r}, ${c}, ${o/100});`}).join("\n");return`\n --color-${a}: rgb(${n}, ${r}, ${c}); /* Default (opacità 1) */\n ${i}\n `}catch(e){return console.warn(`Errore nella generazione delle varianti di opacità per ${a}: ${e}`),""}},r=(l,a)=>{if(!l)return"";try{const o=e(l);if(!o||"number"!=typeof o.r||"number"!=typeof o.g||"number"!=typeof o.b)return console.warn(`Impossibile convertire il colore ${a}: ${l}`),"";const{r:n,g:r,b:c}=o,i=e=>Math.max(0,Math.min(255,Math.round(e))),t=(e,l)=>`${i(n+(e-n)*l)},${i(r+(e-r)*l)},${i(c+(e-c)*l)}`,u=[.2,.4,.6,.8],b=[10,20,30,40],v=u.map((e,l)=>{const o=b[l];return`--color-${a}-light-${o}: rgb(${t(255,e)});`}).join("\n"),s=u.map((e,l)=>{const o=b[l];return`--color-${a}-dark-${o}: rgb(${t(0,e)});`}).join("\n");return`--color-${a}: rgb(${n}, ${r}, ${c});\n ${v}\n ${s}`}catch(e){return console.warn(`Errore nella generazione delle varianti di brightness per ${a}: ${e}`),""}},c=`${n(l.primaryColor,"primary")} ${r(l.primaryColor,"primary")}`,i=`${n(l.secondaryColor,"secondary")} ${r(l.secondaryColor,"secondary")}`,t=`${n(l.secondaryColor,"accent")} ${r(l.secondaryColor,"accent")}`,u=`${n(l.secondaryColor,"dark")} ${r(l.secondaryColor,"dark")}`,b=`${n(l.secondaryColor,"light")} ${r(l.secondaryColor,"light")}`;return`\n ${o}\n\n :root {\n --font-heading: ${l.headingFont?`'${l.headingFont}', sans-serif`:"system-layout, sans-serif"};\n --font-text: ${l.textFont?`'${l.textFont}', sans-serif`:"system-layout, sans-serif"};\n --color-white: #ffffff;\n --color-black: #000000;\n --color-foreground: ${l.foregroundColor||"#FFFFFF"};\n ${c}\n ${i}\n ${t}\n ${u}\n ${b}\n }\n `},exports.iconsList=[{label:"Academic Cap",value:"AcademicCapIcon"},{label:"Adjustments Horizontal",value:"AdjustmentsHorizontalIcon"},{label:"Adjustments Vertical",value:"AdjustmentsVerticalIcon"},{label:"Archive Box Arrow Down",value:"ArchiveBoxArrowDownIcon"},{label:"Archive Box X Mark",value:"ArchiveBoxXMarkIcon"},{label:"Archive Box",value:"ArchiveBoxIcon"},{label:"Arrow Down Circle",value:"ArrowDownCircleIcon"},{label:"Arrow Down",value:"ArrowDownIcon"},{label:"Arrow Left Circle",value:"ArrowLeftCircleIcon"},{label:"Arrow Left",value:"ArrowLeftIcon"},{label:"Arrow Right Circle",value:"ArrowRightCircleIcon"},{label:"Arrow Right",value:"ArrowRightIcon"},{label:"Arrow Up Circle",value:"ArrowUpCircleIcon"},{label:"Arrow Up",value:"ArrowUpIcon"},{label:"Bell Alert",value:"BellAlertIcon"},{label:"Bell",value:"BellIcon"},{label:"Bookmark Square",value:"BookmarkSquareIcon"},{label:"Bookmark",value:"BookmarkIcon"},{label:"Building Office",value:"BuildingOfficeIcon"},{label:"Calendar",value:"CalendarIcon"},{label:"Camera",value:"CameraIcon"},{label:"Chart Bar",value:"ChartBarIcon"},{label:"Chat Bubble Left Right",value:"ChatBubbleLeftRightIcon"},{label:"Chat Bubble Left",value:"ChatBubbleLeftIcon"},{label:"Check Circle",value:"CheckCircleIcon"},{label:"Check",value:"CheckIcon"},{label:"Chevron Down",value:"ChevronDownIcon"},{label:"Chevron Left",value:"ChevronLeftIcon"},{label:"Chevron Right",value:"ChevronRightIcon"},{label:"Chevron Up",value:"ChevronUpIcon"},{label:"Clock",value:"ClockIcon"},{label:"Cloud Arrow Up",value:"CloudArrowUpIcon"},{label:"Cloud",value:"CloudIcon"},{label:"Code Bracket",value:"CodeBracketIcon"},{label:"Cog",value:"CogIcon"},{label:"Command Line",value:"CommandLineIcon"},{label:"Computer Desktop",value:"ComputerDesktopIcon"},{label:"Credit Card",value:"CreditCardIcon"},{label:"Document",value:"DocumentIcon"},{label:"Envelope",value:"EnvelopeIcon"},{label:"Exclamation Circle",value:"ExclamationCircleIcon"},{label:"Exclamation Triangle",value:"ExclamationTriangleIcon"},{label:"Eye",value:"EyeIcon"},{label:"Face Smile",value:"FaceSmileIcon"},{label:"Film",value:"FilmIcon"},{label:"Finger Print",value:"FingerPrintIcon"},{label:"Fire",value:"FireIcon"},{label:"Flag",value:"FlagIcon"},{label:"Folder Open",value:"FolderOpenIcon"},{label:"Folder",value:"FolderIcon"},{label:"Gift",value:"GiftIcon"},{label:"Globe Alt",value:"GlobeAltIcon"},{label:"Globe Europe Africa",value:"GlobeEuropeAfricaIcon"},{label:"Hand Raised",value:"HandRaisedIcon"},{label:"Heart",value:"HeartIcon"},{label:"Home",value:"HomeIcon"},{label:"Identification",value:"IdentificationIcon"},{label:"Information Circle",value:"InformationCircleIcon"},{label:"Key",value:"KeyIcon"},{label:"Link",value:"LinkIcon"},{label:"List Bullet",value:"ListBulletIcon"},{label:"Lock Closed",value:"LockClosedIcon"},{label:"Lock Open",value:"LockOpenIcon"},{label:"Magnifying Glass Circle",value:"MagnifyingGlassCircleIcon"},{label:"Magnifying Glass",value:"MagnifyingGlassIcon"},{label:"Map Pin",value:"MapPinIcon"},{label:"Map",value:"MapIcon"},{label:"Moon",value:"MoonIcon"},{label:"Paper Airplane",value:"PaperAirplaneIcon"},{label:"Paper Clip",value:"PaperClipIcon"},{label:"Pause Circle",value:"PauseCircleIcon"},{label:"Pencil Square",value:"PencilSquareIcon"},{label:"Pencil",value:"PencilIcon"},{label:"Phone Arrow Up Right",value:"PhoneArrowUpRightIcon"},{label:"Phone X Mark",value:"PhoneXMarkIcon"},{label:"Phone",value:"PhoneIcon"},{label:"Photo",value:"PhotoIcon"},{label:"Play Circle",value:"PlayCircleIcon"},{label:"Play",value:"PlayIcon"},{label:"Plus Circle",value:"PlusCircleIcon"},{label:"Plus",value:"PlusIcon"},{label:"Power",value:"PowerIcon"},{label:"Question Mark Circle",value:"QuestionMarkCircleIcon"},{label:"Rocket Launch",value:"RocketLaunchIcon"},{label:"Rss",value:"RssIcon"},{label:"Scale",value:"ScaleIcon"},{label:"Server",value:"ServerIcon"},{label:"Share",value:"ShareIcon"},{label:"Shield Check",value:"ShieldCheckIcon"},{label:"Shield Exclamation",value:"ShieldExclamationIcon"},{label:"Shopping Bag",value:"ShoppingBagIcon"},{label:"Shopping Cart",value:"ShoppingCartIcon"},{label:"Star",value:"StarIcon"},{label:"Stop Circle",value:"StopCircleIcon"},{label:"Sun",value:"SunIcon"},{label:"Tag",value:"TagIcon"},{label:"Trash",value:"TrashIcon"},{label:"Trophy",value:"TrophyIcon"},{label:"User Circle",value:"UserCircleIcon"},{label:"User Group",value:"UserGroupIcon"},{label:"User",value:"UserIcon"},{label:"Users",value:"UsersIcon"},{label:"Video Camera",value:"VideoCameraIcon"},{label:"Wifi",value:"WifiIcon"},{label:"Window",value:"WindowIcon"},{label:"Wrench Screwdriver",value:"WrenchScrewdriverIcon"},{label:"Wrench",value:"WrenchIcon"},{label:"X Circle",value:"XCircleIcon"},{label:"X Mark",value:"XMarkIcon"}];
1
+ "use strict";const e=e=>{const l=e.replace(/^#/,"");if(!/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(l))throw new Error(`Colore HEX non valido: ${e}`);const a=3===l.length?l.split("").map(e=>e+e).join(""):l;return{r:parseInt(a.slice(0,2),16),g:parseInt(a.slice(2,4),16),b:parseInt(a.slice(4,6),16)}};exports.generateCssVars=function(l){const a=[300,400,500,600,700,800],o=[l.headingFont,l.textFont].filter(Boolean).map(e=>e?`@import url('https://fonts.googleapis.com/css2?family=${e.replace(/ /g,"+")}:wght@${a.join(";")}&display=swap');`:"").join("\n"),n=(l,a)=>{if(!l)return"";try{const o=e(l);if(!o||"number"!=typeof o.r||"number"!=typeof o.g||"number"!=typeof o.b)return console.warn(`Impossibile convertire il colore ${a}: ${l}`),"";const{r:n,g:r,b:c}=o,i=Array.from({length:9},(e,l)=>{const o=10*(l+1);return`--color-${a}-${o}: rgba(${n}, ${r}, ${c}, ${o/100});`}).join("\n");return`\n --color-${a}: rgb(${n}, ${r}, ${c}); /* Default (opacità 1) */\n ${i}\n `}catch(e){return console.warn(`Errore nella generazione delle varianti di opacità per ${a}: ${e}`),""}},r=(l,a)=>{if(!l)return"";try{const o=e(l);if(!o||"number"!=typeof o.r||"number"!=typeof o.g||"number"!=typeof o.b)return console.warn(`Impossibile convertire il colore ${a}: ${l}`),"";const{r:n,g:r,b:c}=o,i=e=>Math.max(0,Math.min(255,Math.round(e))),t=(e,l)=>`${i(n+(e-n)*l)},${i(r+(e-r)*l)},${i(c+(e-c)*l)}`,u=[.2,.4,.6,.8],b=[10,20,30,40],v=u.map((e,l)=>{const o=b[l];return`--color-${a}-light-${o}: rgb(${t(255,e)});`}).join("\n"),s=u.map((e,l)=>{const o=b[l];return`--color-${a}-dark-${o}: rgb(${t(0,e)});`}).join("\n");return`--color-${a}: rgb(${n}, ${r}, ${c});\n ${v}\n ${s}`}catch(e){return console.warn(`Errore nella generazione delle varianti di brightness per ${a}: ${e}`),""}},c=`${n(l.primaryColor,"primary")} ${r(l.primaryColor,"primary")}`,i=`${n(l.secondaryColor,"secondary")} ${r(l.secondaryColor,"secondary")}`,t=`${n(l.secondaryColor,"accent")} ${r(l.secondaryColor,"accent")}`,u=`${n(l.secondaryColor,"dark")} ${r(l.secondaryColor,"dark")}`,b=`${n(l.secondaryColor,"light")} ${r(l.secondaryColor,"light")}`;return`\n ${o}\n\n :root {\n --font-heading: ${l.headingFont?`'${l.headingFont}', sans-serif`:"system-layout, sans-serif"};\n --font-text: ${l.textFont?`'${l.textFont}', sans-serif`:"system-layout, sans-serif"};\n --color-white: #ffffff;\n --color-black: #000000;\n --color-foreground: ${l.foregroundColor||"#FFFFFF"};\n ${c}\n ${i}\n ${t}\n ${u}\n ${b}\n }\n `},exports.iconsList=[{label:"Academic Cap",value:"AcademicCapIcon"},{label:"Adjustments Horizontal",value:"AdjustmentsHorizontalIcon"},{label:"Adjustments Vertical",value:"AdjustmentsVerticalIcon"},{label:"Archive Box Arrow Down",value:"ArchiveBoxArrowDownIcon"},{label:"Archive Box X Mark",value:"ArchiveBoxXMarkIcon"},{label:"Archive Box",value:"ArchiveBoxIcon"},{label:"Arrow Down Circle",value:"ArrowDownCircleIcon"},{label:"Arrow Down",value:"ArrowDownIcon"},{label:"Arrow Left Circle",value:"ArrowLeftCircleIcon"},{label:"Arrow Left",value:"ArrowLeftIcon"},{label:"Arrow Right Circle",value:"ArrowRightCircleIcon"},{label:"Arrow Right",value:"ArrowRightIcon"},{label:"Arrow Up Circle",value:"ArrowUpCircleIcon"},{label:"Arrow Up",value:"ArrowUpIcon"},{label:"Bell Alert",value:"BellAlertIcon"},{label:"Bell",value:"BellIcon"},{label:"Bookmark Square",value:"BookmarkSquareIcon"},{label:"Bookmark",value:"BookmarkIcon"},{label:"Building Office",value:"BuildingOfficeIcon"},{label:"Calendar",value:"CalendarIcon"},{label:"Camera",value:"CameraIcon"},{label:"Chart Bar",value:"ChartBarIcon"},{label:"Chat Bubble Left Right",value:"ChatBubbleLeftRightIcon"},{label:"Chat Bubble Left",value:"ChatBubbleLeftIcon"},{label:"Check Circle",value:"CheckCircleIcon"},{label:"Check",value:"CheckIcon"},{label:"Chevron Down",value:"ChevronDownIcon"},{label:"Chevron Left",value:"ChevronLeftIcon"},{label:"Chevron Right",value:"ChevronRightIcon"},{label:"Chevron Up",value:"ChevronUpIcon"},{label:"Clock",value:"ClockIcon"},{label:"Cloud Arrow Up",value:"CloudArrowUpIcon"},{label:"Cloud",value:"CloudIcon"},{label:"Code Bracket",value:"CodeBracketIcon"},{label:"Cog",value:"CogIcon"},{label:"Command Line",value:"CommandLineIcon"},{label:"Computer Desktop",value:"ComputerDesktopIcon"},{label:"Credit Card",value:"CreditCardIcon"},{label:"Document",value:"DocumentIcon"},{label:"Envelope",value:"EnvelopeIcon"},{label:"Exclamation Circle",value:"ExclamationCircleIcon"},{label:"Exclamation Triangle",value:"ExclamationTriangleIcon"},{label:"Eye",value:"EyeIcon"},{label:"Face Smile",value:"FaceSmileIcon"},{label:"Film",value:"FilmIcon"},{label:"Finger Print",value:"FingerPrintIcon"},{label:"Fire",value:"FireIcon"},{label:"Flag",value:"FlagIcon"},{label:"Folder Open",value:"FolderOpenIcon"},{label:"Folder",value:"FolderIcon"},{label:"Gift",value:"GiftIcon"},{label:"Globe Alt",value:"GlobeAltIcon"},{label:"Globe Europe Africa",value:"GlobeEuropeAfricaIcon"},{label:"Hand Raised",value:"HandRaisedIcon"},{label:"Heart",value:"HeartIcon"},{label:"Home",value:"HomeIcon"},{label:"Identification",value:"IdentificationIcon"},{label:"Information Circle",value:"InformationCircleIcon"},{label:"Key",value:"KeyIcon"},{label:"Link",value:"LinkIcon"},{label:"List Bullet",value:"ListBulletIcon"},{label:"Lock Closed",value:"LockClosedIcon"},{label:"Lock Open",value:"LockOpenIcon"},{label:"Magnifying Glass Circle",value:"MagnifyingGlassCircleIcon"},{label:"Magnifying Glass",value:"MagnifyingGlassIcon"},{label:"Map Pin",value:"MapPinIcon"},{label:"Map",value:"MapIcon"},{label:"Moon",value:"MoonIcon"},{label:"Paper Airplane",value:"PaperAirplaneIcon"},{label:"Paper Clip",value:"PaperClipIcon"},{label:"Pause Circle",value:"PauseCircleIcon"},{label:"Pencil Square",value:"PencilSquareIcon"},{label:"Pencil",value:"PencilIcon"},{label:"Phone Arrow Up Right",value:"PhoneArrowUpRightIcon"},{label:"Phone X Mark",value:"PhoneXMarkIcon"},{label:"Phone",value:"PhoneIcon"},{label:"Photo",value:"PhotoIcon"},{label:"Play Circle",value:"PlayCircleIcon"},{label:"Play",value:"PlayIcon"},{label:"Plus Circle",value:"PlusCircleIcon"},{label:"Plus",value:"PlusIcon"},{label:"Power",value:"PowerIcon"},{label:"Question Mark Circle",value:"QuestionMarkCircleIcon"},{label:"Rocket Launch",value:"RocketLaunchIcon"},{label:"Rss",value:"RssIcon"},{label:"Scale",value:"ScaleIcon"},{label:"Server",value:"ServerIcon"},{label:"Share",value:"ShareIcon"},{label:"Shield Check",value:"ShieldCheckIcon"},{label:"Shield Exclamation",value:"ShieldExclamationIcon"},{label:"Shopping Bag",value:"ShoppingBagIcon"},{label:"Shopping Cart",value:"ShoppingCartIcon"},{label:"Star",value:"StarIcon"},{label:"Stop Circle",value:"StopCircleIcon"},{label:"Sun",value:"SunIcon"},{label:"Tag",value:"TagIcon"},{label:"Trash",value:"TrashIcon"},{label:"Trophy",value:"TrophyIcon"},{label:"User Circle",value:"UserCircleIcon"},{label:"User Group",value:"UserGroupIcon"},{label:"User",value:"UserIcon"},{label:"Users",value:"UsersIcon"},{label:"Video Camera",value:"VideoCameraIcon"},{label:"Wifi",value:"WifiIcon"},{label:"Window",value:"WindowIcon"},{label:"Wrench Screwdriver",value:"WrenchScrewdriverIcon"},{label:"Wrench",value:"WrenchIcon"},{label:"X Circle",value:"XCircleIcon"},{label:"X Mark",value:"XMarkIcon"}],exports.resolveViewData=async function(e,l){const a={};for(let o=0;o<l.length;o++){const n=l[o];if("view"===n.blockType&&(n.useInternalSource&&n.internalCollection))try{const l=await e.find({collection:n.internalCollection,limit:100,pagination:!1,where:n.internalWhere||void 0,sort:n.internalSort||void 0,depth:9});a[o]=l.docs??[]}catch(e){console.warn("Errore caricando view-block",o,e),a[o]=[]}}return a};
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../src/utils/iconsList.ts","../../src/hexToRgb.ts","../../src/utils/generateCssVars.ts"],"sourcesContent":["export const iconsList = [\n { label: 'Academic Cap', value: 'AcademicCapIcon' },\n { label: 'Adjustments Horizontal', value: 'AdjustmentsHorizontalIcon' },\n { label: 'Adjustments Vertical', value: 'AdjustmentsVerticalIcon' },\n { label: 'Archive Box Arrow Down', value: 'ArchiveBoxArrowDownIcon' },\n { label: 'Archive Box X Mark', value: 'ArchiveBoxXMarkIcon' },\n { label: 'Archive Box', value: 'ArchiveBoxIcon' },\n { label: 'Arrow Down Circle', value: 'ArrowDownCircleIcon' },\n { label: 'Arrow Down', value: 'ArrowDownIcon' },\n { label: 'Arrow Left Circle', value: 'ArrowLeftCircleIcon' },\n { label: 'Arrow Left', value: 'ArrowLeftIcon' },\n { label: 'Arrow Right Circle', value: 'ArrowRightCircleIcon' },\n { label: 'Arrow Right', value: 'ArrowRightIcon' },\n { label: 'Arrow Up Circle', value: 'ArrowUpCircleIcon' },\n { label: 'Arrow Up', value: 'ArrowUpIcon' },\n { label: 'Bell Alert', value: 'BellAlertIcon' },\n { label: 'Bell', value: 'BellIcon' },\n { label: 'Bookmark Square', value: 'BookmarkSquareIcon' },\n { label: 'Bookmark', value: 'BookmarkIcon' },\n { label: 'Building Office', value: 'BuildingOfficeIcon' },\n { label: 'Calendar', value: 'CalendarIcon' },\n { label: 'Camera', value: 'CameraIcon' },\n { label: 'Chart Bar', value: 'ChartBarIcon' },\n { label: 'Chat Bubble Left Right', value: 'ChatBubbleLeftRightIcon' },\n { label: 'Chat Bubble Left', value: 'ChatBubbleLeftIcon' },\n { label: 'Check Circle', value: 'CheckCircleIcon' },\n { label: 'Check', value: 'CheckIcon' },\n { label: 'Chevron Down', value: 'ChevronDownIcon' },\n { label: 'Chevron Left', value: 'ChevronLeftIcon' },\n { label: 'Chevron Right', value: 'ChevronRightIcon' },\n { label: 'Chevron Up', value: 'ChevronUpIcon' },\n { label: 'Clock', value: 'ClockIcon' },\n { label: 'Cloud Arrow Up', value: 'CloudArrowUpIcon' },\n { label: 'Cloud', value: 'CloudIcon' },\n { label: 'Code Bracket', value: 'CodeBracketIcon' },\n { label: 'Cog', value: 'CogIcon' },\n { label: 'Command Line', value: 'CommandLineIcon' },\n { label: 'Computer Desktop', value: 'ComputerDesktopIcon' },\n { label: 'Credit Card', value: 'CreditCardIcon' },\n { label: 'Document', value: 'DocumentIcon' },\n { label: 'Envelope', value: 'EnvelopeIcon' },\n { label: 'Exclamation Circle', value: 'ExclamationCircleIcon' },\n { label: 'Exclamation Triangle', value: 'ExclamationTriangleIcon' },\n { label: 'Eye', value: 'EyeIcon' },\n { label: 'Face Smile', value: 'FaceSmileIcon' },\n { label: 'Film', value: 'FilmIcon' },\n { label: 'Finger Print', value: 'FingerPrintIcon' },\n { label: 'Fire', value: 'FireIcon' },\n { label: 'Flag', value: 'FlagIcon' },\n { label: 'Folder Open', value: 'FolderOpenIcon' },\n { label: 'Folder', value: 'FolderIcon' },\n { label: 'Gift', value: 'GiftIcon' },\n { label: 'Globe Alt', value: 'GlobeAltIcon' },\n { label: 'Globe Europe Africa', value: 'GlobeEuropeAfricaIcon' },\n { label: 'Hand Raised', value: 'HandRaisedIcon' },\n { label: 'Heart', value: 'HeartIcon' },\n { label: 'Home', value: 'HomeIcon' },\n { label: 'Identification', value: 'IdentificationIcon' },\n { label: 'Information Circle', value: 'InformationCircleIcon' },\n { label: 'Key', value: 'KeyIcon' },\n { label: 'Link', value: 'LinkIcon' },\n { label: 'List Bullet', value: 'ListBulletIcon' },\n { label: 'Lock Closed', value: 'LockClosedIcon' },\n { label: 'Lock Open', value: 'LockOpenIcon' },\n { label: 'Magnifying Glass Circle', value: 'MagnifyingGlassCircleIcon' },\n { label: 'Magnifying Glass', value: 'MagnifyingGlassIcon' },\n { label: 'Map Pin', value: 'MapPinIcon' },\n { label: 'Map', value: 'MapIcon' },\n { label: 'Moon', value: 'MoonIcon' },\n { label: 'Paper Airplane', value: 'PaperAirplaneIcon' },\n { label: 'Paper Clip', value: 'PaperClipIcon' },\n { label: 'Pause Circle', value: 'PauseCircleIcon' },\n { label: 'Pencil Square', value: 'PencilSquareIcon' },\n { label: 'Pencil', value: 'PencilIcon' },\n { label: 'Phone Arrow Up Right', value: 'PhoneArrowUpRightIcon' },\n { label: 'Phone X Mark', value: 'PhoneXMarkIcon' },\n { label: 'Phone', value: 'PhoneIcon' },\n { label: 'Photo', value: 'PhotoIcon' },\n { label: 'Play Circle', value: 'PlayCircleIcon' },\n { label: 'Play', value: 'PlayIcon' },\n { label: 'Plus Circle', value: 'PlusCircleIcon' },\n { label: 'Plus', value: 'PlusIcon' },\n { label: 'Power', value: 'PowerIcon' },\n { label: 'Question Mark Circle', value: 'QuestionMarkCircleIcon' },\n { label: 'Rocket Launch', value: 'RocketLaunchIcon' },\n { label: 'Rss', value: 'RssIcon' },\n { label: 'Scale', value: 'ScaleIcon' },\n { label: 'Server', value: 'ServerIcon' },\n { label: 'Share', value: 'ShareIcon' },\n { label: 'Shield Check', value: 'ShieldCheckIcon' },\n { label: 'Shield Exclamation', value: 'ShieldExclamationIcon' },\n { label: 'Shopping Bag', value: 'ShoppingBagIcon' },\n { label: 'Shopping Cart', value: 'ShoppingCartIcon' },\n { label: 'Star', value: 'StarIcon' },\n { label: 'Stop Circle', value: 'StopCircleIcon' },\n { label: 'Sun', value: 'SunIcon' },\n { label: 'Tag', value: 'TagIcon' },\n { label: 'Trash', value: 'TrashIcon' },\n { label: 'Trophy', value: 'TrophyIcon' },\n { label: 'User Circle', value: 'UserCircleIcon' },\n { label: 'User Group', value: 'UserGroupIcon' },\n { label: 'User', value: 'UserIcon' },\n { label: 'Users', value: 'UsersIcon' },\n { label: 'Video Camera', value: 'VideoCameraIcon' },\n { label: 'Wifi', value: 'WifiIcon' },\n { label: 'Window', value: 'WindowIcon' },\n { label: 'Wrench Screwdriver', value: 'WrenchScrewdriverIcon' },\n { label: 'Wrench', value: 'WrenchIcon' },\n { label: 'X Circle', value: 'XCircleIcon' },\n { label: 'X Mark', value: 'XMarkIcon' },\n]\n","const hexToRgb = (hex: string): { r: number; g: number; b: number } => {\n // Rimuove il simbolo `#` se presente\n const cleanedHex = hex.replace(/^#/, '');\n\n // Controlla che il colore sia valido (3 o 6 caratteri)\n if (!/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(cleanedHex)) {\n throw new Error(`Colore HEX non valido: ${hex}`);\n }\n\n // In caso di formato corto (es. \"FFF\"), lo converte in formato lungo (es. \"FFFFFF\")\n const expandedHex =\n cleanedHex.length === 3\n ? cleanedHex\n .split('')\n .map(char => char + char)\n .join('')\n : cleanedHex;\n\n // Converte il valore HEX in decimali per R, G e B\n const r = parseInt(expandedHex.slice(0, 2), 16);\n const g = parseInt(expandedHex.slice(2, 4), 16);\n const b = parseInt(expandedHex.slice(4, 6), 16);\n\n return { r, g, b };\n};\n\nexport default hexToRgb;","import hexToRgb from '../hexToRgb'\n\nexport function generateCssVars(settings: {\n headingFont?: string\n textFont?: string\n foregroundColor?: string\n primaryColor?: string\n secondaryColor?: string\n accentColor?: string\n darkColor?: string\n lightColor?: string\n}): string {\n // Gestione robusta dei font\n const fontWeights = [300, 400, 500, 600, 700, 800]\n\n const fontsToImport = [settings.headingFont, settings.textFont]\n .filter(Boolean)\n .map((f) => {\n if (!f) return ''\n // Aggiungiamo il parametro wght per specificare i pesi da caricare\n return `@import url('https://fonts.googleapis.com/css2?family=${f.replace(\n / /g,\n '+',\n )}:wght@${fontWeights.join(';')}&display=swap');`\n })\n .join('\\n')\n\n const generateOpacityVariants = (color: string | undefined, name: string): string => {\n if (!color) {\n return ''\n }\n\n try {\n const rgbValue = hexToRgb(color)\n\n if (\n !rgbValue ||\n typeof rgbValue.r !== 'number' ||\n typeof rgbValue.g !== 'number' ||\n typeof rgbValue.b !== 'number'\n ) {\n console.warn(`Impossibile convertire il colore ${name}: ${color}`)\n return ''\n }\n\n const { r, g, b } = rgbValue\n\n const opacityVars = Array.from({ length: 9 }, (_, i) => {\n const opacity = (i + 1) * 10\n return `--color-${name}-${opacity}: rgba(${r}, ${g}, ${b}, ${opacity / 100});`\n }).join('\\n')\n\n return `\n --color-${name}: rgb(${r}, ${g}, ${b}); /* Default (opacità 1) */\n ${opacityVars}\n `\n } catch (error) {\n console.warn(`Errore nella generazione delle varianti di opacità per ${name}: ${error}`)\n return ''\n }\n }\n\n const generateBrightnessVariants = (color: string | undefined, name: string): string => {\n if (!color) {\n return ''\n }\n\n try {\n const rgbValue = hexToRgb(color)\n\n if (\n !rgbValue ||\n typeof rgbValue.r !== 'number' ||\n typeof rgbValue.g !== 'number' ||\n typeof rgbValue.b !== 'number'\n ) {\n console.warn(`Impossibile convertire il colore ${name}: ${color}`)\n return ''\n }\n\n const { r, g, b } = rgbValue\n\n const clamp = (value: number) => Math.max(0, Math.min(255, Math.round(value)))\n\n const mixWith = (target: number, amount: number) =>\n `${clamp(r + (target - r) * amount)},${clamp(\n g + (target - g) * amount,\n )},${clamp(b + (target - b) * amount)}`\n\n const steps = [0.2, 0.4, 0.6, 0.8] // → 20 / 40 / 60 / 80 se vuoi estendere\n const labels = [10, 20, 30, 40]\n\n const lighter = steps\n .map((step, i) => {\n const label = labels[i]\n return `--color-${name}-light-${label}: rgb(${mixWith(255, step)});`\n })\n .join('\\n')\n\n const darker = steps\n .map((step, i) => {\n const label = labels[i]\n return `--color-${name}-dark-${label}: rgb(${mixWith(0, step)});`\n })\n .join('\\n')\n\n return `--color-${name}: rgb(${r}, ${g}, ${b});\n ${lighter}\n ${darker}`\n } catch (error) {\n console.warn(`Errore nella generazione delle varianti di brightness per ${name}: ${error}`)\n return ''\n }\n }\n\n // Genera variabili solo per i colori forniti\n const primaryVars = `${generateOpacityVariants(settings.primaryColor, 'primary')} ${generateBrightnessVariants(settings.primaryColor, 'primary')}`\n const secondaryVars = `${generateOpacityVariants(settings.secondaryColor, 'secondary')} ${generateBrightnessVariants(settings.secondaryColor, 'secondary')}`\n const accentVars = `${generateOpacityVariants(settings.secondaryColor, 'accent')} ${generateBrightnessVariants(settings.secondaryColor, 'accent')}`\n const darkVars = `${generateOpacityVariants(settings.secondaryColor, 'dark')} ${generateBrightnessVariants(settings.secondaryColor, 'dark')}`\n const lightVars = `${generateOpacityVariants(settings.secondaryColor, 'light')} ${generateBrightnessVariants(settings.secondaryColor, 'light')}`\n\n // Genera i valori dei font in modo sicuro\n const headingFontValue = settings.headingFont\n ? `'${settings.headingFont}', sans-serif`\n : 'system-layout, sans-serif'\n\n const textFontValue = settings.textFont\n ? `'${settings.textFont}', sans-serif`\n : 'system-layout, sans-serif'\n\n return `\n ${fontsToImport}\n\n :root {\n --font-heading: ${headingFontValue};\n --font-text: ${textFontValue};\n --color-white: #ffffff;\n --color-black: #000000;\n --color-foreground: ${settings.foregroundColor || '#FFFFFF'};\n ${primaryVars}\n ${secondaryVars}\n ${accentVars}\n ${darkVars}\n ${lightVars}\n }\n `\n}\n"],"names":["hexToRgb","hex","cleanedHex","replace","test","Error","expandedHex","length","split","map","char","join","r","parseInt","slice","g","b","settings","fontWeights","fontsToImport","headingFont","textFont","filter","Boolean","f","generateOpacityVariants","color","name","rgbValue","console","warn","opacityVars","Array","from","_","i","opacity","error","generateBrightnessVariants","clamp","value","Math","max","min","round","mixWith","target","amount","steps","labels","lighter","step","label","darker","primaryVars","primaryColor","secondaryVars","secondaryColor","accentVars","darkVars","lightVars","foregroundColor"],"mappings":"aAAO,MCADA,EAAYC,IAEd,MAAMC,EAAaD,EAAIE,QAAQ,KAAM,IAGrC,IAAK,oCAAoCC,KAAKF,GAC1C,MAAM,IAAIG,MAAM,0BAA0BJ,KAI9C,MAAMK,EACoB,IAAtBJ,EAAWK,OACLL,EACGM,MAAM,IACNC,IAAIC,GAAQA,EAAOA,GACnBC,KAAK,IACRT,EAOV,MAAO,CAAEU,EAJCC,SAASP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ACxB,CAAEY,MAAO,SAAUZ,MAAO,cAC1B,CAAEY,MAAO,qBAAsBZ,MAAO,yBACtC,CAAEY,MAAO,SAAUZ,MAAO,cAC1B,CAAEY,MAAO,WAAYZ,MAAO,eAC5B,CAAEY,MAAO,SAAUZ,MAAO"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../src/utils/iconsList.ts","../../src/hexToRgb.ts","../../src/utils/generateCssVars.ts","../../src/utils/resolveViewData.ts"],"sourcesContent":["export const iconsList = [\n { label: 'Academic Cap', value: 'AcademicCapIcon' },\n { label: 'Adjustments Horizontal', value: 'AdjustmentsHorizontalIcon' },\n { label: 'Adjustments Vertical', value: 'AdjustmentsVerticalIcon' },\n { label: 'Archive Box Arrow Down', value: 'ArchiveBoxArrowDownIcon' },\n { label: 'Archive Box X Mark', value: 'ArchiveBoxXMarkIcon' },\n { label: 'Archive Box', value: 'ArchiveBoxIcon' },\n { label: 'Arrow Down Circle', value: 'ArrowDownCircleIcon' },\n { label: 'Arrow Down', value: 'ArrowDownIcon' },\n { label: 'Arrow Left Circle', value: 'ArrowLeftCircleIcon' },\n { label: 'Arrow Left', value: 'ArrowLeftIcon' },\n { label: 'Arrow Right Circle', value: 'ArrowRightCircleIcon' },\n { label: 'Arrow Right', value: 'ArrowRightIcon' },\n { label: 'Arrow Up Circle', value: 'ArrowUpCircleIcon' },\n { label: 'Arrow Up', value: 'ArrowUpIcon' },\n { label: 'Bell Alert', value: 'BellAlertIcon' },\n { label: 'Bell', value: 'BellIcon' },\n { label: 'Bookmark Square', value: 'BookmarkSquareIcon' },\n { label: 'Bookmark', value: 'BookmarkIcon' },\n { label: 'Building Office', value: 'BuildingOfficeIcon' },\n { label: 'Calendar', value: 'CalendarIcon' },\n { label: 'Camera', value: 'CameraIcon' },\n { label: 'Chart Bar', value: 'ChartBarIcon' },\n { label: 'Chat Bubble Left Right', value: 'ChatBubbleLeftRightIcon' },\n { label: 'Chat Bubble Left', value: 'ChatBubbleLeftIcon' },\n { label: 'Check Circle', value: 'CheckCircleIcon' },\n { label: 'Check', value: 'CheckIcon' },\n { label: 'Chevron Down', value: 'ChevronDownIcon' },\n { label: 'Chevron Left', value: 'ChevronLeftIcon' },\n { label: 'Chevron Right', value: 'ChevronRightIcon' },\n { label: 'Chevron Up', value: 'ChevronUpIcon' },\n { label: 'Clock', value: 'ClockIcon' },\n { label: 'Cloud Arrow Up', value: 'CloudArrowUpIcon' },\n { label: 'Cloud', value: 'CloudIcon' },\n { label: 'Code Bracket', value: 'CodeBracketIcon' },\n { label: 'Cog', value: 'CogIcon' },\n { label: 'Command Line', value: 'CommandLineIcon' },\n { label: 'Computer Desktop', value: 'ComputerDesktopIcon' },\n { label: 'Credit Card', value: 'CreditCardIcon' },\n { label: 'Document', value: 'DocumentIcon' },\n { label: 'Envelope', value: 'EnvelopeIcon' },\n { label: 'Exclamation Circle', value: 'ExclamationCircleIcon' },\n { label: 'Exclamation Triangle', value: 'ExclamationTriangleIcon' },\n { label: 'Eye', value: 'EyeIcon' },\n { label: 'Face Smile', value: 'FaceSmileIcon' },\n { label: 'Film', value: 'FilmIcon' },\n { label: 'Finger Print', value: 'FingerPrintIcon' },\n { label: 'Fire', value: 'FireIcon' },\n { label: 'Flag', value: 'FlagIcon' },\n { label: 'Folder Open', value: 'FolderOpenIcon' },\n { label: 'Folder', value: 'FolderIcon' },\n { label: 'Gift', value: 'GiftIcon' },\n { label: 'Globe Alt', value: 'GlobeAltIcon' },\n { label: 'Globe Europe Africa', value: 'GlobeEuropeAfricaIcon' },\n { label: 'Hand Raised', value: 'HandRaisedIcon' },\n { label: 'Heart', value: 'HeartIcon' },\n { label: 'Home', value: 'HomeIcon' },\n { label: 'Identification', value: 'IdentificationIcon' },\n { label: 'Information Circle', value: 'InformationCircleIcon' },\n { label: 'Key', value: 'KeyIcon' },\n { label: 'Link', value: 'LinkIcon' },\n { label: 'List Bullet', value: 'ListBulletIcon' },\n { label: 'Lock Closed', value: 'LockClosedIcon' },\n { label: 'Lock Open', value: 'LockOpenIcon' },\n { label: 'Magnifying Glass Circle', value: 'MagnifyingGlassCircleIcon' },\n { label: 'Magnifying Glass', value: 'MagnifyingGlassIcon' },\n { label: 'Map Pin', value: 'MapPinIcon' },\n { label: 'Map', value: 'MapIcon' },\n { label: 'Moon', value: 'MoonIcon' },\n { label: 'Paper Airplane', value: 'PaperAirplaneIcon' },\n { label: 'Paper Clip', value: 'PaperClipIcon' },\n { label: 'Pause Circle', value: 'PauseCircleIcon' },\n { label: 'Pencil Square', value: 'PencilSquareIcon' },\n { label: 'Pencil', value: 'PencilIcon' },\n { label: 'Phone Arrow Up Right', value: 'PhoneArrowUpRightIcon' },\n { label: 'Phone X Mark', value: 'PhoneXMarkIcon' },\n { label: 'Phone', value: 'PhoneIcon' },\n { label: 'Photo', value: 'PhotoIcon' },\n { label: 'Play Circle', value: 'PlayCircleIcon' },\n { label: 'Play', value: 'PlayIcon' },\n { label: 'Plus Circle', value: 'PlusCircleIcon' },\n { label: 'Plus', value: 'PlusIcon' },\n { label: 'Power', value: 'PowerIcon' },\n { label: 'Question Mark Circle', value: 'QuestionMarkCircleIcon' },\n { label: 'Rocket Launch', value: 'RocketLaunchIcon' },\n { label: 'Rss', value: 'RssIcon' },\n { label: 'Scale', value: 'ScaleIcon' },\n { label: 'Server', value: 'ServerIcon' },\n { label: 'Share', value: 'ShareIcon' },\n { label: 'Shield Check', value: 'ShieldCheckIcon' },\n { label: 'Shield Exclamation', value: 'ShieldExclamationIcon' },\n { label: 'Shopping Bag', value: 'ShoppingBagIcon' },\n { label: 'Shopping Cart', value: 'ShoppingCartIcon' },\n { label: 'Star', value: 'StarIcon' },\n { label: 'Stop Circle', value: 'StopCircleIcon' },\n { label: 'Sun', value: 'SunIcon' },\n { label: 'Tag', value: 'TagIcon' },\n { label: 'Trash', value: 'TrashIcon' },\n { label: 'Trophy', value: 'TrophyIcon' },\n { label: 'User Circle', value: 'UserCircleIcon' },\n { label: 'User Group', value: 'UserGroupIcon' },\n { label: 'User', value: 'UserIcon' },\n { label: 'Users', value: 'UsersIcon' },\n { label: 'Video Camera', value: 'VideoCameraIcon' },\n { label: 'Wifi', value: 'WifiIcon' },\n { label: 'Window', value: 'WindowIcon' },\n { label: 'Wrench Screwdriver', value: 'WrenchScrewdriverIcon' },\n { label: 'Wrench', value: 'WrenchIcon' },\n { label: 'X Circle', value: 'XCircleIcon' },\n { label: 'X Mark', value: 'XMarkIcon' },\n]\n","const hexToRgb = (hex: string): { r: number; g: number; b: number } => {\n // Rimuove il simbolo `#` se presente\n const cleanedHex = hex.replace(/^#/, '');\n\n // Controlla che il colore sia valido (3 o 6 caratteri)\n if (!/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(cleanedHex)) {\n throw new Error(`Colore HEX non valido: ${hex}`);\n }\n\n // In caso di formato corto (es. \"FFF\"), lo converte in formato lungo (es. \"FFFFFF\")\n const expandedHex =\n cleanedHex.length === 3\n ? cleanedHex\n .split('')\n .map(char => char + char)\n .join('')\n : cleanedHex;\n\n // Converte il valore HEX in decimali per R, G e B\n const r = parseInt(expandedHex.slice(0, 2), 16);\n const g = parseInt(expandedHex.slice(2, 4), 16);\n const b = parseInt(expandedHex.slice(4, 6), 16);\n\n return { r, g, b };\n};\n\nexport default hexToRgb;","import hexToRgb from '../hexToRgb'\n\nexport function generateCssVars(settings: {\n headingFont?: string\n textFont?: string\n foregroundColor?: string\n primaryColor?: string\n secondaryColor?: string\n accentColor?: string\n darkColor?: string\n lightColor?: string\n}): string {\n // Gestione robusta dei font\n const fontWeights = [300, 400, 500, 600, 700, 800]\n\n const fontsToImport = [settings.headingFont, settings.textFont]\n .filter(Boolean)\n .map((f) => {\n if (!f) return ''\n // Aggiungiamo il parametro wght per specificare i pesi da caricare\n return `@import url('https://fonts.googleapis.com/css2?family=${f.replace(\n / /g,\n '+',\n )}:wght@${fontWeights.join(';')}&display=swap');`\n })\n .join('\\n')\n\n const generateOpacityVariants = (color: string | undefined, name: string): string => {\n if (!color) {\n return ''\n }\n\n try {\n const rgbValue = hexToRgb(color)\n\n if (\n !rgbValue ||\n typeof rgbValue.r !== 'number' ||\n typeof rgbValue.g !== 'number' ||\n typeof rgbValue.b !== 'number'\n ) {\n console.warn(`Impossibile convertire il colore ${name}: ${color}`)\n return ''\n }\n\n const { r, g, b } = rgbValue\n\n const opacityVars = Array.from({ length: 9 }, (_, i) => {\n const opacity = (i + 1) * 10\n return `--color-${name}-${opacity}: rgba(${r}, ${g}, ${b}, ${opacity / 100});`\n }).join('\\n')\n\n return `\n --color-${name}: rgb(${r}, ${g}, ${b}); /* Default (opacità 1) */\n ${opacityVars}\n `\n } catch (error) {\n console.warn(`Errore nella generazione delle varianti di opacità per ${name}: ${error}`)\n return ''\n }\n }\n\n const generateBrightnessVariants = (color: string | undefined, name: string): string => {\n if (!color) {\n return ''\n }\n\n try {\n const rgbValue = hexToRgb(color)\n\n if (\n !rgbValue ||\n typeof rgbValue.r !== 'number' ||\n typeof rgbValue.g !== 'number' ||\n typeof rgbValue.b !== 'number'\n ) {\n console.warn(`Impossibile convertire il colore ${name}: ${color}`)\n return ''\n }\n\n const { r, g, b } = rgbValue\n\n const clamp = (value: number) => Math.max(0, Math.min(255, Math.round(value)))\n\n const mixWith = (target: number, amount: number) =>\n `${clamp(r + (target - r) * amount)},${clamp(\n g + (target - g) * amount,\n )},${clamp(b + (target - b) * amount)}`\n\n const steps = [0.2, 0.4, 0.6, 0.8] // → 20 / 40 / 60 / 80 se vuoi estendere\n const labels = [10, 20, 30, 40]\n\n const lighter = steps\n .map((step, i) => {\n const label = labels[i]\n return `--color-${name}-light-${label}: rgb(${mixWith(255, step)});`\n })\n .join('\\n')\n\n const darker = steps\n .map((step, i) => {\n const label = labels[i]\n return `--color-${name}-dark-${label}: rgb(${mixWith(0, step)});`\n })\n .join('\\n')\n\n return `--color-${name}: rgb(${r}, ${g}, ${b});\n ${lighter}\n ${darker}`\n } catch (error) {\n console.warn(`Errore nella generazione delle varianti di brightness per ${name}: ${error}`)\n return ''\n }\n }\n\n // Genera variabili solo per i colori forniti\n const primaryVars = `${generateOpacityVariants(settings.primaryColor, 'primary')} ${generateBrightnessVariants(settings.primaryColor, 'primary')}`\n const secondaryVars = `${generateOpacityVariants(settings.secondaryColor, 'secondary')} ${generateBrightnessVariants(settings.secondaryColor, 'secondary')}`\n const accentVars = `${generateOpacityVariants(settings.secondaryColor, 'accent')} ${generateBrightnessVariants(settings.secondaryColor, 'accent')}`\n const darkVars = `${generateOpacityVariants(settings.secondaryColor, 'dark')} ${generateBrightnessVariants(settings.secondaryColor, 'dark')}`\n const lightVars = `${generateOpacityVariants(settings.secondaryColor, 'light')} ${generateBrightnessVariants(settings.secondaryColor, 'light')}`\n\n // Genera i valori dei font in modo sicuro\n const headingFontValue = settings.headingFont\n ? `'${settings.headingFont}', sans-serif`\n : 'system-layout, sans-serif'\n\n const textFontValue = settings.textFont\n ? `'${settings.textFont}', sans-serif`\n : 'system-layout, sans-serif'\n\n return `\n ${fontsToImport}\n\n :root {\n --font-heading: ${headingFontValue};\n --font-text: ${textFontValue};\n --color-white: #ffffff;\n --color-black: #000000;\n --color-foreground: ${settings.foregroundColor || '#FFFFFF'};\n ${primaryVars}\n ${secondaryVars}\n ${accentVars}\n ${darkVars}\n ${lightVars}\n }\n `\n}\n","import { BasePayload } from 'payload'\n\nexport async function resolveViewData(payload: BasePayload, layout: any[]) {\n const result: Record<number, any[]> = {}\n\n for (let index = 0; index < layout.length; index++) {\n const block = layout[index]\n\n if (block.blockType !== 'view') continue\n if (!block.useInternalSource || !block.internalCollection) continue\n\n try {\n const data = await payload.find({\n collection: block.internalCollection,\n limit: 100,\n pagination: false,\n where: block.internalWhere || undefined,\n sort: block.internalSort || undefined,\n depth: 9,\n })\n\n result[index] = data.docs ?? []\n } catch (err) {\n console.warn('Errore caricando view-block', index, err)\n result[index] = []\n }\n }\n\n return result\n}\n"],"names":["hexToRgb","hex","cleanedHex","replace","test","Error","expandedHex","length","split","map","char","join","r","parseInt","slice","g","b","settings","fontWeights","fontsToImport","headingFont","textFont","filter","Boolean","f","generateOpacityVariants","color","name","rgbValue","console","warn","opacityVars","Array","from","_","i","opacity","error","generateBrightnessVariants","clamp","value","Math","max","min","round","mixWith","target","amount","steps","labels","lighter","step","label","darker","primaryVars","primaryColor","secondaryVars","secondaryColor","accentVars","darkVars","lightVars","foregroundColor","async","payload","layout","result","index","block","blockType","useInternalSource","internalCollection","data","find","collection","limit","pagination","where","internalWhere","undefined","sort","internalSort","depth","docs","err"],"mappings":"aAAO,MCADA,EAAYC,IAEd,MAAMC,EAAaD,EAAIE,QAAQ,KAAM,IAGrC,IAAK,oCAAoCC,KAAKF,GAC1C,MAAM,IAAIG,MAAM,0BAA0BJ,KAI9C,MAAMK,EACoB,IAAtBJ,EAAWK,OACLL,EACGM,MAAM,IACNC,IAAIC,GAAQA,EAAOA,GACnBC,KAAK,IACRT,EAOV,MAAO,CAAEU,EAJCC,SAASP,EAAYQ,MAAM,EAAG,GAAI,IAIhCC,EAHFF,SAASP,EAAYQ,MAAM,EAAG,GAAI,IAG7BE,EAFLH,SAASP,EAAYQ,MAAM,EAAG,GAAI,8BCnB1C,SAA0BG,GAW9B,MAAMC,EAAc,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,KAExCC,EAAgB,CAACF,EAASG,YAAaH,EAASI,UACnDC,OAAOC,SACPd,IAAKe,GACCA,EAEE,yDAAyDA,EAAErB,QAChE,KACA,aACQe,EAAYP,KAAK,uBALZ,IAOhBA,KAAK,MAEFc,EAA0B,CAACC,EAA2BC,KAC1D,IAAKD,EACH,MAAO,GAGT,IACE,MAAME,EAAW5B,EAAS0B,GAE1B,IACGE,GACqB,iBAAfA,EAAShB,GACM,iBAAfgB,EAASb,GACM,iBAAfa,EAASZ,EAGhB,OADAa,QAAQC,KAAK,oCAAoCH,MAASD,KACnD,GAGT,MAAMd,EAAEA,EAACG,EAAEA,EAACC,EAAEA,GAAMY,EAEdG,EAAcC,MAAMC,KAAK,CAAE1B,OAAQ,GAAK,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AAS,EAClB,CACF,CAEA,OAAOD,CACT"}
@@ -1,2 +1,3 @@
1
1
  export * from './iconsList';
2
2
  export * from './generateCssVars';
3
+ export * from './resolveViewData';
@@ -1,2 +1,2 @@
1
- const e=[{label:"Academic Cap",value:"AcademicCapIcon"},{label:"Adjustments Horizontal",value:"AdjustmentsHorizontalIcon"},{label:"Adjustments Vertical",value:"AdjustmentsVerticalIcon"},{label:"Archive Box Arrow Down",value:"ArchiveBoxArrowDownIcon"},{label:"Archive Box X Mark",value:"ArchiveBoxXMarkIcon"},{label:"Archive Box",value:"ArchiveBoxIcon"},{label:"Arrow Down Circle",value:"ArrowDownCircleIcon"},{label:"Arrow Down",value:"ArrowDownIcon"},{label:"Arrow Left Circle",value:"ArrowLeftCircleIcon"},{label:"Arrow Left",value:"ArrowLeftIcon"},{label:"Arrow Right Circle",value:"ArrowRightCircleIcon"},{label:"Arrow Right",value:"ArrowRightIcon"},{label:"Arrow Up Circle",value:"ArrowUpCircleIcon"},{label:"Arrow Up",value:"ArrowUpIcon"},{label:"Bell Alert",value:"BellAlertIcon"},{label:"Bell",value:"BellIcon"},{label:"Bookmark Square",value:"BookmarkSquareIcon"},{label:"Bookmark",value:"BookmarkIcon"},{label:"Building Office",value:"BuildingOfficeIcon"},{label:"Calendar",value:"CalendarIcon"},{label:"Camera",value:"CameraIcon"},{label:"Chart Bar",value:"ChartBarIcon"},{label:"Chat Bubble Left Right",value:"ChatBubbleLeftRightIcon"},{label:"Chat Bubble Left",value:"ChatBubbleLeftIcon"},{label:"Check Circle",value:"CheckCircleIcon"},{label:"Check",value:"CheckIcon"},{label:"Chevron Down",value:"ChevronDownIcon"},{label:"Chevron Left",value:"ChevronLeftIcon"},{label:"Chevron Right",value:"ChevronRightIcon"},{label:"Chevron Up",value:"ChevronUpIcon"},{label:"Clock",value:"ClockIcon"},{label:"Cloud Arrow Up",value:"CloudArrowUpIcon"},{label:"Cloud",value:"CloudIcon"},{label:"Code Bracket",value:"CodeBracketIcon"},{label:"Cog",value:"CogIcon"},{label:"Command Line",value:"CommandLineIcon"},{label:"Computer Desktop",value:"ComputerDesktopIcon"},{label:"Credit Card",value:"CreditCardIcon"},{label:"Document",value:"DocumentIcon"},{label:"Envelope",value:"EnvelopeIcon"},{label:"Exclamation Circle",value:"ExclamationCircleIcon"},{label:"Exclamation Triangle",value:"ExclamationTriangleIcon"},{label:"Eye",value:"EyeIcon"},{label:"Face Smile",value:"FaceSmileIcon"},{label:"Film",value:"FilmIcon"},{label:"Finger Print",value:"FingerPrintIcon"},{label:"Fire",value:"FireIcon"},{label:"Flag",value:"FlagIcon"},{label:"Folder Open",value:"FolderOpenIcon"},{label:"Folder",value:"FolderIcon"},{label:"Gift",value:"GiftIcon"},{label:"Globe Alt",value:"GlobeAltIcon"},{label:"Globe Europe Africa",value:"GlobeEuropeAfricaIcon"},{label:"Hand Raised",value:"HandRaisedIcon"},{label:"Heart",value:"HeartIcon"},{label:"Home",value:"HomeIcon"},{label:"Identification",value:"IdentificationIcon"},{label:"Information Circle",value:"InformationCircleIcon"},{label:"Key",value:"KeyIcon"},{label:"Link",value:"LinkIcon"},{label:"List Bullet",value:"ListBulletIcon"},{label:"Lock Closed",value:"LockClosedIcon"},{label:"Lock Open",value:"LockOpenIcon"},{label:"Magnifying Glass Circle",value:"MagnifyingGlassCircleIcon"},{label:"Magnifying Glass",value:"MagnifyingGlassIcon"},{label:"Map Pin",value:"MapPinIcon"},{label:"Map",value:"MapIcon"},{label:"Moon",value:"MoonIcon"},{label:"Paper Airplane",value:"PaperAirplaneIcon"},{label:"Paper Clip",value:"PaperClipIcon"},{label:"Pause Circle",value:"PauseCircleIcon"},{label:"Pencil Square",value:"PencilSquareIcon"},{label:"Pencil",value:"PencilIcon"},{label:"Phone Arrow Up Right",value:"PhoneArrowUpRightIcon"},{label:"Phone X Mark",value:"PhoneXMarkIcon"},{label:"Phone",value:"PhoneIcon"},{label:"Photo",value:"PhotoIcon"},{label:"Play Circle",value:"PlayCircleIcon"},{label:"Play",value:"PlayIcon"},{label:"Plus Circle",value:"PlusCircleIcon"},{label:"Plus",value:"PlusIcon"},{label:"Power",value:"PowerIcon"},{label:"Question Mark Circle",value:"QuestionMarkCircleIcon"},{label:"Rocket Launch",value:"RocketLaunchIcon"},{label:"Rss",value:"RssIcon"},{label:"Scale",value:"ScaleIcon"},{label:"Server",value:"ServerIcon"},{label:"Share",value:"ShareIcon"},{label:"Shield Check",value:"ShieldCheckIcon"},{label:"Shield Exclamation",value:"ShieldExclamationIcon"},{label:"Shopping Bag",value:"ShoppingBagIcon"},{label:"Shopping Cart",value:"ShoppingCartIcon"},{label:"Star",value:"StarIcon"},{label:"Stop Circle",value:"StopCircleIcon"},{label:"Sun",value:"SunIcon"},{label:"Tag",value:"TagIcon"},{label:"Trash",value:"TrashIcon"},{label:"Trophy",value:"TrophyIcon"},{label:"User Circle",value:"UserCircleIcon"},{label:"User Group",value:"UserGroupIcon"},{label:"User",value:"UserIcon"},{label:"Users",value:"UsersIcon"},{label:"Video Camera",value:"VideoCameraIcon"},{label:"Wifi",value:"WifiIcon"},{label:"Window",value:"WindowIcon"},{label:"Wrench Screwdriver",value:"WrenchScrewdriverIcon"},{label:"Wrench",value:"WrenchIcon"},{label:"X Circle",value:"XCircleIcon"},{label:"X Mark",value:"XMarkIcon"}],l=e=>{const l=e.replace(/^#/,"");if(!/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(l))throw new Error(`Colore HEX non valido: ${e}`);const a=3===l.length?l.split("").map(e=>e+e).join(""):l;return{r:parseInt(a.slice(0,2),16),g:parseInt(a.slice(2,4),16),b:parseInt(a.slice(4,6),16)}};function a(e){const a=[300,400,500,600,700,800],o=[e.headingFont,e.textFont].filter(Boolean).map(e=>e?`@import url('https://fonts.googleapis.com/css2?family=${e.replace(/ /g,"+")}:wght@${a.join(";")}&display=swap');`:"").join("\n"),n=(e,a)=>{if(!e)return"";try{const o=l(e);if(!o||"number"!=typeof o.r||"number"!=typeof o.g||"number"!=typeof o.b)return console.warn(`Impossibile convertire il colore ${a}: ${e}`),"";const{r:n,g:r,b:c}=o,i=Array.from({length:9},(e,l)=>{const o=10*(l+1);return`--color-${a}-${o}: rgba(${n}, ${r}, ${c}, ${o/100});`}).join("\n");return`\n --color-${a}: rgb(${n}, ${r}, ${c}); /* Default (opacità 1) */\n ${i}\n `}catch(e){return console.warn(`Errore nella generazione delle varianti di opacità per ${a}: ${e}`),""}},r=(e,a)=>{if(!e)return"";try{const o=l(e);if(!o||"number"!=typeof o.r||"number"!=typeof o.g||"number"!=typeof o.b)return console.warn(`Impossibile convertire il colore ${a}: ${e}`),"";const{r:n,g:r,b:c}=o,i=e=>Math.max(0,Math.min(255,Math.round(e))),u=(e,l)=>`${i(n+(e-n)*l)},${i(r+(e-r)*l)},${i(c+(e-c)*l)}`,t=[.2,.4,.6,.8],b=[10,20,30,40],v=t.map((e,l)=>{const o=b[l];return`--color-${a}-light-${o}: rgb(${u(255,e)});`}).join("\n"),I=t.map((e,l)=>{const o=b[l];return`--color-${a}-dark-${o}: rgb(${u(0,e)});`}).join("\n");return`--color-${a}: rgb(${n}, ${r}, ${c});\n ${v}\n ${I}`}catch(e){return console.warn(`Errore nella generazione delle varianti di brightness per ${a}: ${e}`),""}},c=`${n(e.primaryColor,"primary")} ${r(e.primaryColor,"primary")}`,i=`${n(e.secondaryColor,"secondary")} ${r(e.secondaryColor,"secondary")}`,u=`${n(e.secondaryColor,"accent")} ${r(e.secondaryColor,"accent")}`,t=`${n(e.secondaryColor,"dark")} ${r(e.secondaryColor,"dark")}`,b=`${n(e.secondaryColor,"light")} ${r(e.secondaryColor,"light")}`;return`\n ${o}\n\n :root {\n --font-heading: ${e.headingFont?`'${e.headingFont}', sans-serif`:"system-layout, sans-serif"};\n --font-text: ${e.textFont?`'${e.textFont}', sans-serif`:"system-layout, sans-serif"};\n --color-white: #ffffff;\n --color-black: #000000;\n --color-foreground: ${e.foregroundColor||"#FFFFFF"};\n ${c}\n ${i}\n ${u}\n ${t}\n ${b}\n }\n `}export{a as generateCssVars,e as iconsList};
1
+ const e=[{label:"Academic Cap",value:"AcademicCapIcon"},{label:"Adjustments Horizontal",value:"AdjustmentsHorizontalIcon"},{label:"Adjustments Vertical",value:"AdjustmentsVerticalIcon"},{label:"Archive Box Arrow Down",value:"ArchiveBoxArrowDownIcon"},{label:"Archive Box X Mark",value:"ArchiveBoxXMarkIcon"},{label:"Archive Box",value:"ArchiveBoxIcon"},{label:"Arrow Down Circle",value:"ArrowDownCircleIcon"},{label:"Arrow Down",value:"ArrowDownIcon"},{label:"Arrow Left Circle",value:"ArrowLeftCircleIcon"},{label:"Arrow Left",value:"ArrowLeftIcon"},{label:"Arrow Right Circle",value:"ArrowRightCircleIcon"},{label:"Arrow Right",value:"ArrowRightIcon"},{label:"Arrow Up Circle",value:"ArrowUpCircleIcon"},{label:"Arrow Up",value:"ArrowUpIcon"},{label:"Bell Alert",value:"BellAlertIcon"},{label:"Bell",value:"BellIcon"},{label:"Bookmark Square",value:"BookmarkSquareIcon"},{label:"Bookmark",value:"BookmarkIcon"},{label:"Building Office",value:"BuildingOfficeIcon"},{label:"Calendar",value:"CalendarIcon"},{label:"Camera",value:"CameraIcon"},{label:"Chart Bar",value:"ChartBarIcon"},{label:"Chat Bubble Left Right",value:"ChatBubbleLeftRightIcon"},{label:"Chat Bubble Left",value:"ChatBubbleLeftIcon"},{label:"Check Circle",value:"CheckCircleIcon"},{label:"Check",value:"CheckIcon"},{label:"Chevron Down",value:"ChevronDownIcon"},{label:"Chevron Left",value:"ChevronLeftIcon"},{label:"Chevron Right",value:"ChevronRightIcon"},{label:"Chevron Up",value:"ChevronUpIcon"},{label:"Clock",value:"ClockIcon"},{label:"Cloud Arrow Up",value:"CloudArrowUpIcon"},{label:"Cloud",value:"CloudIcon"},{label:"Code Bracket",value:"CodeBracketIcon"},{label:"Cog",value:"CogIcon"},{label:"Command Line",value:"CommandLineIcon"},{label:"Computer Desktop",value:"ComputerDesktopIcon"},{label:"Credit Card",value:"CreditCardIcon"},{label:"Document",value:"DocumentIcon"},{label:"Envelope",value:"EnvelopeIcon"},{label:"Exclamation Circle",value:"ExclamationCircleIcon"},{label:"Exclamation Triangle",value:"ExclamationTriangleIcon"},{label:"Eye",value:"EyeIcon"},{label:"Face Smile",value:"FaceSmileIcon"},{label:"Film",value:"FilmIcon"},{label:"Finger Print",value:"FingerPrintIcon"},{label:"Fire",value:"FireIcon"},{label:"Flag",value:"FlagIcon"},{label:"Folder Open",value:"FolderOpenIcon"},{label:"Folder",value:"FolderIcon"},{label:"Gift",value:"GiftIcon"},{label:"Globe Alt",value:"GlobeAltIcon"},{label:"Globe Europe Africa",value:"GlobeEuropeAfricaIcon"},{label:"Hand Raised",value:"HandRaisedIcon"},{label:"Heart",value:"HeartIcon"},{label:"Home",value:"HomeIcon"},{label:"Identification",value:"IdentificationIcon"},{label:"Information Circle",value:"InformationCircleIcon"},{label:"Key",value:"KeyIcon"},{label:"Link",value:"LinkIcon"},{label:"List Bullet",value:"ListBulletIcon"},{label:"Lock Closed",value:"LockClosedIcon"},{label:"Lock Open",value:"LockOpenIcon"},{label:"Magnifying Glass Circle",value:"MagnifyingGlassCircleIcon"},{label:"Magnifying Glass",value:"MagnifyingGlassIcon"},{label:"Map Pin",value:"MapPinIcon"},{label:"Map",value:"MapIcon"},{label:"Moon",value:"MoonIcon"},{label:"Paper Airplane",value:"PaperAirplaneIcon"},{label:"Paper Clip",value:"PaperClipIcon"},{label:"Pause Circle",value:"PauseCircleIcon"},{label:"Pencil Square",value:"PencilSquareIcon"},{label:"Pencil",value:"PencilIcon"},{label:"Phone Arrow Up Right",value:"PhoneArrowUpRightIcon"},{label:"Phone X Mark",value:"PhoneXMarkIcon"},{label:"Phone",value:"PhoneIcon"},{label:"Photo",value:"PhotoIcon"},{label:"Play Circle",value:"PlayCircleIcon"},{label:"Play",value:"PlayIcon"},{label:"Plus Circle",value:"PlusCircleIcon"},{label:"Plus",value:"PlusIcon"},{label:"Power",value:"PowerIcon"},{label:"Question Mark Circle",value:"QuestionMarkCircleIcon"},{label:"Rocket Launch",value:"RocketLaunchIcon"},{label:"Rss",value:"RssIcon"},{label:"Scale",value:"ScaleIcon"},{label:"Server",value:"ServerIcon"},{label:"Share",value:"ShareIcon"},{label:"Shield Check",value:"ShieldCheckIcon"},{label:"Shield Exclamation",value:"ShieldExclamationIcon"},{label:"Shopping Bag",value:"ShoppingBagIcon"},{label:"Shopping Cart",value:"ShoppingCartIcon"},{label:"Star",value:"StarIcon"},{label:"Stop Circle",value:"StopCircleIcon"},{label:"Sun",value:"SunIcon"},{label:"Tag",value:"TagIcon"},{label:"Trash",value:"TrashIcon"},{label:"Trophy",value:"TrophyIcon"},{label:"User Circle",value:"UserCircleIcon"},{label:"User Group",value:"UserGroupIcon"},{label:"User",value:"UserIcon"},{label:"Users",value:"UsersIcon"},{label:"Video Camera",value:"VideoCameraIcon"},{label:"Wifi",value:"WifiIcon"},{label:"Window",value:"WindowIcon"},{label:"Wrench Screwdriver",value:"WrenchScrewdriverIcon"},{label:"Wrench",value:"WrenchIcon"},{label:"X Circle",value:"XCircleIcon"},{label:"X Mark",value:"XMarkIcon"}],l=e=>{const l=e.replace(/^#/,"");if(!/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(l))throw new Error(`Colore HEX non valido: ${e}`);const a=3===l.length?l.split("").map(e=>e+e).join(""):l;return{r:parseInt(a.slice(0,2),16),g:parseInt(a.slice(2,4),16),b:parseInt(a.slice(4,6),16)}};function a(e){const a=[300,400,500,600,700,800],o=[e.headingFont,e.textFont].filter(Boolean).map(e=>e?`@import url('https://fonts.googleapis.com/css2?family=${e.replace(/ /g,"+")}:wght@${a.join(";")}&display=swap');`:"").join("\n"),n=(e,a)=>{if(!e)return"";try{const o=l(e);if(!o||"number"!=typeof o.r||"number"!=typeof o.g||"number"!=typeof o.b)return console.warn(`Impossibile convertire il colore ${a}: ${e}`),"";const{r:n,g:r,b:c}=o,i=Array.from({length:9},(e,l)=>{const o=10*(l+1);return`--color-${a}-${o}: rgba(${n}, ${r}, ${c}, ${o/100});`}).join("\n");return`\n --color-${a}: rgb(${n}, ${r}, ${c}); /* Default (opacità 1) */\n ${i}\n `}catch(e){return console.warn(`Errore nella generazione delle varianti di opacità per ${a}: ${e}`),""}},r=(e,a)=>{if(!e)return"";try{const o=l(e);if(!o||"number"!=typeof o.r||"number"!=typeof o.g||"number"!=typeof o.b)return console.warn(`Impossibile convertire il colore ${a}: ${e}`),"";const{r:n,g:r,b:c}=o,i=e=>Math.max(0,Math.min(255,Math.round(e))),t=(e,l)=>`${i(n+(e-n)*l)},${i(r+(e-r)*l)},${i(c+(e-c)*l)}`,u=[.2,.4,.6,.8],b=[10,20,30,40],v=u.map((e,l)=>{const o=b[l];return`--color-${a}-light-${o}: rgb(${t(255,e)});`}).join("\n"),I=u.map((e,l)=>{const o=b[l];return`--color-${a}-dark-${o}: rgb(${t(0,e)});`}).join("\n");return`--color-${a}: rgb(${n}, ${r}, ${c});\n ${v}\n ${I}`}catch(e){return console.warn(`Errore nella generazione delle varianti di brightness per ${a}: ${e}`),""}},c=`${n(e.primaryColor,"primary")} ${r(e.primaryColor,"primary")}`,i=`${n(e.secondaryColor,"secondary")} ${r(e.secondaryColor,"secondary")}`,t=`${n(e.secondaryColor,"accent")} ${r(e.secondaryColor,"accent")}`,u=`${n(e.secondaryColor,"dark")} ${r(e.secondaryColor,"dark")}`,b=`${n(e.secondaryColor,"light")} ${r(e.secondaryColor,"light")}`;return`\n ${o}\n\n :root {\n --font-heading: ${e.headingFont?`'${e.headingFont}', sans-serif`:"system-layout, sans-serif"};\n --font-text: ${e.textFont?`'${e.textFont}', sans-serif`:"system-layout, sans-serif"};\n --color-white: #ffffff;\n --color-black: #000000;\n --color-foreground: ${e.foregroundColor||"#FFFFFF"};\n ${c}\n ${i}\n ${t}\n ${u}\n ${b}\n }\n `}async function o(e,l){const a={};for(let o=0;o<l.length;o++){const n=l[o];if("view"===n.blockType&&(n.useInternalSource&&n.internalCollection))try{const l=await e.find({collection:n.internalCollection,limit:100,pagination:!1,where:n.internalWhere||void 0,sort:n.internalSort||void 0,depth:9});a[o]=l.docs??[]}catch(e){console.warn("Errore caricando view-block",o,e),a[o]=[]}}return a}export{a as generateCssVars,e as iconsList,o as resolveViewData};
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/utils/iconsList.ts","../../src/hexToRgb.ts","../../src/utils/generateCssVars.ts"],"sourcesContent":["export const iconsList = [\n { label: 'Academic Cap', value: 'AcademicCapIcon' },\n { label: 'Adjustments Horizontal', value: 'AdjustmentsHorizontalIcon' },\n { label: 'Adjustments Vertical', value: 'AdjustmentsVerticalIcon' },\n { label: 'Archive Box Arrow Down', value: 'ArchiveBoxArrowDownIcon' },\n { label: 'Archive Box X Mark', value: 'ArchiveBoxXMarkIcon' },\n { label: 'Archive Box', value: 'ArchiveBoxIcon' },\n { label: 'Arrow Down Circle', value: 'ArrowDownCircleIcon' },\n { label: 'Arrow Down', value: 'ArrowDownIcon' },\n { label: 'Arrow Left Circle', value: 'ArrowLeftCircleIcon' },\n { label: 'Arrow Left', value: 'ArrowLeftIcon' },\n { label: 'Arrow Right Circle', value: 'ArrowRightCircleIcon' },\n { label: 'Arrow Right', value: 'ArrowRightIcon' },\n { label: 'Arrow Up Circle', value: 'ArrowUpCircleIcon' },\n { label: 'Arrow Up', value: 'ArrowUpIcon' },\n { label: 'Bell Alert', value: 'BellAlertIcon' },\n { label: 'Bell', value: 'BellIcon' },\n { label: 'Bookmark Square', value: 'BookmarkSquareIcon' },\n { label: 'Bookmark', value: 'BookmarkIcon' },\n { label: 'Building Office', value: 'BuildingOfficeIcon' },\n { label: 'Calendar', value: 'CalendarIcon' },\n { label: 'Camera', value: 'CameraIcon' },\n { label: 'Chart Bar', value: 'ChartBarIcon' },\n { label: 'Chat Bubble Left Right', value: 'ChatBubbleLeftRightIcon' },\n { label: 'Chat Bubble Left', value: 'ChatBubbleLeftIcon' },\n { label: 'Check Circle', value: 'CheckCircleIcon' },\n { label: 'Check', value: 'CheckIcon' },\n { label: 'Chevron Down', value: 'ChevronDownIcon' },\n { label: 'Chevron Left', value: 'ChevronLeftIcon' },\n { label: 'Chevron Right', value: 'ChevronRightIcon' },\n { label: 'Chevron Up', value: 'ChevronUpIcon' },\n { label: 'Clock', value: 'ClockIcon' },\n { label: 'Cloud Arrow Up', value: 'CloudArrowUpIcon' },\n { label: 'Cloud', value: 'CloudIcon' },\n { label: 'Code Bracket', value: 'CodeBracketIcon' },\n { label: 'Cog', value: 'CogIcon' },\n { label: 'Command Line', value: 'CommandLineIcon' },\n { label: 'Computer Desktop', value: 'ComputerDesktopIcon' },\n { label: 'Credit Card', value: 'CreditCardIcon' },\n { label: 'Document', value: 'DocumentIcon' },\n { label: 'Envelope', value: 'EnvelopeIcon' },\n { label: 'Exclamation Circle', value: 'ExclamationCircleIcon' },\n { label: 'Exclamation Triangle', value: 'ExclamationTriangleIcon' },\n { label: 'Eye', value: 'EyeIcon' },\n { label: 'Face Smile', value: 'FaceSmileIcon' },\n { label: 'Film', value: 'FilmIcon' },\n { label: 'Finger Print', value: 'FingerPrintIcon' },\n { label: 'Fire', value: 'FireIcon' },\n { label: 'Flag', value: 'FlagIcon' },\n { label: 'Folder Open', value: 'FolderOpenIcon' },\n { label: 'Folder', value: 'FolderIcon' },\n { label: 'Gift', value: 'GiftIcon' },\n { label: 'Globe Alt', value: 'GlobeAltIcon' },\n { label: 'Globe Europe Africa', value: 'GlobeEuropeAfricaIcon' },\n { label: 'Hand Raised', value: 'HandRaisedIcon' },\n { label: 'Heart', value: 'HeartIcon' },\n { label: 'Home', value: 'HomeIcon' },\n { label: 'Identification', value: 'IdentificationIcon' },\n { label: 'Information Circle', value: 'InformationCircleIcon' },\n { label: 'Key', value: 'KeyIcon' },\n { label: 'Link', value: 'LinkIcon' },\n { label: 'List Bullet', value: 'ListBulletIcon' },\n { label: 'Lock Closed', value: 'LockClosedIcon' },\n { label: 'Lock Open', value: 'LockOpenIcon' },\n { label: 'Magnifying Glass Circle', value: 'MagnifyingGlassCircleIcon' },\n { label: 'Magnifying Glass', value: 'MagnifyingGlassIcon' },\n { label: 'Map Pin', value: 'MapPinIcon' },\n { label: 'Map', value: 'MapIcon' },\n { label: 'Moon', value: 'MoonIcon' },\n { label: 'Paper Airplane', value: 'PaperAirplaneIcon' },\n { label: 'Paper Clip', value: 'PaperClipIcon' },\n { label: 'Pause Circle', value: 'PauseCircleIcon' },\n { label: 'Pencil Square', value: 'PencilSquareIcon' },\n { label: 'Pencil', value: 'PencilIcon' },\n { label: 'Phone Arrow Up Right', value: 'PhoneArrowUpRightIcon' },\n { label: 'Phone X Mark', value: 'PhoneXMarkIcon' },\n { label: 'Phone', value: 'PhoneIcon' },\n { label: 'Photo', value: 'PhotoIcon' },\n { label: 'Play Circle', value: 'PlayCircleIcon' },\n { label: 'Play', value: 'PlayIcon' },\n { label: 'Plus Circle', value: 'PlusCircleIcon' },\n { label: 'Plus', value: 'PlusIcon' },\n { label: 'Power', value: 'PowerIcon' },\n { label: 'Question Mark Circle', value: 'QuestionMarkCircleIcon' },\n { label: 'Rocket Launch', value: 'RocketLaunchIcon' },\n { label: 'Rss', value: 'RssIcon' },\n { label: 'Scale', value: 'ScaleIcon' },\n { label: 'Server', value: 'ServerIcon' },\n { label: 'Share', value: 'ShareIcon' },\n { label: 'Shield Check', value: 'ShieldCheckIcon' },\n { label: 'Shield Exclamation', value: 'ShieldExclamationIcon' },\n { label: 'Shopping Bag', value: 'ShoppingBagIcon' },\n { label: 'Shopping Cart', value: 'ShoppingCartIcon' },\n { label: 'Star', value: 'StarIcon' },\n { label: 'Stop Circle', value: 'StopCircleIcon' },\n { label: 'Sun', value: 'SunIcon' },\n { label: 'Tag', value: 'TagIcon' },\n { label: 'Trash', value: 'TrashIcon' },\n { label: 'Trophy', value: 'TrophyIcon' },\n { label: 'User Circle', value: 'UserCircleIcon' },\n { label: 'User Group', value: 'UserGroupIcon' },\n { label: 'User', value: 'UserIcon' },\n { label: 'Users', value: 'UsersIcon' },\n { label: 'Video Camera', value: 'VideoCameraIcon' },\n { label: 'Wifi', value: 'WifiIcon' },\n { label: 'Window', value: 'WindowIcon' },\n { label: 'Wrench Screwdriver', value: 'WrenchScrewdriverIcon' },\n { label: 'Wrench', value: 'WrenchIcon' },\n { label: 'X Circle', value: 'XCircleIcon' },\n { label: 'X Mark', value: 'XMarkIcon' },\n]\n","const hexToRgb = (hex: string): { r: number; g: number; b: number } => {\n // Rimuove il simbolo `#` se presente\n const cleanedHex = hex.replace(/^#/, '');\n\n // Controlla che il colore sia valido (3 o 6 caratteri)\n if (!/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(cleanedHex)) {\n throw new Error(`Colore HEX non valido: ${hex}`);\n }\n\n // In caso di formato corto (es. \"FFF\"), lo converte in formato lungo (es. \"FFFFFF\")\n const expandedHex =\n cleanedHex.length === 3\n ? cleanedHex\n .split('')\n .map(char => char + char)\n .join('')\n : cleanedHex;\n\n // Converte il valore HEX in decimali per R, G e B\n const r = parseInt(expandedHex.slice(0, 2), 16);\n const g = parseInt(expandedHex.slice(2, 4), 16);\n const b = parseInt(expandedHex.slice(4, 6), 16);\n\n return { r, g, b };\n};\n\nexport default hexToRgb;","import hexToRgb from '../hexToRgb'\n\nexport function generateCssVars(settings: {\n headingFont?: string\n textFont?: string\n foregroundColor?: string\n primaryColor?: string\n secondaryColor?: string\n accentColor?: string\n darkColor?: string\n lightColor?: string\n}): string {\n // Gestione robusta dei font\n const fontWeights = [300, 400, 500, 600, 700, 800]\n\n const fontsToImport = [settings.headingFont, settings.textFont]\n .filter(Boolean)\n .map((f) => {\n if (!f) return ''\n // Aggiungiamo il parametro wght per specificare i pesi da caricare\n return `@import url('https://fonts.googleapis.com/css2?family=${f.replace(\n / /g,\n '+',\n )}:wght@${fontWeights.join(';')}&display=swap');`\n })\n .join('\\n')\n\n const generateOpacityVariants = (color: string | undefined, name: string): string => {\n if (!color) {\n return ''\n }\n\n try {\n const rgbValue = hexToRgb(color)\n\n if (\n !rgbValue ||\n typeof rgbValue.r !== 'number' ||\n typeof rgbValue.g !== 'number' ||\n typeof rgbValue.b !== 'number'\n ) {\n console.warn(`Impossibile convertire il colore ${name}: ${color}`)\n return ''\n }\n\n const { r, g, b } = rgbValue\n\n const opacityVars = Array.from({ length: 9 }, (_, i) => {\n const opacity = (i + 1) * 10\n return `--color-${name}-${opacity}: rgba(${r}, ${g}, ${b}, ${opacity / 100});`\n }).join('\\n')\n\n return `\n --color-${name}: rgb(${r}, ${g}, ${b}); /* Default (opacità 1) */\n ${opacityVars}\n `\n } catch (error) {\n console.warn(`Errore nella generazione delle varianti di opacità per ${name}: ${error}`)\n return ''\n }\n }\n\n const generateBrightnessVariants = (color: string | undefined, name: string): string => {\n if (!color) {\n return ''\n }\n\n try {\n const rgbValue = hexToRgb(color)\n\n if (\n !rgbValue ||\n typeof rgbValue.r !== 'number' ||\n typeof rgbValue.g !== 'number' ||\n typeof rgbValue.b !== 'number'\n ) {\n console.warn(`Impossibile convertire il colore ${name}: ${color}`)\n return ''\n }\n\n const { r, g, b } = rgbValue\n\n const clamp = (value: number) => Math.max(0, Math.min(255, Math.round(value)))\n\n const mixWith = (target: number, amount: number) =>\n `${clamp(r + (target - r) * amount)},${clamp(\n g + (target - g) * amount,\n )},${clamp(b + (target - b) * amount)}`\n\n const steps = [0.2, 0.4, 0.6, 0.8] // → 20 / 40 / 60 / 80 se vuoi estendere\n const labels = [10, 20, 30, 40]\n\n const lighter = steps\n .map((step, i) => {\n const label = labels[i]\n return `--color-${name}-light-${label}: rgb(${mixWith(255, step)});`\n })\n .join('\\n')\n\n const darker = steps\n .map((step, i) => {\n const label = labels[i]\n return `--color-${name}-dark-${label}: rgb(${mixWith(0, step)});`\n })\n .join('\\n')\n\n return `--color-${name}: rgb(${r}, ${g}, ${b});\n ${lighter}\n ${darker}`\n } catch (error) {\n console.warn(`Errore nella generazione delle varianti di brightness per ${name}: ${error}`)\n return ''\n }\n }\n\n // Genera variabili solo per i colori forniti\n const primaryVars = `${generateOpacityVariants(settings.primaryColor, 'primary')} ${generateBrightnessVariants(settings.primaryColor, 'primary')}`\n const secondaryVars = `${generateOpacityVariants(settings.secondaryColor, 'secondary')} ${generateBrightnessVariants(settings.secondaryColor, 'secondary')}`\n const accentVars = `${generateOpacityVariants(settings.secondaryColor, 'accent')} ${generateBrightnessVariants(settings.secondaryColor, 'accent')}`\n const darkVars = `${generateOpacityVariants(settings.secondaryColor, 'dark')} ${generateBrightnessVariants(settings.secondaryColor, 'dark')}`\n const lightVars = `${generateOpacityVariants(settings.secondaryColor, 'light')} ${generateBrightnessVariants(settings.secondaryColor, 'light')}`\n\n // Genera i valori dei font in modo sicuro\n const headingFontValue = settings.headingFont\n ? `'${settings.headingFont}', sans-serif`\n : 'system-layout, sans-serif'\n\n const textFontValue = settings.textFont\n ? `'${settings.textFont}', sans-serif`\n : 'system-layout, sans-serif'\n\n return `\n ${fontsToImport}\n\n :root {\n --font-heading: ${headingFontValue};\n --font-text: ${textFontValue};\n --color-white: #ffffff;\n --color-black: #000000;\n --color-foreground: ${settings.foregroundColor || '#FFFFFF'};\n ${primaryVars}\n ${secondaryVars}\n ${accentVars}\n ${darkVars}\n ${lightVars}\n }\n `\n}\n"],"names":["iconsList","label","value","hexToRgb","hex","cleanedHex","replace","test","Error","expandedHex","length","split","map","char","join","r","parseInt","slice","g","b","generateCssVars","settings","fontWeights","fontsToImport","headingFont","textFont","filter","Boolean","f","generateOpacityVariants","color","name","rgbValue","console","warn","opacityVars","Array","from","_","i","opacity","error","generateBrightnessVariants","clamp","Math","max","min","round","mixWith","target","amount","steps","labels","lighter","step","darker","primaryVars","primaryColor","secondaryVars","secondaryColor","accentVars","darkVars","lightVars","foregroundColor"],"mappings":"AAAO,MAAMA,EAAY,CACvB,CAAEC,MAAO,eAAgBC,MAAO,mBAChC,CAAED,MAAO,yBAA0BC,MAAO,6BAC1C,CAAED,MAAO,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,IAAIJ,EAASI,wBACb,yHAUsBJ,EAAS0C,iBAAmB,qBAChDP,YACAE,YACAE,YACAC,YACAC,cAGR"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../src/utils/iconsList.ts","../../src/hexToRgb.ts","../../src/utils/generateCssVars.ts","../../src/utils/resolveViewData.ts"],"sourcesContent":["export const iconsList = [\n { label: 'Academic Cap', value: 'AcademicCapIcon' },\n { label: 'Adjustments Horizontal', value: 'AdjustmentsHorizontalIcon' },\n { label: 'Adjustments Vertical', value: 'AdjustmentsVerticalIcon' },\n { label: 'Archive Box Arrow Down', value: 'ArchiveBoxArrowDownIcon' },\n { label: 'Archive Box X Mark', value: 'ArchiveBoxXMarkIcon' },\n { label: 'Archive Box', value: 'ArchiveBoxIcon' },\n { label: 'Arrow Down Circle', value: 'ArrowDownCircleIcon' },\n { label: 'Arrow Down', value: 'ArrowDownIcon' },\n { label: 'Arrow Left Circle', value: 'ArrowLeftCircleIcon' },\n { label: 'Arrow Left', value: 'ArrowLeftIcon' },\n { label: 'Arrow Right Circle', value: 'ArrowRightCircleIcon' },\n { label: 'Arrow Right', value: 'ArrowRightIcon' },\n { label: 'Arrow Up Circle', value: 'ArrowUpCircleIcon' },\n { label: 'Arrow Up', value: 'ArrowUpIcon' },\n { label: 'Bell Alert', value: 'BellAlertIcon' },\n { label: 'Bell', value: 'BellIcon' },\n { label: 'Bookmark Square', value: 'BookmarkSquareIcon' },\n { label: 'Bookmark', value: 'BookmarkIcon' },\n { label: 'Building Office', value: 'BuildingOfficeIcon' },\n { label: 'Calendar', value: 'CalendarIcon' },\n { label: 'Camera', value: 'CameraIcon' },\n { label: 'Chart Bar', value: 'ChartBarIcon' },\n { label: 'Chat Bubble Left Right', value: 'ChatBubbleLeftRightIcon' },\n { label: 'Chat Bubble Left', value: 'ChatBubbleLeftIcon' },\n { label: 'Check Circle', value: 'CheckCircleIcon' },\n { label: 'Check', value: 'CheckIcon' },\n { label: 'Chevron Down', value: 'ChevronDownIcon' },\n { label: 'Chevron Left', value: 'ChevronLeftIcon' },\n { label: 'Chevron Right', value: 'ChevronRightIcon' },\n { label: 'Chevron Up', value: 'ChevronUpIcon' },\n { label: 'Clock', value: 'ClockIcon' },\n { label: 'Cloud Arrow Up', value: 'CloudArrowUpIcon' },\n { label: 'Cloud', value: 'CloudIcon' },\n { label: 'Code Bracket', value: 'CodeBracketIcon' },\n { label: 'Cog', value: 'CogIcon' },\n { label: 'Command Line', value: 'CommandLineIcon' },\n { label: 'Computer Desktop', value: 'ComputerDesktopIcon' },\n { label: 'Credit Card', value: 'CreditCardIcon' },\n { label: 'Document', value: 'DocumentIcon' },\n { label: 'Envelope', value: 'EnvelopeIcon' },\n { label: 'Exclamation Circle', value: 'ExclamationCircleIcon' },\n { label: 'Exclamation Triangle', value: 'ExclamationTriangleIcon' },\n { label: 'Eye', value: 'EyeIcon' },\n { label: 'Face Smile', value: 'FaceSmileIcon' },\n { label: 'Film', value: 'FilmIcon' },\n { label: 'Finger Print', value: 'FingerPrintIcon' },\n { label: 'Fire', value: 'FireIcon' },\n { label: 'Flag', value: 'FlagIcon' },\n { label: 'Folder Open', value: 'FolderOpenIcon' },\n { label: 'Folder', value: 'FolderIcon' },\n { label: 'Gift', value: 'GiftIcon' },\n { label: 'Globe Alt', value: 'GlobeAltIcon' },\n { label: 'Globe Europe Africa', value: 'GlobeEuropeAfricaIcon' },\n { label: 'Hand Raised', value: 'HandRaisedIcon' },\n { label: 'Heart', value: 'HeartIcon' },\n { label: 'Home', value: 'HomeIcon' },\n { label: 'Identification', value: 'IdentificationIcon' },\n { label: 'Information Circle', value: 'InformationCircleIcon' },\n { label: 'Key', value: 'KeyIcon' },\n { label: 'Link', value: 'LinkIcon' },\n { label: 'List Bullet', value: 'ListBulletIcon' },\n { label: 'Lock Closed', value: 'LockClosedIcon' },\n { label: 'Lock Open', value: 'LockOpenIcon' },\n { label: 'Magnifying Glass Circle', value: 'MagnifyingGlassCircleIcon' },\n { label: 'Magnifying Glass', value: 'MagnifyingGlassIcon' },\n { label: 'Map Pin', value: 'MapPinIcon' },\n { label: 'Map', value: 'MapIcon' },\n { label: 'Moon', value: 'MoonIcon' },\n { label: 'Paper Airplane', value: 'PaperAirplaneIcon' },\n { label: 'Paper Clip', value: 'PaperClipIcon' },\n { label: 'Pause Circle', value: 'PauseCircleIcon' },\n { label: 'Pencil Square', value: 'PencilSquareIcon' },\n { label: 'Pencil', value: 'PencilIcon' },\n { label: 'Phone Arrow Up Right', value: 'PhoneArrowUpRightIcon' },\n { label: 'Phone X Mark', value: 'PhoneXMarkIcon' },\n { label: 'Phone', value: 'PhoneIcon' },\n { label: 'Photo', value: 'PhotoIcon' },\n { label: 'Play Circle', value: 'PlayCircleIcon' },\n { label: 'Play', value: 'PlayIcon' },\n { label: 'Plus Circle', value: 'PlusCircleIcon' },\n { label: 'Plus', value: 'PlusIcon' },\n { label: 'Power', value: 'PowerIcon' },\n { label: 'Question Mark Circle', value: 'QuestionMarkCircleIcon' },\n { label: 'Rocket Launch', value: 'RocketLaunchIcon' },\n { label: 'Rss', value: 'RssIcon' },\n { label: 'Scale', value: 'ScaleIcon' },\n { label: 'Server', value: 'ServerIcon' },\n { label: 'Share', value: 'ShareIcon' },\n { label: 'Shield Check', value: 'ShieldCheckIcon' },\n { label: 'Shield Exclamation', value: 'ShieldExclamationIcon' },\n { label: 'Shopping Bag', value: 'ShoppingBagIcon' },\n { label: 'Shopping Cart', value: 'ShoppingCartIcon' },\n { label: 'Star', value: 'StarIcon' },\n { label: 'Stop Circle', value: 'StopCircleIcon' },\n { label: 'Sun', value: 'SunIcon' },\n { label: 'Tag', value: 'TagIcon' },\n { label: 'Trash', value: 'TrashIcon' },\n { label: 'Trophy', value: 'TrophyIcon' },\n { label: 'User Circle', value: 'UserCircleIcon' },\n { label: 'User Group', value: 'UserGroupIcon' },\n { label: 'User', value: 'UserIcon' },\n { label: 'Users', value: 'UsersIcon' },\n { label: 'Video Camera', value: 'VideoCameraIcon' },\n { label: 'Wifi', value: 'WifiIcon' },\n { label: 'Window', value: 'WindowIcon' },\n { label: 'Wrench Screwdriver', value: 'WrenchScrewdriverIcon' },\n { label: 'Wrench', value: 'WrenchIcon' },\n { label: 'X Circle', value: 'XCircleIcon' },\n { label: 'X Mark', value: 'XMarkIcon' },\n]\n","const hexToRgb = (hex: string): { r: number; g: number; b: number } => {\n // Rimuove il simbolo `#` se presente\n const cleanedHex = hex.replace(/^#/, '');\n\n // Controlla che il colore sia valido (3 o 6 caratteri)\n if (!/^([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/.test(cleanedHex)) {\n throw new Error(`Colore HEX non valido: ${hex}`);\n }\n\n // In caso di formato corto (es. \"FFF\"), lo converte in formato lungo (es. \"FFFFFF\")\n const expandedHex =\n cleanedHex.length === 3\n ? cleanedHex\n .split('')\n .map(char => char + char)\n .join('')\n : cleanedHex;\n\n // Converte il valore HEX in decimali per R, G e B\n const r = parseInt(expandedHex.slice(0, 2), 16);\n const g = parseInt(expandedHex.slice(2, 4), 16);\n const b = parseInt(expandedHex.slice(4, 6), 16);\n\n return { r, g, b };\n};\n\nexport default hexToRgb;","import hexToRgb from '../hexToRgb'\n\nexport function generateCssVars(settings: {\n headingFont?: string\n textFont?: string\n foregroundColor?: string\n primaryColor?: string\n secondaryColor?: string\n accentColor?: string\n darkColor?: string\n lightColor?: string\n}): string {\n // Gestione robusta dei font\n const fontWeights = [300, 400, 500, 600, 700, 800]\n\n const fontsToImport = [settings.headingFont, settings.textFont]\n .filter(Boolean)\n .map((f) => {\n if (!f) return ''\n // Aggiungiamo il parametro wght per specificare i pesi da caricare\n return `@import url('https://fonts.googleapis.com/css2?family=${f.replace(\n / /g,\n '+',\n )}:wght@${fontWeights.join(';')}&display=swap');`\n })\n .join('\\n')\n\n const generateOpacityVariants = (color: string | undefined, name: string): string => {\n if (!color) {\n return ''\n }\n\n try {\n const rgbValue = hexToRgb(color)\n\n if (\n !rgbValue ||\n typeof rgbValue.r !== 'number' ||\n typeof rgbValue.g !== 'number' ||\n typeof rgbValue.b !== 'number'\n ) {\n console.warn(`Impossibile convertire il colore ${name}: ${color}`)\n return ''\n }\n\n const { r, g, b } = rgbValue\n\n const opacityVars = Array.from({ length: 9 }, (_, i) => {\n const opacity = (i + 1) * 10\n return `--color-${name}-${opacity}: rgba(${r}, ${g}, ${b}, ${opacity / 100});`\n }).join('\\n')\n\n return `\n --color-${name}: rgb(${r}, ${g}, ${b}); /* Default (opacità 1) */\n ${opacityVars}\n `\n } catch (error) {\n console.warn(`Errore nella generazione delle varianti di opacità per ${name}: ${error}`)\n return ''\n }\n }\n\n const generateBrightnessVariants = (color: string | undefined, name: string): string => {\n if (!color) {\n return ''\n }\n\n try {\n const rgbValue = hexToRgb(color)\n\n if (\n !rgbValue ||\n typeof rgbValue.r !== 'number' ||\n typeof rgbValue.g !== 'number' ||\n typeof rgbValue.b !== 'number'\n ) {\n console.warn(`Impossibile convertire il colore ${name}: ${color}`)\n return ''\n }\n\n const { r, g, b } = rgbValue\n\n const clamp = (value: number) => Math.max(0, Math.min(255, Math.round(value)))\n\n const mixWith = (target: number, amount: number) =>\n `${clamp(r + (target - r) * amount)},${clamp(\n g + (target - g) * amount,\n )},${clamp(b + (target - b) * amount)}`\n\n const steps = [0.2, 0.4, 0.6, 0.8] // → 20 / 40 / 60 / 80 se vuoi estendere\n const labels = [10, 20, 30, 40]\n\n const lighter = steps\n .map((step, i) => {\n const label = labels[i]\n return `--color-${name}-light-${label}: rgb(${mixWith(255, step)});`\n })\n .join('\\n')\n\n const darker = steps\n .map((step, i) => {\n const label = labels[i]\n return `--color-${name}-dark-${label}: rgb(${mixWith(0, step)});`\n })\n .join('\\n')\n\n return `--color-${name}: rgb(${r}, ${g}, ${b});\n ${lighter}\n ${darker}`\n } catch (error) {\n console.warn(`Errore nella generazione delle varianti di brightness per ${name}: ${error}`)\n return ''\n }\n }\n\n // Genera variabili solo per i colori forniti\n const primaryVars = `${generateOpacityVariants(settings.primaryColor, 'primary')} ${generateBrightnessVariants(settings.primaryColor, 'primary')}`\n const secondaryVars = `${generateOpacityVariants(settings.secondaryColor, 'secondary')} ${generateBrightnessVariants(settings.secondaryColor, 'secondary')}`\n const accentVars = `${generateOpacityVariants(settings.secondaryColor, 'accent')} ${generateBrightnessVariants(settings.secondaryColor, 'accent')}`\n const darkVars = `${generateOpacityVariants(settings.secondaryColor, 'dark')} ${generateBrightnessVariants(settings.secondaryColor, 'dark')}`\n const lightVars = `${generateOpacityVariants(settings.secondaryColor, 'light')} ${generateBrightnessVariants(settings.secondaryColor, 'light')}`\n\n // Genera i valori dei font in modo sicuro\n const headingFontValue = settings.headingFont\n ? `'${settings.headingFont}', sans-serif`\n : 'system-layout, sans-serif'\n\n const textFontValue = settings.textFont\n ? `'${settings.textFont}', sans-serif`\n : 'system-layout, sans-serif'\n\n return `\n ${fontsToImport}\n\n :root {\n --font-heading: ${headingFontValue};\n --font-text: ${textFontValue};\n --color-white: #ffffff;\n --color-black: #000000;\n --color-foreground: ${settings.foregroundColor || '#FFFFFF'};\n ${primaryVars}\n ${secondaryVars}\n ${accentVars}\n ${darkVars}\n ${lightVars}\n }\n `\n}\n","import { BasePayload } from 'payload'\n\nexport async function resolveViewData(payload: BasePayload, layout: any[]) {\n const result: Record<number, any[]> = {}\n\n for (let index = 0; index < layout.length; index++) {\n const block = layout[index]\n\n if (block.blockType !== 'view') continue\n if (!block.useInternalSource || !block.internalCollection) continue\n\n try {\n const data = await payload.find({\n collection: block.internalCollection,\n limit: 100,\n pagination: false,\n where: block.internalWhere || undefined,\n sort: block.internalSort || undefined,\n depth: 9,\n })\n\n result[index] = data.docs ?? []\n } catch (err) {\n console.warn('Errore caricando view-block', index, err)\n result[index] = []\n }\n }\n\n return result\n}\n"],"names":["iconsList","label","value","hexToRgb","hex","cleanedHex","replace","test","Error","expandedHex","length","split","map","char","join","r","parseInt","slice","g","b","generateCssVars","settings","fontWeights","fontsToImport","headingFont","textFont","filter","Boolean","f","generateOpacityVariants","color","name","rgbValue","console","warn","opacityVars","Array","from","_","i","opacity","error","generateBrightnessVariants","clamp","Math","max","min","round","mixWith","target","amount","steps","labels","lighter","step","darker","primaryVars","primaryColor","secondaryVars","secondaryColor","accentVars","darkVars","lightVars","foregroundColor","async","resolveViewData","payload","layout","result","index","block","blockType","useInternalSource","internalCollection","data","find","collection","limit","pagination","where","internalWhere","undefined","sort","internalSort","depth","docs","err"],"mappings":"AAAO,MAAMA,EAAY,CACvB,CAAEC,MAAO,eAAgBC,MAAO,mBAChC,CAAED,MAAO,yBAA0BC,MAAO,6BAC1C,CAAED,MAAO,uBAAwBC,MAAO,2BACxC,CAAED,MAAO,yBAA0BC,MAAO,2BAC1C,CAAED,MAAO,qBAAsBC,MAAO,uBACtC,CAAED,MAAO,cAAeC,MAAO,kBAC/B,CAAED,MAAO,oBAAqBC,MAAO,uBACrC,CAAED,MAAO,aAAcC,MAAO,iBAC9B,CAAED,MAAO,oBAAqBC,MAAO,uBACrC,CAAED,MAAO,aAAcC,MAAO,iBAC9B,CAAED,MAAO,qBAAsBC,MAAO,wBACtC,CAAED,MAAO,cAAeC,MAAO,kBAC/B,CAAED,MAAO,kBAAmBC,MAAO,qBACnC,CAAED,MAAO,WAAYC,MAAO,eAC5B,CAAED,MAAO,aAAcC,MAAO,iBAC9B,CAAED,MAAO,OAAQC,MAAO,YACxB,CAAED,MAAO,kBAAmBC,MAAO,sBACnC,CAAED,MAAO,WAAYC,MAAO,gBAC5B,CAAED,MAAO,kBAAmBC,MAAO,sBACnC,CAAED,MAAO,WAAYC,MAAO,gBAC5B,CAAED,MAAO,SAAUC,MAAO,cAC1B,CAAED,MAAO,YAAaC,MAAO,gBAC7B,CAAED,MAAO,yBAA0BC,MAAO,2BAC1C,CAAED,MAAO,mBAAoBC,MAAO,sBACpC,CAAED,MAAO,eAAgBC,MAAO,mBAChC,CAAED,MAAO,QAASC,MAAO,aACzB,CAAED,MAAO,eAAgBC,MAAO,mBAChC,CAAED,MAAO,eAAgBC,MAAO,mBAChC,CAAED,MA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gB,gBAAgBjB,EAA2BrB,EAASsC,eAAgB,eACxIC,EAAa,GAAG/B,EAAwBR,EAASsC,eAAgB,aAAajB,EAA2BrB,EAASsC,eAAgB,YAClIE,EAAW,GAAGhC,EAAwBR,EAASsC,eAAgB,WAAWjB,EAA2BrB,EAASsC,eAAgB,UAC9HG,EAAY,GAAGjC,EAAwBR,EAASsC,eAAgB,YAAYjB,EAA2BrB,EAASsC,eAAgB,WAWtI,MAAO,SACHpC,2CATqBF,EAASG,YAC9B,IAAIH,EAASG,2BACb,oDAEkBH,EAASI,SAC3B,IAAIJ,EAASI,wBACb,yHAUsBJ,EAAS0C,iBAAmB,qBAChDP,YACAE,YACAE,YACAC,YACAC,cAGR,CCjJOE,eAAeC,EAAgBC,EAAsBC,GAC1D,MAAMC,EAAgC,CAAA,EAEtC,IAAK,IAAIC,EAAQ,EAAGA,EAAQF,EAAOzD,OAAQ2D,IAAS,CAClD,MAAMC,EAAQH,EAAOE,GAErB,GAAwB,SAApBC,EAAMC,YACLD,EAAME,mBAAsBF,EAAMG,oBAEvC,IACE,MAAMC,QAAaR,EAAQS,KAAK,CAC9BC,WAAYN,EAAMG,mBAClBI,MAAO,IACPC,YAAY,EACZC,MAAOT,EAAMU,oBAAiBC,EAC9BC,KAAMZ,EAAMa,mBAAgBF,EAC5BG,MAAO,IAGThB,EAAOC,GAASK,EAAKW,MAAQ,EAC/B,CAAE,MAAOC,GACPrD,QAAQC,KAAK,8BAA+BmC,EAAOiB,GACnDlB,EAAOC,GAAS,EAClB,CACF,CAEA,OAAOD,CACT"}
@@ -1,2 +1,3 @@
1
1
  export * from './iconsList';
2
2
  export * from './generateCssVars';
3
+ export * from './resolveViewData';
@@ -0,0 +1,2 @@
1
+ import { BasePayload } from 'payload';
2
+ export declare function resolveViewData(payload: BasePayload, layout: any[]): Promise<Record<number, any[]>>;
@@ -0,0 +1,26 @@
1
+ export async function resolveViewData(payload, layout) {
2
+ const result = {};
3
+ for (let index = 0; index < layout.length; index++) {
4
+ const block = layout[index];
5
+ if (block.blockType !== 'view')
6
+ continue;
7
+ if (!block.useInternalSource || !block.internalCollection)
8
+ continue;
9
+ try {
10
+ const data = await payload.find({
11
+ collection: block.internalCollection,
12
+ limit: 100,
13
+ pagination: false,
14
+ where: block.internalWhere || undefined,
15
+ sort: block.internalSort || undefined,
16
+ depth: 9,
17
+ });
18
+ result[index] = data.docs ?? [];
19
+ }
20
+ catch (err) {
21
+ console.warn('Errore caricando view-block', index, err);
22
+ result[index] = [];
23
+ }
24
+ }
25
+ return result;
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woodylab/payload",
3
- "version": "0.0.123",
3
+ "version": "0.0.126",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes