@pixldocs/canvas-renderer 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ import { forwardRef, useRef, useState, useMemo, useEffect, useCallback, useImper
6
6
  import { flushSync } from "react-dom";
7
7
  import { create } from "zustand";
8
8
  import * as fabric from "fabric";
9
- import { createClient } from "@supabase/supabase-js";
10
9
  import { createRoot } from "react-dom/client";
11
10
  import { jsPDF, ShadingPattern } from "jspdf";
12
11
  import { svg2pdf } from "svg2pdf.js";
@@ -8765,50 +8764,6 @@ function applyThemeToConfig(config, themeOverrides) {
8765
8764
  }
8766
8765
  return cloned;
8767
8766
  }
8768
- const SUPABASE_URL = void 0;
8769
- const SUPABASE_PUBLISHABLE_KEY = void 0;
8770
- createClient(SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY, {
8771
- auth: {
8772
- storage: localStorage,
8773
- persistSession: true,
8774
- autoRefreshToken: true
8775
- }
8776
- });
8777
- function repeatablePageToSection(page) {
8778
- return {
8779
- id: page.id,
8780
- label: page.label,
8781
- description: page.description,
8782
- // Place pages after sections by default; explicit order preserved.
8783
- order: typeof page.order === "number" ? page.order + 1e4 : 1e4,
8784
- fields: page.fields,
8785
- repeatable: true,
8786
- minEntries: page.minEntries,
8787
- maxEntries: page.maxEntries,
8788
- templateKeyPrefix: page.templateKeyPrefix,
8789
- children: page.children
8790
- };
8791
- }
8792
- function getRenderableFormSections(schema) {
8793
- if (!schema) return [];
8794
- const base = schema.sections ?? [];
8795
- const pages = schema.repeatablePages ?? [];
8796
- if (!pages.length) return base;
8797
- return [...base, ...pages.map(repeatablePageToSection)];
8798
- }
8799
- function buildRepeatablePagesInputForApply(schema, sectionState) {
8800
- var _a;
8801
- if (!((_a = schema == null ? void 0 : schema.repeatablePages) == null ? void 0 : _a.length)) return [];
8802
- return schema.repeatablePages.map((p) => {
8803
- const entries = sectionState == null ? void 0 : sectionState[p.id];
8804
- const minEntries = p.minEntries != null ? Math.max(0, p.minEntries) : 1;
8805
- let entryCount;
8806
- if (Array.isArray(entries)) {
8807
- entryCount = minEntries === 0 ? entries.length : Math.max(1, entries.length);
8808
- }
8809
- return { pageId: p.id, templateKeyPrefix: p.templateKeyPrefix, entryCount };
8810
- });
8811
- }
8812
8767
  function mapFormDefFieldType(t) {
8813
8768
  if (["text", "email", "tel", "textarea", "date", "url", "number", "toggle", "color", "image"].includes(t)) return t;
8814
8769
  if (t === "currency") return "number";
@@ -10330,6 +10285,48 @@ function applyContentBoundsPagination(config) {
10330
10285
  if (!mutated) return config;
10331
10286
  return { ...config, pages: resultPages };
10332
10287
  }
10288
+ function repeatablePageToSection(page) {
10289
+ return {
10290
+ id: page.id,
10291
+ label: page.label,
10292
+ description: page.description,
10293
+ order: typeof page.order === "number" ? page.order + 1e4 : 1e4,
10294
+ fields: page.fields,
10295
+ repeatable: true,
10296
+ minEntries: page.minEntries,
10297
+ maxEntries: page.maxEntries,
10298
+ templateKeyPrefix: page.templateKeyPrefix,
10299
+ children: page.children
10300
+ };
10301
+ }
10302
+ function getRenderableFormSections(schema) {
10303
+ if (!schema) return [];
10304
+ const base = schema.sections ?? [];
10305
+ const pages = schema.repeatablePages ?? [];
10306
+ if (!pages.length) return base;
10307
+ return [...base, ...pages.map(repeatablePageToSection)];
10308
+ }
10309
+ function buildRepeatablePagesInputForApply(schema, sectionState) {
10310
+ var _a;
10311
+ if (!((_a = schema == null ? void 0 : schema.repeatablePages) == null ? void 0 : _a.length)) return [];
10312
+ const normalizeTemplateKeyPrefix = (prefix) => {
10313
+ if (!prefix || typeof prefix !== "string") return "";
10314
+ return prefix.replace(/^field_/, "");
10315
+ };
10316
+ return schema.repeatablePages.map((page) => {
10317
+ const entries = sectionState == null ? void 0 : sectionState[page.id];
10318
+ const minEntries = page.minEntries != null ? Math.max(0, page.minEntries) : 1;
10319
+ let entryCount;
10320
+ if (Array.isArray(entries)) {
10321
+ entryCount = minEntries === 0 ? entries.length : Math.max(1, entries.length);
10322
+ }
10323
+ return {
10324
+ pageId: page.id,
10325
+ templateKeyPrefix: normalizeTemplateKeyPrefix(page.templateKeyPrefix),
10326
+ entryCount
10327
+ };
10328
+ });
10329
+ }
10333
10330
  async function fetchRow(supabaseUrl, anonKey, table, id) {
10334
10331
  const url = `${supabaseUrl}/rest/v1/${table}?id=eq.${id}&select=*`;
10335
10332
  const res = await fetch(url, {