@limetech/lime-crm-building-blocks 1.133.0 → 1.134.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  3. package/dist/cjs/limebb-loader.cjs.entry.js +10 -0
  4. package/dist/cjs/limebb-rule-chip-popover.cjs.entry.js +10 -2
  5. package/dist/cjs/limebb-rule-editor.cjs.entry.js +73 -3
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/components/rule-editor/chip-picker-view.js +9 -2
  8. package/dist/collection/components/rule-editor/rule-arg-filter-editor/rule-arg-filter-editor-metadata.js +10 -0
  9. package/dist/collection/components/rule-editor/rule-chip-popover/rule-chip-popover.js +30 -2
  10. package/dist/collection/components/rule-editor/rule-editor.js +53 -2
  11. package/dist/collection/components/rule-editor/rule-operations.js +15 -2
  12. package/dist/components/limebb-loader.js +1 -1
  13. package/dist/components/limebb-rule-editor.js +1 -1
  14. package/dist/components/rule-chip-popover.js +1 -1
  15. package/dist/esm/lime-crm-building-blocks.js +1 -1
  16. package/dist/esm/limebb-loader.entry.js +10 -0
  17. package/dist/esm/limebb-rule-chip-popover.entry.js +10 -2
  18. package/dist/esm/limebb-rule-editor.entry.js +73 -3
  19. package/dist/esm/loader.js +1 -1
  20. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  21. package/dist/lime-crm-building-blocks/p-49bc396e.entry.js +1 -0
  22. package/dist/lime-crm-building-blocks/p-6cf0a1cd.entry.js +1 -0
  23. package/dist/lime-crm-building-blocks/p-6fc4e731.entry.js +1 -0
  24. package/dist/types/components/rule-editor/chip-picker-view.d.ts +8 -0
  25. package/dist/types/components/rule-editor/rule-arg-filter-editor/rule-arg-filter-editor-metadata.d.ts +4 -0
  26. package/dist/types/components/rule-editor/rule-chip-popover/rule-chip-popover.d.ts +8 -0
  27. package/dist/types/components/rule-editor/rule-editor-views.d.ts +6 -0
  28. package/dist/types/components/rule-editor/rule-editor.d.ts +14 -0
  29. package/dist/types/components/rule-editor/rule-operations.d.ts +8 -0
  30. package/dist/types/components.d.ts +11 -0
  31. package/package.json +2 -2
  32. package/dist/lime-crm-building-blocks/p-4e0d077b.entry.js +0 -1
  33. package/dist/lime-crm-building-blocks/p-55692241.entry.js +0 -1
  34. package/dist/lime-crm-building-blocks/p-95a3cf87.entry.js +0 -1
@@ -10,8 +10,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
10
10
  };
11
11
  import { h, } from "@stencil/core";
12
12
  import { PlatformServiceName, SelectContext, } from "@limetech/lime-web-components";
13
- import { deleteNode, replaceNode, updateArgs, } from "./rule-operations";
13
+ import { deleteNode, getNode, replaceNode, updateArgs, } from "./rule-operations";
14
14
  import { extractGroup, RuleNodeView, } from "./rule-editor-views";
15
+ import { buildChipPath, extractRef } from "./chip-picker-view";
15
16
  import { createPrimitiveOptions, primitiveReadsCovered } from "./view-helpers";
