@docengine/editor 0.0.0-stage → 0.0.106
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 +116 -2
- package/dist/DocEnginePdfViewer.zip +0 -0
- package/dist/editor-lwc.css +7425 -0
- package/dist/editor-lwc.js +1595 -0
- package/dist/editor-lwc.js.map +1 -0
- package/dist/editor.js +89754 -0
- package/dist/pdf-viewer/viewer.html +40 -0
- package/dist/pdf-viewer/viewer.js +1 -0
- package/lib/.tsbuildinfo +1 -0
- package/lib/catalog/catalog-provider.d.ts +27 -0
- package/lib/catalog/catalog-provider.d.ts.map +1 -0
- package/lib/catalog/catalog-provider.js +88 -0
- package/lib/catalog/catalog-provider.js.map +1 -0
- package/lib/core/computed-formula.d.ts +3 -0
- package/lib/core/computed-formula.d.ts.map +1 -0
- package/lib/core/computed-formula.js +2 -0
- package/lib/core/computed-formula.js.map +1 -0
- package/lib/core/computed-formula.test.d.ts +2 -0
- package/lib/core/computed-formula.test.d.ts.map +1 -0
- package/lib/core/computed-formula.test.js +204 -0
- package/lib/core/computed-formula.test.js.map +1 -0
- package/lib/core/document-display-defaults.d.ts +2 -0
- package/lib/core/document-display-defaults.d.ts.map +1 -0
- package/lib/core/document-display-defaults.js +2 -0
- package/lib/core/document-display-defaults.js.map +1 -0
- package/lib/core/document-history.d.ts +23 -0
- package/lib/core/document-history.d.ts.map +1 -0
- package/lib/core/document-history.js +87 -0
- package/lib/core/document-history.js.map +1 -0
- package/lib/core/document-history.test.d.ts +2 -0
- package/lib/core/document-history.test.d.ts.map +1 -0
- package/lib/core/document-history.test.js +47 -0
- package/lib/core/document-history.test.js.map +1 -0
- package/lib/core/document-io.d.ts +2 -0
- package/lib/core/document-io.d.ts.map +1 -0
- package/lib/core/document-io.js +2 -0
- package/lib/core/document-io.js.map +1 -0
- package/lib/core/document-io.test.d.ts +2 -0
- package/lib/core/document-io.test.d.ts.map +1 -0
- package/lib/core/document-io.test.js +616 -0
- package/lib/core/document-io.test.js.map +1 -0
- package/lib/core/document-section-defaults.d.ts +27 -0
- package/lib/core/document-section-defaults.d.ts.map +1 -0
- package/lib/core/document-section-defaults.js +60 -0
- package/lib/core/document-section-defaults.js.map +1 -0
- package/lib/core/document-section-defaults.test.d.ts +2 -0
- package/lib/core/document-section-defaults.test.d.ts.map +1 -0
- package/lib/core/document-section-defaults.test.js +47 -0
- package/lib/core/document-section-defaults.test.js.map +1 -0
- package/lib/core/field-id.d.ts +2 -0
- package/lib/core/field-id.d.ts.map +1 -0
- package/lib/core/field-id.js +2 -0
- package/lib/core/field-id.js.map +1 -0
- package/lib/core/field-id.test.d.ts +2 -0
- package/lib/core/field-id.test.d.ts.map +1 -0
- package/lib/core/field-id.test.js +253 -0
- package/lib/core/field-id.test.js.map +1 -0
- package/lib/core/field-io/sectioned-document-io.d.ts +2 -0
- package/lib/core/field-io/sectioned-document-io.d.ts.map +1 -0
- package/lib/core/field-io/sectioned-document-io.js +2 -0
- package/lib/core/field-io/sectioned-document-io.js.map +1 -0
- package/lib/core/field-io/sectioned-document-io.test.d.ts +2 -0
- package/lib/core/field-io/sectioned-document-io.test.d.ts.map +1 -0
- package/lib/core/field-io/sectioned-document-io.test.js +511 -0
- package/lib/core/field-io/sectioned-document-io.test.js.map +1 -0
- package/lib/core/field-io/table-field-io.d.ts +2 -0
- package/lib/core/field-io/table-field-io.d.ts.map +1 -0
- package/lib/core/field-io/table-field-io.js +2 -0
- package/lib/core/field-io/table-field-io.js.map +1 -0
- package/lib/core/field-io/table-field-io.test.d.ts +2 -0
- package/lib/core/field-io/table-field-io.test.d.ts.map +1 -0
- package/lib/core/field-io/table-field-io.test.js +193 -0
- package/lib/core/field-io/table-field-io.test.js.map +1 -0
- package/lib/core/field-schemas.d.ts +2 -0
- package/lib/core/field-schemas.d.ts.map +1 -0
- package/lib/core/field-schemas.js +7 -0
- package/lib/core/field-schemas.js.map +1 -0
- package/lib/core/field-schemas.test.d.ts +2 -0
- package/lib/core/field-schemas.test.d.ts.map +1 -0
- package/lib/core/field-schemas.test.js +369 -0
- package/lib/core/field-schemas.test.js.map +1 -0
- package/lib/core/formula-field-index.d.ts +2 -0
- package/lib/core/formula-field-index.d.ts.map +1 -0
- package/lib/core/formula-field-index.js +2 -0
- package/lib/core/formula-field-index.js.map +1 -0
- package/lib/core/formula-field-index.test.d.ts +2 -0
- package/lib/core/formula-field-index.test.d.ts.map +1 -0
- package/lib/core/formula-field-index.test.js +110 -0
- package/lib/core/formula-field-index.test.js.map +1 -0
- package/lib/core/page-setup-styles.d.ts +69 -0
- package/lib/core/page-setup-styles.d.ts.map +1 -0
- package/lib/core/page-setup-styles.js +147 -0
- package/lib/core/page-setup-styles.js.map +1 -0
- package/lib/core/page-setup-styles.test.d.ts +2 -0
- package/lib/core/page-setup-styles.test.d.ts.map +1 -0
- package/lib/core/page-setup-styles.test.js +204 -0
- package/lib/core/page-setup-styles.test.js.map +1 -0
- package/lib/core/repeater-io.d.ts +2 -0
- package/lib/core/repeater-io.d.ts.map +1 -0
- package/lib/core/repeater-io.js +2 -0
- package/lib/core/repeater-io.js.map +1 -0
- package/lib/core/repeater-io.test.d.ts +2 -0
- package/lib/core/repeater-io.test.d.ts.map +1 -0
- package/lib/core/repeater-io.test.js +754 -0
- package/lib/core/repeater-io.test.js.map +1 -0
- package/lib/core/segment-tree.d.ts +2 -0
- package/lib/core/segment-tree.d.ts.map +1 -0
- package/lib/core/segment-tree.js +2 -0
- package/lib/core/segment-tree.js.map +1 -0
- package/lib/core/segment-tree.test.d.ts +2 -0
- package/lib/core/segment-tree.test.d.ts.map +1 -0
- package/lib/core/segment-tree.test.js +39 -0
- package/lib/core/segment-tree.test.js.map +1 -0
- package/lib/create-editor.d.ts +160 -0
- package/lib/create-editor.d.ts.map +1 -0
- package/lib/create-editor.js +3373 -0
- package/lib/create-editor.js.map +1 -0
- package/lib/design/collection-tree-picker.d.ts +17 -0
- package/lib/design/collection-tree-picker.d.ts.map +1 -0
- package/lib/design/collection-tree-picker.js +295 -0
- package/lib/design/collection-tree-picker.js.map +1 -0
- package/lib/design/collection-tree-picker.test.d.ts +2 -0
- package/lib/design/collection-tree-picker.test.d.ts.map +1 -0
- package/lib/design/collection-tree-picker.test.js +94 -0
- package/lib/design/collection-tree-picker.test.js.map +1 -0
- package/lib/design/design-mode.d.ts +3 -0
- package/lib/design/design-mode.d.ts.map +1 -0
- package/lib/design/design-mode.js +7 -0
- package/lib/design/design-mode.js.map +1 -0
- package/lib/design/design-shell.d.ts +16 -0
- package/lib/design/design-shell.d.ts.map +1 -0
- package/lib/design/design-shell.js +68 -0
- package/lib/design/design-shell.js.map +1 -0
- package/lib/design/display-style-form.d.ts +10 -0
- package/lib/design/display-style-form.d.ts.map +1 -0
- package/lib/design/display-style-form.js +182 -0
- package/lib/design/display-style-form.js.map +1 -0
- package/lib/design/display-style-form.test.d.ts +2 -0
- package/lib/design/display-style-form.test.d.ts.map +1 -0
- package/lib/design/display-style-form.test.js +137 -0
- package/lib/design/display-style-form.test.js.map +1 -0
- package/lib/design/field-highlight-form.d.ts +10 -0
- package/lib/design/field-highlight-form.d.ts.map +1 -0
- package/lib/design/field-highlight-form.js +160 -0
- package/lib/design/field-highlight-form.js.map +1 -0
- package/lib/design/field-highlight-form.test.d.ts +2 -0
- package/lib/design/field-highlight-form.test.d.ts.map +1 -0
- package/lib/design/field-highlight-form.test.js +58 -0
- package/lib/design/field-highlight-form.test.js.map +1 -0
- package/lib/design/field-palette.d.ts +55 -0
- package/lib/design/field-palette.d.ts.map +1 -0
- package/lib/design/field-palette.js +216 -0
- package/lib/design/field-palette.js.map +1 -0
- package/lib/design/field-palette.test.d.ts +2 -0
- package/lib/design/field-palette.test.d.ts.map +1 -0
- package/lib/design/field-palette.test.js +79 -0
- package/lib/design/field-palette.test.js.map +1 -0
- package/lib/design/formula-field-picker.d.ts +15 -0
- package/lib/design/formula-field-picker.d.ts.map +1 -0
- package/lib/design/formula-field-picker.js +170 -0
- package/lib/design/formula-field-picker.js.map +1 -0
- package/lib/design/formula-field-picker.test.d.ts +2 -0
- package/lib/design/formula-field-picker.test.d.ts.map +1 -0
- package/lib/design/formula-field-picker.test.js +136 -0
- package/lib/design/formula-field-picker.test.js.map +1 -0
- package/lib/design/palette-block-drop.d.ts +7 -0
- package/lib/design/palette-block-drop.d.ts.map +1 -0
- package/lib/design/palette-block-drop.js +62 -0
- package/lib/design/palette-block-drop.js.map +1 -0
- package/lib/design/properties-panel.d.ts +22 -0
- package/lib/design/properties-panel.d.ts.map +1 -0
- package/lib/design/properties-panel.js +848 -0
- package/lib/design/properties-panel.js.map +1 -0
- package/lib/design/schema-editor-controller.d.ts +22 -0
- package/lib/design/schema-editor-controller.d.ts.map +1 -0
- package/lib/design/schema-editor-controller.js +1033 -0
- package/lib/design/schema-editor-controller.js.map +1 -0
- package/lib/design/schema-editor-controller.test.d.ts +2 -0
- package/lib/design/schema-editor-controller.test.d.ts.map +1 -0
- package/lib/design/schema-editor-controller.test.js +259 -0
- package/lib/design/schema-editor-controller.test.js.map +1 -0
- package/lib/design/schema-editor-modal.d.ts +4 -0
- package/lib/design/schema-editor-modal.d.ts.map +1 -0
- package/lib/design/schema-editor-modal.js +68 -0
- package/lib/design/schema-editor-modal.js.map +1 -0
- package/lib/design/schema-items-designer-modal.d.ts +3 -0
- package/lib/design/schema-items-designer-modal.d.ts.map +1 -0
- package/lib/design/schema-items-designer-modal.js +187 -0
- package/lib/design/schema-items-designer-modal.js.map +1 -0
- package/lib/design/schema-items-designer.d.ts +20 -0
- package/lib/design/schema-items-designer.d.ts.map +1 -0
- package/lib/design/schema-items-designer.js +394 -0
- package/lib/design/schema-items-designer.js.map +1 -0
- package/lib/design/schema-items-designer.test.d.ts +2 -0
- package/lib/design/schema-items-designer.test.d.ts.map +1 -0
- package/lib/design/schema-items-designer.test.js +115 -0
- package/lib/design/schema-items-designer.test.js.map +1 -0
- package/lib/design/style-toolbar-shared.d.ts +53 -0
- package/lib/design/style-toolbar-shared.d.ts.map +1 -0
- package/lib/design/style-toolbar-shared.js +196 -0
- package/lib/design/style-toolbar-shared.js.map +1 -0
- package/lib/domain/ophthalmology/catalogs.d.ts +107 -0
- package/lib/domain/ophthalmology/catalogs.d.ts.map +1 -0
- package/lib/domain/ophthalmology/catalogs.js +65 -0
- package/lib/domain/ophthalmology/catalogs.js.map +1 -0
- package/lib/domain/ophthalmology/life-anamnesis-tree.d.ts +13 -0
- package/lib/domain/ophthalmology/life-anamnesis-tree.d.ts.map +1 -0
- package/lib/domain/ophthalmology/life-anamnesis-tree.js +44 -0
- package/lib/domain/ophthalmology/life-anamnesis-tree.js.map +1 -0
- package/lib/domain/ophthalmology/norm-options.d.ts +9 -0
- package/lib/domain/ophthalmology/norm-options.d.ts.map +1 -0
- package/lib/domain/ophthalmology/norm-options.js +24 -0
- package/lib/domain/ophthalmology/norm-options.js.map +1 -0
- package/lib/domain/ophthalmology/ophthalmology-complaints-tree.d.ts +13 -0
- package/lib/domain/ophthalmology/ophthalmology-complaints-tree.d.ts.map +1 -0
- package/lib/domain/ophthalmology/ophthalmology-complaints-tree.js +48 -0
- package/lib/domain/ophthalmology/ophthalmology-complaints-tree.js.map +1 -0
- package/lib/domain/ophthalmology/ophthalmology-diagnoses.d.ts +6 -0
- package/lib/domain/ophthalmology/ophthalmology-diagnoses.d.ts.map +1 -0
- package/lib/domain/ophthalmology/ophthalmology-diagnoses.js +13 -0
- package/lib/domain/ophthalmology/ophthalmology-diagnoses.js.map +1 -0
- package/lib/domain/ophthalmology/vision-values.d.ts +21 -0
- package/lib/domain/ophthalmology/vision-values.d.ts.map +1 -0
- package/lib/domain/ophthalmology/vision-values.js +55 -0
- package/lib/domain/ophthalmology/vision-values.js.map +1 -0
- package/lib/export/document-pdf.d.ts +20 -0
- package/lib/export/document-pdf.d.ts.map +1 -0
- package/lib/export/document-pdf.js +39 -0
- package/lib/export/document-pdf.js.map +1 -0
- package/lib/export/document-pdf.sf-stub.d.ts +13 -0
- package/lib/export/document-pdf.sf-stub.d.ts.map +1 -0
- package/lib/export/document-pdf.sf-stub.js +19 -0
- package/lib/export/document-pdf.sf-stub.js.map +1 -0
- package/lib/export/preview-export-options.d.ts +17 -0
- package/lib/export/preview-export-options.d.ts.map +1 -0
- package/lib/export/preview-export-options.js +28 -0
- package/lib/export/preview-export-options.js.map +1 -0
- package/lib/export/preview-html-document.d.ts +10 -0
- package/lib/export/preview-html-document.d.ts.map +1 -0
- package/lib/export/preview-html-document.js +29 -0
- package/lib/export/preview-html-document.js.map +1 -0
- package/lib/export/preview-html-styles.d.ts +10 -0
- package/lib/export/preview-html-styles.d.ts.map +1 -0
- package/lib/export/preview-html-styles.js +527 -0
- package/lib/export/preview-html-styles.js.map +1 -0
- package/lib/export/preview-html-styles.test.d.ts +2 -0
- package/lib/export/preview-html-styles.test.d.ts.map +1 -0
- package/lib/export/preview-html-styles.test.js +56 -0
- package/lib/export/preview-html-styles.test.js.map +1 -0
- package/lib/export/preview-pdf-mount.d.ts +14 -0
- package/lib/export/preview-pdf-mount.d.ts.map +1 -0
- package/lib/export/preview-pdf-mount.js +41 -0
- package/lib/export/preview-pdf-mount.js.map +1 -0
- package/lib/export/preview-pdf-parity.test.d.ts +2 -0
- package/lib/export/preview-pdf-parity.test.d.ts.map +1 -0
- package/lib/export/preview-pdf-parity.test.js +217 -0
- package/lib/export/preview-pdf-parity.test.js.map +1 -0
- package/lib/fields/barcode-encode.d.ts +33 -0
- package/lib/fields/barcode-encode.d.ts.map +1 -0
- package/lib/fields/barcode-encode.js +118 -0
- package/lib/fields/barcode-encode.js.map +1 -0
- package/lib/fields/barcode-encode.test.d.ts +2 -0
- package/lib/fields/barcode-encode.test.d.ts.map +1 -0
- package/lib/fields/barcode-encode.test.js +38 -0
- package/lib/fields/barcode-encode.test.js.map +1 -0
- package/lib/fields/collect-field-values.test.d.ts +2 -0
- package/lib/fields/collect-field-values.test.d.ts.map +1 -0
- package/lib/fields/collect-field-values.test.js +71 -0
- package/lib/fields/collect-field-values.test.js.map +1 -0
- package/lib/fields/columns-serialize.test.d.ts +2 -0
- package/lib/fields/columns-serialize.test.d.ts.map +1 -0
- package/lib/fields/columns-serialize.test.js +68 -0
- package/lib/fields/columns-serialize.test.js.map +1 -0
- package/lib/fields/cross-section-reposition.d.ts +19 -0
- package/lib/fields/cross-section-reposition.d.ts.map +1 -0
- package/lib/fields/cross-section-reposition.js +185 -0
- package/lib/fields/cross-section-reposition.js.map +1 -0
- package/lib/fields/cross-section-reposition.test.d.ts +2 -0
- package/lib/fields/cross-section-reposition.test.d.ts.map +1 -0
- package/lib/fields/cross-section-reposition.test.js +190 -0
- package/lib/fields/cross-section-reposition.test.js.map +1 -0
- package/lib/fields/document-preview.d.ts +10 -0
- package/lib/fields/document-preview.d.ts.map +1 -0
- package/lib/fields/document-preview.js +781 -0
- package/lib/fields/document-preview.js.map +1 -0
- package/lib/fields/document-preview.test.d.ts +2 -0
- package/lib/fields/document-preview.test.d.ts.map +1 -0
- package/lib/fields/document-preview.test.js +1433 -0
- package/lib/fields/document-preview.test.js.map +1 -0
- package/lib/fields/field-clipboard.d.ts +32 -0
- package/lib/fields/field-clipboard.d.ts.map +1 -0
- package/lib/fields/field-clipboard.js +642 -0
- package/lib/fields/field-clipboard.js.map +1 -0
- package/lib/fields/field-clipboard.test.d.ts +2 -0
- package/lib/fields/field-clipboard.test.d.ts.map +1 -0
- package/lib/fields/field-clipboard.test.js +281 -0
- package/lib/fields/field-clipboard.test.js.map +1 -0
- package/lib/fields/field-display-style.d.ts +76 -0
- package/lib/fields/field-display-style.d.ts.map +1 -0
- package/lib/fields/field-display-style.js +429 -0
- package/lib/fields/field-display-style.js.map +1 -0
- package/lib/fields/field-display-style.test.d.ts +2 -0
- package/lib/fields/field-display-style.test.d.ts.map +1 -0
- package/lib/fields/field-display-style.test.js +299 -0
- package/lib/fields/field-display-style.test.js.map +1 -0
- package/lib/fields/field-keyboard.d.ts +9 -0
- package/lib/fields/field-keyboard.d.ts.map +1 -0
- package/lib/fields/field-keyboard.js +1118 -0
- package/lib/fields/field-keyboard.js.map +1 -0
- package/lib/fields/field-keyboard.test.d.ts +2 -0
- package/lib/fields/field-keyboard.test.d.ts.map +1 -0
- package/lib/fields/field-keyboard.test.js +390 -0
- package/lib/fields/field-keyboard.test.js.map +1 -0
- package/lib/fields/field-selection.d.ts +12 -0
- package/lib/fields/field-selection.d.ts.map +1 -0
- package/lib/fields/field-selection.js +123 -0
- package/lib/fields/field-selection.js.map +1 -0
- package/lib/fields/field-selection.test.d.ts +2 -0
- package/lib/fields/field-selection.test.d.ts.map +1 -0
- package/lib/fields/field-selection.test.js +67 -0
- package/lib/fields/field-selection.test.js.map +1 -0
- package/lib/fields/field-token-drag.test.d.ts +2 -0
- package/lib/fields/field-token-drag.test.d.ts.map +1 -0
- package/lib/fields/field-token-drag.test.js +55 -0
- package/lib/fields/field-token-drag.test.js.map +1 -0
- package/lib/fields/fill-defaults.test.d.ts +2 -0
- package/lib/fields/fill-defaults.test.d.ts.map +1 -0
- package/lib/fields/fill-defaults.test.js +70 -0
- package/lib/fields/fill-defaults.test.js.map +1 -0
- package/lib/fields/fill-field-focus.d.ts +51 -0
- package/lib/fields/fill-field-focus.d.ts.map +1 -0
- package/lib/fields/fill-field-focus.js +230 -0
- package/lib/fields/fill-field-focus.js.map +1 -0
- package/lib/fields/fill-field-focus.test.d.ts +2 -0
- package/lib/fields/fill-field-focus.test.d.ts.map +1 -0
- package/lib/fields/fill-field-focus.test.js +201 -0
- package/lib/fields/fill-field-focus.test.js.map +1 -0
- package/lib/fields/handlers/builtins.d.ts +3 -0
- package/lib/fields/handlers/builtins.d.ts.map +1 -0
- package/lib/fields/handlers/builtins.js +869 -0
- package/lib/fields/handlers/builtins.js.map +1 -0
- package/lib/fields/handlers/index.d.ts +4 -0
- package/lib/fields/handlers/index.d.ts.map +1 -0
- package/lib/fields/handlers/index.js +5 -0
- package/lib/fields/handlers/index.js.map +1 -0
- package/lib/fields/handlers/registry.d.ts +27 -0
- package/lib/fields/handlers/registry.d.ts.map +1 -0
- package/lib/fields/handlers/registry.js +69 -0
- package/lib/fields/handlers/registry.js.map +1 -0
- package/lib/fields/handlers/registry.test.d.ts +2 -0
- package/lib/fields/handlers/registry.test.d.ts.map +1 -0
- package/lib/fields/handlers/registry.test.js +203 -0
- package/lib/fields/handlers/registry.test.js.map +1 -0
- package/lib/fields/handlers/schema-form-dom.d.ts +36 -0
- package/lib/fields/handlers/schema-form-dom.d.ts.map +1 -0
- package/lib/fields/handlers/schema-form-dom.js +114 -0
- package/lib/fields/handlers/schema-form-dom.js.map +1 -0
- package/lib/fields/heading-line-breaks.test.d.ts +2 -0
- package/lib/fields/heading-line-breaks.test.d.ts.map +1 -0
- package/lib/fields/heading-line-breaks.test.js +755 -0
- package/lib/fields/heading-line-breaks.test.js.map +1 -0
- package/lib/fields/inline-field-from-selection.test.d.ts +2 -0
- package/lib/fields/inline-field-from-selection.test.d.ts.map +1 -0
- package/lib/fields/inline-field-from-selection.test.js +185 -0
- package/lib/fields/inline-field-from-selection.test.js.map +1 -0
- package/lib/fields/inline-fields.d.ts +150 -0
- package/lib/fields/inline-fields.d.ts.map +1 -0
- package/lib/fields/inline-fields.js +3408 -0
- package/lib/fields/inline-fields.js.map +1 -0
- package/lib/fields/logical-display.d.ts +8 -0
- package/lib/fields/logical-display.d.ts.map +1 -0
- package/lib/fields/logical-display.js +29 -0
- package/lib/fields/logical-display.js.map +1 -0
- package/lib/fields/logical-display.test.d.ts +2 -0
- package/lib/fields/logical-display.test.d.ts.map +1 -0
- package/lib/fields/logical-display.test.js +31 -0
- package/lib/fields/logical-display.test.js.map +1 -0
- package/lib/fields/manual-field-values.d.ts +87 -0
- package/lib/fields/manual-field-values.d.ts.map +1 -0
- package/lib/fields/manual-field-values.js +189 -0
- package/lib/fields/manual-field-values.js.map +1 -0
- package/lib/fields/manual-field-values.test.d.ts +2 -0
- package/lib/fields/manual-field-values.test.d.ts.map +1 -0
- package/lib/fields/manual-field-values.test.js +84 -0
- package/lib/fields/manual-field-values.test.js.map +1 -0
- package/lib/fields/pivot-table-field.d.ts +25 -0
- package/lib/fields/pivot-table-field.d.ts.map +1 -0
- package/lib/fields/pivot-table-field.js +408 -0
- package/lib/fields/pivot-table-field.js.map +1 -0
- package/lib/fields/plain-text-newlines.test.d.ts +2 -0
- package/lib/fields/plain-text-newlines.test.d.ts.map +1 -0
- package/lib/fields/plain-text-newlines.test.js +40 -0
- package/lib/fields/plain-text-newlines.test.js.map +1 -0
- package/lib/fields/repeater-field.d.ts +10 -0
- package/lib/fields/repeater-field.d.ts.map +1 -0
- package/lib/fields/repeater-field.js +48 -0
- package/lib/fields/repeater-field.js.map +1 -0
- package/lib/fields/rich-text.d.ts +27 -0
- package/lib/fields/rich-text.d.ts.map +1 -0
- package/lib/fields/rich-text.js +984 -0
- package/lib/fields/rich-text.js.map +1 -0
- package/lib/fields/table-field.d.ts +57 -0
- package/lib/fields/table-field.d.ts.map +1 -0
- package/lib/fields/table-field.js +836 -0
- package/lib/fields/table-field.js.map +1 -0
- package/lib/fields/table-field.test.d.ts +2 -0
- package/lib/fields/table-field.test.d.ts.map +1 -0
- package/lib/fields/table-field.test.js +456 -0
- package/lib/fields/table-field.test.js.map +1 -0
- package/lib/fields/tree-paths.d.ts +5 -0
- package/lib/fields/tree-paths.d.ts.map +1 -0
- package/lib/fields/tree-paths.js +7 -0
- package/lib/fields/tree-paths.js.map +1 -0
- package/lib/fields/tree-selection.d.ts +9 -0
- package/lib/fields/tree-selection.d.ts.map +1 -0
- package/lib/fields/tree-selection.js +39 -0
- package/lib/fields/tree-selection.js.map +1 -0
- package/lib/fields/tree.d.ts +7 -0
- package/lib/fields/tree.d.ts.map +1 -0
- package/lib/fields/tree.js +7 -0
- package/lib/fields/tree.js.map +1 -0
- package/lib/fields/wire-columns-resize.d.ts +6 -0
- package/lib/fields/wire-columns-resize.d.ts.map +1 -0
- package/lib/fields/wire-columns-resize.js +130 -0
- package/lib/fields/wire-columns-resize.js.map +1 -0
- package/lib/fields/wire-columns-resize.test.d.ts +2 -0
- package/lib/fields/wire-columns-resize.test.d.ts.map +1 -0
- package/lib/fields/wire-columns-resize.test.js +38 -0
- package/lib/fields/wire-columns-resize.test.js.map +1 -0
- package/lib/fields/wire-editorjs-native-drop-guard.d.ts +34 -0
- package/lib/fields/wire-editorjs-native-drop-guard.d.ts.map +1 -0
- package/lib/fields/wire-editorjs-native-drop-guard.js +453 -0
- package/lib/fields/wire-editorjs-native-drop-guard.js.map +1 -0
- package/lib/fields/wire-editorjs-native-drop-guard.test.d.ts +2 -0
- package/lib/fields/wire-editorjs-native-drop-guard.test.d.ts.map +1 -0
- package/lib/fields/wire-editorjs-native-drop-guard.test.js +230 -0
- package/lib/fields/wire-editorjs-native-drop-guard.test.js.map +1 -0
- package/lib/fields/wire-table-column-reorder.d.ts +23 -0
- package/lib/fields/wire-table-column-reorder.d.ts.map +1 -0
- package/lib/fields/wire-table-column-reorder.js +207 -0
- package/lib/fields/wire-table-column-reorder.js.map +1 -0
- package/lib/fields/wire-table-column-reorder.test.d.ts +2 -0
- package/lib/fields/wire-table-column-reorder.test.d.ts.map +1 -0
- package/lib/fields/wire-table-column-reorder.test.js +133 -0
- package/lib/fields/wire-table-column-reorder.test.js.map +1 -0
- package/lib/fields/wire-table-column-resize.d.ts +118 -0
- package/lib/fields/wire-table-column-resize.d.ts.map +1 -0
- package/lib/fields/wire-table-column-resize.js +406 -0
- package/lib/fields/wire-table-column-resize.js.map +1 -0
- package/lib/fields/wire-table-column-resize.test.d.ts +2 -0
- package/lib/fields/wire-table-column-resize.test.d.ts.map +1 -0
- package/lib/fields/wire-table-column-resize.test.js +407 -0
- package/lib/fields/wire-table-column-resize.test.js.map +1 -0
- package/lib/index.d.ts +39 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +37 -0
- package/lib/index.js.map +1 -0
- package/lib/node.d.ts +20 -0
- package/lib/node.d.ts.map +1 -0
- package/lib/node.js +20 -0
- package/lib/node.js.map +1 -0
- package/lib/registry/registry-context.d.ts +6 -0
- package/lib/registry/registry-context.d.ts.map +1 -0
- package/lib/registry/registry-context.js +39 -0
- package/lib/registry/registry-context.js.map +1 -0
- package/lib/registry/schema-registry.d.ts +18 -0
- package/lib/registry/schema-registry.d.ts.map +1 -0
- package/lib/registry/schema-registry.js +67 -0
- package/lib/registry/schema-registry.js.map +1 -0
- package/lib/services/image-upload.d.ts +27 -0
- package/lib/services/image-upload.d.ts.map +1 -0
- package/lib/services/image-upload.js +159 -0
- package/lib/services/image-upload.js.map +1 -0
- package/lib/services/image-upload.test.d.ts +2 -0
- package/lib/services/image-upload.test.d.ts.map +1 -0
- package/lib/services/image-upload.test.js +141 -0
- package/lib/services/image-upload.test.js.map +1 -0
- package/lib/sf-entry.d.ts +5 -0
- package/lib/sf-entry.d.ts.map +1 -0
- package/lib/sf-entry.js +15 -0
- package/lib/sf-entry.js.map +1 -0
- package/lib/sf-pdf-viewer/main.d.ts +2 -0
- package/lib/sf-pdf-viewer/main.d.ts.map +1 -0
- package/lib/sf-pdf-viewer/main.js +57 -0
- package/lib/sf-pdf-viewer/main.js.map +1 -0
- package/lib/tools/document-section.d.ts +54 -0
- package/lib/tools/document-section.d.ts.map +1 -0
- package/lib/tools/document-section.js +591 -0
- package/lib/tools/document-section.js.map +1 -0
- package/lib/tools/template-block.d.ts +18 -0
- package/lib/tools/template-block.d.ts.map +1 -0
- package/lib/tools/template-block.js +243 -0
- package/lib/tools/template-block.js.map +1 -0
- package/lib/ui/action-icons.d.ts +10 -0
- package/lib/ui/action-icons.d.ts.map +1 -0
- package/lib/ui/action-icons.js +11 -0
- package/lib/ui/action-icons.js.map +1 -0
- package/lib/ui/document-actions.d.ts +12 -0
- package/lib/ui/document-actions.d.ts.map +1 -0
- package/lib/ui/document-actions.js +37 -0
- package/lib/ui/document-actions.js.map +1 -0
- package/lib/ui/drag-handle.d.ts +11 -0
- package/lib/ui/drag-handle.d.ts.map +1 -0
- package/lib/ui/drag-handle.js +38 -0
- package/lib/ui/drag-handle.js.map +1 -0
- package/lib/ui/existing-image-modal.d.ts +10 -0
- package/lib/ui/existing-image-modal.d.ts.map +1 -0
- package/lib/ui/existing-image-modal.js +153 -0
- package/lib/ui/existing-image-modal.js.map +1 -0
- package/lib/ui/field-form-modal.d.ts +33 -0
- package/lib/ui/field-form-modal.d.ts.map +1 -0
- package/lib/ui/field-form-modal.js +103 -0
- package/lib/ui/field-form-modal.js.map +1 -0
- package/lib/ui/field-form-modal.test.d.ts +2 -0
- package/lib/ui/field-form-modal.test.d.ts.map +1 -0
- package/lib/ui/field-form-modal.test.js +81 -0
- package/lib/ui/field-form-modal.test.js.map +1 -0
- package/lib/ui/field-mapping-badges.d.ts +9 -0
- package/lib/ui/field-mapping-badges.d.ts.map +1 -0
- package/lib/ui/field-mapping-badges.js +208 -0
- package/lib/ui/field-mapping-badges.js.map +1 -0
- package/lib/ui/field-mapping-badges.test.d.ts +2 -0
- package/lib/ui/field-mapping-badges.test.d.ts.map +1 -0
- package/lib/ui/field-mapping-badges.test.js +81 -0
- package/lib/ui/field-mapping-badges.test.js.map +1 -0
- package/lib/ui/field-mapping-modal-open.test.d.ts +2 -0
- package/lib/ui/field-mapping-modal-open.test.d.ts.map +1 -0
- package/lib/ui/field-mapping-modal-open.test.js +58 -0
- package/lib/ui/field-mapping-modal-open.test.js.map +1 -0
- package/lib/ui/field-mapping-modal.d.ts +4 -0
- package/lib/ui/field-mapping-modal.d.ts.map +1 -0
- package/lib/ui/field-mapping-modal.js +992 -0
- package/lib/ui/field-mapping-modal.js.map +1 -0
- package/lib/ui/filename-prompt.d.ts +6 -0
- package/lib/ui/filename-prompt.d.ts.map +1 -0
- package/lib/ui/filename-prompt.js +85 -0
- package/lib/ui/filename-prompt.js.map +1 -0
- package/lib/ui/format-icons.d.ts +23 -0
- package/lib/ui/format-icons.d.ts.map +1 -0
- package/lib/ui/format-icons.js +23 -0
- package/lib/ui/format-icons.js.map +1 -0
- package/lib/ui/html-text-modal.d.ts +6 -0
- package/lib/ui/html-text-modal.d.ts.map +1 -0
- package/lib/ui/html-text-modal.js +195 -0
- package/lib/ui/html-text-modal.js.map +1 -0
- package/lib/ui/image-modal.d.ts +6 -0
- package/lib/ui/image-modal.d.ts.map +1 -0
- package/lib/ui/image-modal.js +237 -0
- package/lib/ui/image-modal.js.map +1 -0
- package/lib/ui/integer-modal.d.ts +12 -0
- package/lib/ui/integer-modal.d.ts.map +1 -0
- package/lib/ui/integer-modal.js +71 -0
- package/lib/ui/integer-modal.js.map +1 -0
- package/lib/ui/list-modal.d.ts +6 -0
- package/lib/ui/list-modal.d.ts.map +1 -0
- package/lib/ui/list-modal.js +627 -0
- package/lib/ui/list-modal.js.map +1 -0
- package/lib/ui/list-modal.test.d.ts +2 -0
- package/lib/ui/list-modal.test.d.ts.map +1 -0
- package/lib/ui/list-modal.test.js +185 -0
- package/lib/ui/list-modal.test.js.map +1 -0
- package/lib/ui/logical-modal.d.ts +11 -0
- package/lib/ui/logical-modal.d.ts.map +1 -0
- package/lib/ui/logical-modal.js +104 -0
- package/lib/ui/logical-modal.js.map +1 -0
- package/lib/ui/mapping-drag-drop.d.ts +44 -0
- package/lib/ui/mapping-drag-drop.d.ts.map +1 -0
- package/lib/ui/mapping-drag-drop.js +339 -0
- package/lib/ui/mapping-drag-drop.js.map +1 -0
- package/lib/ui/mapping-drag-drop.test.d.ts +2 -0
- package/lib/ui/mapping-drag-drop.test.d.ts.map +1 -0
- package/lib/ui/mapping-drag-drop.test.js +47 -0
- package/lib/ui/mapping-drag-drop.test.js.map +1 -0
- package/lib/ui/mapping-result-helper.d.ts +130 -0
- package/lib/ui/mapping-result-helper.d.ts.map +1 -0
- package/lib/ui/mapping-result-helper.js +659 -0
- package/lib/ui/mapping-result-helper.js.map +1 -0
- package/lib/ui/mapping-result-helper.test.d.ts +2 -0
- package/lib/ui/mapping-result-helper.test.d.ts.map +1 -0
- package/lib/ui/mapping-result-helper.test.js +185 -0
- package/lib/ui/mapping-result-helper.test.js.map +1 -0
- package/lib/ui/modal-picker-keyboard.d.ts +12 -0
- package/lib/ui/modal-picker-keyboard.d.ts.map +1 -0
- package/lib/ui/modal-picker-keyboard.js +72 -0
- package/lib/ui/modal-picker-keyboard.js.map +1 -0
- package/lib/ui/modal-picker-keyboard.test.d.ts +2 -0
- package/lib/ui/modal-picker-keyboard.test.d.ts.map +1 -0
- package/lib/ui/modal-picker-keyboard.test.js +53 -0
- package/lib/ui/modal-picker-keyboard.test.js.map +1 -0
- package/lib/ui/modal-picker-pills.d.ts +2 -0
- package/lib/ui/modal-picker-pills.d.ts.map +1 -0
- package/lib/ui/modal-picker-pills.js +26 -0
- package/lib/ui/modal-picker-pills.js.map +1 -0
- package/lib/ui/notification.d.ts +2 -0
- package/lib/ui/notification.d.ts.map +1 -0
- package/lib/ui/notification.js +47 -0
- package/lib/ui/notification.js.map +1 -0
- package/lib/ui/palette-icons.d.ts +5 -0
- package/lib/ui/palette-icons.d.ts.map +1 -0
- package/lib/ui/palette-icons.js +28 -0
- package/lib/ui/palette-icons.js.map +1 -0
- package/lib/ui/pdf-canvas-preview.d.ts +11 -0
- package/lib/ui/pdf-canvas-preview.d.ts.map +1 -0
- package/lib/ui/pdf-canvas-preview.js +88 -0
- package/lib/ui/pdf-canvas-preview.js.map +1 -0
- package/lib/ui/preview-modal.d.ts +24 -0
- package/lib/ui/preview-modal.d.ts.map +1 -0
- package/lib/ui/preview-modal.js +536 -0
- package/lib/ui/preview-modal.js.map +1 -0
- package/lib/ui/recent-fill-colors.d.ts +21 -0
- package/lib/ui/recent-fill-colors.d.ts.map +1 -0
- package/lib/ui/recent-fill-colors.js +95 -0
- package/lib/ui/recent-fill-colors.js.map +1 -0
- package/lib/ui/recent-fill-colors.test.d.ts +2 -0
- package/lib/ui/recent-fill-colors.test.d.ts.map +1 -0
- package/lib/ui/recent-fill-colors.test.js +56 -0
- package/lib/ui/recent-fill-colors.test.js.map +1 -0
- package/lib/ui/repeater-editor-modal.d.ts +10 -0
- package/lib/ui/repeater-editor-modal.d.ts.map +1 -0
- package/lib/ui/repeater-editor-modal.js +124 -0
- package/lib/ui/repeater-editor-modal.js.map +1 -0
- package/lib/ui/rich-text-toolbar.d.ts +13 -0
- package/lib/ui/rich-text-toolbar.d.ts.map +1 -0
- package/lib/ui/rich-text-toolbar.js +670 -0
- package/lib/ui/rich-text-toolbar.js.map +1 -0
- package/lib/ui/rich-text-toolbar.test.d.ts +2 -0
- package/lib/ui/rich-text-toolbar.test.d.ts.map +1 -0
- package/lib/ui/rich-text-toolbar.test.js +167 -0
- package/lib/ui/rich-text-toolbar.test.js.map +1 -0
- package/lib/ui/signature-modal.d.ts +13 -0
- package/lib/ui/signature-modal.d.ts.map +1 -0
- package/lib/ui/signature-modal.js +219 -0
- package/lib/ui/signature-modal.js.map +1 -0
- package/lib/ui/source-path-canvas-drop.d.ts +121 -0
- package/lib/ui/source-path-canvas-drop.d.ts.map +1 -0
- package/lib/ui/source-path-canvas-drop.js +300 -0
- package/lib/ui/source-path-canvas-drop.js.map +1 -0
- package/lib/ui/source-path-canvas-drop.test.d.ts +2 -0
- package/lib/ui/source-path-canvas-drop.test.d.ts.map +1 -0
- package/lib/ui/source-path-canvas-drop.test.js +216 -0
- package/lib/ui/source-path-canvas-drop.test.js.map +1 -0
- package/lib/ui/source-schema-tree.d.ts +33 -0
- package/lib/ui/source-schema-tree.d.ts.map +1 -0
- package/lib/ui/source-schema-tree.js +326 -0
- package/lib/ui/source-schema-tree.js.map +1 -0
- package/lib/ui/text-modal.d.ts +13 -0
- package/lib/ui/text-modal.d.ts.map +1 -0
- package/lib/ui/text-modal.js +31 -0
- package/lib/ui/text-modal.js.map +1 -0
- package/lib/ui/tree-modal.d.ts +8 -0
- package/lib/ui/tree-modal.d.ts.map +1 -0
- package/lib/ui/tree-modal.js +586 -0
- package/lib/ui/tree-modal.js.map +1 -0
- package/lib/ui/tree-modal.test.d.ts +2 -0
- package/lib/ui/tree-modal.test.d.ts.map +1 -0
- package/lib/ui/tree-modal.test.js +390 -0
- package/lib/ui/tree-modal.test.js.map +1 -0
- package/lib/ui/wire-modal-escape.d.ts +13 -0
- package/lib/ui/wire-modal-escape.d.ts.map +1 -0
- package/lib/ui/wire-modal-escape.js +26 -0
- package/lib/ui/wire-modal-escape.js.map +1 -0
- package/lib/ui/wire-modal-escape.test.d.ts +2 -0
- package/lib/ui/wire-modal-escape.test.d.ts.map +1 -0
- package/lib/ui/wire-modal-escape.test.js +57 -0
- package/lib/ui/wire-modal-escape.test.js.map +1 -0
- package/lib/ui/wire-modal-focus-trap.test.d.ts +2 -0
- package/lib/ui/wire-modal-focus-trap.test.d.ts.map +1 -0
- package/lib/ui/wire-modal-focus-trap.test.js +264 -0
- package/lib/ui/wire-modal-focus-trap.test.js.map +1 -0
- package/lib/ui/wire-modal-move.d.ts +23 -0
- package/lib/ui/wire-modal-move.d.ts.map +1 -0
- package/lib/ui/wire-modal-move.js +179 -0
- package/lib/ui/wire-modal-move.js.map +1 -0
- package/lib/ui/wire-modal-move.test.d.ts +2 -0
- package/lib/ui/wire-modal-move.test.d.ts.map +1 -0
- package/lib/ui/wire-modal-move.test.js +84 -0
- package/lib/ui/wire-modal-move.test.js.map +1 -0
- package/lib/ui/wire-modal-palette.d.ts +56 -0
- package/lib/ui/wire-modal-palette.d.ts.map +1 -0
- package/lib/ui/wire-modal-palette.js +501 -0
- package/lib/ui/wire-modal-palette.js.map +1 -0
- package/lib/ui/wire-modal-resize.d.ts +27 -0
- package/lib/ui/wire-modal-resize.d.ts.map +1 -0
- package/lib/ui/wire-modal-resize.js +146 -0
- package/lib/ui/wire-modal-resize.js.map +1 -0
- package/lib/ui/wire-modal-resize.test.d.ts +2 -0
- package/lib/ui/wire-modal-resize.test.d.ts.map +1 -0
- package/lib/ui/wire-modal-resize.test.js +61 -0
- package/lib/ui/wire-modal-resize.test.js.map +1 -0
- package/lib/ui/wire-panel-splitter.d.ts +67 -0
- package/lib/ui/wire-panel-splitter.d.ts.map +1 -0
- package/lib/ui/wire-panel-splitter.js +361 -0
- package/lib/ui/wire-panel-splitter.js.map +1 -0
- package/lib/ui/wire-panel-splitter.test.d.ts +2 -0
- package/lib/ui/wire-panel-splitter.test.d.ts.map +1 -0
- package/lib/ui/wire-panel-splitter.test.js +152 -0
- package/lib/ui/wire-panel-splitter.test.js.map +1 -0
- package/lib/utils/export-filename.d.ts +24 -0
- package/lib/utils/export-filename.d.ts.map +1 -0
- package/lib/utils/export-filename.js +42 -0
- package/lib/utils/export-filename.js.map +1 -0
- package/lib/utils/export-filename.test.d.ts +2 -0
- package/lib/utils/export-filename.test.d.ts.map +1 -0
- package/lib/utils/export-filename.test.js +42 -0
- package/lib/utils/export-filename.test.js.map +1 -0
- package/lib/utils/print-document.d.ts +17 -0
- package/lib/utils/print-document.d.ts.map +1 -0
- package/lib/utils/print-document.js +132 -0
- package/lib/utils/print-document.js.map +1 -0
- package/lib/utils/save-blob.d.ts +9 -0
- package/lib/utils/save-blob.d.ts.map +1 -0
- package/lib/utils/save-blob.js +41 -0
- package/lib/utils/save-blob.js.map +1 -0
- package/lib/web-component.d.ts +6 -0
- package/lib/web-component.d.ts.map +1 -0
- package/lib/web-component.js +59 -0
- package/lib/web-component.js.map +1 -0
- package/package.json +61 -6
- package/src/catalog/catalog-provider.ts +91 -0
- package/src/core/computed-formula.test.ts +258 -0
- package/src/core/computed-formula.ts +18 -0
- package/src/core/document-display-defaults.ts +13 -0
- package/src/core/document-history.test.ts +54 -0
- package/src/core/document-history.ts +102 -0
- package/src/core/document-io.test.ts +739 -0
- package/src/core/document-io.ts +27 -0
- package/src/core/document-section-defaults.test.ts +56 -0
- package/src/core/document-section-defaults.ts +67 -0
- package/src/core/field-id.test.ts +299 -0
- package/src/core/field-id.ts +23 -0
- package/src/core/field-io/sectioned-document-io.test.ts +568 -0
- package/src/core/field-io/sectioned-document-io.ts +15 -0
- package/src/core/field-io/table-field-io.test.ts +242 -0
- package/src/core/field-io/table-field-io.ts +13 -0
- package/src/core/field-schemas.test.ts +472 -0
- package/src/core/field-schemas.ts +46 -0
- package/src/core/formula-field-index.test.ts +140 -0
- package/src/core/formula-field-index.ts +16 -0
- package/src/core/page-setup-styles.test.ts +274 -0
- package/src/core/page-setup-styles.ts +213 -0
- package/src/core/repeater-io.test.ts +899 -0
- package/src/core/repeater-io.ts +37 -0
- package/src/core/segment-tree.test.ts +41 -0
- package/src/core/segment-tree.ts +6 -0
- package/src/create-editor.ts +3848 -0
- package/src/design/collection-tree-picker.test.ts +105 -0
- package/src/design/collection-tree-picker.ts +340 -0
- package/src/design/design-mode.ts +7 -0
- package/src/design/design-shell.ts +76 -0
- package/src/design/display-style-form.test.ts +174 -0
- package/src/design/display-style-form.ts +217 -0
- package/src/design/field-highlight-form.test.ts +64 -0
- package/src/design/field-highlight-form.ts +169 -0
- package/src/design/field-palette.test.ts +97 -0
- package/src/design/field-palette.ts +250 -0
- package/src/design/formula-field-picker.test.ts +158 -0
- package/src/design/formula-field-picker.ts +189 -0
- package/src/design/palette-block-drop.ts +66 -0
- package/src/design/properties-panel.ts +900 -0
- package/src/design/schema-editor-controller.test.ts +296 -0
- package/src/design/schema-editor-controller.ts +1122 -0
- package/src/design/schema-editor-modal.ts +83 -0
- package/src/design/schema-items-designer-modal.ts +209 -0
- package/src/design/schema-items-designer.test.ts +148 -0
- package/src/design/schema-items-designer.ts +442 -0
- package/src/design/style-toolbar-shared.ts +218 -0
- package/src/dom-pragmatic.d.ts +83 -0
- package/src/domain/ophthalmology/catalogs.ts +72 -0
- package/src/domain/ophthalmology/life-anamnesis-tree.ts +43 -0
- package/src/domain/ophthalmology/norm-options.ts +24 -0
- package/src/domain/ophthalmology/ophthalmology-complaints-tree.ts +47 -0
- package/src/domain/ophthalmology/ophthalmology-diagnoses.ts +12 -0
- package/src/domain/ophthalmology/vision-values.ts +58 -0
- package/src/editorjs-shim.d.ts +2 -0
- package/src/export/document-pdf.sf-stub.ts +23 -0
- package/src/export/document-pdf.ts +44 -0
- package/src/export/preview-export-options.ts +29 -0
- package/src/export/preview-html-document.ts +34 -0
- package/src/export/preview-html-styles.test.ts +60 -0
- package/src/export/preview-html-styles.ts +551 -0
- package/src/export/preview-pdf-mount.ts +48 -0
- package/src/export/preview-pdf-parity.test.ts +237 -0
- package/src/fields/barcode-encode.test.ts +43 -0
- package/src/fields/barcode-encode.ts +147 -0
- package/src/fields/collect-field-values.test.ts +95 -0
- package/src/fields/columns-serialize.test.ts +75 -0
- package/src/fields/cross-section-reposition.test.ts +206 -0
- package/src/fields/cross-section-reposition.ts +214 -0
- package/src/fields/document-preview.test.ts +1621 -0
- package/src/fields/document-preview.ts +910 -0
- package/src/fields/field-clipboard.test.ts +312 -0
- package/src/fields/field-clipboard.ts +705 -0
- package/src/fields/field-display-style.test.ts +403 -0
- package/src/fields/field-display-style.ts +435 -0
- package/src/fields/field-keyboard.test.ts +446 -0
- package/src/fields/field-keyboard.ts +1281 -0
- package/src/fields/field-selection.test.ts +85 -0
- package/src/fields/field-selection.ts +137 -0
- package/src/fields/field-token-drag.test.ts +65 -0
- package/src/fields/fill-defaults.test.ts +89 -0
- package/src/fields/fill-field-focus.test.ts +239 -0
- package/src/fields/fill-field-focus.ts +249 -0
- package/src/fields/handlers/builtins.ts +879 -0
- package/src/fields/handlers/index.ts +16 -0
- package/src/fields/handlers/registry.test.ts +266 -0
- package/src/fields/handlers/registry.ts +88 -0
- package/src/fields/handlers/schema-form-dom.ts +135 -0
- package/src/fields/heading-line-breaks.test.ts +931 -0
- package/src/fields/inline-field-from-selection.test.ts +202 -0
- package/src/fields/inline-fields.ts +3760 -0
- package/src/fields/logical-display.test.ts +37 -0
- package/src/fields/logical-display.ts +29 -0
- package/src/fields/manual-field-values.test.ts +152 -0
- package/src/fields/manual-field-values.ts +207 -0
- package/src/fields/pivot-table-field.ts +458 -0
- package/src/fields/plain-text-newlines.test.ts +48 -0
- package/src/fields/repeater-field.ts +61 -0
- package/src/fields/rich-text.ts +1018 -0
- package/src/fields/table-field.test.ts +504 -0
- package/src/fields/table-field.ts +1026 -0
- package/src/fields/tree-paths.ts +6 -0
- package/src/fields/tree-selection.ts +50 -0
- package/src/fields/tree.ts +11 -0
- package/src/fields/wire-columns-resize.test.ts +40 -0
- package/src/fields/wire-columns-resize.ts +138 -0
- package/src/fields/wire-editorjs-native-drop-guard.test.ts +273 -0
- package/src/fields/wire-editorjs-native-drop-guard.ts +491 -0
- package/src/fields/wire-table-column-reorder.test.ts +163 -0
- package/src/fields/wire-table-column-reorder.ts +223 -0
- package/src/fields/wire-table-column-resize.test.ts +459 -0
- package/src/fields/wire-table-column-resize.ts +433 -0
- package/src/index.ts +290 -0
- package/src/node.ts +114 -0
- package/src/registry/registry-context.ts +36 -0
- package/src/registry/schema-registry.ts +80 -0
- package/src/services/image-upload.test.ts +180 -0
- package/src/services/image-upload.ts +185 -0
- package/src/sf-entry.ts +19 -0
- package/src/sf-pdf-viewer/main.ts +57 -0
- package/src/sf-pdf-viewer/viewer.html +40 -0
- package/src/styles/editor.css +5472 -0
- package/src/themes/bridge.css +2071 -0
- package/src/themes/prime.css +207 -0
- package/src/themes/slds.css +123 -0
- package/src/tools/document-section.ts +692 -0
- package/src/tools/template-block.ts +289 -0
- package/src/types.d.ts +1782 -0
- package/src/ui/action-icons.ts +13 -0
- package/src/ui/document-actions.ts +41 -0
- package/src/ui/drag-handle.ts +52 -0
- package/src/ui/existing-image-modal.ts +164 -0
- package/src/ui/field-form-modal.test.ts +92 -0
- package/src/ui/field-form-modal.ts +168 -0
- package/src/ui/field-mapping-badges.test.ts +93 -0
- package/src/ui/field-mapping-badges.ts +243 -0
- package/src/ui/field-mapping-modal-open.test.ts +72 -0
- package/src/ui/field-mapping-modal.ts +1277 -0
- package/src/ui/filename-prompt.ts +96 -0
- package/src/ui/format-icons.ts +42 -0
- package/src/ui/html-text-modal.ts +224 -0
- package/src/ui/image-modal.ts +264 -0
- package/src/ui/integer-modal.ts +76 -0
- package/src/ui/list-modal.test.ts +220 -0
- package/src/ui/list-modal.ts +701 -0
- package/src/ui/mapping-drag-drop.test.ts +61 -0
- package/src/ui/mapping-drag-drop.ts +382 -0
- package/src/ui/mapping-result-helper.test.ts +231 -0
- package/src/ui/mapping-result-helper.ts +725 -0
- package/src/ui/modal-picker-keyboard.test.ts +65 -0
- package/src/ui/modal-picker-keyboard.ts +87 -0
- package/src/ui/modal-picker-pills.ts +31 -0
- package/src/ui/notification.ts +54 -0
- package/src/ui/palette-icons.ts +64 -0
- package/src/ui/pdf-canvas-preview.ts +93 -0
- package/src/ui/preview-modal.ts +580 -0
- package/src/ui/recent-fill-colors.test.ts +66 -0
- package/src/ui/recent-fill-colors.ts +91 -0
- package/src/ui/repeater-editor-modal.ts +137 -0
- package/src/ui/rich-text-toolbar.test.ts +180 -0
- package/src/ui/rich-text-toolbar.ts +740 -0
- package/src/ui/signature-modal.ts +240 -0
- package/src/ui/source-path-canvas-drop.test.ts +256 -0
- package/src/ui/source-path-canvas-drop.ts +367 -0
- package/src/ui/source-schema-tree.ts +384 -0
- package/src/ui/text-modal.ts +37 -0
- package/src/ui/tree-modal.test.ts +484 -0
- package/src/ui/tree-modal.ts +682 -0
- package/src/ui/wire-modal-escape.test.ts +66 -0
- package/src/ui/wire-modal-escape.ts +23 -0
- package/src/ui/wire-modal-focus-trap.test.ts +307 -0
- package/src/ui/wire-modal-move.test.ts +107 -0
- package/src/ui/wire-modal-move.ts +201 -0
- package/src/ui/wire-modal-palette.ts +533 -0
- package/src/ui/wire-modal-resize.test.ts +76 -0
- package/src/ui/wire-modal-resize.ts +176 -0
- package/src/ui/wire-panel-splitter.test.ts +178 -0
- package/src/ui/wire-panel-splitter.ts +381 -0
- package/src/utils/export-filename.test.ts +54 -0
- package/src/utils/export-filename.ts +58 -0
- package/src/utils/print-document.ts +136 -0
- package/src/utils/save-blob.ts +40 -0
- package/src/web-component.ts +68 -0
|
@@ -0,0 +1,1118 @@
|
|
|
1
|
+
import { focusCaretAfter, focusCaretAtFieldBridge, insertLineBreakAtCaret, ensureCaretAnchorAfter, ensureFieldTokenCaretAnchors, removeTrailingCaretBridge, stripFieldTokenCaretAnchors, hasLeadingCaretAnchor, caretPositionAfterFieldToken, isCaretAnchorOnlyTextNode, normalizeEditableLineStructure, } from './inline-fields.js';
|
|
2
|
+
import { clearAllDesignTokenSelection, getFieldTokensForClipboard, getSelectedFieldTokens, sortTokensByDocumentOrder, } from './field-selection.js';
|
|
3
|
+
import { collectEditableFillFieldTokens, getFocusedFillFieldToken, isFillModalOverlayOpen, moveFillFieldFocus, resolveFillFocusHolder, } from './fill-field-focus.js';
|
|
4
|
+
function isFieldToken(node) {
|
|
5
|
+
return node?.nodeType === Node.ELEMENT_NODE && node.classList?.contains('field-token');
|
|
6
|
+
}
|
|
7
|
+
function isIgnorableText(node) {
|
|
8
|
+
return node?.nodeType === Node.TEXT_NODE && !stripFieldTokenCaretAnchors(node.textContent);
|
|
9
|
+
}
|
|
10
|
+
function isCaretAnchorTextNode(node) {
|
|
11
|
+
return isCaretAnchorOnlyTextNode(node);
|
|
12
|
+
}
|
|
13
|
+
function isEditorBlockElement(node) {
|
|
14
|
+
return (node?.nodeType === Node.ELEMENT_NODE &&
|
|
15
|
+
(node.tagName === 'DIV' || node.tagName === 'P' || node.tagName === 'H1' || node.tagName === 'H2' || node.tagName === 'H3') &&
|
|
16
|
+
!node.classList?.contains('document-align') &&
|
|
17
|
+
!node.classList?.contains('document-columns') &&
|
|
18
|
+
!node.classList?.contains('document-table') &&
|
|
19
|
+
!isFieldToken(node));
|
|
20
|
+
}
|
|
21
|
+
function getBlockAncestor(node, container) {
|
|
22
|
+
let current = node?.nodeType === Node.TEXT_NODE ? node.parentNode : node;
|
|
23
|
+
while (current && current !== container) {
|
|
24
|
+
if (isEditorBlockElement(current))
|
|
25
|
+
return current;
|
|
26
|
+
current = current.parentNode;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function isCaretAtLineStart(range, container) {
|
|
31
|
+
const { startContainer, startOffset } = range;
|
|
32
|
+
if (startContainer.nodeType === Node.TEXT_NODE) {
|
|
33
|
+
if (startOffset > 0)
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
else if (startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
37
|
+
if (startOffset > 0) {
|
|
38
|
+
const previous = startContainer.childNodes[startOffset - 1];
|
|
39
|
+
return previous?.nodeName === 'BR';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const before = getNodeBeforeCaret(range, container);
|
|
46
|
+
if (!before)
|
|
47
|
+
return false;
|
|
48
|
+
if (before.nodeName === 'BR')
|
|
49
|
+
return true;
|
|
50
|
+
if (isEditorBlockElement(before))
|
|
51
|
+
return true;
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
function mergeLineBackwardAtCaret(container, range) {
|
|
55
|
+
const before = getNodeBeforeCaret(range, container);
|
|
56
|
+
if (!before)
|
|
57
|
+
return false;
|
|
58
|
+
if (before.nodeName === 'BR') {
|
|
59
|
+
const caretNode = range.startContainer.nodeType === Node.TEXT_NODE ? range.startContainer : null;
|
|
60
|
+
const caretOffset = range.startOffset;
|
|
61
|
+
before.remove();
|
|
62
|
+
const sel = window.getSelection();
|
|
63
|
+
if (caretNode?.isConnected) {
|
|
64
|
+
const nextRange = document.createRange();
|
|
65
|
+
nextRange.setStart(caretNode, Math.min(caretOffset, caretNode.textContent?.length ?? 0));
|
|
66
|
+
nextRange.collapse(true);
|
|
67
|
+
sel?.removeAllRanges();
|
|
68
|
+
sel?.addRange(nextRange);
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
if (!isEditorBlockElement(before))
|
|
73
|
+
return false;
|
|
74
|
+
const currentBlock = getBlockAncestor(range.startContainer, container);
|
|
75
|
+
if (currentBlock === before)
|
|
76
|
+
return false;
|
|
77
|
+
if (!currentBlock) {
|
|
78
|
+
const { startContainer, startOffset } = range;
|
|
79
|
+
if (startContainer.nodeType !== Node.TEXT_NODE || startOffset !== 0)
|
|
80
|
+
return false;
|
|
81
|
+
const insertRange = document.createRange();
|
|
82
|
+
insertRange.selectNodeContents(before);
|
|
83
|
+
insertRange.collapse(false);
|
|
84
|
+
insertRange.insertNode(startContainer);
|
|
85
|
+
insertRange.collapse(false);
|
|
86
|
+
const sel = window.getSelection();
|
|
87
|
+
sel?.removeAllRanges();
|
|
88
|
+
sel?.addRange(insertRange);
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
const mergeRange = document.createRange();
|
|
92
|
+
mergeRange.selectNodeContents(before);
|
|
93
|
+
mergeRange.collapse(false);
|
|
94
|
+
while (currentBlock.firstChild) {
|
|
95
|
+
mergeRange.insertNode(currentBlock.firstChild);
|
|
96
|
+
mergeRange.collapse(false);
|
|
97
|
+
}
|
|
98
|
+
currentBlock.remove();
|
|
99
|
+
mergeRange.collapse(false);
|
|
100
|
+
const sel = window.getSelection();
|
|
101
|
+
sel?.removeAllRanges();
|
|
102
|
+
sel?.addRange(mergeRange);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
export function getCollapsedCaretRange(container) {
|
|
106
|
+
const sel = window.getSelection();
|
|
107
|
+
if (!sel?.rangeCount || !sel.isCollapsed)
|
|
108
|
+
return null;
|
|
109
|
+
const range = sel.getRangeAt(0);
|
|
110
|
+
const anchor = range.commonAncestorContainer;
|
|
111
|
+
if (!container.contains(anchor))
|
|
112
|
+
return null;
|
|
113
|
+
// Nested contenteditables (e.g. `.document-columns__col`) have their own
|
|
114
|
+
// keyboard wiring. Ignore those carets so the parent section does not steal
|
|
115
|
+
// arrow keys and park the caret on non-editable chrome (splitter, toolbar).
|
|
116
|
+
const anchorEl = anchor.nodeType === Node.TEXT_NODE ? anchor.parentElement : anchor;
|
|
117
|
+
const editingHost = anchorEl?.closest?.('[contenteditable="true"]');
|
|
118
|
+
if (editingHost && editingHost !== container && container.contains(editingHost)) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return range;
|
|
122
|
+
}
|
|
123
|
+
function getNodeAfterCaret(range, container) {
|
|
124
|
+
const { startContainer, startOffset } = range;
|
|
125
|
+
if (startContainer.nodeType === Node.TEXT_NODE) {
|
|
126
|
+
if (startOffset < (startContainer.textContent?.length ?? 0))
|
|
127
|
+
return null;
|
|
128
|
+
let node = startContainer;
|
|
129
|
+
while (node && node !== container) {
|
|
130
|
+
if (node.nextSibling)
|
|
131
|
+
return node.nextSibling;
|
|
132
|
+
node = node.parentNode;
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
if (startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
137
|
+
if (startOffset < startContainer.childNodes.length) {
|
|
138
|
+
return startContainer.childNodes[startOffset];
|
|
139
|
+
}
|
|
140
|
+
let node = startContainer;
|
|
141
|
+
while (node && node !== container) {
|
|
142
|
+
if (node.nextSibling)
|
|
143
|
+
return node.nextSibling;
|
|
144
|
+
node = node.parentNode;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
function getNodeBeforeCaret(range, container) {
|
|
150
|
+
const { startContainer, startOffset } = range;
|
|
151
|
+
if (startContainer.nodeType === Node.TEXT_NODE) {
|
|
152
|
+
if (startOffset > 0)
|
|
153
|
+
return null;
|
|
154
|
+
let node = startContainer;
|
|
155
|
+
while (node && node !== container) {
|
|
156
|
+
if (node.previousSibling)
|
|
157
|
+
return node.previousSibling;
|
|
158
|
+
node = node.parentNode;
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
if (startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
163
|
+
if (startOffset > 0) {
|
|
164
|
+
return startContainer.childNodes[startOffset - 1];
|
|
165
|
+
}
|
|
166
|
+
let node = startContainer;
|
|
167
|
+
while (node && node !== container) {
|
|
168
|
+
if (node.previousSibling)
|
|
169
|
+
return node.previousSibling;
|
|
170
|
+
node = node.parentNode;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
function walkForward(node, container) {
|
|
176
|
+
let bridgeBr = null;
|
|
177
|
+
let current = node;
|
|
178
|
+
while (current) {
|
|
179
|
+
if (!container.contains(current))
|
|
180
|
+
return null;
|
|
181
|
+
if (isIgnorableText(current)) {
|
|
182
|
+
current = current.nextSibling;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (current.nodeType === Node.TEXT_NODE) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
if (current.nodeType === Node.ELEMENT_NODE && current.tagName === 'BR') {
|
|
189
|
+
bridgeBr = current;
|
|
190
|
+
current = current.nextSibling;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (isFieldToken(current)) {
|
|
194
|
+
return { token: current, bridgeBr };
|
|
195
|
+
}
|
|
196
|
+
if (current.nodeType === Node.ELEMENT_NODE && current.childNodes.length === 0) {
|
|
197
|
+
current = current.nextSibling;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
function walkBackward(node, container) {
|
|
205
|
+
let bridgeBr = null;
|
|
206
|
+
let current = node;
|
|
207
|
+
while (current) {
|
|
208
|
+
if (!container.contains(current))
|
|
209
|
+
return null;
|
|
210
|
+
if (isIgnorableText(current)) {
|
|
211
|
+
current = current.previousSibling;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (current.nodeType === Node.TEXT_NODE) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
if (current.nodeType === Node.ELEMENT_NODE && current.tagName === 'BR') {
|
|
218
|
+
bridgeBr = current;
|
|
219
|
+
current = current.previousSibling;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (isFieldToken(current)) {
|
|
223
|
+
return { token: current, bridgeBr };
|
|
224
|
+
}
|
|
225
|
+
if (current.nodeType === Node.ELEMENT_NODE && current.childNodes.length === 0) {
|
|
226
|
+
current = current.previousSibling;
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
function findAdjacentFieldToken(range, direction, container) {
|
|
234
|
+
const startNode = direction === 'forward'
|
|
235
|
+
? getNodeAfterCaret(range, container)
|
|
236
|
+
: getNodeBeforeCaret(range, container);
|
|
237
|
+
if (!startNode)
|
|
238
|
+
return null;
|
|
239
|
+
return direction === 'forward'
|
|
240
|
+
? walkForward(startNode, container)
|
|
241
|
+
: walkBackward(startNode, container);
|
|
242
|
+
}
|
|
243
|
+
function focusCaretInText(textNode, offset = 0) {
|
|
244
|
+
if (!textNode?.isConnected || textNode.nodeType !== Node.TEXT_NODE)
|
|
245
|
+
return;
|
|
246
|
+
const range = document.createRange();
|
|
247
|
+
const max = textNode.textContent?.length ?? 0;
|
|
248
|
+
range.setStart(textNode, Math.max(0, Math.min(offset, max)));
|
|
249
|
+
range.collapse(true);
|
|
250
|
+
const sel = window.getSelection();
|
|
251
|
+
sel?.removeAllRanges();
|
|
252
|
+
sel?.addRange(range);
|
|
253
|
+
}
|
|
254
|
+
function focusCaretBefore(node) {
|
|
255
|
+
if (!node?.isConnected)
|
|
256
|
+
return;
|
|
257
|
+
const range = document.createRange();
|
|
258
|
+
range.setStartBefore(node);
|
|
259
|
+
range.collapse(true);
|
|
260
|
+
const sel = window.getSelection();
|
|
261
|
+
sel?.removeAllRanges();
|
|
262
|
+
sel?.addRange(range);
|
|
263
|
+
}
|
|
264
|
+
function focusCaretBeforeFieldToken(fieldToken, container) {
|
|
265
|
+
const earlier = skipBridgeNodes(fieldToken.previousSibling, 'backward', container);
|
|
266
|
+
if (earlier?.nodeType === Node.TEXT_NODE) {
|
|
267
|
+
focusCaretInText(earlier, earlier.textContent?.length ?? 0);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
focusCaretBefore(fieldToken);
|
|
271
|
+
}
|
|
272
|
+
function isNonEditableStructureNode(node) {
|
|
273
|
+
return (node?.nodeType === Node.ELEMENT_NODE &&
|
|
274
|
+
(node.classList?.contains('document-columns') ||
|
|
275
|
+
node.classList?.contains('document-columns__col-resizer') ||
|
|
276
|
+
node.classList?.contains('document-columns__toolbar') ||
|
|
277
|
+
node.classList?.contains('document-table') ||
|
|
278
|
+
node.classList?.contains('document-table__toolbar') ||
|
|
279
|
+
node.classList?.contains('editor-drag-handle')));
|
|
280
|
+
}
|
|
281
|
+
function skipBridgeNodes(node, direction, container) {
|
|
282
|
+
let current = node;
|
|
283
|
+
while (current) {
|
|
284
|
+
if (!container.contains(current))
|
|
285
|
+
return null;
|
|
286
|
+
if (isCaretAnchorTextNode(current)) {
|
|
287
|
+
return current;
|
|
288
|
+
}
|
|
289
|
+
if (isIgnorableText(current) || isNonEditableStructureNode(current)) {
|
|
290
|
+
current = direction === 'forward' ? current.nextSibling : current.previousSibling;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (current.nodeName === 'BR') {
|
|
294
|
+
current = direction === 'forward' ? current.nextSibling : current.previousSibling;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
return current;
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
function findFieldTokenBeforeCaret(range, container) {
|
|
302
|
+
if (range.startContainer.nodeType === Node.TEXT_NODE) {
|
|
303
|
+
const prev = skipBridgeNodes(range.startContainer.previousSibling, 'backward', container);
|
|
304
|
+
return isFieldToken(prev) ? prev : null;
|
|
305
|
+
}
|
|
306
|
+
if (range.startContainer.nodeType === Node.ELEMENT_NODE && range.startOffset > 0) {
|
|
307
|
+
const prev = skipBridgeNodes(range.startContainer.childNodes[range.startOffset - 1], 'backward', container);
|
|
308
|
+
return isFieldToken(prev) ? prev : null;
|
|
309
|
+
}
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
function findTextNodeAfterFieldToken(fieldToken, container) {
|
|
313
|
+
const after = skipBridgeNodes(fieldToken.nextSibling, 'forward', container);
|
|
314
|
+
if (after?.nodeType === Node.TEXT_NODE && stripFieldTokenCaretAnchors(after.textContent).length > 0) {
|
|
315
|
+
return after;
|
|
316
|
+
}
|
|
317
|
+
return null;
|
|
318
|
+
}
|
|
319
|
+
function caretIsBeforeVisibleTextAfterField(range, container) {
|
|
320
|
+
const fieldToken = findFieldTokenBeforeCaret(range, container);
|
|
321
|
+
if (!fieldToken)
|
|
322
|
+
return false;
|
|
323
|
+
const textAfter = findTextNodeAfterFieldToken(fieldToken, container);
|
|
324
|
+
if (!textAfter)
|
|
325
|
+
return false;
|
|
326
|
+
const enterOffset = caretPositionAfterFieldToken(textAfter);
|
|
327
|
+
if (range.startContainer === textAfter) {
|
|
328
|
+
return range.startOffset < enterOffset;
|
|
329
|
+
}
|
|
330
|
+
if (range.startContainer.nodeType === Node.ELEMENT_NODE && range.startOffset > 0) {
|
|
331
|
+
const prev = range.startContainer.childNodes[range.startOffset - 1];
|
|
332
|
+
return isFieldToken(prev) && range.startContainer.childNodes[range.startOffset] === textAfter;
|
|
333
|
+
}
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
function enterVisibleTextAfterField(range, container) {
|
|
337
|
+
const fieldToken = findFieldTokenBeforeCaret(range, container);
|
|
338
|
+
if (!fieldToken)
|
|
339
|
+
return false;
|
|
340
|
+
const textAfter = ensureCaretAnchorAfter(fieldToken) ?? findTextNodeAfterFieldToken(fieldToken, container);
|
|
341
|
+
if (!textAfter) {
|
|
342
|
+
focusCaretAfter(fieldToken);
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
if (isCaretAnchorTextNode(textAfter)) {
|
|
346
|
+
container.focus?.();
|
|
347
|
+
focusCaretAtFieldBridge(textAfter);
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
const enterOffset = caretPositionAfterFieldToken(textAfter);
|
|
351
|
+
if (range.startContainer === textAfter && range.startOffset >= enterOffset) {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
container.focus?.();
|
|
355
|
+
focusCaretInText(textAfter, enterOffset);
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
function stopArrowEvent(e) {
|
|
359
|
+
e.preventDefault();
|
|
360
|
+
e.stopPropagation();
|
|
361
|
+
e.stopImmediatePropagation();
|
|
362
|
+
}
|
|
363
|
+
function normalizeCollapsedCaret(container) {
|
|
364
|
+
// Self-heal after drag/drop or paste left adjacent field tokens without a ZWSP.
|
|
365
|
+
ensureFieldTokenCaretAnchors(container);
|
|
366
|
+
const range = getCollapsedCaretRange(container);
|
|
367
|
+
if (!range)
|
|
368
|
+
return;
|
|
369
|
+
if (range.startContainer.nodeType === Node.TEXT_NODE) {
|
|
370
|
+
const textNode = range.startContainer;
|
|
371
|
+
// Standalone bridge: keep caret at offset 0 (visible after the field).
|
|
372
|
+
// Offset > 0 is past the only invisible character and often paints nothing.
|
|
373
|
+
if (isCaretAnchorTextNode(textNode) && range.startOffset > 0) {
|
|
374
|
+
focusCaretAtFieldBridge(textNode);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (isFieldToken(textNode.previousSibling) &&
|
|
378
|
+
hasLeadingCaretAnchor(textNode.textContent) &&
|
|
379
|
+
stripFieldTokenCaretAnchors(textNode.textContent).length > 0 &&
|
|
380
|
+
range.startOffset === 0) {
|
|
381
|
+
focusCaretInText(textNode, 1);
|
|
382
|
+
}
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (range.startContainer.nodeType !== Node.ELEMENT_NODE)
|
|
386
|
+
return;
|
|
387
|
+
const prev = range.startContainer.childNodes[range.startOffset - 1];
|
|
388
|
+
const next = range.startContainer.childNodes[range.startOffset];
|
|
389
|
+
// Caret parked after a standalone bridge at the parent boundary — pull back
|
|
390
|
+
// into the bridge so Chrome keeps drawing it.
|
|
391
|
+
if (isCaretAnchorTextNode(prev)) {
|
|
392
|
+
focusCaretAtFieldBridge(prev);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (!isFieldToken(prev))
|
|
396
|
+
return;
|
|
397
|
+
if (isCaretAnchorTextNode(next)) {
|
|
398
|
+
focusCaretAtFieldBridge(next);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
focusCaretAfter(prev);
|
|
402
|
+
}
|
|
403
|
+
function focusCaretInEditable(el, atEnd = false) {
|
|
404
|
+
if (!el)
|
|
405
|
+
return false;
|
|
406
|
+
el.focus?.();
|
|
407
|
+
const sel = window.getSelection();
|
|
408
|
+
if (!sel)
|
|
409
|
+
return false;
|
|
410
|
+
const range = document.createRange();
|
|
411
|
+
range.selectNodeContents(el);
|
|
412
|
+
range.collapse(!atEnd);
|
|
413
|
+
sel.removeAllRanges();
|
|
414
|
+
sel.addRange(range);
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
function focusCaretAroundStructure(node, direction) {
|
|
418
|
+
if (!isNonEditableStructureNode(node))
|
|
419
|
+
return false;
|
|
420
|
+
if (node.classList?.contains('document-columns')) {
|
|
421
|
+
const cols = [...node.querySelectorAll(':scope > .document-columns__grid > .document-columns__col')];
|
|
422
|
+
if (cols.length) {
|
|
423
|
+
const target = direction === 'forward' ? cols[0] : cols[cols.length - 1];
|
|
424
|
+
return focusCaretInEditable(target, direction !== 'forward');
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (!node.parentNode)
|
|
428
|
+
return false;
|
|
429
|
+
const range = document.createRange();
|
|
430
|
+
if (direction === 'forward')
|
|
431
|
+
range.setStartAfter(node);
|
|
432
|
+
else
|
|
433
|
+
range.setStartBefore(node);
|
|
434
|
+
range.collapse(true);
|
|
435
|
+
const sel = window.getSelection();
|
|
436
|
+
sel?.removeAllRanges();
|
|
437
|
+
sel?.addRange(range);
|
|
438
|
+
return true;
|
|
439
|
+
}
|
|
440
|
+
function handleArrowNavigation(range, direction, container) {
|
|
441
|
+
const forward = direction === 'forward';
|
|
442
|
+
if (range.startContainer.nodeType === Node.TEXT_NODE) {
|
|
443
|
+
const textNode = range.startContainer;
|
|
444
|
+
const atStart = range.startOffset === 0;
|
|
445
|
+
const atEnd = range.startOffset === (textNode.textContent?.length ?? 0);
|
|
446
|
+
if (!forward && atStart) {
|
|
447
|
+
const before = skipBridgeNodes(textNode.previousSibling, 'backward', container);
|
|
448
|
+
if (isFieldToken(before)) {
|
|
449
|
+
focusCaretBeforeFieldToken(before, container);
|
|
450
|
+
return true;
|
|
451
|
+
}
|
|
452
|
+
if (isNonEditableStructureNode(before) && focusCaretAroundStructure(before, 'backward')) {
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (!forward && isCaretAnchorTextNode(textNode)) {
|
|
457
|
+
const before = skipBridgeNodes(textNode.previousSibling, 'backward', container);
|
|
458
|
+
if (isFieldToken(before)) {
|
|
459
|
+
focusCaretBeforeFieldToken(before, container);
|
|
460
|
+
return true;
|
|
461
|
+
}
|
|
462
|
+
focusCaretBefore(textNode);
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
if (!forward &&
|
|
466
|
+
isFieldToken(textNode.previousSibling) &&
|
|
467
|
+
hasLeadingCaretAnchor(textNode.textContent) &&
|
|
468
|
+
stripFieldTokenCaretAnchors(textNode.textContent).length > 0 &&
|
|
469
|
+
range.startOffset === caretPositionAfterFieldToken(textNode)) {
|
|
470
|
+
focusCaretBeforeFieldToken(textNode.previousSibling, container);
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
if (forward && atEnd) {
|
|
474
|
+
const after = skipBridgeNodes(textNode.nextSibling, 'forward', container);
|
|
475
|
+
if (after?.nodeType === Node.TEXT_NODE) {
|
|
476
|
+
focusCaretInText(after, caretPositionAfterFieldToken(after));
|
|
477
|
+
return true;
|
|
478
|
+
}
|
|
479
|
+
if (isFieldToken(after)) {
|
|
480
|
+
focusCaretAfter(after);
|
|
481
|
+
return true;
|
|
482
|
+
}
|
|
483
|
+
if (isNonEditableStructureNode(textNode.nextSibling) &&
|
|
484
|
+
focusCaretAroundStructure(textNode.nextSibling, 'forward')) {
|
|
485
|
+
return true;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (forward && hasLeadingCaretAnchor(textNode.textContent) && range.startOffset === 0) {
|
|
489
|
+
if (isCaretAnchorTextNode(textNode)) {
|
|
490
|
+
// Leave the standalone bridge toward the next visible node (or stay put
|
|
491
|
+
// only when there is nothing after — still keep caret painted at offset 0).
|
|
492
|
+
const afterAnchor = skipBridgeNodes(textNode.nextSibling, 'forward', container);
|
|
493
|
+
if (afterAnchor?.nodeType === Node.TEXT_NODE &&
|
|
494
|
+
stripFieldTokenCaretAnchors(afterAnchor.textContent).length > 0) {
|
|
495
|
+
focusCaretInText(afterAnchor, caretPositionAfterFieldToken(afterAnchor));
|
|
496
|
+
return true;
|
|
497
|
+
}
|
|
498
|
+
if (isFieldToken(afterAnchor)) {
|
|
499
|
+
focusCaretAfter(afterAnchor);
|
|
500
|
+
return true;
|
|
501
|
+
}
|
|
502
|
+
// Nothing further on this line — let the browser handle (e.g. next block).
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
505
|
+
// After a field token, offset 1 is the visible landing spot.
|
|
506
|
+
// Stray leading ZWSP (e.g. leftover after Enter) is invisible — skip it and
|
|
507
|
+
// step into the first visible character so ArrowRight is not a no-op.
|
|
508
|
+
if (!isFieldToken(textNode.previousSibling)) {
|
|
509
|
+
const enter = caretPositionAfterFieldToken(textNode);
|
|
510
|
+
const len = textNode.textContent?.length ?? 0;
|
|
511
|
+
const visibleLen = stripFieldTokenCaretAnchors(textNode.textContent).length;
|
|
512
|
+
focusCaretInText(textNode, visibleLen > 0 ? Math.min(enter + 1, len) : enter);
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
focusCaretInText(textNode, 1);
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
const adjacent = forward
|
|
521
|
+
? getNodeAfterCaret(range, container)
|
|
522
|
+
: getNodeBeforeCaret(range, container);
|
|
523
|
+
if (isNonEditableStructureNode(adjacent) && focusCaretAroundStructure(adjacent, direction)) {
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
const normalized = skipBridgeNodes(adjacent, direction, container);
|
|
527
|
+
if (normalized?.nodeType === Node.TEXT_NODE) {
|
|
528
|
+
if (isCaretAnchorTextNode(normalized)) {
|
|
529
|
+
if (forward) {
|
|
530
|
+
const afterAnchor = normalized.nextSibling;
|
|
531
|
+
if (afterAnchor?.nodeType === Node.TEXT_NODE &&
|
|
532
|
+
stripFieldTokenCaretAnchors(afterAnchor.textContent).length > 0) {
|
|
533
|
+
focusCaretInText(afterAnchor, caretPositionAfterFieldToken(afterAnchor));
|
|
534
|
+
return true;
|
|
535
|
+
}
|
|
536
|
+
if (isFieldToken(afterAnchor)) {
|
|
537
|
+
focusCaretAfter(afterAnchor);
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
540
|
+
focusCaretAtFieldBridge(normalized);
|
|
541
|
+
return true;
|
|
542
|
+
}
|
|
543
|
+
const before = skipBridgeNodes(normalized.previousSibling, 'backward', container);
|
|
544
|
+
if (isFieldToken(before)) {
|
|
545
|
+
focusCaretBeforeFieldToken(before, container);
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
548
|
+
focusCaretBefore(normalized);
|
|
549
|
+
return true;
|
|
550
|
+
}
|
|
551
|
+
// Plain text after a <br> (or other non-field boundary): placing the caret at
|
|
552
|
+
// the visual start is a no-op vs sitting just before the node, and
|
|
553
|
+
// preventDefault would freeze ArrowRight at the start of the new line.
|
|
554
|
+
const prev = skipBridgeNodes(normalized.previousSibling, 'backward', container);
|
|
555
|
+
if (forward && !isFieldToken(prev)) {
|
|
556
|
+
if (!hasLeadingCaretAnchor(normalized.textContent)) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
const enter = caretPositionAfterFieldToken(normalized);
|
|
560
|
+
const len = normalized.textContent?.length ?? 0;
|
|
561
|
+
const visibleLen = stripFieldTokenCaretAnchors(normalized.textContent).length;
|
|
562
|
+
focusCaretInText(normalized, visibleLen > 0 ? Math.min(enter + 1, len) : enter);
|
|
563
|
+
return true;
|
|
564
|
+
}
|
|
565
|
+
focusCaretInText(normalized, forward ? caretPositionAfterFieldToken(normalized) : normalized.textContent?.length ?? 0);
|
|
566
|
+
return true;
|
|
567
|
+
}
|
|
568
|
+
if (isFieldToken(normalized)) {
|
|
569
|
+
if (forward) {
|
|
570
|
+
focusCaretAfter(normalized);
|
|
571
|
+
}
|
|
572
|
+
else {
|
|
573
|
+
focusCaretBeforeFieldToken(normalized, container);
|
|
574
|
+
}
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
if (range.startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
578
|
+
const index = forward ? range.startOffset : range.startOffset - 1;
|
|
579
|
+
const node = range.startContainer.childNodes[index];
|
|
580
|
+
if (isFieldToken(node)) {
|
|
581
|
+
if (forward) {
|
|
582
|
+
const after = skipBridgeNodes(node.nextSibling, 'forward', container);
|
|
583
|
+
if (after?.nodeType === Node.TEXT_NODE) {
|
|
584
|
+
focusCaretInText(after, caretPositionAfterFieldToken(after));
|
|
585
|
+
return true;
|
|
586
|
+
}
|
|
587
|
+
focusCaretAfter(node);
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
focusCaretBeforeFieldToken(node, container);
|
|
591
|
+
}
|
|
592
|
+
return true;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return false;
|
|
596
|
+
}
|
|
597
|
+
export function moveFieldTokenToCaret(token, range, bridgeBr) {
|
|
598
|
+
bridgeBr?.remove();
|
|
599
|
+
const insertRange = range.cloneRange();
|
|
600
|
+
const editableRoot = token.parentElement?.closest?.('[contenteditable="true"]') ?? token.parentElement;
|
|
601
|
+
removeTrailingCaretBridge(token);
|
|
602
|
+
token.remove();
|
|
603
|
+
insertRange.insertNode(token);
|
|
604
|
+
if (editableRoot)
|
|
605
|
+
ensureFieldTokenCaretAnchors(editableRoot);
|
|
606
|
+
else
|
|
607
|
+
ensureCaretAnchorAfter(token);
|
|
608
|
+
focusCaretAfter(token);
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Backspace at the end of a ZWSP bridge (or Delete at its start) would remove the
|
|
612
|
+
* only caret landing spot between contenteditable=false field tokens.
|
|
613
|
+
*/
|
|
614
|
+
export function findStandaloneCaretBridgeTargetedByDelete(range, direction) {
|
|
615
|
+
const node = range?.startContainer;
|
|
616
|
+
if (!node || node.nodeType !== Node.TEXT_NODE || !isCaretAnchorTextNode(node)) {
|
|
617
|
+
return null;
|
|
618
|
+
}
|
|
619
|
+
if (direction === 'backward') {
|
|
620
|
+
return range.startOffset > 0 ? node : null;
|
|
621
|
+
}
|
|
622
|
+
return range.startOffset === 0 ? node : null;
|
|
623
|
+
}
|
|
624
|
+
/** Keep the bridge; step the caret across it instead of deleting it. */
|
|
625
|
+
function preserveCaretBridgeOnDelete(range, direction, container) {
|
|
626
|
+
const bridge = findStandaloneCaretBridgeTargetedByDelete(range, direction);
|
|
627
|
+
if (!bridge)
|
|
628
|
+
return false;
|
|
629
|
+
if (direction === 'backward') {
|
|
630
|
+
// Sit at offset 0 so the next Backspace can delete the preceding field.
|
|
631
|
+
focusCaretAtFieldBridge(bridge);
|
|
632
|
+
return true;
|
|
633
|
+
}
|
|
634
|
+
const after = skipBridgeNodes(bridge.nextSibling, 'forward', container);
|
|
635
|
+
if (isFieldToken(after)) {
|
|
636
|
+
focusCaretAfter(after);
|
|
637
|
+
return true;
|
|
638
|
+
}
|
|
639
|
+
if (after?.nodeType === Node.TEXT_NODE) {
|
|
640
|
+
focusCaretInText(after, caretPositionAfterFieldToken(after));
|
|
641
|
+
return true;
|
|
642
|
+
}
|
|
643
|
+
focusCaretAtFieldBridge(bridge);
|
|
644
|
+
return true;
|
|
645
|
+
}
|
|
646
|
+
function isTableCellToken(token) {
|
|
647
|
+
return !!token?.classList?.contains('field-token--cell');
|
|
648
|
+
}
|
|
649
|
+
function deleteFieldToken(token, onDeleteField, onStructureChange) {
|
|
650
|
+
if (!token?.isConnected || isTableCellToken(token))
|
|
651
|
+
return;
|
|
652
|
+
removeTrailingCaretBridge(token);
|
|
653
|
+
onDeleteField?.(token.dataset.fieldId, token);
|
|
654
|
+
token.remove();
|
|
655
|
+
onStructureChange?.();
|
|
656
|
+
}
|
|
657
|
+
function getVisibleSiblingAfterField(fieldToken, container) {
|
|
658
|
+
let node = fieldToken.nextSibling;
|
|
659
|
+
while (node && container.contains(node)) {
|
|
660
|
+
if (isCaretAnchorTextNode(node)) {
|
|
661
|
+
node = node.nextSibling;
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
665
|
+
return stripFieldTokenCaretAnchors(node.textContent).length > 0 ? node : null;
|
|
666
|
+
}
|
|
667
|
+
if (isFieldToken(node) || node.nodeName === 'BR') {
|
|
668
|
+
return node;
|
|
669
|
+
}
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
return null;
|
|
673
|
+
}
|
|
674
|
+
function fieldIsTrailing(fieldToken, container) {
|
|
675
|
+
return !getVisibleSiblingAfterField(fieldToken, container);
|
|
676
|
+
}
|
|
677
|
+
function lineVisibleContent(text) {
|
|
678
|
+
return String(text ?? '').split('\n')[0].replace(/\u200B/g, '').replace(/[\s.,;:!?]/g, '');
|
|
679
|
+
}
|
|
680
|
+
function hasSameLineContentAfterFieldExit(range, fieldToken, container) {
|
|
681
|
+
if (range.startContainer.nodeType === Node.TEXT_NODE) {
|
|
682
|
+
const textNode = range.startContainer;
|
|
683
|
+
let previous = textNode.previousSibling;
|
|
684
|
+
while (previous && (isCaretAnchorTextNode(previous) || isIgnorableText(previous))) {
|
|
685
|
+
previous = previous.previousSibling;
|
|
686
|
+
}
|
|
687
|
+
if (previous !== fieldToken)
|
|
688
|
+
return true;
|
|
689
|
+
const visible = stripFieldTokenCaretAnchors(textNode.textContent);
|
|
690
|
+
const enterOffset = caretPositionAfterFieldToken(textNode);
|
|
691
|
+
const afterCaret = visible.slice(Math.max(0, range.startOffset - enterOffset));
|
|
692
|
+
return lineVisibleContent(afterCaret).length > 0;
|
|
693
|
+
}
|
|
694
|
+
let node = fieldToken.nextSibling;
|
|
695
|
+
while (node && container.contains(node)) {
|
|
696
|
+
if (isCaretAnchorTextNode(node)) {
|
|
697
|
+
node = node.nextSibling;
|
|
698
|
+
continue;
|
|
699
|
+
}
|
|
700
|
+
if (node.nodeName === 'BR')
|
|
701
|
+
return false;
|
|
702
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
703
|
+
const visible = stripFieldTokenCaretAnchors(node.textContent);
|
|
704
|
+
if (lineVisibleContent(visible).length > 0)
|
|
705
|
+
return true;
|
|
706
|
+
if (visible.includes('\n'))
|
|
707
|
+
return false;
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
if (isFieldToken(node))
|
|
711
|
+
return true;
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
return false;
|
|
715
|
+
}
|
|
716
|
+
function shouldDeleteFieldOnBackwardFromExit(range, fieldToken, container) {
|
|
717
|
+
if (!isCaretOnFieldExitPosition(range, fieldToken, container))
|
|
718
|
+
return false;
|
|
719
|
+
if (fieldIsTrailing(fieldToken, container))
|
|
720
|
+
return true;
|
|
721
|
+
return !hasSameLineContentAfterFieldExit(range, fieldToken, container);
|
|
722
|
+
}
|
|
723
|
+
function isCaretOnFieldExitPosition(range, fieldToken, container) {
|
|
724
|
+
if (range.startContainer.nodeType === Node.TEXT_NODE) {
|
|
725
|
+
const textNode = range.startContainer;
|
|
726
|
+
let previous = textNode.previousSibling;
|
|
727
|
+
while (previous && (isCaretAnchorTextNode(previous) || isIgnorableText(previous))) {
|
|
728
|
+
previous = previous.previousSibling;
|
|
729
|
+
}
|
|
730
|
+
if (previous !== fieldToken)
|
|
731
|
+
return false;
|
|
732
|
+
if (isCaretAnchorTextNode(textNode))
|
|
733
|
+
return true;
|
|
734
|
+
if (hasLeadingCaretAnchor(textNode.textContent) &&
|
|
735
|
+
range.startOffset <= caretPositionAfterFieldToken(textNode)) {
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
return false;
|
|
739
|
+
}
|
|
740
|
+
if (range.startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
741
|
+
let current = getNodeBeforeCaret(range, container);
|
|
742
|
+
while (current && (isCaretAnchorTextNode(current) || isIgnorableText(current))) {
|
|
743
|
+
current = current.previousSibling;
|
|
744
|
+
}
|
|
745
|
+
return current === fieldToken;
|
|
746
|
+
}
|
|
747
|
+
return false;
|
|
748
|
+
}
|
|
749
|
+
function findBackwardFieldTokenFromCaret(range, container) {
|
|
750
|
+
if (range.startContainer.nodeType === Node.TEXT_NODE) {
|
|
751
|
+
const textNode = range.startContainer;
|
|
752
|
+
if (isCaretAnchorTextNode(textNode)) {
|
|
753
|
+
const before = skipBridgeNodes(textNode.previousSibling, 'backward', container);
|
|
754
|
+
return isFieldToken(before) ? before : null;
|
|
755
|
+
}
|
|
756
|
+
if (range.startOffset === 0 ||
|
|
757
|
+
(hasLeadingCaretAnchor(textNode.textContent) &&
|
|
758
|
+
range.startOffset <= caretPositionAfterFieldToken(textNode))) {
|
|
759
|
+
const before = skipBridgeNodes(textNode.previousSibling, 'backward', container);
|
|
760
|
+
return isFieldToken(before) ? before : null;
|
|
761
|
+
}
|
|
762
|
+
return null;
|
|
763
|
+
}
|
|
764
|
+
if (range.startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
765
|
+
const start = getNodeBeforeCaret(range, container);
|
|
766
|
+
if (!start)
|
|
767
|
+
return null;
|
|
768
|
+
if (isFieldToken(start))
|
|
769
|
+
return start;
|
|
770
|
+
const walked = walkBackward(start, container);
|
|
771
|
+
return walked?.token ?? null;
|
|
772
|
+
}
|
|
773
|
+
return null;
|
|
774
|
+
}
|
|
775
|
+
function tryDeleteTrailingFieldOnBackwardDelete(range, container, { onDeleteField, onStructureChange }) {
|
|
776
|
+
const fieldToken = findBackwardFieldTokenFromCaret(range, container);
|
|
777
|
+
if (!fieldToken || !shouldDeleteFieldOnBackwardFromExit(range, fieldToken, container)) {
|
|
778
|
+
return false;
|
|
779
|
+
}
|
|
780
|
+
deleteFieldToken(fieldToken, onDeleteField, onStructureChange);
|
|
781
|
+
return true;
|
|
782
|
+
}
|
|
783
|
+
function deleteSelectedTokens(container, onDeleteField, onStructureChange) {
|
|
784
|
+
const selected = sortTokensByDocumentOrder(getSelectedFieldTokens(container));
|
|
785
|
+
if (!selected.length)
|
|
786
|
+
return false;
|
|
787
|
+
// Table column/cell fields are structural — Delete must not remove them.
|
|
788
|
+
const deletable = selected.filter((token) => !isTableCellToken(token));
|
|
789
|
+
if (!deletable.length)
|
|
790
|
+
return true;
|
|
791
|
+
for (const token of deletable) {
|
|
792
|
+
onDeleteField?.(token.dataset.fieldId, token);
|
|
793
|
+
}
|
|
794
|
+
clearAllDesignTokenSelection(document);
|
|
795
|
+
onStructureChange?.();
|
|
796
|
+
return true;
|
|
797
|
+
}
|
|
798
|
+
function shouldIgnoreFieldDeleteKey(target) {
|
|
799
|
+
if (!target)
|
|
800
|
+
return true;
|
|
801
|
+
const el = target.nodeType === Node.ELEMENT_NODE ? target : target.parentElement;
|
|
802
|
+
if (!el)
|
|
803
|
+
return true;
|
|
804
|
+
if (el.closest('.modal-overlay:not([hidden])'))
|
|
805
|
+
return true;
|
|
806
|
+
if (el.closest('input, textarea, select, .schema-editor, .document-section__label-input'))
|
|
807
|
+
return true;
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
function resolveProtectFieldsInFillMode(options) {
|
|
811
|
+
if (typeof options.getProtectFieldsInFillMode === 'function') {
|
|
812
|
+
return options.getProtectFieldsInFillMode() !== false;
|
|
813
|
+
}
|
|
814
|
+
return options.protectFieldsInFillMode !== false;
|
|
815
|
+
}
|
|
816
|
+
function selectionIncludesProtectedFieldTokens(container, protectFields) {
|
|
817
|
+
if (!protectFields)
|
|
818
|
+
return false;
|
|
819
|
+
return getFieldTokensForClipboard(container).length > 0;
|
|
820
|
+
}
|
|
821
|
+
function shouldBlockFillModeFieldDelete(container, range, direction, protectFields) {
|
|
822
|
+
if (!protectFields)
|
|
823
|
+
return false;
|
|
824
|
+
if (getFieldTokensForClipboard(container).length)
|
|
825
|
+
return true;
|
|
826
|
+
if (!range)
|
|
827
|
+
return false;
|
|
828
|
+
const adjacent = findAdjacentFieldToken(range, direction, container);
|
|
829
|
+
return !!adjacent?.token;
|
|
830
|
+
}
|
|
831
|
+
export function wireFieldTokenKeyboard(container, options = {}) {
|
|
832
|
+
const { designMode = false, mappingMode = false, onDeleteField, onStructureChange } = options;
|
|
833
|
+
if (mappingMode) {
|
|
834
|
+
return () => { };
|
|
835
|
+
}
|
|
836
|
+
ensureFieldTokenCaretAnchors(container);
|
|
837
|
+
function getFillFocusSchemas() {
|
|
838
|
+
return options.getRegistry?.()?.getFieldSchemas?.() ?? options.fieldSchemas ?? {};
|
|
839
|
+
}
|
|
840
|
+
function handleFillFieldFocusKeys(e) {
|
|
841
|
+
if (designMode)
|
|
842
|
+
return false;
|
|
843
|
+
if (shouldIgnoreFieldDeleteKey(e.target))
|
|
844
|
+
return false;
|
|
845
|
+
if (isFillModalOverlayOpen())
|
|
846
|
+
return false;
|
|
847
|
+
if (e.ctrlKey || e.metaKey || e.altKey)
|
|
848
|
+
return false;
|
|
849
|
+
const holder = resolveFillFocusHolder(container, options);
|
|
850
|
+
const getSchemas = () => getFillFocusSchemas();
|
|
851
|
+
if (e.key === 'Tab') {
|
|
852
|
+
const tokens = collectEditableFillFieldTokens(holder, getSchemas);
|
|
853
|
+
if (!tokens.length)
|
|
854
|
+
return false;
|
|
855
|
+
const moved = moveFillFieldFocus(holder, e.shiftKey ? -1 : 1, getSchemas);
|
|
856
|
+
if (!moved)
|
|
857
|
+
return false;
|
|
858
|
+
e.preventDefault();
|
|
859
|
+
e.stopPropagation();
|
|
860
|
+
return true;
|
|
861
|
+
}
|
|
862
|
+
if ((e.key === 'Enter' || e.key === ' ') && !e.shiftKey) {
|
|
863
|
+
const focused = getFocusedFillFieldToken(holder);
|
|
864
|
+
if (!focused || !options.onActivateFillField)
|
|
865
|
+
return false;
|
|
866
|
+
e.preventDefault();
|
|
867
|
+
e.stopPropagation();
|
|
868
|
+
void options.onActivateFillField(focused);
|
|
869
|
+
return true;
|
|
870
|
+
}
|
|
871
|
+
return false;
|
|
872
|
+
}
|
|
873
|
+
function handleSelectionChange() {
|
|
874
|
+
// Field dialogs own keyboard/selection while open — don't heal canvas carets
|
|
875
|
+
// (arrows would otherwise keep moving "selected" text behind the overlay).
|
|
876
|
+
if (isFillModalOverlayOpen())
|
|
877
|
+
return;
|
|
878
|
+
normalizeCollapsedCaret(container);
|
|
879
|
+
}
|
|
880
|
+
function handleInput(e) {
|
|
881
|
+
if (isFillModalOverlayOpen())
|
|
882
|
+
return;
|
|
883
|
+
// Native deletes can still collapse bridges (e.g. selecting ZWSP+text). Re-anchor.
|
|
884
|
+
if (e.inputType === 'deleteContentBackward' ||
|
|
885
|
+
e.inputType === 'deleteContentForward' ||
|
|
886
|
+
e.inputType === 'deleteByCut' ||
|
|
887
|
+
e.inputType === 'deleteByDrag' ||
|
|
888
|
+
e.inputType === 'historyUndo' ||
|
|
889
|
+
e.inputType === 'historyRedo') {
|
|
890
|
+
ensureFieldTokenCaretAnchors(container);
|
|
891
|
+
normalizeCollapsedCaret(container);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
function handleBeforeInput(e) {
|
|
895
|
+
if (isFillModalOverlayOpen())
|
|
896
|
+
return;
|
|
897
|
+
if (e.inputType === 'insertParagraph' &&
|
|
898
|
+
!e.ctrlKey &&
|
|
899
|
+
!e.metaKey &&
|
|
900
|
+
!e.altKey &&
|
|
901
|
+
!shouldIgnoreFieldDeleteKey(e.target)) {
|
|
902
|
+
const range = getCollapsedCaretRange(container);
|
|
903
|
+
if (range && !range.startContainer?.parentElement?.closest?.('.field-token')) {
|
|
904
|
+
e.preventDefault();
|
|
905
|
+
insertLineBreakAtCaret(container);
|
|
906
|
+
normalizeEditableLineStructure(container);
|
|
907
|
+
onStructureChange?.();
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
if (e.inputType !== 'deleteContentForward' &&
|
|
912
|
+
e.inputType !== 'deleteContentBackward' &&
|
|
913
|
+
e.inputType !== 'deleteByCut') {
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
if (designMode) {
|
|
917
|
+
const selected = getSelectedFieldTokens(container);
|
|
918
|
+
if (selected.length) {
|
|
919
|
+
e.preventDefault();
|
|
920
|
+
deleteSelectedTokens(container, onDeleteField, onStructureChange);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
const range = getCollapsedCaretRange(container);
|
|
924
|
+
if (!range)
|
|
925
|
+
return;
|
|
926
|
+
const direction = e.inputType === 'deleteContentForward' ? 'forward' : 'backward';
|
|
927
|
+
if (preserveCaretBridgeOnDelete(range, direction, container)) {
|
|
928
|
+
e.preventDefault();
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
if (direction === 'backward' &&
|
|
932
|
+
tryDeleteTrailingFieldOnBackwardDelete(range, container, { onDeleteField, onStructureChange })) {
|
|
933
|
+
e.preventDefault();
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
const adjacent = findAdjacentFieldToken(range, direction, container);
|
|
937
|
+
if (!adjacent)
|
|
938
|
+
return;
|
|
939
|
+
e.preventDefault();
|
|
940
|
+
moveFieldTokenToCaret(adjacent.token, range, adjacent.bridgeBr);
|
|
941
|
+
onStructureChange?.();
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
const protectFields = resolveProtectFieldsInFillMode(options);
|
|
945
|
+
if (selectionIncludesProtectedFieldTokens(container, protectFields)) {
|
|
946
|
+
e.preventDefault();
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
const range = getCollapsedCaretRange(container);
|
|
950
|
+
if (!range)
|
|
951
|
+
return;
|
|
952
|
+
const direction = e.inputType === 'deleteContentForward' ? 'forward' : 'backward';
|
|
953
|
+
if (preserveCaretBridgeOnDelete(range, direction, container)) {
|
|
954
|
+
e.preventDefault();
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
if (shouldBlockFillModeFieldDelete(container, range, direction, protectFields)) {
|
|
958
|
+
e.preventDefault();
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
if (!protectFields &&
|
|
962
|
+
direction === 'backward' &&
|
|
963
|
+
tryDeleteTrailingFieldOnBackwardDelete(range, container, { onDeleteField, onStructureChange })) {
|
|
964
|
+
e.preventDefault();
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
if (direction === 'backward' && isCaretAtLineStart(range, container)) {
|
|
968
|
+
if (mergeLineBackwardAtCaret(container, range)) {
|
|
969
|
+
e.preventDefault();
|
|
970
|
+
onStructureChange?.();
|
|
971
|
+
}
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
const adjacent = findAdjacentFieldToken(range, direction, container);
|
|
975
|
+
if (!adjacent?.bridgeBr)
|
|
976
|
+
return;
|
|
977
|
+
e.preventDefault();
|
|
978
|
+
adjacent.bridgeBr.remove();
|
|
979
|
+
onStructureChange?.();
|
|
980
|
+
}
|
|
981
|
+
function handleArrowKey(e) {
|
|
982
|
+
if (isFillModalOverlayOpen())
|
|
983
|
+
return false;
|
|
984
|
+
if (!shouldIgnoreFieldDeleteKey(e.target)) {
|
|
985
|
+
const range = getCollapsedCaretRange(container);
|
|
986
|
+
if (!range)
|
|
987
|
+
return false;
|
|
988
|
+
const direction = e.key === 'ArrowRight' ? 'forward' : 'backward';
|
|
989
|
+
if (direction === 'forward' &&
|
|
990
|
+
caretIsBeforeVisibleTextAfterField(range, container) &&
|
|
991
|
+
enterVisibleTextAfterField(range, container)) {
|
|
992
|
+
normalizeCollapsedCaret(container);
|
|
993
|
+
return true;
|
|
994
|
+
}
|
|
995
|
+
if (handleArrowNavigation(range, direction, container)) {
|
|
996
|
+
container.focus?.();
|
|
997
|
+
return true;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
function handleKeyDown(e) {
|
|
1003
|
+
// While a field dialog is open, ignore canvas keyboard entirely — even if
|
|
1004
|
+
// focus/selection leaked back onto a contenteditable behind the overlay.
|
|
1005
|
+
if (isFillModalOverlayOpen())
|
|
1006
|
+
return;
|
|
1007
|
+
if (handleFillFieldFocusKeys(e))
|
|
1008
|
+
return;
|
|
1009
|
+
if ((e.key === 'ArrowRight' || e.key === 'ArrowLeft') &&
|
|
1010
|
+
!e.ctrlKey &&
|
|
1011
|
+
!e.metaKey &&
|
|
1012
|
+
!e.altKey &&
|
|
1013
|
+
!e.shiftKey) {
|
|
1014
|
+
if (handleArrowKey(e)) {
|
|
1015
|
+
stopArrowEvent(e);
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') &&
|
|
1020
|
+
!e.ctrlKey &&
|
|
1021
|
+
!e.metaKey &&
|
|
1022
|
+
!e.altKey &&
|
|
1023
|
+
!e.shiftKey &&
|
|
1024
|
+
!shouldIgnoreFieldDeleteKey(e.target) &&
|
|
1025
|
+
getCollapsedCaretRange(container)) {
|
|
1026
|
+
normalizeEditableLineStructure(container);
|
|
1027
|
+
}
|
|
1028
|
+
if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
1029
|
+
if (shouldIgnoreFieldDeleteKey(e.target))
|
|
1030
|
+
return;
|
|
1031
|
+
// Use the nested-aware caret range so the section body does not also
|
|
1032
|
+
// insert a <br> when Enter is pressed inside a column cell.
|
|
1033
|
+
const range = getCollapsedCaretRange(container);
|
|
1034
|
+
if (!range)
|
|
1035
|
+
return;
|
|
1036
|
+
if (range.startContainer?.parentElement?.closest?.('.field-token'))
|
|
1037
|
+
return;
|
|
1038
|
+
e.preventDefault();
|
|
1039
|
+
e.stopPropagation();
|
|
1040
|
+
insertLineBreakAtCaret(container);
|
|
1041
|
+
normalizeEditableLineStructure(container);
|
|
1042
|
+
onStructureChange?.();
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
if (!designMode) {
|
|
1046
|
+
const protectFields = resolveProtectFieldsInFillMode(options);
|
|
1047
|
+
if ((e.ctrlKey || e.metaKey) && !e.altKey && e.key === 'x') {
|
|
1048
|
+
if (!shouldIgnoreFieldDeleteKey(e.target) &&
|
|
1049
|
+
selectionIncludesProtectedFieldTokens(container, protectFields)) {
|
|
1050
|
+
e.preventDefault();
|
|
1051
|
+
e.stopPropagation();
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
if ((e.key === 'Delete' || e.key === 'Backspace') &&
|
|
1056
|
+
!e.ctrlKey &&
|
|
1057
|
+
!e.metaKey &&
|
|
1058
|
+
!e.altKey &&
|
|
1059
|
+
!shouldIgnoreFieldDeleteKey(e.target) &&
|
|
1060
|
+
selectionIncludesProtectedFieldTokens(container, protectFields)) {
|
|
1061
|
+
const sel = window.getSelection();
|
|
1062
|
+
if (sel && !sel.isCollapsed) {
|
|
1063
|
+
e.preventDefault();
|
|
1064
|
+
e.stopPropagation();
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
if (e.key === 'Backspace' && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
1069
|
+
if (!shouldIgnoreFieldDeleteKey(e.target) && !protectFields) {
|
|
1070
|
+
const range = getCollapsedCaretRange(container);
|
|
1071
|
+
if (range &&
|
|
1072
|
+
tryDeleteTrailingFieldOnBackwardDelete(range, container, { onDeleteField, onStructureChange })) {
|
|
1073
|
+
e.preventDefault();
|
|
1074
|
+
e.stopPropagation();
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
if (e.key !== 'Delete' && e.key !== 'Backspace')
|
|
1082
|
+
return;
|
|
1083
|
+
if (e.ctrlKey || e.metaKey || e.altKey)
|
|
1084
|
+
return;
|
|
1085
|
+
if (shouldIgnoreFieldDeleteKey(e.target))
|
|
1086
|
+
return;
|
|
1087
|
+
const selected = getSelectedFieldTokens(container);
|
|
1088
|
+
if (!selected.length)
|
|
1089
|
+
return;
|
|
1090
|
+
e.preventDefault();
|
|
1091
|
+
deleteSelectedTokens(container, onDeleteField, onStructureChange);
|
|
1092
|
+
}
|
|
1093
|
+
function handleCut(e) {
|
|
1094
|
+
if (designMode)
|
|
1095
|
+
return;
|
|
1096
|
+
if (shouldIgnoreFieldDeleteKey(e.target))
|
|
1097
|
+
return;
|
|
1098
|
+
if (!selectionIncludesProtectedFieldTokens(container, resolveProtectFieldsInFillMode(options))) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
e.preventDefault();
|
|
1102
|
+
}
|
|
1103
|
+
container.addEventListener('beforeinput', handleBeforeInput);
|
|
1104
|
+
container.addEventListener('input', handleInput);
|
|
1105
|
+
container.addEventListener('cut', handleCut);
|
|
1106
|
+
container.addEventListener('click', handleSelectionChange);
|
|
1107
|
+
container.addEventListener('keydown', handleKeyDown, true);
|
|
1108
|
+
document.addEventListener('selectionchange', handleSelectionChange);
|
|
1109
|
+
return () => {
|
|
1110
|
+
container.removeEventListener('beforeinput', handleBeforeInput);
|
|
1111
|
+
container.removeEventListener('input', handleInput);
|
|
1112
|
+
container.removeEventListener('cut', handleCut);
|
|
1113
|
+
container.removeEventListener('click', handleSelectionChange);
|
|
1114
|
+
container.removeEventListener('keydown', handleKeyDown, true);
|
|
1115
|
+
document.removeEventListener('selectionchange', handleSelectionChange);
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
//# sourceMappingURL=field-keyboard.js.map
|