cf-pagetree-parser 1.0.0

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/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # cf-pagetree-parser
2
+
3
+ Parse FunnelWind HTML to ClickFunnels PageTree JSON.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install cf-pagetree-parser
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### ES Modules (Next.js, Node.js)
14
+
15
+ ```javascript
16
+ import { parsePageTree, exportPageTreeJSON } from 'cf-pagetree-parser';
17
+
18
+ // Parse a DOM element to PageTree
19
+ const rootElement = document.querySelector('[data-type="ContentNode"]');
20
+ const pageTree = parsePageTree(rootElement, styleguideData);
21
+
22
+ // Export as JSON string
23
+ const json = exportPageTreeJSON(rootElement, true, styleguideData);
24
+ ```
25
+
26
+ ### Browser (Standalone Bundle)
27
+
28
+ ```html
29
+ <script src="dist/cf-pagetree-parser.js"></script>
30
+ <script>
31
+ const { parsePageTree } = CFPageTreeParser;
32
+ const pageTree = parsePageTree(rootElement);
33
+ </script>
34
+ ```
35
+
36
+ ### Chrome Extension (Sandboxed)
37
+
38
+ The `dist/cf-pagetree-parser.js` bundle can be used in sandboxed extension contexts.
39
+
40
+ ## API
41
+
42
+ ### Main Functions
43
+
44
+ - `parsePageTree(rootElement, styleguideData?)` - Parse DOM to PageTree object
45
+ - `parseElement(element, parentId, index, styleguideData?)` - Parse single element
46
+ - `extractPageSettings(rootElement, styleguideData?)` - Extract page settings
47
+ - `exportPageTreeJSON(rootElement, formatted?, styleguideData?)` - Export as JSON string
48
+ - `downloadPageTreeJSON(rootElement, filename?, styleguideData?)` - Download JSON file
49
+ - `copyPageTreeToClipboard(rootElement, styleguideData?)` - Copy to clipboard
50
+
51
+ ### Utilities
52
+
53
+ - `generateId()` - Generate unique ID
54
+ - `generateFractionalIndex(index)` - Generate fractional index for ordering
55
+ - `parseValueWithUnit(value, defaultUnit?)` - Parse CSS value with unit
56
+ - `normalizeColor(color)` - Normalize color to consistent format
57
+ - `parseInlineStyle(styleString)` - Parse inline style string to object
58
+
59
+ ### Style Parsers
60
+
61
+ - `parseShadow(shadowString)` - Parse box-shadow
62
+ - `shadowToParams(shadow)` - Convert shadow to CF params
63
+ - `parseBorder(styles)` - Parse border styles
64
+ - `borderToParams(border)` - Convert border to CF params
65
+ - `parseBackground(styles)` - Parse background styles
66
+ - `backgroundToParams(background)` - Convert background to CF params
67
+
68
+ ## Development
69
+
70
+ ```bash
71
+ # Build standalone bundle
72
+ npm run build
73
+
74
+ # Output: dist/cf-pagetree-parser.js
75
+ ```
76
+
77
+ ## License
78
+
79
+ MIT