16
17
  /**
17
18
  * Tree editor for {@link Rule}.
@@ -52,6 +53,7 @@ export class RuleEditor {
52
53
  constructor() {
53
54
  this.issues = [];
54
55
  this.openChipPath = null;
56
+ this.focusOnOpen = false;
55
57
  this.metadataById = new Map();
56
58
  this.allPrimitiveOptions = [];
57
59
  this.availablePrimitiveOptions = [];
@@ -60,19 +62,27 @@ export class RuleEditor {
60
62
  this.hasLoaded = false;
61
63
  this.handleDelete = (path) => {
62
64
  this.openChipPath = null;
65
+ this.focusOnOpen = false;
63
66
  this.emitIfChanged(deleteNode(this.normalizedValue, path));
64
67
  };
65
68
  this.handleUpdateArgs = (path, args) => {
66
69
  this.emitIfChanged(updateArgs(this.normalizedValue, path, args));
67
70
  };
68
71
  this.handleReplaceNode = (path, replacement) => {
72
+ const autoOpenPath = this.autoOpenPathFor(path, replacement);
73
+ this.focusOnOpen = autoOpenPath !== null;
74
+ if (autoOpenPath !== null) {
75
+ this.openChipPath = autoOpenPath;
76
+ }
69
77
  this.emitIfChanged(replaceNode(this.normalizedValue, path, replacement));
70
78
  };
71
79
  this.handleChipInteract = (path) => {
72
80
  this.openChipPath = path;
81
+ this.focusOnOpen = false;
73
82
  };
74
83
  this.handlePopoverClose = () => {
75
84
  this.openChipPath = null;
85
+ this.focusOnOpen = false;
76
86
  };
77
87
  }
78
88
  componentWillLoad() {
@@ -116,7 +126,7 @@ export class RuleEditor {
116
126
  'rule-editor': true,
117
127
  'rule-editor--disabled': this.disabled,
118
128
  };
119
- return (h("div", { key: 'f84022580c3dcbc397a2551b282464d6579368a1', class: containerClasses }, this.renderLabel(), h(RuleNodeView, { key: '660cb7221c151f0a348e00c834338ce03511a7e9', node: this.normalizedValue, path: [], ctx: this.createRenderContext() }), this.renderHelperText()));
129
+ return (h("div", { key: '939efeb92282ce6c60bac6e86dcfe1e8386802c6', class: containerClasses }, this.renderLabel(), h(RuleNodeView, { key: 'd0f829aeda9e2552b39f1ed195d486ea76122ed9', node: this.normalizedValue, path: [], ctx: this.createRenderContext() }), this.renderHelperText()));
120
130
  }
121
131
  renderLabel() {
122
132
  if (!this.label) {
@@ -143,6 +153,7 @@ export class RuleEditor {
143
153
  context: this.effectiveContext,
144
154
  translator: this.translator,
145
155
  openChipPath: this.openChipPath,
156
+ focusOnOpen: this.focusOnOpen,
146
157
  onDelete: this.handleDelete,
147
158
  onUpdateArgs: this.handleUpdateArgs,
148
159
  onReplaceNode: this.handleReplaceNode,
@@ -150,6 +161,46 @@ export class RuleEditor {
150
161
  onPopoverClose: this.handlePopoverClose,
151
162
  };
152
163
  }
164
+ /**
165
+ * Path of a newly added chip whose primitive declares a config
166
+ * component, so its args editor opens immediately on add. The new
167
+ * ref is found by object identity — the picker reuses existing ref
168
+ * objects and only the added chip is a fresh node — so adding a
169
+ * second instance of a primitive already in the group is still
170
+ * detected. Returns `null` unless exactly one ref was added and it
171
+ * has an editor, leaving the open chip untouched for removals,
172
+ * multi-adds, and negation.
173
+ * @param path
174
+ * @param replacement
175
+ */
176
+ autoOpenPathFor(path, replacement) {
177
+ var _a;
178
+ if (replacement.type !== 'all' && replacement.type !== 'any') {
179
+ return null;
180
+ }
181
+ const previous = getNode(this.normalizedValue, path);
182
+ if (previous === undefined ||
183
+ (previous.type !== 'all' && previous.type !== 'any')) {
184
+ return null;
185
+ }
186
+ const previousRefs = new Set(previous.rules
187
+ .map((rule) => { var _a; return (_a = extractRef(rule)) === null || _a === void 0 ? void 0 : _a.ref; })
188
+ .filter((ref) => ref !== undefined));
189
+ const added = replacement.rules
190
+ .map((rule, index) => {
191
+ var _a;
192
+ const ref = (_a = extractRef(rule)) === null || _a === void 0 ? void 0 : _a.ref;
193
+ return ref && !previousRefs.has(ref) ? { ref, index } : null;
194
+ })
195
+ .filter((entry) => entry !== null);
196
+ if (added.length !== 1) {
197
+ return null;
198
+ }
199
+ const [{ ref, index }] = added;
200
+ return ((_a = this.metadataById.get(ref.id)) === null || _a === void 0 ? void 0 : _a.configComponent)
201
+ ? buildChipPath(path, index)
202
+ : null;
203
+ }
153
204
  indexMetadata() {
154
205
  var _a, _b, _c;
155
206
  const metadata = (_c = (_b = (_a = this.ruleRegistry).listMetadata) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : [];
@@ -14,6 +14,9 @@ export function deleteNode(rule, path) {
14
14
  const parentPath = path.slice(0, -1);
15
15
  const key = path.at(-1);
16
16
  const parent = getNode(rule, parentPath);
17
+ if (parent === undefined) {
18
+ return rule;
19
+ }
17
20
  if ((parent.type === 'all' || parent.type === 'any') &&
18
21
  typeof key === 'number') {
19
22
  const rules = [...parent.rules];
@@ -34,7 +37,7 @@ export function deleteNode(rule, path) {
34
37
  */
35
38
  export function updateArgs(rule, path, args) {
36
39
  const node = getNode(rule, path);
37
- if (node.type !== 'ref') {
40
+ if (node === undefined || node.type !== 'ref') {
38
41
  return rule;
39
42
  }
40
43
  return replaceAt(rule, path, Object.assign(Object.assign({}, node), { args }));
@@ -88,9 +91,19 @@ export function pathsEqual(a, b) {
88
91
  export function issuesAt(issues, path) {
89
92
  return issues.filter((issue) => pathsEqual(issue.path, path));
90
93
  }
91
- function getNode(rule, path) {
94
+ /**
95
+ * Resolve the node at `path` by walking each segment from the root.
96
+ * Returns `undefined` when a segment indexes past the end of a
97
+ * combinator's `rules`, so callers must guard the result.
98
+ * @param rule
99
+ * @param path
100
+ */
101
+ export function getNode(rule, path) {
92
102
  let node = rule;
93
103
  for (const key of path) {
104
+ if (node === undefined) {
105
+ return undefined;
106
+ }
94
107
  node = stepIntoNode(node, key);
95
108
  }
96
109
  return node;
@@ -1 +1 @@
1
- import{proxyCustomElement as e,HTMLElement as t,createEvent as o,transformTag as i}from"@stencil/core/internal/client";import{H as l,b as n}from"./index.esm.js";import{H as c}from"./highlight-item.handler.js";let s=class{constructor(e){this.itemId=e}};s=function(e,t,o,i){var l,n=arguments.length,c=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(c=(n<3?l(c):n>3?l(t,o,c):l(t,o))||c);return n>3&&c&&Object.defineProperty(t,o,c),c}([l({id:"limebb-feed.highlight-item"})],s);const r=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.loaded=o(this,"loaded",7)}connectedCallback(){}async componentWillLoad(){const e=new c;this.platform.register(c.SERVICE_NAME,e),this.commandBus.register(s,e),(()=>{this.platform.get(n.RuleRegistry).attachMetadata("limetech.limeobject-matches-filter",{configComponent:{name:"limebb-rule-arg-filter-editor"}})})(),this.loaded.emit()}componentWillUpdate(){}disconnectedCallback(){}get commandBus(){return this.platform.get(n.CommandBus)}},[1,"limebb-loader",{platform:[16],context:[16]}]),m=r,a=function(){"undefined"!=typeof customElements&&["limebb-loader"].forEach((e=>{"limebb-loader"===e&&(customElements.get(i(e))||customElements.define(i(e),r))}))};export{m as LimebbLoader,a as defineCustomElement}
1
+ import{proxyCustomElement as e,HTMLElement as t,createEvent as o,transformTag as i}from"@stencil/core/internal/client";import{H as l,b as n}from"./index.esm.js";import{H as c}from"./highlight-item.handler.js";let s=class{constructor(e){this.itemId=e}};s=function(e,t,o,i){var l,n=arguments.length,c=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(l=e[s])&&(c=(n<3?l(c):n>3?l(t,o,c):l(t,o))||c);return n>3&&c&&Object.defineProperty(t,o,c),c}([l({id:"limebb-feed.highlight-item"})],s);const r="limetech.limeobject-matches-filter",m=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.loaded=o(this,"loaded",7)}connectedCallback(){}async componentWillLoad(){const e=new c;this.platform.register(c.SERVICE_NAME,e),this.commandBus.register(s,e),(e=>{e.listPrimitives().some((e=>e.id===r))&&e.attachMetadata(r,{configComponent:{name:"limebb-rule-arg-filter-editor"}})})(this.platform.get(n.RuleRegistry)),this.loaded.emit()}componentWillUpdate(){}disconnectedCallback(){}get commandBus(){return this.platform.get(n.CommandBus)}},[1,"limebb-loader",{platform:[16],context:[16]}]),a=m,f=function(){"undefined"!=typeof customElements&&["limebb-loader"].forEach((e=>{"limebb-loader"===e&&(customElements.get(i(e))||customElements.define(i(e),m))}))};export{a as LimebbLoader,f as defineCustomElement}
@@ -1 +1 @@
1
- import{h as e,proxyCustomElement as t,HTMLElement as n,createEvent as r,transformTag as i}from"@stencil/core/internal/client";import{O as o,b as l}from"./index.esm.js";import{d as s}from"./rule-chip-popover.js";function u(e,t){return t?{type:"not",rule:e}:e}function a(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))}function c(e,t){return e.filter((e=>a(e.path,t)))}function d(e,t){let n=e;for(const e of t)n=p(n,e);return n}function h(e,t,n){if(0===t.length)return n;const[r,...i]=t;if("not"===e.type&&"rule"===r)return Object.assign(Object.assign({},e),{rule:h(e.rule,i,n)});if(("all"===e.type||"any"===e.type)&&"rules"===r){if(0===i.length)return n;const[t,...r]=i;if("number"!=typeof t)return e;const o=[...e.rules];return o[t]=h(o[t],r,n),Object.assign(Object.assign({},e),{rules:o})}return e}function p(e,t){return"not"===e.type&&"rule"===t?e.rule:"all"!==e.type&&"any"!==e.type||"rules"!==t?"all"!==e.type&&"any"!==e.type||"number"!=typeof t?e:e.rules[t]:e}const f={name:"question",color:"rgb(var(--color-glaucous-light))"};function b(e,t){return{"rule-node":!0,["rule-node--"+e]:!0,"rule-node--invalid":t.length>0}}function v(e,t){return[...e.values()].map((e=>({value:e.id,text:e.title?t.get(e.title):e.id,secondaryText:e.description?t.get(e.description):"",icon:e.icon}))).sort(((e,t)=>e.text.localeCompare(t.text)))}function m(e,t){return e.reads.every((e=>t.has(e)))}function g(e){return"__chip__:"+e}function y(e){return"ref"===e.type?{ref:e,isNegated:!1}:"not"===e.type&&"ref"===e.rule.type?{ref:e.rule,isNegated:!0}:null}const _=({groupNode:t,groupPath:n,chipChildren:r,ctx:i})=>{const o=new Map,l=r.map((e=>{const t=g(e.index);o.set(t,e);const n=function(e,t){var n;return null!==(n=e.find((e=>e.value===t)))&&void 0!==n?n:{value:t,text:t,icon:f}}(i.allPrimitiveOptions,e.ref.id);return Object.assign(Object.assign({},n),{text:e.isNegated?"¬ "+n.text:n.text,value:t})})),s=function(e){return t=>Promise.resolve(function(e,t){if(!t)return e;const n=t.toLocaleLowerCase().split(/\s+/);return e.filter((e=>n.every((t=>{var n,r;return e.text.toLocaleLowerCase().includes(t)||(null===(n=e.secondaryText)||void 0===n?void 0:n.toLocaleLowerCase().includes(t))||(null===(r=e.value)||void 0===r?void 0:r.toLocaleLowerCase().includes(t))}))))}(e,t))}(i.availablePrimitiveOptions),u=function(e,t,n){var r;const i=k(t,n);return null===i?null:null!==(r=e.find((e=>e.index===i)))&&void 0!==r?r:null}(r,n,i.openChipPath),a="all"===t.type?"&":"|";return e("limel-popover",{class:"rule-node__chips-popover",open:null!==u,openDirection:"bottom-start",onClose:i.onPopoverClose},e("div",{slot:"trigger",class:"rule-node__chips"},e("limel-picker",{multiple:!0,label:i.translator.get("webclient.rule-editor.rules-label"),value:l,searcher:s,delimiter:a,readonly:i.readonly,disabled:i.disabled,onChange:x(t,n,o,i),onInteract:C(n,o,i)})),e("div",null,function(t,n,r){if(!t)return null;const i=function(e,t){return[...e,"rules",t]}(n,t.index);return e("limebb-rule-chip-popover",{platform:r.platform,context:r.context,refNode:t.ref,isNegated:t.isNegated,metadata:r.metadataById.get(t.ref.id),readonly:r.readonly,disabled:r.disabled,isMutable:r.isMutable,onNegate:j(t,i,r),onUpdateArgs:O(t,i,r),onDeleteChip:w(i,r)})}(u,n,i)))},x=(e,t,n,r)=>i=>{i.stopPropagation();const o=Array.isArray(i.detail)?i.detail:[],l=k(t,r.openChipPath);if(null!==l){const e=g(l);o.every((t=>t.value!==e))&&r.onPopoverClose()}const s=o.flatMap((e=>{if("string"!=typeof e.value)return[];const t=n.get(e.value);return t?[t.isNegated?{type:"not",rule:t.ref}:t.ref]:[{type:"ref",id:e.value}]})),u=e.rules.filter((e=>null===y(e)));r.onReplaceNode(t,Object.assign(Object.assign({},e),{rules:[...s,...u]}))},C=(e,t,n)=>r=>{r.stopPropagation();const i=function(e){if("string"==typeof e)return e;if(e&&"object"==typeof e&&"value"in e){const t=e.value;return"string"==typeof t?t:void 0}}(r.detail),o=i?t.get(i):void 0;o&&n.onChipInteract([...e,"rules",o.index])},j=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,r.detail?{type:"not",rule:e.ref}:e.ref)},O=(e,t,n)=>r=>{r.stopPropagation();const i=e.isNegated?[...t,"rule"]:t;n.onUpdateArgs(i,r.detail)},w=(e,t)=>()=>{t.onDelete(e)};function k(e,t){if(!t||t.length<2)return null;if(!a(function(e){return e.slice(0,-2)}(t),e))return null;const n=t.at(-1);return"number"==typeof n?n:null}const N=({node:t,path:n,isNegated:r,ctx:i})=>{const o=r?[...n,"rule"]:n,l=r?[...c(i.issues,n),...c(i.issues,o)]:c(i.issues,n),s=[],u=[];for(const[e,n]of t.rules.entries()){const t=y(n);t?s.push(Object.assign(Object.assign({},t),{index:e})):u.push({child:n,index:e})}const a=function(e){return[{value:"all",text:e.translator.get("webclient.rule-editor.combinator.all")},{value:"any",text:e.translator.get("webclient.rule-editor.combinator.any")}]}(i),d=a.find((e=>e.value===t.type));return e("div",{class:b(t.type,l),key:P(n)},e("div",{class:"rule-node__header"},e("limel-select",{class:"rule-node__combinator-select",value:d,options:a,disabled:!i.isMutable,onChange:M(t,n,r,i)}),function(t,n,r,i){return i.isMutable?e("div",{class:"rule-node__header-actions"},e("limel-switch",{class:"rule-node__negate-switch",label:i.translator.get("webclient.rule-editor.negate"),value:r,onChange:z(t,n,i)}),e("limel-icon-button",{icon:"trash",label:i.translator.get("webclient.rule-editor.delete"),onClick:()=>i.onDelete(n)})):null}(t,n,r,i)),e("div",{class:"rule-node__body"},e(I,{issues:l}),e(_,{groupNode:t,groupPath:o,chipChildren:s,ctx:i}),function(t,n,r){return 0===t.length?null:e("div",{class:"rule-node__children"},t.map((t=>e(V,{node:t.child,path:[...n,"rules",t.index],ctx:r}))))}(u,o,i),function(t,n,r,i){return i.isMutable?e("div",{class:"rule-node__footer"},e("limel-button",{icon:"add",label:i.translator.get("webclient.rule-editor.add-nested-group"),onClick:A(t,n,r,i)})):null}(t,n,r,i)))};function P(e){return 0===e.length?"root":e.join("/")}function R(e,t,n,r){r.onReplaceNode(t,u(e,n))}const M=(e,t,n,r)=>i=>{i.stopPropagation();const o=i.detail.value;o!==e.type&&R(Object.assign(Object.assign({},e),{type:o}),t,n,r)},A=(e,t,n,r)=>()=>{R(function(e){return Object.assign(Object.assign({},e),{rules:[...e.rules,{type:"all",rules:[]}]})}(e),t,n,r)},z=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,u(e,r.detail))},V=t=>{const{node:n,path:r,ctx:i}=t,o=E(n);return o?e(N,{node:o.node,path:r,isNegated:o.isNegated,ctx:i}):null},D=e=>"not"===e.type&&("all"===e.rule.type||"any"===e.rule.type);function E(e){if("all"===e.type||"any"===e.type)return{node:e,isNegated:!1};if(D(e))return{node:e.rule,isNegated:!0};if("not"===e.type){const t=E(e.rule);if(t)return{node:t.node,isNegated:!t.isNegated}}return null}const I=({issues:t})=>0===t.length?null:t.map((t=>e("div",{class:"rule-node__issue"},t.message)));const L=t(class extends n{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=r(this,"change",7),this.issues=[],this.openChipPath=null,this.metadataById=new Map,this.allPrimitiveOptions=[],this.availablePrimitiveOptions=[],this.reachableSlots=new Set,this.normalizedCache=null,this.hasLoaded=!1,this.handleDelete=e=>{this.openChipPath=null,this.emitIfChanged(function(e,t){if(0===t.length)return{type:"all",rules:[]};const n=t.slice(0,-1),r=t.at(-1),i=d(e,n);if(("all"===i.type||"any"===i.type)&&"number"==typeof r){const t=[...i.rules];return t.splice(r,1),h(e,n,Object.assign(Object.assign({},i),{rules:t}))}return"not"===i.type&&"rule"===r?h(e,n,{type:"all",rules:[]}):e}(this.normalizedValue,e))},this.handleUpdateArgs=(e,t)=>{this.emitIfChanged(function(e,t,n){const r=d(e,t);return"ref"!==r.type?e:h(e,t,Object.assign(Object.assign({},r),{args:n}))}(this.normalizedValue,e,t))},this.handleReplaceNode=(e,t)=>{this.emitIfChanged(function(e,t,n){return h(e,t,n)}(this.normalizedValue,e,t))},this.handleChipInteract=e=>{this.openChipPath=e},this.handlePopoverClose=()=>{this.openChipPath=null}}componentWillLoad(){this.rebuildFromRegistries()}rebuildFromRegistries(){this.computeReachableSlots(),this.indexMetadata(),this.rebuildAvailableOptions(),this.runValidation()}connectedCallback(){this.hasLoaded&&(this.computeReachableSlots(),this.rebuildAvailableOptions(),this.runValidation())}componentDidLoad(){this.hasLoaded=!0,this.emitNormalization()}onValueChange(){this.emitNormalization()||this.runValidation()}onAvailableContextsChange(){this.rebuildFromRegistries()}render(){return e("div",{key:"f84022580c3dcbc397a2551b282464d6579368a1",class:{"rule-editor":!0,"rule-editor--disabled":this.disabled}},this.renderLabel(),e(V,{key:"660cb7221c151f0a348e00c834338ce03511a7e9",node:this.normalizedValue,path:[],ctx:this.createRenderContext()}),this.renderHelperText())}renderLabel(){return this.label?e("div",{class:"rule-editor__label"},this.label):null}renderHelperText(){return this.helperText?e("div",{class:"rule-editor__helper-text"},this.helperText):null}createRenderContext(){return{issues:this.issues,metadataById:this.metadataById,allPrimitiveOptions:this.allPrimitiveOptions,availablePrimitiveOptions:this.availablePrimitiveOptions,isMutable:!this.readonly&&!this.disabled,readonly:this.readonly,disabled:this.disabled,platform:this.platform,context:this.effectiveContext,translator:this.translator,openChipPath:this.openChipPath,onDelete:this.handleDelete,onUpdateArgs:this.handleUpdateArgs,onReplaceNode:this.handleReplaceNode,onChipInteract:this.handleChipInteract,onPopoverClose:this.handlePopoverClose}}indexMetadata(){var e,t,n;const r=null!==(n=null===(t=(e=this.ruleRegistry).listMetadata)||void 0===t?void 0:t.call(e))&&void 0!==n?n:[];this.metadataById=new Map(r.map((e=>[e.id,e]))),this.allPrimitiveOptions=v(this.metadataById,this.translator)}rebuildAvailableOptions(){this.availablePrimitiveOptions=v(this.availablePrimitiveMetadata(),this.translator)}availablePrimitiveMetadata(){const e=new Map;for(const[t,n]of this.metadataById)m(n,this.reachableSlots)&&e.set(t,n);return e}computeReachableSlots(){var e;const t=this.contextRegistry,n=t.list().map((e=>e.id)).filter((e=>void 0!==t.get(e,this.host)));this.reachableSlots=new Set([...n,...null!==(e=this.availableContexts)&&void 0!==e?e:[]])}runValidation(){if(!this.value)return void(this.issues=[]);const e=this.ruleRegistry.validate(this.normalizedValue,[...this.reachableSlots]);this.issues=e.ok?[]:e.issues}emitIfChanged(e){e!==this.normalizedValue&&this.change.emit(function(e){return"all"!==e.type&&"any"!==e.type?e:0===e.rules.length?void 0:e}(e))}get normalizedValue(){if(null!==this.normalizedCache&&this.normalizedCache.source===this.value)return this.normalizedCache.normalized;const e=function(e){return e?E(e)?e:{type:"all",rules:[e]}:{type:"all",rules:[]}}(this.value);return this.normalizedCache={source:this.value,normalized:e},e}emitNormalization(){if(!this.value)return!1;const e=this.normalizedValue;return e!==this.value&&(this.change.emit(e),!0)}get ruleRegistry(){return this.platform.get(l.RuleRegistry)}get translator(){return this.platform.get(l.Translate)}get contextRegistry(){return this.platform.get(l.ContextRegistry)}get effectiveContext(){var e,t;return(null===(e=this.context)||void 0===e?void 0:e.limetype)?this.context:(null===(t=this.resolvedContext)||void 0===t?void 0:t.limetype)?this.resolvedContext:S}get host(){return this}static get watchers(){return{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}}static get style(){return":host{display:block}.rule-editor--disabled{opacity:0.6;pointer-events:none}.rule-editor__label{font-size:0.75rem;font-weight:600;color:rgb(var(--contrast-1500));margin-bottom:0.25rem}.rule-editor__helper-text{font-size:0.75rem;color:rgb(var(--contrast-1300));margin-top:0.25rem}.rule-node{border:1px solid rgb(var(--contrast-500));border-radius:0.5rem;margin:0.25rem 0;overflow:hidden;background-color:rgb(var(--contrast-100))}.rule-node--invalid{border-color:rgb(var(--color-red-default))}.rule-node--all>.rule-node__header,.rule-node--any>.rule-node__header{background-color:rgb(var(--contrast-300));padding:0.375rem 0.75rem;border-bottom:1px solid rgb(var(--contrast-500))}.rule-node__header{display:flex;align-items:center;gap:0.5rem}.rule-node__header-actions{margin-left:auto;display:grid;grid-auto-flow:column;grid-gap:0.5rem;padding:0.125rem;align-items:center}.rule-node__combinator-select{min-width:6rem}.rule-node__body{padding:0.75rem;display:flex;flex-direction:column;gap:0.75rem}limel-popover.rule-node__chips-popover{display:contents;--popover-surface-width:min(calc(100vw - 4rem), 50rem)}.rule-node__chips{display:block;width:100%}.rule-node__chips limel-picker{display:block;width:100%}.rule-node__children{display:flex;flex-direction:column;gap:0.5rem}.rule-node__footer{display:flex;justify-content:center}.rule-node__issue{color:rgb(var(--color-red-default));font-size:0.875rem}"}},[1,"limebb-rule-editor",{platform:[16],context:[16],value:[16],availableContexts:[16],required:[516],readonly:[516],disabled:[516],label:[513],helperText:[1,"helper-text"],resolvedContext:[32],issues:[32],openChipPath:[32],availablePrimitiveOptions:[32]},void 0,{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}]);!function(e,t,n,r){var i,o=arguments.length,l=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(o<3?i(l):o>3?i(t,n,l):i(t,n))||l);o>3&&l&&Object.defineProperty(t,n,l)}([o("context")],L.prototype,"resolvedContext",void 0);const S=Object.freeze({limetype:null,id:null}),T=L,q=function(){"undefined"!=typeof customElements&&["limebb-rule-editor","limebb-rule-chip-popover"].forEach((e=>{switch(e){case"limebb-rule-editor":customElements.get(i(e))||customElements.define(i(e),L);break;case"limebb-rule-chip-popover":customElements.get(i(e))||s()}}))};export{T as LimebbRuleEditor,q as defineCustomElement}
1
+ import{h as e,proxyCustomElement as t,HTMLElement as n,createEvent as r,transformTag as i}from"@stencil/core/internal/client";import{O as l,b as o}from"./index.esm.js";import{d as s}from"./rule-chip-popover.js";function u(e,t){return t?{type:"not",rule:e}:e}function a(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))}function c(e,t){return e.filter((e=>a(e.path,t)))}function d(e,t){let n=e;for(const e of t){if(void 0===n)return;n=f(n,e)}return n}function h(e,t,n){if(0===t.length)return n;const[r,...i]=t;if("not"===e.type&&"rule"===r)return Object.assign(Object.assign({},e),{rule:h(e.rule,i,n)});if(("all"===e.type||"any"===e.type)&&"rules"===r){if(0===i.length)return n;const[t,...r]=i;if("number"!=typeof t)return e;const l=[...e.rules];return l[t]=h(l[t],r,n),Object.assign(Object.assign({},e),{rules:l})}return e}function f(e,t){return"not"===e.type&&"rule"===t?e.rule:"all"!==e.type&&"any"!==e.type||"rules"!==t?"all"!==e.type&&"any"!==e.type||"number"!=typeof t?e:e.rules[t]:e}const p={name:"question",color:"rgb(var(--color-glaucous-light))"};function b(e,t){return{"rule-node":!0,["rule-node--"+e]:!0,"rule-node--invalid":t.length>0}}function v(e,t){return[...e.values()].map((e=>({value:e.id,text:e.title?t.get(e.title):e.id,secondaryText:e.description?t.get(e.description):"",icon:e.icon}))).sort(((e,t)=>e.text.localeCompare(t.text)))}function m(e,t){return e.reads.every((e=>t.has(e)))}function g(e){return"__chip__:"+e}function y(e,t){return[...e,"rules",t]}function _(e){return"ref"===e.type?{ref:e,isNegated:!1}:"not"===e.type&&"ref"===e.rule.type?{ref:e.rule,isNegated:!0}:null}const x=({groupNode:t,groupPath:n,chipChildren:r,ctx:i})=>{const l=new Map,o=r.map((e=>{const t=g(e.index);l.set(t,e);const n=function(e,t){var n;return null!==(n=e.find((e=>e.value===t)))&&void 0!==n?n:{value:t,text:t,icon:p}}(i.allPrimitiveOptions,e.ref.id);return Object.assign(Object.assign({},n),{text:e.isNegated?"¬ "+n.text:n.text,value:t})})),s=function(e){return t=>Promise.resolve(function(e,t){if(!t)return e;const n=t.toLocaleLowerCase().split(/\s+/);return e.filter((e=>n.every((t=>{var n,r;return e.text.toLocaleLowerCase().includes(t)||(null===(n=e.secondaryText)||void 0===n?void 0:n.toLocaleLowerCase().includes(t))||(null===(r=e.value)||void 0===r?void 0:r.toLocaleLowerCase().includes(t))}))))}(e,t))}(i.availablePrimitiveOptions),u=function(e,t,n){var r;const i=N(t,n);return null===i?null:null!==(r=e.find((e=>e.index===i)))&&void 0!==r?r:null}(r,n,i.openChipPath),a="all"===t.type?"&":"|";return e("limel-popover",{class:"rule-node__chips-popover",open:null!==u,openDirection:"bottom-start",onClose:i.onPopoverClose},e("div",{slot:"trigger",class:"rule-node__chips"},e("limel-picker",{multiple:!0,label:i.translator.get("webclient.rule-editor.rules-label"),value:o,searcher:s,delimiter:a,readonly:i.readonly,disabled:i.disabled,onChange:C(t,n,l,i),onInteract:O(n,l,i)})),e("div",null,function(t,n,r){if(!t)return null;const i=y(n,t.index);return e("limebb-rule-chip-popover",{platform:r.platform,context:r.context,refNode:t.ref,isNegated:t.isNegated,metadata:r.metadataById.get(t.ref.id),readonly:r.readonly,disabled:r.disabled,isMutable:r.isMutable,focusOnOpen:r.focusOnOpen,onNegate:j(t,i,r),onUpdateArgs:w(t,i,r),onDeleteChip:k(i,r)})}(u,n,i)))},C=(e,t,n,r)=>i=>{i.stopPropagation();const l=Array.isArray(i.detail)?i.detail:[],o=N(t,r.openChipPath);if(null!==o){const e=g(o);l.every((t=>t.value!==e))&&r.onPopoverClose()}const s=l.flatMap((e=>{if("string"!=typeof e.value)return[];const t=n.get(e.value);return t?[t.isNegated?{type:"not",rule:t.ref}:t.ref]:[{type:"ref",id:e.value}]})),u=e.rules.filter((e=>null===_(e)));r.onReplaceNode(t,Object.assign(Object.assign({},e),{rules:[...s,...u]}))},O=(e,t,n)=>r=>{r.stopPropagation();const i=function(e){if("string"==typeof e)return e;if(e&&"object"==typeof e&&"value"in e){const t=e.value;return"string"==typeof t?t:void 0}}(r.detail),l=i?t.get(i):void 0;l&&n.onChipInteract([...e,"rules",l.index])},j=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,r.detail?{type:"not",rule:e.ref}:e.ref)},w=(e,t,n)=>r=>{r.stopPropagation();const i=e.isNegated?[...t,"rule"]:t;n.onUpdateArgs(i,r.detail)},k=(e,t)=>()=>{t.onDelete(e)};function N(e,t){if(!t||t.length<2)return null;if(!a(function(e){return e.slice(0,-2)}(t),e))return null;const n=t.at(-1);return"number"==typeof n?n:null}const P=({node:t,path:n,isNegated:r,ctx:i})=>{const l=r?[...n,"rule"]:n,o=r?[...c(i.issues,n),...c(i.issues,l)]:c(i.issues,n),s=[],u=[];for(const[e,n]of t.rules.entries()){const t=_(n);t?s.push(Object.assign(Object.assign({},t),{index:e})):u.push({child:n,index:e})}const a=function(e){return[{value:"all",text:e.translator.get("webclient.rule-editor.combinator.all")},{value:"any",text:e.translator.get("webclient.rule-editor.combinator.any")}]}(i),d=a.find((e=>e.value===t.type));return e("div",{class:b(t.type,o),key:R(n)},e("div",{class:"rule-node__header"},e("limel-select",{class:"rule-node__combinator-select",value:d,options:a,disabled:!i.isMutable,onChange:A(t,n,r,i)}),function(t,n,r,i){return i.isMutable?e("div",{class:"rule-node__header-actions"},e("limel-switch",{class:"rule-node__negate-switch",label:i.translator.get("webclient.rule-editor.negate"),value:r,onChange:V(t,n,i)}),e("limel-icon-button",{icon:"trash",label:i.translator.get("webclient.rule-editor.delete"),onClick:()=>i.onDelete(n)})):null}(t,n,r,i)),e("div",{class:"rule-node__body"},e(S,{issues:o}),e(x,{groupNode:t,groupPath:l,chipChildren:s,ctx:i}),function(t,n,r){return 0===t.length?null:e("div",{class:"rule-node__children"},t.map((t=>e(D,{node:t.child,path:[...n,"rules",t.index],ctx:r}))))}(u,l,i),function(t,n,r,i){return i.isMutable?e("div",{class:"rule-node__footer"},e("limel-button",{icon:"add",label:i.translator.get("webclient.rule-editor.add-nested-group"),onClick:z(t,n,r,i)})):null}(t,n,r,i)))};function R(e){return 0===e.length?"root":e.join("/")}function M(e,t,n,r){r.onReplaceNode(t,u(e,n))}const A=(e,t,n,r)=>i=>{i.stopPropagation();const l=i.detail.value;l!==e.type&&M(Object.assign(Object.assign({},e),{type:l}),t,n,r)},z=(e,t,n,r)=>()=>{M(function(e){return Object.assign(Object.assign({},e),{rules:[...e.rules,{type:"all",rules:[]}]})}(e),t,n,r)},V=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,u(e,r.detail))},D=t=>{const{node:n,path:r,ctx:i}=t,l=I(n);return l?e(P,{node:l.node,path:r,isNegated:l.isNegated,ctx:i}):null},E=e=>"not"===e.type&&("all"===e.rule.type||"any"===e.rule.type);function I(e){if("all"===e.type||"any"===e.type)return{node:e,isNegated:!1};if(E(e))return{node:e.rule,isNegated:!0};if("not"===e.type){const t=I(e.rule);if(t)return{node:t.node,isNegated:!t.isNegated}}return null}const S=({issues:t})=>0===t.length?null:t.map((t=>e("div",{class:"rule-node__issue"},t.message)));const L=t(class extends n{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.change=r(this,"change",7),this.issues=[],this.openChipPath=null,this.focusOnOpen=!1,this.metadataById=new Map,this.allPrimitiveOptions=[],this.availablePrimitiveOptions=[],this.reachableSlots=new Set,this.normalizedCache=null,this.hasLoaded=!1,this.handleDelete=e=>{this.openChipPath=null,this.focusOnOpen=!1,this.emitIfChanged(function(e,t){if(0===t.length)return{type:"all",rules:[]};const n=t.slice(0,-1),r=t.at(-1),i=d(e,n);if(void 0===i)return e;if(("all"===i.type||"any"===i.type)&&"number"==typeof r){const t=[...i.rules];return t.splice(r,1),h(e,n,Object.assign(Object.assign({},i),{rules:t}))}return"not"===i.type&&"rule"===r?h(e,n,{type:"all",rules:[]}):e}(this.normalizedValue,e))},this.handleUpdateArgs=(e,t)=>{this.emitIfChanged(function(e,t,n){const r=d(e,t);return void 0===r||"ref"!==r.type?e:h(e,t,Object.assign(Object.assign({},r),{args:n}))}(this.normalizedValue,e,t))},this.handleReplaceNode=(e,t)=>{const n=this.autoOpenPathFor(e,t);this.focusOnOpen=null!==n,null!==n&&(this.openChipPath=n),this.emitIfChanged(function(e,t,n){return h(e,t,n)}(this.normalizedValue,e,t))},this.handleChipInteract=e=>{this.openChipPath=e,this.focusOnOpen=!1},this.handlePopoverClose=()=>{this.openChipPath=null,this.focusOnOpen=!1}}componentWillLoad(){this.rebuildFromRegistries()}rebuildFromRegistries(){this.computeReachableSlots(),this.indexMetadata(),this.rebuildAvailableOptions(),this.runValidation()}connectedCallback(){this.hasLoaded&&(this.computeReachableSlots(),this.rebuildAvailableOptions(),this.runValidation())}componentDidLoad(){this.hasLoaded=!0,this.emitNormalization()}onValueChange(){this.emitNormalization()||this.runValidation()}onAvailableContextsChange(){this.rebuildFromRegistries()}render(){return e("div",{key:"939efeb92282ce6c60bac6e86dcfe1e8386802c6",class:{"rule-editor":!0,"rule-editor--disabled":this.disabled}},this.renderLabel(),e(D,{key:"d0f829aeda9e2552b39f1ed195d486ea76122ed9",node:this.normalizedValue,path:[],ctx:this.createRenderContext()}),this.renderHelperText())}renderLabel(){return this.label?e("div",{class:"rule-editor__label"},this.label):null}renderHelperText(){return this.helperText?e("div",{class:"rule-editor__helper-text"},this.helperText):null}createRenderContext(){return{issues:this.issues,metadataById:this.metadataById,allPrimitiveOptions:this.allPrimitiveOptions,availablePrimitiveOptions:this.availablePrimitiveOptions,isMutable:!this.readonly&&!this.disabled,readonly:this.readonly,disabled:this.disabled,platform:this.platform,context:this.effectiveContext,translator:this.translator,openChipPath:this.openChipPath,focusOnOpen:this.focusOnOpen,onDelete:this.handleDelete,onUpdateArgs:this.handleUpdateArgs,onReplaceNode:this.handleReplaceNode,onChipInteract:this.handleChipInteract,onPopoverClose:this.handlePopoverClose}}autoOpenPathFor(e,t){var n;if("all"!==t.type&&"any"!==t.type)return null;const r=d(this.normalizedValue,e);if(void 0===r||"all"!==r.type&&"any"!==r.type)return null;const i=new Set(r.rules.map((e=>{var t;return null===(t=_(e))||void 0===t?void 0:t.ref})).filter((e=>void 0!==e))),l=t.rules.map(((e,t)=>{var n;const r=null===(n=_(e))||void 0===n?void 0:n.ref;return r&&!i.has(r)?{ref:r,index:t}:null})).filter((e=>null!==e));if(1!==l.length)return null;const[{ref:o,index:s}]=l;return(null===(n=this.metadataById.get(o.id))||void 0===n?void 0:n.configComponent)?y(e,s):null}indexMetadata(){var e,t,n;const r=null!==(n=null===(t=(e=this.ruleRegistry).listMetadata)||void 0===t?void 0:t.call(e))&&void 0!==n?n:[];this.metadataById=new Map(r.map((e=>[e.id,e]))),this.allPrimitiveOptions=v(this.metadataById,this.translator)}rebuildAvailableOptions(){this.availablePrimitiveOptions=v(this.availablePrimitiveMetadata(),this.translator)}availablePrimitiveMetadata(){const e=new Map;for(const[t,n]of this.metadataById)m(n,this.reachableSlots)&&e.set(t,n);return e}computeReachableSlots(){var e;const t=this.contextRegistry,n=t.list().map((e=>e.id)).filter((e=>void 0!==t.get(e,this.host)));this.reachableSlots=new Set([...n,...null!==(e=this.availableContexts)&&void 0!==e?e:[]])}runValidation(){if(!this.value)return void(this.issues=[]);const e=this.ruleRegistry.validate(this.normalizedValue,[...this.reachableSlots]);this.issues=e.ok?[]:e.issues}emitIfChanged(e){e!==this.normalizedValue&&this.change.emit(function(e){return"all"!==e.type&&"any"!==e.type?e:0===e.rules.length?void 0:e}(e))}get normalizedValue(){if(null!==this.normalizedCache&&this.normalizedCache.source===this.value)return this.normalizedCache.normalized;const e=function(e){return e?I(e)?e:{type:"all",rules:[e]}:{type:"all",rules:[]}}(this.value);return this.normalizedCache={source:this.value,normalized:e},e}emitNormalization(){if(!this.value)return!1;const e=this.normalizedValue;return e!==this.value&&(this.change.emit(e),!0)}get ruleRegistry(){return this.platform.get(o.RuleRegistry)}get translator(){return this.platform.get(o.Translate)}get contextRegistry(){return this.platform.get(o.ContextRegistry)}get effectiveContext(){var e,t;return(null===(e=this.context)||void 0===e?void 0:e.limetype)?this.context:(null===(t=this.resolvedContext)||void 0===t?void 0:t.limetype)?this.resolvedContext:T}get host(){return this}static get watchers(){return{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}}static get style(){return":host{display:block}.rule-editor--disabled{opacity:0.6;pointer-events:none}.rule-editor__label{font-size:0.75rem;font-weight:600;color:rgb(var(--contrast-1500));margin-bottom:0.25rem}.rule-editor__helper-text{font-size:0.75rem;color:rgb(var(--contrast-1300));margin-top:0.25rem}.rule-node{border:1px solid rgb(var(--contrast-500));border-radius:0.5rem;margin:0.25rem 0;overflow:hidden;background-color:rgb(var(--contrast-100))}.rule-node--invalid{border-color:rgb(var(--color-red-default))}.rule-node--all>.rule-node__header,.rule-node--any>.rule-node__header{background-color:rgb(var(--contrast-300));padding:0.375rem 0.75rem;border-bottom:1px solid rgb(var(--contrast-500))}.rule-node__header{display:flex;align-items:center;gap:0.5rem}.rule-node__header-actions{margin-left:auto;display:grid;grid-auto-flow:column;grid-gap:0.5rem;padding:0.125rem;align-items:center}.rule-node__combinator-select{min-width:6rem}.rule-node__body{padding:0.75rem;display:flex;flex-direction:column;gap:0.75rem}limel-popover.rule-node__chips-popover{display:contents;--popover-surface-width:min(calc(100vw - 4rem), 50rem)}.rule-node__chips{display:block;width:100%}.rule-node__chips limel-picker{display:block;width:100%}.rule-node__children{display:flex;flex-direction:column;gap:0.5rem}.rule-node__footer{display:flex;justify-content:center}.rule-node__issue{color:rgb(var(--color-red-default));font-size:0.875rem}"}},[1,"limebb-rule-editor",{platform:[16],context:[16],value:[16],availableContexts:[16],required:[516],readonly:[516],disabled:[516],label:[513],helperText:[1,"helper-text"],resolvedContext:[32],issues:[32],openChipPath:[32],availablePrimitiveOptions:[32]},void 0,{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}]);!function(e,t,n,r){var i,l=arguments.length,o=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(l<3?i(o):l>3?i(t,n,o):i(t,n))||o);l>3&&o&&Object.defineProperty(t,n,o)}([l("context")],L.prototype,"resolvedContext",void 0);const T=Object.freeze({limetype:null,id:null}),q=L,F=function(){"undefined"!=typeof customElements&&["limebb-rule-editor","limebb-rule-chip-popover"].forEach((e=>{switch(e){case"limebb-rule-editor":customElements.get(i(e))||customElements.define(i(e),L);break;case"limebb-rule-chip-popover":customElements.get(i(e))||s()}}))};export{q as LimebbRuleEditor,F as defineCustomElement}
@@ -1 +1 @@
1
- import{proxyCustomElement as e,HTMLElement as t,createEvent as o,h as i,transformTag as r}from"@stencil/core/internal/client";import{T as s,b as l}from"./index.esm.js";import{L as n}from"./web-component-template.js";const a=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.negate=o(this,"negate",7),this.updateArgs=o(this,"updateArgs",7),this.deleteChip=o(this,"deleteChip",7),this.isNegated=!1,this.readonly=!1,this.disabled=!1,this.isMutable=!0,this.handleNegateChange=e=>{e.stopPropagation(),this.negate.emit(e.detail)},this.handleArgsChange=e=>{e.stopPropagation(),this.updateArgs.emit(e.detail)},this.handleDelete=()=>{this.deleteChip.emit()}}render(){return i("div",{key:"ca7901be2a99590faddea0c678d149b13b5d564f",class:"popover"},this.renderHeader(),this.renderBody())}renderHeader(){var e,t,o,r;const s=(null===(e=this.metadata)||void 0===e?void 0:e.title)?this.translator.get(this.metadata.title):null!==(o=null===(t=this.refNode)||void 0===t?void 0:t.id)&&void 0!==o?o:"";return i("limel-header",{class:"popover__header is-narrow",heading:s,icon:null===(r=this.metadata)||void 0===r?void 0:r.icon},this.renderHeaderActions())}renderHeaderActions(){return this.isMutable?i("div",{slot:"actions",class:"popover__header-actions"},i("limel-switch",{class:"popover__negate-switch",label:this.translator.get("webclient.rule-editor.negate"),value:this.isNegated,onChange:this.handleNegateChange}),i("limel-icon-button",{class:"popover__delete-button",icon:"trash",label:this.translator.get("webclient.rule-editor.delete"),onClick:this.handleDelete})):null}get translator(){return this.platform.get(l.Translate)}renderBody(){var e,t;const o=null===(e=this.metadata)||void 0===e?void 0:e.configComponent;return o?i("div",{class:"popover__body"},i(n,{platform:this.platform,context:this.context,name:o.name,props:Object.assign(Object.assign({},o.props),{value:null===(t=this.refNode)||void 0===t?void 0:t.args,readonly:this.readonly,disabled:this.disabled,onChange:this.handleArgsChange})})):null}static get style(){return":host{display:block}.popover{display:flex;flex-direction:column;min-width:24rem;background-color:rgb(var(--contrast-100));border:1px solid rgb(var(--contrast-700));border-radius:0.5rem;box-shadow:0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);overflow:hidden}.popover__header{--header-background-color:rgba(var(--contrast-300));padding-right:0.5rem;gap:1rem}.popover__header-actions{display:grid;grid-auto-flow:column;grid-gap:0.75rem;padding:0.25rem;align-items:center}.popover__delete-button{color:rgb(var(--contrast-1100))}.popover__body{padding:1rem}"}},[1,"limebb-rule-chip-popover",{platform:[16],context:[16],refNode:[16],isNegated:[4,"is-negated"],metadata:[16],readonly:[4],disabled:[4],isMutable:[4,"is-mutable"]}]);function d(){"undefined"!=typeof customElements&&["limebb-rule-chip-popover"].forEach((e=>{"limebb-rule-chip-popover"===e&&(customElements.get(r(e))||customElements.define(r(e),a))}))}!function(e,t,o,i){var r,s=arguments.length,l=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,i);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(l=(s<3?r(l):s>3?r(t,o,l):r(t,o))||l);s>3&&l&&Object.defineProperty(t,o,l)}([s("context")],a.prototype,"context",void 0);export{a as R,d}
1
+ import{proxyCustomElement as e,HTMLElement as t,createEvent as o,h as i,transformTag as r}from"@stencil/core/internal/client";import{T as s,b as n}from"./index.esm.js";import{L as l}from"./web-component-template.js";const a=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.negate=o(this,"negate",7),this.updateArgs=o(this,"updateArgs",7),this.deleteChip=o(this,"deleteChip",7),this.isNegated=!1,this.readonly=!1,this.disabled=!1,this.isMutable=!0,this.focusOnOpen=!1,this.handleNegateChange=e=>{e.stopPropagation(),this.negate.emit(e.detail)},this.handleArgsChange=e=>{e.stopPropagation(),this.updateArgs.emit(e.detail)},this.handleDelete=()=>{this.deleteChip.emit()}}render(){return i("div",{key:"a395bf65b1868b0a440881f2c885c7bd9dc741d4",class:"popover"},this.renderHeader(),this.renderBody())}renderHeader(){var e,t,o,r;const s=(null===(e=this.metadata)||void 0===e?void 0:e.title)?this.translator.get(this.metadata.title):null!==(o=null===(t=this.refNode)||void 0===t?void 0:t.id)&&void 0!==o?o:"";return i("limel-header",{class:"popover__header is-narrow",heading:s,icon:null===(r=this.metadata)||void 0===r?void 0:r.icon},this.renderHeaderActions())}renderHeaderActions(){return this.isMutable?i("div",{slot:"actions",class:"popover__header-actions"},i("limel-switch",{class:"popover__negate-switch",label:this.translator.get("webclient.rule-editor.negate"),value:this.isNegated,onChange:this.handleNegateChange}),i("limel-icon-button",{class:"popover__delete-button",icon:"trash",label:this.translator.get("webclient.rule-editor.delete"),onClick:this.handleDelete})):null}get translator(){return this.platform.get(n.Translate)}renderBody(){var e,t;const o=null===(e=this.metadata)||void 0===e?void 0:e.configComponent;return o?i("div",{class:"popover__body"},i(l,{platform:this.platform,context:this.context,name:o.name,props:Object.assign(Object.assign({},o.props),{value:null===(t=this.refNode)||void 0===t?void 0:t.args,readonly:this.readonly,disabled:this.disabled,focusOnOpen:this.focusOnOpen,onChange:this.handleArgsChange})})):null}static get style(){return":host{display:block}.popover{display:flex;flex-direction:column;min-width:24rem;background-color:rgb(var(--contrast-100));border:1px solid rgb(var(--contrast-700));border-radius:0.5rem;box-shadow:0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);overflow:hidden}.popover__header{--header-background-color:rgba(var(--contrast-300));padding-right:0.5rem;gap:1rem}.popover__header-actions{display:grid;grid-auto-flow:column;grid-gap:0.75rem;padding:0.25rem;align-items:center}.popover__delete-button{color:rgb(var(--contrast-1100))}.popover__body{padding:1rem}"}},[1,"limebb-rule-chip-popover",{platform:[16],context:[16],refNode:[16],isNegated:[4,"is-negated"],metadata:[16],readonly:[4],disabled:[4],isMutable:[4,"is-mutable"],focusOnOpen:[4,"focus-on-open"]}]);function d(){"undefined"!=typeof customElements&&["limebb-rule-chip-popover"].forEach((e=>{"limebb-rule-chip-popover"===e&&(customElements.get(r(e))||customElements.define(r(e),a))}))}!function(e,t,o,i){var r,s=arguments.length,n=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,i);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(n=(s<3?r(n):s>3?r(t,o,n):r(t,o))||n);s>3&&n&&Object.defineProperty(t,o,n)}([s("context")],a.prototype,"context",void 0);export{a as R,d}
@@ -17,5 +17,5 @@ var patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(async (options) => {
19
19
  await globalScripts();
20
- return bootstrapLazy(JSON.parse("[[\"limebb-lime-query-builder\",[[1,\"limebb-lime-query-builder\",{\"platform\":[16],\"context\":[16],\"value\":[16],\"label\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"limetypes\":[32],\"mode\":[32],\"codeValue\":[32],\"limetype\":[32],\"filter\":[32],\"internalResponseFormat\":[32],\"limit\":[32],\"orderBy\":[32],\"description\":[32]}]]],[\"limebb-rule-arg-filter-editor\",[[1,\"limebb-rule-arg-filter-editor\",{\"platform\":[16],\"context\":[16],\"value\":[16],\"resolvedContext\":[32]}]]],[\"limebb-feed\",[[1,\"limebb-feed\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"emptyStateMessage\":[1,\"empty-state-message\"],\"heading\":[1],\"loading\":[4],\"minutesOfProximity\":[2,\"minutes-of-proximity\"],\"totalCount\":[2,\"total-count\"],\"direction\":[513],\"lastVisitedTimestamp\":[1,\"last-visited-timestamp\"],\"highlightedItemId\":[8,\"highlighted-item-id\"]},null,{\"highlightedItemId\":[{\"highlightedItemIdChanged\":0}]}]]],[\"limebb-kanban\",[[1,\"limebb-kanban\",{\"platform\":[16],\"context\":[16],\"groups\":[16]}]]],[\"limebb-chat-list\",[[1,\"limebb-chat-list\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"loading\":[516],\"isTypingIndicatorVisible\":[516,\"is-typing-indicator-visible\"],\"lastVisitedTimestamp\":[513,\"last-visited-timestamp\"],\"order\":[513]},null,{\"items\":[{\"handleItemsChange\":0}],\"order\":[{\"handleItemsChange\":0}]}]]],[\"limebb-lime-query-response-format-builder\",[[1,\"limebb-lime-query-response-format-builder\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"value\":[16],\"label\":[1],\"helperText\":[1,\"helper-text\"],\"limetypes\":[32],\"mode\":[32],\"codeValue\":[32],\"internalValue\":[32]}]]],[\"limebb-document-chips\",[[1,\"limebb-document-chips\",{\"accessibleLabel\":[513,\"accessible-label\"],\"files\":[16]},null,{\"files\":[{\"onFilesChanged\":0}]}]]],[\"limebb-limeobject-file-viewer\",[[1,\"limebb-limeobject-file-viewer\",{\"platform\":[16],\"context\":[16],\"property\":[1],\"fileTypes\":[16],\"limeobject\":[32],\"limetype\":[32]}]]],[\"limebb-text-editor\",[[17,\"limebb-text-editor\",{\"platform\":[16],\"context\":[16],\"allowMentioning\":[4,\"allow-mentioning\"],\"contentType\":[1,\"content-type\"],\"language\":[513],\"disabled\":[516],\"readonly\":[516],\"helperText\":[513,\"helper-text\"],\"placeholder\":[513],\"label\":[513],\"invalid\":[516],\"required\":[516],\"selectedContext\":[16],\"ui\":[513],\"allowResize\":[4,\"allow-resize\"],\"value\":[1],\"draftIdentifier\":[1,\"draft-identifier\"],\"triggerMap\":[16],\"customElements\":[16],\"allowInlineImages\":[4,\"allow-inline-images\"],\"items\":[32],\"highlightedItemIndex\":[32],\"editorPickerQuery\":[32],\"searchableLimetypes\":[32],\"isPickerOpen\":[32],\"isSearching\":[32]},null,{\"isPickerOpen\":[{\"watchOpen\":0}],\"editorPickerQuery\":[{\"watchQuery\":0}]}]]],[\"limebb-data-cells\",[[1,\"limebb-data-cells\",{\"platform\":[16],\"context\":[16],\"limeobject\":[8],\"items\":[16],\"image\":[16],\"relativeDates\":[4,\"relative-dates\"]}]]],[\"limebb-date-range\",[[1,\"limebb-date-range\",{\"platform\":[16],\"context\":[16],\"startTime\":[16],\"endTime\":[16],\"startTimeLabel\":[1,\"start-time-label\"],\"endTimeLabel\":[1,\"end-time-label\"],\"language\":[1],\"timeFormat\":[1,\"time-format\"],\"type\":[1]}]]],[\"limebb-document-picker\",[[1,\"limebb-document-picker\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"invalid\":[516],\"required\":[516],\"type\":[513]}]]],[\"limebb-info-tile-currency-format\",[[1,\"limebb-info-tile-currency-format\",{\"platform\":[16],\"context\":[16],\"value\":[16]}]]],[\"limebb-notification-list\",[[1,\"limebb-notification-list\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"loading\":[4],\"lastVisitedTimestamp\":[1,\"last-visited-timestamp\"]},null,{\"items\":[{\"handleItemsChange\":0}]}]]],[\"limebb-rule-editor\",[[1,\"limebb-rule-editor\",{\"platform\":[16],\"context\":[16],\"value\":[16],\"availableContexts\":[16],\"required\":[516],\"readonly\":[516],\"disabled\":[516],\"label\":[513],\"helperText\":[1,\"helper-text\"],\"resolvedContext\":[32],\"issues\":[32],\"openChipPath\":[32],\"availablePrimitiveOptions\":[32]},null,{\"value\":[{\"onValueChange\":0}],\"availableContexts\":[{\"onAvailableContextsChange\":0}]}]]],[\"limebb-alert-dialog\",[[257,\"limebb-alert-dialog\",{\"type\":[513],\"open\":[516],\"icon\":[513],\"heading\":[513],\"subheading\":[1]}]]],[\"limebb-browser\",[[17,\"limebb-browser\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"layout\":[1],\"filter\":[32]}]]],[\"limebb-color-palette-picker\",[[1,\"limebb-color-palette-picker\",{\"value\":[513],\"required\":[516],\"readonly\":[516],\"invalid\":[516],\"disabled\":[516],\"label\":[513],\"helperText\":[1,\"helper-text\"]}]]],[\"limebb-color-palette-swatches\",[[1,\"limebb-color-palette-swatches\",{\"colors\":[16]}]]],[\"limebb-component-config\",[[1,\"limebb-component-config\",{\"platform\":[16],\"context\":[16],\"value\":[16],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"label\":[1],\"helperText\":[1,\"helper-text\"],\"formInfo\":[16],\"type\":[1],\"nameField\":[1,\"name-field\"],\"configComponent\":[32],\"configViewType\":[32]},null,{\"formInfo\":[{\"watchFormInfo\":0}],\"configComponent\":[{\"watchconfigComponent\":0}]}]]],[\"limebb-component-picker\",[[1,\"limebb-component-picker\",{\"platform\":[16],\"context\":[16],\"type\":[1],\"tags\":[16],\"value\":[1],\"copyLabel\":[1,\"copy-label\"],\"hideCopyButton\":[4,\"hide-copy-button\"],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"label\":[1],\"helperText\":[1,\"helper-text\"]}]]],[\"limebb-composer-toolbar\",[[257,\"limebb-composer-toolbar\",{\"platform\":[16],\"mentions\":[516],\"textSnippets\":[516,\"text-snippets\"],\"internalLinks\":[516,\"internal-links\"],\"richText\":[516,\"rich-text\"],\"fileInput\":[16]}]]],[\"limebb-dashboard-widget\",[[257,\"limebb-dashboard-widget\",{\"heading\":[513],\"subheading\":[513],\"supportingText\":[513,\"supporting-text\"],\"icon\":[513]}]]],[\"limebb-icon-picker\",[[1,\"limebb-icon-picker\",{\"value\":[1],\"required\":[4],\"readonly\":[4],\"invalid\":[4],\"disabled\":[4],\"label\":[1],\"helperText\":[1,\"helper-text\"]}]]],[\"limebb-info-tile\",[[1,\"limebb-info-tile\",{\"platform\":[16],\"context\":[16],\"filterId\":[513,\"filter-id\"],\"disabled\":[4],\"icon\":[513],\"label\":[1],\"prefix\":[1],\"suffix\":[1],\"propertyName\":[1,\"property-name\"],\"aggregateOperator\":[1,\"aggregate-operator\"],\"format\":[16],\"config\":[32],\"filters\":[32],\"value\":[32],\"loading\":[32],\"error\":[32],\"limetypes\":[32]},null,{\"filterId\":[{\"watchFilterId\":0}],\"propertyName\":[{\"watchPropertyName\":0}],\"aggregateOperator\":[{\"watchAggregateOperator\":0}]}]]],[\"limebb-info-tile-date-format\",[[1,\"limebb-info-tile-date-format\",{\"value\":[16]}]]],[\"limebb-info-tile-decimal-format\",[[1,\"limebb-info-tile-decimal-format\",{\"value\":[16]}]]],[\"limebb-info-tile-format\",[[1,\"limebb-info-tile-format\",{\"platform\":[16],\"context\":[16],\"type\":[1],\"value\":[16]}]]],[\"limebb-info-tile-relative-date-format\",[[1,\"limebb-info-tile-relative-date-format\",{\"value\":[16]}]]],[\"limebb-info-tile-unit-format\",[[1,\"limebb-info-tile-unit-format\",{\"value\":[16]}]]],[\"limebb-loader\",[[1,\"limebb-loader\",{\"platform\":[16],\"context\":[16]}]]],[\"limebb-locale-picker\",[[1,\"limebb-locale-picker\",{\"platform\":[16],\"context\":[16],\"value\":[1],\"required\":[4],\"disabled\":[4],\"label\":[1],\"helperText\":[1,\"helper-text\"],\"readonly\":[4],\"multipleChoice\":[4,\"multiple-choice\"],\"allLanguages\":[32]}]]],[\"limebb-mention\",[[257,\"limebb-mention\",{\"limetype\":[1],\"objectid\":[2],\"limeobject\":[32]}]]],[\"limebb-mention-group-counter\",[[1,\"limebb-mention-group-counter\",{\"count\":[2],\"limetype\":[16],\"helperLabel\":[1,\"helper-label\"]}]]],[\"limebb-object-chip\",[[1,\"limebb-object-chip\",{\"limetype\":[1],\"objectid\":[2],\"size\":[1],\"platform\":[16],\"data\":[32]},null,{\"limetype\":[{\"handlePropChange\":0}],\"objectid\":[{\"handlePropChange\":0}]}]]],[\"limebb-rule-gate\",[[257,\"limebb-rule-gate\",{\"platform\":[16],\"rule\":[16],\"scope\":[16],\"shouldRender\":[32]},null,{\"rule\":[{\"onRuleChange\":0}],\"scope\":[{\"onScopeChange\":0}]}]]],[\"limebb-trend-indicator\",[[1,\"limebb-trend-indicator\",{\"platform\":[16],\"context\":[16],\"value\":[520],\"formerValue\":[514,\"former-value\"],\"suffix\":[513],\"label\":[513],\"invalid\":[516],\"required\":[516],\"helperText\":[513,\"helper-text\"],\"reducePresence\":[516,\"reduce-presence\"]},null,{\"value\":[{\"valueChanged\":0}]}]]],[\"limebb-currency-picker\",[[1,\"limebb-currency-picker\",{\"platform\":[16],\"context\":[16],\"label\":[513],\"currencies\":[16],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"readonly\":[516],\"invalid\":[516],\"disabled\":[516],\"value\":[1]}]]],[\"limebb-feed-item-thumbnail-file-info\",[[1,\"limebb-feed-item-thumbnail-file-info\",{\"description\":[1]}]]],[\"limebb-feed-timeline-item\",[[1,\"limebb-feed-timeline-item\",{\"platform\":[16],\"context\":[16],\"item\":[16],\"ui\":[513],\"helperText\":[1,\"helper-text\"],\"hasError\":[516,\"has-error\"],\"isBundled\":[516,\"is-bundled\"],\"headingCanExpand\":[32],\"isHeadingExpanded\":[32],\"showMore\":[32],\"isTall\":[32]}]]],[\"limebb-kanban-group\",[[1,\"limebb-kanban-group\",{\"platform\":[16],\"context\":[16],\"identifier\":[1],\"heading\":[513],\"help\":[1],\"items\":[16],\"summary\":[1],\"loading\":[516],\"totalCount\":[514,\"total-count\"]}]]],[\"limebb-document-item\",[[17,\"limebb-document-item\",{\"platform\":[16],\"context\":[16],\"item\":[16],\"type\":[513],\"fileTypes\":[16]}]]],[\"limebb-empty-state\",[[1,\"limebb-empty-state\",{\"heading\":[513],\"value\":[513],\"icon\":[16]}]]],[\"limebb-text-editor-picker\",[[1,\"limebb-text-editor-picker\",{\"items\":[16],\"open\":[516],\"isSearching\":[4,\"is-searching\"],\"emptyMessage\":[1,\"empty-message\"]},null,{\"open\":[{\"watchOpen\":0}]}]]],[\"limebb-date-picker\",[[1,\"limebb-date-picker\",{\"platform\":[16],\"context\":[16],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"value\":[1],\"type\":[513]}]]],[\"limebb-live-docs-info\",[[1,\"limebb-live-docs-info\"]]],[\"limebb-notification-item\",[[1,\"limebb-notification-item\",{\"platform\":[16],\"context\":[16],\"item\":[16]}]]],[\"limebb-percentage-visualizer\",[[1,\"limebb-percentage-visualizer\",{\"platform\":[16],\"context\":[16],\"value\":[520],\"rangeMax\":[514,\"range-max\"],\"rangeMin\":[514,\"range-min\"],\"multiplier\":[514],\"label\":[513],\"invalid\":[516],\"required\":[516],\"helperText\":[513,\"helper-text\"],\"reducePresence\":[516,\"reduce-presence\"],\"displayPercentageColors\":[516,\"display-percentage-colors\"]},null,{\"value\":[{\"valueChanged\":0}]}]]],[\"limebb-rule-chip-popover\",[[1,\"limebb-rule-chip-popover\",{\"platform\":[16],\"context\":[16],\"refNode\":[16],\"isNegated\":[4,\"is-negated\"],\"metadata\":[16],\"readonly\":[4],\"disabled\":[4],\"isMutable\":[4,\"is-mutable\"]}]]],[\"limebb-lime-query-filter-builder\",[[1,\"limebb-lime-query-filter-builder\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}]]],[\"limebb-kanban-item\",[[257,\"limebb-kanban-item\",{\"platform\":[16],\"context\":[16],\"item\":[16]}]]],[\"limebb-property-selector\",[[17,\"limebb-property-selector\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"value\":[1],\"label\":[1],\"required\":[4],\"helperText\":[1,\"helper-text\"],\"limetypes\":[32],\"isOpen\":[32],\"navigationPath\":[32]}]]],[\"limebb-lime-query-order-by-item\",[[1,\"limebb-lime-query-order-by-item\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"item\":[16]}]]],[\"limebb-lime-query-order-by-editor_2\",[[1,\"limebb-lime-query-order-by-editor\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"value\":[16],\"label\":[1],\"items\":[32]},null,{\"value\":[{\"handleValueChange\":0}]}],[0,\"limebb-limetype-field\",{\"platform\":[16],\"context\":[16],\"label\":[513],\"required\":[516],\"readonly\":[516],\"disabled\":[516],\"value\":[513],\"helperText\":[513,\"helper-text\"],\"invalid\":[4],\"limetypes\":[16],\"propertyFields\":[16],\"fieldName\":[1,\"field-name\"],\"formInfo\":[16]}]]],[\"limebb-chat-icon-list_3\",[[1,\"limebb-chat-icon-list\",{\"item\":[16]}],[1,\"limebb-chat-item\",{\"platform\":[16],\"context\":[16],\"item\":[16],\"helperText\":[1,\"helper-text\"],\"hasError\":[516,\"has-error\"]}],[1,\"limebb-typing-indicator\"]]],[\"limebb-lime-query-response-format-editor_2\",[[1,\"limebb-lime-query-response-format-editor\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"value\":[16],\"label\":[1],\"items\":[32]}],[1,\"limebb-lime-query-response-format-item\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"item\":[16],\"showAliasInput\":[32],\"showDescriptionInput\":[32]}]]],[\"limebb-lime-query-filter-comparison_2\",[[2,\"limebb-lime-query-filter-expression\",{\"platform\":[16],\"context\":[16],\"label\":[1],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}],[1,\"limebb-lime-query-filter-comparison\",{\"platform\":[16],\"context\":[16],\"label\":[513],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16],\"isOpen\":[32]}]]],[\"limebb-navigation-button_2\",[[257,\"limebb-summary-popover\",{\"triggerDelay\":[514,\"trigger-delay\"],\"heading\":[513],\"subheading\":[513],\"image\":[16],\"file\":[16],\"icon\":[513],\"value\":[1],\"openDirection\":[513,\"open-direction\"],\"popoverMaxWidth\":[513,\"popover-max-width\"],\"popoverMaxHeight\":[513,\"popover-max-height\"],\"actions\":[16],\"isPopoverOpen\":[32]}],[17,\"limebb-navigation-button\",{\"href\":[513],\"tooltipLabel\":[513,\"tooltip-label\"],\"tooltipHelperLabel\":[513,\"tooltip-helper-label\"],\"type\":[513]}]]],[\"limebb-lime-query-filter-comparison-editor_4\",[[17,\"limebb-lime-query-filter-comparison-editor\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}],[1,\"limebb-lime-query-filter-group\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}],[1,\"limebb-lime-query-filter-not\",{\"platform\":[16],\"context\":[16],\"label\":[1],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}],[1,\"limebb-lime-query-value-input\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"propertyPath\":[1,\"property-path\"],\"operator\":[1],\"value\":[8],\"label\":[1],\"limetypes\":[32],\"inputMode\":[32]}]]]]"), options);
20
+ return bootstrapLazy(JSON.parse("[[\"limebb-lime-query-builder\",[[1,\"limebb-lime-query-builder\",{\"platform\":[16],\"context\":[16],\"value\":[16],\"label\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"limetypes\":[32],\"mode\":[32],\"codeValue\":[32],\"limetype\":[32],\"filter\":[32],\"internalResponseFormat\":[32],\"limit\":[32],\"orderBy\":[32],\"description\":[32]}]]],[\"limebb-rule-arg-filter-editor\",[[1,\"limebb-rule-arg-filter-editor\",{\"platform\":[16],\"context\":[16],\"value\":[16],\"resolvedContext\":[32]}]]],[\"limebb-feed\",[[1,\"limebb-feed\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"emptyStateMessage\":[1,\"empty-state-message\"],\"heading\":[1],\"loading\":[4],\"minutesOfProximity\":[2,\"minutes-of-proximity\"],\"totalCount\":[2,\"total-count\"],\"direction\":[513],\"lastVisitedTimestamp\":[1,\"last-visited-timestamp\"],\"highlightedItemId\":[8,\"highlighted-item-id\"]},null,{\"highlightedItemId\":[{\"highlightedItemIdChanged\":0}]}]]],[\"limebb-kanban\",[[1,\"limebb-kanban\",{\"platform\":[16],\"context\":[16],\"groups\":[16]}]]],[\"limebb-chat-list\",[[1,\"limebb-chat-list\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"loading\":[516],\"isTypingIndicatorVisible\":[516,\"is-typing-indicator-visible\"],\"lastVisitedTimestamp\":[513,\"last-visited-timestamp\"],\"order\":[513]},null,{\"items\":[{\"handleItemsChange\":0}],\"order\":[{\"handleItemsChange\":0}]}]]],[\"limebb-lime-query-response-format-builder\",[[1,\"limebb-lime-query-response-format-builder\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"value\":[16],\"label\":[1],\"helperText\":[1,\"helper-text\"],\"limetypes\":[32],\"mode\":[32],\"codeValue\":[32],\"internalValue\":[32]}]]],[\"limebb-document-chips\",[[1,\"limebb-document-chips\",{\"accessibleLabel\":[513,\"accessible-label\"],\"files\":[16]},null,{\"files\":[{\"onFilesChanged\":0}]}]]],[\"limebb-limeobject-file-viewer\",[[1,\"limebb-limeobject-file-viewer\",{\"platform\":[16],\"context\":[16],\"property\":[1],\"fileTypes\":[16],\"limeobject\":[32],\"limetype\":[32]}]]],[\"limebb-text-editor\",[[17,\"limebb-text-editor\",{\"platform\":[16],\"context\":[16],\"allowMentioning\":[4,\"allow-mentioning\"],\"contentType\":[1,\"content-type\"],\"language\":[513],\"disabled\":[516],\"readonly\":[516],\"helperText\":[513,\"helper-text\"],\"placeholder\":[513],\"label\":[513],\"invalid\":[516],\"required\":[516],\"selectedContext\":[16],\"ui\":[513],\"allowResize\":[4,\"allow-resize\"],\"value\":[1],\"draftIdentifier\":[1,\"draft-identifier\"],\"triggerMap\":[16],\"customElements\":[16],\"allowInlineImages\":[4,\"allow-inline-images\"],\"items\":[32],\"highlightedItemIndex\":[32],\"editorPickerQuery\":[32],\"searchableLimetypes\":[32],\"isPickerOpen\":[32],\"isSearching\":[32]},null,{\"isPickerOpen\":[{\"watchOpen\":0}],\"editorPickerQuery\":[{\"watchQuery\":0}]}]]],[\"limebb-data-cells\",[[1,\"limebb-data-cells\",{\"platform\":[16],\"context\":[16],\"limeobject\":[8],\"items\":[16],\"image\":[16],\"relativeDates\":[4,\"relative-dates\"]}]]],[\"limebb-date-range\",[[1,\"limebb-date-range\",{\"platform\":[16],\"context\":[16],\"startTime\":[16],\"endTime\":[16],\"startTimeLabel\":[1,\"start-time-label\"],\"endTimeLabel\":[1,\"end-time-label\"],\"language\":[1],\"timeFormat\":[1,\"time-format\"],\"type\":[1]}]]],[\"limebb-document-picker\",[[1,\"limebb-document-picker\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"invalid\":[516],\"required\":[516],\"type\":[513]}]]],[\"limebb-info-tile-currency-format\",[[1,\"limebb-info-tile-currency-format\",{\"platform\":[16],\"context\":[16],\"value\":[16]}]]],[\"limebb-notification-list\",[[1,\"limebb-notification-list\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"loading\":[4],\"lastVisitedTimestamp\":[1,\"last-visited-timestamp\"]},null,{\"items\":[{\"handleItemsChange\":0}]}]]],[\"limebb-rule-editor\",[[1,\"limebb-rule-editor\",{\"platform\":[16],\"context\":[16],\"value\":[16],\"availableContexts\":[16],\"required\":[516],\"readonly\":[516],\"disabled\":[516],\"label\":[513],\"helperText\":[1,\"helper-text\"],\"resolvedContext\":[32],\"issues\":[32],\"openChipPath\":[32],\"availablePrimitiveOptions\":[32]},null,{\"value\":[{\"onValueChange\":0}],\"availableContexts\":[{\"onAvailableContextsChange\":0}]}]]],[\"limebb-alert-dialog\",[[257,\"limebb-alert-dialog\",{\"type\":[513],\"open\":[516],\"icon\":[513],\"heading\":[513],\"subheading\":[1]}]]],[\"limebb-browser\",[[17,\"limebb-browser\",{\"platform\":[16],\"context\":[16],\"items\":[16],\"layout\":[1],\"filter\":[32]}]]],[\"limebb-color-palette-picker\",[[1,\"limebb-color-palette-picker\",{\"value\":[513],\"required\":[516],\"readonly\":[516],\"invalid\":[516],\"disabled\":[516],\"label\":[513],\"helperText\":[1,\"helper-text\"]}]]],[\"limebb-color-palette-swatches\",[[1,\"limebb-color-palette-swatches\",{\"colors\":[16]}]]],[\"limebb-component-config\",[[1,\"limebb-component-config\",{\"platform\":[16],\"context\":[16],\"value\":[16],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"label\":[1],\"helperText\":[1,\"helper-text\"],\"formInfo\":[16],\"type\":[1],\"nameField\":[1,\"name-field\"],\"configComponent\":[32],\"configViewType\":[32]},null,{\"formInfo\":[{\"watchFormInfo\":0}],\"configComponent\":[{\"watchconfigComponent\":0}]}]]],[\"limebb-component-picker\",[[1,\"limebb-component-picker\",{\"platform\":[16],\"context\":[16],\"type\":[1],\"tags\":[16],\"value\":[1],\"copyLabel\":[1,\"copy-label\"],\"hideCopyButton\":[4,\"hide-copy-button\"],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"label\":[1],\"helperText\":[1,\"helper-text\"]}]]],[\"limebb-composer-toolbar\",[[257,\"limebb-composer-toolbar\",{\"platform\":[16],\"mentions\":[516],\"textSnippets\":[516,\"text-snippets\"],\"internalLinks\":[516,\"internal-links\"],\"richText\":[516,\"rich-text\"],\"fileInput\":[16]}]]],[\"limebb-dashboard-widget\",[[257,\"limebb-dashboard-widget\",{\"heading\":[513],\"subheading\":[513],\"supportingText\":[513,\"supporting-text\"],\"icon\":[513]}]]],[\"limebb-icon-picker\",[[1,\"limebb-icon-picker\",{\"value\":[1],\"required\":[4],\"readonly\":[4],\"invalid\":[4],\"disabled\":[4],\"label\":[1],\"helperText\":[1,\"helper-text\"]}]]],[\"limebb-info-tile\",[[1,\"limebb-info-tile\",{\"platform\":[16],\"context\":[16],\"filterId\":[513,\"filter-id\"],\"disabled\":[4],\"icon\":[513],\"label\":[1],\"prefix\":[1],\"suffix\":[1],\"propertyName\":[1,\"property-name\"],\"aggregateOperator\":[1,\"aggregate-operator\"],\"format\":[16],\"config\":[32],\"filters\":[32],\"value\":[32],\"loading\":[32],\"error\":[32],\"limetypes\":[32]},null,{\"filterId\":[{\"watchFilterId\":0}],\"propertyName\":[{\"watchPropertyName\":0}],\"aggregateOperator\":[{\"watchAggregateOperator\":0}]}]]],[\"limebb-info-tile-date-format\",[[1,\"limebb-info-tile-date-format\",{\"value\":[16]}]]],[\"limebb-info-tile-decimal-format\",[[1,\"limebb-info-tile-decimal-format\",{\"value\":[16]}]]],[\"limebb-info-tile-format\",[[1,\"limebb-info-tile-format\",{\"platform\":[16],\"context\":[16],\"type\":[1],\"value\":[16]}]]],[\"limebb-info-tile-relative-date-format\",[[1,\"limebb-info-tile-relative-date-format\",{\"value\":[16]}]]],[\"limebb-info-tile-unit-format\",[[1,\"limebb-info-tile-unit-format\",{\"value\":[16]}]]],[\"limebb-loader\",[[1,\"limebb-loader\",{\"platform\":[16],\"context\":[16]}]]],[\"limebb-locale-picker\",[[1,\"limebb-locale-picker\",{\"platform\":[16],\"context\":[16],\"value\":[1],\"required\":[4],\"disabled\":[4],\"label\":[1],\"helperText\":[1,\"helper-text\"],\"readonly\":[4],\"multipleChoice\":[4,\"multiple-choice\"],\"allLanguages\":[32]}]]],[\"limebb-mention\",[[257,\"limebb-mention\",{\"limetype\":[1],\"objectid\":[2],\"limeobject\":[32]}]]],[\"limebb-mention-group-counter\",[[1,\"limebb-mention-group-counter\",{\"count\":[2],\"limetype\":[16],\"helperLabel\":[1,\"helper-label\"]}]]],[\"limebb-object-chip\",[[1,\"limebb-object-chip\",{\"limetype\":[1],\"objectid\":[2],\"size\":[1],\"platform\":[16],\"data\":[32]},null,{\"limetype\":[{\"handlePropChange\":0}],\"objectid\":[{\"handlePropChange\":0}]}]]],[\"limebb-rule-gate\",[[257,\"limebb-rule-gate\",{\"platform\":[16],\"rule\":[16],\"scope\":[16],\"shouldRender\":[32]},null,{\"rule\":[{\"onRuleChange\":0}],\"scope\":[{\"onScopeChange\":0}]}]]],[\"limebb-trend-indicator\",[[1,\"limebb-trend-indicator\",{\"platform\":[16],\"context\":[16],\"value\":[520],\"formerValue\":[514,\"former-value\"],\"suffix\":[513],\"label\":[513],\"invalid\":[516],\"required\":[516],\"helperText\":[513,\"helper-text\"],\"reducePresence\":[516,\"reduce-presence\"]},null,{\"value\":[{\"valueChanged\":0}]}]]],[\"limebb-currency-picker\",[[1,\"limebb-currency-picker\",{\"platform\":[16],\"context\":[16],\"label\":[513],\"currencies\":[16],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"readonly\":[516],\"invalid\":[516],\"disabled\":[516],\"value\":[1]}]]],[\"limebb-feed-item-thumbnail-file-info\",[[1,\"limebb-feed-item-thumbnail-file-info\",{\"description\":[1]}]]],[\"limebb-feed-timeline-item\",[[1,\"limebb-feed-timeline-item\",{\"platform\":[16],\"context\":[16],\"item\":[16],\"ui\":[513],\"helperText\":[1,\"helper-text\"],\"hasError\":[516,\"has-error\"],\"isBundled\":[516,\"is-bundled\"],\"headingCanExpand\":[32],\"isHeadingExpanded\":[32],\"showMore\":[32],\"isTall\":[32]}]]],[\"limebb-kanban-group\",[[1,\"limebb-kanban-group\",{\"platform\":[16],\"context\":[16],\"identifier\":[1],\"heading\":[513],\"help\":[1],\"items\":[16],\"summary\":[1],\"loading\":[516],\"totalCount\":[514,\"total-count\"]}]]],[\"limebb-document-item\",[[17,\"limebb-document-item\",{\"platform\":[16],\"context\":[16],\"item\":[16],\"type\":[513],\"fileTypes\":[16]}]]],[\"limebb-empty-state\",[[1,\"limebb-empty-state\",{\"heading\":[513],\"value\":[513],\"icon\":[16]}]]],[\"limebb-text-editor-picker\",[[1,\"limebb-text-editor-picker\",{\"items\":[16],\"open\":[516],\"isSearching\":[4,\"is-searching\"],\"emptyMessage\":[1,\"empty-message\"]},null,{\"open\":[{\"watchOpen\":0}]}]]],[\"limebb-date-picker\",[[1,\"limebb-date-picker\",{\"platform\":[16],\"context\":[16],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"value\":[1],\"type\":[513]}]]],[\"limebb-live-docs-info\",[[1,\"limebb-live-docs-info\"]]],[\"limebb-notification-item\",[[1,\"limebb-notification-item\",{\"platform\":[16],\"context\":[16],\"item\":[16]}]]],[\"limebb-percentage-visualizer\",[[1,\"limebb-percentage-visualizer\",{\"platform\":[16],\"context\":[16],\"value\":[520],\"rangeMax\":[514,\"range-max\"],\"rangeMin\":[514,\"range-min\"],\"multiplier\":[514],\"label\":[513],\"invalid\":[516],\"required\":[516],\"helperText\":[513,\"helper-text\"],\"reducePresence\":[516,\"reduce-presence\"],\"displayPercentageColors\":[516,\"display-percentage-colors\"]},null,{\"value\":[{\"valueChanged\":0}]}]]],[\"limebb-rule-chip-popover\",[[1,\"limebb-rule-chip-popover\",{\"platform\":[16],\"context\":[16],\"refNode\":[16],\"isNegated\":[4,\"is-negated\"],\"metadata\":[16],\"readonly\":[4],\"disabled\":[4],\"isMutable\":[4,\"is-mutable\"],\"focusOnOpen\":[4,\"focus-on-open\"]}]]],[\"limebb-lime-query-filter-builder\",[[1,\"limebb-lime-query-filter-builder\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}]]],[\"limebb-kanban-item\",[[257,\"limebb-kanban-item\",{\"platform\":[16],\"context\":[16],\"item\":[16]}]]],[\"limebb-property-selector\",[[17,\"limebb-property-selector\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"value\":[1],\"label\":[1],\"required\":[4],\"helperText\":[1,\"helper-text\"],\"limetypes\":[32],\"isOpen\":[32],\"navigationPath\":[32]}]]],[\"limebb-lime-query-order-by-item\",[[1,\"limebb-lime-query-order-by-item\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"item\":[16]}]]],[\"limebb-lime-query-order-by-editor_2\",[[1,\"limebb-lime-query-order-by-editor\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"value\":[16],\"label\":[1],\"items\":[32]},null,{\"value\":[{\"handleValueChange\":0}]}],[0,\"limebb-limetype-field\",{\"platform\":[16],\"context\":[16],\"label\":[513],\"required\":[516],\"readonly\":[516],\"disabled\":[516],\"value\":[513],\"helperText\":[513,\"helper-text\"],\"invalid\":[4],\"limetypes\":[16],\"propertyFields\":[16],\"fieldName\":[1,\"field-name\"],\"formInfo\":[16]}]]],[\"limebb-chat-icon-list_3\",[[1,\"limebb-chat-icon-list\",{\"item\":[16]}],[1,\"limebb-chat-item\",{\"platform\":[16],\"context\":[16],\"item\":[16],\"helperText\":[1,\"helper-text\"],\"hasError\":[516,\"has-error\"]}],[1,\"limebb-typing-indicator\"]]],[\"limebb-lime-query-response-format-editor_2\",[[1,\"limebb-lime-query-response-format-editor\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"value\":[16],\"label\":[1],\"items\":[32]}],[1,\"limebb-lime-query-response-format-item\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"item\":[16],\"showAliasInput\":[32],\"showDescriptionInput\":[32]}]]],[\"limebb-lime-query-filter-comparison_2\",[[2,\"limebb-lime-query-filter-expression\",{\"platform\":[16],\"context\":[16],\"label\":[1],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}],[1,\"limebb-lime-query-filter-comparison\",{\"platform\":[16],\"context\":[16],\"label\":[513],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16],\"isOpen\":[32]}]]],[\"limebb-navigation-button_2\",[[257,\"limebb-summary-popover\",{\"triggerDelay\":[514,\"trigger-delay\"],\"heading\":[513],\"subheading\":[513],\"image\":[16],\"file\":[16],\"icon\":[513],\"value\":[1],\"openDirection\":[513,\"open-direction\"],\"popoverMaxWidth\":[513,\"popover-max-width\"],\"popoverMaxHeight\":[513,\"popover-max-height\"],\"actions\":[16],\"isPopoverOpen\":[32]}],[17,\"limebb-navigation-button\",{\"href\":[513],\"tooltipLabel\":[513,\"tooltip-label\"],\"tooltipHelperLabel\":[513,\"tooltip-helper-label\"],\"type\":[513]}]]],[\"limebb-lime-query-filter-comparison-editor_4\",[[17,\"limebb-lime-query-filter-comparison-editor\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}],[1,\"limebb-lime-query-filter-group\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}],[1,\"limebb-lime-query-filter-not\",{\"platform\":[16],\"context\":[16],\"label\":[1],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"expression\":[16]}],[1,\"limebb-lime-query-value-input\",{\"platform\":[16],\"context\":[16],\"limetype\":[1],\"activeLimetype\":[1,\"active-limetype\"],\"propertyPath\":[1,\"property-path\"],\"operator\":[1],\"value\":[8],\"label\":[1],\"limetypes\":[32],\"inputMode\":[32]}]]]]"), options);
21
21
  });
