diff --git a/package-lock.json b/package-lock.json index 75e767852..d8a3239b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,9 @@ "@docusaurus/preset-classic": "3.1.1", "@easyops-cn/docusaurus-search-local": "0.40.1", "@lottiefiles/react-lottie-player": "3.5.3", - "@openfga/frontend-utils": "^0.2.0-beta.6", + "@openfga/frontend-utils": "^0.2.0-beta.9", "@openfga/sdk": "^0.3.5", - "@openfga/syntax-transformer": "^0.2.0-beta.11", + "@openfga/syntax-transformer": "^0.2.0-beta.17", "assert-never": "1.2.1", "clsx": "2.1.0", "path-browserify": "1.0.1", @@ -3393,11 +3393,11 @@ } }, "node_modules/@openfga/frontend-utils": { - "version": "0.2.0-beta.6", - "resolved": "https://registry.npmjs.org/@openfga/frontend-utils/-/frontend-utils-0.2.0-beta.6.tgz", - "integrity": "sha512-nFHUv/+PHDSYFxizV+w23rWNI5UtCHxdB2PXxbXXEn/WqHi9AuKn/NJtL/Daw05y+xdbUsVlFVMczNRR39WEug==", + "version": "0.2.0-beta.9", + "resolved": "https://registry.npmjs.org/@openfga/frontend-utils/-/frontend-utils-0.2.0-beta.9.tgz", + "integrity": "sha512-AzfD7WKcrH/HtUGpuWjmeL4pskV1EN9yg8NJDAkgR51oOuko6xLjjkAwH37yuxihAj9u30GdWeDeJRGxyFkx2Q==", "dependencies": { - "@openfga/syntax-transformer": "^0.2.0-beta.10" + "@openfga/syntax-transformer": "^0.2.0-beta.17" } }, "node_modules/@openfga/sdk": { @@ -3413,9 +3413,9 @@ } }, "node_modules/@openfga/syntax-transformer": { - "version": "0.2.0-beta.14", - "resolved": "https://registry.npmjs.org/@openfga/syntax-transformer/-/syntax-transformer-0.2.0-beta.14.tgz", - "integrity": "sha512-6P181+Jyn87bioPNW0koalisa15tpOZy/PsDU75PQ+ilhSxh/v2C7Bb/FJ+rFZgJ+bcInAxfmWPvEDPqc706SA==", + "version": "0.2.0-beta.17", + "resolved": "https://registry.npmjs.org/@openfga/syntax-transformer/-/syntax-transformer-0.2.0-beta.17.tgz", + "integrity": "sha512-a9ysHh//RH16x+gZbp5kAFrKAjzHHFdMLYFdqDQIx/3VMmH/sTUXh/tPn/FmPMtr0mnzV/fANO2zGFFQfYOh3Q==", "dependencies": { "antlr4": "^4.13.1", "yaml": "^2.4.1" @@ -21082,11 +21082,11 @@ } }, "@openfga/frontend-utils": { - "version": "0.2.0-beta.6", - "resolved": "https://registry.npmjs.org/@openfga/frontend-utils/-/frontend-utils-0.2.0-beta.6.tgz", - "integrity": "sha512-nFHUv/+PHDSYFxizV+w23rWNI5UtCHxdB2PXxbXXEn/WqHi9AuKn/NJtL/Daw05y+xdbUsVlFVMczNRR39WEug==", + "version": "0.2.0-beta.9", + "resolved": "https://registry.npmjs.org/@openfga/frontend-utils/-/frontend-utils-0.2.0-beta.9.tgz", + "integrity": "sha512-AzfD7WKcrH/HtUGpuWjmeL4pskV1EN9yg8NJDAkgR51oOuko6xLjjkAwH37yuxihAj9u30GdWeDeJRGxyFkx2Q==", "requires": { - "@openfga/syntax-transformer": "^0.2.0-beta.10" + "@openfga/syntax-transformer": "^0.2.0-beta.17" } }, "@openfga/sdk": { @@ -21099,9 +21099,9 @@ } }, "@openfga/syntax-transformer": { - "version": "0.2.0-beta.14", - "resolved": "https://registry.npmjs.org/@openfga/syntax-transformer/-/syntax-transformer-0.2.0-beta.14.tgz", - "integrity": "sha512-6P181+Jyn87bioPNW0koalisa15tpOZy/PsDU75PQ+ilhSxh/v2C7Bb/FJ+rFZgJ+bcInAxfmWPvEDPqc706SA==", + "version": "0.2.0-beta.17", + "resolved": "https://registry.npmjs.org/@openfga/syntax-transformer/-/syntax-transformer-0.2.0-beta.17.tgz", + "integrity": "sha512-a9ysHh//RH16x+gZbp5kAFrKAjzHHFdMLYFdqDQIx/3VMmH/sTUXh/tPn/FmPMtr0mnzV/fANO2zGFFQfYOh3Q==", "requires": { "antlr4": "^4.13.1", "yaml": "^2.4.1" diff --git a/package.json b/package.json index cd706490c..6ced0efac 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "@docusaurus/preset-classic": "3.1.1", "@easyops-cn/docusaurus-search-local": "0.40.1", "@lottiefiles/react-lottie-player": "3.5.3", - "@openfga/frontend-utils": "^0.2.0-beta.6", + "@openfga/frontend-utils": "^0.2.0-beta.9", "@openfga/sdk": "^0.3.5", - "@openfga/syntax-transformer": "^0.2.0-beta.11", + "@openfga/syntax-transformer": "^0.2.0-beta.17", "assert-never": "1.2.1", "clsx": "2.1.0", "path-browserify": "1.0.1", diff --git a/src/theme/prism-include-languages.ts b/src/theme/prism-include-languages.ts index f3b7aac66..5dd035b80 100644 --- a/src/theme/prism-include-languages.ts +++ b/src/theme/prism-include-languages.ts @@ -1,29 +1,9 @@ import siteConfig from '@generated/docusaurus.config'; import type * as PrismNamespace from 'prismjs'; -import { tools, theming } from '@openfga/frontend-utils'; - -const { OpenFgaDslThemeTokenType } = theming; +import { tools } from '@openfga/frontend-utils'; const { PrismExtensions } = tools; -const languageDefinition = { - ...PrismExtensions.languageDefinition, - [OpenFgaDslThemeTokenType.KEYWORD]: - /\b(type|relations|define|and|or|but not|from|as|model|schema|condition|module|extend)\b/, - condition: { - pattern: /(\bcondition\s+)\w+/i, - lookbehind: true, - greedy: true, - }, - 'condition-params': { - pattern: /\(.*\)\s*{/, - inside: { - 'condition-param': /\b(\w+)\s*:/i, - 'condition-param-type': /\b(string|int|map|uint|list|timestamp|bool|duration|double|ipaddress)\b/, - }, - }, -}; - export default function prismIncludeLanguages(PrismObject: typeof PrismNamespace): void { const { themeConfig: { prism }, @@ -42,7 +22,7 @@ export default function prismIncludeLanguages(PrismObject: typeof PrismNamespace require(`prismjs/components/prism-${lang}`); }); - PrismObject.languages[PrismExtensions.LANGUAGE_NAME] = languageDefinition; + PrismObject.languages[PrismExtensions.LANGUAGE_NAME] = PrismExtensions.languageDefinition; delete (globalThis as unknown as Global & { Prism?: typeof PrismNamespace }).Prism; } diff --git a/static/css/openfga.css b/static/css/openfga.css index 2c17a4b36..3b44f537d 100644 --- a/static/css/openfga.css +++ b/static/css/openfga.css @@ -24,6 +24,7 @@ --ofga-color-default: #ffffff; --ofga-color-comment: #737981; --ofga-color-keyword: #aaaaaa; + --ofga-color-module: #79ed83; --ofga-color-type: #79ed83; --ofga-color-relation: #20f1f5; --ofga-color-directly-assignable: #ceec93; @@ -591,6 +592,10 @@ pre code { color: var(--ofga-color-keyword) !important; } +.language-dsl\.openfga .token.module { + color: var(--ofga-color-module); +} + .language-dsl\.openfga .token.type { color: var(--ofga-color-type); }