Skip to content

ScifiPanelAlpha

WASM Powered
Star
🏅Original

ScifiPanelAlpha is the pioneer and core flagship of the TechUI Scifi panel family. As TechUI's first fully self-developed sci-fi panel, it features the most diverse morphological variations in the series and established the signature "Chamfer-Label" design language for the Scifi line.

Built on precision path calculations via Wasm/SVG, this component implements an intelligence-aware chamfered container. Its core highlight lies in its exceptional geometric transformation capabilities—through various combinations of the rotate and directionAlt properties, the title bar can be precisely anchored to any of the four corners of the rectangular container.

It can derive up to 16 distinct visual forms, perfectly adapting to the layout requirements of various complex dashboards.

Note: This component can be invoked using ScifiPanelA1 or its semantic alias ScifiPanelAlpha.

Basic Usage

Default Morphology

By default, the chamfered title is located at the top-left corner of the panel. This is the form most consistent with standard reading habits and is suitable as a general-purpose data card container.

vue
<template>
  <div style="width: 400px; height: 300px;">
    <ScifiPanelAlpha title="Basic Title">
      <div class="content-area">
        Panel Content...
      </div>
    </ScifiPanelAlpha>
  </div>
</template>

Title Adaptation

Since the panel's geometric path is drawn based on SVG mathematical calculations, the component cannot automatically expand the title bar width based on text length like standard HTML elements. Precise control of the title width is key to using A1 effectively.

  • title: The text content of the title.
  • titleWidth: The physical width of the title area (in pixels). The default value is 150.

Adaptation Principle

If your title text is long (exceeding 4-5 Chinese characters or equivalent length), or if you use a larger font size, you must manually increase the titleWidth; otherwise, the text will overflow the chamfered background.

vue
<template>
  <div class="grid">
    <ScifiPanelAlpha title="System Status" />

    <ScifiPanelAlpha 
      title="Auxiliary Energy System Monitoring" 
      :titleWidth="220" 
    />

    <ScifiPanelAlpha 
      title="Sector 7 External Environment Real-time Monitoring Data Center" 
      :titleWidth="380" 
    />
  </div>
</template>

Four-Corner Positioning

By combining the directionAlt and rotate attributes, you can place the title bar in any corner of the panel.

Top-Left

  • Default: Standard form.
  • DirectionAlt: Inverts the chamfer logic (typically manifests as switching between inner and outer chamfers or changing the chamfer direction).
vue
<template>
  <ScifiPanelAlpha title="Top-Left Standard" />
  <ScifiPanelAlpha title="Top-Left Variant" :directionAlt="true" />
</template>

Top-Right

  • Rotate Y: Mirror flip along the Y-axis. The text direction is automatically corrected to maintain readability.
  • DirectionAlt: Combined with directionAlt to achieve a visual translation effect.
vue
<template>
  <ScifiPanelAlpha title="Top-Right Mirror" rotate="y" />
</template>

Bottom-Left

  • Rotate X: Mirror flip along the X-axis. The title bar moves to the bottom.
vue
<template>
  <ScifiPanelAlpha title="Bottom-Left Layout" rotate="x" />
</template>

Bottom-Right

  • Rotate Z: 180-degree center rotation (or simultaneous X and Y axis flip).
vue
<template>
  <ScifiPanelAlpha title="Bottom-Right Layout" rotate="z" />
</template>

CSS Variable

ScifiPanelAlpha provides a powerful CSS variable interface. By passing a className, you can override the CSS variables defined inside the component to achieve a skinning effect.

This is extremely useful for distinguishing between different panel states such as "Normal," "Warning," or "Failure."

Case: Red Alert Style

vue
<template>
  <ScifiPanelAlpha 
    title="DANGER ZONE" 
    className="panel-danger"
    :glow="true"
    :glowOpacity="0.8"
  >
    <div class="error-msg">Intrusion Signal Detected</div>
  </ScifiPanelAlpha>
</template>

