@limetech/lime-crm-building-blocks 2.0.4 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/condition-tree-translate-B_qIQz9s.js +27 -0
- package/dist/cjs/index.cjs.js +6 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-alert-dialog.cjs.entry.js +1 -1
- package/dist/cjs/limebb-browser.cjs.entry.js +2 -2
- package/dist/cjs/limebb-chat-icon-list_3.cjs.entry.js +4 -4
- package/dist/cjs/limebb-chat-list.cjs.entry.js +1 -1
- package/dist/cjs/limebb-color-palette-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-color-palette-swatches.cjs.entry.js +1 -1
- package/dist/cjs/limebb-composer-toolbar.cjs.entry.js +2 -2
- package/dist/cjs/limebb-condition-tree-editor.cjs.entry.js +90 -0
- package/dist/cjs/limebb-condition-tree.cjs.entry.js +882 -0
- package/dist/cjs/limebb-currency-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-dashboard-widget.cjs.entry.js +1 -1
- package/dist/cjs/limebb-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-date-range.cjs.entry.js +1 -1
- package/dist/cjs/limebb-document-chips.cjs.entry.js +1 -1
- package/dist/cjs/limebb-document-item.cjs.entry.js +2 -2
- package/dist/cjs/limebb-document-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed-item-thumbnail-file-info.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed.cjs.entry.js +1 -1
- package/dist/cjs/limebb-filter-chip_6.cjs.entry.js +7 -7
- package/dist/cjs/limebb-icon-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-info-tile-format.cjs.entry.js +1 -1
- package/dist/cjs/limebb-info-tile.cjs.entry.js +1 -1
- package/dist/cjs/limebb-kanban-group.cjs.entry.js +1 -1
- package/dist/cjs/limebb-kanban-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +2 -2
- package/dist/cjs/limebb-lime-query-order-by-editor_2.cjs.entry.js +2 -2
- package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +2 -2
- package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +1 -1
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
- package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +2 -2
- package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
- package/dist/cjs/limebb-rule-chip-popover.cjs.entry.js +2 -2
- package/dist/cjs/limebb-rule-editor.cjs.entry.js +162 -22
- package/dist/cjs/limebb-rule-gate.cjs.entry.js +1 -1
- package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/limebb-value-comparison-editor.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/rule-editor-modes-Dc6rnwD2.js +76 -0
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/alert-dialog/alert-dialog.js +1 -1
- package/dist/collection/components/browser/browser.js +2 -2
- package/dist/collection/components/chat-list/chat-icon-list/chat-icon-list.js +1 -1
- package/dist/collection/components/chat-list/chat-item/chat-item.js +2 -2
- package/dist/collection/components/chat-list/chat-list.js +1 -1
- package/dist/collection/components/chat-list/typing-indicator/typing-indicator.js +1 -1
- package/dist/collection/components/color-palette-picker/color-palette-picker.js +1 -1
- package/dist/collection/components/color-palette-picker/color-palette-swatches/color-palette-swatches.js +1 -1
- package/dist/collection/components/composer-toolbar/composer-toolbar.js +2 -2
- package/dist/collection/components/condition-tree/condition-tree-combinators.js +78 -0
- package/dist/collection/components/condition-tree/condition-tree-editor/condition-tree-editor.css +17 -0
- package/dist/collection/components/condition-tree/condition-tree-editor/condition-tree-editor.js +333 -0
- package/dist/collection/components/condition-tree/condition-tree-nodes.js +218 -0
- package/dist/collection/components/condition-tree/condition-tree-open-state.js +127 -0
- package/dist/collection/components/condition-tree/condition-tree-translate.js +22 -0
- package/dist/collection/components/condition-tree/condition-tree-view-context.js +22 -0
- package/dist/collection/components/condition-tree/condition-tree.css +132 -0
- package/dist/collection/components/condition-tree/condition-tree.js +461 -0
- package/dist/collection/components/condition-tree/condition-tree.types.js +1 -0
- package/dist/collection/components/condition-tree/group-node-view.js +153 -0
- package/dist/collection/components/condition-tree/leaf-node-view.js +74 -0
- package/dist/collection/components/currency-picker/currency-picker.js +1 -1
- package/dist/collection/components/dashboard-widget/dashboard-widget.js +1 -1
- package/dist/collection/components/date-picker/date-picker.js +1 -1
- package/dist/collection/components/date-range/date-range.js +1 -1
- package/dist/collection/components/document-chips/document-chips.js +1 -1
- package/dist/collection/components/document-picker/document-item/document-item.js +2 -2
- package/dist/collection/components/document-picker/document-picker.js +1 -1
- package/dist/collection/components/feed/feed-item/feed-timeline-item.js +1 -1
- package/dist/collection/components/feed/feed-item-thumbnail-file-info/feed-item-thumbnail-file-info.js +1 -1
- package/dist/collection/components/feed/feed.js +1 -1
- package/dist/collection/components/filter-chip/filter-chip.js +2 -2
- package/dist/collection/components/filter-condition-picker/filter-condition-picker.js +1 -1
- package/dist/collection/components/icon-picker/icon-picker.js +1 -1
- package/dist/collection/components/info-tile/format/config/info-tile-format.js +1 -1
- package/dist/collection/components/info-tile/info-tile.js +1 -1
- package/dist/collection/components/kanban/kanban-group/kanban-group.js +1 -1
- package/dist/collection/components/kanban/kanban-item/kanban-item.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison-editor.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +2 -2
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +2 -2
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +1 -1
- package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +1 -1
- package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
- package/dist/collection/components/lime-query-builder/order-by/order-by-editor.js +1 -1
- package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +2 -2
- package/dist/collection/components/lime-query-builder/response-format/response-format-item.js +1 -1
- package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
- package/dist/collection/components/locale-picker/locale-picker.js +1 -1
- package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
- package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
- package/dist/collection/components/rule-editor/group-node-view.js +3 -3
- package/dist/collection/components/rule-editor/rule-chip-popover/rule-chip-popover.js +2 -2
- package/dist/collection/components/rule-editor/rule-editor-mode-view.js +32 -0
- package/dist/collection/components/rule-editor/rule-editor-modes.js +68 -0
- package/dist/collection/components/rule-editor/rule-editor.css +153 -12
- package/dist/collection/components/rule-editor/rule-editor.js +201 -19
- package/dist/collection/components/rule-editor/rule-editor.types.js +1 -0
- package/dist/collection/components/rule-editor/value-comparison-editor/value-comparison-editor.js +1 -1
- package/dist/collection/components/rule-gate/rule-gate.js +1 -1
- package/dist/collection/components/summary-popover/summary-popover.js +2 -2
- package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
- package/dist/collection/index.js +2 -0
- package/dist/components/chat-icon-list.js +1 -1
- package/dist/components/chat-item.js +1 -1
- package/dist/components/condition-tree-editor.js +1 -0
- package/dist/components/currency-picker.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/document-item.js +1 -1
- package/dist/components/feed-item-thumbnail-file-info.js +1 -1
- package/dist/components/feed-timeline-item.js +1 -1
- package/dist/components/filter-chip.js +1 -1
- package/dist/components/filter-condition-picker.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/kanban-group.js +1 -1
- package/dist/components/kanban-item.js +1 -1
- package/dist/components/lime-query-filter-comparison-editor.js +1 -1
- package/dist/components/lime-query-filter-comparison.js +1 -1
- package/dist/components/lime-query-filter-expression.js +1 -1
- package/dist/components/limebb-alert-dialog.js +1 -1
- package/dist/components/limebb-browser.js +1 -1
- package/dist/components/limebb-chat-list.js +1 -1
- package/dist/components/limebb-color-palette-picker.js +1 -1
- package/dist/components/limebb-color-palette-swatches.js +1 -1
- package/dist/components/limebb-composer-toolbar.js +1 -1
- package/dist/components/limebb-condition-tree-editor.d.ts +11 -0
- package/dist/components/limebb-condition-tree-editor.js +1 -0
- package/dist/components/limebb-condition-tree.d.ts +11 -0
- package/dist/components/limebb-condition-tree.js +1 -0
- package/dist/components/limebb-dashboard-widget.js +1 -1
- package/dist/components/limebb-date-range.js +1 -1
- package/dist/components/limebb-document-chips.js +1 -1
- package/dist/components/limebb-document-picker.js +1 -1
- package/dist/components/limebb-feed.js +1 -1
- package/dist/components/limebb-icon-picker.js +1 -1
- package/dist/components/limebb-info-tile-format.js +1 -1
- package/dist/components/limebb-info-tile.js +1 -1
- package/dist/components/limebb-lime-query-builder.js +1 -1
- package/dist/components/limebb-lime-query-response-format-builder.js +1 -1
- package/dist/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention-group-counter.js +1 -1
- package/dist/components/limebb-rule-editor.js +1 -1
- package/dist/components/limebb-rule-gate.js +1 -1
- package/dist/components/limebb-text-editor.js +1 -1
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limebb-value-comparison-editor.js +1 -1
- package/dist/components/limetype-field.js +1 -1
- package/dist/components/live-docs-info.js +1 -1
- package/dist/components/notification-item.js +1 -1
- package/dist/components/order-by-editor.js +1 -1
- package/dist/components/order-by-item.js +1 -1
- package/dist/components/percentage-visualizer.js +1 -1
- package/dist/components/response-format-item.js +1 -1
- package/dist/components/rule-chip-popover.js +1 -1
- package/dist/components/rule-editor-modes.js +1 -0
- package/dist/components/summary-popover.js +1 -1
- package/dist/components/typing-indicator.js +1 -1
- package/dist/esm/condition-tree-translate-CBeXbZ_z.js +25 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-alert-dialog.entry.js +1 -1
- package/dist/esm/limebb-browser.entry.js +2 -2
- package/dist/esm/limebb-chat-icon-list_3.entry.js +4 -4
- package/dist/esm/limebb-chat-list.entry.js +1 -1
- package/dist/esm/limebb-color-palette-picker.entry.js +1 -1
- package/dist/esm/limebb-color-palette-swatches.entry.js +1 -1
- package/dist/esm/limebb-composer-toolbar.entry.js +2 -2
- package/dist/esm/limebb-condition-tree-editor.entry.js +88 -0
- package/dist/esm/limebb-condition-tree.entry.js +880 -0
- package/dist/esm/limebb-currency-picker.entry.js +1 -1
- package/dist/esm/limebb-dashboard-widget.entry.js +1 -1
- package/dist/esm/limebb-date-picker.entry.js +1 -1
- package/dist/esm/limebb-date-range.entry.js +1 -1
- package/dist/esm/limebb-document-chips.entry.js +1 -1
- package/dist/esm/limebb-document-item.entry.js +2 -2
- package/dist/esm/limebb-document-picker.entry.js +1 -1
- package/dist/esm/limebb-feed-item-thumbnail-file-info.entry.js +1 -1
- package/dist/esm/limebb-feed-timeline-item.entry.js +1 -1
- package/dist/esm/limebb-feed.entry.js +1 -1
- package/dist/esm/limebb-filter-chip_6.entry.js +7 -7
- package/dist/esm/limebb-icon-picker.entry.js +1 -1
- package/dist/esm/limebb-info-tile-format.entry.js +1 -1
- package/dist/esm/limebb-info-tile.entry.js +1 -1
- package/dist/esm/limebb-kanban-group.entry.js +1 -1
- package/dist/esm/limebb-kanban-item.entry.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +1 -1
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +2 -2
- package/dist/esm/limebb-lime-query-order-by-editor_2.entry.js +2 -2
- package/dist/esm/limebb-lime-query-order-by-item.entry.js +2 -2
- package/dist/esm/limebb-lime-query-response-format-builder.entry.js +1 -1
- package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +1 -1
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-locale-picker.entry.js +1 -1
- package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
- package/dist/esm/limebb-navigation-button_2.entry.js +2 -2
- package/dist/esm/limebb-notification-item.entry.js +1 -1
- package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
- package/dist/esm/limebb-rule-chip-popover.entry.js +2 -2
- package/dist/esm/limebb-rule-editor.entry.js +163 -23
- package/dist/esm/limebb-rule-gate.entry.js +1 -1
- package/dist/esm/limebb-text-editor.entry.js +1 -1
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/limebb-value-comparison-editor.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/rule-editor-modes-BCglve2Z.js +70 -0
- package/dist/lime-crm-building-blocks/index.esm.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-2f8540ab.entry.js → p-02fba38e.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-76151fce.entry.js → p-0445035f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-4f0a4893.entry.js → p-0a05b3e9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-0dd64440.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-1578c8f0.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-76064593.entry.js → p-170ab4be.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-542047c4.entry.js → p-27b9c824.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-2628fe8e.entry.js → p-2d1c7b6f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c2c181f1.entry.js → p-3fd84800.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c7daffb6.entry.js → p-45dd8663.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-cede8095.entry.js → p-4e4d096c.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-51eb53ee.entry.js → p-54735042.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c2899d68.entry.js → p-568c4e76.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-9907deb1.entry.js → p-584a48e4.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-ac4bddfc.entry.js → p-5b97d4f4.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-615770be.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-edfaf566.entry.js → p-6d8efe87.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-705c53c0.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-031b1648.entry.js → p-73f23d08.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-2baab674.entry.js → p-7c5ecffe.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-1fac8130.entry.js → p-7cd8dffd.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-93af3e81.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-247fcace.entry.js → p-97e2e5c9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-BCglve2Z.js +1 -0
- package/dist/lime-crm-building-blocks/p-BxCq236x.js +1 -0
- package/dist/lime-crm-building-blocks/p-a2b9c410.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-f9f7020f.entry.js → p-a716b3a8.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-b3529254.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-2bfd351d.entry.js → p-b48d7d23.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-b373c60f.entry.js → p-b6807166.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-318369ae.entry.js → p-b6c2d93b.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-d82a2424.entry.js → p-c46802cd.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-9099b440.entry.js → p-c635f826.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-fec173db.entry.js → p-d816fcc8.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-4594c2b1.entry.js → p-d8ce3497.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-0f74d662.entry.js → p-d8d32cb1.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-99556fc0.entry.js → p-de7724f0.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-92403251.entry.js → p-e910963c.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-4274cbe3.entry.js → p-ea6ab8b0.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-eedbf69a.entry.js → p-ee7bd504.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-e1f35866.entry.js → p-f024c185.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-7bb2788b.entry.js → p-f102f169.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-2984005d.entry.js → p-f1060c88.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-17588c29.entry.js → p-f3905fa2.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-ac97c7cc.entry.js → p-fc372344.entry.js} +1 -1
- package/dist/types/components/condition-tree/condition-tree-combinators.d.ts +47 -0
- package/dist/types/components/condition-tree/condition-tree-editor/condition-tree-editor.d.ts +84 -0
- package/dist/types/components/condition-tree/condition-tree-nodes.d.ts +130 -0
- package/dist/types/components/condition-tree/condition-tree-open-state.d.ts +76 -0
- package/dist/types/components/condition-tree/condition-tree-translate.d.ts +11 -0
- package/dist/types/components/condition-tree/condition-tree-view-context.d.ts +48 -0
- package/dist/types/components/condition-tree/condition-tree.d.ts +177 -0
- package/dist/types/components/condition-tree/condition-tree.types.d.ts +323 -0
- package/dist/types/components/condition-tree/group-node-view.d.ts +30 -0
- package/dist/types/components/condition-tree/leaf-node-view.d.ts +21 -0
- package/dist/types/components/rule-editor/rule-editor-mode-view.d.ts +22 -0
- package/dist/types/components/rule-editor/rule-editor-modes.d.ts +43 -0
- package/dist/types/components/rule-editor/rule-editor.d.ts +129 -5
- package/dist/types/components/rule-editor/rule-editor.types.d.ts +16 -0
- package/dist/types/components.d.ts +412 -4
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interface.d.ts +2 -0
- package/package.json +3 -3
- package/dist/lime-crm-building-blocks/p-1e83a491.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-73f79d42.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-761deada.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-b8d74591.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-e8a7a94c.entry.js +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A stable string form of a path, for `key` attributes and for comparing two
|
|
3
|
+
* paths without an element-by-element loop at every call site.
|
|
4
|
+
* @param path
|
|
5
|
+
*/
|
|
6
|
+
export function pathKey(path) {
|
|
7
|
+
return path.length === 0 ? 'root' : path.join('.');
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reads and rebuilds a consumer's tree through its adapter.
|
|
11
|
+
*
|
|
12
|
+
* Walking down goes through `describe`, so the tree never has to know how a
|
|
13
|
+
* consumer nests its nodes. Rebuilding goes up through `group`, and only groups
|
|
14
|
+
* are rebuilt: a condition is moved as the object it already is.
|
|
15
|
+
*/
|
|
16
|
+
export class ConditionTreeWalker {
|
|
17
|
+
/**
|
|
18
|
+
* @param adapter
|
|
19
|
+
* @param isVisited - Whether the user has opened and closed a node's
|
|
20
|
+
* editor. Read through a function rather than taken as a set, so that the
|
|
21
|
+
* walker outlives the tree's tally growing.
|
|
22
|
+
*/
|
|
23
|
+
constructor(adapter, isVisited = () => false) {
|
|
24
|
+
this.adapter = adapter;
|
|
25
|
+
this.isVisited = isVisited;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* What the tree should draw for `node`.
|
|
29
|
+
* @param node
|
|
30
|
+
*/
|
|
31
|
+
describe(node) {
|
|
32
|
+
return this.adapter.describe(node, {
|
|
33
|
+
visited: this.isVisited(node),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* How `node` reads as a group, or `undefined` when it is a single
|
|
38
|
+
* condition rather than a group of them.
|
|
39
|
+
* @param node
|
|
40
|
+
*/
|
|
41
|
+
groupOf(node) {
|
|
42
|
+
const description = this.describe(node);
|
|
43
|
+
return description.kind === 'group' ? description : undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The children of a group, or `undefined` for a single condition.
|
|
47
|
+
* @param node
|
|
48
|
+
*/
|
|
49
|
+
childrenOf(node) {
|
|
50
|
+
var _a;
|
|
51
|
+
return (_a = this.groupOf(node)) === null || _a === void 0 ? void 0 : _a.children;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The node at `path`, or `undefined` when the path leads nowhere — which
|
|
55
|
+
* happens routinely when the consumer replaces the tree while an editor is
|
|
56
|
+
* open.
|
|
57
|
+
* @param root
|
|
58
|
+
* @param path
|
|
59
|
+
*/
|
|
60
|
+
nodeAt(root, path) {
|
|
61
|
+
let node = root;
|
|
62
|
+
for (const index of path) {
|
|
63
|
+
if (node === undefined) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const children = this.childrenOf(node);
|
|
67
|
+
if (!children) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
node = children[index];
|
|
71
|
+
}
|
|
72
|
+
return node;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The group at `path`, or `undefined` when the path leads nowhere or to a
|
|
76
|
+
* condition. Every caller that wants to look inside a group first has to
|
|
77
|
+
* find it and then find out whether it is one, so both steps live here.
|
|
78
|
+
* @param root
|
|
79
|
+
* @param path
|
|
80
|
+
*/
|
|
81
|
+
groupAt(root, path) {
|
|
82
|
+
const node = this.nodeAt(root, path);
|
|
83
|
+
return node === undefined ? undefined : this.groupOf(node);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Whether `node` is still somewhere in the tree, by identity.
|
|
87
|
+
*
|
|
88
|
+
* Identity rather than equality: a condition the tree did not touch is the
|
|
89
|
+
* very object the consumer handed over, so one that merely looks the same
|
|
90
|
+
* is a different condition.
|
|
91
|
+
* @param root
|
|
92
|
+
* @param node
|
|
93
|
+
*/
|
|
94
|
+
contains(root, node) {
|
|
95
|
+
if (root === undefined) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
if (root === node) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
const children = this.childrenOf(root);
|
|
102
|
+
return !!(children === null || children === void 0 ? void 0 : children.some((child) => this.contains(child, node)));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Every condition asking to be opened, in display order.
|
|
106
|
+
*
|
|
107
|
+
* All of them rather than the first, because a consumer that leaves the
|
|
108
|
+
* flag on a condition it has already added would otherwise keep pointing at
|
|
109
|
+
* that one, and the next condition added would never get its turn.
|
|
110
|
+
* @param root
|
|
111
|
+
*/
|
|
112
|
+
autoOpenNodes(root) {
|
|
113
|
+
if (root === undefined) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
const description = this.describe(root);
|
|
117
|
+
if (description.kind === 'leaf') {
|
|
118
|
+
return description.autoOpen ? [root] : [];
|
|
119
|
+
}
|
|
120
|
+
return description.children.flatMap((child) => this.autoOpenNodes(child));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The tree with the node at `path` replaced by `next`, or removed when
|
|
124
|
+
* `next` is `undefined`.
|
|
125
|
+
* @param root
|
|
126
|
+
* @param path
|
|
127
|
+
* @param next
|
|
128
|
+
*/
|
|
129
|
+
replaceAt(root, path, next) {
|
|
130
|
+
if (path.length === 0) {
|
|
131
|
+
return next;
|
|
132
|
+
}
|
|
133
|
+
const group = this.groupOf(root);
|
|
134
|
+
if (!group) {
|
|
135
|
+
return root;
|
|
136
|
+
}
|
|
137
|
+
const [index, ...rest] = path;
|
|
138
|
+
const children = group.children;
|
|
139
|
+
if (!(index in children)) {
|
|
140
|
+
return root;
|
|
141
|
+
}
|
|
142
|
+
const child = this.replaceAt(children[index], rest, next);
|
|
143
|
+
return this.rebuild(group.combinator, spliced(children, index, child));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The tree with `child` added to the end of the group at `path`. A path
|
|
147
|
+
* leading to a condition rather than a group leaves the tree alone: there
|
|
148
|
+
* is nothing there to add to.
|
|
149
|
+
* @param root
|
|
150
|
+
* @param path
|
|
151
|
+
* @param child
|
|
152
|
+
*/
|
|
153
|
+
appendAt(root, path, child) {
|
|
154
|
+
const group = this.groupAt(root, path);
|
|
155
|
+
if (!group) {
|
|
156
|
+
return root;
|
|
157
|
+
}
|
|
158
|
+
return this.replaceAt(root, path, this.adapter.group(group.combinator, [...group.children, child]));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The tree with the group at `path` joined by `combinator` instead, and
|
|
162
|
+
* what is inside it left alone. A path leading anywhere but a group leaves
|
|
163
|
+
* the tree as it was.
|
|
164
|
+
* @param root
|
|
165
|
+
* @param path
|
|
166
|
+
* @param combinator
|
|
167
|
+
*/
|
|
168
|
+
rejoinAt(root, path, combinator) {
|
|
169
|
+
const group = this.groupAt(root, path);
|
|
170
|
+
if (!group) {
|
|
171
|
+
return root;
|
|
172
|
+
}
|
|
173
|
+
return this.replaceAt(root, path, this.adapter.group(combinator, group.children));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The tree with the condition at `path` negated, or not.
|
|
177
|
+
*
|
|
178
|
+
* An adapter with no way to rebuild a negated condition leaves the tree
|
|
179
|
+
* alone: it has already told the tree not to offer the control.
|
|
180
|
+
* @param root
|
|
181
|
+
* @param path
|
|
182
|
+
* @param negated
|
|
183
|
+
*/
|
|
184
|
+
negateAt(root, path, negated) {
|
|
185
|
+
const target = this.nodeAt(root, path);
|
|
186
|
+
if (target === undefined || !this.adapter.negate) {
|
|
187
|
+
return root;
|
|
188
|
+
}
|
|
189
|
+
return this.replaceAt(root, path, this.adapter.negate(target, negated));
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* A group holding `children`, or nothing at all when there are none left: a
|
|
193
|
+
* group with nothing in it says nothing, so it goes the way of its last
|
|
194
|
+
* condition — and so, in turn, does the group that held it.
|
|
195
|
+
* @param combinator
|
|
196
|
+
* @param children
|
|
197
|
+
*/
|
|
198
|
+
rebuild(combinator, children) {
|
|
199
|
+
if (children.length === 0) {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
return this.adapter.group(combinator, children);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The same list with the entry at `index` swapped for `replacement`, or dropped
|
|
207
|
+
* when there is no replacement.
|
|
208
|
+
* @param children
|
|
209
|
+
* @param index
|
|
210
|
+
* @param replacement
|
|
211
|
+
*/
|
|
212
|
+
function spliced(children, index, replacement) {
|
|
213
|
+
return [
|
|
214
|
+
...children.slice(0, index),
|
|
215
|
+
...(replacement === undefined ? [] : [replacement]),
|
|
216
|
+
...children.slice(index + 1),
|
|
217
|
+
];
|
|
218
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which condition's editor is open, and what the tree remembers about the user
|
|
3
|
+
* having been there.
|
|
4
|
+
*
|
|
5
|
+
* All of it is held by condition rather than by place in the tree, so that it
|
|
6
|
+
* survives the tree being rearranged around it.
|
|
7
|
+
*
|
|
8
|
+
* Every method returns a new state rather than changing this one, because
|
|
9
|
+
* `limebb-condition-tree` keeps it in `@State` and Stencil redraws on a new
|
|
10
|
+
* reference, not on a changed field.
|
|
11
|
+
*/
|
|
12
|
+
export class ConditionTreeOpenState {
|
|
13
|
+
constructor(fields) {
|
|
14
|
+
this.fields = fields;
|
|
15
|
+
}
|
|
16
|
+
static empty() {
|
|
17
|
+
return new ConditionTreeOpenState({
|
|
18
|
+
open: null,
|
|
19
|
+
pending: null,
|
|
20
|
+
seen: new Set(),
|
|
21
|
+
autoOpened: new Set(),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
get openNode() {
|
|
25
|
+
return this.fields.open;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether the user has opened this condition's editor and closed it again.
|
|
29
|
+
* @param node
|
|
30
|
+
*/
|
|
31
|
+
hasSeen(node) {
|
|
32
|
+
return this.fields.seen.has(node);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The open editor moved onto `next`, or onto nothing at all, remembering
|
|
36
|
+
* the condition left behind — the moment the user is done with it for now,
|
|
37
|
+
* and the earliest anything can fairly judge it. Losing a condition because
|
|
38
|
+
* it went away is not the user leaving it: see `dropIfGone`.
|
|
39
|
+
* @param next
|
|
40
|
+
*/
|
|
41
|
+
moveTo(next) {
|
|
42
|
+
const previous = this.fields.open;
|
|
43
|
+
const moved = this.with({
|
|
44
|
+
open: next,
|
|
45
|
+
// Whatever the consumer was about to send back is no longer the
|
|
46
|
+
// condition being edited, so it must not be chased later.
|
|
47
|
+
pending: null,
|
|
48
|
+
});
|
|
49
|
+
if (previous === null || previous === next) {
|
|
50
|
+
return moved;
|
|
51
|
+
}
|
|
52
|
+
return moved.with({ seen: new Set(this.fields.seen).add(previous) });
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The same state, now waiting for `next` — the condition an editor just
|
|
56
|
+
* reported — to turn up in a tree from the consumer.
|
|
57
|
+
* @param next
|
|
58
|
+
*/
|
|
59
|
+
expect(next) {
|
|
60
|
+
return this.with({ pending: next });
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The state brought up to date with a tree the consumer has just handed
|
|
64
|
+
* over: follow the condition that replaced the one being edited, open
|
|
65
|
+
* whatever is asking to be opened, and let go of a condition that is no
|
|
66
|
+
* longer there.
|
|
67
|
+
* @param root
|
|
68
|
+
* @param walker
|
|
69
|
+
*/
|
|
70
|
+
sync(root, walker) {
|
|
71
|
+
return this.followPending(root, walker)
|
|
72
|
+
.openWhatAsks(root, walker)
|
|
73
|
+
.dropIfGone(root, walker);
|
|
74
|
+
}
|
|
75
|
+
with(changes) {
|
|
76
|
+
return new ConditionTreeOpenState(Object.assign(Object.assign({}, this.fields), changes));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Move the editor onto the replacement, once the consumer has sent a tree
|
|
80
|
+
* holding it. One that reports the edit elsewhere, or normalizes the
|
|
81
|
+
* condition on the way through, never sends it back at all — the editor
|
|
82
|
+
* then stays where it is, and `dropIfGone` settles it if that has gone too.
|
|
83
|
+
* @param root
|
|
84
|
+
* @param walker
|
|
85
|
+
*/
|
|
86
|
+
followPending(root, walker) {
|
|
87
|
+
if (this.fields.pending === null) {
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
if (!walker.contains(root, this.fields.pending)) {
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
return this.with({ open: this.fields.pending, pending: null });
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Open the condition that is asking for it and has not had its turn yet.
|
|
97
|
+
*
|
|
98
|
+
* A consumer is free to leave the flag on conditions it added earlier, so
|
|
99
|
+
* what settles this is not the flag alone but whether that condition has
|
|
100
|
+
* already been opened once. Conditions that stop asking are forgotten
|
|
101
|
+
* again, so one that is removed and put back opens anew.
|
|
102
|
+
* @param root
|
|
103
|
+
* @param walker
|
|
104
|
+
*/
|
|
105
|
+
openWhatAsks(root, walker) {
|
|
106
|
+
const nodes = walker.autoOpenNodes(root);
|
|
107
|
+
const fresh = nodes.find((node) => !this.fields.autoOpened.has(node));
|
|
108
|
+
const remembered = this.with({ autoOpened: new Set(nodes) });
|
|
109
|
+
return fresh === undefined ? remembered : remembered.moveTo(fresh);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Let go of the open condition when it is no longer there — the user
|
|
113
|
+
* removed it, or the consumer replaced the tree under it. That is not the
|
|
114
|
+
* user finishing with it, so it does not count as having been seen.
|
|
115
|
+
* @param root
|
|
116
|
+
* @param walker
|
|
117
|
+
*/
|
|
118
|
+
dropIfGone(root, walker) {
|
|
119
|
+
if (this.fields.open === null) {
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
if (walker.contains(root, this.fields.open)) {
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
return this.with({ open: null });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PlatformServiceName, } from "@limetech/lime-web-components";
|
|
2
|
+
/**
|
|
3
|
+
* A translate function that falls back to the given English wording when the
|
|
4
|
+
* platform is absent or has no translation for the key.
|
|
5
|
+
*
|
|
6
|
+
* The tree is presentational and is rendered in docs and tests without a fully
|
|
7
|
+
* loaded platform, so it must read sensibly either way.
|
|
8
|
+
* @param platform
|
|
9
|
+
*/
|
|
10
|
+
export function createTranslator(platform) {
|
|
11
|
+
return (key, fallback) => {
|
|
12
|
+
var _a;
|
|
13
|
+
let translated;
|
|
14
|
+
try {
|
|
15
|
+
translated = (_a = platform === null || platform === void 0 ? void 0 : platform.get(PlatformServiceName.Translate)) === null || _a === void 0 ? void 0 : _a.get(key);
|
|
16
|
+
}
|
|
17
|
+
catch (_b) {
|
|
18
|
+
return fallback;
|
|
19
|
+
}
|
|
20
|
+
return translated && translated !== key ? translated : fallback;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* Problems reported on a node, listed beneath it.
|
|
4
|
+
* @param props
|
|
5
|
+
*/
|
|
6
|
+
export const IssuesView = (props) => {
|
|
7
|
+
var _a;
|
|
8
|
+
if (!((_a = props.issues) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return props.issues.map((issue) => h("div", { class: "issue" }, issue));
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Throwing a node away. Shared because both kinds offer it: a group through
|
|
15
|
+
* the button in its header, a condition through the cross on its chip.
|
|
16
|
+
* @param path
|
|
17
|
+
* @param ctx
|
|
18
|
+
*/
|
|
19
|
+
export const handleDelete = (path, ctx) => (event) => {
|
|
20
|
+
event.stopPropagation();
|
|
21
|
+
ctx.onDelete(path);
|
|
22
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*:before,
|
|
3
|
+
*::after {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: 1.5rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.group {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: 1rem;
|
|
18
|
+
padding: 0.5rem;
|
|
19
|
+
border-radius: 0.75rem;
|
|
20
|
+
background-color: rgb(var(--contrast-800), 0.15);
|
|
21
|
+
transition: box-shadow 120ms ease;
|
|
22
|
+
}
|
|
23
|
+
.group:before {
|
|
24
|
+
content: "";
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 1rem;
|
|
27
|
+
bottom: calc(1rem + 1.75rem);
|
|
28
|
+
left: 0;
|
|
29
|
+
width: 0.125rem;
|
|
30
|
+
transform: translateX(-50%);
|
|
31
|
+
border-radius: 1rem;
|
|
32
|
+
background-color: var(--group-rail-color);
|
|
33
|
+
}
|
|
34
|
+
.group:has(> .group-header > limel-icon-button.delete-group:not([disabled]):hover), .group:has(> .group-header > limel-icon-button.delete-group:not([disabled]):focus-within) {
|
|
35
|
+
box-shadow: var(--shadow-error-state);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.group-header {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 0.5rem;
|
|
42
|
+
min-height: 2.5rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
limel-select.combinator {
|
|
46
|
+
min-width: 12rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
limel-icon-button.delete-group {
|
|
50
|
+
margin-left: auto;
|
|
51
|
+
opacity: 0;
|
|
52
|
+
transition: opacity 120ms ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.group:hover > .group-header > limel-icon-button.delete-group,
|
|
56
|
+
.group:focus-within > .group-header > limel-icon-button.delete-group {
|
|
57
|
+
opacity: 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
limel-chip.add-group {
|
|
61
|
+
--lime-elevated-surface-background-color: transparent;
|
|
62
|
+
--button-shadow-normal: none;
|
|
63
|
+
isolation: isolate;
|
|
64
|
+
position: relative;
|
|
65
|
+
margin-right: auto;
|
|
66
|
+
}
|
|
67
|
+
limel-chip.add-group:after {
|
|
68
|
+
content: "";
|
|
69
|
+
position: absolute;
|
|
70
|
+
width: 0.5rem;
|
|
71
|
+
height: 1.75rem;
|
|
72
|
+
top: 0;
|
|
73
|
+
left: calc(0.5rem * -1 - 0.125rem / 2);
|
|
74
|
+
border-width: 0 0 0.125rem 0.125rem;
|
|
75
|
+
border-color: var(--group-rail-color);
|
|
76
|
+
border-style: solid;
|
|
77
|
+
border-radius: 0 0 0 0.5rem;
|
|
78
|
+
transform: translateY(calc(-50% - 0.125rem / 2));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
ul.rows {
|
|
82
|
+
list-style: none;
|
|
83
|
+
margin: 0;
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
flex-wrap: wrap;
|
|
87
|
+
align-items: center;
|
|
88
|
+
column-gap: 0.5rem;
|
|
89
|
+
row-gap: 0.5rem;
|
|
90
|
+
padding: 0 0.5rem 0.5rem 0.5rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
li.row {
|
|
94
|
+
list-style: none;
|
|
95
|
+
position: relative;
|
|
96
|
+
}
|
|
97
|
+
li.row.row--group {
|
|
98
|
+
flex-basis: 100%;
|
|
99
|
+
align-self: stretch;
|
|
100
|
+
}
|
|
101
|
+
li.row + li.row:before {
|
|
102
|
+
content: attr(data-marker);
|
|
103
|
+
color: var(--group-rail-color);
|
|
104
|
+
font-size: 0.75rem;
|
|
105
|
+
font-weight: 600;
|
|
106
|
+
line-height: normal;
|
|
107
|
+
}
|
|
108
|
+
li.row + li.row.row--group:before {
|
|
109
|
+
position: absolute;
|
|
110
|
+
left: 0;
|
|
111
|
+
top: 0;
|
|
112
|
+
transform: translate(-50%, -50%);
|
|
113
|
+
}
|
|
114
|
+
li.row + li.row:not(.row--group) {
|
|
115
|
+
display: inline-flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
flex-wrap: wrap;
|
|
118
|
+
}
|
|
119
|
+
li.row + li.row:not(.row--group):before {
|
|
120
|
+
margin-right: 0.5rem;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
limel-popover.leaf {
|
|
124
|
+
display: inline-block;
|
|
125
|
+
max-width: 25rem;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.issue {
|
|
129
|
+
color: rgb(var(--color-red-default));
|
|
130
|
+
font-size: 0.875rem;
|
|
131
|
+
flex-basis: 100%;
|
|
132
|
+
}
|