
    +j?                        d dl mZ d dlmZ g dZ G d de          Z G d de          Z G d d	e          Z G d
 de          Z G d de          Z	 G d de          Z
 G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          ZdS )    )AbstractElement)module)ClientStateChangeClientTriggersCursorLifeCycleMonitor	MouseTrapSizeObserver	FloatCardListBrowserGitTree
XaiHeatMapXaiImageLineSeedc                         e Zd Zd fd	Z xZS )HtmlElementNc                      t                      j        ||fi | | j        r!| j                            t                     d S d S N)super__init__serverenable_moduler   )self
_elem_namechildrenkwargs	__class__s       X/DATA/AppData/hermes/venv/lib/python3.11/site-packages/trame_components/widgets/trame.pyr   zHtmlElement.__init__   sT    X88888; 	.K%%f-----	. 	.    r   __name__
__module____qualname__r   __classcell__r   s   @r   r   r      s=        . . . . . . . . . .r   r   c                   $     e Zd ZdZd fd	Z xZS )r   a  
    Allow the client side to trigger an event when a state element changes.

    :param value: Name of the state variable to monitor
    :type value: str
    :param immediate: Trigger change right away rather than at nextTick (default: False)
    :type immediate: bool
    :param trigger_on_create: If set to true, the change event will be triggered when the client start. (default: False)
    :type trigger_on_create: bool
    :param change: Event triggered when state[value] change
    :type change: Function or JS expression (event)
    Nc                      t                      j        d|fi | | xj        g dz  c_        | xj        dgz  c_        d S )Nztc-client-state-change))valuez:value	immediate)trigger_on_createtriggerChangeOnCreatechanger   r   _attr_names_event_namesr   r   r   r   s      r   r   zClientStateChange.__init__-   sf    18FFvFFF 
 
 
 	

 	hZ'r   r   r!   r"   r#   __doc__r   r$   r%   s   @r   r   r      sG         ( ( ( ( ( ( ( ( ( (r   r   c                   *     e Zd ZdZd fd	Zd Z xZS )r   z
    Allow to trigger an event on the client side

    :param ref: Identifier for the client side DOM elem
    :param **kwargs: List of events to registers with their callbacks
    trame_triggersNc                     || _          t                      j        dd |d| | xj        dgz  c_        | xj        t          |                                          z  c_        d S )Ntc-client-triggers)r   refr7   )r6   )_ClientTriggers__namer   r   r.   r/   listkeys)r   r7   r   r   r   s       r   r   zClientTriggers.__init__B   sn    P#PPPPPUG#T&++--000r   c                 :     | j         j        | j        d|g|R   dS )zt
        Perform the call on the client

        :param method: Key used in the kwargs at construction time
        emitN)r   js_callr8   )r   methodargss      r   callzClientTriggers.callH   s-     	DK?$??????r   )r4   N)r!   r"   r#   r2   r   r@   r$   r%   s   @r   r   r   :   s]         1 1 1 1 1 1@ @ @ @ @ @ @r   r   c                   "     e Zd ZdZ fdZ xZS )r   zAllow to define the cursor of the parent component based on an active index and the list of css cursor names.

    :param active: index to selection the current cursor
    :param cursors: Array of available cursor to chose from
    c                 ^     t                      j        di | | xj        ddgz  c_        d S )N	tc-cursoractivecursors)rC   r   r   r.   r   r   r   s     r   r   zCursor.__init__[   s?    /////Xy11r   r1   r%   s   @r   r   r   T   sB         2 2 2 2 2 2 2 2 2r   r   c                   $     e Zd ZdZd fd	Z xZS )r   ax  
    LifeCycleMonitor is a debug purpose tool to validate a sub-tree get the proper
    expected life cycle event.

    This component allow to print into the client side console when any of the
    monitored event happen.

    :param name: User specific text to easily identify which component the event
                was coming from.
    :param type: console[type](...) so you can use 'log', 'error', 'info', 'warn'
    :param value: Another value that is printed when an event occur
    :param events: List of events to monitor such as created, beforeMount,
        mounted, beforeUpdate, updated, beforeDestroy, destroyed
    Nc                      t                      j        d|fi | | xj        g dz  c_        | xj        g dz  c_        d S )Nztc-life-cycle-monitor)nametyper(   events)created)before_mountbeforeMountmounted)before_updatebeforeUpdateupdated)before_destroybeforeDestroy	destroyedr-   r0   s      r   r   zLifeCycleMonitor.__init__s   ss    0(EEfEEE 
 
 
 	
 	 
 
 
 	
r   r   r1   r%   s   @r   r   r   c   sG         
 
 
 
 
 
 
 
 
 
r   r   c                   0     e Zd ZdZ fdZddZd Z xZS )r	   a  
    MouseTrap allow to capture client side event and bind them
    to server side trigger.

    :param **kwargs: The keys are meant to be assigned to events.

    .. code-block::

        widget = MouseTrap(Save=save_fn, Open=open_fn, Edit=edit_fn, Escape=exit_fn)

        widget.bind(["ctrl+s", "mod+s"], "Save", stop_propagation=True)
        widget.bind(["ctrl+o", "mod+o"], "Open", stop_propagation=True)
        widget.bind("mod+e", "Edit")
        widget.bind("esc", "Escape")

    c                      t                      j        di | d| j        d<   | xj        g |                                z  c_        d S )Ntc-mouse-trapz:mapping="trame__mousetrap"_trame_mapping)rY   )r   r   _attributesr/   r:   rG   s     r   r   zMouseTrap.__init__   sV    33F333-J)*-v{{}}--r   FNc                     | xj         |gz  c_         ||d}|rd|d<   |r||d<   | j        j        j                            |           dS )z>
        Create binding for key stroke to event name.
        )r:   event   stoplistenN)r/   r   statetrame__mousetrapappend)r   r:   
