@limetech/lime-crm-building-blocks 1.104.0 → 1.104.1

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 (33) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/{lime-query-validation-6be10fa7.js → lime-query-validation-82aa2855.js} +84 -84
  3. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +44 -43
  4. package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +1 -1
  5. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +42 -42
  6. package/dist/collection/components/lime-query-builder/lime-query-builder.css +9 -9
  7. package/dist/collection/components/lime-query-builder/lime-query-builder.js +42 -41
  8. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.css +5 -5
  9. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +42 -42
  10. package/dist/collection/components/lime-query-builder/lime-query-validation.js +84 -84
  11. package/dist/collection/components/lime-query-builder/order-by/order-by-editor.css +2 -2
  12. package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js +2 -2
  13. package/dist/components/lime-query-validation.js +84 -84
  14. package/dist/components/limebb-lime-query-builder.js +43 -42
  15. package/dist/components/limebb-lime-query-response-format-builder.js +41 -41
  16. package/dist/components/order-by-editor.js +1 -1
  17. package/dist/esm/{lime-query-validation-573223a5.js → lime-query-validation-9e386da8.js} +84 -84
  18. package/dist/esm/limebb-lime-query-builder.entry.js +44 -43
  19. package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +1 -1
  20. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +42 -42
  21. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  22. package/dist/lime-crm-building-blocks/{p-6c7af6bb.entry.js → p-7d2188aa.entry.js} +1 -1
  23. package/dist/lime-crm-building-blocks/p-7fbb6eba.entry.js +1 -0
  24. package/dist/lime-crm-building-blocks/p-ac9e81c9.entry.js +1 -0
  25. package/dist/lime-crm-building-blocks/p-efa5bcd4.js +1 -0
  26. package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +3 -3
  27. package/dist/types/components/lime-query-builder/lime-query-response-format-builder.d.ts +13 -13
  28. package/dist/types/components/lime-query-builder/lime-query-validation.d.ts +17 -17
  29. package/dist/types/components.d.ts +12 -12
  30. package/package.json +1 -1
  31. package/dist/lime-crm-building-blocks/p-96fee7ee.entry.js +0 -1
  32. package/dist/lime-crm-building-blocks/p-fa2da6bc.js +0 -1
  33. package/dist/lime-crm-building-blocks/p-fe6a94a1.entry.js +0 -1
@@ -66,7 +66,7 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
66
66
  private limit?;
67
67
  private orderBy?;
68
68
  private getButtons;
69
- private get guiModeEnabled();
69
+ private get visualModeEnabled();
70
70
  componentWillLoad(): void;
71
71
  render(): any;
72
72
  private renderContent;
@@ -78,14 +78,14 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
78
78
  private emitChange;
79
79
  private updateCodeValue;
80
80
  private buildLimeQuery;
81
- private checkGuiSupport;
81
+ private checkVisualModeSupport;
82
82
  private renderModeSwitch;
83
83
  private renderCodeEditor;
84
84
  private renderLimetypeSection;
85
85
  private renderResponseFormatSection;
86
86
  private renderFilterSection;
87
87
  private renderQueryOptionsSection;
88
- private renderGuiMode;
88
+ private renderVisualMode;
89
89
  private renderHeader;
90
90
  private renderModeControls;
91
91
  private renderCodeMode;
@@ -5,16 +5,16 @@ import { ResponseFormat } from './lime-query.types';
5
5
  * Response Format Builder
6
6
  *
7
7
  * A focused component for editing Lime Query ResponseFormat in isolation.
8
- * Supports both GUI and code modes for maximum flexibility.
8
+ * Supports both visual and code modes for maximum flexibility.
9
9
  *
10
10
  * Use this component when you need to configure which properties to return
11
11
  * from a query, but don't need filter, limit, or other query parameters.
12
12
  *
13
13
  * **Features**:
14
- * - **GUI Mode**: Visual property selector with relation navigation
14
+ * - **Visual Mode**: Visual property selector with relation navigation
15
15
  * - **Code Mode**: JSON editor for ResponseFormat structure
16
16
  * - **Validation**: Ensures JSON is valid ResponseFormat (rejects other fields)
17
- * - **Mode Toggle**: Switch between GUI and code modes seamlessly
17
+ * - **Mode Toggle**: Switch between visual and code modes seamlessly
18
18
  * - **Feature Flag**: Respects `useLimeQueryBuilderGuiMode` setting
19
19
  *
20
20
  * @example
@@ -67,30 +67,30 @@ export declare class LimeQueryResponseFormatBuilder implements LimeWebComponent
67
67
  private codeValue;