@@ -45,9 +45,19 @@ const LIMEOBJECT_MATCHES_FILTER_ID = 'limetech.limeobject-matches-filter';
45
45
  * `limeobject-matches-filter` primitive, so the rule editor renders the
46
46
  * filter builder instead of a raw JSON field.
47
47
  *
48
+ * No-op when the primitive is not registered. `attachMetadata` throws
49
+ * for an unknown id, and this runs at loader time on every surface, so
50
+ * a missing primitive would otherwise block the whole app from loading.
51
+ *
48
52
  * @param registry - the platform's rule registry.
49
53
  */
50
54
  const attachRuleArgFilterEditorMetadata = (registry) => {
55
+ const isRegistered = registry
56
+ .listPrimitives()
57
+ .some((primitive) => primitive.id === LIMEOBJECT_MATCHES_FILTER_ID);
58
+ if (!isRegistered) {
59
+ return;
60
+ }
51
61
  registry.attachMetadata(LIMEOBJECT_MATCHES_FILTER_ID, {
52
62
  configComponent: { name: 'limebb-rule-arg-filter-editor' },
53
63
  });
@@ -24,6 +24,14 @@ const RuleChipPopover = class {
24
24
  this.readonly = false;
25
25
  this.disabled = false;
26
26
  this.isMutable = true;
27
+ /**
28
+ * Forwarded to the embedded config component so it can pull focus
29
+ * when this popover opens. The rule editor sets it only when the chip
30
+ * was just added via the picker, so clicking an existing chip does
31
+ * not steal focus. The component decides when it is ready to receive
32
+ * focus (e.g. after loading its own data).
33
+ */
34
+ this.focusOnOpen = false;
27
35
  this.handleNegateChange = (event) => {
28
36
  event.stopPropagation();
29
37
  this.negate.emit(event.detail);
@@ -37,7 +45,7 @@ const RuleChipPopover = class {
37
45
  };
38
46
  }
39
47
  render() {
40
- return (h("div", { key: 'ca7901be2a99590faddea0c678d149b13b5d564f', class: "popover" }, this.renderHeader(), this.renderBody()));
48
+ return (h("div", { key: 'a395bf65b1868b0a440881f2c885c7bd9dc741d4', class: "popover" }, this.renderHeader(), this.renderBody()));
41
49
  }
42
50
  renderHeader() {
43
51
  var _a, _b, _c, _d;
@@ -61,7 +69,7 @@ const RuleChipPopover = class {
61
69
  if (!configComponent) {
62
70
  return null;
63
71
  }
64
- return (h("div", { class: "popover__body" }, h(LimeWebComponentTemplate, { platform: this.platform, context: this.context, name: configComponent.name, props: Object.assign(Object.assign({}, configComponent.props), { value: (_b = this.refNode) === null || _b === void 0 ? void 0 : _b.args, readonly: this.readonly, disabled: this.disabled, onChange: this.handleArgsChange }) })));
72
+ return (h("div", { class: "popover__body" }, h(LimeWebComponentTemplate, { platform: this.platform, context: this.context, name: configComponent.name, props: Object.assign(Object.assign({}, configComponent.props), { value: (_b = this.refNode) === null || _b === void 0 ? void 0 : _b.args, readonly: this.readonly, disabled: this.disabled, focusOnOpen: this.focusOnOpen, onChange: this.handleArgsChange }) })));
65
73
  }
66
74
  };
67
75
  __decorate([
@@ -17,6 +17,9 @@ function deleteNode(rule, path) {
17
17
  const parentPath = path.slice(0, -1);
18
18
  const key = path.at(-1);
19
19
  const parent = getNode(rule, parentPath);
20
+ if (parent === undefined) {
21
+ return rule;
22
+ }
20
23
  if ((parent.type === 'all' || parent.type === 'any') &&
21
24
  typeof key === 'number') {
22
25
  const rules = [...parent.rules];
@@ -37,7 +40,7 @@ function deleteNode(rule, path) {
37
40
  */
38
41
  function updateArgs(rule, path, args) {
39
42
  const node = getNode(rule, path);
40
- if (node.type !== 'ref') {
43
+ if (node === undefined || node.type !== 'ref') {
41
44
  return rule;
42
45
  }
43
46
  return replaceAt(rule, path, Object.assign(Object.assign({}, node), { args }));
@@ -91,9 +94,19 @@ function pathsEqual(a, b) {
91
94
  function issuesAt(issues, path) {
92
95
  return issues.filter((issue) => pathsEqual(issue.path, path));
93
96
  }
97
+ /**
98
+ * Resolve the node at `path` by walking each segment from the root.
99
+ * Returns `undefined` when a segment indexes past the end of a
100
+ * combinator's `rules`, so callers must guard the result.
101
+ * @param rule
102
+ * @param path
103
+ */
94
104
  function getNode(rule, path) {
95
105
  let node = rule;
96
106
  for (const key of path) {
107
+ if (node === undefined) {
108
+ return undefined;
109
+ }
97
110
  node = stepIntoNode(node, key);
98
111
  }
99
112
  return node;
@@ -225,6 +238,13 @@ function chipTokenFor(index) {
225
238
  // by a two-segment suffix `['rules', index]`. Build and parse via
226
239
  // these helpers so both sides stay in sync.
227
240
  const CHIP_PATH_SUFFIX_LENGTH = 2;
241
+ /**
242
+ * Address of the chip at `index` inside a group: the group's path plus
243
+ * the `['rules', index]` suffix. Built here so the picker and popover
244
+ * address chips the same way.
245
+ * @param groupPath
246
+ * @param index
247
+ */
228
248
  function buildChipPath(groupPath, index) {
229
249
  return [...groupPath, 'rules', index];
230
250
  }
@@ -265,7 +285,7 @@ function renderChipPopoverContent(openChip, groupPath, ctx) {
265
285
  return null;
266
286
  }
267
287
  const openChipPath = buildChipPath(groupPath, openChip.index);
268
- return (h("limebb-rule-chip-popover", { platform: ctx.platform, context: ctx.context, refNode: openChip.ref, isNegated: openChip.isNegated, metadata: ctx.metadataById.get(openChip.ref.id), readonly: ctx.readonly, disabled: ctx.disabled, isMutable: ctx.isMutable, onNegate: chipNegateHandler(openChip, openChipPath, ctx), onUpdateArgs: chipArgsHandler(openChip, openChipPath, ctx), onDeleteChip: chipDeleteHandler(openChipPath, ctx) }));
288
+ return (h("limebb-rule-chip-popover", { platform: ctx.platform, context: ctx.context, refNode: openChip.ref, isNegated: openChip.isNegated, metadata: ctx.metadataById.get(openChip.ref.id), readonly: ctx.readonly, disabled: ctx.disabled, isMutable: ctx.isMutable, focusOnOpen: ctx.focusOnOpen, onNegate: chipNegateHandler(openChip, openChipPath, ctx), onUpdateArgs: chipArgsHandler(openChip, openChipPath, ctx), onDeleteChip: chipDeleteHandler(openChipPath, ctx) }));
269
289
  }
270
290
  const chipsChangeHandler = (groupNode, groupPath, chipsByToken, ctx) => (event) => {
271
291
  event.stopPropagation();
@@ -491,6 +511,7 @@ const RuleEditor = class {
491
511
  this.change = createEvent(this, "change");
492
512
  this.issues = [];
493
513
  this.openChipPath = null;
514
+ this.focusOnOpen = false;
494
515
  this.metadataById = new Map();
495
516
  this.allPrimitiveOptions = [];
496
517
  this.availablePrimitiveOptions = [];
@@ -499,19 +520,27 @@ const RuleEditor = class {
499
520
  this.hasLoaded = false;
500
521
  this.handleDelete = (path) => {
501
522
  this.openChipPath = null;
523
+ this.focusOnOpen = false;
502
524
  this.emitIfChanged(deleteNode(this.normalizedValue, path));
503
525
  };
504
526
  this.handleUpdateArgs = (path, args) => {
505
527
  this.emitIfChanged(updateArgs(this.normalizedValue, path, args));
506
528
  };
507
529
  this.handleReplaceNode = (path, replacement) => {
530
+ const autoOpenPath = this.autoOpenPathFor(path, replacement);
531
+ this.focusOnOpen = autoOpenPath !== null;
532
+ if (autoOpenPath !== null) {
533
+ this.openChipPath = autoOpenPath;
534
+ }
508
535
  this.emitIfChanged(replaceNode(this.normalizedValue, path, replacement));
509
536
  };
510
537
  this.handleChipInteract = (path) => {
511
538
  this.openChipPath = path;
539
+ this.focusOnOpen = false;
512
540
  };
513
541
  this.handlePopoverClose = () => {
514
542
  this.openChipPath = null;
543
+ this.focusOnOpen = false;
515
544
  };
516
545
  }
517
546
  componentWillLoad() {
@@ -555,7 +584,7 @@ const RuleEditor = class {
555
584
  'rule-editor': true,
556
585
  'rule-editor--disabled': this.disabled,
557
586
  };
558
- return (h("div", { key: 'f84022580c3dcbc397a2551b282464d6579368a1', class: containerClasses }, this.renderLabel(), h(RuleNodeView, { key: '660cb7221c151f0a348e00c834338ce03511a7e9', node: this.normalizedValue, path: [], ctx: this.createRenderContext() }), this.renderHelperText()));
587
+ return (h("div", { key: '939efeb92282ce6c60bac6e86dcfe1e8386802c6', class: containerClasses }, this.renderLabel(), h(RuleNodeView, { key: 'd0f829aeda9e2552b39f1ed195d486ea76122ed9', node: this.normalizedValue, path: [], ctx: this.createRenderContext() }), this.renderHelperText()));
559
588
  }
560
589
  renderLabel() {
561
590
  if (!this.label) {
@@ -582,6 +611,7 @@ const RuleEditor = class {
582
611
  context: this.effectiveContext,
583
612
  translator: this.translator,
584
613
  openChipPath: this.openChipPath,
614
+ focusOnOpen: this.focusOnOpen,
585
615
  onDelete: this.handleDelete,
586
616
  onUpdateArgs: this.handleUpdateArgs,
587
617
  onReplaceNode: this.handleReplaceNode,
@@ -589,6 +619,46 @@ const RuleEditor = class {
589
619
  onPopoverClose: this.handlePopoverClose,
590
620
  };
591
621
  }
622
+ /**
623
+ * Path of a newly added chip whose primitive declares a config
624
+ * component, so its args editor opens immediately on add. The new
625
+ * ref is found by object identity — the picker reuses existing ref
626
+ * objects and only the added chip is a fresh node — so adding a
627
+ * second instance of a primitive already in the group is still
628
+ * detected. Returns `null` unless exactly one ref was added and it
629
+ * has an editor, leaving the open chip untouched for removals,
630
+ * multi-adds, and negation.
631
+ * @param path
632
+ * @param replacement
633
+ */
634
+ autoOpenPathFor(path, replacement) {
635
+ var _a;
636
+ if (replacement.type !== 'all' && replacement.type !== 'any') {
637
+ return null;
638
+ }
639
+ const previous = getNode(this.normalizedValue, path);
640
+ if (previous === undefined ||
641
+ (previous.type !== 'all' && previous.type !== 'any')) {
642
+ return null;
643
+ }
644
+ const previousRefs = new Set(previous.rules
645
+ .map((rule) => { var _a; return (_a = extractRef(rule)) === null || _a === void 0 ? void 0 : _a.ref; })
646
+ .filter((ref) => ref !== undefined));
647
+ const added = replacement.rules
648
+ .map((rule, index) => {
649
+ var _a;
650
+ const ref = (_a = extractRef(rule)) === null || _a === void 0 ? void 0 : _a.ref;
651
+ return ref && !previousRefs.has(ref) ? { ref, index } : null;
652
+ })
653
+ .filter((entry) => entry !== null);
654
+ if (added.length !== 1) {
655
+ return null;
656
+ }
657
+ const [{ ref, index }] = added;
658
+ return ((_a = this.metadataById.get(ref.id)) === null || _a === void 0 ? void 0 : _a.configComponent)
659
+ ? buildChipPath(path, index)
660
+ : null;
661
+ }
592
662
  indexMetadata() {
593
663
  var _a, _b, _c;
594
664
  const metadata = (_c = (_b = (_a = this.ruleRegistry).listMetadata) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : [];