michael-s-molina commented on code in PR #39226:
URL: https://github.com/apache/superset/pull/39226#discussion_r3492473406


##########
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:
   We can use the `export *` approach as the above code.



##########
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:
   Should this be named `CategoricalScheme` based on its comment? Then we could 
remove the `CategoricalScheme` 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;
+}
+
+/**
+ * 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:
   Where are the methods to register a scheme? 



##########
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:
   Maybe have a getCategoricalSchemes function? Extracting the names seems like 
a implementation detail.



##########
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:
   Is this the only difference between a categorical and sequential schemes? 
Should we also rename it to SequentialScheme?



-- 
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