event_namestop_propagation	listen_toentrys         r   bindzMouseTrap.bind   sr     	j\)
 
  	E&M 	('E(O*11%88888r   c                 (    g | j         j        _        d S r   )r   ra   rb   )r   s    r   resetzMouseTrap.reset   s    -/***r   )FN)r!   r"   r#   r2   r   rh   rj   r$   r%   s   @r   r	   r	      se         ". . . . .
9 9 9 9 0 0 0 0 0 0 0r   r	   c                   "     e Zd ZdZ fdZ xZS )r
   z
    SizeObserver allow to monitor the space available in the UI and bind that
    information onto a state variable.

    :param _name: Name of the state variable to bound the component size to
    c                      t                      j        di | | xj        dgz  c_        d | j        j        |<   | j        j                            |          | _        d S )Ntc-size-observerrJ   )rm   )r   r   r.   r   ra   
translatortranslate_keyrJ   )r   _namer   r   s      r   r   zSizeObserver.__init__   sk    66v666
 	
 $(% K*88??			r   r1   r%   s   @r   r
   r
      sK         @ @ @ @ @ @ @ @ @r   r
   c                   $     e Zd ZdZd fd	Z xZS )r   a  
    A |floatcard_vuetify_link| which floats above the application and can be moved freely from a handle

    .. |floatcard_vuetify_link| raw:: html

        <a href="https://vuetifyjs.com/api/v-card" target="_blank">vuetify VCard container</a>


    :param handle_color:
    :param handle_position:
    :param handle_size:
    :param location:

    Vuetify VCard attributes

    :param color:
    :param dark:
    :param flat:
    :param height:
    :param elevation:
    :param hover:
    :param img:
    :param light:
    :param loader_height:
    :param loading:
    :param max_height:
    :param max_width:
    :param min_height:
    :param min_width:
    :param outlined:
    :param raised:
    :param rounded:
    :param shaped:
    :param tile:
    :param width:
    Nc                 b     t                      j        d|fi | | xj        g dz  c_        d S )Nztc-float-card)handle_colorhandle_positionhandle_sizelocationcolordarkflatheight	elevationhoverimglightloader_heightloading