68
68
  private internalValue;
69
69
  /**
70
- * Check if GUI mode is enabled via feature flag
70
+ * Check if visual mode is enabled via feature flag
71
71
  */
72
- private get guiModeEnabled();
72
+ private get visualModeEnabled();
73
73
  componentWillLoad(): void;
74
74
  componentWillUpdate(): void;
75
75
  render(): any;
76
76
  private renderModeSwitch;
77
77
  private handleModeChange;
78
78
  private renderCodeEditor;
79
- private renderGuiMode;
79
+ private renderVisualMode;
80
80
  /**
81
- * Check if current value can be rendered in GUI mode
81
+ * Check if current value can be rendered in visual mode
82
82
  */
83
- private checkGuiSupport;
83
+ private checkVisualModeSupport;
84
84
  /**
85
85
  * Update code value from internal state
86
86
  */
87
87
  private updateCodeValue;
88
88
  /**
89
- * Switch from code mode to GUI mode
89
+ * Switch from code mode to visual mode
90
90
  */
91
- private switchToGui;
91
+ private switchToVisualMode;
92
92
  /**
93
- * Switch from GUI mode to code mode
93
+ * Switch from visual mode to code mode
94
94
  */
95
95
  private switchToCode;
96
96
  /**
@@ -99,9 +99,9 @@ export declare class LimeQueryResponseFormatBuilder implements LimeWebComponent
99
99
  */
100
100
  private handleCodeChange;
101
101
  /**
102
- * Handle GUI mode changes
102
+ * Handle visual mode changes
103
103
  * @param event
104
104
  */
105
- private handleGuiChange;
105
+ private handleVisualModeChange;
106
106
  }
107
107
  //# sourceMappingURL=lime-query-response-format-builder.d.ts.map
@@ -6,12 +6,12 @@ import { ResponseFormat, PropertySelection, LimeQuery } from './lime-query.types
6
6
  export interface LimeQueryValidationResult {
7
7
  /** Is this a valid Lime Query according to the spec? */
8
8
  valid: boolean;
9
- /** Can the GUI render this Lime Query? */
10
- guiSupported: boolean;
9
+ /** Can the visual mode render this Lime Query? */
10
+ visualModeSupported: boolean;
11
11
  /** Reasons why the Lime Query is invalid (violates Lime Query spec) */
12
12
  validationErrors: string[];
13
- /** Reasons why GUI cannot render this Lime Query (GUI limitations, not spec violations) */
14
- guiLimitations: string[];
13
+ /** Reasons why visual mode cannot render this Lime Query (visual mode limitations, not spec violations) */
14
+ visualModeLimitations: string[];
15
15
  }
16
16
  /**
17
17
  * Validate a placeholder value
@@ -27,34 +27,34 @@ export declare function validatePlaceholder(value: any, activeLimetype: string |
27
27
  /**
28
28
  * Validate a response format against limetype schemas
29
29
  * Throws errors for invalid property references
30
- * Returns GUI limitations for features not yet supported in GUI
30
+ * Returns visual mode limitations for features not yet supported in visual mode
31
31
  * @param responseFormat
32
32
  * @param limetypes Record of all available limetypes
33
33
  * @param limetype The root limetype for this query
34
- * @param guiModeEnabled Whether GUI mode is enabled
35
- * @returns GUI limitations found (if any)
34
+ * @param visualModeEnabled Whether visual mode is enabled
35
+ * @returns Visual mode limitations found (if any)
36
36
  */
37
- export declare function validateResponseFormat(responseFormat: ResponseFormat, limetypes: Record<string, LimeType>, limetype: string, guiModeEnabled?: boolean): string[];
37
+ export declare function validateResponseFormat(responseFormat: ResponseFormat, limetypes: Record<string, LimeType>, limetype: string, visualModeEnabled?: boolean): string[];
38
38
  /**
39
39
  * Validate a property selection object against a limetype schema
40
40
  * Recursively validates nested property selections for relations
41
41
  * @param selection
42
42
  * @param limetypes Record of all available limetypes
43
43
  * @param limetype The limetype for this level of the selection
44
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
45
- * @returns GUI limitations found (if any)
44
+ * @param visualModeEnabled Whether visual mode is enabled (affects validation)
45
+ * @returns Visual mode limitations found (if any)
46
46
  */
