@lumiastream/ui 0.0.2-alpha.8 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -16,11 +16,12 @@ interface LSButtonProps {
16
16
  /** Primary UI component for user interaction */
17
17
  declare const LSButton: ({ primary, size, backgroundColor, label, ...props }: LSButtonProps) => react_jsx_runtime.JSX.Element;
18
18
 
19
- declare function allowedVariableCompletion(context: CompletionContext, variables: Record<string, any>, extraOptions?: {
19
+ declare function variableCompletionOptions(context: CompletionContext, variables: {
20
20
  label: string;
21
21
  displayLabel: string;
22
22
  type: string;
23
23
  info: string;
24
+ shouldWrap?: boolean;
24
25
  }[]): {
25
26
  from: number;
26
27
  options: {
@@ -32,4 +33,4 @@ declare function allowedVariableCompletion(context: CompletionContext, variables
32
33
  validFor: RegExp;
33
34
  } | null;
34
35
 
35
- export { LSButton, type LSButtonProps, allowedVariableCompletion };
36
+ export { LSButton, type LSButtonProps, variableCompletionOptions };
package/dist/index.js CHANGED
@@ -49,8 +49,8 @@ var LSButton = ({
49
49
  );
50
50
  };
51
51
 
52
- // src/utils/allowedVariableCompletion.ts
53
- function allowedVariableCompletion(context, variables, extraOptions) {
52
+ // src/utils/variableCompletionOptions.ts
53
+ function variableCompletionOptions(context, variables) {
54
54
  const before = context.state.sliceDoc(0, context.pos);
55
55
  const after = context.state.sliceDoc(context.pos, context.pos + 2);
56
56
  const wordMatch = /(\w*)$/.exec(before);
@@ -63,13 +63,12 @@ function allowedVariableCompletion(context, variables, extraOptions) {
63
63
  const closeNeeded = Math.max(0, 2 - closeCount);
64
64
  const braceWrap = (v) => `${"{".repeat(openNeeded)}${v}${"}".repeat(closeNeeded)}`;
65
65
  const options = [
66
- ...Object.keys(variables).map((variable) => ({
67
- label: braceWrap(variable),
68
- displayLabel: variable,
69
- type: "variable",
70
- info: "A variable in Lumia Stream"
71
- })),
72
- ...extraOptions ?? []
66
+ ...variables.map((variable) => ({
67
+ label: variable.shouldWrap ? braceWrap(variable.label) : variable.label,
68
+ displayLabel: variable.displayLabel,
69
+ type: variable.type,
70
+ info: variable.info
71
+ }))
73
72
  ];
74
73
  return {
75
74
  from,
@@ -80,5 +79,5 @@ function allowedVariableCompletion(context, variables, extraOptions) {
80
79
  }
81
80
  export {
82
81
  LSButton,
83
- allowedVariableCompletion
82
+ variableCompletionOptions
84
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/ui",
3
- "version": "0.0.2-alpha.8",
3
+ "version": "0.0.3",
4
4
  "author": "Lumia Stream",
5
5
  "license": "ISC",
6
6
  "description": "Lumia UI Kit",