<commit_before>## EP 003 - View Registration

> Status: Placeholder. Don't bother reading yet. 


### Abstract 


### Notes


Create using `def-view`:
```clj
(def-view 
   :something 
   
   ;; indicate what subscriptions we wish to obtain 
   ;; obtain a dispatch for use 
   ;; get the context id if you want to 
   ;; 
   (fn [_ id]
      {:subs [[:item ]] 
       :context ["name1", "name2")})
       
   ;; the renderer
   ;; last argument `ins` is a map of:
   ;;    - `:subs` - a vector of subscription values? 
   ;;    - :dispatch and :subscribe 
   ;;    - :context - a vector of context values
   ;; 
   (fn [a-str  ins]
     (let [XXXX] 
       )))
```

Use of `:something`:
```clj
[:something "Hello"] 
```<commit_msg>Update 004-ViewRegistration.md<commit_after>## EP 003 - View Registration

> Status: Placeholder. Don't read yet. 


### Abstract 

Broadbrush:
   - views registered via a new `def-view` function
   - like other re-frame registration functions, `def-view` associates a `keyword` with a (reagent) render function
   - the registered view keyword (eg: `:my-view`) can be used in hiccup to identify the renderer. eg:  `[:my-view  "Hello world"]`
   - `def-view` allows various values to be `injected` as args into the view render
   
What might need to be injected (as args) into a view:  

  - `subscribe` and `dispatch` 
  - a `frame` supplied via `context`  (subscribe and dispatch from frame)
  - other context: data from higher in the DOM tree
  - annimation?  CSS  ?

XXX searches up the DOM heirarchy looking for a `frame` context then extracts dispatch and subscribe.  Sounds inefficient. 

### Code Doodles

Associate the keyword `:my-view-id ` with a renderer using `def-view`:
```clj
(def-view 
   :my-view-id 
   
   ;; injection function
   ;; indicate what subscriptions we wish to obtain 
   ;; obtain a dispatch for use 
   ;; get the context id if you want to 
   ;; 
   :subscriptions 
   (fn [_ id]
      {:subs [[:item ]] 
       :context ["name1", "name2")})

       
   ;; the renderer
   ;; last argument `ins` is a map of:
   ;;    - `:subs` - a vector of subscription values? 
   ;;    - :dispatch and :subscribe 
   ;;    - :context - a vector of context values
   ;; 
   (fn [a-str  ins]
     (let [XXXX] 
       )))
```

Use of `:my-view-id `:
```clj
[:my-view-id  "Hello"] 
```


Misc Notes:
   
   - reagent hiccup will be changed/monkey-patched so that views can be identified by keyword
   - Views are the leaves of the signal graph. They need to subscribe and dispatch. 
   
{'fraction_non_alphanumeric': 0.12071005917159763, 'fraction_numerical': 0.005128205128205128, 'mean_word_length': 2.6176890156918686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2864493', 'n_tokens_mistral': 872, 'n_tokens_neox': 778, 'n_words': 308}