lib-pixelbuild 0.2.0 → 0.2.2

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.
Files changed (59) hide show
  1. package/dist/builders/PageBuilder.js +7 -3
  2. package/dist/components/ButtonsComponent.d.ts +5 -0
  3. package/dist/components/ButtonsComponent.js +44 -0
  4. package/dist/components/CardComponent.js +31 -6
  5. package/dist/components/FormComponent.js +8 -4
  6. package/dist/components/{CarouselComponent.d.ts → ImageComponent.d.ts} +3 -2
  7. package/dist/components/ImageComponent.js +17 -0
  8. package/dist/components/ListComponent.js +5 -1
  9. package/dist/components/MapComponent.js +4 -4
  10. package/dist/components/SliderComponent.d.ts +1 -2
  11. package/dist/components/SliderComponent.js +175 -93
  12. package/dist/components/SocialIconsComponent.d.ts +3 -2
  13. package/dist/components/SocialIconsComponent.js +20 -15
  14. package/dist/components/TextComponent.js +3 -2
  15. package/dist/constants/ComponentEnum.d.ts +1 -0
  16. package/dist/constants/ComponentEnum.js +1 -0
  17. package/dist/elements/ButtonElement.js +19 -6
  18. package/dist/elements/ElementColWrapper.js +10 -1
  19. package/dist/elements/IconElement.js +5 -5
  20. package/dist/elements/IconMap.js +101 -28
  21. package/dist/elements/InputElement.js +4 -3
  22. package/dist/elements/TextElement.js +1 -1
  23. package/dist/factories/ButtonActionFactory.d.ts +3 -4
  24. package/dist/factories/ButtonActionFactory.js +2 -2
  25. package/dist/factories/ComponentFactory.js +6 -3
  26. package/dist/index.d.ts +5 -2
  27. package/dist/index.js +2 -0
  28. package/dist/layouts/Footer.js +1 -1
  29. package/dist/layouts/Header.js +29 -13
  30. package/dist/layouts/SiteLayout.d.ts +8 -1
  31. package/dist/layouts/SiteLayout.js +35 -3
  32. package/dist/renderers/SectionRenderer.js +26 -9
  33. package/dist/services/EmailService.d.ts +14 -5
  34. package/dist/services/EmailService.js +21 -22
  35. package/dist/stores/UseFormStore.d.ts +7 -2
  36. package/dist/stores/UseFormStore.js +8 -3
  37. package/dist/types/ElementType.d.ts +1 -0
  38. package/dist/types/EmailSettingsType.d.ts +5 -0
  39. package/dist/types/EmailSettingsType.js +1 -0
  40. package/dist/types/HeaderPropertiesType.d.ts +1 -0
  41. package/dist/types/MailBodyType.d.ts +2 -0
  42. package/dist/types/SocialPropertiesType.d.ts +3 -11
  43. package/dist/types/StylesType.d.ts +12 -0
  44. package/dist/types/WebsitePropertiesType.d.ts +2 -0
  45. package/dist/types/WebsiteType.d.ts +1 -0
  46. package/dist/utils/emailTemplate.d.ts +7 -0
  47. package/dist/utils/emailTemplate.js +66 -0
  48. package/dist/utils/fonts.d.ts +2 -0
  49. package/dist/utils/fonts.js +10 -0
  50. package/dist/utils/imageCustomization.d.ts +3 -0
  51. package/dist/utils/imageCustomization.js +11 -0
  52. package/dist/utils/responsiveProperties.d.ts +2 -0
  53. package/dist/utils/responsiveProperties.js +28 -0
  54. package/dist/utils/responsiveStyles.d.ts +6 -0
  55. package/dist/utils/responsiveStyles.js +82 -0
  56. package/package.json +2 -4
  57. package/dist/components/CarouselComponent.js +0 -6
  58. package/dist/layouts/Menu.d.ts +0 -5
  59. package/dist/layouts/Menu.js +0 -34
