@flanksource/clicky-ui 0.3.86 → 0.3.88
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/components.cjs +0 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +2 -2
- package/dist/data/ProgressBars.cjs +157 -101
- package/dist/data/ProgressBars.cjs.map +1 -1
- package/dist/data/ProgressBars.d.ts +1 -1
- package/dist/data/ProgressBars.d.ts.map +1 -1
- package/dist/data/ProgressBars.js +157 -101
- package/dist/data/ProgressBars.js.map +1 -1
- package/dist/data/ai/PromptCatalog/PromptCatalogTable.cjs +1 -0
- package/dist/data/ai/PromptCatalog/PromptCatalogTable.cjs.map +1 -1
- package/dist/data/ai/PromptCatalog/PromptCatalogTable.d.ts.map +1 -1
- package/dist/data/ai/PromptCatalog/PromptCatalogTable.js +1 -0
- package/dist/data/ai/PromptCatalog/PromptCatalogTable.js.map +1 -1
- package/dist/data/traces/ProcessResourceMetrics.cjs +99 -0
- package/dist/data/traces/ProcessResourceMetrics.cjs.map +1 -0
- package/dist/data/traces/ProcessResourceMetrics.d.ts +10 -0
- package/dist/data/traces/ProcessResourceMetrics.d.ts.map +1 -0
- package/dist/data/traces/ProcessResourceMetrics.js +99 -0
- package/dist/data/traces/ProcessResourceMetrics.js.map +1 -0
- package/dist/data/traces/ProcessTraceDetail.cjs +85 -108
- package/dist/data/traces/ProcessTraceDetail.cjs.map +1 -1
- package/dist/data/traces/ProcessTraceDetail.d.ts +7 -1
- package/dist/data/traces/ProcessTraceDetail.d.ts.map +1 -1
- package/dist/data/traces/ProcessTraceDetail.js +88 -111
- package/dist/data/traces/ProcessTraceDetail.js.map +1 -1
- package/dist/data/traces/ProcessUsageBars.cjs +37 -41
- package/dist/data/traces/ProcessUsageBars.cjs.map +1 -1
- package/dist/data/traces/ProcessUsageBars.d.ts.map +1 -1
- package/dist/data/traces/ProcessUsageBars.js +37 -41
- package/dist/data/traces/ProcessUsageBars.js.map +1 -1
- package/dist/data/traces/process-tree.cjs +35 -0
- package/dist/data/traces/process-tree.cjs.map +1 -1
- package/dist/data/traces/process-tree.d.ts +15 -0
- package/dist/data/traces/process-tree.d.ts.map +1 -1
- package/dist/data/traces/process-tree.js +35 -1
- package/dist/data/traces/process-tree.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/expressions/lang/attributes.cjs.map +1 -1
- package/dist/expressions/lang/attributes.d.ts.map +1 -1
- package/dist/expressions/lang/attributes.js.map +1 -1
- package/dist/expressions/lang/completion.cjs.map +1 -1
- package/dist/expressions/lang/completion.d.ts.map +1 -1
- package/dist/expressions/lang/completion.js.map +1 -1
- package/dist/expressions/lang/generated/conformance.json.d.ts +280 -0
- package/dist/expressions/lang/generated/index.cjs.map +1 -1
- package/dist/expressions/lang/generated/index.d.ts.map +1 -1
- package/dist/expressions/lang/generated/index.js.map +1 -1
- package/dist/expressions/lang/generated/languages.cjs +2 -0
- package/dist/expressions/lang/generated/languages.cjs.map +1 -1
- package/dist/expressions/lang/generated/languages.js +2 -0
- package/dist/expressions/lang/generated/languages.js.map +1 -1
- package/dist/expressions/lang/generated/languages.json.d.ts +2 -0
- package/dist/expressions/lang/generated/spec.cjs +2 -2
- package/dist/expressions/lang/generated/spec.cjs.map +1 -1
- package/dist/expressions/lang/generated/spec.js +2 -2
- package/dist/expressions/lang/generated/spec.js.map +1 -1
- package/dist/expressions/lang/generated/spec.json.d.ts +81 -26
- package/dist/expressions/lang/hover.cjs +3 -1
- package/dist/expressions/lang/hover.cjs.map +1 -1
- package/dist/expressions/lang/hover.d.ts.map +1 -1
- package/dist/expressions/lang/hover.js +3 -1
- package/dist/expressions/lang/hover.js.map +1 -1
- package/dist/expressions/lang/index.cjs.map +1 -1
- package/dist/expressions/lang/index.d.ts.map +1 -1
- package/dist/expressions/lang/index.js.map +1 -1
- package/dist/expressions/lang/merge.cjs +5 -0
- package/dist/expressions/lang/merge.cjs.map +1 -1
- package/dist/expressions/lang/merge.d.ts +4 -0
- package/dist/expressions/lang/merge.d.ts.map +1 -1
- package/dist/expressions/lang/merge.js +5 -0
- package/dist/expressions/lang/merge.js.map +1 -1
- package/dist/expressions/lang/prefix.cjs.map +1 -1
- package/dist/expressions/lang/prefix.d.ts.map +1 -1
- package/dist/expressions/lang/prefix.js.map +1 -1
- package/dist/expressions/lang/spec.d.ts.map +1 -1
- package/dist/expressions/lang/theme.cjs.map +1 -1
- package/dist/expressions/lang/theme.d.ts.map +1 -1
- package/dist/expressions/lang/theme.js.map +1 -1
- package/dist/expressions/lang/types.d.ts +12 -0
- package/dist/expressions/lang/types.d.ts.map +1 -1
- package/dist/expressions/playground/EmbeddedPlayground.cjs +6 -5
- package/dist/expressions/playground/EmbeddedPlayground.cjs.map +1 -1
- package/dist/expressions/playground/EmbeddedPlayground.d.ts +12 -4
- package/dist/expressions/playground/EmbeddedPlayground.d.ts.map +1 -1
- package/dist/expressions/playground/EmbeddedPlayground.js +6 -5
- package/dist/expressions/playground/EmbeddedPlayground.js.map +1 -1
- package/dist/expressions/playground/ExpressionPlayground.cjs +217 -156
- package/dist/expressions/playground/ExpressionPlayground.cjs.map +1 -1
- package/dist/expressions/playground/ExpressionPlayground.d.ts +7 -6
- package/dist/expressions/playground/ExpressionPlayground.d.ts.map +1 -1
- package/dist/expressions/playground/ExpressionPlayground.js +217 -156
- package/dist/expressions/playground/ExpressionPlayground.js.map +1 -1
- package/dist/expressions/playground/panels/ReferencePanel.cjs +34 -0
- package/dist/expressions/playground/panels/ReferencePanel.cjs.map +1 -0
- package/dist/expressions/playground/panels/ReferencePanel.d.ts +22 -0
- package/dist/expressions/playground/panels/ReferencePanel.d.ts.map +1 -0
- package/dist/expressions/playground/panels/ReferencePanel.js +33 -0
- package/dist/expressions/playground/panels/ReferencePanel.js.map +1 -0
- package/dist/expressions/playground/panels/SpecPanel.cjs +10 -2
- package/dist/expressions/playground/panels/SpecPanel.cjs.map +1 -1
- package/dist/expressions/playground/panels/SpecPanel.d.ts.map +1 -1
- package/dist/expressions/playground/panels/SpecPanel.js +10 -2
- package/dist/expressions/playground/panels/SpecPanel.js.map +1 -1
- package/dist/expressions/playground/useEvaluator.cjs +56 -42
- package/dist/expressions/playground/useEvaluator.cjs.map +1 -1
- package/dist/expressions/playground/useEvaluator.d.ts +0 -2
- package/dist/expressions/playground/useEvaluator.d.ts.map +1 -1
- package/dist/expressions/playground/useEvaluator.js +56 -42
- package/dist/expressions/playground/useEvaluator.js.map +1 -1
- package/dist/expressions/playground/useSampleRuns.cjs +22 -18
- package/dist/expressions/playground/useSampleRuns.cjs.map +1 -1
- package/dist/expressions/playground/useSampleRuns.d.ts +2 -3
- package/dist/expressions/playground/useSampleRuns.d.ts.map +1 -1
- package/dist/expressions/playground/useSampleRuns.js +22 -18
- package/dist/expressions/playground/useSampleRuns.js.map +1 -1
- package/dist/hooks/use-latest.cjs +14 -0
- package/dist/hooks/use-latest.cjs.map +1 -0
- package/dist/hooks/use-latest.d.ts +3 -0
- package/dist/hooks/use-latest.d.ts.map +1 -0
- package/dist/hooks/use-latest.js +14 -0
- package/dist/hooks/use-latest.js.map +1 -0
- package/dist/index.cjs +0 -1
- package/dist/index.js +2 -2
- package/dist/overlay/ConfirmDialog.cjs +12 -37
- package/dist/overlay/ConfirmDialog.cjs.map +1 -1
- package/dist/overlay/ConfirmDialog.d.ts +3 -17
- package/dist/overlay/ConfirmDialog.d.ts.map +1 -1
- package/dist/overlay/ConfirmDialog.js +12 -37
- package/dist/overlay/ConfirmDialog.js.map +1 -1
- package/dist/overlay/useConfirm.cjs +1 -16
- package/dist/overlay/useConfirm.cjs.map +1 -1
- package/dist/overlay/useConfirm.d.ts +1 -9
- package/dist/overlay/useConfirm.d.ts.map +1 -1
- package/dist/overlay/useConfirm.js +3 -17
- package/dist/overlay/useConfirm.js.map +1 -1
- package/dist/runtime/barrels.json +1574 -1576
- package/dist/runtime/importmap.json +2185 -2183
- package/package.json +1 -1
- package/dist/overlay/confirmMemory.cjs +0 -58
- package/dist/overlay/confirmMemory.cjs.map +0 -1
- package/dist/overlay/confirmMemory.d.ts +0 -8
- package/dist/overlay/confirmMemory.d.ts.map +0 -1
- package/dist/overlay/confirmMemory.js +0 -54
- package/dist/overlay/confirmMemory.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix.cjs","names":["pathFlavour","spec"],"sources":["../../../src/expressions/lang/prefix.ts"],"sourcesContent":["import { spec } from \"./generated\";\nimport { pathFlavour } from \"./environment\";\nimport type { PathSegment } from \"./environment\";\n\n/** The subset of a Monaco model this module reads. */\nexport interface PrefixModel {\n getLineContent(line: number): string;\n}\n\nexport interface PrefixPosition {\n lineNumber: number;\n column: number;\n}\n\n/** A path expression under construction at the cursor. */\nexport interface EnvironmentPrefix {\n /** The segments already committed, left of the trailing dot. */\n segments: PathSegment[];\n /** The partially typed leaf, empty right after a dot. */\n leaf: string;\n /**\n * 1-based columns spanning the whole expression typed so far, root marker\n * included. A completion replaces this range with a freshly rendered path, so\n * the inserted text is always well formed rather than glued onto what is\n * already there.\n */\n startColumn: number;\n endColumn: number;\n /** The text in that range, which Monaco filters candidates against. */\n typed: string;\n}\n\nconst IDENT = /[A-Za-z0-9_]/;\nconst SUBSCRIPT = /^(?:(\\d+)|\"((?:[^\"\\\\]|\\\\.)*)\"|'((?:[^'\\\\]|\\\\.)*)')$/;\n\n/**\n * Reads the path expression the cursor sits in, or null when it sits somewhere\n * the document's keys have no meaning.\n *\n * `dottedWordAt` in `hover.ts` cannot serve here: it scans past the cursor and\n * strips the trailing dot, and the trailing dot is precisely the signal that a\n * child is being completed.\n */\nexport function environmentPrefixAt(\n model: PrefixModel,\n position: PrefixPosition,\n languageId: string,\n): EnvironmentPrefix | null {\n const flavour = pathFlavour(languageId);\n if (!flavour) return null;\n\n const line = model.getLineContent(position.lineNumber);\n const before = line.slice(0, position.column - 1);\n\n if (flavour === \"gotemplate\" && !insideAction(before)) return null;\n\n let leafStart = before.length;\n while (leafStart > 0 && IDENT.test(before[leafStart - 1]!)) leafStart--;\n const leaf = before.slice(leafStart);\n const head = before.slice(0, leafStart);\n\n const chain = parseChain(head);\n if (!chain) return null;\n // Without a dot the leaf can only be a root name, so anything that looks like\n // the tail of a path before it (`items[0]name`) is malformed, not a prefix.\n if (leaf !== \"\" && !chain.dotted && chain.segments.length > 0) return null;\n\n // `chain.start` already sits on the leading `.` when there is one, so a go\n // template needs no adjustment; JSONPath's `$` sits one place further left.\n let start = chain.start;\n if (flavour === \"gotemplate\" && !chain.rooted) return null;\n if (flavour === \"jsonpath\") {\n const marker = head[chain.start - 1];\n if (marker !== \"$\" && marker !== \"@\") return null;\n start -= 1;\n }\n if (flavour === \"cel\" && chain.rooted) return null; // a leading `.` is not CEL\n\n return {\n segments: chain.segments,\n leaf,\n startColumn: start + 1,\n endColumn: position.column,\n typed: before.slice(start),\n };\n}\n\ninterface Chain {\n segments: PathSegment[];\n /** Index in `head` where the segment list starts, root marker excluded. */\n start: number;\n /** Whether `head` ends with the dot that opens a new segment. */\n dotted: boolean;\n /** Whether the outermost segment is preceded by a `.`, as go templates need. */\n rooted: boolean;\n}\n\n/**\n * Parses the trailing path of `head` backwards.\n *\n * Backwards because a path has no left boundary of its own: it ends where the\n * expression around it begins, and that is only knowable by walking off it.\n */\nfunction parseChain(head: string): Chain | null {\n let pos = head.length;\n const dotted = pos > 0 && head[pos - 1] === \".\";\n if (dotted) pos--;\n\n const reversed: PathSegment[] = [];\n let rooted = false;\n\n for (;;) {\n if (pos > 0 && head[pos - 1] === \"]\") {\n const open = head.lastIndexOf(\"[\", pos - 2);\n if (open < 0) return null;\n const segment = parseSubscript(head.slice(open + 1, pos - 1));\n if (segment === null) return null;\n reversed.push(segment);\n pos = open;\n rooted = false;\n continue;\n }\n if (pos > 0 && IDENT.test(head[pos - 1]!)) {\n let start = pos;\n while (start > 0 && IDENT.test(head[start - 1]!)) start--;\n reversed.push(head.slice(start, pos));\n pos = start;\n rooted = pos > 0 && head[pos - 1] === \".\";\n if (rooted) {\n pos--;\n continue;\n }\n break;\n }\n break;\n }\n\n // Only the trailing dot was consumed, so that dot is itself the root marker.\n if (reversed.length === 0 && dotted) rooted = true;\n\n return { segments: reversed.reverse(), start: pos, dotted, rooted };\n}\n\nfunction parseSubscript(inner: string): PathSegment | null {\n const match = SUBSCRIPT.exec(inner.trim());\n if (!match) return null;\n if (match[1] !== undefined) return Number(match[1]);\n const quoted = match[2] ?? match[3]!;\n try {\n return JSON.parse(`\"${quoted.replace(/\\\\'/g, \"'\")}\"`) as string;\n } catch {\n return null;\n }\n}\n\n/**\n * Whether the cursor sits between template delimiters. Outside them the text is\n * literal output, where a key path means nothing.\n */\nfunction insideAction(before: string): boolean {\n const { left, right, leftComment, rightComment } = spec.gotemplate.delimiters;\n\n const open = before.lastIndexOf(left);\n if (open < 0) return false;\n if (before.lastIndexOf(right) > open) return false;\n\n // `{{/*` opens with the ordinary left delimiter, so an unterminated comment\n // reads as an open action unless it is checked for separately.\n const comment = before.lastIndexOf(leftComment);\n if (comment >= open && before.lastIndexOf(rightComment) < comment) return false;\n\n return true;\n}\n"],"mappings":";;;AAgCA,IAAM,QAAQ;AACd,IAAM,YAAY;;;;;;;;;AAUlB,SAAgB,oBACd,OACA,UACA,YAC0B;CAC1B,MAAM,UAAUA,oBAAAA,YAAY,UAAU;CACtC,IAAI,CAAC,SAAS,OAAO;CAGrB,MAAM,SADO,MAAM,eAAe,SAAS,UAC5B,CAAA,CAAK,MAAM,GAAG,SAAS,SAAS,CAAC;CAEhD,IAAI,YAAY,gBAAgB,CAAC,aAAa,MAAM,GAAG,OAAO;CAE9D,IAAI,YAAY,OAAO;CACvB,OAAO,YAAY,KAAK,MAAM,KAAK,OAAO,YAAY,EAAG,GAAG;CAC5D,MAAM,OAAO,OAAO,MAAM,SAAS;CACnC,MAAM,OAAO,OAAO,MAAM,GAAG,SAAS;CAEtC,MAAM,QAAQ,WAAW,IAAI;CAC7B,IAA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,KAAK,QAAQ,SAAS;CAE9C,OAAO;EAAE,UAAU,SAAS,QAAQ;EAAG,OAAO;EAAK;EAAQ;CAAO;AACpE;AAEA,SAAS,eAAe,OAAmC;CACzD,MAAM,QAAQ,UAAU,KAAK,MAAM,KAAK,CAAC;CACzC,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,MAAM,OAAO,KAAA,GAAW,OAAO,OAAO,MAAM,EAAE;CAClD,MAAM,SAAS,MAAM,MAAM,MAAM;CACjC,IAAI;EACF,OAAO,KAAK,MAAM,IAAI,OAAO,QAAQ,QAAQ,GAAG,EAAE,EAAE;CACtD,QAAQ;EACN,OAAO;CACT;AACF;;;;;AAMA,SAAS,aAAa,QAAyB;CAC7C,MAAM,EAAE,MAAM,OAAO,aAAa,iBAAiBC,cAAAA,KAAK,WAAW;CAEnE,MAAM,OAAO,OAAO,YAAY,IAAI;CACpC,IAAI,OAAO,GAAG,OAAO;CACrB,IAAI,OAAO,YAAY,KAAK,IAAI,MAAM,OAAO;CAI7C,MAAM,UAAU,OAAO,YAAY,WAAW;CAC9C,IAAI,WAAW,QAAQ,OAAO,YAAY,YAAY,IAAI,SAAS,OAAO;CAE1E,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"prefix.cjs","names":["pathFlavour","spec"],"sources":["../../../src/expressions/lang/prefix.ts"],"sourcesContent":["import { spec } from \"./generated/index.js\";\nimport { pathFlavour } from \"./environment.js\";\nimport type { PathSegment } from \"./environment.js\";\n\n/** The subset of a Monaco model this module reads. */\nexport interface PrefixModel {\n getLineContent(line: number): string;\n}\n\nexport interface PrefixPosition {\n lineNumber: number;\n column: number;\n}\n\n/** A path expression under construction at the cursor. */\nexport interface EnvironmentPrefix {\n /** The segments already committed, left of the trailing dot. */\n segments: PathSegment[];\n /** The partially typed leaf, empty right after a dot. */\n leaf: string;\n /**\n * 1-based columns spanning the whole expression typed so far, root marker\n * included. A completion replaces this range with a freshly rendered path, so\n * the inserted text is always well formed rather than glued onto what is\n * already there.\n */\n startColumn: number;\n endColumn: number;\n /** The text in that range, which Monaco filters candidates against. */\n typed: string;\n}\n\nconst IDENT = /[A-Za-z0-9_]/;\nconst SUBSCRIPT = /^(?:(\\d+)|\"((?:[^\"\\\\]|\\\\.)*)\"|'((?:[^'\\\\]|\\\\.)*)')$/;\n\n/**\n * Reads the path expression the cursor sits in, or null when it sits somewhere\n * the document's keys have no meaning.\n *\n * `dottedWordAt` in `hover.ts` cannot serve here: it scans past the cursor and\n * strips the trailing dot, and the trailing dot is precisely the signal that a\n * child is being completed.\n */\nexport function environmentPrefixAt(\n model: PrefixModel,\n position: PrefixPosition,\n languageId: string,\n): EnvironmentPrefix | null {\n const flavour = pathFlavour(languageId);\n if (!flavour) return null;\n\n const line = model.getLineContent(position.lineNumber);\n const before = line.slice(0, position.column - 1);\n\n if (flavour === \"gotemplate\" && !insideAction(before)) return null;\n\n let leafStart = before.length;\n while (leafStart > 0 && IDENT.test(before[leafStart - 1]!)) leafStart--;\n const leaf = before.slice(leafStart);\n const head = before.slice(0, leafStart);\n\n const chain = parseChain(head);\n if (!chain) return null;\n // Without a dot the leaf can only be a root name, so anything that looks like\n // the tail of a path before it (`items[0]name`) is malformed, not a prefix.\n if (leaf !== \"\" && !chain.dotted && chain.segments.length > 0) return null;\n\n // `chain.start` already sits on the leading `.` when there is one, so a go\n // template needs no adjustment; JSONPath's `$` sits one place further left.\n let start = chain.start;\n if (flavour === \"gotemplate\" && !chain.rooted) return null;\n if (flavour === \"jsonpath\") {\n const marker = head[chain.start - 1];\n if (marker !== \"$\" && marker !== \"@\") return null;\n start -= 1;\n }\n if (flavour === \"cel\" && chain.rooted) return null; // a leading `.` is not CEL\n\n return {\n segments: chain.segments,\n leaf,\n startColumn: start + 1,\n endColumn: position.column,\n typed: before.slice(start),\n };\n}\n\ninterface Chain {\n segments: PathSegment[];\n /** Index in `head` where the segment list starts, root marker excluded. */\n start: number;\n /** Whether `head` ends with the dot that opens a new segment. */\n dotted: boolean;\n /** Whether the outermost segment is preceded by a `.`, as go templates need. */\n rooted: boolean;\n}\n\n/**\n * Parses the trailing path of `head` backwards.\n *\n * Backwards because a path has no left boundary of its own: it ends where the\n * expression around it begins, and that is only knowable by walking off it.\n */\nfunction parseChain(head: string): Chain | null {\n let pos = head.length;\n const dotted = pos > 0 && head[pos - 1] === \".\";\n if (dotted) pos--;\n\n const reversed: PathSegment[] = [];\n let rooted = false;\n\n for (;;) {\n if (pos > 0 && head[pos - 1] === \"]\") {\n const open = head.lastIndexOf(\"[\", pos - 2);\n if (open < 0) return null;\n const segment = parseSubscript(head.slice(open + 1, pos - 1));\n if (segment === null) return null;\n reversed.push(segment);\n pos = open;\n rooted = false;\n continue;\n }\n if (pos > 0 && IDENT.test(head[pos - 1]!)) {\n let start = pos;\n while (start > 0 && IDENT.test(head[start - 1]!)) start--;\n reversed.push(head.slice(start, pos));\n pos = start;\n rooted = pos > 0 && head[pos - 1] === \".\";\n if (rooted) {\n pos--;\n continue;\n }\n break;\n }\n break;\n }\n\n // Only the trailing dot was consumed, so that dot is itself the root marker.\n if (reversed.length === 0 && dotted) rooted = true;\n\n return { segments: reversed.reverse(), start: pos, dotted, rooted };\n}\n\nfunction parseSubscript(inner: string): PathSegment | null {\n const match = SUBSCRIPT.exec(inner.trim());\n if (!match) return null;\n if (match[1] !== undefined) return Number(match[1]);\n const quoted = match[2] ?? match[3]!;\n try {\n return JSON.parse(`\"${quoted.replace(/\\\\'/g, \"'\")}\"`) as string;\n } catch {\n return null;\n }\n}\n\n/**\n * Whether the cursor sits between template delimiters. Outside them the text is\n * literal output, where a key path means nothing.\n */\nfunction insideAction(before: string): boolean {\n const { left, right, leftComment, rightComment } = spec.gotemplate.delimiters;\n\n const open = before.lastIndexOf(left);\n if (open < 0) return false;\n if (before.lastIndexOf(right) > open) return false;\n\n // `{{/*` opens with the ordinary left delimiter, so an unterminated comment\n // reads as an open action unless it is checked for separately.\n const comment = before.lastIndexOf(leftComment);\n if (comment >= open && before.lastIndexOf(rightComment) < comment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AY,YAAY,IAAI,SAAS,OAAO;CAE1E,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../../../src/expressions/lang/prefix.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../../../src/expressions/lang/prefix.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,sDAAsD;AACtD,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,gEAAgE;IAChE,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;CACf;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,MAAM,GACjB,iBAAiB,GAAG,IAAI,CAsC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix.js","names":[],"sources":["../../../src/expressions/lang/prefix.ts"],"sourcesContent":["import { spec } from \"./generated\";\nimport { pathFlavour } from \"./environment\";\nimport type { PathSegment } from \"./environment\";\n\n/** The subset of a Monaco model this module reads. */\nexport interface PrefixModel {\n getLineContent(line: number): string;\n}\n\nexport interface PrefixPosition {\n lineNumber: number;\n column: number;\n}\n\n/** A path expression under construction at the cursor. */\nexport interface EnvironmentPrefix {\n /** The segments already committed, left of the trailing dot. */\n segments: PathSegment[];\n /** The partially typed leaf, empty right after a dot. */\n leaf: string;\n /**\n * 1-based columns spanning the whole expression typed so far, root marker\n * included. A completion replaces this range with a freshly rendered path, so\n * the inserted text is always well formed rather than glued onto what is\n * already there.\n */\n startColumn: number;\n endColumn: number;\n /** The text in that range, which Monaco filters candidates against. */\n typed: string;\n}\n\nconst IDENT = /[A-Za-z0-9_]/;\nconst SUBSCRIPT = /^(?:(\\d+)|\"((?:[^\"\\\\]|\\\\.)*)\"|'((?:[^'\\\\]|\\\\.)*)')$/;\n\n/**\n * Reads the path expression the cursor sits in, or null when it sits somewhere\n * the document's keys have no meaning.\n *\n * `dottedWordAt` in `hover.ts` cannot serve here: it scans past the cursor and\n * strips the trailing dot, and the trailing dot is precisely the signal that a\n * child is being completed.\n */\nexport function environmentPrefixAt(\n model: PrefixModel,\n position: PrefixPosition,\n languageId: string,\n): EnvironmentPrefix | null {\n const flavour = pathFlavour(languageId);\n if (!flavour) return null;\n\n const line = model.getLineContent(position.lineNumber);\n const before = line.slice(0, position.column - 1);\n\n if (flavour === \"gotemplate\" && !insideAction(before)) return null;\n\n let leafStart = before.length;\n while (leafStart > 0 && IDENT.test(before[leafStart - 1]!)) leafStart--;\n const leaf = before.slice(leafStart);\n const head = before.slice(0, leafStart);\n\n const chain = parseChain(head);\n if (!chain) return null;\n // Without a dot the leaf can only be a root name, so anything that looks like\n // the tail of a path before it (`items[0]name`) is malformed, not a prefix.\n if (leaf !== \"\" && !chain.dotted && chain.segments.length > 0) return null;\n\n // `chain.start` already sits on the leading `.` when there is one, so a go\n // template needs no adjustment; JSONPath's `$` sits one place further left.\n let start = chain.start;\n if (flavour === \"gotemplate\" && !chain.rooted) return null;\n if (flavour === \"jsonpath\") {\n const marker = head[chain.start - 1];\n if (marker !== \"$\" && marker !== \"@\") return null;\n start -= 1;\n }\n if (flavour === \"cel\" && chain.rooted) return null; // a leading `.` is not CEL\n\n return {\n segments: chain.segments,\n leaf,\n startColumn: start + 1,\n endColumn: position.column,\n typed: before.slice(start),\n };\n}\n\ninterface Chain {\n segments: PathSegment[];\n /** Index in `head` where the segment list starts, root marker excluded. */\n start: number;\n /** Whether `head` ends with the dot that opens a new segment. */\n dotted: boolean;\n /** Whether the outermost segment is preceded by a `.`, as go templates need. */\n rooted: boolean;\n}\n\n/**\n * Parses the trailing path of `head` backwards.\n *\n * Backwards because a path has no left boundary of its own: it ends where the\n * expression around it begins, and that is only knowable by walking off it.\n */\nfunction parseChain(head: string): Chain | null {\n let pos = head.length;\n const dotted = pos > 0 && head[pos - 1] === \".\";\n if (dotted) pos--;\n\n const reversed: PathSegment[] = [];\n let rooted = false;\n\n for (;;) {\n if (pos > 0 && head[pos - 1] === \"]\") {\n const open = head.lastIndexOf(\"[\", pos - 2);\n if (open < 0) return null;\n const segment = parseSubscript(head.slice(open + 1, pos - 1));\n if (segment === null) return null;\n reversed.push(segment);\n pos = open;\n rooted = false;\n continue;\n }\n if (pos > 0 && IDENT.test(head[pos - 1]!)) {\n let start = pos;\n while (start > 0 && IDENT.test(head[start - 1]!)) start--;\n reversed.push(head.slice(start, pos));\n pos = start;\n rooted = pos > 0 && head[pos - 1] === \".\";\n if (rooted) {\n pos--;\n continue;\n }\n break;\n }\n break;\n }\n\n // Only the trailing dot was consumed, so that dot is itself the root marker.\n if (reversed.length === 0 && dotted) rooted = true;\n\n return { segments: reversed.reverse(), start: pos, dotted, rooted };\n}\n\nfunction parseSubscript(inner: string): PathSegment | null {\n const match = SUBSCRIPT.exec(inner.trim());\n if (!match) return null;\n if (match[1] !== undefined) return Number(match[1]);\n const quoted = match[2] ?? match[3]!;\n try {\n return JSON.parse(`\"${quoted.replace(/\\\\'/g, \"'\")}\"`) as string;\n } catch {\n return null;\n }\n}\n\n/**\n * Whether the cursor sits between template delimiters. Outside them the text is\n * literal output, where a key path means nothing.\n */\nfunction insideAction(before: string): boolean {\n const { left, right, leftComment, rightComment } = spec.gotemplate.delimiters;\n\n const open = before.lastIndexOf(left);\n if (open < 0) return false;\n if (before.lastIndexOf(right) > open) return false;\n\n // `{{/*` opens with the ordinary left delimiter, so an unterminated comment\n // reads as an open action unless it is checked for separately.\n const comment = before.lastIndexOf(leftComment);\n if (comment >= open && before.lastIndexOf(rightComment) < comment) return false;\n\n return true;\n}\n"],"mappings":";;;AAgCA,IAAM,QAAQ;AACd,IAAM,YAAY;;;;;;;;;AAUlB,SAAgB,oBACd,OACA,UACA,YAC0B;CAC1B,MAAM,UAAU,YAAY,UAAU;CACtC,IAAI,CAAC,SAAS,OAAO;CAGrB,MAAM,SADO,MAAM,eAAe,SAAS,UAC5B,CAAA,CAAK,MAAM,GAAG,SAAS,SAAS,CAAC;CAEhD,IAAI,YAAY,gBAAgB,CAAC,aAAa,MAAM,GAAG,OAAO;CAE9D,IAAI,YAAY,OAAO;CACvB,OAAO,YAAY,KAAK,MAAM,KAAK,OAAO,YAAY,EAAG,GAAG;CAC5D,MAAM,OAAO,OAAO,MAAM,SAAS;CACnC,MAAM,OAAO,OAAO,MAAM,GAAG,SAAS;CAEtC,MAAM,QAAQ,WAAW,IAAI;CAC7B,IAAI,CAAC,OAAO,OAAO;CAGnB,IAAI,SAAS,MAAM,CAAC,MAAM,UAAU,MAAM,SAAS,SAAS,GAAG,OAAO;CAItE,IAAI,QAAQ,MAAM;CAClB,IAAI,YAAY,gBAAgB,CAAC,MAAM,QAAQ,OAAO;CACtD,IAAI,YAAY,YAAY;EAC1B,MAAM,SAAS,KAAK,MAAM,QAAQ;EAClC,IAAI,WAAW,OAAO,WAAW,KAAK,OAAO;EAC7C,SAAS;CACX;CACA,IAAI,YAAY,SAAS,MAAM,QAAQ,OAAO;CAE9C,OAAO;EACL,UAAU,MAAM;EAChB;EACA,aAAa,QAAQ;EACrB,WAAW,SAAS;EACpB,OAAO,OAAO,MAAM,KAAK;CAC3B;AACF;;;;;;;AAkBA,SAAS,WAAW,MAA4B;CAC9C,IAAI,MA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AEnE,MAAM,OAAO,OAAO,YAAY,IAAI;CACpC,IAAI,OAAO,GAAG,OAAO;CACrB,IAAI,OAAO,YAAY,KAAK,IAAI,MAAM,OAAO;CAI7C,MAAM,UAAU,OAAO,YAAY,WAAW;CAC9C,IAAI,WAAW,QAAQ,OAAO,YAAY,YAAY,IAAI,SAAS,OAAO;CAE1E,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"prefix.js","names":[],"sources":["../../../src/expressions/lang/prefix.ts"],"sourcesContent":["import { spec } from \"./generated/index.js\";\nimport { pathFlavour } from \"./environment.js\";\nimport type { PathSegment } from \"./environment.js\";\n\n/** The subset of a Monaco model this module reads. */\nexport interface PrefixModel {\n getLineContent(line: number): string;\n}\n\nexport interface PrefixPosition {\n lineNumber: number;\n column: number;\n}\n\n/** A path expression under construction at the cursor. */\nexport interface EnvironmentPrefix {\n /** The segments already committed, left of the trailing dot. */\n segments: PathSegment[];\n /** The partially typed leaf, empty right after a dot. */\n leaf: string;\n /**\n * 1-based columns spanning the whole expression typed so far, root marker\n * included. A completion replaces this range with a freshly rendered path, so\n * the inserted text is always well formed rather than glued onto what is\n * already there.\n */\n startColumn: number;\n endColumn: number;\n /** The text in that range, which Monaco filters candidates against. */\n typed: string;\n}\n\nconst IDENT = /[A-Za-z0-9_]/;\nconst SUBSCRIPT = /^(?:(\\d+)|\"((?:[^\"\\\\]|\\\\.)*)\"|'((?:[^'\\\\]|\\\\.)*)')$/;\n\n/**\n * Reads the path expression the cursor sits in, or null when it sits somewhere\n * the document's keys have no meaning.\n *\n * `dottedWordAt` in `hover.ts` cannot serve here: it scans past the cursor and\n * strips the trailing dot, and the trailing dot is precisely the signal that a\n * child is being completed.\n */\nexport function environmentPrefixAt(\n model: PrefixModel,\n position: PrefixPosition,\n languageId: string,\n): EnvironmentPrefix | null {\n const flavour = pathFlavour(languageId);\n if (!flavour) return null;\n\n const line = model.getLineContent(position.lineNumber);\n const before = line.slice(0, position.column - 1);\n\n if (flavour === \"gotemplate\" && !insideAction(before)) return null;\n\n let leafStart = before.length;\n while (leafStart > 0 && IDENT.test(before[leafStart - 1]!)) leafStart--;\n const leaf = before.slice(leafStart);\n const head = before.slice(0, leafStart);\n\n const chain = parseChain(head);\n if (!chain) return null;\n // Without a dot the leaf can only be a root name, so anything that looks like\n // the tail of a path before it (`items[0]name`) is malformed, not a prefix.\n if (leaf !== \"\" && !chain.dotted && chain.segments.length > 0) return null;\n\n // `chain.start` already sits on the leading `.` when there is one, so a go\n // template needs no adjustment; JSONPath's `$` sits one place further left.\n let start = chain.start;\n if (flavour === \"gotemplate\" && !chain.rooted) return null;\n if (flavour === \"jsonpath\") {\n const marker = head[chain.start - 1];\n if (marker !== \"$\" && marker !== \"@\") return null;\n start -= 1;\n }\n if (flavour === \"cel\" && chain.rooted) return null; // a leading `.` is not CEL\n\n return {\n segments: chain.segments,\n leaf,\n startColumn: start + 1,\n endColumn: position.column,\n typed: before.slice(start),\n };\n}\n\ninterface Chain {\n segments: PathSegment[];\n /** Index in `head` where the segment list starts, root marker excluded. */\n start: number;\n /** Whether `head` ends with the dot that opens a new segment. */\n dotted: boolean;\n /** Whether the outermost segment is preceded by a `.`, as go templates need. */\n rooted: boolean;\n}\n\n/**\n * Parses the trailing path of `head` backwards.\n *\n * Backwards because a path has no left boundary of its own: it ends where the\n * expression around it begins, and that is only knowable by walking off it.\n */\nfunction parseChain(head: string): Chain | null {\n let pos = head.length;\n const dotted = pos > 0 && head[pos - 1] === \".\";\n if (dotted) pos--;\n\n const reversed: PathSegment[] = [];\n let rooted = false;\n\n for (;;) {\n if (pos > 0 && head[pos - 1] === \"]\") {\n const open = head.lastIndexOf(\"[\", pos - 2);\n if (open < 0) return null;\n const segment = parseSubscript(head.slice(open + 1, pos - 1));\n if (segment === null) return null;\n reversed.push(segment);\n pos = open;\n rooted = false;\n continue;\n }\n if (pos > 0 && IDENT.test(head[pos - 1]!)) {\n let start = pos;\n while (start > 0 && IDENT.test(head[start - 1]!)) start--;\n reversed.push(head.slice(start, pos));\n pos = start;\n rooted = pos > 0 && head[pos - 1] === \".\";\n if (rooted) {\n pos--;\n continue;\n }\n break;\n }\n break;\n }\n\n // Only the trailing dot was consumed, so that dot is itself the root marker.\n if (reversed.length === 0 && dotted) rooted = true;\n\n return { segments: reversed.reverse(), start: pos, dotted, rooted };\n}\n\nfunction parseSubscript(inner: string): PathSegment | null {\n const match = SUBSCRIPT.exec(inner.trim());\n if (!match) return null;\n if (match[1] !== undefined) return Number(match[1]);\n const quoted = match[2] ?? match[3]!;\n try {\n return JSON.parse(`\"${quoted.replace(/\\\\'/g, \"'\")}\"`) as string;\n } catch {\n return null;\n }\n}\n\n/**\n * Whether the cursor sits between template delimiters. Outside them the text is\n * literal output, where a key path means nothing.\n */\nfunction insideAction(before: string): boolean {\n const { left, right, leftComment, rightComment } = spec.gotemplate.delimiters;\n\n const open = before.lastIndexOf(left);\n if (open < 0) return false;\n if (before.lastIndexOf(right) > open) return false;\n\n // `{{/*` opens with the ordinary left delimiter, so an unterminated comment\n // reads as an open action unless it is checked for separately.\n const comment = before.lastIndexOf(leftComment);\n if (comment >= open && before.lastIndexOf(rightComment) < comment) return false;\n\n return true;\n}\n"],"mappings":";;;AAgCA,IAAM,QAAQ;AACd,IAAM,YAAY;;;;;;;;;AAUlB,SAAgB,oBACd,OACA,UACA,YAC0B;CAC1B,MAAM,UAAU,YAAY,UAAU;CACtC,IAAI,CAAC,SAAS,OAAO;CAGrB,MAAM,SADO,MAAM,eAAe,SAAS,UAC5B,CAAA,CAAK,MAAM,GAAG,SAAS,SAAS,CAAC;CAEhD,IAAI,YAAY,gBAAgB,CAAC,aAAa,MAAM,GAAG,OAAO;CAE9D,IAAI,YAAY,OAAO;CACvB,OAAO,YAAY,KAAK,MAAM,KAAK,OAAO,YAAY,EAAG,GAAG;CAC5D,MAAM,OAAO,OAAO,MAAM,SAAS;CACnC,MAAM,OAAO,OAAO,MAAM,GAAG,SAAS;CAEtC,MAAM,QAAQ,WAAW,IAAI;CAC7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,WAAW,KAAK,QAAQ,SAAS;CAE9C,OAAO;EAAE,UAAU,SAAS,QAAQ;EAAG,OAAO;EAAK;EAAQ;CAAO;AACpE;AAEA,SAAS,eAAe,OAAmC;CACzD,MAAM,QAAQ,UAAU,KAAK,MAAM,KAAK,CAAC;CACzC,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,MAAM,OAAO,KAAA,GAAW,OAAO,OAAO,MAAM,EAAE;CAClD,MAAM,SAAS,MAAM,MAAM,MAAM;CACjC,IAAI;EACF,OAAO,KAAK,MAAM,IAAI,OAAO,QAAQ,QAAQ,GAAG,EAAE,EAAE;CACtD,QAAQ;EACN,OAAO;CACT;AACF;;;;;AAMA,SAAS,aAAa,QAAyB;CAC7C,MAAM,EAAE,MAAM,OAAO,aAAa,iBAAiB,KAAK,WAAW;CAEnE,MAAM,OAAO,OAAO,YAAY,IAAI;CACpC,IAAI,OAAO,GAAG,OAAO;CACrB,IAAI,OAAO,YAAY,KAAK,IAAI,MAAM,OAAO;CAI7C,MAAM,UAAU,OAAO,YAAY,WAAW;CAC9C,IAAI,WAAW,QAAQ,OAAO,YAAY,YAAY,IAAI,SAAS,OAAO;CAE1E,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../src/expressions/lang/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../src/expressions/lang/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAExE,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;AAEtD,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAElE;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEzE;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE,CAE9D;AAED,iDAAiD;AACjD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE,CAErE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.cjs","names":[],"sources":["../../../src/expressions/lang/theme.ts"],"sourcesContent":["import type { Monaco } from \"./types\";\n\nexport const GOMPLATE_LIGHT_THEME = \"gomplate-light\";\nexport const GOMPLATE_DARK_THEME = \"gomplate-dark\";\n\n/**\n * Token rules shared by both themes. Only the colours differ, so the token\n * vocabulary stays in one place.\n *\n * The token names are the ones the generated tokenizers emit; anything not\n * listed falls back to the base theme, which is why the themes inherit from\n * `vs` and `vs-dark` rather than starting from nothing.\n */\nconst TOKENS = [\n \"namespace\",\n \"function\",\n \"function.member\",\n \"function.builtin\",\n \"keyword.macro\",\n \"keyword.constant\",\n \"keyword.directive\",\n \"operator.optional\",\n \"operator.pipe\",\n \"delimiter.template\",\n \"variable\",\n \"variable.field\",\n \"variable.anchor\",\n \"variable.root\",\n \"variable.current\",\n \"identifier.escaped\",\n \"string.bytes\",\n \"number.uint\",\n \"number.float\",\n \"type.yaml\",\n \"type.json\",\n \"comment.directive\",\n] as const;\n\ntype Palette = Record<(typeof TOKENS)[number], string>;\n\nconst LIGHT: Palette = {\n namespace: \"267F99\",\n function: \"795E26\",\n \"function.member\": \"795E26\",\n \"function.builtin\": \"0000FF\",\n \"keyword.macro\": \"AF00DB\",\n \"keyword.constant\": \"0000FF\",\n \"keyword.directive\": \"AF00DB\",\n \"operator.optional\": \"AF00DB\",\n \"operator.pipe\": \"AF00DB\",\n \"delimiter.template\": \"AF00DB\",\n variable: \"001080\",\n \"variable.field\": \"001080\",\n \"variable.anchor\": \"267F99\",\n \"variable.root\": \"AF00DB\",\n \"variable.current\": \"AF00DB\",\n \"identifier.escaped\": \"001080\",\n \"string.bytes\": \"A31515\",\n \"number.uint\": \"098658\",\n \"number.float\": \"098658\",\n \"type.yaml\": \"0451A5\",\n \"type.json\": \"0451A5\",\n \"comment.directive\": \"008000\",\n};\n\nconst DARK: Palette = {\n namespace: \"4EC9B0\",\n function: \"DCDCAA\",\n \"function.member\": \"DCDCAA\",\n \"function.builtin\": \"569CD6\",\n \"keyword.macro\": \"C586C0\",\n \"keyword.constant\": \"569CD6\",\n \"keyword.directive\": \"C586C0\",\n \"operator.optional\": \"C586C0\",\n \"operator.pipe\": \"C586C0\",\n \"delimiter.template\": \"C586C0\",\n variable: \"9CDCFE\",\n \"variable.field\": \"9CDCFE\",\n \"variable.anchor\": \"4EC9B0\",\n \"variable.root\": \"C586C0\",\n \"variable.current\": \"C586C0\",\n \"identifier.escaped\": \"9CDCFE\",\n \"string.bytes\": \"CE9178\",\n \"number.uint\": \"B5CEA8\",\n \"number.float\": \"B5CEA8\",\n \"type.yaml\": \"9CDCFE\",\n \"type.json\": \"9CDCFE\",\n \"comment.directive\": \"6A9955\",\n};\n\n/** Defines the gomplate themes. Idempotent -- Monaco overwrites by name. */\nexport function defineThemes(monaco: Monaco) {\n monaco.editor.defineTheme(GOMPLATE_LIGHT_THEME, {\n base: \"vs\",\n inherit: true,\n rules: rulesFor(LIGHT),\n colors: {},\n });\n monaco.editor.defineTheme(GOMPLATE_DARK_THEME, {\n base: \"vs-dark\",\n inherit: true,\n rules: rulesFor(DARK),\n colors: {},\n });\n}\n\nfunction rulesFor(palette: Palette) {\n return TOKENS.map((token) => ({ token, foreground: palette[token] }));\n}\n"],"mappings":";AAEA,IAAa,uBAAuB;AACpC,IAAa,sBAAsB;;;;;;;;;AAUnC,IAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,IAAM,QAAiB;CACrB,WAAW;CACX,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,UAAU;CACV,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,qBAAqB;AACvB;AAEA,IAAM,OAAgB;CACpB,WAAW;CACX,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,UAAU;CACV,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,qBAAqB;AACvB;;AAGA,SAAgB,aAAa,QAAgB;CAC3C,OAAO,OAAO,YAAY,sBAAsB;EAC9C,MAAM;EACN,SAAS;EACT,OAAO,SAAS,KAAK;EACrB,QAAQ,CAAC;CACX,CAAC;CACD,OAAO,OAAO,YAAY,qBAAqB;EAC7C,MAAM;EACN,SAAS;EACT,OAAO,SAAS,IAAI;EACpB,QAAQ,CAAC;CACX,CAAC;AACH;AAEA,SAAS,SAAS,SAAkB;CAClC,OAAO,OAAO,KAAK,WAAW;EAAE;EAAO,YAAY,QAAQ;CAAO,EAAE;AACtE"}
|
|
1
|
+
{"version":3,"file":"theme.cjs","names":[],"sources":["../../../src/expressions/lang/theme.ts"],"sourcesContent":["import type { Monaco } from \"./types.js\";\n\nexport const GOMPLATE_LIGHT_THEME = \"gomplate-light\";\nexport const GOMPLATE_DARK_THEME = \"gomplate-dark\";\n\n/**\n * Token rules shared by both themes. Only the colours differ, so the token\n * vocabulary stays in one place.\n *\n * The token names are the ones the generated tokenizers emit; anything not\n * listed falls back to the base theme, which is why the themes inherit from\n * `vs` and `vs-dark` rather than starting from nothing.\n */\nconst TOKENS = [\n \"namespace\",\n \"function\",\n \"function.member\",\n \"function.builtin\",\n \"keyword.macro\",\n \"keyword.constant\",\n \"keyword.directive\",\n \"operator.optional\",\n \"operator.pipe\",\n \"delimiter.template\",\n \"variable\",\n \"variable.field\",\n \"variable.anchor\",\n \"variable.root\",\n \"variable.current\",\n \"identifier.escaped\",\n \"string.bytes\",\n \"number.uint\",\n \"number.float\",\n \"type.yaml\",\n \"type.json\",\n \"comment.directive\",\n] as const;\n\ntype Palette = Record<(typeof TOKENS)[number], string>;\n\nconst LIGHT: Palette = {\n namespace: \"267F99\",\n function: \"795E26\",\n \"function.member\": \"795E26\",\n \"function.builtin\": \"0000FF\",\n \"keyword.macro\": \"AF00DB\",\n \"keyword.constant\": \"0000FF\",\n \"keyword.directive\": \"AF00DB\",\n \"operator.optional\": \"AF00DB\",\n \"operator.pipe\": \"AF00DB\",\n \"delimiter.template\": \"AF00DB\",\n variable: \"001080\",\n \"variable.field\": \"001080\",\n \"variable.anchor\": \"267F99\",\n \"variable.root\": \"AF00DB\",\n \"variable.current\": \"AF00DB\",\n \"identifier.escaped\": \"001080\",\n \"string.bytes\": \"A31515\",\n \"number.uint\": \"098658\",\n \"number.float\": \"098658\",\n \"type.yaml\": \"0451A5\",\n \"type.json\": \"0451A5\",\n \"comment.directive\": \"008000\",\n};\n\nconst DARK: Palette = {\n namespace: \"4EC9B0\",\n function: \"DCDCAA\",\n \"function.member\": \"DCDCAA\",\n \"function.builtin\": \"569CD6\",\n \"keyword.macro\": \"C586C0\",\n \"keyword.constant\": \"569CD6\",\n \"keyword.directive\": \"C586C0\",\n \"operator.optional\": \"C586C0\",\n \"operator.pipe\": \"C586C0\",\n \"delimiter.template\": \"C586C0\",\n variable: \"9CDCFE\",\n \"variable.field\": \"9CDCFE\",\n \"variable.anchor\": \"4EC9B0\",\n \"variable.root\": \"C586C0\",\n \"variable.current\": \"C586C0\",\n \"identifier.escaped\": \"9CDCFE\",\n \"string.bytes\": \"CE9178\",\n \"number.uint\": \"B5CEA8\",\n \"number.float\": \"B5CEA8\",\n \"type.yaml\": \"9CDCFE\",\n \"type.json\": \"9CDCFE\",\n \"comment.directive\": \"6A9955\",\n};\n\n/** Defines the gomplate themes. Idempotent -- Monaco overwrites by name. */\nexport function defineThemes(monaco: Monaco) {\n monaco.editor.defineTheme(GOMPLATE_LIGHT_THEME, {\n base: \"vs\",\n inherit: true,\n rules: rulesFor(LIGHT),\n colors: {},\n });\n monaco.editor.defineTheme(GOMPLATE_DARK_THEME, {\n base: \"vs-dark\",\n inherit: true,\n rules: rulesFor(DARK),\n colors: {},\n });\n}\n\nfunction rulesFor(palette: Palette) {\n return TOKENS.map((token) => ({ token, foreground: palette[token] }));\n}\n"],"mappings":";AAEA,IAAa,uBAAuB;AACpC,IAAa,sBAAsB;;;;;;;;;AAUnC,IAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,IAAM,QAAiB;CACrB,WAAW;CACX,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,UAAU;CACV,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,qBAAqB;AACvB;AAEA,IAAM,OAAgB;CACpB,WAAW;CACX,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,UAAU;CACV,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,qBAAqB;AACvB;;AAGA,SAAgB,aAAa,QAAgB;CAC3C,OAAO,OAAO,YAAY,sBAAsB;EAC9C,MAAM;EACN,SAAS;EACT,OAAO,SAAS,KAAK;EACrB,QAAQ,CAAC;CACX,CAAC;CACD,OAAO,OAAO,YAAY,qBAAqB;EAC7C,MAAM;EACN,SAAS;EACT,OAAO,SAAS,IAAI;EACpB,QAAQ,CAAC;CACX,CAAC;AACH;AAEA,SAAS,SAAS,SAAkB;CAClC,OAAO,OAAO,KAAK,WAAW;EAAE;EAAO,YAAY,QAAQ;CAAO,EAAE;AACtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/expressions/lang/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/expressions/lang/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AAuFnD,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,QAa1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":[],"sources":["../../../src/expressions/lang/theme.ts"],"sourcesContent":["import type { Monaco } from \"./types\";\n\nexport const GOMPLATE_LIGHT_THEME = \"gomplate-light\";\nexport const GOMPLATE_DARK_THEME = \"gomplate-dark\";\n\n/**\n * Token rules shared by both themes. Only the colours differ, so the token\n * vocabulary stays in one place.\n *\n * The token names are the ones the generated tokenizers emit; anything not\n * listed falls back to the base theme, which is why the themes inherit from\n * `vs` and `vs-dark` rather than starting from nothing.\n */\nconst TOKENS = [\n \"namespace\",\n \"function\",\n \"function.member\",\n \"function.builtin\",\n \"keyword.macro\",\n \"keyword.constant\",\n \"keyword.directive\",\n \"operator.optional\",\n \"operator.pipe\",\n \"delimiter.template\",\n \"variable\",\n \"variable.field\",\n \"variable.anchor\",\n \"variable.root\",\n \"variable.current\",\n \"identifier.escaped\",\n \"string.bytes\",\n \"number.uint\",\n \"number.float\",\n \"type.yaml\",\n \"type.json\",\n \"comment.directive\",\n] as const;\n\ntype Palette = Record<(typeof TOKENS)[number], string>;\n\nconst LIGHT: Palette = {\n namespace: \"267F99\",\n function: \"795E26\",\n \"function.member\": \"795E26\",\n \"function.builtin\": \"0000FF\",\n \"keyword.macro\": \"AF00DB\",\n \"keyword.constant\": \"0000FF\",\n \"keyword.directive\": \"AF00DB\",\n \"operator.optional\": \"AF00DB\",\n \"operator.pipe\": \"AF00DB\",\n \"delimiter.template\": \"AF00DB\",\n variable: \"001080\",\n \"variable.field\": \"001080\",\n \"variable.anchor\": \"267F99\",\n \"variable.root\": \"AF00DB\",\n \"variable.current\": \"AF00DB\",\n \"identifier.escaped\": \"001080\",\n \"string.bytes\": \"A31515\",\n \"number.uint\": \"098658\",\n \"number.float\": \"098658\",\n \"type.yaml\": \"0451A5\",\n \"type.json\": \"0451A5\",\n \"comment.directive\": \"008000\",\n};\n\nconst DARK: Palette = {\n namespace: \"4EC9B0\",\n function: \"DCDCAA\",\n \"function.member\": \"DCDCAA\",\n \"function.builtin\": \"569CD6\",\n \"keyword.macro\": \"C586C0\",\n \"keyword.constant\": \"569CD6\",\n \"keyword.directive\": \"C586C0\",\n \"operator.optional\": \"C586C0\",\n \"operator.pipe\": \"C586C0\",\n \"delimiter.template\": \"C586C0\",\n variable: \"9CDCFE\",\n \"variable.field\": \"9CDCFE\",\n \"variable.anchor\": \"4EC9B0\",\n \"variable.root\": \"C586C0\",\n \"variable.current\": \"C586C0\",\n \"identifier.escaped\": \"9CDCFE\",\n \"string.bytes\": \"CE9178\",\n \"number.uint\": \"B5CEA8\",\n \"number.float\": \"B5CEA8\",\n \"type.yaml\": \"9CDCFE\",\n \"type.json\": \"9CDCFE\",\n \"comment.directive\": \"6A9955\",\n};\n\n/** Defines the gomplate themes. Idempotent -- Monaco overwrites by name. */\nexport function defineThemes(monaco: Monaco) {\n monaco.editor.defineTheme(GOMPLATE_LIGHT_THEME, {\n base: \"vs\",\n inherit: true,\n rules: rulesFor(LIGHT),\n colors: {},\n });\n monaco.editor.defineTheme(GOMPLATE_DARK_THEME, {\n base: \"vs-dark\",\n inherit: true,\n rules: rulesFor(DARK),\n colors: {},\n });\n}\n\nfunction rulesFor(palette: Palette) {\n return TOKENS.map((token) => ({ token, foreground: palette[token] }));\n}\n"],"mappings":";AAEA,IAAa,uBAAuB;AACpC,IAAa,sBAAsB;;;;;;;;;AAUnC,IAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,IAAM,QAAiB;CACrB,WAAW;CACX,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,UAAU;CACV,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,qBAAqB;AACvB;AAEA,IAAM,OAAgB;CACpB,WAAW;CACX,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,UAAU;CACV,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,qBAAqB;AACvB;;AAGA,SAAgB,aAAa,QAAgB;CAC3C,OAAO,OAAO,YAAY,sBAAsB;EAC9C,MAAM;EACN,SAAS;EACT,OAAO,SAAS,KAAK;EACrB,QAAQ,CAAC;CACX,CAAC;CACD,OAAO,OAAO,YAAY,qBAAqB;EAC7C,MAAM;EACN,SAAS;EACT,OAAO,SAAS,IAAI;EACpB,QAAQ,CAAC;CACX,CAAC;AACH;AAEA,SAAS,SAAS,SAAkB;CAClC,OAAO,OAAO,KAAK,WAAW;EAAE;EAAO,YAAY,QAAQ;CAAO,EAAE;AACtE"}
|
|
1
|
+
{"version":3,"file":"theme.js","names":[],"sources":["../../../src/expressions/lang/theme.ts"],"sourcesContent":["import type { Monaco } from \"./types.js\";\n\nexport const GOMPLATE_LIGHT_THEME = \"gomplate-light\";\nexport const GOMPLATE_DARK_THEME = \"gomplate-dark\";\n\n/**\n * Token rules shared by both themes. Only the colours differ, so the token\n * vocabulary stays in one place.\n *\n * The token names are the ones the generated tokenizers emit; anything not\n * listed falls back to the base theme, which is why the themes inherit from\n * `vs` and `vs-dark` rather than starting from nothing.\n */\nconst TOKENS = [\n \"namespace\",\n \"function\",\n \"function.member\",\n \"function.builtin\",\n \"keyword.macro\",\n \"keyword.constant\",\n \"keyword.directive\",\n \"operator.optional\",\n \"operator.pipe\",\n \"delimiter.template\",\n \"variable\",\n \"variable.field\",\n \"variable.anchor\",\n \"variable.root\",\n \"variable.current\",\n \"identifier.escaped\",\n \"string.bytes\",\n \"number.uint\",\n \"number.float\",\n \"type.yaml\",\n \"type.json\",\n \"comment.directive\",\n] as const;\n\ntype Palette = Record<(typeof TOKENS)[number], string>;\n\nconst LIGHT: Palette = {\n namespace: \"267F99\",\n function: \"795E26\",\n \"function.member\": \"795E26\",\n \"function.builtin\": \"0000FF\",\n \"keyword.macro\": \"AF00DB\",\n \"keyword.constant\": \"0000FF\",\n \"keyword.directive\": \"AF00DB\",\n \"operator.optional\": \"AF00DB\",\n \"operator.pipe\": \"AF00DB\",\n \"delimiter.template\": \"AF00DB\",\n variable: \"001080\",\n \"variable.field\": \"001080\",\n \"variable.anchor\": \"267F99\",\n \"variable.root\": \"AF00DB\",\n \"variable.current\": \"AF00DB\",\n \"identifier.escaped\": \"001080\",\n \"string.bytes\": \"A31515\",\n \"number.uint\": \"098658\",\n \"number.float\": \"098658\",\n \"type.yaml\": \"0451A5\",\n \"type.json\": \"0451A5\",\n \"comment.directive\": \"008000\",\n};\n\nconst DARK: Palette = {\n namespace: \"4EC9B0\",\n function: \"DCDCAA\",\n \"function.member\": \"DCDCAA\",\n \"function.builtin\": \"569CD6\",\n \"keyword.macro\": \"C586C0\",\n \"keyword.constant\": \"569CD6\",\n \"keyword.directive\": \"C586C0\",\n \"operator.optional\": \"C586C0\",\n \"operator.pipe\": \"C586C0\",\n \"delimiter.template\": \"C586C0\",\n variable: \"9CDCFE\",\n \"variable.field\": \"9CDCFE\",\n \"variable.anchor\": \"4EC9B0\",\n \"variable.root\": \"C586C0\",\n \"variable.current\": \"C586C0\",\n \"identifier.escaped\": \"9CDCFE\",\n \"string.bytes\": \"CE9178\",\n \"number.uint\": \"B5CEA8\",\n \"number.float\": \"B5CEA8\",\n \"type.yaml\": \"9CDCFE\",\n \"type.json\": \"9CDCFE\",\n \"comment.directive\": \"6A9955\",\n};\n\n/** Defines the gomplate themes. Idempotent -- Monaco overwrites by name. */\nexport function defineThemes(monaco: Monaco) {\n monaco.editor.defineTheme(GOMPLATE_LIGHT_THEME, {\n base: \"vs\",\n inherit: true,\n rules: rulesFor(LIGHT),\n colors: {},\n });\n monaco.editor.defineTheme(GOMPLATE_DARK_THEME, {\n base: \"vs-dark\",\n inherit: true,\n rules: rulesFor(DARK),\n colors: {},\n });\n}\n\nfunction rulesFor(palette: Palette) {\n return TOKENS.map((token) => ({ token, foreground: palette[token] }));\n}\n"],"mappings":";AAEA,IAAa,uBAAuB;AACpC,IAAa,sBAAsB;;;;;;;;;AAUnC,IAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,IAAM,QAAiB;CACrB,WAAW;CACX,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,UAAU;CACV,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,qBAAqB;AACvB;AAEA,IAAM,OAAgB;CACpB,WAAW;CACX,UAAU;CACV,mBAAmB;CACnB,oBAAoB;CACpB,iBAAiB;CACjB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,UAAU;CACV,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,qBAAqB;AACvB;;AAGA,SAAgB,aAAa,QAAgB;CAC3C,OAAO,OAAO,YAAY,sBAAsB;EAC9C,MAAM;EACN,SAAS;EACT,OAAO,SAAS,KAAK;EACrB,QAAQ,CAAC;CACX,CAAC;CACD,OAAO,OAAO,YAAY,qBAAqB;EAC7C,MAAM;EACN,SAAS;EACT,OAAO,SAAS,IAAI;EACpB,QAAQ,CAAC;CACX,CAAC;AACH;AAEA,SAAS,SAAS,SAAkB;CAClC,OAAO,OAAO,KAAK,WAAW;EAAE;EAAO,YAAY,QAAQ;CAAO,EAAE;AACtE"}
|
|
@@ -25,6 +25,10 @@ export interface SpecFunction {
|
|
|
25
25
|
signature?: string;
|
|
26
26
|
overloads?: Overload[];
|
|
27
27
|
examples?: string[];
|
|
28
|
+
/** The opt-in extension that registers it (its gomplate.Extension name); absent for the core. */
|
|
29
|
+
group?: string;
|
|
30
|
+
/** The function's section in a published reference page; hover and completion link to it. */
|
|
31
|
+
docsUrl?: string;
|
|
28
32
|
}
|
|
29
33
|
/** A CEL macro. Expanded at parse time, so never a function. */
|
|
30
34
|
export interface SpecMacro {
|
|
@@ -33,6 +37,8 @@ export interface SpecMacro {
|
|
|
33
37
|
receiverStyle: boolean;
|
|
34
38
|
doc?: string;
|
|
35
39
|
examples?: string[];
|
|
40
|
+
/** The macro's section in a published reference page. */
|
|
41
|
+
docsUrl?: string;
|
|
36
42
|
}
|
|
37
43
|
export interface CelSpec {
|
|
38
44
|
namespaces: string[];
|
|
@@ -60,6 +66,12 @@ export interface GoTemplateSpec {
|
|
|
60
66
|
export interface GomplateSpec {
|
|
61
67
|
cel: CelSpec;
|
|
62
68
|
gotemplate: GoTemplateSpec;
|
|
69
|
+
/**
|
|
70
|
+
* The host's whole surface (catalog.Build): it replaces the packaged
|
|
71
|
+
* catalogue instead of being added to it, so functions the host does not
|
|
72
|
+
* register are not offered.
|
|
73
|
+
*/
|
|
74
|
+
complete?: boolean;
|
|
63
75
|
}
|
|
64
76
|
/**
|
|
65
77
|
* One snippet plus the token boundaries the language's real lexer produces.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/expressions/lang/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,6DAA6D;AAC7D,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,0EAA0E;AAC1E,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAA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E,YAAY,EAAE,CAAC;CAC3B;AAED,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,OAAO,CAAC;IACb,UAAU,EAAE,cAAc,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -9,11 +9,11 @@ var NO_EXAMPLES = [];
|
|
|
9
9
|
* The full expression playground, for a host that evaluates on its own engine.
|
|
10
10
|
*
|
|
11
11
|
* It owns the three things the playground would otherwise fetch from a gomplate
|
|
12
|
-
* server: the evaluator (the host's), the catalogue (the
|
|
13
|
-
* examples (the host's, or none). So nothing here makes a
|
|
14
|
-
* endpoint the host does not serve.
|
|
12
|
+
* server: the evaluator (the host's), the catalogue (the host's, else the
|
|
13
|
+
* packaged one) and the examples (the host's, or none). So nothing here makes a
|
|
14
|
+
* request to an endpoint the host does not serve.
|
|
15
15
|
*/
|
|
16
|
-
function EmbeddedPlayground({ language, source, input, onSourceChange, evaluate, samples, examples = NO_EXAMPLES, expectation, formatPath, executionMode }) {
|
|
16
|
+
function EmbeddedPlayground({ language, source, input, onSourceChange, evaluate, samples, examples = NO_EXAMPLES, expectation, formatPath, executionMode, spec: hostSpec, reference }) {
|
|
17
17
|
const languages = (0, react.useMemo)(() => [require_languages.languageById(language)], [language]);
|
|
18
18
|
const [initial] = (0, react.useState)(() => ({
|
|
19
19
|
language,
|
|
@@ -23,8 +23,9 @@ function EmbeddedPlayground({ language, source, input, onSourceChange, evaluate,
|
|
|
23
23
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ExpressionPlayground.ExpressionPlayground, {
|
|
24
24
|
className: "h-full",
|
|
25
25
|
languages,
|
|
26
|
-
spec: require_index.spec,
|
|
26
|
+
spec: hostSpec ?? require_index.spec,
|
|
27
27
|
examples,
|
|
28
|
+
...reference ? { reference } : {},
|
|
28
29
|
evaluate,
|
|
29
30
|
samples,
|
|
30
31
|
formatPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedPlayground.cjs","names":["useMemo","languageById","useState","ExpressionPlayground"],"sources":["../../../src/expressions/playground/EmbeddedPlayground.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { spec } from \"../lang/index.ts\";\nimport type { EvalRequest, EvalResponse, Example, FormatPath, PlaygroundSample, ResultExpectation } from \"./api.ts\";\nimport { ExpressionPlayground } from \"./ExpressionPlayground.tsx\";\nimport { languageById } from \"./languages.ts\";\n\nconst NO_EXAMPLES: Example[] = [];\n\nexport interface EmbeddedPlaygroundProps {\n /** The one language this embedding writes; there is no switcher. */\n language: \"cel\" | \"jsonpath\";\n /** The expression the editor opens with. */\n source: string;\n /** The document the input pane opens with. */\n input: string;\n /** Called with the expression as it is edited, for the host's Apply. */\n onSourceChange: (source: string) => void;\n /** The host's evaluator: the engine that runs the expression for real. */\n evaluate: (request: EvalRequest) => Promise<EvalResponse>;\n samples: PlaygroundSample[];\n /** \"Load an example\" entries; none by default. */\n examples?: Example[];\n expectation?: ResultExpectation | undefined;\n formatPath: FormatPath;\n /** Explicit leaves evaluation to the Run button. */\n executionMode?: \"automatic\" | \"explicit\";\n}\n\n/**\n * The full expression playground, for a host that evaluates on its own engine.\n *\n * It owns the three things the playground would otherwise fetch from a gomplate\n * server: the evaluator (the host's), the catalogue (the packaged one) and the
|
|
1
|
+
{"version":3,"file":"EmbeddedPlayground.cjs","names":["useMemo","languageById","useState","ExpressionPlayground","spec"],"sources":["../../../src/expressions/playground/EmbeddedPlayground.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { spec } from \"../lang/index.ts\";\nimport type { GomplateSpec } from \"../lang/index.ts\";\nimport type { EvalRequest, EvalResponse, Example, FormatPath, PlaygroundSample, ResultExpectation } from \"./api.ts\";\nimport { ExpressionPlayground } from \"./ExpressionPlayground.tsx\";\nimport { languageById } from \"./languages.ts\";\n\nconst NO_EXAMPLES: Example[] = [];\n\nexport interface EmbeddedPlaygroundProps {\n /** The one language this embedding writes; there is no switcher. */\n language: \"cel\" | \"jsonpath\";\n /** The expression the editor opens with. */\n source: string;\n /** The document the input pane opens with. */\n input: string;\n /** Called with the expression as it is edited, for the host's Apply. */\n onSourceChange: (source: string) => void;\n /** The host's evaluator: the engine that runs the expression for real. */\n evaluate: (request: EvalRequest) => Promise<EvalResponse>;\n samples: PlaygroundSample[];\n /** \"Load an example\" entries; none by default. */\n examples?: Example[];\n expectation?: ResultExpectation | undefined;\n formatPath: FormatPath;\n /** Explicit leaves evaluation to the Run button. */\n executionMode?: \"automatic\" | \"explicit\";\n /**\n * The host's catalogue (a gomplate catalog.Build spec). Omitted, the packaged\n * one is used; a `complete` spec replaces it.\n */\n spec?: GomplateSpec | undefined;\n /** The host's reference page per catalogue, shown in place of the Functions table. */\n reference?: Partial<Record<\"cel\" | \"gotemplate\", string>> | undefined;\n}\n\n/**\n * The full expression playground, for a host that evaluates on its own engine.\n *\n * It owns the three things the playground would otherwise fetch from a gomplate\n * server: the evaluator (the host's), the catalogue (the host's, else the\n * packaged one) and the examples (the host's, or none). So nothing here makes a\n * request to an endpoint the host does not serve.\n */\nexport function EmbeddedPlayground({\n language,\n source,\n input,\n onSourceChange,\n evaluate,\n samples,\n examples = NO_EXAMPLES,\n expectation,\n formatPath,\n executionMode,\n spec: hostSpec,\n reference,\n}: EmbeddedPlaygroundProps) {\n const languages = useMemo(() => [languageById(language)], [language]);\n // The starting state only: the playground owns the text from here on, and\n // reports edits through `onSourceChange`.\n const [initial] = useState(() => ({ language, source, input }));\n\n return (\n <ExpressionPlayground\n className=\"h-full\"\n languages={languages}\n spec={hostSpec ?? spec}\n examples={examples}\n {...(reference ? { reference } : {})}\n evaluate={evaluate}\n samples={samples}\n formatPath={formatPath}\n pathInsertion={language === \"jsonpath\" ? \"replace\" : \"caret\"}\n defaultValue={initial}\n onChange={(state) => onSourceChange(state.source)}\n {...(expectation ? { expectation } : {})}\n {...(executionMode ? { executionMode } : {})}\n />\n );\n}\n"],"mappings":";;;;;;AAOA,IAAM,cAAyB,CAAC;;;;;;;;;AAqChC,SAAgB,mBAAmB,EACjC,UACA,QACA,OACA,gBACA,UACA,SACA,WAAW,aACX,aACA,YACA,eACA,MAAM,UACN,aAC0B;CAC1B,MAAM,aAAA,GAAYA,MAAAA,QAAAA,OAAc,CAACC,kBAAAA,aAAa,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;CAGpE,MAAM,CAAC,YAAA,GAAWC,MAAAA,SAAAA,QAAgB;EAAE;EAAU;EAAQ;CAAM,EAAE;CAE9D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,sBAAD;EACE,WAAU;EACC;EACX,MAAM,YAAYC,cAAAA;EACR;EACV,GAAK,YAAY,EAAE,UAAU,IAAI,CAAC;EACxB;EACD;EACG;EACZ,eAAe,aAAa,aAAa,YAAY;EACrD,cAAc;EACd,WAAW,UAAU,eAAe,MAAM,MAAM;EAChD,GAAK,cAAc,EAAE,YAAY,IAAI,CAAC;EACtC,GAAK,gBAAgB,EAAE,cAAc,IAAI,CAAC;CAC3C,CAAA;AAEL"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GomplateSpec } from '../lang/index.js';
|
|
1
2
|
import { EvalRequest, EvalResponse, Example, FormatPath, PlaygroundSample, ResultExpectation } from './api.js';
|
|
2
3
|
export interface EmbeddedPlaygroundProps {
|
|
3
4
|
/** The one language this embedding writes; there is no switcher. */
|
|
@@ -17,14 +18,21 @@ export interface EmbeddedPlaygroundProps {
|
|
|
17
18
|
formatPath: FormatPath;
|
|
18
19
|
/** Explicit leaves evaluation to the Run button. */
|
|
19
20
|
executionMode?: "automatic" | "explicit";
|
|
21
|
+
/**
|
|
22
|
+
* The host's catalogue (a gomplate catalog.Build spec). Omitted, the packaged
|
|
23
|
+
* one is used; a `complete` spec replaces it.
|
|
24
|
+
*/
|
|
25
|
+
spec?: GomplateSpec | undefined;
|
|
26
|
+
/** The host's reference page per catalogue, shown in place of the Functions table. */
|
|
27
|
+
reference?: Partial<Record<"cel" | "gotemplate", string>> | undefined;
|
|
20
28
|
}
|
|
21
29
|
/**
|
|
22
30
|
* The full expression playground, for a host that evaluates on its own engine.
|
|
23
31
|
*
|
|
24
32
|
* It owns the three things the playground would otherwise fetch from a gomplate
|
|
25
|
-
* server: the evaluator (the host's), the catalogue (the
|
|
26
|
-
* examples (the host's, or none). So nothing here makes a
|
|
27
|
-
* endpoint the host does not serve.
|
|
33
|
+
* server: the evaluator (the host's), the catalogue (the host's, else the
|
|
34
|
+
* packaged one) and the examples (the host's, or none). So nothing here makes a
|
|
35
|
+
* request to an endpoint the host does not serve.
|
|
28
36
|
*/
|
|
29
|
-
export declare function EmbeddedPlayground({ language, source, input, onSourceChange, evaluate, samples, examples, expectation, formatPath, executionMode, }: EmbeddedPlaygroundProps): import("react").JSX.Element;
|
|
37
|
+
export declare function EmbeddedPlayground({ language, source, input, onSourceChange, evaluate, samples, examples, expectation, formatPath, executionMode, spec: hostSpec, reference, }: EmbeddedPlaygroundProps): import("react").JSX.Element;
|
|
30
38
|
//# sourceMappingURL=EmbeddedPlayground.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedPlayground.d.ts","sourceRoot":"","sources":["../../../src/expressions/playground/EmbeddedPlayground.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMpH,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,QAAQ,EAAE,KAAK,GAAG,UAAU,CAAC;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rB,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC5C,UAAU,EAAE,UAAU,CAAC;IACvB,oDAAoD;IACpD,aAAa,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IACzC;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAChC,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,YAAY,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;CACvE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,MAAM,EACN,KAAK,EACL,cAAc,EACd,QAAQ,EACR,OAAO,EACP,QAAsB,EACtB,WAAW,EACX,UAAU,EACV,aAAa,EACb,IAAI,EAAE,QAAQ,EACd,SAAS,GACV,EAAE,uBAAuB,+BAuBzB"}
|
|
@@ -9,11 +9,11 @@ var NO_EXAMPLES = [];
|
|
|
9
9
|
* The full expression playground, for a host that evaluates on its own engine.
|
|
10
10
|
*
|
|
11
11
|
* It owns the three things the playground would otherwise fetch from a gomplate
|
|
12
|
-
* server: the evaluator (the host's), the catalogue (the
|
|
13
|
-
* examples (the host's, or none). So nothing here makes a
|
|
14
|
-
* endpoint the host does not serve.
|
|
12
|
+
* server: the evaluator (the host's), the catalogue (the host's, else the
|
|
13
|
+
* packaged one) and the examples (the host's, or none). So nothing here makes a
|
|
14
|
+
* request to an endpoint the host does not serve.
|
|
15
15
|
*/
|
|
16
|
-
function EmbeddedPlayground({ language, source, input, onSourceChange, evaluate, samples, examples = NO_EXAMPLES, expectation, formatPath, executionMode }) {
|
|
16
|
+
function EmbeddedPlayground({ language, source, input, onSourceChange, evaluate, samples, examples = NO_EXAMPLES, expectation, formatPath, executionMode, spec: hostSpec, reference }) {
|
|
17
17
|
const languages = useMemo(() => [languageById(language)], [language]);
|
|
18
18
|
const [initial] = useState(() => ({
|
|
19
19
|
language,
|
|
@@ -23,8 +23,9 @@ function EmbeddedPlayground({ language, source, input, onSourceChange, evaluate,
|
|
|
23
23
|
return /* @__PURE__ */ jsx(ExpressionPlayground, {
|
|
24
24
|
className: "h-full",
|
|
25
25
|
languages,
|
|
26
|
-
spec,
|
|
26
|
+
spec: hostSpec ?? spec,
|
|
27
27
|
examples,
|
|
28
|
+
...reference ? { reference } : {},
|
|
28
29
|
evaluate,
|
|
29
30
|
samples,
|
|
30
31
|
formatPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedPlayground.js","names":[],"sources":["../../../src/expressions/playground/EmbeddedPlayground.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { spec } from \"../lang/index.ts\";\nimport type { EvalRequest, EvalResponse, Example, FormatPath, PlaygroundSample, ResultExpectation } from \"./api.ts\";\nimport { ExpressionPlayground } from \"./ExpressionPlayground.tsx\";\nimport { languageById } from \"./languages.ts\";\n\nconst NO_EXAMPLES: Example[] = [];\n\nexport interface EmbeddedPlaygroundProps {\n /** The one language this embedding writes; there is no switcher. */\n language: \"cel\" | \"jsonpath\";\n /** The expression the editor opens with. */\n source: string;\n /** The document the input pane opens with. */\n input: string;\n /** Called with the expression as it is edited, for the host's Apply. */\n onSourceChange: (source: string) => void;\n /** The host's evaluator: the engine that runs the expression for real. */\n evaluate: (request: EvalRequest) => Promise<EvalResponse>;\n samples: PlaygroundSample[];\n /** \"Load an example\" entries; none by default. */\n examples?: Example[];\n expectation?: ResultExpectation | undefined;\n formatPath: FormatPath;\n /** Explicit leaves evaluation to the Run button. */\n executionMode?: \"automatic\" | \"explicit\";\n}\n\n/**\n * The full expression playground, for a host that evaluates on its own engine.\n *\n * It owns the three things the playground would otherwise fetch from a gomplate\n * server: the evaluator (the host's), the catalogue (the packaged one) and the
|
|
1
|
+
{"version":3,"file":"EmbeddedPlayground.js","names":[],"sources":["../../../src/expressions/playground/EmbeddedPlayground.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { spec } from \"../lang/index.ts\";\nimport type { GomplateSpec } from \"../lang/index.ts\";\nimport type { EvalRequest, EvalResponse, Example, FormatPath, PlaygroundSample, ResultExpectation } from \"./api.ts\";\nimport { ExpressionPlayground } from \"./ExpressionPlayground.tsx\";\nimport { languageById } from \"./languages.ts\";\n\nconst NO_EXAMPLES: Example[] = [];\n\nexport interface EmbeddedPlaygroundProps {\n /** The one language this embedding writes; there is no switcher. */\n language: \"cel\" | \"jsonpath\";\n /** The expression the editor opens with. */\n source: string;\n /** The document the input pane opens with. */\n input: string;\n /** Called with the expression as it is edited, for the host's Apply. */\n onSourceChange: (source: string) => void;\n /** The host's evaluator: the engine that runs the expression for real. */\n evaluate: (request: EvalRequest) => Promise<EvalResponse>;\n samples: PlaygroundSample[];\n /** \"Load an example\" entries; none by default. */\n examples?: Example[];\n expectation?: ResultExpectation | undefined;\n formatPath: FormatPath;\n /** Explicit leaves evaluation to the Run button. */\n executionMode?: \"automatic\" | \"explicit\";\n /**\n * The host's catalogue (a gomplate catalog.Build spec). Omitted, the packaged\n * one is used; a `complete` spec replaces it.\n */\n spec?: GomplateSpec | undefined;\n /** The host's reference page per catalogue, shown in place of the Functions table. */\n reference?: Partial<Record<\"cel\" | \"gotemplate\", string>> | undefined;\n}\n\n/**\n * The full expression playground, for a host that evaluates on its own engine.\n *\n * It owns the three things the playground would otherwise fetch from a gomplate\n * server: the evaluator (the host's), the catalogue (the host's, else the\n * packaged one) and the examples (the host's, or none). So nothing here makes a\n * request to an endpoint the host does not serve.\n */\nexport function EmbeddedPlayground({\n language,\n source,\n input,\n onSourceChange,\n evaluate,\n samples,\n examples = NO_EXAMPLES,\n expectation,\n formatPath,\n executionMode,\n spec: hostSpec,\n reference,\n}: EmbeddedPlaygroundProps) {\n const languages = useMemo(() => [languageById(language)], [language]);\n // The starting state only: the playground owns the text from here on, and\n // reports edits through `onSourceChange`.\n const [initial] = useState(() => ({ language, source, input }));\n\n return (\n <ExpressionPlayground\n className=\"h-full\"\n languages={languages}\n spec={hostSpec ?? spec}\n examples={examples}\n {...(reference ? { reference } : {})}\n evaluate={evaluate}\n samples={samples}\n formatPath={formatPath}\n pathInsertion={language === \"jsonpath\" ? \"replace\" : \"caret\"}\n defaultValue={initial}\n onChange={(state) => onSourceChange(state.source)}\n {...(expectation ? { expectation } : {})}\n {...(executionMode ? { executionMode } : {})}\n />\n );\n}\n"],"mappings":";;;;;;AAOA,IAAM,cAAyB,CAAC;;;;;;;;;AAqChC,SAAgB,mBAAmB,EACjC,UACA,QACA,OACA,gBACA,UACA,SACA,WAAW,aACX,aACA,YACA,eACA,MAAM,UACN,aAC0B;CAC1B,MAAM,YAAY,cAAc,CAAC,aAAa,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;CAGpE,MAAM,CAAC,WAAW,gBAAgB;EAAE;EAAU;EAAQ;CAAM,EAAE;CAE9D,OACE,oBAAC,sBAAD;EACE,WAAU;EACC;EACX,MAAM,YAAY;EACR;EACV,GAAK,YAAY,EAAE,UAAU,IAAI,CAAC;EACxB;EACD;EACG;EACZ,eAAe,aAAa,aAAa,YAAY;EACrD,cAAc;EACd,WAAW,UAAU,eAAe,MAAM,MAAM;EAChD,GAAK,cAAc,EAAE,YAAY,IAAI,CAAC;EACtC,GAAK,gBAAgB,EAAE,cAAc,IAAI,CAAC;CAC3C,CAAA;AAEL"}
|