max_height	max_width
min_height	min_widthoutlinedraisedroundedshapedtilewidthrF   r0   s      r   r   zFloatCard.__init__   sM    (==f=== 
 
 
 	
r   r   r1   r%   s   @r   r   r      sH        # #J
 
 
 
 
 
 
 
 
 
r   r   c                   $     e Zd ZdZd fd	Z xZS )r   a  
    A component that list items that be used for browsing directories or simple item picking

    :param list: List stored in state
    :param filter: Function to filter list
    :param path_separator: The icon to use for the slash between folders
    :param show_path_with_icon: Shows the path with the icon
    :param hide_icon: Hide the folder icons in the navigation bar
    :param sticky_header: Freezes the navigation bar while scrolling
    :param path_icon:
    :param path_selected_icon:
    :param filter_icon:
    :param path:
    Nc                 b     t                      j        d|fi | | xj        g dz  c_        d S )Nztc-list-browser)	path_iconpath_selected_iconpath_separator	hide_iconshow_path_with_iconfilter_iconsticky_headerfilterpathr9   )queryfilterQueryrF   r0   s      r   r   zListBrowser.__init__&  sN    *H????? 
 
 
 	
r   r   r1   r%   s   @r   r   r     sG         
 
 
 
 
 
 
 
 
 
r   r   c                   $     e Zd ZdZd fd	Z xZS )r   a  
    A component to present a Tree the same way Git does it (Like a subway map)

    :param sources: All of the elements of the tree
    :param actives: Any active elements of the tree

    Vuetify styling attributes

    :param active_background:
    :param delta_x:
    :param delta_y:
    :param font_size:
    :param margin:
    :param multiselect:
    :param offset:
    :param palette:
    :param radius:
    :param root_id:
    :param stroke:
    :param width:
    :param active_circle_stroke_color:
    :param not_visible_circle_fill_color:
    :param text_color:
    :param text_weight:
    :param action_map:
    :param action_size:

    Events

    :param actives_change:
    :param visibility_change:
    :param action:

    Nc                      t                      j        d|fi | | xj        g dz  c_        | xj        g dz  c_        d S )Nztc-git-tree)sourcesactivesactive_backgrounddelta_xdelta_y	font_sizemarginmultiselectoffsetpaletteradiusroot_idstroker   active_circle_stroke_colornot_visible_circle_fill_color