@@ -3,15 +3,24 @@ import type { MailBodyType } from '../types/MailBodyType.js';
3
3
  export interface EmailServiceConfig {
4
4
  apiUrl: string;
5
5
  authToken: string;
6
- senderName: string;
6
+ websiteId: number | string;
7
7
  sender: string;
8
- recipientName: string;
9
- recipient: string;
8
+ senderName?: string;
9
+ defaultRecipient?: string;
10
+ defaultRecipientName?: string;
11
+ defaultSubject?: string;
12
+ }
13
+ export interface EmailSendOptions {
14
+ recipient?: string;
15
+ recipientName?: string;
16
+ subject?: string;
17
+ formId?: number | string;
18
+ websiteName?: string;
10
19
  }
11
20
  declare class EmailService {
12
21
  private readonly config;
13
22
  constructor(config: EmailServiceConfig);
14
- sendMail(params: FormFieldsType[]): Promise<boolean>;
15
- createBody(params: FormFieldsType[]): MailBodyType;
23
+ sendMail(params: FormFieldsType[], options?: EmailSendOptions): Promise<boolean>;
24
+ createBody(params: FormFieldsType[], options?: EmailSendOptions): MailBodyType;
16
25
  }
17
26
  export { EmailService };
@@ -1,14 +1,18 @@
1
+ import { buildFormEmailHtml } from '../utils/emailTemplate.js';
2
+ const DEFAULT_SUBJECT = 'Mensagem enviada pelo formulário do site';
3
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1
4
  class EmailService {
2
5
  constructor(config) {
3
6
  this.config = config;
4
7
  }
5
- async sendMail(params) {
6
- const body = this.createBody(params);
8
+ async sendMail(params, options = {}) {
9
+ const body = this.createBody(params, options);
7
10
  const response = await fetch(`${this.config.apiUrl}/send-mail`, {
8
11
  method: 'POST',
9
12
  headers: {
10
13
  'Content-Type': 'application/json',
11
- Authorization: `Bearer ${this.config.authToken}`
14
+ Authorization: `Bearer ${this.config.authToken}`,
15
+ 'X-Website-Id': String(this.config.websiteId)
12
16
  },
13
17
  body: JSON.stringify(body)
14
18
  });
@@ -17,27 +21,22 @@ class EmailService {
17
21
  }
18
22
  return true;
19
23
  }
20
- createBody(params) {
21
- var _a, _b, _c, _d, _e, _f;
22
- const firstName = params.find((e) => e.name === 'firstNameInput');
23
- const lastName = params.find((e) => e.name === 'lastNameInput');
24
- const birthDate = params.find((e) => e.name === 'birthDateField');
25
- const document = params.find((e) => e.name === 'documentField');
26
- const email = params.find((e) => e.name === 'emailField');
27
- const phone = params.find((e) => e.name === 'phoneField');
24
+ createBody(params, options = {}) {
25
+ var _a;
26
+ const rows = params
27
+ .filter((field) => { var _a; return field.name && String((_a = field.value) !== null && _a !== void 0 ? _a : '').trim() !== ''; })
28
+ .map((field) => { var _a; return ({ label: field.name, value: String((_a = field.value) !== null && _a !== void 0 ? _a : '') }); });
29
+ const emailField = params.find((field) => { var _a; return /email/i.test(field.name) || EMAIL_REGEX.test(String((_a = field.value) !== null && _a !== void 0 ? _a : '')); });
30
+ const subject = options.subject || this.config.defaultSubject || DEFAULT_SUBJECT;
28
31
  return {
29
- senderName: this.config.senderName,
32
+ senderName: this.config.senderName || options.websiteName || 'PixelBuild',
30
33
  sender: this.config.sender,
31
- recipientName: this.config.recipientName,
32
- recipient: this.config.recipient,
33
- title: 'Mensagem enviada pelo formulário do site',
34
- message: [
35
- `Nome: ${(_a = firstName === null || firstName === void 0 ? void 0 : firstName.value) !== null && _a !== void 0 ? _a : ''} ${(_b = lastName === null || lastName === void 0 ? void 0 : lastName.value) !== null && _b !== void 0 ? _b : ''}`,
36
- `Data de Nascimento: ${(_c = birthDate === null || birthDate === void 0 ? void 0 : birthDate.value) !== null && _c !== void 0 ? _c : ''}`,
37
- `CPF: ${(_d = document === null || document === void 0 ? void 0 : document.value) !== null && _d !== void 0 ? _d : ''}`,
38
- `E-mail: ${(_e = email === null || email === void 0 ? void 0 : email.value) !== null && _e !== void 0 ? _e : ''}`,
39
- `Celular: ${(_f = phone === null || phone === void 0 ? void 0 : phone.value) !== null && _f !== void 0 ? _f : ''}`
40
- ].filter(Boolean).join('\n')
34
+ recipientName: options.recipientName || this.config.defaultRecipientName || 'Site',
35
+ recipient: options.recipient || this.config.defaultRecipient || '',
36
+ title: subject,
37
+ message: buildFormEmailHtml(subject, rows),
38
+ isHtml: true,
39
+ lead: Object.assign(Object.assign({ formId: (_a = options.formId) !== null && _a !== void 0 ? _a : null }, Object.fromEntries(rows.map((row) => [row.label, row.value]))), (emailField ? { email: emailField.value } : {}))
41
40
  };
42
41
  }
43
42
  }
@@ -11,14 +11,19 @@ export interface FormElement {
11
11
  inputValidateId: number | null;
12
12
  [key: string]: string | number | boolean | null;
13
13
  }
14
+ export interface FormEmailConfig {
15
+ recipient?: string;
16
+ subject?: string;
17
+ }
14
18
  export interface FormEntry {
15
19
  elements: string[];
16
- [key: string]: string[] | null;
20
+ email?: FormEmailConfig;
21
+ [key: string]: string[] | FormEmailConfig | null | undefined;
17
22
  }
18
23
  export interface FormStoreState {
19
24
  forms: Record<string, FormEntry>;
20
25
  elements: Record<string, FormElement>;
21
- registerForm: (formId: number) => void;
26
+ registerForm: (formId: number, emailConfig?: FormEmailConfig) => void;
22
27
  registerElement: (elementId: number, formId?: number | null, initialState?: Partial<FormElement>) => void;
23
28
  unregisterElement: (elementId: number) => void;
24
29
  validateFormData: (inputValidateId: number, elementId: number, value: string) => void;
@@ -3,9 +3,14 @@ import { InputValidateFactory } from '../factories/InputValidateFactory.js';
3
3
  const UseFormStore = create((set, get) => ({
4
4
  forms: {},
5
5
  elements: {},
6
- registerForm: (formId) => set((state) => ({
7
- forms: Object.assign(Object.assign({}, state.forms), { [formId]: state.forms[formId] || { elements: [] } })
8
- })),
6
+ registerForm: (formId, emailConfig) => set((state) => {
7
+ const existing = state.forms[formId];
8
+ const nextForm = existing
9
+ ? Object.assign(Object.assign({}, existing), (emailConfig ? { email: emailConfig } : {})) : Object.assign({ elements: [] }, (emailConfig ? { email: emailConfig } : {}));
10
+ return {
11
+ forms: Object.assign(Object.assign({}, state.forms), { [formId]: nextForm })
12
+ };
13
+ }),
9
14
  registerElement: (elementId, formId = null, initialState = {}) => set((state) => {
10
15
  var _a, _b;
11
16
  const existingElement = state.elements[elementId];
@@ -8,4 +8,5 @@ export interface ElementType {
8
8
  styles: StylesType;
9
9
  width: ColumnWidthType;
10
10
  offset: ColumnWidthType;
11
+ fullBleed?: boolean;
11
12
  }
@@ -0,0 +1,5 @@
1
+ export interface EmailSettingsType {
2
+ recipient?: string;
3
+ recipientName?: string;
4
+ subject?: string;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  export interface HeaderPropertiesType {
2
2
  logoAlign: 'left' | 'right' | 'center';
3
+ logoWidth?: string | number;
3
4
  showLogo: boolean;
4
5
  showMenu: boolean;
5
6
  }
@@ -5,4 +5,6 @@ export interface MailBodyType {
5
5
  recipient: string;
6
6
  title: string;
7
7
  message: string;
8
+ isHtml?: boolean;
9
+ lead?: Record<string, unknown>;
8
10
  }
@@ -1,11 +1,3 @@
1
- export interface SocialPropertiesType {
2
- instagram: {
3
- path: string;
4
- };
5
- facebook: {
6
- path: string;
7
- };
8
- linktree: {
9
- path: string;
10
- };
11
- }
1
+ export type SocialPropertiesType = Record<string, {
2
+ path?: string;
3
+ } | undefined>;
@@ -2,7 +2,12 @@ export type Float = 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
2
2
  export type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
3
3
  export type ObjectFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
4
4
  export type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
5
+ export type BreakpointKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
6
+ export type ResponsiveStylesType = {
7
+ [key in BreakpointKey]?: Partial<Omit<StylesType, 'responsive'>>;
8
+ };
5
9
  export interface StylesType {
10
+ responsive?: ResponsiveStylesType;
6
11
  alignItems?: string;
7
12
  backgroundColor?: string;
8
13
  backgroundGradientColorStart?: string;
@@ -18,6 +23,7 @@ export interface StylesType {
18
23
  display?: string;
19
24
  float?: Float;
20
25
  fluid?: boolean;
26
+ fontFamily?: string;
21
27
  fontSize?: string;
22
28
  fontWeight?: FontWeight;
23
29
  height?: string;
@@ -25,6 +31,12 @@ export interface StylesType {
25
31
  marginLeft?: string;
26
32
  marginRight?: string;
27
33
  marginBottom?: string;
34
+ menuLinkColor?: string;
35
+ menuActiveLinkColor?: string;
36
+ menuFontSize?: string;
37
+ menuLetterSpacing?: string;
38
+ menuTextTransform?: string;
39
+ socialIconColor?: string;
28
40
  objectFit?: ObjectFit;
29
41
  paddingTop?: string;
30
42
  paddingLeft?: string;
@@ -1,5 +1,7 @@
1
1
  import type { SocialPropertiesType } from './SocialPropertiesType.js';
2
+ import type { EmailSettingsType } from './EmailSettingsType.js';
2
3
  export interface WebsitePropertiesType {
3
4
  loadingMessage: string;
4
5
  social: SocialPropertiesType;
6
+ email?: EmailSettingsType;
5
7
  }
@@ -14,6 +14,7 @@ export interface WebsiteType {
14
14
  properties: WebsitePropertiesType;
15
15
  styles: StylesType;
16
16
  enabled: boolean;
17
+ maintenance?: boolean;
17
18
  publishedAt: string | null;
18
19
  createdAt: string;
19
20
  updatedAt: string;
@@ -0,0 +1,7 @@
1
+ export interface EmailTemplateRow {
2
+ label: string;
3
+ value: string;
4
+ }
5
+ declare function escapeHtml(value: unknown): string;
6
+ export declare function buildFormEmailHtml(title: string, rows: EmailTemplateRow[]): string;
7
+ export { escapeHtml };
@@ -0,0 +1,66 @@
1
+ function escapeHtml(value) {
2
+ return String(value !== null && value !== void 0 ? value : '')
3
+ .replace(/&/g, '&amp;')
4
+ .replace(/</g, '&lt;')
5
+ .replace(/>/g, '&gt;')
6
+ .replace(/"/g, '&quot;')
7
+ .replace(/'/g, '&#39;');
8
+ }
9
+ export function buildFormEmailHtml(title, rows) {
10
+ const safeTitle = escapeHtml(title);
11
+ const rowsHtml = rows
12
+ .filter((row) => String(row.value).trim() !== '')
13
+ .map((row) => `
14
+ <tr>
15
+ <td style="padding:12px 0;border-bottom:1px solid #e5e7eb;font-size:13px;color:#6b7280;width:40%;vertical-align:top;">${escapeHtml(row.label)}</td>
16
+ <td style="padding:12px 0;border-bottom:1px solid #e5e7eb;font-size:14px;color:#172033;vertical-align:top;white-space:pre-wrap;word-break:break-word;">${escapeHtml(row.value)}</td>
17
+ </tr>`)
18
+ .join('');
19
+ return `<!DOCTYPE html>
20
+ <html lang="pt-BR">
21
+ <head>
22
+ <meta charset="UTF-8">
23
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
24
+ <title>${safeTitle}</title>
25
+ </head>
26
+ <body style="margin:0;padding:0;background-color:#eef2f7;font-family:Arial,Helvetica,sans-serif;color:#172033;">
27
+ <table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#eef2f7;margin:0;padding:24px 0;width:100%;">
28
+ <tr>
29
+ <td align="center">
30
+ <table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="max-width:600px;width:100%;margin:0 auto;">
31
+ <tr>
32
+ <td style="padding:0 16px;">
33
+ <table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#111933;border-radius:20px 20px 0 0;width:100%;">
34
+ <tr>
35
+ <td align="center" style="padding:32px 24px 24px 24px;">
36
+ <div style="font-size:12px;line-height:12px;letter-spacing:1.6px;text-transform:uppercase;color:#98a2c3;margin-bottom:12px;">PixelBuild</div>
37
+ <div style="font-size:24px;line-height:30px;font-weight:700;color:#ffffff;">${safeTitle}</div>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ <table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff;border-radius:0 0 20px 20px;width:100%;">
42
+ <tr>
43
+ <td style="padding:16px 32px 32px 32px;">
44
+ <table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%">
45
+ ${rowsHtml || '<tr><td style="padding:12px 0;font-size:14px;color:#6b7280;">Nenhuma informação enviada.</td></tr>'}
46
+ </table>
47
+ </td>
48
+ </tr>
49
+ </table>
50
+ <table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%;">
51
+ <tr>
52
+ <td align="center" style="padding:20px 24px 0 24px;font-size:12px;line-height:18px;color:#8a94a6;text-align:center;">
53
+ Este e-mail foi enviado automaticamente pelo formulário do site.
54
+ </td>
55
+ </tr>
56
+ </table>
57
+ </td>
58
+ </tr>
59
+ </table>
60
+ </td>
61
+ </tr>
62
+ </table>
63
+ </body>
64
+ </html>`;
65
+ }
66
+ export { escapeHtml };
@@ -0,0 +1,2 @@
1
+ export declare function buildFontFamily(fontFamily?: string): string | undefined;
2
+ export declare function buildGoogleFontsHref(fontFamily?: string): string | undefined;
@@ -0,0 +1,10 @@
1
+ export function buildFontFamily(fontFamily) {
2
+ if (!fontFamily)
3
+ return undefined;
4
+ return `"${fontFamily}", sans-serif`;
5
+ }
6
+ export function buildGoogleFontsHref(fontFamily) {
7
+ if (!fontFamily)
8
+ return undefined;
9
+ return `https://fonts.googleapis.com/css2?family=${fontFamily.replaceAll(' ', '+')}&display=swap`;
10
+ }
@@ -0,0 +1,3 @@
1
+ import type { ComponentType } from '../types/ComponentType.js';
2
+ import type { ElementType } from '../types/ElementType.js';
3
+ export declare function resolveImageElement(component: ComponentType, element: ElementType): ElementType;
@@ -0,0 +1,11 @@
1
+ export function resolveImageElement(component, element) {
2
+ if (element.elementType !== 'image' && element.elementType !== 'video') {
3
+ return element;
4
+ }
5
+ const properties = component.properties || {};
6
+ const useShared = properties.imageCustomization !== 'separate';
7
+ const imageStyles = useShared
8
+ ? properties.imageStyles || {}
9
+ : element.styles;
10
+ return Object.assign(Object.assign({}, element), { styles: Object.assign({ width: '100%' }, imageStyles) });
11
+ }
@@ -0,0 +1,2 @@
1
+ export declare function resolveResponsiveProperties(properties: Record<string, unknown>, breakpoint: string): Record<string, unknown>;
2
+ export declare function breakpointFromWidth(width: number): string;
@@ -0,0 +1,28 @@
1
+ const BREAKPOINT_ORDER = ['xs', 'sm', 'md', 'lg', 'xl'];
2
+ export function resolveResponsiveProperties(properties, breakpoint) {
3
+ const responsive = properties === null || properties === void 0 ? void 0 : properties.responsive;
4
+ const resolved = Object.assign({}, properties);
5
+ delete resolved.responsive;
6
+ if (!responsive)
7
+ return resolved;
8
+ const idx = BREAKPOINT_ORDER.indexOf(breakpoint);
9
+ if (idx < 0)
10
+ return resolved;
11
+ for (let i = 0; i <= idx; i++) {
12
+ const overrides = responsive[BREAKPOINT_ORDER[i]];
13
+ if (overrides)
14
+ Object.assign(resolved, overrides);
15
+ }
16
+ return resolved;
17
+ }
18
+ export function breakpointFromWidth(width) {
19
+ if (width >= 1200)
20
+ return 'xl';
21
+ if (width >= 992)
22
+ return 'lg';
23
+ if (width >= 768)
24
+ return 'md';
25
+ if (width >= 576)
26
+ return 'sm';
27
+ return 'xs';
28
+ }
@@ -0,0 +1,6 @@
1
+ import type { SectionType } from '../types/SectionType.js';
2
+ import type { StylesType } from '../types/StylesType.js';
3
+ declare const BREAKPOINT_MIN_WIDTHS: Record<string, number>;
4
+ export declare function buildResponsiveCssForStyles(selector: string, styles: StylesType | undefined): string;
5
+ export declare function buildResponsiveCss(sections: SectionType[]): string;
6
+ export { BREAKPOINT_MIN_WIDTHS };
@@ -0,0 +1,82 @@
1
+ const BREAKPOINT_MIN_WIDTHS = {
2
+ sm: 576,
3
+ md: 768,
4
+ lg: 992,
5
+ xl: 1200,
6
+ };
7
+ const SKIP_KEYS = new Set([
8
+ 'responsive',
9
+ 'customCss',
10
+ 'fluid',
11
+ 'backgroundGradientColorStart',
12
+ 'backgroundGradientColorEnd',
13
+ ]);
14
+ function kebabCase(key) {
15
+ return key.replace(/([A-Z])/g, '-$1').toLowerCase();
16
+ }
17
+ function cssValue(key, value) {
18
+ if (value === undefined || value === null || value === '')
19
+ return null;
20
+ const stringValue = String(value);
21
+ if (key === 'backgroundImage')
22
+ return `url(${stringValue})`;
23
+ return stringValue;
24
+ }
25
+ function declarationFor(key, value) {
26
+ const css = cssValue(key, value);
27
+ if (!css)
28
+ return null;
29
+ return `${kebabCase(key)}:${css}!important`;
30
+ }
31
+ function styleDeclarations(styles) {
32
+ if (!styles)
33
+ return '';
34
+ const declarations = [];
35
+ for (const [key, value] of Object.entries(styles)) {
36
+ if (SKIP_KEYS.has(key))
37
+ continue;
38
+ const declaration = declarationFor(key, value);
39
+ if (declaration)
40
+ declarations.push(declaration);
41
+ }
42
+ return declarations.join(';');
43
+ }
44
+ function buildRules(selector, responsive) {
45
+ if (!responsive)
46
+ return [];
47
+ const rules = [];
48
+ for (const [breakpoint, minWidth] of Object.entries(BREAKPOINT_MIN_WIDTHS)) {
49
+ const declarations = styleDeclarations(responsive[breakpoint]);
50
+ if (!declarations)
51
+ continue;
52
+ rules.push(`@media (min-width:${minWidth}px){${selector}{${declarations}}}`);
53
+ }
54
+ return rules;
55
+ }
56
+ export function buildResponsiveCssForStyles(selector, styles) {
57
+ return buildRules(selector, styles === null || styles === void 0 ? void 0 : styles.responsive).join('');
58
+ }
59
+ export function buildResponsiveCss(sections) {
60
+ const rules = [];
61
+ const visitSection = (section) => {
62
+ var _a, _b, _c, _d;
63
+ rules.push(...buildRules(`#section-${section.id}`, (_a = section.styles) === null || _a === void 0 ? void 0 : _a.responsive));
64
+ for (const column of section.columns) {
65
+ rules.push(...buildRules(`#column-${column.id}`, (_b = column.styles) === null || _b === void 0 ? void 0 : _b.responsive));
66
+ for (const component of column.components) {
67
+ rules.push(...buildRules(`[data-pb-component="${component.id}"]`, (_c = component.styles) === null || _c === void 0 ? void 0 : _c.responsive));
68
+ for (const element of component.elements) {
69
+ rules.push(...buildRules(`[data-pb-element="${element.id}"]`, (_d = element.styles) === null || _d === void 0 ? void 0 : _d.responsive));
70
+ }
71
+ }
72
+ for (const childSection of column.childSections) {
73
+ visitSection(childSection);
74
+ }
75
+ }
76
+ };
77
+ for (const section of sections) {
78
+ visitSection(section);
79
+ }
80
+ return rules.join('');
81
+ }
82
+ export { BREAKPOINT_MIN_WIDTHS };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "lib-pixelbuild",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "engines": {
5
- "node": "^24.18.0",
5
+ "node": "^24.0.0",
6
6
  "npm": ">=10"
7
7
  },
8
8
  "type": "module",
@@ -80,7 +80,6 @@
80
80
  "husky": "^9.1.7",
81
81
  "jsdom": "^30.0.0",
82
82
  "lint-staged": "^15.5.2",
83
- "keen-slider": "^6.8.6",
84
83
  "prettier": "^3.6.2",
85
84
  "react": "^18.2.0",
86
85
  "react-bootstrap": "^2.10.10",
@@ -105,7 +104,6 @@
105
104
  "peerDependencies": {
106
105
  "bootstrap": "^5.0.0",
107
106
  "dompurify": "^3.2.6",
108
- "keen-slider": "^6.8.6",
109
107
  "react": "^18.0.0",
110
108
  "react-bootstrap": "^2.10.10",
111
109
  "react-dom": "^18.0.0",
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Row, Col, Carousel } from 'react-bootstrap';
3
- import { orderBySort } from '../utils/orderBySort.js';
4
- export function CarouselComponent({ component }) {
5
- return (_jsx(Row, { children: _jsx(Col, { children: _jsx(Carousel, { indicators: false, className: "slider", children: orderBySort(component.elements).map((element, index) => (_jsx(Carousel.Item, { children: _jsx("img", { src: String(element.properties.name || element.properties.src || ''), alt: String(element.properties.title || element.properties.alt || ''), style: { width: '100%', height: 'auto', objectFit: 'cover' } }) }, element.id || index))) }) }) }));
6
- }
@@ -1,5 +0,0 @@
1
- import type { PageType } from '../types/PageType.js';
2
- export declare function Menu({ page, websitePages }: {
3
- readonly page?: PageType;
4
- readonly websitePages?: PageType[];
5
- }): import("react").JSX.Element;
@@ -1,34 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Navbar, Nav, Container } from 'react-bootstrap';
3
- export function Menu({ page, websitePages }) {
4
- if (!websitePages || websitePages.length === 0) {
5
- return null;
6
- }
7
- const menuPages = websitePages
8
- .filter((p) => p.menu === true)
9
- .sort((a, b) => a.menuOrder - b.menuOrder);
10
- if (menuPages.length === 0) {
11
- return null;
12
- }
13
- const currentPath = (page === null || page === void 0 ? void 0 : page.path) || '';
14
- const isActive = (path) => {
15
- if (!currentPath)
16
- return false;
17
- if (path === '/')
18
- return currentPath === '/' || currentPath === '';
19
- return currentPath === path || currentPath.startsWith(path + '/');
20
- };
21
- return (_jsx(Navbar, { expand: "lg", className: "py-3", children: _jsxs(Container, { children: [_jsx(Navbar.Toggle, { "aria-controls": "basic-navbar-nav", className: "menu" }), _jsx(Navbar.Collapse, { id: "basic-navbar-nav", children: _jsx(Nav, { className: "me-auto", children: menuPages.map((p) => {
22
- const active = isActive(p.path);
23
- return (_jsx(Nav.Link, { href: p.path, style: {
24
- color: active ? '#c0ad5b' : '#a4a4a4',
25
- fontSize: '0.9rem',
26
- letterSpacing: '0.05em',
27
- textTransform: 'uppercase',
28
- margin: '0 12px',
29
- paddingBottom: '4px',
30
- borderBottom: active ? '2px solid #c0ad5b' : '2px solid transparent',
31
- transition: 'color 0.3s, border-color 0.3s',
32
- }, children: p.title }, p.id));
33
- }) }) })] }) }));
34
- }