47
- export declare function validatePropertySelection(selection: PropertySelection, limetypes: Record<string, LimeType>, limetype: string, guiModeEnabled?: boolean): string[];
47
+ export declare function validatePropertySelection(selection: PropertySelection, limetypes: Record<string, LimeType>, limetype: string, visualModeEnabled?: boolean): string[];
48
48
  /**
49
49
  * Validate a Lime Query
50
- * Returns validation result with separate arrays for validity errors and GUI limitations
50
+ * Returns validation result with separate arrays for validity errors and visual mode limitations
51
51
  * @param limeQuery The Lime Query to validate
52
52
  * @param limetypes Record of all available limetypes
53
53
  * @param activeLimetype Optional active object limetype for placeholder validation
54
- * @param guiModeEnabled Whether GUI mode is enabled (affects validation)
54
+ * @param visualModeEnabled Whether visual mode is enabled (affects validation)
55
55
  * @returns LimeQueryValidationResult with validity status and any errors/limitations
56
56
  */
57
- export declare function isLimeQuerySupported(limeQuery: LimeQuery, limetypes: Record<string, LimeType>, activeLimetype?: string, guiModeEnabled?: boolean): LimeQueryValidationResult;
57
+ export declare function isLimeQuerySupported(limeQuery: LimeQuery, limetypes: Record<string, LimeType>, activeLimetype?: string, visualModeEnabled?: boolean): LimeQueryValidationResult;
58
58
  /**
59
59
  * Validate a ResponseFormat in isolation (for response-format-builder)
60
60
  *
@@ -64,8 +64,8 @@ export declare function isLimeQuerySupported(limeQuery: LimeQuery, limetypes: Re
64
64
  * @param responseFormat - The response format to validate
65
65
  * @param limetypes - Record of all available limetypes
66
66
  * @param limetype - The limetype context for validation
67
- * @param guiModeEnabled - Whether GUI mode is enabled (affects validation)
68
- * @returns Validation result with errors and GUI limitations
67
+ * @param visualModeEnabled - Whether visual mode is enabled (affects validation)
68
+ * @returns Validation result with errors and visual mode limitations
69
69
  */
70
- export declare function validateResponseFormatOnly(responseFormat: ResponseFormat, limetypes: Record<string, LimeType>, limetype: string, guiModeEnabled?: boolean): LimeQueryValidationResult;
70
+ export declare function validateResponseFormatOnly(responseFormat: ResponseFormat, limetypes: Record<string, LimeType>, limetype: string, visualModeEnabled?: boolean): LimeQueryValidationResult;
71
71
  //# sourceMappingURL=lime-query-validation.d.ts.map
