@superdoc-dev/template-builder 1.1.0 → 1.2.0-next.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.
- package/README.md +163 -85
- package/dist/defaults/InfoTooltip.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1163 -1104
- package/dist/tests/FieldList.test.d.ts +1 -0
- package/dist/tests/FieldMenu.test.d.ts +1 -0
- package/dist/tests/InfoTooltip.test.d.ts +1 -0
- package/dist/tests/utils.test.d.ts +1 -0
- package/dist/types.d.ts +11 -0
- package/dist/utils.d.ts +17 -0
- package/package.json +4 -2
- package/src/styles/field-types.css +26 -0
- /package/dist/{test → tests}/setup.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SuperDoc } from 'superdoc';
|
|
2
|
+
/** Field definition for template builder */
|
|
2
3
|
export interface FieldDefinition {
|
|
3
4
|
id: string;
|
|
4
5
|
label: string;
|
|
@@ -6,7 +7,9 @@ export interface FieldDefinition {
|
|
|
6
7
|
metadata?: Record<string, any>;
|
|
7
8
|
mode?: 'inline' | 'block';
|
|
8
9
|
group?: string;
|
|
10
|
+
fieldType?: string;
|
|
9
11
|
}
|
|
12
|
+
/** Field instance in a template document */
|
|
10
13
|
export interface TemplateField {
|
|
11
14
|
id: string | number;
|
|
12
15
|
alias: string;
|
|
@@ -14,6 +17,7 @@ export interface TemplateField {
|
|
|
14
17
|
position?: number;
|
|
15
18
|
mode?: 'inline' | 'block';
|
|
16
19
|
group?: string;
|
|
20
|
+
fieldType?: string;
|
|
17
21
|
}
|
|
18
22
|
export interface TriggerEvent {
|
|
19
23
|
position: {
|
|
@@ -101,6 +105,13 @@ export interface SuperDocTemplateBuilderProps {
|
|
|
101
105
|
toolbar?: boolean | string | ToolbarConfig;
|
|
102
106
|
/** Content Security Policy nonce for dynamically injected styles */
|
|
103
107
|
cspNonce?: string;
|
|
108
|
+
/** Telemetry configuration for SuperDoc */
|
|
109
|
+
telemetry?: {
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
metadata?: Record<string, any>;
|
|
112
|
+
};
|
|
113
|
+
/** License key for SuperDoc */
|
|
114
|
+
licenseKey?: string;
|
|
104
115
|
onReady?: () => void;
|
|
105
116
|
onTrigger?: (event: TriggerEvent) => void;
|
|
106
117
|
onFieldInsert?: (field: TemplateField) => void;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SuperDoc } from 'superdoc';
|
|
2
|
+
import { TemplateField, SuperDocTemplateBuilderProps, ToolbarConfig } from './types';
|
|
3
|
+
export declare const areTemplateFieldsEqual: (a: TemplateField[], b: TemplateField[]) => boolean;
|
|
4
|
+
export declare const resolveToolbar: (toolbar: SuperDocTemplateBuilderProps["toolbar"]) => {
|
|
5
|
+
selector: string;
|
|
6
|
+
config: Omit<ToolbarConfig, "selector">;
|
|
7
|
+
renderDefaultContainer: boolean;
|
|
8
|
+
} | null;
|
|
9
|
+
export declare const getPresentationEditor: (superdoc: SuperDoc | null) => any;
|
|
10
|
+
export declare const getFieldTypeStyle: (fieldType: string) => {
|
|
11
|
+
background: string;
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const MENU_VIEWPORT_PADDING = 10;
|
|
15
|
+
export declare const MENU_APPROX_WIDTH = 250;
|
|
16
|
+
export declare const MENU_APPROX_HEIGHT = 300;
|
|
17
|
+
export declare const clampToViewport: (rect: DOMRect) => DOMRect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/template-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-next.2",
|
|
4
4
|
"description": "React template builder component for SuperDoc",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.js"
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
|
+
"./field-types.css": "./src/styles/field-types.css"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist",
|
|
19
|
+
"src/styles",
|
|
18
20
|
"README.md"
|
|
19
21
|
],
|
|
20
22
|
"scripts": {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.superdoc-structured-content-inline.superdoc-structured-content-inline,
|
|
2
|
+
.superdoc-structured-content-block.superdoc-structured-content-block {
|
|
3
|
+
border-color: var(--superdoc-field-owner-color, #629be7);
|
|
4
|
+
}
|
|
5
|
+
.superdoc-structured-content-inline.superdoc-structured-content-inline:hover,
|
|
6
|
+
.superdoc-structured-content-block.superdoc-structured-content-block:hover {
|
|
7
|
+
border-color: var(--superdoc-field-owner-color, #629be7);
|
|
8
|
+
}
|
|
9
|
+
.superdoc-structured-content-inline.superdoc-structured-content-inline .superdoc-structured-content-inline__label,
|
|
10
|
+
.superdoc-structured-content-block.superdoc-structured-content-block .superdoc-structured-content-block__label {
|
|
11
|
+
border-color: var(--superdoc-field-owner-color, #629be7);
|
|
12
|
+
background-color: color-mix(in srgb, var(--superdoc-field-owner-color, #629be7) 87%, transparent);
|
|
13
|
+
}
|
|
14
|
+
.superdoc-structured-content-inline[data-sdt-tag*='"fieldType":"signer"'],
|
|
15
|
+
.superdoc-structured-content-block[data-sdt-tag*='"fieldType":"signer"'] {
|
|
16
|
+
border-color: var(--superdoc-field-signer-color, #d97706);
|
|
17
|
+
}
|
|
18
|
+
.superdoc-structured-content-inline[data-sdt-tag*='"fieldType":"signer"']:hover,
|
|
19
|
+
.superdoc-structured-content-block[data-sdt-tag*='"fieldType":"signer"']:hover {
|
|
20
|
+
border-color: var(--superdoc-field-signer-color, #d97706);
|
|
21
|
+
}
|
|
22
|
+
.superdoc-structured-content-inline[data-sdt-tag*='"fieldType":"signer"'] .superdoc-structured-content-inline__label,
|
|
23
|
+
.superdoc-structured-content-block[data-sdt-tag*='"fieldType":"signer"'] .superdoc-structured-content-block__label {
|
|
24
|
+
border-color: var(--superdoc-field-signer-color, #d97706);
|
|
25
|
+
background-color: color-mix(in srgb, var(--superdoc-field-signer-color, #d97706) 87%, transparent);
|
|
26
|
+
}
|
|
File without changes
|