text_colortext_weight
action_mapaction_size))actives_changeactivesChange)visibility_changevisibilityChangeactionr-   r0   s      r   r   zGitTree.__init__`  sr    ;;F;;; 
 
 
 	
, 	 
 
 
 	
r   r   r1   r%   s   @r   r   r   <  sH        ! !F
 
 
 
 
 
 
 
 
 
r   r   c                   $     e Zd ZdZd fd	Z xZS )r   aK  
    XaiHeatMap create a visual representation of a numerical array
    representing a 2D image.

    :param heatmap: Array to display
    :param shape: expect [width, height]
    :param color_mode: full, maxSym, minSym, positive, negative, custom (default: full)
    :param color_range: Range to be used when `color_mode="custom"`
    :param color_preset: Preset name from `vtk.js <https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/ColorTransferFunction/ColorMaps.json>`_

    Events:

    :param hover: event triggered when moving over the map
    :param enter: event triggered when entring the map area
    :param exit: event triggered when exiting the map area
    :param color_range_change: event triggered when color range used has changed
    :param full_range_change: event triggered when full range has changed
    Nc                      t                      j        d|fi | | xj        g dz  c_        | xj        g dz  c_        d S )Nztc-xai-heat-map)heatmapshape
color_modecolor_rangecolor_preset)r|   enterexitcolor_range_change
colorRangefull_range_change	fullRanger-   r0   s      r   r   zXaiHeatMap.__init__  ss    *H????? 
 
 
 	
 	 
 
 
 	
r   r   r1   r%   s   @r   r   r     sG         &
 
 
 
 
 
 
 
 
 
r   r   c                   $     e Zd ZdZd fd	Z xZS )r   a  
    XaiImage show an image with a XaiHeatMap as overlay

    :param src: URL to the image to display
    :param max_height: Limit the size of the image vertically
    :param max_width: Limit the size of the image horizontally
    :param width: If present use as style.width = "..."
    :param colors: Palette to use for areas
    :param areas: (optional) Array containing bounding box info
    :param area_key: (optional) Key in the area[i][key] that id the area
    :param area_style: (optional) css style to apply (default: { stroke-width: 3, rx: 10 })
    :param area_selected: (optional) Array of area ids
    :param area_selected_opacity: Opacity to use for selected areas 0-1
    :param area_opacity: Opacity to use for all areas 0-1
    :param heatmaps: Dict of arrays
    :param heatmap_opacity: Opacity of the heatmap overlay
    :param heatmap_color_preset: Preset name from `vtk.js <https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/ColorTransferFunction/ColorMaps.json>`_
    :param heatmap_color_range: Range to be used when `heatmap_color_mode="custom"`
    :param heatmap_active: Key in heatmaps to select
    :param heatmap_color_mode: full, maxSym, minSym, positive, negative, custom (default: full)

    Events:

    :param area_selection_change: event triggered when requested area selection change
    :param hover: event triggered when moving over the map
    :param enter: event triggered when entring the map area
    :param exit: event triggered when exiting the map area
    :param color_range_change: event triggered when color range used has changed
    :param full_range_change: event triggered when full range has changed
    Nc                      t                      j        d|fi | | xj        g dz  c_        | xj        g dz  c_        d S )Nztc-xai-image)srcr   r   r   colorsareasarea_key
area_stylearea_selectedarea_selected_opacityarea_opacityheatmapsheatmap_opacityheatmap_color_presetheatmap_color_rangeheatmap_activeheatmap_color_mode))area_selection_changeareaSelectionChanger|   r   r   r   r   r-   r0   s      r   r   zXaiImage.__init__  sr    <<V<<< 
 
 
 	
& 	 
 
 
 	
r   r   r1   r%   s   @r   r   r     sG         >
 
 
 
 
 
 
 
 
 
r   r   c                         e Zd Zd fd	Z xZS )r   Nc                      t                      j        d|fi | | xj        g dz  c_        | xj        dgz  c_        d S )Nztc-line-seed))point_1point1)point_2point2)n_stepsnumberOfSteps)	n_sliders	nbSlidersboundsimage)update_seedzupdate-seedr-   r0   s      r   r   zLineSeed.__init__  sk    <<V<<< 
 
 
 	
 	*
 	
r   r   r    r%   s   @r   r   r     s=        
 
 
 
 
 
 
 
 
 
r   r   N)trame_client.widgets.corer   trame_componentsr   __all__r   r   r   r   r   r	   r
   r   r   r   r   r   r    r   r   <module>r      s   5 5 5 5 5 5 # # # # # #   . . . . ./ . . .( ( ( ( ( ( ( (6@ @ @ @ @[ @ @ @4	2 	2 	2 	2 	2[ 	2 	2 	2 
  
  
  
  
{  
  
  
L(0 (0 (0 (0 (0 (0 (0 (0\@ @ @ @ @; @ @ @,A
 A
 A
 A
 A
 A
 A
 A
R
 
 
 
 
+ 
 
 
L@
 @
 @
 @
 @
k @
 @
 @
P#
 #
 #
 #
 #
 #
 #
 #
V<
 <
 <
 <
 <
{ <
 <
 <
H
 
 
 
 
{ 
 
 
 
 
r   