<style lang="less">
/* Custom Danger Style */
.panel-danger {
  /* Border Color: Bright Red */
  --sf-panel-bd: #ff4d4f;
  
  /* Background Color: Deep Red Semi-transparent */
  --sf-panel-bg: rgba(60, 0, 0, 0.85);
  
  /* Font Color: White */
  --sf-panel-fc: #ffffff;
  
  /* Glow Color: Red Halo */
  --sf-panel-glow: #ff0000;
  
  /* Decoration/Highlight Color: Orange-Red */
  --sf-panel-hlite: #ff9c6e;
}
</style>

Case: Hacker Matrix Style

vue
<template>
  <ScifiPanelAlpha 
    title="MATRIX CORE" 
    className="panel-matrix"
    :decorationAlt="true"
  >
    <div class="code-flow">System Call...</div>
  </ScifiPanelAlpha>
</template>

<style lang="less">
.panel-matrix {
  --sf-panel-bd: #00ff00;       /* Bright Green Border */
  --sf-panel-bg: rgba(0, 20, 0, 0.9); /* Deep Green Background */
  --sf-panel-fc: #00ff00;       /* Green Text */
  --sf-panel-hlite: #ccffcc;    /* Bright Green Highlight */
}
</style>

Visual Variants

In addition to CSS skinning, the component provides geometric variants at the Props level.

Decoration Alt (Hollow Decoration)

When decorationAlt is enabled, the title bar background changes from a "solid block" to a "hollowed line" or "mixed solid/hollow" style. This style has a lighter visual weight and is suitable for overlaying on maps or complex backgrounds.

vue
<template>
  <div class="grid">
    <ScifiPanelAlpha title="Solid Style" />

    <ScifiPanelAlpha title="Hollow Style" :decorationAlt="true" />
    
    <ScifiPanelAlpha title="Alt Color" :decorationColorAlt="true" />
  </div>
</template>

Border and Glow Effects

  • borderWidth: Increasing the border thickness creates a "heavy armor" feel.
  • borderd: Setting this to false hides the border, leaving only the title chamfer.
  • glow: Enables a global outer glow (consumes some performance; recommended to enable only as needed).

API Reference

Props

PropertyDescriptionTypeDefault
titlePanel title contentString
titleWidthTitle area width (px), must be adjusted manually based on word countNumber150
directionAltDirection Variant. Changes the starting logic of the chamferBooleanfalse
rotateGeometric Rotation. Supports 'x' (Vertical), 'y' (Horizontal), 'z' (Diagonal)String
decorationWhether to display decorative elementsBooleantrue
decorationAltDecoration Variant. Switches to hollow/line styleBooleanfalse
decorationColorAltWhether to enable the variant color scheme for decorationsBooleanfalse
borderWidthBorder line width (px)Number
borderdWhether to display the borderBooleantrue
backgroundOpacityBackground opacity (0-1)Number
glowWhether to enable the outer glow filterBooleanfalse
glowRangeOuter glow diffusion range (px)Number
glowOpacityOuter glow intensity (0-1)Number
scaleOverall scale ratioNumber1
classNameCustom container class name for binding CSS variablesString

CSS Variables

You can override the following variables at the component's parent level or via className to control the component's color scheme and appearance.

Variable NameDescriptionDefault Reference
--sf-panel-bgPanel background fill colorvar(--scifi-bg)
--sf-panel-bgopBackground opacityvar(--cpt-panel-bgop, 1)
--sf-panel-bdBorder line colorvar(--scifi-bd)
--sf-panel-bdwBorder line widthvar(--cpt-panel-bdw, 1px)
--sf-panel-fcTitle text colorvar(--scifi-fc)
--sf-panel-hlitehighlight colorvar(--scifi-hlite)
--sf-panel-focusFocus colorvar(--scifi-focus)
--sf-panel-glowInner glow colorvar(--scifi-focus)
--sf-panel-glowopInner glow opacityvar(--cpt-panel-glowop, .5)
--sf-panel-shadowContainer shadowvar(--shadow-weak)
--sf-panel-scaleOverall scaling ratiovar(--cpt-panel-scale)

Released under the MIT License.