@palmyit/elements 0.0.0-stage → 0.1.7

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 (60) hide show
  1. package/README.md +12 -2
  2. package/dist/definitions.d.ts +51 -0
  3. package/dist/definitions.js +1737 -0
  4. package/dist/manifest.json +7 -0
  5. package/dist/plmt-elements.css +2 -0
  6. package/dist/plmt-elements.js +0 -0
  7. package/dist/registry.d.ts +9 -0
  8. package/dist/render/renderHtml.d.ts +5 -0
  9. package/dist/render/styleToVars.d.ts +2 -0
  10. package/dist/render/tags.d.ts +42 -0
  11. package/dist/render/toDom.d.ts +3 -0
  12. package/dist/render/types.d.ts +14 -0
  13. package/dist/schema/Fields/BackgroundField/backgroundValue.d.ts +15 -0
  14. package/dist/schema/Fields/ColorField/color-value.d.ts +6 -0
  15. package/dist/schema/Fields/ColorField/index.d.ts +1 -0
  16. package/dist/schema/Fields/FontStyleField.d.ts +2 -0
  17. package/dist/schema/Fields/IconPicker/iconCatalog.d.ts +3 -0
  18. package/dist/schema/PButton/pButton.definition.d.ts +38 -0
  19. package/dist/schema/PCheckbox/pCheckbox.definition.d.ts +10 -0
  20. package/dist/schema/PContainer/pContainer.definition.d.ts +39 -0
  21. package/dist/schema/PDivider/pDivider.definition.d.ts +10 -0
  22. package/dist/schema/PIcon/pIcon.definition.d.ts +18 -0
  23. package/dist/schema/PImage/pImage.definition.d.ts +33 -0
  24. package/dist/schema/PList/pList.definition.d.ts +11 -0
  25. package/dist/schema/PPage/pPage.definition.d.ts +22 -0
  26. package/dist/schema/PRadio/pRadio.definition.d.ts +13 -0
  27. package/dist/schema/PRichText/pRichText.definition.d.ts +8 -0
  28. package/dist/schema/PRichText/richTextMarks.d.ts +4 -0
  29. package/dist/schema/PRichText/richTextOptions.d.ts +2 -0
  30. package/dist/schema/PSection/pSection.definition.d.ts +39 -0
  31. package/dist/schema/PSelect/pSelect.definition.d.ts +13 -0
  32. package/dist/schema/PTable/pTable.definition.d.ts +20 -0
  33. package/dist/schema/PText/pText.definition.d.ts +46 -0
  34. package/dist/schema/PTextArea/pTextArea.definition.d.ts +10 -0
  35. package/dist/schema/PTextField/pTextField.definition.d.ts +10 -0
  36. package/dist/schema/PVideo/pVideo.definition.d.ts +10 -0
  37. package/dist/schema/addressSchema.d.ts +3 -0
  38. package/dist/schema/backgroundStyleDefinitions.d.ts +15 -0
  39. package/dist/schema/device/deviceStyle.d.ts +13 -0
  40. package/dist/schema/device/devices.d.ts +21 -0
  41. package/dist/schema/deviceSettings.d.ts +13 -0
  42. package/dist/schema/deviceVisibility.d.ts +19 -0
  43. package/dist/schema/elementConfiguration.d.ts +38 -0
  44. package/dist/schema/elementRegistry.d.ts +40 -0
  45. package/dist/schema/elementStyleDefinitions.d.ts +24 -0
  46. package/dist/schema/elementTemplates.d.ts +26 -0
  47. package/dist/schema/layoutChildren.d.ts +2 -0
  48. package/dist/schema/layoutElementConfiguration.d.ts +17 -0
  49. package/dist/schema/linkSettings.d.ts +26 -0
  50. package/dist/schema/style/backgroundStyle.d.ts +5 -0
  51. package/dist/schema/style/elementStyle.d.ts +62 -0
  52. package/dist/schema/style/page-styles.d.ts +3 -0
  53. package/dist/schema/styleItems.d.ts +53 -0
  54. package/dist/schema/textItems.d.ts +10 -0
  55. package/dist/tags.json +19 -0
  56. package/dist/templates/elementSpec.d.ts +15 -0
  57. package/dist/templates/helpers.d.ts +9 -0
  58. package/dist/templates.d.ts +11 -0
  59. package/dist/templates.js +269 -0
  60. package/package.json +67 -4
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": "0.1.7",
3
+ "files": {
4
+ "plmt-elements.css": "sha384-eJlb3M+bTfPog3lcAyGeMHgK0eguPsEl8jq4rkLdqnd39Zfe/p6iJLHNqP4Y+J/w",
5
+ "plmt-elements.js": "sha384-OLBgp1GsljhM2TJ+sbHjaiH9txEUvgdDTAzHv2P24donTt6/529l+9Ua0vFImLlb"
6
+ }
7
+ }
@@ -0,0 +1,2 @@
1
+ .plmt-page{--plmt-theme-font-family:system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--plmt-theme-font-size:16px;--plmt-theme-text-color:#334155;--plmt-theme-accent-color:#0f766e;--plmt-theme-accent-text:#0f766e;--plmt-theme-radius:.375rem;--plmt-theme-radius-full:9999px;--plmt-theme-space-2:.5rem;--plmt-theme-space-3:.75rem;--plmt-theme-button-height:2.5rem;--plmt-theme-button-bg:color-mix(in srgb, var(--plmt-theme-accent-color) 12%, transparent)}.plmt-page,.plmt-section,.plmt-container,.plmt-button,.plmt-text,.plmt-rich-text,.plmt-image,.plmt-video,.plmt-list,.plmt-icon,.plmt-divider,.plmt-table,.plmt-text-field,.plmt-text-area,.plmt-checkbox,.plmt-radio,.plmt-select{box-sizing:border-box}.plmt-page,.plmt-section,.plmt-container,.plmt-text,.plmt-rich-text,.plmt-table,.plmt-text-field,.plmt-text-area,.plmt-checkbox,.plmt-radio,.plmt-select,video.plmt-video,ul.plmt-list,hr.plmt-divider,img.plmt-image{display:block}a.plmt-image{display:inline-block}.plmt-button,.plmt-icon{display:inline-flex}.plmt-page{font-family:var(--palmyit-page-font-family,var(--plmt-theme-font-family));font-size:var(--palmyit-page-font-size,var(--plmt-theme-font-size));color:var(--palmyit-page-text-color,var(--plmt-theme-text-color));background-color:var(--palmyit-page-background-color,transparent);position:relative}.plmt-section{overflow-x:var(--palmyit-section-overflow-x,auto);overflow-y:var(--palmyit-section-overflow-y,auto);width:var(--palmyit-section-width,auto);height:var(--palmyit-section-height,auto);min-width:var(--palmyit-section-min-width,auto);min-height:var(--palmyit-section-min-height,auto);max-width:var(--palmyit-section-max-width,none);max-height:var(--palmyit-section-max-height,none);padding-top:var(--palmyit-section-padding-top,0);padding-bottom:var(--palmyit-section-padding-bottom,0);padding-left:var(--palmyit-section-padding-left,0);padding-right:var(--palmyit-section-padding-right,0);margin-top:var(--palmyit-section-margin-top,0);margin-bottom:var(--palmyit-section-margin-bottom,0);margin-left:var(--palmyit-section-margin-left,0);margin-right:var(--palmyit-section-margin-right,0);border-top-left-radius:var(--palmyit-section-border-top-left-radius,0);border-top-right-radius:var(--palmyit-section-border-top-right-radius,0);border-bottom-right-radius:var(--palmyit-section-border-bottom-right-radius,0);border-bottom-left-radius:var(--palmyit-section-border-bottom-left-radius,0);border-width:var(--palmyit-section-border-width,0);border-style:var(--palmyit-section-border-style,none);border-color:var(--palmyit-section-border-color,transparent);background-color:var(--palmyit-section-background-color,transparent);background-image:var(--palmyit-section-background-image,none);flex-direction:column;display:flex}.plmt-section[data-layout=flex]{flex-direction:var(--palmyit-section-flex-direction,row);flex-wrap:var(--palmyit-section-flex-wrap,nowrap);justify-content:var(--palmyit-section-justify-content,flex-start);align-items:var(--palmyit-section-align-items,stretch);align-content:var(--palmyit-section-align-content,stretch);row-gap:var(--palmyit-section-row-gap,0);column-gap:var(--palmyit-section-column-gap,0);display:flex}.plmt-section[data-layout=grid]{grid-template-columns:var(--palmyit-section-grid-template-columns,none);row-gap:var(--palmyit-section-row-gap,0);column-gap:var(--palmyit-section-column-gap,0);display:grid}.plmt-section[data-layout=flex]>*,.plmt-section[data-layout=grid]>*{min-width:0}.plmt-container{overflow-x:var(--palmyit-container-overflow-x,auto);overflow-y:var(--palmyit-container-overflow-y,auto);width:var(--palmyit-container-width,auto);height:var(--palmyit-container-height,auto);min-width:var(--palmyit-container-min-width,0);min-height:var(--palmyit-container-min-height,auto);max-width:var(--palmyit-container-max-width,none);max-height:var(--palmyit-container-max-height,none);padding-top:var(--palmyit-container-padding-top,0);padding-bottom:var(--palmyit-container-padding-bottom,0);padding-left:var(--palmyit-container-padding-left,0);padding-right:var(--palmyit-container-padding-right,0);margin-top:var(--palmyit-container-margin-top,0);margin-bottom:var(--palmyit-container-margin-bottom,0);margin-left:var(--palmyit-container-margin-left,0);margin-right:var(--palmyit-container-margin-right,0);border-top-left-radius:var(--palmyit-container-border-top-left-radius,0);border-top-right-radius:var(--palmyit-container-border-top-right-radius,0);border-bottom-right-radius:var(--palmyit-container-border-bottom-right-radius,0);border-bottom-left-radius:var(--palmyit-container-border-bottom-left-radius,0);border-width:var(--palmyit-container-border-width,0);border-style:var(--palmyit-container-border-style,none);border-color:var(--palmyit-container-border-color,transparent);background-color:var(--palmyit-container-background-color,transparent);background-image:var(--palmyit-container-background-image,none);box-sizing:border-box;flex-direction:column;display:flex}.plmt-container[data-layout=flex]{flex-direction:var(--palmyit-container-flex-direction,row);flex-wrap:var(--palmyit-container-flex-wrap,nowrap);justify-content:var(--palmyit-container-justify-content,flex-start);align-items:var(--palmyit-container-align-items,stretch);align-content:var(--palmyit-container-align-content,stretch);row-gap:var(--palmyit-container-row-gap,0);column-gap:var(--palmyit-container-column-gap,0);display:flex}.plmt-container[data-layout=grid]{grid-template-columns:var(--palmyit-container-grid-template-columns,none);row-gap:var(--palmyit-container-row-gap,0);column-gap:var(--palmyit-container-column-gap,0);display:grid}.plmt-container[data-layout=flex]>*,.plmt-container[data-layout=grid]>*{min-width:0}.plmt-button{color:var(--palmyit-button-text-color,var(--plmt-theme-accent-text));font-family:var(--palmyit-button-font-family,var(--plmt-theme-font-family));font-size:var(--palmyit-button-font-size,var(--plmt-theme-font-size));justify-content:center;align-items:center;gap:var(--palmyit-button-gap,var(--plmt-theme-space-2));border-width:var(--palmyit-button-border-width,0);border-style:var(--palmyit-button-border-style,solid);border-color:var(--palmyit-button-border-color,currentColor);border-top-left-radius:var(--palmyit-button-border-top-left-radius,max(var(--plmt-theme-radius), var(--plmt-theme-radius-full)));border-top-right-radius:var(--palmyit-button-border-top-right-radius,max(var(--plmt-theme-radius), var(--plmt-theme-radius-full)));border-bottom-right-radius:var(--palmyit-button-border-bottom-right-radius,max(var(--plmt-theme-radius), var(--plmt-theme-radius-full)));border-bottom-left-radius:var(--palmyit-button-border-bottom-left-radius,max(var(--plmt-theme-radius), var(--plmt-theme-radius-full)));padding-top:var(--palmyit-button-padding-top,0);padding-bottom:var(--palmyit-button-padding-bottom,0);padding-left:var(--palmyit-button-padding-left,var(--plmt-theme-space-3));padding-right:var(--palmyit-button-padding-right,var(--plmt-theme-space-3));margin-top:var(--palmyit-button-margin-top,0);margin-bottom:var(--palmyit-button-margin-bottom,0);margin-left:var(--palmyit-button-margin-left,0);margin-right:var(--palmyit-button-margin-right,0);width:var(--palmyit-button-width,auto);height:var(--palmyit-button-height,var(--plmt-theme-button-height));min-width:var(--palmyit-button-min-width,auto);min-height:var(--palmyit-button-min-height,auto);max-width:var(--palmyit-button-max-width,none);max-height:var(--palmyit-button-max-height,none);background-color:var(--plmt-theme-button-bg);cursor:pointer;box-sizing:border-box;text-decoration:none;display:inline-flex}.plmt-button[data-background]{background-color:var(--palmyit-button-background-color,transparent);background-image:var(--palmyit-button-background-image,none)}.plmt-text{min-width:0;color:var(--palmyit-text-color,inherit);font-family:var(--palmyit-text-font-family,inherit);font-size:var(--palmyit-text-font-size,14px);font-style:var(--palmyit-text-font-style,normal);font-weight:var(--palmyit-text-font-weight,inherit);line-height:var(--palmyit-text-line-height,1.4);letter-spacing:var(--palmyit-text-letter-spacing,normal);word-spacing:var(--palmyit-text-word-spacing,normal);-webkit-text-decoration-line:var(--palmyit-text-text-decoration,none);text-decoration-line:var(--palmyit-text-text-decoration,none);text-align:var(--palmyit-text-text-align,start);text-transform:var(--palmyit-text-text-transform,none);white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.plmt-text a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}.plmt-rich-text{min-width:0;color:inherit;font-size:14px;line-height:1.4}.plmt-rich-text p,.plmt-rich-text h2,.plmt-rich-text h3,.plmt-rich-text h4,.plmt-rich-text ul,.plmt-rich-text ol,.plmt-rich-text blockquote{margin:0}.plmt-rich-text h2{font-size:24px;line-height:1.3}.plmt-rich-text h3{font-size:20px;line-height:1.3}.plmt-rich-text h4{font-size:16px;line-height:1.4}.plmt-rich-text ul,.plmt-rich-text ol{padding-left:1.25em}.plmt-rich-text a{color:inherit;text-decoration:underline}img.plmt-image,.plmt-image>img{box-sizing:border-box;width:var(--palmyit-image-width,auto);height:var(--palmyit-image-height,auto);min-width:var(--palmyit-image-min-width,auto);min-height:var(--palmyit-image-min-height,auto);max-width:var(--palmyit-image-max-width,100%);max-height:var(--palmyit-image-max-height,none);border-width:var(--palmyit-image-border-width,0);border-style:var(--palmyit-image-border-style,solid);border-color:var(--palmyit-image-border-color,currentColor);border-top-left-radius:var(--palmyit-image-border-top-left-radius,0);border-top-right-radius:var(--palmyit-image-border-top-right-radius,0);border-bottom-right-radius:var(--palmyit-image-border-bottom-right-radius,0);border-bottom-left-radius:var(--palmyit-image-border-bottom-left-radius,0);display:block}a.plmt-image{color:inherit;text-decoration:none;display:inline-block}img.plmt-image[data-background],.plmt-image[data-background]>img{background-color:var(--palmyit-image-background-color,transparent);background-image:var(--palmyit-image-background-image,none)}video.plmt-video{width:100%;max-width:100%;height:auto;display:block}ul.plmt-list{overflow-wrap:anywhere;margin:0;padding-left:1.25em}.plmt-icon{vertical-align:middle;justify-content:center;align-items:center;width:1em;height:1em;font-size:24px;line-height:0;display:inline-flex}.plmt-divider{opacity:.35;border:none;border-top:1px solid;margin:.75em 0;display:block}.plmt-divider[data-size="1"]{width:4rem}.plmt-divider[data-size="2"]{width:8rem}.plmt-divider[data-size="3"]{width:16rem}.plmt-divider[data-size="4"],.plmt-divider:not([data-size]){width:100%}.plmt-table>table{border-collapse:collapse;width:100%}.plmt-table th,.plmt-table td{border:1px solid color-mix(in srgb, currentColor 20%, transparent);text-align:start;padding:.5em .75em}.plmt-text-field,.plmt-text-area,.plmt-checkbox,.plmt-radio,.plmt-select{display:block}.plmt-text-field label,.plmt-text-area label,.plmt-select label,.plmt-checkbox label{flex-direction:column;gap:.25em;display:flex}.plmt-text-field input,.plmt-text-area textarea,.plmt-select select{font:inherit;border:1px solid color-mix(in srgb, currentColor 25%, transparent);border-radius:var(--plmt-theme-radius);padding:.5em .75em}.plmt-checkbox label{flex-direction:row;align-items:center;gap:.5em}.plmt-radio fieldset{border:none;margin:0;padding:0}.plmt-radio legend{margin-bottom:.5em}.plmt-radio label{align-items:center;gap:.5em;margin-bottom:.25em;display:flex}
2
+ /*$vite$:1*/
File without changes
@@ -0,0 +1,9 @@
1
+ import { ElementType, RegisteredElementConfiguration } from './schema/elementConfiguration';
2
+ import { elementSpec, toElementTree, ShortcodeNode } from './templates/elementSpec';
3
+ import { ElementSpec, ElementSpecOptions } from './render/types';
4
+ export type ElementEntry = {
5
+ definition: RegisteredElementConfiguration;
6
+ template: (node: ShortcodeNode, options?: ElementSpecOptions) => ElementSpec | null;
7
+ };
8
+ export declare const registry: Record<ElementType, ElementEntry>;
9
+ export { elementSpec, toElementTree };
@@ -0,0 +1,5 @@
1
+ import { ElementSpec } from './types';
2
+ export declare function escapeHtml(value: unknown): string;
3
+ /** Drop script/style blocks, event handlers, and javascript: URLs from rich text. */
4
+ export declare function sanitizeRichTextHtml(html: string): string;
5
+ export declare function renderHtml(node: ElementSpec | string): string;
@@ -0,0 +1,2 @@
1
+ import { CssVariables } from './types';
2
+ export declare function styleToCssVariables(style: Record<string, unknown> | undefined, prefix: string): CssVariables;
@@ -0,0 +1,42 @@
1
+ import { ElementType } from '../schema/elementConfiguration';
2
+ /** CSS class hook for each shortcode element type. */
3
+ export declare const tags: {
4
+ readonly PPage: "plmt-page";
5
+ readonly PSection: "plmt-section";
6
+ readonly PContainer: "plmt-container";
7
+ readonly PButton: "plmt-button";
8
+ readonly PText: "plmt-text";
9
+ readonly PRichText: "plmt-rich-text";
10
+ readonly PImage: "plmt-image";
11
+ readonly PVideo: "plmt-video";
12
+ readonly PList: "plmt-list";
13
+ readonly PIcon: "plmt-icon";
14
+ readonly PDivider: "plmt-divider";
15
+ readonly PTable: "plmt-table";
16
+ readonly PTextField: "plmt-text-field";
17
+ readonly PTextArea: "plmt-text-area";
18
+ readonly PCheckbox: "plmt-checkbox";
19
+ readonly PRadio: "plmt-radio";
20
+ readonly PSelect: "plmt-select";
21
+ };
22
+ export type ShortcodeTag = (typeof tags)[ElementType];
23
+ /** Semantic HTML tag for each element type (Stage 3). */
24
+ export declare const semanticTags: {
25
+ readonly PPage: "main";
26
+ readonly PSection: "section";
27
+ readonly PContainer: "div";
28
+ readonly PButton: "button";
29
+ readonly PText: "p";
30
+ readonly PRichText: "div";
31
+ readonly PImage: "img";
32
+ readonly PVideo: "video";
33
+ readonly PList: "ul";
34
+ readonly PIcon: "span";
35
+ readonly PDivider: "hr";
36
+ readonly PTable: "div";
37
+ readonly PTextField: "div";
38
+ readonly PTextArea: "div";
39
+ readonly PCheckbox: "div";
40
+ readonly PRadio: "fieldset";
41
+ readonly PSelect: "div";
42
+ };
@@ -0,0 +1,3 @@
1
+ import { ElementSpec } from './types';
2
+ /** Turn an ElementSpec into a real DOM node (for Storybook / tests). */
3
+ export declare function toDom(node: ElementSpec | string): Node;
@@ -0,0 +1,14 @@
1
+ export type ElementAttribute = string | number | boolean | undefined;
2
+ export type CssVariables = Record<string, string | undefined>;
3
+ export type ElementSpec = {
4
+ tag: string;
5
+ attrs: Record<string, ElementAttribute>;
6
+ styleVars: CssVariables;
7
+ children?: Array<ElementSpec | string> | {
8
+ html: string;
9
+ };
10
+ };
11
+ export type ElementSpecOptions = {
12
+ /** Layout host children (from Puck slots or recursion). Ignored for leaf elements. */
13
+ children?: Array<ElementSpec | string>;
14
+ };
@@ -0,0 +1,15 @@
1
+ import { ColorValue } from '../ColorField/color-value';
2
+ export type BackgroundType = 'color' | 'gradient';
3
+ export type GradientKind = 'linear' | 'radial';
4
+ export type GradientValue = {
5
+ kind: GradientKind;
6
+ value: string;
7
+ };
8
+ export type BackgroundStyle = {
9
+ backgroundType: BackgroundType;
10
+ backgroundColor: ColorValue;
11
+ backgroundGradient: GradientValue;
12
+ };
13
+ export declare const MAX_GRADIENT_ARGS_LENGTH = 200;
14
+ export declare function isSafeGradientArgs(value: string): boolean;
15
+ export declare function gradientToCss(gradient: GradientValue): string | undefined;
@@ -0,0 +1,6 @@
1
+ export type ColorValue = {
2
+ hex: string;
3
+ opacity: number;
4
+ };
5
+ export declare function toHexAlpha(value: ColorValue): string;
6
+ export declare function fromHexAlpha(color: string): ColorValue | null;
@@ -0,0 +1 @@
1
+ export * from './color-value';
@@ -0,0 +1,2 @@
1
+ export declare const FONT_STYLES: readonly ["normal", "italic", "oblique"];
2
+ export type FontStyle = (typeof FONT_STYLES)[number];
@@ -0,0 +1,3 @@
1
+ export declare const NO_ICON = "";
2
+ export declare function isOutlineIconName(value: string): boolean;
3
+ export declare function labelForIcon(value: string): string;
@@ -0,0 +1,38 @@
1
+ import { LinkSettings } from '../linkSettings';
2
+ import { LengthKey } from '../elementStyleDefinitions';
3
+ import { BorderLineStyle } from '../style/elementStyle';
4
+ import { BackgroundStyle } from '../Fields/BackgroundField/backgroundValue';
5
+ import { ColorValue } from '../Fields/ColorField/color-value';
6
+ /** Every key stays unset until the user edits it, so the button keeps its theme look. */
7
+ export type ButtonStyle = Partial<BackgroundStyle & Record<LengthKey, string> & {
8
+ borderWidth: string;
9
+ borderStyle: BorderLineStyle;
10
+ borderColor: ColorValue;
11
+ textColor: ColorValue;
12
+ textFont: string;
13
+ textSize: string;
14
+ iconGap: string;
15
+ }>;
16
+ export type PButtonDocumentProps = LinkSettings & {
17
+ id: string;
18
+ name: string;
19
+ startIcon: string;
20
+ endIcon: string;
21
+ style: ButtonStyle;
22
+ };
23
+ export declare const defaultButtonProps: {
24
+ style: ButtonStyle;
25
+ href: string;
26
+ target: import('../linkSettings').LinkTarget;
27
+ description: string;
28
+ name: string;
29
+ startIcon: string;
30
+ endIcon: string;
31
+ };
32
+ export declare const pButtonDefinition: import('../elementConfiguration').ElementConfiguration<LinkSettings & {
33
+ id: string;
34
+ name: string;
35
+ startIcon: string;
36
+ endIcon: string;
37
+ style: ButtonStyle;
38
+ } & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,10 @@
1
+ export type PCheckboxDocumentProps = {
2
+ id: string;
3
+ label: string;
4
+ checked: boolean;
5
+ };
6
+ export declare const defaultCheckboxProps: {
7
+ label: string;
8
+ checked: boolean;
9
+ };
10
+ export declare const pCheckboxDefinition: import('../elementConfiguration').ElementConfiguration<PCheckboxDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,39 @@
1
+ export declare const defaultContainerStyle: {
2
+ layout: import('../style/elementStyle').ElementLayout;
3
+ gridColumns?: import('../style/elementStyle').GridColumnCount;
4
+ flexDirection: import('../style/elementStyle').FlexDirection;
5
+ flexWrap: import('../style/elementStyle').FlexWrap;
6
+ justifyContent: import('../style/elementStyle').FlexJustifyContent;
7
+ alignItems: import('../style/elementStyle').FlexAlignItems;
8
+ alignContent: import('../style/elementStyle').FlexAlignContent;
9
+ rowGap: string;
10
+ columnGap: string;
11
+ overflow: import('../style/elementStyle').ElementOverflow;
12
+ overflowVertical: boolean;
13
+ overflowHorizontal: boolean;
14
+ width: string;
15
+ height: string;
16
+ minWidth: string;
17
+ minHeight: string;
18
+ maxWidth: string;
19
+ maxHeight: string;
20
+ paddingTop: string;
21
+ paddingBottom: string;
22
+ paddingLeft: string;
23
+ paddingRight: string;
24
+ marginTop: string;
25
+ marginBottom: string;
26
+ marginLeft: string;
27
+ marginRight: string;
28
+ borderRadiusTopLeft: string;
29
+ borderRadiusTopRight: string;
30
+ borderRadiusBottomRight: string;
31
+ borderRadiusBottomLeft: string;
32
+ borderWidth: string;
33
+ borderStyle: import('../style/elementStyle').BorderLineStyle;
34
+ borderColor: import('../../definitions').ColorValue;
35
+ backgroundType: import('../Fields/BackgroundField/backgroundValue').BackgroundType;
36
+ backgroundColor: import('../../definitions').ColorValue;
37
+ backgroundGradient: import('../Fields/BackgroundField/backgroundValue').GradientValue;
38
+ };
39
+ export declare const pContainerDefinition: import('../elementConfiguration').ElementConfiguration<import('../layoutElementConfiguration').LayoutElementProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,10 @@
1
+ export declare const dividerSizes: readonly ["1", "2", "3", "4"];
2
+ export type DividerSize = (typeof dividerSizes)[number];
3
+ export type PDividerDocumentProps = {
4
+ id: string;
5
+ size: DividerSize;
6
+ };
7
+ export declare const defaultDividerProps: {
8
+ size: DividerSize;
9
+ };
10
+ export declare const pDividerDefinition: import('../elementConfiguration').ElementConfiguration<PDividerDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,18 @@
1
+ import { LinkSettings } from '../linkSettings';
2
+ export type PIconDocumentProps = LinkSettings & {
3
+ id: string;
4
+ icon: string;
5
+ label: string;
6
+ };
7
+ export declare const defaultIconProps: {
8
+ href: string;
9
+ target: import('../linkSettings').LinkTarget;
10
+ description: string;
11
+ icon: string;
12
+ label: string;
13
+ };
14
+ export declare const pIconDefinition: import('../elementConfiguration').ElementConfiguration<LinkSettings & {
15
+ id: string;
16
+ icon: string;
17
+ label: string;
18
+ } & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,33 @@
1
+ import { LinkSettings } from '../linkSettings';
2
+ import { BorderLineStyle } from '../style/elementStyle';
3
+ import { BackgroundStyle } from '../Fields/BackgroundField/backgroundValue';
4
+ import { ColorValue } from '../Fields/ColorField/color-value';
5
+ export declare const IMAGE_LENGTH_KEYS: ("width" | "height" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "borderRadiusTopLeft" | "borderRadiusTopRight" | "borderRadiusBottomRight" | "borderRadiusBottomLeft")[];
6
+ export type ImageLengthKey = (typeof IMAGE_LENGTH_KEYS)[number];
7
+ /** Every key stays unset until the user edits it, so the image keeps its natural size and no frame. */
8
+ export type ImageStyle = Partial<BackgroundStyle & Record<ImageLengthKey, string> & {
9
+ borderWidth: string;
10
+ borderStyle: BorderLineStyle;
11
+ borderColor: ColorValue;
12
+ }>;
13
+ export type PImageDocumentProps = LinkSettings & {
14
+ id: string;
15
+ src: string;
16
+ alt: string;
17
+ style: ImageStyle;
18
+ };
19
+ export declare const defaultImageProps: {
20
+ href: string;
21
+ target: import('../linkSettings').LinkTarget;
22
+ description: string;
23
+ src: string;
24
+ alt: string;
25
+ style: ImageStyle;
26
+ };
27
+ export declare const IMAGE_PREFIX = "--palmyit-image";
28
+ export declare const pImageDefinition: import('../elementConfiguration').ElementConfiguration<LinkSettings & {
29
+ id: string;
30
+ src: string;
31
+ alt: string;
32
+ style: ImageStyle;
33
+ } & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,11 @@
1
+ import { TextItem } from '../textItems';
2
+ export type PListDocumentProps = {
3
+ id: string;
4
+ items: TextItem[];
5
+ };
6
+ export declare const defaultListProps: {
7
+ items: {
8
+ text: string;
9
+ }[];
10
+ };
11
+ export declare const pListDefinition: import('../elementConfiguration').ElementConfiguration<PListDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,22 @@
1
+ import { ColorValue } from '../Fields/ColorField/color-value';
2
+ export type PPageRootProps = {
3
+ pageId: string;
4
+ url: string;
5
+ title: string;
6
+ backgroundColor: ColorValue;
7
+ textColor: ColorValue;
8
+ textSize: number;
9
+ };
10
+ export declare const defaultPageStyle: {
11
+ backgroundColor: {
12
+ hex: string;
13
+ opacity: number;
14
+ };
15
+ textColor: {
16
+ hex: string;
17
+ opacity: number;
18
+ };
19
+ textSize: number;
20
+ };
21
+ export declare const pageStyleKeys: readonly string[];
22
+ export declare const pPageDefinition: import('../elementConfiguration').ElementConfiguration<PPageRootProps>;
@@ -0,0 +1,13 @@
1
+ import { TextItem } from '../textItems';
2
+ export type PRadioDocumentProps = {
3
+ id: string;
4
+ legend: string;
5
+ options: TextItem[];
6
+ };
7
+ export declare const defaultRadioProps: {
8
+ legend: string;
9
+ options: {
10
+ text: string;
11
+ }[];
12
+ };
13
+ export declare const pRadioDefinition: import('../elementConfiguration').ElementConfiguration<PRadioDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,8 @@
1
+ export type PRichTextDocumentProps = {
2
+ id: string;
3
+ text: string;
4
+ };
5
+ export declare const defaultRichTextProps: {
6
+ text: string;
7
+ };
8
+ export declare const pRichTextDefinition: import('../elementConfiguration').ElementConfiguration<PRichTextDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,4 @@
1
+ export declare const textColors: readonly ["primary-500", "secondary-500", "accent-500", "error-500", "neutral-900"];
2
+ export declare const textHighlights: readonly ["accent-100", "secondary-100", "warning-100", "success-100"];
3
+ export declare const lineHeights: readonly ["1", "1.4", "1.8", "2"];
4
+ export declare function isFontFamily(value: unknown): value is string;
@@ -0,0 +1,2 @@
1
+ export declare function normalizeRichText(html: string): string;
2
+ export declare function richTextToPlainText(html: string): string;
@@ -0,0 +1,39 @@
1
+ export declare const defaultSectionStyle: {
2
+ layout: import('../style/elementStyle').ElementLayout;
3
+ gridColumns?: import('../style/elementStyle').GridColumnCount;
4
+ flexDirection: import('../style/elementStyle').FlexDirection;
5
+ flexWrap: import('../style/elementStyle').FlexWrap;
6
+ justifyContent: import('../style/elementStyle').FlexJustifyContent;
7
+ alignItems: import('../style/elementStyle').FlexAlignItems;
8
+ alignContent: import('../style/elementStyle').FlexAlignContent;
9
+ rowGap: string;
10
+ columnGap: string;
11
+ overflow: import('../style/elementStyle').ElementOverflow;
12
+ overflowVertical: boolean;
13
+ overflowHorizontal: boolean;
14
+ width: string;
15
+ height: string;
16
+ minWidth: string;
17
+ minHeight: string;
18
+ maxWidth: string;
19
+ maxHeight: string;
20
+ paddingTop: string;
21
+ paddingBottom: string;
22
+ paddingLeft: string;
23
+ paddingRight: string;
24
+ marginTop: string;
25
+ marginBottom: string;
26
+ marginLeft: string;
27
+ marginRight: string;
28
+ borderRadiusTopLeft: string;
29
+ borderRadiusTopRight: string;
30
+ borderRadiusBottomRight: string;
31
+ borderRadiusBottomLeft: string;
32
+ borderWidth: string;
33
+ borderStyle: import('../style/elementStyle').BorderLineStyle;
34
+ borderColor: import('../../definitions').ColorValue;
35
+ backgroundType: import('../Fields/BackgroundField/backgroundValue').BackgroundType;
36
+ backgroundColor: import('../../definitions').ColorValue;
37
+ backgroundGradient: import('../Fields/BackgroundField/backgroundValue').GradientValue;
38
+ };
39
+ export declare const pSectionDefinition: import('../elementConfiguration').ElementConfiguration<import('../layoutElementConfiguration').LayoutElementProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,13 @@
1
+ import { TextItem } from '../textItems';
2
+ export type PSelectDocumentProps = {
3
+ id: string;
4
+ label: string;
5
+ options: TextItem[];
6
+ };
7
+ export declare const defaultSelectProps: {
8
+ label: string;
9
+ options: {
10
+ text: string;
11
+ }[];
12
+ };
13
+ export declare const pSelectDefinition: import('../elementConfiguration').ElementConfiguration<PSelectDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,20 @@
1
+ import { TextItem } from '../textItems';
2
+ export type TableRow = {
3
+ cells: string[];
4
+ };
5
+ export type PTableDocumentProps = {
6
+ id: string;
7
+ headers: TextItem[];
8
+ rows: TableRow[];
9
+ };
10
+ export declare const defaultTableProps: {
11
+ headers: {
12
+ text: string;
13
+ }[];
14
+ rows: {
15
+ cells: string[];
16
+ }[];
17
+ };
18
+ /** Pads or trims every row to one cell per column. */
19
+ export declare function fitRowsToHeaders(columnCount: number, rows: readonly TableRow[]): TableRow[];
20
+ export declare const pTableDefinition: import('../elementConfiguration').ElementConfiguration<PTableDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,46 @@
1
+ import { LinkSettings } from '../linkSettings';
2
+ import { StyleDefinition } from '../styleItems';
3
+ import { ColorValue } from '../Fields/ColorField/color-value';
4
+ import { FontStyle } from '../Fields/FontStyleField';
5
+ export declare const TEXT_DECORATIONS: readonly ["none", "underline", "overline", "line-through"];
6
+ export declare const TEXT_ALIGNS: readonly ["left", "center", "right", "justify"];
7
+ export declare const TEXT_TRANSFORMS: readonly ["none", "capitalize", "uppercase", "lowercase"];
8
+ export declare const FONT_WEIGHTS: readonly ["100", "200", "300", "400", "500", "600", "700", "800", "900"];
9
+ export type TextDecoration = (typeof TEXT_DECORATIONS)[number];
10
+ export type TextAlign = (typeof TEXT_ALIGNS)[number];
11
+ export type TextTransform = (typeof TEXT_TRANSFORMS)[number];
12
+ export type FontWeight = (typeof FONT_WEIGHTS)[number];
13
+ /** Every key stays unset until the user edits it, so the text keeps the page typography. */
14
+ export type TextStyle = Partial<{
15
+ textFont: string;
16
+ fontStyle: FontStyle;
17
+ textSize: string;
18
+ textColor: ColorValue;
19
+ lineHeight: string;
20
+ letterSpacing: string;
21
+ wordSpacing: string;
22
+ textDecoration: TextDecoration;
23
+ textAlign: TextAlign;
24
+ textTransform: TextTransform;
25
+ fontWeight: FontWeight;
26
+ }>;
27
+ export type PTextDocumentProps = LinkSettings & {
28
+ id: string;
29
+ text: string;
30
+ style: TextStyle;
31
+ };
32
+ export declare const defaultTextProps: {
33
+ style: TextStyle;
34
+ href: string;
35
+ target: import('../linkSettings').LinkTarget;
36
+ description: string;
37
+ text: string;
38
+ };
39
+ export declare const TEXT_PREFIX = "--palmyit-text";
40
+ /** The Text style keys, written under `prefix` so each element keeps its own variables. */
41
+ export declare function textStyleDefinitions(prefix: string): StyleDefinition[];
42
+ export declare const pTextDefinition: import('../elementConfiguration').ElementConfiguration<LinkSettings & {
43
+ id: string;
44
+ text: string;
45
+ style: TextStyle;
46
+ } & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,10 @@
1
+ export type PTextAreaDocumentProps = {
2
+ id: string;
3
+ label: string;
4
+ placeholder: string;
5
+ };
6
+ export declare const defaultTextAreaProps: {
7
+ label: string;
8
+ placeholder: string;
9
+ };
10
+ export declare const pTextAreaDefinition: import('../elementConfiguration').ElementConfiguration<PTextAreaDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,10 @@
1
+ export type PTextFieldDocumentProps = {
2
+ id: string;
3
+ label: string;
4
+ placeholder: string;
5
+ };
6
+ export declare const defaultTextFieldProps: {
7
+ label: string;
8
+ placeholder: string;
9
+ };
10
+ export declare const pTextFieldDefinition: import('../elementConfiguration').ElementConfiguration<PTextFieldDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,10 @@
1
+ export type PVideoDocumentProps = {
2
+ id: string;
3
+ src: string;
4
+ title: string;
5
+ };
6
+ export declare const defaultVideoProps: {
7
+ src: string;
8
+ title: string;
9
+ };
10
+ export declare const pVideoDefinition: import('../elementConfiguration').ElementConfiguration<PVideoDocumentProps & Partial<import('../deviceVisibility').DeviceVisibility> & Partial<Record<"tabletStyle" | "mobileStyle" | "tabletLandscapeStyle" | "mobileLandscapeStyle", Partial<Record<string, unknown>>>>>;
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ /** An http(s) URL or a single-slash path on the same site. Other schemes and relative paths are rejected. */
3
+ export declare const addressSchema: z.ZodString;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { BackgroundStyle } from './Fields/BackgroundField/backgroundValue';
3
+ import { StyleDefinition } from './styleItems';
4
+ export declare const colorValue: z.ZodObject<{
5
+ hex: z.ZodString;
6
+ opacity: z.ZodNumber;
7
+ }, z.core.$strict>;
8
+ type BackgroundDefinitionOptions = {
9
+ /** Omit to leave every background key unset until the user picks one. */
10
+ defaults?: BackgroundStyle;
11
+ /** A data attribute the element sets while it has a background type. */
12
+ typeAttribute?: string;
13
+ };
14
+ export declare function backgroundStyleDefinitions(prefix: string, { defaults, typeAttribute }?: BackgroundDefinitionOptions): StyleDefinition[];
15
+ export {};
@@ -0,0 +1,13 @@
1
+ import { DeviceName, Orientation } from './devices';
2
+ export type DeviceStyleProp = 'style' | 'tabletStyle' | 'mobileStyle' | 'tabletLandscapeStyle' | 'mobileLandscapeStyle';
3
+ export type DeviceStyles<TStyle> = {
4
+ style: TStyle;
5
+ } & Partial<Record<Exclude<DeviceStyleProp, 'style'>, Partial<TStyle>>>;
6
+ /** The prop a style edit on this device and orientation writes to. */
7
+ export declare function deviceStyleProp(device: DeviceName, orientation?: Orientation): DeviceStyleProp;
8
+ /** The override stored for exactly this device and orientation; Desktop has none. */
9
+ export declare function deviceOverride<TStyle>(styles: DeviceStyles<TStyle>, device: DeviceName, orientation?: Orientation): Partial<TStyle>;
10
+ /** The keys of `next` set to a different value than in `previous`. */
11
+ export declare function changedStyle<TStyle extends object>(previous: TStyle, next: Partial<TStyle>): Partial<TStyle>;
12
+ /** Desktop, then the device's portrait override, then in landscape its landscape override. */
13
+ export declare function resolveDeviceStyle<TStyle>(styles: DeviceStyles<TStyle>, device: DeviceName, orientation?: Orientation): TStyle;
@@ -0,0 +1,21 @@
1
+ export type DeviceName = 'Desktop' | 'Tablet' | 'Mobile';
2
+ export type Orientation = 'portrait' | 'landscape';
3
+ export type ViewportSize = {
4
+ width: number;
5
+ height: number | 'auto';
6
+ };
7
+ export type BuilderDevice = {
8
+ name: DeviceName;
9
+ icon: 'Monitor' | 'Tablet' | 'Smartphone';
10
+ portrait: ViewportSize;
11
+ landscape?: ViewportSize;
12
+ };
13
+ export declare const builderDevices: BuilderDevice[];
14
+ export declare const builderViewports: {
15
+ icon: "Tablet" | "Monitor" | "Smartphone";
16
+ label: DeviceName;
17
+ width: number;
18
+ height: number | "auto";
19
+ }[];
20
+ export declare function deviceForWidth(width: number | '100%'): BuilderDevice;
21
+ export declare function orientationForWidth(width: number | '100%'): Orientation;
@@ -0,0 +1,13 @@
1
+ import { DeviceStyleProp } from './device/deviceStyle';
2
+ import { ElementConfiguration } from './elementConfiguration';
3
+ import { DeviceVisibility } from './deviceVisibility';
4
+ import { StyleDefinition } from './styleItems';
5
+ type OverrideProp = Exclude<DeviceStyleProp, 'style'>;
6
+ export type DeviceStyleOverrides<TStyle> = Partial<Record<OverrideProp, Partial<TStyle>>>;
7
+ /**
8
+ * Adds the Show for devices flags to an element, and, when it has `styles`,
9
+ * portrait and landscape Tablet and Mobile overrides of those styles. Publish
10
+ * writes only flags that change visibility and overrides that are set.
11
+ */
12
+ export declare function withDeviceSettings<TProps>(configuration: ElementConfiguration<TProps>, styles?: StyleDefinition[]): ElementConfiguration<TProps & Partial<DeviceVisibility> & DeviceStyleOverrides<Record<string, unknown>>>;
13
+ export {};