rusackas commented on code in PR #39226:
URL: https://github.com/apache/superset/pull/39226#discussion_r3818594687


##########
superset-frontend/packages/superset-core/src/theme/index.tsx:
##########
@@ -88,3 +88,17 @@ export type {
 // Export theme utility functions
 export * from './utils/themeUtils';
 export * from './utils';
+
+// Color scheme API — types, enum, and declare-function bridge for extensions.
+// The host app provides the runtime implementations on window.superset.theme.
+export type {

Review Comment:
   Done, swapped to `export * from './colors'` to match the pattern above.



##########
superset-frontend/packages/superset-core/src/theme/colors.ts:
##########
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Grouping/tier for a color scheme — controls how it appears in the
+ * scheme picker UI (e.g. Featured palettes are shown first).
+ *
+ * Mirrors @superset-ui/core's ColorSchemeGroup; kept here so
+ * palette configs have no dependency on @superset-ui/core.
+ */
+export enum ColorSchemeGroup {
+  Custom = 'custom',
+  Featured = 'featured',
+  Other = 'other',
+}
+
+/** Plain configuration object for a categorical color scheme. */
+export interface ColorSchemeConfig {

Review Comment:
   Good call, renamed to `CategoricalScheme` and dropped the redundant one 
below.



##########
superset-frontend/packages/superset-core/src/theme/colors.ts:
##########
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Grouping/tier for a color scheme — controls how it appears in the
+ * scheme picker UI (e.g. Featured palettes are shown first).
+ *
+ * Mirrors @superset-ui/core's ColorSchemeGroup; kept here so
+ * palette configs have no dependency on @superset-ui/core.
+ */
+export enum ColorSchemeGroup {
+  Custom = 'custom',
+  Featured = 'featured',
+  Other = 'other',
+}
+
+/** Plain configuration object for a categorical color scheme. */
+export interface ColorSchemeConfig {
+  id: string;
+  label?: string;
+  colors: string[];
+  description?: string;
+  isDefault?: boolean;
+  group?: ColorSchemeGroup;
+}
+
+/** Extension of ColorSchemeConfig for sequential / diverging schemes. */
+export interface SequentialSchemeConfig extends ColorSchemeConfig {
+  isDiverging?: boolean;

Review Comment:
   Yep, `isDiverging` is the only diff. Renamed to `SequentialScheme` to match.



##########
superset-frontend/packages/superset-core/src/theme/colors.ts:
##########
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Grouping/tier for a color scheme — controls how it appears in the
+ * scheme picker UI (e.g. Featured palettes are shown first).
+ *
+ * Mirrors @superset-ui/core's ColorSchemeGroup; kept here so
+ * palette configs have no dependency on @superset-ui/core.
+ */
+export enum ColorSchemeGroup {
+  Custom = 'custom',
+  Featured = 'featured',
+  Other = 'other',
+}
+
+/** Plain configuration object for a categorical color scheme. */
+export interface ColorSchemeConfig {
+  id: string;
+  label?: string;
+  colors: string[];
+  description?: string;
+  isDefault?: boolean;
+  group?: ColorSchemeGroup;
+}
+
+/** Extension of ColorSchemeConfig for sequential / diverging schemes. */
+export interface SequentialSchemeConfig extends ColorSchemeConfig {
+  isDiverging?: boolean;
+}
+
+/**
+ * Minimal interface for the categorical color scheme registry.
+ * Mirrors the public surface of @superset-ui/core's ColorSchemeRegistry.
+ */
+export interface CategoricalScheme {
+  id: string;
+  label?: string;
+  colors: string[];
+}
+
+export interface CategoricalSchemeRegistryLike {
+  keys(): string[];
+  get(name: string): CategoricalScheme | null | undefined;
+}
+
+/**
+ * Returns an alphabetically sorted list of all registered categorical color
+ * scheme names. The host app provides the implementation via
+ * window.superset.theme.
+ */
+export declare function getCategoricalSchemeNames(): string[];

Review Comment:
   No register methods on purpose, this is read-only: extensions query 
Superset's registered schemes, they don't add their own.



##########
superset-frontend/packages/superset-core/src/theme/colors.ts:
##########
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Grouping/tier for a color scheme — controls how it appears in the
+ * scheme picker UI (e.g. Featured palettes are shown first).
+ *
+ * Mirrors @superset-ui/core's ColorSchemeGroup; kept here so
+ * palette configs have no dependency on @superset-ui/core.
+ */
+export enum ColorSchemeGroup {
+  Custom = 'custom',
+  Featured = 'featured',
+  Other = 'other',
+}
+
+/** Plain configuration object for a categorical color scheme. */
+export interface ColorSchemeConfig {
+  id: string;
+  label?: string;
+  colors: string[];
+  description?: string;
+  isDefault?: boolean;
+  group?: ColorSchemeGroup;
+}
+
+/** Extension of ColorSchemeConfig for sequential / diverging schemes. */
+export interface SequentialSchemeConfig extends ColorSchemeConfig {
+  isDiverging?: boolean;
+}
+
+/**
+ * Minimal interface for the categorical color scheme registry.
+ * Mirrors the public surface of @superset-ui/core's ColorSchemeRegistry.
+ */
+export interface CategoricalScheme {
+  id: string;
+  label?: string;
+  colors: string[];
+}
+
+export interface CategoricalSchemeRegistryLike {
+  keys(): string[];
+  get(name: string): CategoricalScheme | null | undefined;
+}
+
+/**
+ * Returns an alphabetically sorted list of all registered categorical color
+ * scheme names. The host app provides the implementation via
+ * window.superset.theme.
+ */
+export declare function getCategoricalSchemeNames(): string[];

Review Comment:
   Added `getCategoricalSchemes()` so you get full scheme metadata without a 
second round-trip through `getSchemeColors`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to