@d34dman/flowdrop 0.0.28 → 0.0.30

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.
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Form Field Component Registry
3
+ *
4
+ * Provides a registry system for form field components that enables:
5
+ * - Tree-shaking: Heavy components (code editor, markdown) are only bundled when registered
6
+ * - Dynamic field types: Users can add custom field renderers
7
+ * - Lazy loading: Components can be registered at runtime
8
+ *
9
+ * @module form/fieldRegistry
10
+ *
11
+ * @example Basic usage with light fields only (no codemirror/easymde):
12
+ * ```typescript
13
+ * import { SchemaForm } from "@d34dman/flowdrop/form";
14
+ * // Uses only basic fields - small bundle size
15
+ * ```
16
+ *
17
+ * @example Adding code editor support:
18
+ * ```typescript
19
+ * import { SchemaForm, registerFieldComponent } from "@d34dman/flowdrop/form";
20
+ * import { FormCodeEditor, codeEditorFieldMatcher } from "@d34dman/flowdrop/form/code";
21
+ *
22
+ * registerFieldComponent("code-editor", FormCodeEditor, codeEditorFieldMatcher);
23
+ * ```
24
+ */
25
+ import type { Component } from "svelte";
26
+ import type { FieldSchema } from "../components/form/types.js";
27
+ /**
28
+ * Base field component props that all registered field components should accept.
29
+ * Components may have additional specific props.
30
+ */
31
+ export interface FieldComponentProps {
32
+ /** Field identifier */
33
+ id: string;
34
+ /** Current field value */
35
+ value: unknown;
36
+ /** Placeholder text */
37
+ placeholder?: string;
38
+ /** Whether field is required */
39
+ required?: boolean;
40
+ /** ARIA description ID */
41
+ ariaDescribedBy?: string;
42
+ /** Change callback */
43
+ onChange: (value: unknown) => void;
44
+ /** Additional schema-derived props */
45
+ [key: string]: unknown;
46
+ }
47
+ /**
48
+ * Function type for determining if a field schema should use a specific component
49
+ */
50
+ export type FieldMatcher = (schema: FieldSchema) => boolean;
51
+ /**
52
+ * Generic component type that accepts any props
53
+ * This is needed because different field components have different prop requirements
54
+ */
55
+ export type FieldComponent = Component<any, any, any>;
56
+ /**
57
+ * Registration entry for a field component
58
+ */
59
+ export interface FieldComponentRegistration {
60
+ /** The Svelte component to render */
61
+ component: FieldComponent;
62
+ /** Function to determine if this component should handle a given schema */
63
+ matcher: FieldMatcher;
64
+ /** Priority for matching (higher = checked first) */
65
+ priority: number;
66
+ }
67
+ /**
68
+ * Register a field component for a specific field type
69
+ *
70
+ * @param type - Unique identifier for this field type
71
+ * @param component - Svelte component to render for matching fields
72
+ * @param matcher - Function to determine if a schema matches this type
73
+ * @param priority - Priority for matching (default: 0, higher = checked first)
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * registerFieldComponent(
78
+ * "code-editor",
79
+ * FormCodeEditor,
80
+ * (schema) => schema.format === "json" || schema.format === "code",
81
+ * 100 // High priority to override default
82
+ * );
83
+ * ```
84
+ */
85
+ export declare function registerFieldComponent(type: string, component: FieldComponent, matcher: FieldMatcher, priority?: number): void;
86
+ /**
87
+ * Unregister a field component
88
+ *
89
+ * @param type - The field type to unregister
90
+ * @returns true if the component was registered and removed
91
+ */
92
+ export declare function unregisterFieldComponent(type: string): boolean;
93
+ /**
94
+ * Get all registered field types
95
+ *
96
+ * @returns Array of registered field type identifiers
97
+ */
98
+ export declare function getRegisteredFieldTypes(): string[];
99
+ /**
100
+ * Check if a field type is registered
101
+ *
102
+ * @param type - Field type to check
103
+ * @returns true if the type is registered
104
+ */
105
+ export declare function isFieldTypeRegistered(type: string): boolean;
106
+ /**
107
+ * Resolve which component should render a given field schema
108
+ * Checks registered matchers in priority order
109
+ *
110
+ * @param schema - The field schema to resolve
111
+ * @returns The matching registration or null if no match
112
+ */
113
+ export declare function resolveFieldComponent(schema: FieldSchema): FieldComponentRegistration | null;
114
+ /**
115
+ * Clear all registered field components
116
+ * Useful for testing or reset scenarios
117
+ */
118
+ export declare function clearFieldRegistry(): void;
119
+ /**
120
+ * Get the registry size
121
+ * @returns Number of registered field components
122
+ */
123
+ export declare function getFieldRegistrySize(): number;
124
+ /**
125
+ * Matcher for hidden fields (should not render)
126
+ */
127
+ export declare const hiddenFieldMatcher: FieldMatcher;
128
+ /**
129
+ * Matcher for checkbox group fields (enum with multiple)
130
+ */
131
+ export declare const checkboxGroupMatcher: FieldMatcher;
132
+ /**
133
+ * Matcher for enum select fields
134
+ */
135
+ export declare const enumSelectMatcher: FieldMatcher;
136
+ /**
137
+ * Matcher for multiline textarea fields
138
+ */
139
+ export declare const textareaMatcher: FieldMatcher;
140
+ /**
141
+ * Matcher for range slider fields
142
+ */
143
+ export declare const rangeMatcher: FieldMatcher;
144
+ /**
145
+ * Matcher for string text fields
146
+ */
147
+ export declare const textFieldMatcher: FieldMatcher;
148
+ /**
149
+ * Matcher for number fields
150
+ */
151
+ export declare const numberFieldMatcher: FieldMatcher;
152
+ /**
153
+ * Matcher for boolean toggle fields
154
+ */
155
+ export declare const toggleMatcher: FieldMatcher;
156
+ /**
157
+ * Matcher for select fields with options
158
+ */
159
+ export declare const selectOptionsMatcher: FieldMatcher;
160
+ /**
161
+ * Matcher for array fields
162
+ */
163
+ export declare const arrayMatcher: FieldMatcher;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Form Field Component Registry
3
+ *
4
+ * Provides a registry system for form field components that enables:
5
+ * - Tree-shaking: Heavy components (code editor, markdown) are only bundled when registered
6
+ * - Dynamic field types: Users can add custom field renderers
7
+ * - Lazy loading: Components can be registered at runtime
8
+ *
9
+ * @module form/fieldRegistry
10
+ *
11
+ * @example Basic usage with light fields only (no codemirror/easymde):
12
+ * ```typescript
13
+ * import { SchemaForm } from "@d34dman/flowdrop/form";
14
+ * // Uses only basic fields - small bundle size
15
+ * ```
16
+ *
17
+ * @example Adding code editor support:
18
+ * ```typescript
19
+ * import { SchemaForm, registerFieldComponent } from "@d34dman/flowdrop/form";
20
+ * import { FormCodeEditor, codeEditorFieldMatcher } from "@d34dman/flowdrop/form/code";
21
+ *
22
+ * registerFieldComponent("code-editor", FormCodeEditor, codeEditorFieldMatcher);
23
+ * ```
24
+ */
25
+ /**
26
+ * Field component registry
27
+ * Stores registered field components with their matchers
28
+ */
29
+ const fieldRegistry = new Map();
30
+ /**
31
+ * Ordered list of field type keys by priority (highest first)
32
+ * Cached and invalidated when registry changes
33
+ */
34
+ let orderedKeys = null;
35
+ /**
36
+ * Register a field component for a specific field type
37
+ *
38
+ * @param type - Unique identifier for this field type
39
+ * @param component - Svelte component to render for matching fields
40
+ * @param matcher - Function to determine if a schema matches this type
41
+ * @param priority - Priority for matching (default: 0, higher = checked first)
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * registerFieldComponent(
46
+ * "code-editor",
47
+ * FormCodeEditor,
48
+ * (schema) => schema.format === "json" || schema.format === "code",
49
+ * 100 // High priority to override default
50
+ * );
51
+ * ```
52
+ */
53
+ export function registerFieldComponent(type, component, matcher, priority = 0) {
54
+ fieldRegistry.set(type, { component, matcher, priority });
55
+ orderedKeys = null; // Invalidate cache
56
+ }
57
+ /**
58
+ * Unregister a field component
59
+ *
60
+ * @param type - The field type to unregister
61
+ * @returns true if the component was registered and removed
62
+ */
63
+ export function unregisterFieldComponent(type) {
64
+ const removed = fieldRegistry.delete(type);
65
+ if (removed) {
66
+ orderedKeys = null; // Invalidate cache
67
+ }
68
+ return removed;
69
+ }
70
+ /**
71
+ * Get all registered field types
72
+ *
73
+ * @returns Array of registered field type identifiers
74
+ */
75
+ export function getRegisteredFieldTypes() {
76
+ return Array.from(fieldRegistry.keys());
77
+ }
78
+ /**
79
+ * Check if a field type is registered
80
+ *
81
+ * @param type - Field type to check
82
+ * @returns true if the type is registered
83
+ */
84
+ export function isFieldTypeRegistered(type) {
85
+ return fieldRegistry.has(type);
86
+ }
87
+ /**
88
+ * Get ordered keys by priority (cached)
89
+ */
90
+ function getOrderedKeys() {
91
+ if (orderedKeys === null) {
92
+ orderedKeys = Array.from(fieldRegistry.entries())
93
+ .sort((a, b) => b[1].priority - a[1].priority)
94
+ .map(([key]) => key);
95
+ }
96
+ return orderedKeys;
97
+ }
98
+ /**
99
+ * Resolve which component should render a given field schema
100
+ * Checks registered matchers in priority order
101
+ *
102
+ * @param schema - The field schema to resolve
103
+ * @returns The matching registration or null if no match
104
+ */
105
+ export function resolveFieldComponent(schema) {
106
+ const keys = getOrderedKeys();
107
+ for (const key of keys) {
108
+ const registration = fieldRegistry.get(key);
109
+ if (registration && registration.matcher(schema)) {
110
+ return registration;
111
+ }
112
+ }
113
+ return null;
114
+ }
115
+ /**
116
+ * Clear all registered field components
117
+ * Useful for testing or reset scenarios
118
+ */
119
+ export function clearFieldRegistry() {
120
+ fieldRegistry.clear();
121
+ orderedKeys = null;
122
+ }
123
+ /**
124
+ * Get the registry size
125
+ * @returns Number of registered field components
126
+ */
127
+ export function getFieldRegistrySize() {
128
+ return fieldRegistry.size;
129
+ }
130
+ // ============================================================================
131
+ // Built-in Field Matchers (for light fields)
132
+ // These are always available and used by the base FormField component
133
+ // ============================================================================
134
+ /**
135
+ * Matcher for hidden fields (should not render)
136
+ */
137
+ export const hiddenFieldMatcher = (schema) => schema.format === "hidden";
138
+ /**
139
+ * Matcher for checkbox group fields (enum with multiple)
140
+ */
141
+ export const checkboxGroupMatcher = (schema) => Boolean(schema.enum && schema.multiple);
142
+ /**
143
+ * Matcher for enum select fields
144
+ */
145
+ export const enumSelectMatcher = (schema) => Boolean(schema.enum && !schema.multiple);
146
+ /**
147
+ * Matcher for multiline textarea fields
148
+ */
149
+ export const textareaMatcher = (schema) => schema.type === "string" && schema.format === "multiline";
150
+ /**
151
+ * Matcher for range slider fields
152
+ */
153
+ export const rangeMatcher = (schema) => (schema.type === "number" || schema.type === "integer") &&
154
+ schema.format === "range";
155
+ /**
156
+ * Matcher for string text fields
157
+ */
158
+ export const textFieldMatcher = (schema) => schema.type === "string" && !schema.format;
159
+ /**
160
+ * Matcher for number fields
161
+ */
162
+ export const numberFieldMatcher = (schema) => (schema.type === "number" || schema.type === "integer") &&
163
+ schema.format !== "range";
164
+ /**
165
+ * Matcher for boolean toggle fields
166
+ */
167
+ export const toggleMatcher = (schema) => schema.type === "boolean";
168
+ /**
169
+ * Matcher for select fields with options
170
+ */
171
+ export const selectOptionsMatcher = (schema) => schema.type === "select" || Boolean(schema.options);
172
+ /**
173
+ * Matcher for array fields
174
+ */
175
+ export const arrayMatcher = (schema) => schema.type === "array" && Boolean(schema.items);
@@ -0,0 +1,53 @@
1
+ /**
2
+ * FlowDrop Form Full Module
3
+ *
4
+ * Convenience module that imports and registers all form field types,
5
+ * including heavy editors (CodeMirror, EasyMDE).
6
+ *
7
+ * This is equivalent to importing from the light form module and manually
8
+ * registering all editor types.
9
+ *
10
+ * @module form/full
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Single import that sets up everything
15
+ * import { SchemaForm, initializeAllFieldTypes } from "@d34dman/flowdrop/form/full";
16
+ *
17
+ * // Call once at app startup
18
+ * initializeAllFieldTypes();
19
+ *
20
+ * // Now all field types are available
21
+ * ```
22
+ */
23
+ export * from "./index.js";
24
+ export { FormCodeEditor, FormTemplateEditor } from "./code.js";
25
+ export { FormMarkdownEditor } from "./markdown.js";
26
+ export { registerCodeEditorField, registerTemplateEditorField, registerAllCodeEditors, isCodeEditorRegistered, isTemplateEditorRegistered, codeEditorFieldMatcher, templateEditorFieldMatcher } from "./code.js";
27
+ export { registerMarkdownEditorField, isMarkdownEditorRegistered, markdownEditorFieldMatcher } from "./markdown.js";
28
+ /**
29
+ * Initialize all form field types including heavy editors
30
+ *
31
+ * Call this once at application startup to enable all field types.
32
+ * This includes:
33
+ * - Code/JSON editor (CodeMirror)
34
+ * - Template editor (CodeMirror with Twig/Liquid syntax)
35
+ * - Markdown editor (EasyMDE)
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * import { initializeAllFieldTypes } from "@d34dman/flowdrop/form/full";
40
+ *
41
+ * // In your app's entry point
42
+ * initializeAllFieldTypes();
43
+ * ```
44
+ */
45
+ export declare function initializeAllFieldTypes(): void;
46
+ /**
47
+ * Check if all field types have been initialized
48
+ */
49
+ export declare function areAllFieldTypesInitialized(): boolean;
50
+ /**
51
+ * Reset initialization state (useful for testing)
52
+ */
53
+ export declare function resetFieldTypeInitialization(): void;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * FlowDrop Form Full Module
3
+ *
4
+ * Convenience module that imports and registers all form field types,
5
+ * including heavy editors (CodeMirror, EasyMDE).
6
+ *
7
+ * This is equivalent to importing from the light form module and manually
8
+ * registering all editor types.
9
+ *
10
+ * @module form/full
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Single import that sets up everything
15
+ * import { SchemaForm, initializeAllFieldTypes } from "@d34dman/flowdrop/form/full";
16
+ *
17
+ * // Call once at app startup
18
+ * initializeAllFieldTypes();
19
+ *
20
+ * // Now all field types are available
21
+ * ```
22
+ */
23
+ // Re-export everything from the light form module
24
+ export * from "./index.js";
25
+ // Import registration functions
26
+ import { registerCodeEditorField, registerTemplateEditorField } from "./code.js";
27
+ import { registerMarkdownEditorField } from "./markdown.js";
28
+ // Re-export heavy editor components for direct access
29
+ export { FormCodeEditor, FormTemplateEditor } from "./code.js";
30
+ export { FormMarkdownEditor } from "./markdown.js";
31
+ // Re-export registration functions
32
+ export { registerCodeEditorField, registerTemplateEditorField, registerAllCodeEditors, isCodeEditorRegistered, isTemplateEditorRegistered, codeEditorFieldMatcher, templateEditorFieldMatcher } from "./code.js";
33
+ export { registerMarkdownEditorField, isMarkdownEditorRegistered, markdownEditorFieldMatcher } from "./markdown.js";
34
+ /**
35
+ * Track if all field types have been initialized
36
+ */
37
+ let allFieldTypesInitialized = false;
38
+ /**
39
+ * Initialize all form field types including heavy editors
40
+ *
41
+ * Call this once at application startup to enable all field types.
42
+ * This includes:
43
+ * - Code/JSON editor (CodeMirror)
44
+ * - Template editor (CodeMirror with Twig/Liquid syntax)
45
+ * - Markdown editor (EasyMDE)
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * import { initializeAllFieldTypes } from "@d34dman/flowdrop/form/full";
50
+ *
51
+ * // In your app's entry point
52
+ * initializeAllFieldTypes();
53
+ * ```
54
+ */
55
+ export function initializeAllFieldTypes() {
56
+ if (allFieldTypesInitialized) {
57
+ return;
58
+ }
59
+ registerCodeEditorField();
60
+ registerTemplateEditorField();
61
+ registerMarkdownEditorField();
62
+ allFieldTypesInitialized = true;
63
+ }
64
+ /**
65
+ * Check if all field types have been initialized
66
+ */
67
+ export function areAllFieldTypesInitialized() {
68
+ return allFieldTypesInitialized;
69
+ }
70
+ /**
71
+ * Reset initialization state (useful for testing)
72
+ */
73
+ export function resetFieldTypeInitialization() {
74
+ allFieldTypesInitialized = false;
75
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * FlowDrop Form Module
3
+ *
4
+ * Provides SchemaForm and form field components for building dynamic forms
5
+ * from JSON Schema definitions. This is the "light" version that includes
6
+ * only basic field types (text, number, select, checkbox, etc.).
7
+ *
8
+ * For code editor support (CodeMirror), import from "@d34dman/flowdrop/form/code"
9
+ * For markdown editor support (EasyMDE), import from "@d34dman/flowdrop/form/markdown"
10
+ *
11
+ * @module form
12
+ *
13
+ * @example Basic usage (small bundle - ~20KB):
14
+ * ```typescript
15
+ * import { SchemaForm } from "@d34dman/flowdrop/form";
16
+ *
17
+ * const schema = {
18
+ * type: "object",
19
+ * properties: {
20
+ * name: { type: "string", title: "Name" },
21
+ * age: { type: "number", title: "Age" }
22
+ * }
23
+ * };
24
+ * ```
25
+ *
26
+ * @example With code editor support (adds ~300KB):
27
+ * ```typescript
28
+ * import { SchemaForm } from "@d34dman/flowdrop/form";
29
+ * import { registerCodeEditorField } from "@d34dman/flowdrop/form/code";
30
+ *
31
+ * // Register code editor support before using
32
+ * registerCodeEditorField();
33
+ *
34
+ * const schema = {
35
+ * type: "object",
36
+ * properties: {
37
+ * config: { type: "object", format: "json", title: "Configuration" }
38
+ * }
39
+ * };
40
+ * ```
41
+ */
42
+ export { default as SchemaForm } from "../components/SchemaForm.svelte";
43
+ export { default as FormField } from "../components/form/FormFieldLight.svelte";
44
+ export { default as FormFieldFull } from "../components/form/FormField.svelte";
45
+ export { default as FormFieldWrapper } from "../components/form/FormFieldWrapper.svelte";
46
+ export { default as FormTextField } from "../components/form/FormTextField.svelte";
47
+ export { default as FormTextarea } from "../components/form/FormTextarea.svelte";
48
+ export { default as FormNumberField } from "../components/form/FormNumberField.svelte";
49
+ export { default as FormRangeField } from "../components/form/FormRangeField.svelte";
50
+ export { default as FormToggle } from "../components/form/FormToggle.svelte";
51
+ export { default as FormSelect } from "../components/form/FormSelect.svelte";
52
+ export { default as FormCheckboxGroup } from "../components/form/FormCheckboxGroup.svelte";
53
+ export { default as FormArray } from "../components/form/FormArray.svelte";
54
+ export type { FieldSchema, FieldType, FieldFormat, FieldOption, SchemaFormProps, BaseFieldProps, TextFieldProps, TextareaFieldProps, NumberFieldProps, ToggleFieldProps, RangeFieldProps, SelectFieldProps, CheckboxGroupFieldProps, ArrayFieldProps, FormFieldFactoryProps, FormFieldWrapperProps } from "../components/form/types.js";
55
+ export { isFieldOptionArray, normalizeOptions } from "../components/form/types.js";
56
+ export { registerFieldComponent, unregisterFieldComponent, resolveFieldComponent, getRegisteredFieldTypes, isFieldTypeRegistered, clearFieldRegistry, getFieldRegistrySize, hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from "./fieldRegistry.js";
57
+ export type { FieldComponentProps, FieldMatcher, FieldComponent, FieldComponentRegistration } from "./fieldRegistry.js";
@@ -0,0 +1,68 @@
1
+ /**
2
+ * FlowDrop Form Module
3
+ *
4
+ * Provides SchemaForm and form field components for building dynamic forms
5
+ * from JSON Schema definitions. This is the "light" version that includes
6
+ * only basic field types (text, number, select, checkbox, etc.).
7
+ *
8
+ * For code editor support (CodeMirror), import from "@d34dman/flowdrop/form/code"
9
+ * For markdown editor support (EasyMDE), import from "@d34dman/flowdrop/form/markdown"
10
+ *
11
+ * @module form
12
+ *
13
+ * @example Basic usage (small bundle - ~20KB):
14
+ * ```typescript
15
+ * import { SchemaForm } from "@d34dman/flowdrop/form";
16
+ *
17
+ * const schema = {
18
+ * type: "object",
19
+ * properties: {
20
+ * name: { type: "string", title: "Name" },
21
+ * age: { type: "number", title: "Age" }
22
+ * }
23
+ * };
24
+ * ```
25
+ *
26
+ * @example With code editor support (adds ~300KB):
27
+ * ```typescript
28
+ * import { SchemaForm } from "@d34dman/flowdrop/form";
29
+ * import { registerCodeEditorField } from "@d34dman/flowdrop/form/code";
30
+ *
31
+ * // Register code editor support before using
32
+ * registerCodeEditorField();
33
+ *
34
+ * const schema = {
35
+ * type: "object",
36
+ * properties: {
37
+ * config: { type: "object", format: "json", title: "Configuration" }
38
+ * }
39
+ * };
40
+ * ```
41
+ */
42
+ // ============================================================================
43
+ // Main Components
44
+ // ============================================================================
45
+ export { default as SchemaForm } from "../components/SchemaForm.svelte";
46
+ // ============================================================================
47
+ // Form Field Components (Light - no heavy dependencies)
48
+ // ============================================================================
49
+ // Use the light version of FormField that uses the registry for heavy editors
50
+ export { default as FormField } from "../components/form/FormFieldLight.svelte";
51
+ // Also export the original (full) version for users who want everything
52
+ export { default as FormFieldFull } from "../components/form/FormField.svelte";
53
+ export { default as FormFieldWrapper } from "../components/form/FormFieldWrapper.svelte";
54
+ export { default as FormTextField } from "../components/form/FormTextField.svelte";
55
+ export { default as FormTextarea } from "../components/form/FormTextarea.svelte";
56
+ export { default as FormNumberField } from "../components/form/FormNumberField.svelte";
57
+ export { default as FormRangeField } from "../components/form/FormRangeField.svelte";
58
+ export { default as FormToggle } from "../components/form/FormToggle.svelte";
59
+ export { default as FormSelect } from "../components/form/FormSelect.svelte";
60
+ export { default as FormCheckboxGroup } from "../components/form/FormCheckboxGroup.svelte";
61
+ export { default as FormArray } from "../components/form/FormArray.svelte";
62
+ export { isFieldOptionArray, normalizeOptions } from "../components/form/types.js";
63
+ // ============================================================================
64
+ // Field Registry (for dynamic field registration)
65
+ // ============================================================================
66
+ export { registerFieldComponent, unregisterFieldComponent, resolveFieldComponent, getRegisteredFieldTypes, isFieldTypeRegistered, clearFieldRegistry, getFieldRegistrySize,
67
+ // Built-in matchers for custom components
68
+ hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from "./fieldRegistry.js";
@@ -0,0 +1,68 @@
1
+ /**
2
+ * FlowDrop Form Markdown Editor Module
3
+ *
4
+ * Adds EasyMDE-based markdown editor support to SchemaForm.
5
+ * This module bundles EasyMDE dependencies (~200KB).
6
+ *
7
+ * @module form/markdown
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { SchemaForm } from "@d34dman/flowdrop/form";
12
+ * import { registerMarkdownEditorField } from "@d34dman/flowdrop/form/markdown";
13
+ *
14
+ * // Register markdown editor support (call once at app startup)
15
+ * registerMarkdownEditorField();
16
+ *
17
+ * // Now SchemaForm will render markdown editors for format: "markdown"
18
+ * const schema = {
19
+ * type: "object",
20
+ * properties: {
21
+ * content: { type: "string", format: "markdown", title: "Content" }
22
+ * }
23
+ * };
24
+ * ```
25
+ */
26
+ import type { FieldSchema } from "../components/form/types.js";
27
+ export { default as FormMarkdownEditor } from "../components/form/FormMarkdownEditor.svelte";
28
+ export type { MarkdownEditorFieldProps } from "../components/form/types.js";
29
+ /**
30
+ * Matcher for markdown editor fields
31
+ * Matches: format "markdown"
32
+ */
33
+ export declare function markdownEditorFieldMatcher(schema: FieldSchema): boolean;
34
+ /**
35
+ * Register the markdown editor field component
36
+ *
37
+ * Call this function once at application startup to enable
38
+ * markdown editor fields in SchemaForm. This loads EasyMDE dependencies.
39
+ *
40
+ * @param priority - Priority for field matching (default: 100)
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * // In your app's entry point:
45
+ * import { registerMarkdownEditorField } from "@d34dman/flowdrop/form/markdown";
46
+ *
47
+ * registerMarkdownEditorField();
48
+ * ```
49
+ */
50
+ export declare function registerMarkdownEditorField(priority?: number): void;
51
+ /**
52
+ * Synchronously register markdown editor field using the imported component
53
+ *
54
+ * Use this when you've already imported the component and want immediate registration.
55
+ *
56
+ * @param priority - Priority for field matching (default: 100)
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * import { registerMarkdownEditorFieldWithComponent, FormMarkdownEditor } from "@d34dman/flowdrop/form/markdown";
61
+ * registerMarkdownEditorFieldWithComponent(FormMarkdownEditor);
62
+ * ```
63
+ */
64
+ export declare function registerMarkdownEditorFieldWithComponent(component: any, priority?: number): void;
65
+ /**
66
+ * Check if markdown editor field is registered
67
+ */
68
+ export declare function isMarkdownEditorRegistered(): boolean;