@@ -1242,14 +1242,14 @@ export namespace Components {
1242
1242
  /**
1243
1243
  * Response Format Builder
1244
1244
  * A focused component for editing Lime Query ResponseFormat in isolation.
1245
- * Supports both GUI and code modes for maximum flexibility.
1245
+ * Supports both visual and code modes for maximum flexibility.
1246
1246
  * Use this component when you need to configure which properties to return
1247
1247
  * from a query, but don't need filter, limit, or other query parameters.
1248
1248
  * **Features**:
1249
- * - **GUI Mode**: Visual property selector with relation navigation
1249
+ * - **Visual Mode**: Visual property selector with relation navigation
1250
1250
  * - **Code Mode**: JSON editor for ResponseFormat structure
1251
1251
  * - **Validation**: Ensures JSON is valid ResponseFormat (rejects other fields)
1252
- * - **Mode Toggle**: Switch between GUI and code modes seamlessly
1252
+ * - **Mode Toggle**: Switch between visual and code modes seamlessly
1253
1253
  * - **Feature Flag**: Respects `useLimeQueryBuilderGuiMode` setting
1254
1254
  * @example ```tsx
1255
1255
  * <limebb-lime-query-response-format-builder
@@ -3130,14 +3130,14 @@ declare global {
3130
3130
  /**
3131
3131
  * Response Format Builder
3132
3132
  * A focused component for editing Lime Query ResponseFormat in isolation.
3133
- * Supports both GUI and code modes for maximum flexibility.
3133
+ * Supports both visual and code modes for maximum flexibility.
3134
3134
  * Use this component when you need to configure which properties to return
3135
3135
  * from a query, but don't need filter, limit, or other query parameters.
3136
3136
  * **Features**:
3137
- * - **GUI Mode**: Visual property selector with relation navigation
3137
+ * - **Visual Mode**: Visual property selector with relation navigation
3138
3138
  * - **Code Mode**: JSON editor for ResponseFormat structure
3139
3139
  * - **Validation**: Ensures JSON is valid ResponseFormat (rejects other fields)
3140
- * - **Mode Toggle**: Switch between GUI and code modes seamlessly
3140
+ * - **Mode Toggle**: Switch between visual and code modes seamlessly
3141
3141
  * - **Feature Flag**: Respects `useLimeQueryBuilderGuiMode` setting
3142
3142
  * @example ```tsx
3143
3143
  * <limebb-lime-query-response-format-builder
@@ -5058,14 +5058,14 @@ declare namespace LocalJSX {
5058
5058
  /**
5059
5059
  * Response Format Builder
5060
5060
  * A focused component for editing Lime Query ResponseFormat in isolation.
5061
- * Supports both GUI and code modes for maximum flexibility.
5061
+ * Supports both visual and code modes for maximum flexibility.
5062
5062
  * Use this component when you need to configure which properties to return
5063
5063
  * from a query, but don't need filter, limit, or other query parameters.
5064
5064
  * **Features**:
5065
- * - **GUI Mode**: Visual property selector with relation navigation
5065
+ * - **Visual Mode**: Visual property selector with relation navigation
5066
5066
  * - **Code Mode**: JSON editor for ResponseFormat structure
5067
5067
  * - **Validation**: Ensures JSON is valid ResponseFormat (rejects other fields)
5068
- * - **Mode Toggle**: Switch between GUI and code modes seamlessly
5068
+ * - **Mode Toggle**: Switch between visual and code modes seamlessly
5069
5069
  * - **Feature Flag**: Respects `useLimeQueryBuilderGuiMode` setting
5070
5070
  * @example ```tsx
5071
5071
  * <limebb-lime-query-response-format-builder
@@ -6431,14 +6431,14 @@ declare module "@stencil/core" {
6431
6431
  /**
6432
6432
  * Response Format Builder
6433
6433
  * A focused component for editing Lime Query ResponseFormat in isolation.
6434
- * Supports both GUI and code modes for maximum flexibility.
6434
+ * Supports both visual and code modes for maximum flexibility.
6435
6435
  * Use this component when you need to configure which properties to return
6436
6436
  * from a query, but don't need filter, limit, or other query parameters.
6437
6437
  * **Features**:
6438
- * - **GUI Mode**: Visual property selector with relation navigation
6438
+ * - **Visual Mode**: Visual property selector with relation navigation
6439
6439
  * - **Code Mode**: JSON editor for ResponseFormat structure
6440
6440
  * - **Validation**: Ensures JSON is valid ResponseFormat (rejects other fields)
6441
- * - **Mode Toggle**: Switch between GUI and code modes seamlessly
6441
+ * - **Mode Toggle**: Switch between visual and code modes seamlessly
6442
6442
  * - **Feature Flag**: Respects `useLimeQueryBuilderGuiMode` setting
6443
6443
  * @example ```tsx
6444
6444
  * <limebb-lime-query-response-format-builder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-crm-building-blocks",
3
- "version": "1.104.0",
3
+ "version": "1.104.1",
4
4
  "description": "A home for shared components meant for use with Lime CRM",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as i}from"./p-1556b545.js";import{T as r}from"./p-4838284a.js";import{v as o}from"./p-fa2da6bc.js";import"./p-b748c770.js";function s(e){let t;try{t=JSON.parse(e)}catch(e){throw new Error(`Invalid JSON: ${e.message}`)}if(null===t||"object"!=typeof t)throw new Error("Response format must be an object");const i=new Set(["object","aggregates"]),r=Object.keys(t),o=r.filter((e=>!i.has(e)));if(o.length>0)throw new Error(`Unexpected properties in response format: ${o.join(", ")}. Only 'object' and 'aggregates' are allowed.`);if(r.length>0&&!t.object&&!t.aggregates)throw new Error("Response format must contain at least one of: object, aggregates");return t}const l=class{constructor(i){e(this,i),this.change=t(this,"change",7),this.label="Response Format",this.helperText="",this.mode="gui",this.codeValue="",this.handleModeChange=e=>{e.stopPropagation();const t=e.detail.id;"gui"===t?this.switchToGui():"code"===t&&this.switchToCode()},this.switchToGui=()=>{try{const e=s(this.codeValue);if(!o(e,this.limetypes,this.limetype,this.guiModeEnabled).guiSupported)return;this.internalValue=e,this.mode="gui",this.change.emit(e)}catch(e){}},this.switchToCode=()=>{this.updateCodeValue(),this.mode="code"},this.handleCodeChange=e=>{e.stopPropagation(),this.codeValue=e.detail;try{const e=s(this.codeValue);this.internalValue=e,this.change.emit(e)}catch(e){}},this.handleGuiChange=e=>{e.stopPropagation(),this.internalValue=e.detail,this.updateCodeValue(),this.change.emit(e.detail)}}get guiModeEnabled(){var e,t,i;return null!==(i=null===(t=null===(e=this.platform)||void 0===e?void 0:e.isFeatureEnabled)||void 0===t?void 0:t.call(e,"useLimeQueryBuilderGuiMode"))&&void 0!==i&&i}componentWillLoad(){this.internalValue=this.value||{object:{_id:null}},this.updateCodeValue(),this.guiModeEnabled&&this.checkGuiSupport().guiSupported||(this.mode="code")}componentWillUpdate(){this.value&&"gui"===this.mode&&(this.internalValue=this.value)}render(){const e=this.checkGuiSupport();return i("div",{key:"6bc723110dcd545534e93db64a0d6a14963b6bda",class:"response-format-builder"},this.label&&i("h1",{key:"405d373ccb5056af3c0e6201ef5ebf819a3b8154",class:"builder-label"},this.label),this.helperText&&i("p",{key:"5fb07f0fcd9e57b7c358957afc13485156bd041f",class:"builder-helper-text"},this.helperText),this.guiModeEnabled&&i("div",{key:"d2241f702cfe9e75077542d4d21acb038be0a348",class:"mode-controls"},this.renderModeSwitch(e)),this.guiModeEnabled&&"code"!==this.mode?i("div",{class:"gui-mode"},this.renderGuiMode()):i("div",{class:"code-mode"},this.renderCodeEditor(e)))}renderModeSwitch(e){const t=!e.guiSupported,r=[{id:"gui",title:"Visual"},{id:"code",title:"Code"}].map((e=>Object.assign(Object.assign({},e),{selected:e.id===this.mode})));return i("limel-button-group",{value:r,disabled:t,onChange:this.handleModeChange})}renderCodeEditor(e){return i("div",{class:"code-editor-container"},i("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!e.valid&&e.validationErrors.length>0&&i("div",{class:"validation-errors"},i("strong",null,"Invalid Response Format:"),i("ul",null,e.validationErrors.map((e=>i("li",null,e))))),this.guiModeEnabled&&e.valid&&!e.guiSupported&&e.guiLimitations.length>0&&i("div",{class:"gui-limitations"},i("strong",null,"Cannot switch to GUI mode:"),i("ul",null,e.guiLimitations.map((e=>i("li",null,e))))))}renderGuiMode(){return i("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalValue,onChange:this.handleGuiChange})}checkGuiSupport(){if(!this.limetypes)return{valid:!1,guiSupported:!1,validationErrors:["Limetypes not loaded"],guiLimitations:[]};let e;if("code"===this.mode)try{e=s(this.codeValue)}catch(e){return{valid:!1,guiSupported:!1,validationErrors:[e.message],guiLimitations:[]}}else e=this.internalValue;return o(e,this.limetypes,this.limetype,this.guiModeEnabled)}updateCodeValue(){this.codeValue=JSON.stringify(this.internalValue,null,2)}};(function(e,t,i,r){var o,s=arguments.length,l=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,r);else for(var n=e.length-1;n>=0;n--)(o=e[n])&&(l=(s<3?o(l):s>3?o(t,i,l):o(t,i))||l);s>3&&l&&Object.defineProperty(t,i,l)})([r()],l.prototype,"limetypes",void 0),l.style=":host(limebb-lime-query-response-format-builder){display:block;width:100%}.response-format-builder{display:flex;flex-direction:column}.builder-label{color:rgb(var(--contrast-1100));font-size:1.625rem;line-height:1.25rem;font-weight:300;margin-top:1rem;margin-bottom:0.25rem}.builder-helper-text{margin-top:0px;margin-bottom:0.5rem;font-size:var(--limel-theme-default-font-size);color:rgb(var(--contrast-1100))}.mode-controls{display:flex;justify-content:flex-end;padding:0.5rem}.gui-mode,.code-mode{display:block}.code-editor-container{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-editor-container .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .validation-errors ul{margin:0;padding-left:1.5rem}.code-editor-container .validation-errors li{margin:0.25rem 0}.code-editor-container .gui-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .gui-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .gui-limitations li{margin:0.25rem 0}";export{l as limebb_lime_query_response_format_builder}
@@ -1 +0,0 @@
1
- import{Z as t}from"./p-4838284a.js";import{g as r,a as o}from"./p-b748c770.js";const n=new Set(["$yesterday","$now","$today","$tomorrow","$this_week","$this_month","$this_quarter","$this_year"]),e=/^\$(previous|next)_(day|week|month|quarter|year)\(\d+\)$/,i=/^\$me(\.\w+)*$/;function s(t,r,o=!0){const n=Object.keys(t),e=[];if(o){const t=n.filter((t=>t.startsWith("#")&&"#description"!==t));t.length>0&&e.push(`Property '${r}' contains # properties not supported in GUI: ${t.join(", ")}`)}return{keys:n.filter((t=>"_alias"!==t&&!t.startsWith("#"))),guiLimitations:e}}function u(t,r,o,n,e,i=!0){if(""===t){if(i&&null!==r)throw new Error("Empty property name must have null value");return[]}const u=o[t];if(!u)throw new Error(`Property '${t}' does not exist on limetype '${e}'`);return u.relation?function(t,r,o,n,e=!0){if(null===r)return[];if("object"!=typeof r)throw new TypeError(`Relation property '${t}' must be null or an object`);const i=r,{keys:u,guiLimitations:c}=s(i,t,e);if(0===u.length)return c;const f=n.relation.getLimetype();if(!f)throw new Error(`Could not determine related limetype for property '${t}'`);const p={};for(const t of u)p[t]=i[t];const l=a(p,o,f.name,e);return[...c,...l]}(t,r,n,u,i):function(t,r,o=!0){if(null===r)return[];if("object"==typeof r){const{keys:n,guiLimitations:e}=s(r,t,o);if(0===n.length)return e;throw new Error(`Non-relation property '${t}' cannot have nested properties other than _alias or # properties (got: ${n.join(", ")})`)}throw new Error(`Non-relation property '${t}' must be null or an object (got ${typeof r})`)}(t,r,i)}function a(t,r,n,e=!0){const i=r[n];if(!i)throw new Error(`Unknown limetype: ${n}`);const s=o(i),a=[];for(const[o,i]of Object.entries(t)){if(o.startsWith("#"))continue;const t=u(o,i,s,r,n,e);a.push(...t)}return a}function c(o,s,u,a=!0){o&&("key"in o?function(o,s,u){if(!Object.values(t).includes(o.op))throw new Error(`Unsupported filter operator: ${o.op}`);const a=function(t,o,s){if(function(t){return"string"==typeof t&&(n.has(t)||e.test(t)||i.test(t))}(t))return{valid:!0};if("string"!=typeof t||!t.startsWith("%activeObject%"))return{valid:!0};if(!o)return{valid:!0};const u=t.replace(/^%activeObject%\.?/,"");if(!u)return{valid:!0};try{return r(s,o,u)?{valid:!0}:{valid:!1,error:`Property path '${u}' does not exist on limetype '${o}'`}}catch(t){return{valid:!1,error:`Invalid placeholder path: ${t.message}`}}}(o.exp,s,u);if(!a.valid)throw new Error(`Invalid placeholder in filter '${o.key}': ${a.error}`)}(o,s,u):"exp"in o&&function(r,o,n,e){if(r.op!==t.AND&&r.op!==t.OR&&r.op!==t.NOT)throw new Error(`Unsupported group operator: ${r.op}`);if(r.op===t.NOT)c(r.exp,o,n,e);else if(r.op===t.AND||r.op===t.OR){const t=r.exp;for(const r of t)c(r,o,n,e)}}(o,s,u,a))}function f(t,o,n,e){const i=[],s=function(t,r){return"object"!=typeof t||null===t?`orderBy[${r}] must be an object`:null}(t,o);if(s)return[s];const u=Object.keys(t),a=function(t,r){return 0===t.length?`orderBy[${r}] must have a property path`:t.length>1?`orderBy[${r}] must have exactly one property, got ${t.length}`:null}(u,o);if(a)return[a];const c=u[0],f=function(t,r){return"ASC"!==t&&"DESC"!==t?`orderBy[${r}]: direction must be 'ASC' or 'DESC', got '${t}'`:null}(t[c],o);f&&i.push(f);const p=function(t,o,n,e){if(!t||""===t)return null;return r(o,n,t)?null:`orderBy[${e}]: property path '${t}' does not exist on limetype '${n}'`}(c,n,e,o);return p&&i.push(p),i}function p(t,r,o,n){const e=[],i=[];try{const e=function(t,r,o,n=!0){const e=[];if(n&&t.aggregates&&e.push("responseFormat.aggregates is not yet supported in GUI mode"),t.object){const i=a(t.object,r,o,n);e.push(...i)}return e}(t,r,o,n);i.push(...e)}catch(t){e.push(`Invalid responseFormat: ${t.message}`)}return{errors:e,limitations:i}}function l(t,r,o,n=!0){if(!t)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};const e=[],i=[];if(t.limetype&&!r[t.limetype]&&e.push(`Unknown limetype: ${t.limetype}`),void 0===t.offset||t.orderBy||e.push("offset requires orderBy to be specified"),t.orderBy){const o=function(t,r,o){const n=[];if(!Array.isArray(t))return n.push("orderBy must be an array"),n;if(!o||!r[o])return n;for(const[e,i]of t.entries()){const t=f(i,e,r,o);n.push(...t)}return n}(t.orderBy,r,t.limetype);e.push(...o)}if(n&&void 0!==t.offset&&i.push("offset is not yet supported in GUI mode"),t.filter){const i=function(t,r,o,n){const e=[];try{c(t,r,o,n)}catch(t){e.push(`Invalid filter: ${t.message}`)}return e}(t.filter,o,r,n);e.push(...i)}if(t.responseFormat){const{errors:o,limitations:s}=p(t.responseFormat,r,t.limetype,n);e.push(...o),i.push(...s)}return{valid:0===e.length,guiSupported:0===i.length,validationErrors:e,guiLimitations:i}}function d(t,r,o,n=!0){const e=[],i=[];if(!r[o])return e.push(`Unknown limetype: ${o}`),{valid:!1,guiSupported:!1,validationErrors:e,guiLimitations:i};const{errors:s,limitations:u}=p(t,r,o,n);return e.push(...s),i.push(...u),{valid:0===e.length,guiSupported:0===i.length,validationErrors:e,guiLimitations:i}}export{l as i,d as v}
@@ -1 +0,0 @@
1
- import{r as i,c as e,h as t,H as r}from"./p-1556b545.js";import{T as o}from"./p-4838284a.js";import{i as s}from"./p-fa2da6bc.js";import"./p-b748c770.js";const l=class{constructor(t){i(this,t),this.change=e(this,"change",7),this.mode="gui",this.codeValue="",this.limetype="",this.handleLimetypeChange=i=>{i.stopPropagation(),this.limetype=i.detail,this.filter=void 0,this.internalResponseFormat={object:{}},this.emitChange()},this.handleFilterChange=i=>{var e;i.stopPropagation(),this.filter=null!==(e=i.detail)&&void 0!==e?e:void 0,this.emitChange()},this.handleResponseFormatChange=i=>{i.stopPropagation(),this.internalResponseFormat=i.detail,this.emitChange()},this.handleLimitChange=i=>{i.stopPropagation();const e=i.detail;this.limit=e?Number.parseInt(e,10):void 0,this.emitChange()},this.handleOrderByChange=i=>{i.stopPropagation(),this.orderBy=i.detail,this.emitChange()},this.handleChange=i=>{i.stopPropagation();const e=i.detail.id;if("gui"===e)try{const i=JSON.parse(this.codeValue);if(!this.checkGuiSupport().guiSupported)return;this.limetype=i.limetype||"",this.filter=i.filter,this.internalResponseFormat=i.responseFormat,this.limit=i.limit,this.orderBy=i.orderBy,this.mode="gui",this.change.emit(i)}catch(i){}else"code"===e&&(this.updateCodeValue(),this.mode="code")},this.handleCodeChange=i=>{i.stopPropagation(),this.codeValue=i.detail;try{const i=JSON.parse(this.codeValue);this.change.emit(i)}catch(i){}}}getButtons(){return[{id:"gui",title:"Visual"},{id:"code",title:"Code"}]}get guiModeEnabled(){var i,e,t;return null!==(t=null===(e=null===(i=this.platform)||void 0===i?void 0:i.isFeatureEnabled)||void 0===e?void 0:e.call(i,"useLimeQueryBuilderGuiMode"))&&void 0!==t&&t}componentWillLoad(){if(!this.guiModeEnabled)return this.mode="code",void this.updateCodeValue();this.value&&(this.limetype=this.value.limetype||"",this.filter=this.value.filter,this.internalResponseFormat=this.value.responseFormat,this.limit=this.value.limit,this.orderBy=this.value.orderBy),this.updateCodeValue(),this.checkGuiSupport().guiSupported||(this.mode="code")}render(){return t(r,{key:"02e7367fbc718a8625c8d49d5e546acca0986ce2"},this.renderHeader(),this.renderContent())}renderContent(){const i=this.checkGuiSupport();return this.guiModeEnabled&&"code"!==this.mode?this.renderGuiMode():this.renderCodeMode(i)}emitChange(){"code"!==this.mode&&this.limetype&&this.change.emit(this.buildLimeQuery())}updateCodeValue(){this.codeValue=this.limetype?JSON.stringify(this.buildLimeQuery(),null,2):JSON.stringify(this.value||{},null,2)}buildLimeQuery(){const i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};return void 0!==this.limit&&this.limit>0&&(i.limit=this.limit),this.orderBy&&this.orderBy.length>0&&(i.orderBy=this.orderBy),i}checkGuiSupport(){if(!this.limetypes)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};let i;if("code"===this.mode&&this.codeValue)try{i=JSON.parse(this.codeValue)}catch(i){return{valid:!1,guiSupported:!1,validationErrors:["Invalid JSON"],guiLimitations:[]}}else{if(!this.limetype)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(i.limit=this.limit)}return s(i,this.limetypes,this.activeLimetype,this.guiModeEnabled)}renderModeSwitch(i){const e=!i.guiSupported,r=this.getButtons().map((i=>Object.assign(Object.assign({},i),{selected:i.id===this.mode})));return t("limel-button-group",{slot:"actions",onChange:this.handleChange,value:r,disabled:e})}renderCodeEditor(i){return[t("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!i.valid&&i.validationErrors.length>0&&t("div",{class:"validation-errors"},t("strong",null,"Invalid Lime Query:"),t("ul",null,i.validationErrors.map((i=>t("li",null,i))))),this.guiModeEnabled&&i.valid&&!i.guiSupported&&i.guiLimitations.length>0&&t("div",{class:"gui-limitations"},t("strong",null,"Cannot switch to GUI mode:"),t("ul",null,i.guiLimitations.map((i=>t("li",null,i)))))]}renderLimetypeSection(){return t("limebb-limetype-field",{platform:this.platform,context:this.context,label:"Limetype",value:this.limetype,required:!0,fieldName:"limetype",onChange:this.handleLimetypeChange})}renderResponseFormatSection(){if(this.limetype)return t("section",{class:"response-format"},t("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return t("section",{class:"filter"},t("limel-header",{class:"is-narrow",heading:"Filter Conditions",icon:"-lime-filter"}),t("limebb-lime-query-filter-builder",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.filter,onExpressionChange:this.handleFilterChange}))}renderQueryOptionsSection(){var i;if(this.limetype)return t("section",{class:"query-options"},t("limel-header",{class:"is-narrow",heading:"Query Options",icon:"ask_question"}),t("div",{class:"query-options-controls"},t("limel-input-field",{label:"Limit",type:"number",value:(null===(i=this.limit)||void 0===i?void 0:i.toString())||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange}),t("limebb-lime-query-order-by-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.orderBy,onChange:this.handleOrderByChange})))}renderGuiMode(){return t("div",{class:"gui-mode"},this.renderLimetypeSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderHeader(){const i=this.checkGuiSupport();return t("limel-header",{heading:this.label},this.renderModeControls(i))}renderModeControls(i){if(this.guiModeEnabled)return this.renderModeSwitch(i)}renderCodeMode(i){return t("div",{class:"code-mode"},this.renderCodeEditor(i))}};(function(i,e,t,r){var o,s=arguments.length,l=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(i,e,t,r);else for(var d=i.length-1;d>=0;d--)(o=i[d])&&(l=(s<3?o(l):s>3?o(e,t,l):o(e,t))||l);s>3&&l&&Object.defineProperty(e,t,l)})([o()],l.prototype,"limetypes",void 0),l.style="*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-400));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-gui-mode-padding:1rem;--limebb-lime-query-builder-group-color:rgb(var(--color-sky-lighter));box-sizing:border-box;width:calc(100% - 1.5rem);margin:0.75rem auto;display:flex;flex-direction:column;border-radius:var(--limebb-lime-query-builder-border-radius);background-color:var(--limebb-lime-query-builder-background-color);box-shadow:var(--shadow-inflated-16)}.gui-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-gui-mode-padding);border:1px solid var(--header-background-color);border-radius:0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius)}.code-mode{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-mode .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-mode .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .validation-errors ul{margin:0;padding-left:1.5rem}.code-mode .validation-errors li{margin:0.25rem 0}.code-mode .gui-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-mode .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .gui-limitations ul{margin:0;padding-left:1.5rem}.code-mode .gui-limitations li{margin:0.25rem 0}section.filter,section.query-options{display:flex;flex-direction:column;gap:1rem}section h4{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-gui-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-gui-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}";export{l as limebb_lime_query_builder}