@industry-theme/principal-view-panels 0.1.0 → 0.1.2

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.
@@ -1,7 +1,7 @@
1
1
  import type { StoryObj } from '@storybook/react-vite';
2
2
  /**
3
3
  * ConfigLibraryBrowserPanel displays available .canvas configurations
4
- * and component library items from the .vgc/ folder.
4
+ * and component library items from the .principal-views/ folder.
5
5
  */
6
6
  declare const meta: {
7
7
  title: string;
@@ -32,7 +32,7 @@ export declare const WithConfigsAndLibrary: Story;
32
32
  */
33
33
  export declare const ConfigsOnly: Story;
34
34
  /**
35
- * Empty state - no .vgc folder
35
+ * Empty state - no .principal-views folder
36
36
  */
37
37
  export declare const EmptyState: Story;
38
38
  /**
@@ -10,7 +10,7 @@ export interface ConfigFile {
10
10
  source: 'folder' | 'standalone';
11
11
  }
12
12
  /**
13
- * Utility for loading and parsing .canvas configuration files from .vgc/ folder
13
+ * Utility for loading and parsing .canvas configuration files from .principal-views/ folder
14
14
  */
15
15
  export declare class ConfigLoader {
16
16
  /**
@@ -22,7 +22,7 @@ export declare class ConfigLoader {
22
22
  */
23
23
  static parseLibrary(content: string): ComponentLibrary;
24
24
  /**
25
- * Find the library.yaml file in the .vgc/ folder
25
+ * Find the library.yaml file in the .principal-views/ folder
26
26
  * Returns the relative path if found, null otherwise
27
27
  */
28
28
  static findLibraryPath(files: Array<{
@@ -31,7 +31,7 @@ export declare class ConfigLoader {
31
31
  name?: string;
32
32
  }>): string | null;
33
33
  /**
34
- * Find all .canvas files in the .vgc/ folder
34
+ * Find all .canvas files in the .principal-views/ folder
35
35
  * Returns array of config files with metadata
36
36
  */
37
37
  static findConfigs(files: Array<{
@@ -5,7 +5,7 @@ interface EmptyStateContentProps {
5
5
  }
6
6
  /**
7
7
  * Empty state component for Principal View Graph Panel
8
- * Displays when no .vgc/ folder with configuration files is found in the project
8
+ * Displays when no .principal-views/ folder with configuration files is found in the project
9
9
  */
10
10
  export declare const EmptyStateContent: React.FC<EmptyStateContentProps>;
11
11
  export {};
@@ -8892,19 +8892,19 @@ class ConfigurationLoader {
8892
8892
  this.fsAdapter = fsAdapter;
8893
8893
  }
8894
8894
  /**
8895
- * Check if the .vgc/ configuration directory exists
8895
+ * Check if the .principal-views/ configuration directory exists
8896
8896
  *
8897
8897
  * @param baseDir - Base directory to search from
8898
- * @returns True if .vgc/ directory exists
8898
+ * @returns True if .principal-views/ directory exists
8899
8899
  */
8900
8900
  hasConfigDirectory(baseDir) {
8901
8901
  const configPath = this.fsAdapter.join(baseDir, ConfigurationLoader.CONFIG_DIR);
8902
8902
  return this.fsAdapter.exists(configPath) && this.fsAdapter.isDirectory(configPath);
8903
8903
  }
8904
8904
  /**
8905
- * List all available configuration names in .vgc/ folder
8905
+ * List all available configuration names in .principal-views/ folder
8906
8906
  *
8907
- * @param baseDir - Base directory containing .vgc/ folder
8907
+ * @param baseDir - Base directory containing .principal-views/ folder
8908
8908
  * @returns Array of configuration names (without extensions)
8909
8909
  */
8910
8910
  listConfigurations(baseDir) {
@@ -8919,7 +8919,7 @@ class ConfigurationLoader {
8919
8919
  * Load a specific configuration by name
8920
8920
  *
8921
8921
  * @param name - Configuration name (without extension)
8922
- * @param baseDir - Base directory containing .vgc/ folder
8922
+ * @param baseDir - Base directory containing .principal-views/ folder
8923
8923
  * @returns Configuration file or null if not found/invalid
8924
8924
  */
8925
8925
  loadByName(name, baseDir) {
@@ -8949,9 +8949,9 @@ class ConfigurationLoader {
8949
8949
  return null;
8950
8950
  }
8951
8951
  /**
8952
- * Load all configurations from .vgc/ folder
8952
+ * Load all configurations from .principal-views/ folder
8953
8953
  *
8954
- * @param baseDir - Base directory containing .vgc/ folder
8954
+ * @param baseDir - Base directory containing .principal-views/ folder
8955
8955
  * @returns Result containing all loaded configs and any errors
8956
8956
  */
8957
8957
  loadAll(baseDir) {
@@ -8961,8 +8961,8 @@ class ConfigurationLoader {
8961
8961
  };
8962
8962
  if (!this.hasConfigDirectory(baseDir)) {
8963
8963
  result.errors.push({
8964
- file: ".vgc",
8965
- error: "Configuration directory .vgc/ not found"
8964
+ file: ".principal-views",
8965
+ error: "Configuration directory .principal-views/ not found"
8966
8966
  });
8967
8967
  return result;
8968
8968
  }
@@ -9004,25 +9004,25 @@ class ConfigurationLoader {
9004
9004
  * Get the configuration directory path
9005
9005
  *
9006
9006
  * @param baseDir - Base directory
9007
- * @returns Full path to .vgc/ directory
9007
+ * @returns Full path to .principal-views/ directory
9008
9008
  */
9009
9009
  getConfigDirectoryPath(baseDir) {
9010
9010
  return this.fsAdapter.join(baseDir, ConfigurationLoader.CONFIG_DIR);
9011
9011
  }
9012
9012
  }
9013
- ConfigurationLoader.CONFIG_DIR = ".vgc";
9013
+ ConfigurationLoader.CONFIG_DIR = ".principal-views";
9014
9014
  const DEFAULT_LIBRARY_FILES = ["library.yaml", "library.yml", "library.json"];
9015
- const CONFIG_DIR = ".vgc";
9015
+ const CONFIG_DIR = ".principal-views";
9016
9016
  class LibraryLoader {
9017
9017
  constructor(fsAdapter) {
9018
9018
  this.fsAdapter = fsAdapter;
9019
9019
  }
9020
9020
  /**
9021
- * Load the component library from the .vgc/ folder
9021
+ * Load the component library from the .principal-views/ folder
9022
9022
  *
9023
9023
  * Searches for library.yaml, library.yml, or library.json (in that order).
9024
9024
  *
9025
- * @param baseDir - Base directory containing .vgc/ folder
9025
+ * @param baseDir - Base directory containing .principal-views/ folder
9026
9026
  * @returns Library load result
9027
9027
  */
9028
9028
  load(baseDir) {
@@ -9030,7 +9030,7 @@ class LibraryLoader {
9030
9030
  if (!this.fsAdapter.exists(configPath) || !this.fsAdapter.isDirectory(configPath)) {
9031
9031
  return {
9032
9032
  success: false,
9033
- error: "Configuration directory .vgc/ not found",
9033
+ error: "Configuration directory .principal-views/ not found",
9034
9034
  path: configPath
9035
9035
  };
9036
9036
  }
@@ -9080,9 +9080,9 @@ class LibraryLoader {
9080
9080
  }
9081
9081
  }
9082
9082
  /**
9083
- * Check if a library file exists in the .vgc/ folder
9083
+ * Check if a library file exists in the .principal-views/ folder
9084
9084
  *
9085
- * @param baseDir - Base directory containing .vgc/ folder
9085
+ * @param baseDir - Base directory containing .principal-views/ folder
9086
9086
  * @returns True if a library file exists
9087
9087
  */
9088
9088
  hasLibrary(baseDir) {
@@ -9679,14 +9679,11 @@ function createRulesEngine(rules) {
9679
9679
  return engine;
9680
9680
  }
9681
9681
  const CONFIG_FILE_NAMES = [
9682
- ".vgcrc.json",
9683
- ".vgcrc.yaml",
9684
- ".vgcrc.yml",
9685
- "vgc.config.json",
9686
- "vgc.config.yaml",
9687
- "vgc.config.yml"
9688
- ];
9689
- const DEFAULT_INCLUDE_PATTERNS = [".vgc/**/*.yaml", ".vgc/**/*.yml", ".vgc/**/*.json"];
9682
+ ".privurc.yaml",
9683
+ ".privurc.yml",
9684
+ ".privurc.json"
9685
+ ];
9686
+ const DEFAULT_INCLUDE_PATTERNS = [".principal-views/**/*.yaml", ".principal-views/**/*.yml", ".principal-views/**/*.json"];
9690
9687
  const DEFAULT_EXCLUDE_PATTERNS = ["**/node_modules/**", "**/*.test.*"];
9691
9688
  const VALID_SEVERITIES = [
9692
9689
  "off",
@@ -45056,7 +45053,7 @@ function requireCustomNode() {
45056
45053
  const react_1 = /* @__PURE__ */ requireUmd();
45057
45054
  const iconResolver_1 = requireIconResolver();
45058
45055
  const CustomNode$1 = ({ data, selected }) => {
45059
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k;
45056
+ var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o2;
45060
45057
  const nodeProps = data;
45061
45058
  const { typeDefinition, state, hasViolations, data: nodeData, animationType, animationDuration = 1e3, editable = false } = nodeProps;
45062
45059
  if (!typeDefinition) {
@@ -45064,14 +45061,15 @@ function requireCustomNode() {
45064
45061
  }
45065
45062
  const nodeDataColor = nodeData.color;
45066
45063
  const baseColor = nodeDataColor || typeDefinition.color || "#888";
45067
- const stateColor = state && ((_b = (_a = typeDefinition.states) == null ? void 0 : _a[state]) == null ? void 0 : _b.color);
45064
+ const nodeDataStates = nodeData.states;
45065
+ const stateColor = state && (((_a = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _a.color) || ((_c = (_b = typeDefinition.states) == null ? void 0 : _b[state]) == null ? void 0 : _c.color));
45068
45066
  const fillColor = stateColor || baseColor;
45069
45067
  const nodeDataStroke = nodeData.stroke;
45070
45068
  const strokeColor = nodeDataStroke || typeDefinition.stroke || fillColor;
45071
45069
  const color = fillColor;
45072
- const labelField = (_c = Object.entries(typeDefinition.dataSchema).find(([, schema2]) => schema2.displayInLabel)) == null ? void 0 : _c[0];
45070
+ const labelField = (_d = Object.entries(typeDefinition.dataSchema).find(([, schema2]) => schema2.displayInLabel)) == null ? void 0 : _d[0];
45073
45071
  const displayLabel = labelField && nodeData[labelField] ? String(nodeData[labelField]) : nodeProps.label;
45074
- const icon = nodeData.icon || state && ((_e2 = (_d = typeDefinition.states) == null ? void 0 : _d[state]) == null ? void 0 : _e2.icon) || typeDefinition.icon;
45072
+ const icon = nodeData.icon || state && (((_e2 = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _e2.icon) || ((_g = (_f = typeDefinition.states) == null ? void 0 : _f[state]) == null ? void 0 : _g.icon)) || typeDefinition.icon;
45075
45073
  const getAnimationClass = () => {
45076
45074
  switch (animationType) {
45077
45075
  case "pulse":
@@ -45155,8 +45153,8 @@ function requireCustomNode() {
45155
45153
  position: "relative",
45156
45154
  clipPath: hexagonClipPath,
45157
45155
  backgroundColor: hasViolations ? "#D0021B" : strokeColor,
45158
- width: ((_f = typeDefinition.size) == null ? void 0 : _f.width) || 120,
45159
- height: ((_g = typeDefinition.size) == null ? void 0 : _g.height) || 120,
45156
+ width: ((_h = typeDefinition.size) == null ? void 0 : _h.width) || 120,
45157
+ height: ((_i = typeDefinition.size) == null ? void 0 : _i.height) || 120,
45160
45158
  boxShadow: selected ? `0 0 0 2px ${strokeColor}` : "0 2px 4px rgba(0,0,0,0.1)",
45161
45159
  transition: "all 0.2s ease"
45162
45160
  } : {};
@@ -45221,7 +45219,7 @@ function requireCustomNode() {
45221
45219
  padding: "2px 6px",
45222
45220
  borderRadius: "4px",
45223
45221
  textAlign: "center"
45224
- }, children: ((_i = (_h = typeDefinition.states) == null ? void 0 : _h[state]) == null ? void 0 : _i.label) || state }), hasViolations && (0, jsx_runtime_1.jsx)("div", { style: {
45222
+ }, children: ((_j = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _j.label) || ((_l = (_k = typeDefinition.states) == null ? void 0 : _k[state]) == null ? void 0 : _l.label) || state }), hasViolations && (0, jsx_runtime_1.jsx)("div", { style: {
45225
45223
  fontSize: "10px",
45226
45224
  color: "#D0021B",
45227
45225
  fontWeight: "bold"
@@ -45232,7 +45230,7 @@ function requireCustomNode() {
45232
45230
  padding: "2px 6px",
45233
45231
  borderRadius: "4px",
45234
45232
  textAlign: "center"
45235
- }, children: ((_k = (_j = typeDefinition.states) == null ? void 0 : _j[state]) == null ? void 0 : _k.label) || state }), hasViolations && (0, jsx_runtime_1.jsx)("div", { style: {
45233
+ }, children: ((_m = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _m.label) || ((_o2 = (_n2 = typeDefinition.states) == null ? void 0 : _n2[state]) == null ? void 0 : _o2.label) || state }), hasViolations && (0, jsx_runtime_1.jsx)("div", { style: {
45236
45234
  fontSize: "10px",
45237
45235
  color: "#D0021B",
45238
45236
  fontWeight: "bold"
@@ -45358,7 +45356,8 @@ function requireCustomEdge() {
45358
45356
  if (!typeDefinition) {
45359
45357
  return null;
45360
45358
  }
45361
- const color = hasViolations ? "#D0021B" : typeDefinition.color || "#888";
45359
+ const edgeColor = edgeData == null ? void 0 : edgeData.color;
45360
+ const color = hasViolations ? "#D0021B" : edgeColor || typeDefinition.color || "#888";
45362
45361
  const width = typeDefinition.width || 2;
45363
45362
  const [edgePath, labelX, labelY] = (0, react_2.getBezierPath)({
45364
45363
  sourceX,
@@ -45552,18 +45551,20 @@ function requireGraphConverter() {
45552
45551
  }
45553
45552
  function convertToXYFlowEdges(edges, configuration, violations = []) {
45554
45553
  return edges.map((edge) => {
45554
+ var _a;
45555
45555
  const typeDefinition = configuration.edgeTypes[edge.type];
45556
45556
  if (!typeDefinition) {
45557
45557
  console.warn(`Edge type "${edge.type}" not found in configuration for edge "${edge.id}"`);
45558
45558
  }
45559
45559
  const hasViolations = violations.some((v) => {
45560
- var _a;
45561
- return ((_a = v.context) == null ? void 0 : _a.edgeId) === edge.id;
45560
+ var _a2;
45561
+ return ((_a2 = v.context) == null ? void 0 : _a2.edgeId) === edge.id;
45562
45562
  });
45563
45563
  const edgeWithHandles = edge;
45564
+ const edgeColor = (_a = edge.data) == null ? void 0 : _a.color;
45564
45565
  const markerEnd = (typeDefinition == null ? void 0 : typeDefinition.directed) !== false ? {
45565
45566
  type: react_1.MarkerType.ArrowClosed,
45566
- color: (typeDefinition == null ? void 0 : typeDefinition.color) || "#888",
45567
+ color: edgeColor || (typeDefinition == null ? void 0 : typeDefinition.color) || "#888",
45567
45568
  width: 20,
45568
45569
  height: 20
45569
45570
  } : void 0;
@@ -46051,7 +46052,7 @@ function requireGraphRenderer() {
46051
46052
  onPendingChangesChange == null ? void 0 : onPendingChangesChange(false);
46052
46053
  }
46053
46054
  }, [propNodes, propEdges, editStateRef, onEditStateChange, onPendingChangesChange]);
46054
- const nodes = editable ? localNodes : propNodes;
46055
+ const nodes = localNodes;
46055
46056
  const edges = editable ? localEdges : propEdges;
46056
46057
  const checkHasChanges = (0, react_1.useCallback)((state) => {
46057
46058
  return state.positionChanges.size > 0 || state.nodeUpdates.size > 0 || state.deletedNodeIds.size > 0 || state.createdEdges.length > 0 || state.deletedEdges.length > 0;
@@ -46323,6 +46324,7 @@ function requireGraphRenderer() {
46323
46324
  const nodeId = stateEvent.nodeId;
46324
46325
  const newState = stateEvent.newState;
46325
46326
  if (nodeId && newState) {
46327
+ setLocalNodes((prev) => prev.map((node) => node.id === nodeId ? { ...node, state: newState } : node));
46326
46328
  const stateToAnimation = {
46327
46329
  processing: "pulse",
46328
46330
  completed: "flash",
@@ -46347,8 +46349,8 @@ function requireGraphRenderer() {
46347
46349
  });
46348
46350
  }, duration);
46349
46351
  }
46350
- onEventProcessed == null ? void 0 : onEventProcessed(latestEvent);
46351
46352
  }
46353
+ onEventProcessed == null ? void 0 : onEventProcessed(latestEvent);
46352
46354
  }
46353
46355
  }
46354
46356
  if (latestEvent.category === "node" && latestEvent.operation === "create") {
@@ -47386,11 +47388,11 @@ class ConfigLoader {
47386
47388
  }
47387
47389
  }
47388
47390
  /**
47389
- * Find the library.yaml file in the .vgc/ folder
47391
+ * Find the library.yaml file in the .principal-views/ folder
47390
47392
  * Returns the relative path if found, null otherwise
47391
47393
  */
47392
47394
  static findLibraryPath(files) {
47393
- const VGC_FOLDER = ".vgc";
47395
+ const VGC_FOLDER = ".principal-views";
47394
47396
  for (const file of files) {
47395
47397
  const filePath = file.relativePath || file.path || "";
47396
47398
  const fileName = file.name || "";
@@ -47401,12 +47403,12 @@ class ConfigLoader {
47401
47403
  return null;
47402
47404
  }
47403
47405
  /**
47404
- * Find all .canvas files in the .vgc/ folder
47406
+ * Find all .canvas files in the .principal-views/ folder
47405
47407
  * Returns array of config files with metadata
47406
47408
  */
47407
47409
  static findConfigs(files) {
47408
47410
  const configs = [];
47409
- const VGC_FOLDER = ".vgc";
47411
+ const VGC_FOLDER = ".principal-views";
47410
47412
  for (const file of files) {
47411
47413
  const filePath = file.relativePath || file.path || "";
47412
47414
  const fileName = file.name || "";
@@ -51185,7 +51187,7 @@ const EmptyStateContent = ({ theme }) => {
51185
51187
  /* @__PURE__ */ jsx("div", { style: {
51186
51188
  fontSize: theme.fontSizes[0],
51187
51189
  color: theme.colors.textSecondary
51188
- }, children: "Learn how to create .vgc/ configurations with path-based validation" })
51190
+ }, children: "Learn how to create .principal-views/ configurations with path-based validation" })
51189
51191
  ] }),
51190
51192
  /* @__PURE__ */ jsx(ExternalLink, { size: 16, color: theme.colors.textMuted, style: { flexShrink: 0 } })
51191
51193
  ]
@@ -51250,7 +51252,7 @@ const EmptyStateContent = ({ theme }) => {
51250
51252
  borderRadius: theme.radii[0],
51251
51253
  fontFamily: theme.fonts.monospace,
51252
51254
  fontSize: theme.fontSizes[0]
51253
- }, children: ".vgc/" }),
51255
+ }, children: ".principal-views/" }),
51254
51256
  " folder with YAML configuration files to your project root, the panel will automatically visualize your configurations."
51255
51257
  ] })
51256
51258
  ] })
@@ -52168,7 +52170,7 @@ const ConfigLibraryBrowserPanel = ({
52168
52170
  });
52169
52171
  const vgcFiles = fileTreeData2.allFiles.filter((f) => {
52170
52172
  const path = f.relativePath || f.path || "";
52171
- return path.startsWith(".vgc/");
52173
+ return path.startsWith(".principal-views/");
52172
52174
  });
52173
52175
  for (const file of vgcFiles) {
52174
52176
  const relativePath = file.relativePath || file.path || "";
@@ -52207,7 +52209,7 @@ const ConfigLibraryBrowserPanel = ({
52207
52209
  canvasConfigs.push({
52208
52210
  id: name,
52209
52211
  name,
52210
- path: `.vgc/${name}.yaml`,
52212
+ path: `.principal-views/${name}.yaml`,
52211
52213
  displayName
52212
52214
  });
52213
52215
  }
@@ -52271,7 +52273,7 @@ const ConfigLibraryBrowserPanel = ({
52271
52273
  }, []);
52272
52274
  const hasConfigs = state.configs.length > 0;
52273
52275
  const cliCommand = hasConfigs ? "npx @principal-ai/principal-view-cli --help" : "npx @principal-ai/principal-view-cli init";
52274
- const cliCommandDescription = hasConfigs ? "View all available CLI commands and options." : "This creates a .vgc/ folder with a starter canvas file.";
52276
+ const cliCommandDescription = hasConfigs ? "View all available CLI commands and options." : "This creates a .principal-views/ folder with a starter canvas file.";
52275
52277
  const handleCopyCommand = useCallback(() => {
52276
52278
  navigator.clipboard.writeText(cliCommand).then(() => {
52277
52279
  setCopied(true);
@@ -52891,7 +52893,7 @@ const ConfigLibraryBrowserPanel = ({
52891
52893
  }, children: [
52892
52894
  /* @__PURE__ */ jsx(Library, { size: 32, style: { marginBottom: theme.space[2], opacity: 0.5 } }),
52893
52895
  /* @__PURE__ */ jsx("div", { children: "No component library found" }),
52894
- /* @__PURE__ */ jsx("div", { style: { fontSize: theme.fontSizes[0], marginTop: theme.space[1] }, children: "Add library.yaml to the .vgc/ folder" })
52896
+ /* @__PURE__ */ jsx("div", { style: { fontSize: theme.fontSizes[0], marginTop: theme.space[1] }, children: "Add library.yaml to the .principal-views/ folder" })
52895
52897
  ] })
52896
52898
  ] }),
52897
52899
  showSetupInfo && /* @__PURE__ */ jsxs("div", { style: {