id
int64 0
45.1k
| file_name
stringlengths 4
68
| file_path
stringlengths 14
193
| content
stringlengths 32
9.62M
| size
int64 32
9.62M
| language
stringclasses 1
value | extension
stringclasses 6
values | total_lines
int64 1
136k
| avg_line_length
float64 3
903k
| max_line_length
int64 3
4.51M
| alphanum_fraction
float64 0
1
| repo_name
stringclasses 779
values | repo_stars
int64 0
882
| repo_forks
int64 0
108
| repo_open_issues
int64 0
90
| repo_license
stringclasses 8
values | repo_extraction_date
stringclasses 146
values | sha
stringlengths 64
64
| __index_level_0__
int64 0
45.1k
| exdup_ids_cmlisp_stkv2
listlengths 1
47
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,674
|
display.common.lisp
|
phantomics_seed/seed.ui-spec.display.common/display.common.lisp
|
;;;; display.common.lisp
(in-package #:seed.ui-model.react)
(specify-components
html-view-mode
(html-display
(:get-initial-state
(lambda () (create content-string (@ this props data)))
:component-did-mount
(lambda () (chain subcomponents (script-effects (@ this props))))
;; run specified script effects for the contained HTML
:component-will-receive-props
(lambda (next-props) (chain this (set-state (create content-string (@ next-props data))))))
(panic:jsl (:div :class-name "element-view"
;; (seed-icon :face)
;; (:div :style (create font-size "400%")
;; (seed-icon :chart-editor))
(:div :class-name "html-display"
:dangerously-set-inner-h-t-m-l
(create __html (@ this state content-string))))))
(bitmap-display
(:get-initial-state
(lambda () (create image-uri (@ this props data)))
:component-will-receive-props
(lambda (next-props)
(let ((this-date (new (-date))))
(chain this (set-state (create image-uri (+ (@ this props data) "?"
(chain this-date (get-time)))))))))
(panic:jsl
(:div :class-name "element-view"
(:img :src (@ this state image-uri))))))
| 1,156
|
Common Lisp
|
.lisp
| 30
| 34.4
| 94
| 0.652135
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
aaf820f9cde4b3aa739f741296ee77a840f7c6d6cfb2727cd917424b0533adb6
| 2,674
|
[
-1
] |
2,675
|
style.icons-m-design.lisp
|
phantomics_seed/seed.foreign.browser-spec.style.icons-m-design/style.icons-m-design.lisp
|
;;;; style.icons-m-design.lisp
(in-package #:seed.foreign.browser-spec.style.icons-m-design)
(defparameter *local-package-name* (package-name *package*))
(defmacro foundational-browser-style-material-design-icons ()
"Generate the paths for the style source files."
(mapcar (lambda (item) (asdf:system-relative-pathname (intern *local-package-name* "KEYWORD") item))
(list "./material-icons.css")))
| 408
|
Common Lisp
|
.lisp
| 7
| 55.857143
| 102
| 0.751256
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
e8b322b0767ebbf13d2f92f4a8bae9bdfb928d3f5d5faade4fb6b834be0bd214
| 2,675
|
[
-1
] |
2,676
|
media.base.lisp
|
phantomics_seed/seed.media.base/media.base.lisp
|
;;;; media.base.lisp
(in-package #:seed.generate)
(specify-media
media-spec-base
;; read data from a file
(get-file (source)
`(load-exp-from-file (sprout-name sprout)
,(if (symbolp source)
`(concatenate 'string (string-downcase ,(if (eq :-self source)
`(branch-name branch)
`(quote ,source)))
".lisp")
(if (stringp source)
source))))
;; read text from a file
(get-file-text (source)
`(load-string-from-file (sprout-name sprout)
,(if (symbolp source)
`(concatenate 'string
(string-downcase ,(if (eq :-self source)
`(branch-name branch)
`(quote ,source)))
".lisp")
(if (stringp source)
source))))
;; write data to a file
(put-file (follows reagent file-name)
`((file-output (exp-string reagent "")
(asdf:system-relative-pathname
(sprout-name sprout)
;; (concatenate 'string (string-downcase ,(if (eq :-self file-name)
;; `(branch-name branch)
;; `(quote ,file-name)))
;; ".lisp")
,(if (symbolp file-name)
`(concatenate 'string
(string-downcase ,(if (eq :-self file-name)
`(branch-name branch)
`(quote ,file-name)))
".lisp")
(if (stringp file-name)
file-name))))))
;; get a branch image
(get-image (&optional source)
`(branch-image ,(if source `(find-branch-by-name ,source sprout)
'branch)))
;; record a branch image
(put-image (follows reagent)
`((setf (branch-image branch) ,(if reagent 'reagent 'data))))
;; set the branch image to nil
(nullify-image (follows reagent)
`((setf (branch-image ,(if reagent `(find-branch-by-name ,reagent sprout)
'branch))
nil)))
;; get a referenced value from a system
(get-value (follows source)
`((let ((val-sym (intern (string-upcase ,(if (eq :-self source)
`(branch-name branch)
`(quote ,source)))
(string-upcase (sprout-name sprout)))))
(if (boundp val-sym) (eval val-sym)))))
;; get the list of systems in contact with a portal
(get-portal-contacts (follows)
`((mapcar #'sprout-name (portal-contacts sprout))))
;; assign a value to the datum, overwriting whatever value existed previously
(set-data (follows reagent)
(list reagent))
;; get a property of branch metadata
(get-meta (source &rest params)
`(of-branch-meta ,(if (getf params :of-branch)
`(find-branch-by-name ,(getf params :of-branch)
sprout)
'branch)
,source))
;; set a property of the branch's metadata
(set-meta (follows reagent value)
`((set-branch-meta branch ,(intern (string-upcase reagent) "KEYWORD")
,value)
data))
;; set the "type" parameter of a branch
(set-type (follows &rest params)
`((set-param :type (quote ,params))
data))
;; set a branch's time parameter to the current time
(set-time (follows)
`((set-param :time (get-universal-time))
data))
;; designate a branch as stable or not
(set-stable (follows or-not)
`((set-branch-meta branch :stable ,(if (eq :not or-not) nil t))
data))
;; designate the set branch
(set-active-system-by-selection (follows reagent)
`((let ((dat ,(if reagent 'reagent 'data))
(value nil))
(loop for item in (cadar dat)
when (eq :select (getf (getf (cddr item) :mode) :view))
do (setq value (intern (string-upcase (second item))
"KEYWORD")))
(setf (getf (sprout-meta sprout) :active-system)
(symbol-jstring-process value)
(getf (branch-meta branch) :active-system)
(string-downcase value)))))
;; passthrough form used to specify stage display parameters
(display-params (follows &rest params)
`(data))
;; fetch a branch parameter; functions as a check whether the parameter is nil or not
(is-param (key true-or-not)
`(get-param ,key))
(set-param (follows key value)
`((set-param ,key ,value)))
;; fetch a piece of branch metadata; functions as a check whether said element is nil or not
(is-meta (key true-or-not)
`(of-branch-meta branch ,key))
;; check whether or not a branch is designated as stable
(is-stable (true-or-not)
`(getf (branch-meta branch) :stable))
;; transfer current input or output to another branch, forking its path
(fork-to (follows branch-to)
`((set-param :origin-branch (branch-name branch))
(funcall (branch-input (find-branch-by-name ,branch-to sprout))
data params (find-branch-by-name ,branch-to sprout)
sprout (lambda (dat par) (declare (ignorable dat par))))
data))
;; transfer current input to a different portal
;; TODO: this is a WIP
(to-portal (follows reagent)
`(()))
;; transmit data to a remote portal TODO: this is just a stub
(remote (follows params)
(let ((par (cons 'list params)))
`((drakma:http-request (getf ,par :host)
:method :post :content-type "application/x-lisp; charset=utf-8"
:content
(write-to-string (list (intern (string-upcase (getf ,par :name)))
(intern "GROW")
(intern (string-upcase (getf ,par :branch)))
data))))))
;; route the input or output to one of two paths depending whether given conditions are true
(if-condition (condition &rest options)
;; return the paths, returning the 'dat symbol in the stead of an absent second path
(lambda (paths) (if (second paths)
;; TODO: eliminate use of 'dat here
paths (list (first paths) 'dat))))
;; fetch a branch's image; functions as a check whether said image exists
(is-image (true-or-not)
`(branch-image branch))
;; performs a series of actions in another branch
(in-branch (follows branch-name &rest to-do)
`((let ((other-branch (find-branch-by-name ,branch-name sprout)))
(if other-branch (funcall (lambda (input params branch)
(declare (ignorable input params branch))
,@to-do)
data params other-branch)))))
;; sets list of contingencies that may be checked to control routing
(contingencies (follows &rest names)
`((set-branch-meta branch :contingencies (list ,@names))
data))
;; evaluates conditions in other branches with the specified contingencies
;; and chooses IO route according to truth/falsehood of the tests
(is-contingent (contingencies media true-or-not)
`(funcall (lambda (results)
,(cond ((eq :all-of (first contingencies))
`(not (member nil results)))
(t `(member t results))))
(mapcar (lambda (branch-name)
;(print (list :bbr branch-name true-or-not))
(let ((other-branch (find-branch-by-name branch-name sprout)))
;; run media functions in each contingent branch
(funcall (lambda (input params branch)
(declare (ignorable input params branch))
,media)
data params other-branch)))
;; the current branch is not tested when testing contingent branches
(remove (branch-name branch)
(remove-duplicates
(loop for cname in (list ,@(rest contingencies))
append (loop for br in (sprout-branches sprout)
when (not (not (member cname (getf (branch-meta br)
:contingencies))))
collect (branch-name br))))))))
;; checks whether a datum is a form formatted for frontend display
(is-display-format (true-or-not)
`(seed.modulate:display-format-predicate data))
;; call a function within the system's package using given arguments,
;; or the image and branch metadata if no arguments are provided
(call (follows reagent)
`((funcall (symbol-function (intern ,(string-upcase reagent)
(string-upcase (sprout-name sprout))))
(branch-image branch)
(branch-meta branch))))
;; assign system's name as package name in Lisp file to be output
(code-package (follows)
`((cons (list 'in-package (make-symbol (string-upcase (sprout-name sprout)))) data))
`((rest data)))
;; contextualize a list of input
(table-specs (follows reagent)
`((mapcar (lambda (item)
(if (string= "IN-TABLE" (string-upcase (first item)))
(append (list (first item) (second item)) data)
item))
reagent))
`((funcall (lambda (in)
(labels ((process (i)
(if i (let ((point (first i)))
(if (string= "IN-TABLE" (string-upcase (first point)))
(cddr point)
(process (rest i)))))))
(process in)))
reagent)))
;; converts data between display (JSON) and internal (Lisp) formats
(codec (follows)
`((seed.modulate:decode data))
`((multiple-value-bind (output meta-form)
(seed.modulate:encode (sprout-name sprout) data)
;;(print (list :out output meta-form))
;(set-branch-meta branch :depth (getf meta-form :depth))
;(set-branch-meta branch :glyphs (gethash :glyphs meta-form))
(set-branch-meta branch :glyphs (getf meta-form :glyphs))
output)))
;; converts data into display-ready JSON format
(json-to-display (follows reagent)
`((preprocess-structure (if ,reagent ,reagent data))))
(json-string-structure (follows)
`(`(list :string ,data
:data (quote ,(jonathan:parse data
:keyword-normalizer
(lambda (key)
(string-upcase (camel-case->lisp-name key)))
:normalize-all t))))
`(;;(print (list :dd data))
(getf data :string)))
(document-content (follows)
`((let ((jonathan:*null-value* :null)
(jonathan:*false-value* :false))
(list 'seed.app-model.document-slate.base:document-as-html
(jonathan:parse data
:keyword-normalizer
(lambda (key) (string-upcase (camel-case->lisp-name key)))
:normalize-all t))))
`((let ((jonathan:*null-value* :null)
(jonathan:*false-value* :false))
(labels ((convert-keywords (items)
(if (listp (first items))
(mapcar #'convert-keywords items)
(let ((index 0))
(loop for item in items
when (evenp index) collect (intern (lisp->camel-case item)
"KEYWORD")
when (oddp index) collect (if (and item (listp item))
(convert-keywords item)
item)
do (incf index 1))))))
;; process the second element of the data since the first element is 'document-as-html
(jonathan:to-json (convert-keywords (second data)))))))
;; passthrough form meant to wrap stage parameters for use by stage definitions that analyze the branch spec
(stage-params (follows &rest params)
`(data))
;; format data for use as a common form - in most cases, it actually does nothing since the data
;; is formatted like that to start with
(form (follows)
`((if (get-param :from-clipboard)
(multiple-value-bind (output-form form-point)
(follow-path (get-param :point-to)
(branch-image branch)
(lambda (point)
(declare (ignore point))
(let* ((cb-input (get-param :clipboard-input))
(cb-data (getf cb-input :data))
(type-settings (find-form-in-spec 'set-type
(branch-spec (find-branch-by-name
(getf cb-input :origin)
sprout)))))
(cond ((and (eq :matrix (cadar type-settings))
(eq :spreadsheet (caddar type-settings)))
;; handle pasting spreadsheet values into forms
(if (getf cb-data :data-com)
(first (getf cb-data :data-com))
(if (getf cb-data :data-inp) (getf cb-data :data-inp))))
(t cb-data)))))
(declare (ignore form-point))
output-form)
data))
`((if (get-param :from-clipboard)
(multiple-value-bind (output-form from-point)
(follow-path (get-param :point-to)
(branch-image branch)
(lambda (point) point))
(declare (ignore output-form))
from-point)
data)))
;; convert between arrays of spreadsheet data for processing and lists of spreadsheet data for conversion to
;; frontend JSON display format
(sheet (follows)
`((if (get-param :from-clipboard)
(let* ((cb-input (get-param :clipboard-input))
(cb-data (getf cb-input :data)))
(setf (apply #'aref (cons (branch-image branch) (reverse (get-param :point))))
(let ((type-settings (find-form-in-spec 'set-type (branch-spec (find-branch-by-name
(getf cb-input :origin)
sprout)))))
(cond ((and (eq :matrix (cadar type-settings))
(eq :spreadsheet (caddar type-settings)))
;; spreadsheet values are simply passed through, of course...
(if (getf cb-data :data-inp)
(list :type (getf cb-data :type)
:data-inp (getf cb-data :data-inp))
(list :type (getf cb-data :type)
:data-inp (first (getf cb-data :data-com)))))
((eq :form (cadar type-settings))
(list :type (cond ((stringp cb-data) :string)
((numberp cb-data) :number)
((listp cb-data) :list)
((symbolp cb-data) :symbol)
(t :number))
:data-inp cb-data))
(t cb-data))))
(branch-image branch))
(array-map #'seed.app-model.sheet.base:interpret-cell
(array-map #'postprocess-structure (list-to-array data 2)))))
`((if (get-param :from-clipboard)
(apply #'aref (cons data (reverse (get-param :point))))
(array-to-list (array-map #'preprocess-structure data)))))
;; generate or disassemble a dynamic variable assignment in Lisp code
(dynamic-var (follows reagent symbol input)
`((funcall (lambda (content)
(let ((def-pos (position ,symbol content
:test (lambda (to-match item)
(and (eql 'defvar (first item))
(eq to-match (intern (string (second item))
"KEYWORD")))))))
(setf (nth (1+ def-pos) content)
`(setq ,(second (nth def-pos content))
,(if ,input ,input data)))
content))
reagent))
`((let ((found nil) (output nil))
(loop for item in ,reagent
when (and found (not output))
do (setq output (third item))
when (and (eql 'defvar (first item))
(string= (string-upcase (second item))
,(string-upcase symbol)))
do (setq found t))
output)))
;; records items from input to system's clipboard branch / fetches items from clipboard for output
(clipboard (follows reagent)
`((let* ((vector (get-param :vector))
(cb-point-to (if (not (of-branch-meta branch :point-to))
(set-branch-meta branch :point-to 0)
(of-branch-meta branch :point-to)))
(branch-key (intern (string-upcase (get-param :branch))
"KEYWORD"))
(associated-branch (find-branch-by-name branch-key sprout))
(new-params params))
(setf (getf new-params :from-clipboard) (branch-name branch))
(if (= 0 (first vector))
;; if the horizontal motion is zero, change the point according to the vertical motion
(progn (set-branch-meta branch :point-to
(min (max 0 (1- (length reagent)))
(max 0 (- cb-point-to (second vector)))))
reagent)
(if (< 0 (first vector))
;; if the horizontal motion is positive, enter the other branch's form at point
(funcall (branch-output associated-branch)
nil new-params associated-branch
sprout (lambda (data-output pr)
(declare (ignorable pr))
(cons (list :time (get-param :time)
:origin branch-key
:data data-output)
reagent)))
;; if the horizontal motion is negative, replace the other branch's form at point
;; with the clipboard item at point
(progn (setf (getf new-params :clipboard-input) (nth cb-point-to reagent)
;; nullify vector so history recording works properly
(getf new-params :vector) nil)
(funcall (branch-input associated-branch)
nil new-params associated-branch
sprout (lambda (data-output pr)
(declare (ignore data-output pr))
reagent)))))))
`((let ((items (mapcar (lambda (item) (getf item :time))
data)))
(if items (list items)))))
;; records input to system's history branch / fetches items from history branch for output
(history (follows reagent)
`((if (not (get-param :from-history))
;; don't do anything if the input came from a history movement - this prevents an infinite loop
(if (get-param :vector)
(let* ((points (of-branch-meta branch :points))
(branch-key (intern (string-upcase (get-param :recall-branch))
"KEYWORD"))
(history-index (setf (getf points branch-key)
(min (max 0 (1- (length (getf reagent branch-key))))
(max 0 (+ (first (get-param :vector))
(if (getf points branch-key)
(getf points branch-key)
0)))))))
(set-branch-meta branch :points points)
(set-param :from-history t)
(funcall (branch-input (find-branch-by-name branch-key sprout))
(getf (nth history-index (getf reagent branch-key)) :data)
params (find-branch-by-name branch-key sprout)
sprout (lambda (dt pr) (declare (ignorable dt pr))))
reagent)
(progn (setf (getf reagent (getf params :origin-branch))
(cons (list :time (get-param :time)
:data data)
(getf reagent (get-param :origin-branch))))
reagent))
reagent))
`((let ((branch-index 0))
(labels ((process-each (input &optional output)
(if input
(let ((this-index branch-index))
(setq branch-index (1+ branch-index))
(process-each (cddr input)
(append (mapcar (lambda (item index)
(list 'meta
(getf item :time)
:branch-reference (first input)
:branch-index this-index
:point-offset
(let ((this-point
(getf (of-branch-meta branch :points)
(first input))))
(abs (- index
(if this-point this-point 0))))))
(second input)
(loop for n from 0 to (1- (length (second input)))
collect n))
output)))
output)))
(list (sort (process-each data)
(lambda (ifirst isecond) (> (second ifirst) (second isecond)))))))))
)
;; (defmacro specify-media2 (&rest stuff)
;; (declare (ignore stuff))
;; nil)
;; (specify-media2
;; media-spec-base
;; (with :tokens-symbol tokens :idiom-symbol idiom :space-symbol workspace
;; :properties-symbol properties :processor-symbol process)
;; (defun get-file (data source)
;; `(load-exp-from-file (sprout-name sprout)
;; ,(if (symbolp source)
;; `(concatenate 'string (string-downcase ,(if (eq :-self source)
;; `(branch-name branch)
;; `(quote ,source)))
;; ".lisp")
;; (if (stringp source)
;; source))))
;; ;; read text from a file
;; (defun get-file-text (data source)
;; `(load-string-from-file (sprout-name sprout)
;; ,(if (symbolp source)
;; `(concatenate 'string
;; (string-downcase ,(if (eq :-self source)
;; `(branch-name branch)
;; `(quote ,source)))
;; ".lisp")
;; (if (stringp source)
;; source))))
;; ;; write data to a file
;; (defun put-file (data follows reagent file-name)
;; `((file-output (exp-string reagent "")
;; (asdf:system-relative-pathname
;; (sprout-name sprout)
;; ;; (concatenate 'string (string-downcase ,(if (eq :-self file-name)
;; ;; `(branch-name branch)
;; ;; `(quote ,file-name)))
;; ;; ".lisp")
;; ,(if (symbolp file-name)
;; `(concatenate 'string
;; (string-downcase ,(if (eq :-self file-name)
;; `(branch-name branch)
;; `(quote ,file-name)))
;; ".lisp")
;; (if (stringp file-name)
;; file-name))))))
;; ;; get a branch image
;; (defun get-image (data &optional source)
;; `(branch-image ,(if source `(find-branch-by-name ,source sprout)
;; 'branch)))
;; ;; record a branch image
;; (defun put-image (data follows reagent)
;; `((setf (branch-image branch) ,(if reagent 'reagent 'data))))
;; ;; set the branch image to nil
;; (defun nullify-image (data follows reagent)
;; `((setf (branch-image ,(if reagent `(find-branch-by-name ,reagent sprout)
;; 'branch))
;; nil))))
;; (setq mmm (macroexpand `(specify-media
;; media-spec-base
;; ;; read data from a file
;; (get-file (source)
;; `(load-exp-from-file (sprout-name sprout)
;; ,(if (symbolp source)
;; `(concatenate 'string (string-downcase ,(if (eq :-self source)
;; `(branch-name branch)
;; `(quote ,source)))
;; ".lisp")
;; (if (stringp source)
;; source))))
;; ;; read text from a file
;; (get-file-text (source)
;; `(load-string-from-file (sprout-name sprout)
;; ,(if (symbolp source)
;; `(concatenate 'string
;; (string-downcase ,(if (eq :-self source)
;; `(branch-name branch)
;; `(quote ,source)))
;; ".lisp")
;; (if (stringp source)
;; source))))
;; ;; write data to a file
;; (put-file (follows reagent file-name)
;; `((file-output (exp-string reagent "")
;; (asdf:system-relative-pathname
;; (sprout-name sprout)
;; ;; (concatenate 'string (string-downcase ,(if (eq :-self file-name)
;; ;; `(branch-name branch)
;; ;; `(quote ,file-name)))
;; ;; ".lisp")
;; ,(if (symbolp file-name)
;; `(concatenate 'string
;; (string-downcase ,(if (eq :-self file-name)
;; `(branch-name branch)
;; `(quote ,file-name)))
;; ".lisp")
;; (if (stringp file-name)
;; file-name)))))))))
| 21,805
|
Common Lisp
|
.lisp
| 533
| 34.838649
| 109
| 0.612562
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
5b5fb7845793c7a91df0fa64f3bf05d516b2335ddc65d8a94deeb067d318faeb
| 2,676
|
[
-1
] |
2,677
|
extension.lisp
|
phantomics_seed/seed.media.base/extension.lisp
|
;;;; extension.lisp
(in-package #:seed.generate)
(use-package 'drakma)
(use-package 'seed.app-model.sheet.base)
(use-package 'seed.app-model.document-slate.base)
(export 'media-spec-base)
| 190
|
Common Lisp
|
.lisp
| 6
| 30.333333
| 49
| 0.763736
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
e86862a30e2d6ed1a2b9ea1f60ea27a7329b6e62a963cae12d951c4e3ea06d78
| 2,677
|
[
-1
] |
2,678
|
package.lisp
|
phantomics_seed/seed.modulate/package.lisp
|
(defpackage #:seed.modulate
(:export #:encode #:decode #:display-format-predicate #:modes
#:glyphs #:specify-glyphs #:preprocess-structure #:symbol-jstring-process #:postprocess-structure)
(:use #:common-lisp #:cl-utilities #:fare-quasiquote #:cl-ppcre #:parse-number #:symbol-munger))
| 301
|
Common Lisp
|
.lisp
| 4
| 70.5
| 109
| 0.717172
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
729a0855404120d7d14b8d337cc3c4f411cd2218ec333d32b6218bd4bc2f2dad
| 2,678
|
[
-1
] |
2,679
|
modulate.lisp
|
phantomics_seed/seed.modulate/modulate.lisp
|
;;;; modulate.lisp
(in-package #:seed.modulate)
(defparameter *local-package-name* (package-name *package*))
(defun array-map (function &rest arrays)
"Maps the function over the arrays. Assumes that all arrays are of the same dimensions. Returns a new result array of the same dimension."
(flet ((make-displaced-array (array)
(make-array (reduce #'* (array-dimensions array))
:displaced-to array)))
(let* ((displaced-arrays (mapcar #'make-displaced-array arrays))
(result-array (make-array (array-dimensions (first arrays))))
(displaced-result-array (make-displaced-array result-array)))
(declare (dynamic-extent displaced-arrays displaced-result-array))
(apply #'map-into displaced-result-array function displaced-arrays)
result-array)))
(defun array-coord-enum (ar &optional result-array coords)
"Create an array with the same dimensions of the input array whose members are lists of numbers enumerating the coordinates of the input array's members."
(let ((result-array (if result-array result-array
(make-array (array-dimensions ar)
:initial-element nil))))
(if (< (length coords)
(length (array-dimensions ar)))
(progn (loop for index from 0 to (1- (array-dimension ar (length coords)))
do (array-coord-enum ar result-array (append coords (list index))))
(if (not coords) result-array))
(setf (apply #'aref (cons result-array coords))
coords))))
(defun list-dimensions (list depth)
"Get the dimensions of a list."
(loop repeat depth
collect (length list)
do (setf list (car list))))
(defun list-to-array (list depth)
"Convert list to array."
(make-array (list-dimensions list depth)
:initial-contents list))
(defun array-to-list (array)
"Convert array to list."
(let* ((dimensions (array-dimensions array))
(depth (1- (length dimensions)))
(indices (make-list (1+ depth) :initial-element 0)))
(labels ((recurse (n)
(loop for j below (nth n dimensions)
do (setf (nth n indices) j)
collect (if (= n depth)
(apply #'aref array indices)
(recurse (1+ n))))))
(recurse 0))))
(defun trace-symbol (sym package)
(if (find-package package)
(multiple-value-bind (symbol provenance)
(intern (string-upcase sym)
(package-name package))
(if (and provenance (eq provenance :inherited))
(labels ((use-list-search (packages &optional output)
(if (or output (not packages))
output
(let ((symbol-list (let ((slist nil))
(do-external-symbols (sym (first packages))
(setq slist (cons sym slist)))
slist)))
(use-list-search (rest packages)
(if (find symbol symbol-list)
(first packages)))))))
(use-list-search (package-use-list package)))
package))))
(defmacro create-meta ()
nil)
(defmacro of-meta (property)
`(getf meta ,property))
(defmacro of-properties (property properties)
`(getf ,properties ,property))
;; (defmacro create-meta ()
;; '(make-hash-table :test #'eq))
;; (defmacro of-meta (property)
;; `(gethash ,property meta))
;; (defmacro of-properties (property properties)
;; `(gethash ,property ,properties))
(defun encode (package-string form)
"Top-level wrapper for encode process; initializes encoding metadata and passes code to encodeExpr function."
(let ((meta (create-meta)))
(setf (of-meta :package) package-string)
(multiple-value-bind (form-out meta-out)
(encode-expr form meta)
(values (downcase-jsform form-out)
meta-out))))
(defun decode (input)
"Wrapper for decode function - the decoding process is less variable than the encoding process, so it's merely a formality."
(decode-expr input))
(defun encode-expr (form &optional meta output)
"Convert a given form to the display format."
(let ((point (if (listp form) ;; this condition should only go into effect when an atom is
(first form) ;; passed directly from an output function
form))
(meta (if meta meta (create-meta))))
;;(print (list :mt meta form))
;; set initial element flag to true so that the atom heading a form can be correctly marked
(if (not output)
(setf (of-meta :initial) t))
(if (or (and point (atom point)) ;; if the point is an atom or nil
(and (not point) form))
(multiple-value-bind (output-form output-meta)
(atom-to-jsform point meta)
(encode-expr (if (listp form) (rest form))
output-meta (append output (list (if (and (arrayp point)
(not (stringp point)))
(encode-array point)
output-form)))))
(if point ;; if the point is a non-nil list
(multiple-value-bind (result-output result-meta)
;; encodeExpr for processing forms, atomToJsform for processing forms converted to atoms
(encode-form point #'encode-expr #'atom-to-jsform meta output)
(let ((new-meta result-meta))
(if (and (not output)
(not (of-properties :enclosed result-meta)))
(setf (of-properties :to-enclose result-meta) t
(of-properties :enclosed new-meta) t))
(encode-expr (rest form)
new-meta ;; begin the list with a plain list object if the list is nested
;; the enclosed property marks whether or not the form has been enclosed
;; in its outermost list. Because of the way the indexing works, a special
;; provision is made to correctly number the outermost list with the 0 index. x
(append (if output output (list (atom-to-jsform (list :ty (list "plain"))
result-meta)))
(list result-output)))))
(progn (setf (of-meta :initial) nil)
;; strip away plain list header if the head of the list has an atom macro - i.e. if the first
;; element is not a true list but an atom with a macro applied - and if the head of the list
;; does _not_ have a form macro, meaning that it is also the head of a sub-form.
;; the double application is rare but occurs on the first element in a portal specification,
;; thus its quick discovery
(values (if (and (eq :ty (caar output))
(string= "plain" (caadar output))
(keywordp (caadr output))
(getf (second output) :am)
(not (getf (first output) :fm))
(not (getf (second output) :fm)))
;(progn (print (list :mm meta))
;; output)
;; (rest output)
output
output)
meta))))))
(defun encode-array (array &optional dims point output)
"Convert a given array to the display format."
(let ((point (if point point (list 0)))
(dims (if dims dims (array-dimensions array))))
(if (> (nth (1- (length point)) dims)
(first (last point)))
(encode-array array dims
(append (butlast point)
(mapcar #'1+ (last point)))
(append output (if (> (length dims)
(length point))
(list (encode-array array dims (append point (list 0))))
(encode-expr (apply #'aref (cons array point))))))
(if (> (length point) 1) ;; prepend array information object if
output ;; this is the end of the array
(cons (list :ty (list "array")
:dm dims)
output)))))
(defun decode-expr (form &optional output macros)
"Convert a display-formatted form back to a standard Lisp form."
(let ((point (first form)))
(if (keywordp (first point)) ;; if the point is a JSON object
(let ((point-macros (if (getf point :fm)
(append (getf point :fm) macros)
macros)))
(if (string= "plain" (first (getf point :ty))) ;; if this is the head of a plain list
(decode-expr (rest form)
output point-macros)
(if (string= "array" (first (getf point :ty)))
(list-to-array (rest form)
(1- (length (getf point :ty))))
(decode-expr (rest form)
(append output (list (decode-atom point)))
point-macros))))
(if point
(multiple-value-bind (output-form returned-macros)
(decode-expr point)
(decode-expr (rest form)
(append output (list (decode-form output-form returned-macros (first point))))
macros))
(values output macros)))))
(defun atom-to-jsform (obj meta)
"Generates a JSON-convertible property list from a Lisp atom."
(let* ((object (if (and (listp obj)
(keywordp (first obj)))
obj (encode-atom obj meta)))
(jsform (append (if (and (arrayp obj)
(not (stringp obj)))
(let ((base-ct (of-meta :ct))
(base-ly (of-meta :ly)))
(list :ty (list "array") ;; TODO: array-handling needs much more work
:vl (array-map (lambda (member coords)
(list :vl (encode-expr member meta)
:ct (+ (if base-ct base-ct 0)
(first coords))
:ly (+ (if base-ly base-ly 0)
(if (second coords)
(second coords)
0))))
obj (array-coord-enum obj))))
object)
(list :ix (let ((index (of-meta :ix))
(enclosing nil))
(if (of-meta :to-enclose)
(setf (of-meta :to-enclose) nil
(of-meta :enclosed) t
enclosing t))
(if enclosing 0 (setf (of-meta :ix) (if index (1+ index) 1))))))))
(setf (getf jsform :ty)
;; prepend a form-describing type to the type list if this atom is at the start of a list
(append (if (of-meta :initial)
;; check that this is marked as the initial atom in the list
(progn (setf (of-meta :initial) nil)
;; the initial atom marker is now set to nil
(if (and (getf object :vl)
(of-meta :package)
(or (string= "symbol" (first (getf object :ty)))
(string= "keyword" (first (getf object :ty))))
;; check that value is not nil
;; also check that value is not blank
(not (= 0 (length (getf object :vl))))
(not (char= #\# (aref (getf object :vl) 0))))
;; the # character causes problems - TODO: a better way to do this?
(let ((sym (intern (string-upcase (getf object :vl))
(package-name (find-package (of-meta :package))))))
(list (if (string= "keyword" (first (getf object :ty)))
"form-keyword-list"
(if (macro-function sym)
"form-macro"
(if (fboundp sym)
"form-function" "form-list"))))))))
(getf object :ty)))
(if (not (of-meta :glyphs))
(setf (of-meta :glyphs)
(make-array 0 :adjustable t)))
(setf (of-meta :glyphs)
(add-array-glyph (of-meta :glyphs)
(if (and (getf jsform :vl)
(stringp (getf jsform :vl)))
;; add the atom's value to the type list, if said value is a string, indicating
;; the atom is of type symbol, keyword or string
(cons (getf jsform :vl)
(getf jsform :ty))
(getf jsform :ty))
(getf jsform :ix)))
(values jsform meta)))
(defun display-format-predicate (data)
"This function tests whether a form is a piece of data encoded for frontend display. Currently, this is done by checking for the presence of a :ty property."
(flet ((atom-form-test (datum)
(if (keywordp (first datum))
(let ((type-property (getf datum :ty)))
(and type-property (listp type-property))))))
(if (listp (first data))
(if (listp (caar data))
(atom-form-test (caar data))
(atom-form-test (first data))))))
(defun downcase-jsform (list &optional output)
"Prepare a data structure for expression as JSON, preserving semantics including keywords and symbols."
(if (and list (first list))
(if (listp (first list))
(mapcar #'downcase-jsform list)
(if (keywordp (first list))
(downcase-jsform (cddr list)
(cons (intern (string-downcase (first list))
"KEYWORD")
(cons (second list)
output)))
list))
output))
;; (defun preprocess-pair (prop value)
;; (cond ((or (eq :default prop)
;; (eq :data prop)
;; (eq :format prop)
;; (eq :value prop))
;; (downcase-jsform (encode-expr value)))
;; ((eq t value)
;; t)
;; ;; TODO: figure better heuristic for handling
;; ;; nil/empty array conversion between Lisp and JSON
;; ((null value)
;; "_nil")
;; ((symbolp value)
;; (concatenate 'string (if (keywordp value)
;; "__" "_")
;; (lisp->camel-case value)))
;; ((listp value)
;; (preprocess-structure value))
;; (t value)))
(defun preprocess-structure (list &optional output)
"Prepare a data structure for expression as JSON, preserving semantics including keywords and symbols."
(if (and list (first list))
(if (listp (first list))
(mapcar #'preprocess-structure list)
(if (keywordp (first list))
(preprocess-structure (cddr list)
(append (list (intern (lisp->camel-case (first list))
"KEYWORD")
(cond ((or (eq :default (first list))
(eq :data (first list))
(eq :format (first list))
(eq :model (first list))
(eq :value (first list)))
(downcase-jsform (encode-expr (second list))))
((eq t (second list))
t)
;; TODO: figure better heuristic for handling
;; nil/empty array conversion between Lisp and JSON
((null (second list))
nil)
((symbolp (second list))
(concatenate 'string
(if (keywordp (second list))
"__" "_")
(lisp->camel-case (second list))))
((listp (second list))
(preprocess-structure (second list)))
(t (second list))))
output))
list))
output))
(defun symbol-jstring-process (symbol-string)
(if (and (not (symbolp symbol-string))
(char= #\_ (aref symbol-string 0)))
(if (char= #\_ (aref symbol-string 1))
(intern (string-upcase (camel-case->lisp-symbol (subseq symbol-string 2)))
"KEYWORD")
(intern (string-upcase (camel-case->lisp-symbol (subseq symbol-string 1)))))
symbol-string))
(defun postprocess-structure (list &optional output)
"Prepare a data structure converted back from JSON, translating leading underscore strings back to symbols and more."
(if (and list (first list))
(if (listp (first list))
(mapcar #'postprocess-structure list)
(if (keywordp (first list))
(postprocess-structure (cddr list)
(append (list (first list)
(cond ((or (eq :default (first list))
(eq :data (first list))
(eq :format (first list))
(eq :model (first list))
(eq :value (first list)))
;; if the decoded expression is just an atom,
;; pull it out of the list it comes in,
;; otherwise pass the decoded expression back
(let ((decoded (decode-expr (second list))))
(if (and (= 1 (length decoded))
(atom (first decoded)))
(first decoded)
decoded)))
((and (stringp (second list))
(< 0 (length (second list)))
(char= #\_ (aref (second list) 0)))
;; convert keywords and symbols according to
;; the leading underscores
;; (if (char= #\_ (aref (second list) 1))
;; (intern (string-upcase (camel-case->lisp-symbol
;; (subseq (second list) 2)))
;; "KEYWORD")
;; (intern (string-upcase (camel-case->lisp-symbol
;; (subseq (second list) 1)))))
(symbol-jstring-process (second list)))
((listp (second list))
(postprocess-structure (second list)))
(t (second list))))
output))
list))
output))
(defmacro glyphs (&rest media)
"Top-level wrapper for nested glyph specifications, whose function is simply to make the property list produced by the spec functions into the argument to the assignGlyphs macro."
(cons 'assign-glyphs (macroexpand (labels ((nest (media-list &optional output)
(if media-list
(nest (rest media-list)
(cons (first media-list)
output))
output)))
(nest media)))))
(defmacro specify-glyphs (name &rest params)
"Define (part of) the set of glyphs to represent Lisp symbols and datatypes."
(let ((spec (gensym)) (join-plists (gensym)) (new (gensym)) (existing (gensym)))
`(defmacro ,name (&optional ,spec)
(labels ((,join-plists (,new ,existing)
(if ,new
(progn (if (eq :default (first ,new))
(setf (getf ,existing (first ,new))
(second ,new))
(setf (getf ,existing (first ,new))
(append (second ,new)
(getf ,existing (first ,new)))))
(,join-plists (cddr ,new)
,existing))
,existing)))
(if ,spec
(,join-plists (quote ,params)
(macroexpand ,spec))
(quote ,params))))))
(defmacro assign-glyphs (&rest categories)
"Build the function used to assign glyphs to atoms by matching the atoms with specified heuristics."
(labels ((process (segments &optional points seg-out points-out inverted-offset inverted-endpoint)
(if (or segments points)
(if points
(let ((point (first points)) (ratios (list 4/3 1)) (resolution 16))
(if (third point) ;; if an inverted segment begins here
(process segments (rest points) seg-out points-out (first point) (rest point))
(if point
(process segments (rest points) seg-out
(append points-out
(list (funcall (lambda (pt)
(mapcar #'*
(if inverted-offset (list 1 1) ratios)
pt))
(if inverted-offset
(list (+ inverted-offset (second point))
(+ (* (first ratios)
(first point))
(- resolution
(second inverted-endpoint)
inverted-offset)))
(list (first point)
(- resolution (second point)))))))
inverted-offset inverted-endpoint)
(process segments (rest points) ;; if point is nil, end inverted segment
seg-out
(append points-out
(if inverted-offset
(list (list (+ inverted-offset (first inverted-endpoint))
(- (- resolution (second inverted-endpoint))
inverted-offset))
(list (first inverted-endpoint)
(- resolution (second inverted-endpoint))))))))))
(process (rest segments) (first segments)
(append seg-out (if points-out (list points-out)))
nil inverted-offset inverted-endpoint))
(append seg-out (if points-out (list points-out))))))
(let ((type-list (gensym)) (head (gensym)))
`(defun glyph-find (,type-list)
(let ((,head (first ,type-list)))
(cond ,@(mapcar (lambda (entry)
(list (if (stringp (first entry))
`(equal ,head ,(first entry))
(first entry))
(cons 'quote (list (process (second entry))))))
(getf categories :type-is))
(,type-list (glyph-find (rest ,type-list)))
(t (quote ,(process (getf categories :default))))))))))
(defun plot-glyph (type-list)
"Plot the points of a glyph."
(labels ((place-points (points &optional placed)
(let ((point (first points)))
(if (not point)
placed
(place-points (rest points) ;; TODO; is this still needed?
(append placed (list (list (first point)
(second point))))))))
(format-set (glyph-lines)
(mapcar (lambda (line) (place-points line))
glyph-lines)))
(format-set (if (fboundp 'glyph-find)
(glyph-find type-list)))))
(defun add-array-glyph (glyph-array type-list index)
"Add a glyph to the array of glyphs to index."
(if (<= (first (array-dimensions glyph-array))
(1+ index))
(setf glyph-array (adjust-array glyph-array
(list (1+ index))
:initial-element nil)))
(setf (aref glyph-array index)
(plot-glyph type-list))
glyph-array)
(defmacro modes (&rest params)
(let ((atom (rest (assoc :atom params)))
(form (rest (assoc :form params)))
(meta (rest (assoc :meta params))))
`(progn ,@(if atom (macroexpand (cons 'set-atom-modes
(loop :for spec :in atom :append (macroexpand (list spec))))))
,@(if form (macroexpand (cons 'set-form-modes
(loop :for spec :in form :append (macroexpand (list spec))))))
,@(if meta (macroexpand (cons 'set-meta-modes
(loop :for spec :in meta :append (macroexpand (list spec)))))))))
(defmacro specify-atom-modes (name &rest params)
"Define (part of) an atom mode specification to determine the behavior of seed.modulate."
`(defmacro ,name ()
`(,@',params)))
(defmacro specify-form-modes (name &rest params)
"Define (part of) a form mode specification to determine the behavior of seed.modulate."
`(defmacro ,name ()
`(,@',params)))
(defmacro specify-meta-modes (name &rest params)
"Define (part of) a meta mode specification to determine the behavior of seed.modulate."
`(defmacro ,name ()
`(,@',params)))
(defmacro set-atom-modes (&rest entries)
"Define encoding and decoding processes for individual atoms, according to their type and other qualities."
(list `(defun encode-atom (item meta)
(cond ((eq item :seed-constant-blank) ;; handle the blank symbol
(list :vl "" :ty (list "symbol")))
,@(mapcar (lambda (entry)
`((typep item (quote ,(getf (getf entry :predicate) :type-is)))
(let ((properties nil))
,(if (getf entry :process)
(getf entry :process))
(append (if properties (list :pr properties))
(list :vl ,(getf entry :view)
,@(if (getf entry :display)
(list :ti (getf entry :display)))
:ty (mapcar (lambda (item)
(if (symbolp item)
(string-downcase item)
item))
(cons (quote ,(getf (getf entry :predicate) :type-is))
,(getf entry :type-extension))))))))
entries)))
`(defun decode-atom (item)
(flet ((process (atom) atom))
(let ((type (getf item :ty))
(value (getf item :vl))
(macros (getf item :am)))
;; (print (list :val value type))
(cond ,@(append '(((not type) item))
(loop :for entry :in entries :append
(cond ((eq :type-is (first (getf entry :predicate)))
`(((string= (first type)
,(string-downcase (getf (getf entry :predicate)
:type-is)))
,(getf entry :eval))))
((eq :enclosed-by (first (getf entry :predicate)))
(let ((symbols (getf (getf entry :predicate) :enclosed-by)))
(mapcar (lambda (symbol)
`((string= (first macros)
,(string-downcase symbol))
(let ((new-item item))
(setf (getf new-item :am)
(rest (getf new-item :am)))
,@(if (getf entry :decode)
(getf entry :decode)
`((list (quote ,symbol)
(decode-atom new-item)))))))
symbols)))))
'((t (progn (setf (getf item :ty) (rest type))
(decode-atom item)))))))))))
(defmacro set-form-modes (&rest entries)
"Define encoding and decoding methods for forms based on given heuristics. For example, certain macros, such as the quasiquote macros, may be encoded and decoded in unique ways."
(let ((form-process (gensym)) (atom-process (gensym)) (meta (gensym))
(output (gensym)) (macros (gensym)) (macro (gensym)))
(list `(defun encode-form (form ,form-process ,atom-process ,meta ,output)
(setf (of-properties :length ,meta) ;; get length of all forms to assign
(1- (length form)))
(cond ,@(append
(loop :for entry :in entries :append
(append (cond ((eq :enclosed-by (first (getf entry :predicate)))
(let ((symbols (getf (getf entry :predicate) :enclosed-by)))
(mapcar (lambda (symbol)
`((and (symbolp (first form))
(string= (string-downcase (first form))
,(string-downcase symbol)))
;;(print (list :mim form))
(multiple-value-bind (result-output result-meta)
;;(print (list :rro result-output))
(let ((to-process ,(if (getf entry :to-process)
(getf entry :to-process)
`(second form))))
(if (and to-process (listp to-process))
(encode-form to-process ,form-process
,atom-process ,meta ,output)
(funcall ,atom-process to-process ,meta)))
,@(if (getf entry :encode)
(getf entry :encode)
`((if (keywordp (first result-output))
(setf (getf result-output :am)
(cons ,(string-downcase symbol)
(getf result-output :am)))
(setf (getf (first result-output) :fm)
(cons ,(string-downcase symbol)
(getf (first result-output)
:fm))))))
(values result-output result-meta))))
symbols))))))
`((t (funcall ,form-process form ,meta))))))
`(defun decode-form (form ,macros original-form)
(let ((,macro (first ,macros)))
(if (not ,macros)
form
(decode-form
(cond ,@(append
(loop :for entry :in entries :append
(append (cond ((eq :enclosed-by (first (getf entry :predicate)))
(let ((symbols (getf (getf entry :predicate) :enclosed-by)))
(mapcar (lambda (symbol)
`((string= ,macro ,(string-downcase symbol))
,@(if (getf entry :decode)
(getf entry :decode)
`((list (intern (string-upcase ,macro))
form)))))
symbols))))))
'((t form))))
(rest ,macros)
original-form)))))))
(defmacro set-meta-modes (&rest entries)
(let ((form (gensym)) (format (gensym)) (formats (gensym)))
`((let ((,formats (make-hash-table :test #'eq)))
(setf ,@(loop :for entry :in entries :append
`((gethash ,(first entry) ,formats)
,(second entry))))
(defun meta-format (,form ,format)
(funcall (gethash ,form ,formats)
,format))))))
;; (defun decode-array (form dims &optional point output callback)
;; (let ((point (if point point (list 0)))
;; (output (if output output (make-array dims :initial-element nil))))
;; (flet ((to-next () (decode-array (rest form) dims
;; (append (butlast point)
;; (mapcar #'1+ (last point)))
;; output callback)))
;; (if (> (nth (1- (length point)) dims)
;; (first (last point)))
;; (if (= (length dims)
;; (length point))
;; (progn (setf (apply #'aref (cons output point))
;; (first (decode-expr (list (first form)))))
;; (to-next))
;; (decode-array (first form) dims
;; (append point (list 0))
;; output #'to-next))
;; (if callback (funcall callback)
;; output)))))
| 26,585
|
Common Lisp
|
.lisp
| 626
| 35.408946
| 181
| 0.609439
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
922f6f724eb8a6ca7cff8442a047cb4088894ab01da0f4de9c11bcbe038e14b3
| 2,679
|
[
-1
] |
2,680
|
document.base.lisp
|
phantomics_seed/seed.ui-spec.stage-controls.document.base/document.base.lisp
|
;;;; seed.ui-spec.stage-controls.document.base.lisp
(in-package #:seed.ui-spec.stage.base)
(defmacro stage-controls-document-base (meta-symbol spec-symbol params-symbol output-symbol)
(declare (ignorable spec-symbol))
`(((eq :doc-mark-bold (first ,params-symbol))
(cons `(,',meta-symbol :bold :mode (:interaction :doc-mark-bold))
,output-symbol))
((eq :doc-mark-italic (first ,params-symbol))
(cons `(,',meta-symbol :italic :mode (:interaction :doc-mark-italic))
,output-symbol))
((eq :doc-node-pgraph (first ,params-symbol))
(cons `(,',meta-symbol :paragraph :mode (:interaction :doc-node-pgraph))
,output-symbol))
((eq :doc-node-quote (first ,params-symbol))
(cons `(,',meta-symbol :quote :mode (:interaction :doc-node-quote))
,output-symbol))
((eq :doc-node-points (first ,params-symbol))
(cons `(,',meta-symbol :points :mode (:interaction :doc-node-points))
,output-symbol))
((eq :doc-node-count (first ,params-symbol))
(cons `(,',meta-symbol :count :mode (:interaction :doc-node-count))
,output-symbol))))
| 1,091
|
Common Lisp
|
.lisp
| 22
| 44.954545
| 92
| 0.668229
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
34bda31c4a420cf181b5640d9eaf342237cca49798d721ed66cb73fcd0f6fd2f
| 2,680
|
[
-1
] |
2,681
|
styles.lisp
|
phantomics_seed/portal.demo1/styles.lisp
|
(in-package #:my-portal)
(defvar css-string nil)
(setq css-string
(concatenate 'string
"/* Portal styles */"
(lass:compile-and-write
'(|#main|
(.container
:background "#fff"
(.portal-column
:padding-right 8px
:padding-left 8px))
(.portal
(.overview
:position absolute
:top 0
:left 0
:height 100%
:width 16em
:background "#ddd")
(.view
(.main
:padding 0 0 0 16em
(.status
:margin 0 0 6px
:padding 4px 14px
:width 100%
:background "#eee"
(span
:font-size 14px
:font-weight bold))
(.branches
(.container
:max-width 100%)
(div.pane
:background "#fdf6e3"
:margin 0 0 0 1px
:padding-left 6px
:padding-right 6px
:height 100%
(td
:background transparent
:padding 0 0 0 9px)
(td.form-heading
:border none
:border-bottom 1px solid "#eee8d5")
(td.form-value
:border none
:border-bottom 1px solid "#eee8d5")
(.handsontable
((:and tr :first-child)
((:or th td)
:border-top none))
((:or
(:and th :first-child)
(:and th :first-of-type))
:border-left none)))
(svg.dendroglyphs
:position absolute
:top 0
:left 15px
:height 100%
:width 100%
:pointer-events none
(path
:fill none
:stroke "#93a1a1"
:stroke-width 2.5)))))))
'(.form-value.type-form
:color "#073642"
:font-family monospace
:font-weight bold)
'(.form-value.type-name
:color "#888"
:font-family monospace
:font-weight bold)
'(.form-value.type-string
:color "#0000cd"
:font-family monospace
:font-weight bold)
'((:and .form-value.type-string :before)
:content "\"\\\"\""
:padding-right 0.3em)
'(.form-value.type-keyword
:color "#008800"
:font-family monospace
:font-weight bold)
'((:and .form-value.type-keyword :before)
:content "\":\""
:padding-right 0.3em))))
;.handsontable th:first-child, .handsontable td:first-of-type, .handsontable .htNoFrame + th, .handsontable .htNoFrame + td {
; border-left: none;
;}
| 2,236
|
Common Lisp
|
.lisp
| 93
| 17.903226
| 125
| 0.584201
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
cbe068bb95e1286c5626d54c97d107807de84eee6b0302b4ece31823c57a530a
| 2,681
|
[
-1
] |
2,682
|
package.lisp
|
phantomics_seed/portal.demo1/package.lisp
|
;;;; package.lisp
(defpackage #:portal.demo1
(:export #:grow)
(:use #:common-lisp #:seed.generate #:seed.modulate
#:seed.express.glyphs.base #:seed.ui-model.stage
#:seed.ui-model.keys #:seed.ui-model.html
#:seed.ui-model.css #:seed.ui-model.react
#:seed.ui-spec.html.base #:seed.ui-spec.color.base ;; #:seed.ui-spec.react.base
#:seed.ui-spec.keys.base #:seed.ui-spec.keys.map-apl
#:seed.ui-spec.stage.base #:seed.ui-spec.stage-menu.base
#:seed.ui-spec.html-css.glyph-set-mdi
#:seed.foreign.browser-spec.script.base
#:seed.foreign.browser-spec.ss.form-dygraphs
#:seed.foreign.browser-spec.style.base
#:seed.foreign.browser-spec.style.icons-m-design #:seed.app-model.site.base
#:quickproject #:prove #:parenscript #:panic))
| 746
|
Common Lisp
|
.lisp
| 16
| 44.125
| 80
| 0.728395
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
642f78d4d40d793a386ce38fdc4819939de50951710d7254c3e8c639f3da2319
| 2,682
|
[
-1
] |
2,683
|
portal.lisp
|
phantomics_seed/portal.demo1/portal.lisp
|
;;;; portal.lisp
(in-package #:portal.demo1)
(defvar *portal*)
(modes (:atom modes-atom-base)
(:form modes-form-base)
(:meta modes-meta-common))
(media media-spec-base media-spec-chart-base media-spec-graph-garden-path)
(glyphs glyphs-base)
(test-core-systems)
(browser-interface (:markup (html-index-header "Seed: Demo Portal")
(html-index-body))
(:script (key-ui keystroke-maps key-ui-base
key-ui-map-apl-meta-specialized)
(react-ui (with (:url "portal")
(:component :-portal)
(:glyph-sets material-design-glyph-set-common))
(react-portal-core (component-set interface-units interface-units)
(component-set view-modes
form-view-mode
text-view-mode
(html-view-mode :script-effects
standard-form-effects)
document-view-mode
sheet-view-mode
block-space-view-mode
dygraph-chart-view-mode
(graph-shape-view-mode
:effects standard-vector-effects)))))
(:style (css-styles (with (:palettes (:standard palette-hicontrast-solarized)
(:adjunct palette-medcontrast-adjunct)
(:backdrop palette-medcontrast-dropcloth)))
css-base css-overview css-adjunct css-column-view
(css-form-view (with (:palette-contexts :holder)))
(css-form-view-interface-elements (with (:palette-contexts :element)))
css-text-view css-ivector-standard css-font-spec-ddin
(css-glyph-display (with (:palette-contexts :element)))
css-symbol-style-camel-case)
css-animation-silicon-sky)
(:foundation (:scripts foundational-browser-script-base
foundational-browser-script-dygraphs)
(:styles foundational-browser-style-base
foundational-browser-style-material-design-icons
foundational-browser-style-dygraphs)))
(portal)
(stage (simple-stage :branches
(simple-branch-layout :menu (stage-extension-menu-base)
:controls (stage-control-set :by-spec (stage-controls-base-contextual)
:by-parameters
(stage-controls-graph-base
stage-controls-document-base
stage-controls-chart-base)))
:sub-nav (simple-sub-navigation-layout :omit (:stage :clipboard :history))))
| 2,277
|
Common Lisp
|
.lisp
| 52
| 35.788462
| 83
| 0.670578
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
20e36ebe69cab1d1a9629ce0349b472f86c545d4b11fe0c850e805478220cff7
| 2,683
|
[
-1
] |
2,684
|
test-core-systems.lisp
|
phantomics_seed/portal.demo1/test-core-systems.lisp
|
;;;; test-core-systems.lisp
(in-package #:portal.demo1)
;; tests of the seed.generate and seed.modulate systems are run in the portal,
;; because these systems are extended as part of the portal's build process.
(defvar test-sprout)
(defmacro test-core-systems ()
`(progn
(princ (format nil "~%Tests for seed.generate:~%"))
(portal.demo1::sprout
:test-system :system (:description "This is a test system." :author "Somebody" :license "GPL-3.0")
:meta (:symbol test-sprout)
:package ((:use :common-lisp) (:export))
:branches ((branch1 (in (set-time)
(if-condition (is-display-format) (:then (codec)))
(fork-to :history) (put-image))
(out (set-type :form)
(if-condition (is-image :not)
(:then (put-image (get-file :-self)) (code-package)
(set-time) (fork-to :history) (put-image) (codec)))
(set-data (get-image)) (codec)))
(branch2 (out (set-type :html-element :svg)
(if-condition (is-image :not)
(:then (get-value :svg-content)))))))
(princ (format nil "~% Fetching basic system data:~%"))
(is (seed.generate::sprout-name test-sprout)
:test-system)
(is (seed.generate::sprout-system test-sprout)
'(:description "This is a test system." :author "Somebody" :license "GPL-3.0"))
(princ (format nil "~% Describing systems:~%"))
(is (write-to-string (seed.generate::describe-as-package test-sprout))
(write-to-string '(defpackage #:test-system (:use :common-lisp) (:export))))
(is (write-to-string (seed.generate::describe-as-asdf-system test-sprout))
(write-to-string '(asdf/defsystem:defsystem #:test-system
(:description "This is a test system." :author "Somebody" :license "GPL-3.0"
:components nil))))
(let ((branches (seed.generate::sprout-branches test-sprout)))
(princ (format nil "~% System branch data:~%"))
(is (seed.generate::branch-name (first branches)) :branch1)
(is (seed.generate::branch-name (second branches)) :branch2)
(ok (getf (seed.generate::branch-meta (first branches)) :stable))
(is (seed.generate::branch-spec (second branches))
'(branch2 (out (set-type :html-element :svg)
(if-condition (is-image :not)
(:then (get-value :svg-content)))))))
(princ (format nil "~%Tests for seed.modulate:~%"))
(princ (format nil "~% Encode and decode:~%"))
(let ((test-list '((+ 1 2) (* 3 4)))
(encoded (seed.modulate::atom-to-jsform 'a nil)))
(is test-list (seed.modulate::decode-expr (seed.modulate::encode-expr test-list)))
(is encoded '(:vl "a" :ti (("a")) :ty ("symbol") :ix 1))
(princ (format nil "~% Format predicate:~%"))
(ok (seed.modulate::display-format-predicate (list encoded)))
;; atom must be within a list to pass the displayFormatPredicate
(princ (format nil "~% Structural transformation:~%"))
(is (seed.modulate::downcase-jsform encoded)
'(:|ix| 1 :|ty| ("symbol") :|ti| (("a")) :|vl| "a"))
(is (seed.modulate::preprocess-structure '(:ab-cd 1 :ef "test" :gh :ij :k l))
'(:|k| "_l" :|gh| "__ij" :|ef| "test" :|abCd| 1)))
(princ #\Newline)))
| 3,216
|
Common Lisp
|
.lisp
| 59
| 47.644068
| 104
| 0.620855
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
d8c97883fcc7ed924f1e82b3ff224ac5a93d3f7e1b86d3f5df9ecfc633f11aea
| 2,684
|
[
-1
] |
2,685
|
systems.lisp
|
phantomics_seed/portal.demo1/systems.lisp
|
(META
((META :PORTAL.DEMO1 :MODE (:VIEW :PORTAL-NAME))
(META "demo-market" :MODE
(:VIEW :SELECT :OPTIONS
((:VALUE "demo-sheet" :TITLE "demoSheet")
(:VALUE "demo-graph" :TITLE "demoGraph")
(:VALUE "demo-image" :TITLE "demoImage")
(:VALUE "demo-drawing" :TITLE "demoDrawing")
(:VALUE "demo-market" :TITLE "demoMarket"))))
(META
((META :MAIN :MODE (:TARGET :MAIN :VIEW :BRANCH-SELECTOR))
(META :IMAGE :MODE (:TARGET :IMAGE :VIEW :BRANCH-SELECTOR)))
:EACH (:MODE (:INTERACTION :SELECT-BRANCH)) :MODE
(:VALUE NIL :MODEL
((META :MAIN :MODE (:TARGET :MAIN :VIEW :BRANCH-SELECTOR))
(META :IMAGE :MODE (:TARGET :IMAGE :VIEW :BRANCH-SELECTOR)))
:SETS (2) :INDEX 0 :VIEW :SYSTEM-BRANCH-LIST)))
:MODE
(:VALUE NIL :MODEL
((META :PORTAL.DEMO1 :MODE (:VIEW :PORTAL-NAME))
(META "demo-market" :MODE
(:VIEW :SELECT :OPTIONS
((:VALUE "demo-sheet" :TITLE "demoSheet")
(:VALUE "demo-graph" :TITLE "demoGraph")
(:VALUE "demo-image" :TITLE "demoImage")
(:VALUE "demo-drawing" :TITLE "demoDrawing")
(:VALUE "demo-market" :TITLE "demoMarket"))))
(META
((META :MAIN :MODE (:TARGET :MAIN :VIEW :BRANCH-SELECTOR))
(META :IMAGE :MODE (:TARGET :IMAGE :VIEW :BRANCH-SELECTOR)))
:EACH (:MODE (:INTERACTION :SELECT-BRANCH)) :MODE
(:VALUE NIL :MODEL
((META :MAIN :MODE (:TARGET :MAIN :VIEW :BRANCH-SELECTOR))
(META :IMAGE :MODE (:TARGET :IMAGE :VIEW :BRANCH-SELECTOR)))
:SETS (2) :INDEX 0 :VIEW :SYSTEM-BRANCH-LIST)))
:ENCLOSE :ENCLOSE-OVERVIEW :FILL :FILL-OVERVIEW :NAME :PORTAL-SPECS :LAYOUT
:COLUMN :BREADTH :SHORT :VIEW :VISTA))
| 1,638
|
Common Lisp
|
.lisp
| 37
| 39.540541
| 77
| 0.642723
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
2316c440d1c5d33bc95b7a53d98102e783fc938d8b33937b7f074ec011345124
| 2,685
|
[
-1
] |
2,686
|
unit.base.lisp
|
phantomics_seed/seed.ui-spec.unit.base/unit.base.lisp
|
;;;; seed.ui-spec.unit.base.lisp
(in-package #:seed.ui-model.react)
(specify-components
interface-units
(cell-standard
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props)
(funcall inherit this props
(lambda (d) (@ d data))
(lambda (pd) (@ pd data content vl))))
:display-switch
(lambda () (chain self (set-state (create open (not (@ self state open))))))
:component-will-receive-props
(lambda (next-props)
(defvar self this)
(if (/= "set" (@ next-props context mode))
(chain this (set-state (chain this (initialize next-props)))))))
(setq self this)
(let* ((content (@ this state data content))
(content-meta (@ this props data meta))
(editor-active (and (@ content-meta is-parent-point)
(@ content-meta is-point)
(= "set" (@ this props context mode))
(or (not (@ this props context focus))
(= 0 (@ this props context focus meta))))))
(panic:jsl (:div :class-name
(funcall (lambda (state)
(+ "content"
(if (@ state open) " focus" "")
(funcall (lambda ()
(defvar name "")
(loop for tix from 0 to (1- (@ content ty length))
do (setq name (+ name " type-" (getprop (@ content ty) tix))))
name))))
(@ this state))
(if editor-active
(funcall (lambda (self)
(panic:jsl (:div :class-name "editor"
(:input :class-name "data"
:value (@ content vl)
:on-change
(lambda (event)
;; assign both the local and parent state
(let ((new-val (create vl (@ event target value))))
(extend-state :deep data
(create content new-val))
(chain self props context methods
(set-delta new-val))))))))
this)
(panic:jsl (:span :class-name (if (@ content ti) "title" "text")
:ref "target"
(if (@ content ti)
(panic:jsl (:-seed-symbol :symbol (@ content ti)))
(@ content vl))
;; (if (and (@ content pr)
;; (@ content pr pkg)
;; (/= "common-lisp" (@ self props data content pr pkg))
;; (or (not (@ content-meta breadth))
;; (= 1 (@ content-meta breadth))))
;; (panic:jsl (:sup (:-overlay-trigger
;; :placement "right"
;; ;; :overlay (panic:jsl
;; ;; (:-tooltip
;; ;; :id "package-info"
;; ;; (:span "package: ")
;; ;; (:-seed-symbol
;; ;; :symbol (@ self props data content
;; ;; pr pkd))))
;; (:span :class-name
;; (+ "package-tag mini"
;; (if (and (@ self props data content pr)
;; (= (@ self props data
;; content pr pkg)
;; (@ self props context
;; working-system)))
;; " native" ""))
;; (:span :class-name "regular"
;; (@ content pr pkd 0 0 0))
;; (:span :class-name "native"
;; "‚óè"))))))
)))
(:div :class-name "breaker")
(if (@ self props context is-point)
(panic:jsl
(:div (if (@ self props context menu-content)
(let ((rendered-menu
(subcomponent (@ view-modes form-view)
(create
id "menu"
data (@ self props context menu-content))
:context (inert
t
on-trace t
branch (@ self props context branch)
view-scope "short"))))
(panic:jsl (:-overlay :show t
:target (@ this refs target)
:container self
:placement "right"
(:-popover
:class-name "menu-popover form-view"
rendered-menu))))))))
;; (if (and (@ content pr)
;; (@ content pr pkg)
;; (not editor-active)
;; (@ content-meta breadth)
;; (< 1 (@ content-meta breadth)))
;; (panic:jsl (:-overlay-trigger
;; :placement "right"
;; ;; :overlay (panic:jsl (:-tooltip
;; ;; :id "package-name-display"
;; ;; (:span "package: ")
;; ;; (:-seed-symbol :symbol (@ content pr pkd))))
;; (:span :class-name
;; (+ "package-tag"
;; (if (and (@ self props data content pr)
;; (= (@ self props data content pr pkg)
;; (@ self props context working-system)))
;; " native" ""))
;; (:span (:-seed-symbol
;; :symbol (@ content pr pkd)
;; :common (and (@ self props data content pr)
;; (= "common-lisp"
;; (@ self props data content pr pkg)))
;; :native (and (@ self props data content pr)
;; (= (@ self props data content pr pkg)
;; (@ self props context
;; working-system)))))))))
(if (and (@ content mt)
(or (@ content mt comment) (= "" (@ content mt comment))))
(funcall (lambda (self)
(panic:jsl (:-autosize-input
:class-name (+ "meta-comment"
(if (= 1 (@ self props context focus meta))
" focus" ""))
:disabled (/= 1 (@ self props context focus meta))
:value (@ content mt comment)
:on-change
(lambda (event)
(let ((new-val
(create mt (create comment
(@ event target value)))))
;;(extend-state :deep data (create content new-val))
(chain j-query (extend t (@ self state data content)
new-val))
(chain self props context methods
(set-delta new-val)))))))
this))))))
(cell-spreadsheet
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props)
(let ((self this))
(funcall inherit this props
(lambda (d) (chain j-query (extend (create input-value
(if (@ d data content data-inp)
(@ d data content data-inp)
"")
type (@ d data content type))
(@ d data))))
(lambda (pd) (if (@ pd data content data-com)
(@ pd data content data-com 0)
(@ pd data content data-inp))))))
:display-switch
(lambda () (chain self (set-state (create open (not (@ self state open))))))
:component-will-receive-props
(lambda (next-props) (chain this (initialize next-props))))
(defvar self this)
(panic:jsl (:div :class-name
(+ "content type-"
(if (/= "undefined" (typeof (@ self props data content type)))
(chain self props data content type (substr 2))
;; remove the first two characters; since this is a converted
;; keyword, they will always be "__"
"null")
(if (@ self props data content data-com)
(+ " it-" (@ self props data content data-com length))
"")
(if (@ self props data meta is-point) " point" "")
(if (@ self props data content data-inp)
(if (@ self props data content data-com)
" computed-input" " input")
""))
(if (and (@ self props data meta is-point)
(@ self props data meta is-parent-point)
(= "set" (@ self props context mode))) ;; TODO: IS THIS THE CORRECT MODE VAR?
(panic:jsl (:div :class-name "editor"
(:input :class-name "data"
:value (@ self state data input-value)
:on-change
(lambda (val)
(chain self props context methods
(set-delta (@ val target value)))
(extend-state data (create input-value (@ val target value))))))))
(:span :class-name "overridden-text"
(@ self props data content data-inp-ovr))
(:span :class-name "text"
(if (and (@ self props data content)
(= "__function" (@ self props data content type)))
(+ "f" (let ((to-append ""))
(loop for x from 0 to (1- (@ self props data content args-count))
do (setq to-append (chain to-append (concat "."))))
to-append))
(if (@ self props data content data-com)
(@ self props data content data-com 0)
(@ self props data content data-inp)))))))
(bar
(:get-initial-state
(lambda ()
(chain this (initialize (@ this props))))
:initialize
(lambda (props)
(funcall inherit this props
(lambda (d) (@ d data))
(lambda (pd) (@ pd data content vl))))
:component-will-receive-props
(lambda (next-props)
(if (/= "set" (@ next-props context mode))
(chain this (set-state (chain this (initialize next-props)))))))
(let ((branch-index (@ this state data content mt branch-index))
(point-offset (@ this state data content mt point-offset))
(is-composite (/= "undefined" (typeof (@ this state data content mt branch-index))))
(sub-point-present (/= "undefined" (typeof (@ this state data content mt point-offset)))))
(panic:jsl (:div
(:div :class-name (+ "bar"
(if is-composite " composite" "")
(if (and sub-point-present (@ this state data content mt))
(if (= 0 point-offset)
" sub-point" "")
""))
:style (create width
(+ (- 100 (if (and is-composite (@ this state data content mt))
;; 1 is added to the branch index to
;; allow for the point indicator to the right
(* 12 (1+ branch-index))
0))
"%")
margin-left
(+ (if (and is-composite (@ this state data content mt))
(* 12 branch-index)
0)
"%"))
(:div))
(if is-composite (panic:jsl (:div :class-name "point-marker" (:div))))))))
(color-picker
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props)
(funcall inherit this props
(lambda (d) (@ d data))
(lambda (pd) (@ pd data content vl))))
:display-switch
(lambda () (chain self (set-state (create open (not (@ self state open))))))
:component-will-receive-props
(lambda (next-props)
(if (/= "set" (@ next-props context mode))
(chain this (set-state (chain this (initialize next-props)))))))
(let ((self this)
(content (@ this state data content))
(content-meta (@ this props data meta)))
(panic:jsl (:div :class-name "content"
(:div :class-name "rgb-holder"
(:-overlay-trigger
:placement "bottom" :trigger "click"
:on-click
(lambda ()
(if (/= (@ content vl)
(@ self state space))
;; TODO: BOTH OF THE BELOW ACTIONS ARE NEEDED
;; TO UPDATE THE VALUE ON THE SERVER AND CLIENT SIDES
(progn (setf (@ content vl) (@ self state space)
(@ content pr) (create "rgb-string" (@ self state space)))
(chain self state context methods (grow))
(chain self props context methods
(set-delta
(create pr (create "rgb-string" (@ self state space))
vl (@ self state space)))))))
:overlay (panic:jsl (:-popover
:id "color-picker-popover" :title "Color Picker"
(:-sketch-color-picker
:color (@ this state space)
:on-change
(lambda (color event)
(chain self (set-state (create space (@ color hex)))))
(:span "Tooltip content."))))
(:div (:div :class-name "rgb-control"
:style (create background
(@ this state space)
margin "2px"))
(:span :class-name "rgb-string"
(chain this state space (substr 1))))))))))
(select
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props)
(funcall inherit this props
(lambda (d) (@ d data))
(lambda (pd) (@ pd data content vl))))
:designate
(lambda (item)
(if (/= (@ item value) (@ this state space))
(progn (setf (@ this state data content vl) (@ item value 0 vl))
(chain this state context methods (grow))
(chain this props context methods (set-delta (create vl (@ item value 0 vl)))))))
:component-will-receive-props
(lambda (next-props)
(if (/= "set" (@ next-props context mode))
(chain this (set-state (chain this (initialize next-props)))))))
(let ((self this))
(panic:jsl (:div :class-name "content"
(:div :class-name "menu-holder"
(:div :class-name "dropdown"
((@ -react-bootstrap -dropdown-button)
;; :title (let* ((values (chain self state data content mt mode options
;; (map (lambda (item) (@ item value 0 vl)))))
;; (current-value (getprop (@ self state data content mt mode options)
;; (chain values
;; (index-of (@ self state space))))))
;; (if (/= "undefined" (typeof current-value))
;; (funcall (lambda (item) (create label (@ item title)
;; value (@ item value)))
;; current-value)))
:title (@ self state data content vl)
:id (+ "select-dropdown-" (@ self state data content ix))
:key (+ "select-dropdown-" (@ self state data content ix))
(chain self state data content mt mode options
(map (lambda (item index)
(panic:jsl ((@ -react-bootstrap -menu-item)
:event-key index
:key index
:on-click
(lambda () (chain self (designate item)))
(@ item title))))))))
;; (:-select :name "form-select"
;; :value (let* ((values (chain self state data content mt mode options
;; (map (lambda (item) (@ item value 0 vl)))))
;; (current-value (getprop (@ self state data content mt mode options)
;; (chain values
;; (index-of (@ self state space))))))
;; (if (/= "undefined" (typeof current-value))
;; (funcall (lambda (item) (create label (@ item title)
;; value (@ item value)))
;; current-value)))
;; :options (chain self state data content mt mode options
;; (map (lambda (item) (create label (@ item title)
;; value (@ item value)))))
;; :on-change (lambda (value)
;; ;;(chain console (log :inter (@ self state) (@ self props) value))
;; (chain self (designate value))))
)))))
(textfield
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props)
;(cl 9090 props)
(funcall inherit this props
(lambda (d) (@ d data))
(lambda (pd) (if (and (@ this state) (@ this state space))
(@ this state space)
nil))))
:component-will-receive-props
(lambda (next-props)
(if (/= "set" (@ next-props context mode))
(chain this (set-state (chain this (initialize next-props)))))))
(let* ((self this)
(content (@ self state data content)))
(panic:jsl (:div :class-name "content"
(:div :class-name "textfield-holder"
(:div :class-name "input-group"
(:div :class-name "input-wrapper form-control"
(:input :class-name "textfield"
:value (@ content vl)
:on-change (lambda (event)
(extend-state
:deep data
(create content
(create vl (@ event target value))))
(chain self props context methods
(set-delta (create vl (@ event target value)))))
:on-focus (lambda (event)
(if (/= "set" (@ self state context mode))
(chain self state context methods
(set-mode "set"))))
:on-blur (lambda (event)
(chain self state context methods (set-mode "move"))
;; (chain self (designate (@ self state space)))
(chain self state context methods (grow)))))
(if (and (@ self props data content pr)
(@ self props data content pr meta)
(@ self props data content pr meta mode)
(@ self props data content pr meta mode title))
(panic:jsl (:span :class-name "input-group-append"
(:span :class-name "label-holder input-group-text"
(@ self props data content
pr meta mode title)))))))))))
;; (textfield
;; (:get-initial-state
;; (lambda () (chain this (initialize (@ this props))))
;; :initialize
;; (lambda (props)
;; (cl 9090 props)
;; (funcall inherit this props
;; (lambda (d) (@ d data))
;; (lambda (pd) (if (and (@ this state) (@ this state space))
;; (@ this state space)
;; nil))))
;; :designate
;; (lambda (item)
;; (setf (@ this state data content vl) item)
;; (chain this state context methods (grow)))
;; :content ""
;; :component-will-receive-props
;; (lambda (next-props)
;; (if (not (= "set" (@ next-props context mode)))
;; (chain this (set-state (chain this (initialize next-props))))))
;; )
;; (let ((self this))
;; (cl :ssl (@ self content))
;; (panic:jsl (:div :class-name "content"
;; (:div :class-name "textfield-holder"
;; (:input :class-name "textfield"
;; :value (if (@ self content)
;; (@ self content)
;; (@ self state data content vl))
;; :on-change (lambda (event)
;; (cl :ee (@ event target))
;; (setf (@ self content)
;; (@ event target value))
;; (chain self (set-state (create space (@ event target value))))
;; )
;; :on-focus (lambda (event)
;; (cl :eve event (@ self state data content vl))
;; (chain self state context methods (set-mode "set"))
;; (chain self (set-state (create space
;; (@ self state data content vl))))
;; (setf (@ self content)
;; (@ self state data content vl)))
;; :on-blur (lambda (event)
;; (chain self state context methods (set-mode "move"))
;; (chain self (designate (@ self state space))))
;; ))))))
(textarea
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props)
(funcall inherit this props
(lambda (d) (@ d data))
(lambda (pd) nil)))
:designate
(lambda (item) (chain this state context methods (grow (create vl item))))
:component-will-receive-props
(lambda (next-props)
(if (/= "set" (@ next-props context mode))
(chain this (set-state (chain this (initialize next-props)))))))
(let ((self this))
(panic:jsl (:div :class-name "content"
(:div :class-name "info-tabs"
(if (@ self state data content mt mode title)
(panic:jsl (:span :class-name "title"
(@ self state data content mt mode title))))
(if (@ self state data content mt mode removable)
(panic:jsl (:span :class-name "remove"
:on-click (lambda (event)
(chain self props context methods
(delete-point
(list
(@ self state data content ly)
(@ self state data content ct)))))
"X"))))
(:div :class-name "textarea-holder"
(:-autosize-textarea
:class-name "textarea"
:value (if (@ self state space)
(@ self state space)
(@ self state data content vl))
:on-change (lambda (event)
(chain self (set-state (create space (@ event target value)))))
:on-focus (lambda (event)
(chain self state context methods (set-mode "set"))
(chain self (set-state (create space (@ event target value))))
(chain self state context methods
(set-point (@ self state data content))))
:on-blur (lambda (event)
(chain self state context methods (set-mode "move"))
(chain self (designate (@ self state space))))))))))
(item
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props) (funcall inherit this props
(lambda (d) (@ d data))
(lambda (pd) nil)))
:designate
(lambda (item)
(chain this state data params (md (lambda (data)
(chain data (push (@ item value)))
data)))
(chain this state context methods (grow)))
:option-actions
(lambda ()
(let ((self this))
(create toggle-visibility
(lambda (item)
(let ((changed false))
(if (and (@ self state data data mt)
(@ self state data data mt each)
(@ self state data data mt each visible-members))
(progn (loop for member in (@ self state data data mt each visible-members)
do (if (= (@ item name) (@ member name))
(setf (@ member state) "__on"
changed true)))
(if changed (chain self state context methods (grow))))))))))
:permute
(lambda (input)
(if (and (@ window -drag-source)
(@ window -drop-target))
(let* ((over-data nil)
(collect-source (lambda (connect monitor)
(create connect-drag-source (chain connect (drag-source))
connect-drag-preview (chain connect (drag-preview))
is-dragging (chain monitor (is-dragging)))))
(collect-target (lambda (connect) (create connect-drop-target (chain connect (drop-target)))))
(item-source (create begin-drag (lambda (props) (create id (@ props data data ix)
ly (@ props data data ly)
ct (@ props data data ct)
original-index (@ props data data ct)))
end-drag (lambda (props monitor component)
(if (chain monitor (did-drop))
(let ((item (chain monitor (get-item)))
(drop-result (chain monitor (get-drop-result))))
(chain props context methods (sort (list (@ item ly)
(@ item ct))
over-data)))))))
(item-target (create can-drop (lambda (props) t)
hover (lambda (props monitor) (setq over-data (@ props data data))))))
(funcall (chain window (-drop-target "item" item-target collect-target))
(funcall (chain window (-drag-source "item" item-source collect-source))
input)))))
:component-will-receive-props
(lambda (next-props) (chain this (set-state (chain this (initialize next-props))))))
(let* ((self this)
(this-mode (@ self state data data mt mode))
(handle (if (@ window -drag-source)
(chain self props (connect-drag-source (panic:jsl (:span :class-name "title"
(@ this-mode title)))))
(panic:jsl (:span :class-name "title" (@ this-mode title)))))
(option-actions (chain self (option-actions)))
(option-click (lambda (item) (lambda () (funcall (getprop option-actions (chain item action (substr 2)))
item))))
(content (panic:jsl (:div :class-name "item"
(:div :class-name (+ "item-interface-holder element palette-adjunct navbar"
(if (@ this-mode toggle) " with-toggle" ""))
(if (@ this-mode toggle)
(panic:jsl (:div :class-name "btn-group toggle"
(:button :on-click
(lambda (event)
(setf (@ this-mode toggle)
(if (= "__on" (@ this-mode toggle))
"__off" "__on"))
(chain self state context methods
(grow)))
(if (= "__on" (@ this-mode toggle))
"On" "Off")
(:div :class-name "button-detail")))))
(:div :class-name "main"
(:div :class-name "sortable-glyph"
;;(seed-icon :sortable)
)
handle
(if (@ this-mode options)
(panic:jsl
(:div :class-name "options"
((@ -react-bootstrap -dropdown-button)
:title "Select"
:id (+ "select-dropdown-" (@ self state data data ix))
:key (+ "select-dropdown-" (@ self state data data ix))
(chain this-mode options
(map (lambda (item index)
(panic:jsl ((@ -react-bootstrap
-menu-item)
:event-key index
:key index
:on-click (option-click item)
(@ item title))))))))))
(if (@ this-mode removable)
(panic:jsl
(:span :class-name "remove"
:on-click
(lambda (event)
(chain self props context methods
(delete-point
(list (@ self state data data ly)
(@ self state data data ct)))))
;;(seed-icon :close)
))))
)
(if (@ this-mode open)
(panic:jsl (:div :class-name "content" (@ self state data content))))))))
;; (cl :ss self this-mode)
(chain self props (connect-drag-preview (chain self props (connect-drop-target content))))))
(list
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props) (funcall inherit this props
(lambda (d) (@ d data))
(lambda (pd) nil)))
:designate
(lambda (item)
(chain this state data params (md (lambda (data) (chain data (push (@ item value)))
data)))
(chain this state context methods (grow)))
:component-will-receive-props
(lambda (next-props) (chain this (set-state (chain this (initialize next-props))))))
(let ((self this))
;; (cl :aa (@ self state data))
(panic:jsl (:div :class-name "element palette-adjunct"
(:div :class-name "list-interface-holder"
(:div :class-name "navbar"
(:div :class-name "dropdown"
((@ -react-bootstrap -dropdown-button)
:title "Select"
:id (+ "select-dropdown-" (@ self state data params ix))
:key (+ "select-dropdown-" (@ self state data params ix))
(chain self state data params mt mode options
(map (lambda (item index)
(panic:jsl ((@ -react-bootstrap -menu-item)
:event-key index
:key index
:on-click
(lambda () (chain self (designate item)))
(@ item title))))))))
(:div :class-name "list-info"
(:span :class-name "list-label"
(+ (@ self state data params pr count)
(if (= 1 (@ self state data params pr count))
" item" " items")))
(if (@ self state data params mt mode removable)
(panic:jsl (:span :class-name "remove"
:on-click
(lambda (event)
(chain self props context methods
(delete-point
(list (@ self state data params ly)
(@ self state data params ct)))))
;;(seed-icon :close)
)))))
(@ self state data content)))))))
| 26,484
|
Common Lisp
|
.lisp
| 655
| 32.764885
| 106
| 0.548851
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
016dee0122b33e7f6700553be5b0499c4847181b399706f2bf62c85cea615861
| 2,686
|
[
-1
] |
2,687
|
style.base.lisp
|
phantomics_seed/seed.foreign.browser-spec.style.base/style.base.lisp
|
;;;; style.base.lisp
(in-package #:seed.foreign.browser-spec.style.base)
(defparameter *local-package-name* (package-name *package*))
(defmacro foundational-browser-style-base ()
"Generate the paths for the style source files."
(mapcar (lambda (item) (asdf:system-relative-pathname (intern *local-package-name* "KEYWORD") item))
(list "./node_modules/bootstrap/dist/css/bootstrap.min.css"
;; "./node_modules/react-select/dist/react-select.css"
"./node_modules/codemirror/lib/codemirror.css"
"./node_modules/codemirror/theme/solarized.css")))
| 558
|
Common Lisp
|
.lisp
| 10
| 53.2
| 102
| 0.750459
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
2851db6f3f4148bae1b58ea3501c9928e50475cd5ba5170e4cd778043daf2930
| 2,687
|
[
-1
] |
2,688
|
css-vector.base.lisp
|
phantomics_seed/seed.ui-spec.css-vector.base/css-vector.base.lisp
|
;;;; css-vector.base.lisp
(in-package #:seed.ui-model.css)
(specify-css-styles
css-ivector-standard
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:by-palette (``((.pane (svg (.link :stroke ,base1)
(.icon-title-frame ((:or rect circle) :fill ,base0 :!important))
(.expand-control
(.button-backing :fill ,base3)
(.button-circle :fill ,base0)
(rect :fill ,base3))
(.glyph (.outer-circle :fill ,red)
(.inner-circle :fill ,base3)
(.outer-meta-band :stroke ,blue
:stroke-width 3px)
(.outer-meta-spokes :stroke ,blue
:stroke-width 1.8px))))))
:basic (``((.vector-interface
:height 100%
:width 100%
;; high-level portal styles
(.link :fill none
:stroke-width 1.5px)
(.icon-title-frame :opacity 0)
(.item.point (.icon-title-frame :opacity 0.175))))))
#|
(defmacro css-ivector-standard ()
"Main CSS styles for Seed's interface."
`("/* Portal styles */
@keyframes animatedBackground {
from { background-position: 0 50px; }
to { background-position: 0 0; }}"
(body :overflow hidden
:height 100%
:width 100%
(.breaker :clear both))
(.vector-interface
:height 100%
:width 100%
;; high-level portal styles
(.link
:fill none
:stroke "#ccc"
:stroke-width 1.5px)
(.icon-title-frame
:opacity 0
((:or rect circle)
:fill ;;"#eee8d5"
"#839496"))
(.item.point (.icon-title-frame :opacity 0.175))
(.expand-control
(.button-backing :fill "#fdf6e3")
(.button-circle :fill "#839496")
(rect :fill "#fdf6e3"))
(.glyph
(.outer-circle :fill "#dc322f")
(.inner-circle :fill "#fdf6e3")
(.outer-meta-band :stroke "#268bd2"
:stroke-width 3px)
(.outer-meta-spokes :stroke "#268bd2"
:stroke-width 1.8px)))))
|#
#|
.visualizer-container {
path.link {
fill: none;
stroke: #9ecae1;
stroke-width: 1.5px;
}
path.node-path {
fill: none;
stroke: #9ecae1;
stroke-width: 1.5px;
}
path.link-path {
fill: none;
stroke: #9fe1b3;
stroke-width: 1.5px;
stroke-dasharray: 3, 3;
}
.broken-link text.text {
fill: #aa0000;
}
.meta-dots-holder, .expand-control {
.meta-dots {
stroke-linecap: round;
}
.plain-link-indicators {
stroke: #999;
}
.conditional-link-indicators {
stroke: #7a9863;
}
.broken-link-indicators {
stroke: #c80000;
}
}
.expand-control {
cursor: pointer;
rect {
fill: #fff;
}
.button-backing {
fill: #fff;
}
.button-circle {
fill: #ccc;
}
.plain-link-indicators {
stroke: #999;
}
.conditional-link-indicators {
stroke: #7a9863;
}
}
}
#drag-marker {
cursor: move;
}
.visualizer-container .object-data-fetch, #drag-marker {
.outer-meta-band {
display: relative;
stroke: #c8b7b7;
fill: none;
stroke-width: 3;
stroke-linecap: square;
stroke-linejoin: square;
}
.inner-circle {
fill: #fff;
}
.outer-meta-spokes {
display: relative;
stroke: #c8b7b7;
fill: none;
stroke-width: 2.2;
stroke-linecap: square;
stroke-linejoin: miter;
}
.inner-meta-spokes {
display: relative;
fill: none;
stroke-linecap: butt;
stroke-linejoin: miter;
}
}
/* Tree/network diagram focus and selection styles */
.visualizer-container {
.shift-control {
display: none;
.up-button-alt {
display: none;
}
circle.center-point {
display: none;
}
}
.icon-title-frame {
.text-frame, .text-frame-joiner, .circle-frame {
fill: #e3dedb;
opacity: 0;
}
.interactor {
cursor: pointer;
}
}
.item.selected {
.icon-title-frame {
opacity: 0.5;
}
}
// display drag icon when user hovers over a list level 1 glyph
.item.node .glyph.linkable {
cursor: move;
}
// display shift controls for selected controls on the first level
.item.node.level-1:hover, .item.link:hover {
.shift-control {
display: block;
}
}
.drag-active {
.shift-control {
display: none;
}
.transposable .shift-control {
display: block;
path.arrow {
display: none;
}
circle.center-point {
display: block;
}
}
}
// display shift controls for selected controls on the first level
/*.item.node.selected.level-1, .item.link.selected {
.shift-control {
display: block;
}
}*/
.item.node.level-1.netRoot, .item.link.netRoot {
.shift-control {
display: none;
}
}
// don't display the up shifter buttons for the node after the root node or for the first link in a list
/*.item.link.index-0, .item.node.index-1 {
.shift-control .up-button {
display: none;
}
}*/
/*.item.link.lastItem, .item.node.lastItem {
.shift-control .up-button-alt {
display: block;
}
.shift-control .down-button, .shift-control .up-button {
display: none;
}
}
.item.link.lastItem.index-0, .item.node.lastItem.index-0, .item.link.lastItem.level-1.index-1, .item.node.lastItem.index-1 {
.shift-control .up-button-alt {
display: none;
}
}*/
.item.focus .icon-title-frame {
opacity: 0.25;
.text-frame {
opacity: 1;
}
}
.item.selected .icon-title-frame {
.text-frame, .circle-frame, .text-frame-joiner {
opacity: 1;
}
.text-frame {
x: 12.25;
width: 494;
}
}
.item {
text {
font: 14px sans-serif;
pointer-events: none;
}
.linker-control {
cursor: pointer;
.inner-path {
fill: #c8beb7;
cursor: pointer;
}
.outer-path {
fill: #fff;
fill-opacity:1;
stroke:#ffffff;
stroke-width:3;
stroke-miterlimit:4;
stroke-opacity:1;
stroke-dasharray:none;
}
}
.linker-control:hover .inner-path {
fill: #917c6f;
}
}
}
|#
| 7,122
|
Common Lisp
|
.lisp
| 268
| 17.735075
| 128
| 0.525165
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
ba9dbfe7686887ffb0dda214be31a0fc5c98d327225421b903316b7411e9dd6d
| 2,688
|
[
-1
] |
2,689
|
package.lisp
|
phantomics_seed/seed.ui-spec.stage.base/package.lisp
|
;;;; package.lisp
(defpackage #:seed.ui-spec.stage.base
(:export #:simple-stage #:simple-branch-layout #:simple-sub-navigation-layout)
(:use #:cl #:seed.generate #:symbol-munger))
| 185
|
Common Lisp
|
.lisp
| 4
| 44
| 80
| 0.716667
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
10a787debd2cd9a019c5e86f82308af94cf021a2a89a2a57fbd6255f3f3ea004
| 2,689
|
[
-1
] |
2,690
|
stage.base.lisp
|
phantomics_seed/seed.ui-spec.stage.base/stage.base.lisp
|
;;;; seed.ui-spec.stage.base.lisp
(in-package #:seed.ui-spec.stage.base)
(defmacro simple-stage (portal &key (branches nil) (sub-nav nil))
`(lambda ()
(let ((branch-specs (if (of-sprout-meta ,portal :active-system)
(get-portal-contact-branch-specs ,portal
(intern (string-upcase
(of-sprout-meta ,portal :active-system))
"KEYWORD")))))
`(((meta ((meta ,,(intern (package-name *package*) "KEYWORD")
:mode (:view :portal-name))
,@(if (not branch-specs)
`((meta ,(get-portal-contacts ,portal)
:mode (:view :portal-system-list :index -1)
:each (:mode (:interaction :select-system)))))
,@(if branch-specs
`((meta ,(of-sprout-meta ,portal :active-system)
:mode (:options ,(mapcar (lambda (system-name)
`(:title ,(lisp->camel-case system-name)
:value ,(string-downcase system-name)))
(get-portal-contacts ,portal))
:view :select))))
,@(if branch-specs `((meta ,(funcall ,(macroexpand sub-nav)
(loop for item in
(rest (assoc :primary
(rest (first (find-form-in-spec
'display-params
(first branch-specs))))))
append item))
:mode (:view :system-branch-list :index 0 :sets (2))
:each (:mode (:interaction :select-branch))))))
:mode (:view :vista :breadth :short :layout :column :name :portal-specs
:fill :fill-overview :enclose :enclose-overview)))
(meta ,(if branch-specs (funcall ,(macroexpand branches)
branch-specs))
;; is the transparent property needed here?
:mode (:view :vista :transparent t))))))
(defmacro simple-branch-layout (&rest extend)
"A layout for display of major and adjunct branches within a Seed system."
`(lambda (branch-specs)
(labels ((prospec-branch (spec)
(let* ((name (intern (string-upcase (first spec)) "KEYWORD"))
(param-checks (mapcar #'cadr (find-form-in-spec 'is-param spec)))
(stage-params (cdar (find-form-in-spec 'stage-params spec)))
(primary-controls (getf stage-params :primary-controls))
(secondary-controls (append (or (find :save param-checks) (find :revert param-checks)))))
`(meta ,(append (if primary-controls (list :top-controls))
(list :body)
(if secondary-controls (list :sub-controls)))
:mode (:view :vista :ct 0 :fill :fill-branch :branch ,name
,@(if primary-controls (list :starting-index -1))
:extend-response :respond-branches-main :axis :y
,@(if primary-controls
`(:primary-controls
(:format (,(funcall ,(macroexpand (append (getf extend :controls)))
nil (reverse (getf stage-params
:primary-controls)))))))
:secondary-controls
(:format (,(funcall ,(macroexpand (append (getf extend :controls)))
spec (reverse (getf stage-params :secondary-controls)))))
:contextual-menu
(:format ,,@(if (< 0 (length (getf extend :menu)))
(list `(funcall ,(macroexpand (append (getf extend :menu)
(list 'meta)))
(getf stage-params :contextual-menu)))))))))
(prospec-segment (specs)
(labels ((process-section (section)
(if (listp section)
`(meta ,(mapcar #'process-section section)
:mode (:view :vista :enclose :enclose-branch-segment))
(prospec-branch (labels ((find-spec (target specs)
(if specs
(if (eq target (intern (string-upcase (caar specs))
"KEYWORD"))
(first specs)
(find-spec target (rest specs))))))
(find-spec section branch-specs))))))
(mapcar #'process-section
(rest (assoc :primary (rest (first (find-form-in-spec 'display-params
(first specs)))))))))
(prospec-nav (specs)
(rest (assoc :primary (rest (first (find-form-in-spec 'display-params (first specs)))))))
(prospec-adj (specs) ;;(specs &optional output)
(second (assoc :adjunct (rest (first (find-form-in-spec 'display-params (first specs))))))))
`((meta ((meta ,(prospec-segment branch-specs)
:mode (:view :vista :name :branches :enclose :enclose-branches-main :point 0
:index (:format
,(rest (assoc :primary
(rest (first (find-form-in-spec 'display-params
(first branch-specs)))))))
:navigation (:format (,(prospec-nav branch-specs)))))
(meta ,(prospec-adj branch-specs)
:mode (:view :vista :name :branches-adjunct :breadth :brief
:fill :fill-branches-adjunct :enclose :enclose-branches-adjunct)))
:mode (:view :vista :enclose :enclose-content))))))
(defmacro simple-sub-navigation-layout (&key (omit nil))
"List items for use as menu options for a nav menu displaying the visible branches within a Seed system."
`(lambda (branch-specs)
(loop for branch in branch-specs collect `(meta ,branch :mode (:view :branch-selector
:target ,branch)))))
| 5,046
|
Common Lisp
|
.lisp
| 100
| 41.45
| 107
| 0.610953
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
3bce8f55749c1e32101f92e6d08fcbc2fcdc91243d4a6c28a827bb842c13d943
| 2,690
|
[
-1
] |
2,691
|
stage-controls.graph.lisp
|
phantomics_seed/seed.ui-spec.stage-controls.graph/stage-controls.graph.lisp
|
;;;; stage-controls.graph.lisp
(in-package #:seed.ui-spec.stage.base)
(defmacro stage-controls-graph-base (meta-symbol spec-symbol params-symbol output-symbol)
(declare (ignorable spec-symbol))
`(((eq :add-graph-node (first ,params-symbol))
(cons `(,',meta-symbol :add-node :mode (:interaction :add-graph-node))
,output-symbol))
((eq :add-graph-link (first ,params-symbol))
(cons `(,',meta-symbol :add-link :mode (:interaction :add-graph-link))
,output-symbol))
((eq :remove-graph-object (first ,params-symbol))
(cons `(,',meta-symbol :delete-object :mode (:interaction :remove-graph-object))
,output-symbol))))
| 653
|
Common Lisp
|
.lisp
| 13
| 46.076923
| 89
| 0.68652
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
d3e25f8719906299d06a31615e5e09edca012353f170f9b3857858f45b6f8fce
| 2,691
|
[
-1
] |
2,692
|
form.mode-sheet.lisp
|
phantomics_seed/seed.ui-spec.form.mode-sheet/form.mode-sheet.lisp
|
;;;; seed.ui-spec.form.mode-sheet.lisp
(in-package #:seed.ui-model.react)
(specify-components
sheet-view-mode
(sheet-view
(:get-initial-state
(lambda ()
(chain j-query (extend (create point #(0 0)
point-attrs (create value nil delta nil)
meta (chain j-query (extend t (create max-depth 0
confirmed-value nil
invert-axis (list false true))
(@ this props data meta))))
(chain this (initialize (@ this props))))))
:initialize
(lambda (props)
(let* ((self this)
(state (funcall inherit self props
(lambda (d) (chain j-query (extend (@ props data) (@ d data))))
(lambda (pd) (@ pd data data)))))
;; (if (@ self props context trace-category)
;; (chain self props context methods (register-branch-path (@ self props context trace-category)
;; (@ self props data id)
;; (@ state context path))))
state))
:element-specs #()
:modulate-methods
(lambda (methods)
(let* ((self this)
(to-grow (if (@ self props context working-system)
(chain methods (in-context-grow (@ self props context working-system)))
(@ methods grow))))
(chain j-query
(extend (create set-delta (lambda (value) (extend-state point-attrs (create delta value))))
methods (create grow-branch (lambda (space meta callback)
(to-grow (@ self state data id)
space meta callback)))))))
:modulate-methods
(lambda (methods)
(let* ((self this)
(to-grow (if (@ self props context working-system)
(chain methods (in-context-grow (@ self props context working-system)))
(@ methods grow))))
(chain j-query
(extend (create set-delta (lambda (value) (extend-state point-attrs (create delta value))))
methods
(create grow-point
(lambda (data meta alternate-branch)
(let ((new-space (chain j-query (extend t #() (@ self state space)))))
;(cl :as data new-space)
(chain self (assign data new-space)))
;(chain methods
(to-grow (if (= "undefined" (typeof alternate-branch))
(@ self state data id)
alternate-branch)
;; TODO: it may be desirable to add certain metadata to
;; the meta for each grow request, that's what the
;; derive-metadata function below may later be used for
new-space meta))
grow-branch
(lambda (space meta callback)
(chain console (log :ss (@ self props context)))
;;(chain methods (grow
(to-grow (@ self state data id)
space meta callback)))))))
:set-confirmed-value
(lambda (value)
(chain this (set-state (create confirmed-value value))))
:build-sheet-heading
(lambda (data)
(let ((heading (list (panic:jsl (:th :key "a0")))))
(loop for index from 0 to (1- (@ data 0 length))
do (chain heading (push (panic:jsl (:th :key (+ "sheet-header-" index)
(chain -string (from-char-code (+ 65 index))))))))
heading))
:build-sheet-cells
(lambda (data)
(let ((self this)
(cells #())
(this-row #())
(row-index 0))
(loop for row from 0 to (1- (@ data length))
do (funcall
(lambda (row-index)
(setq this-row (list (panic:jsl (:th :key (+ "row-label-" row)
(1+ row)))))
(loop for col from 0 to (1- (@ (getprop data row) length))
do (let ((cell-click (lambda () (chain self (set-state (create point (list col row))))))
(is-point (and (= (@ self state point 1) row)
(= (@ self state point 0) col))))
(chain this-row
(push (panic:jsl (:td :key (+ "cell-" col "-" row)
:on-click cell-click
:ref
(lambda (ref)
(let ((element (j-query ref)))
(if (= "undefined"
(typeof (getprop self "elementSpecs" row)))
(setf (getprop self "elementSpecs" row) #()))
(if (not (= "undefined" (typeof (@ element 0))))
(setf (getprop self "elementSpecs" row col)
(create left (@ element 0 offset-left)
top (@ element 0 offset-top)
width (@ element 0 client-width)
height (@ element 0 client-height))))))
:class-name (+ "atom"
(+ " mode-" (@ self state context mode))
(if is-point " point" ""))
(if is-point (panic:jsl (:div :class-name "point-marker")))
(subcomponent (@ interface-units cell-spreadsheet)
(create content (getprop data row col)
meta (create is-point is-point
is-parent-point
(@ self state context
is-point)))))))))))
row)
(chain cells (push (panic:jsl (:tr :key (+ "row-" row)
this-row)))))
cells))
:move
(lambda (motion)
(let* ((self this)
(mo (chain motion (map (lambda (axis index)
(* axis (if (getprop (@ self state meta invert-axis) index)
-1 1))))))
(new-point (list (if (< -1 (+ (@ mo 0) (@ this state point 0))
(@ this state space 0 length))
(+ (@ mo 0) (@ this state point 0))
(@ this state point 0))
(if (< -1 (+ (@ mo 1) (@ this state point 1))
(@ this state space length))
(+ (@ mo 1) (@ this state point 1))
(@ this state point 0)))))
;; adjust scroll position of pane if cursor is moved out of view
(if (and (not (= "undefined" (typeof (@ self state pane-element))))
(< 0 (@ self element-specs length)))
(progn (if (< (+ (@ self state pane-element 0 client-height)
(@ self state pane-element 0 scroll-top))
(getprop (@ self element-specs) (@ new-point 1) (@ new-point 0) "top"))
(setf (@ self state pane-element 0 scroll-top)
(+ (getprop (@ self element-specs) (@ new-point 1) (@ new-point 0) "top")
(/ (@ self state pane-element 0 client-height) 2)))
(if (> (@ self state pane-element 0 scroll-top)
(getprop (@ self element-specs) (@ new-point 1) (@ new-point 0) "top"))
(setf (@ self state pane-element 0 scroll-top)
(- (getprop (@ self element-specs) (@ new-point 1) (@ new-point 0) "top")
(/ (@ self state pane-element 0 client-height) 2)))))
(if (< (+ (@ self state pane-element 0 client-width)
(@ self state pane-element 0 scroll-left))
(getprop (@ self element-specs) (@ new-point 1) (@ new-point 0) "left"))
(setf (@ self state pane-element 0 scroll-left)
(+ (getprop (@ self element-specs) (@ new-point 1) (@ new-point 0) "left")
(/ (@ self state pane-element 0 client-height) 2)))
(if (> (@ self state pane-element 0 scroll-left)
(getprop (@ self element-specs) (@ new-point 1) (@ new-point 0) "left"))
(setf (@ self state pane-element 0 scroll-left)
(- (getprop (@ self element-specs) (@ new-point 1) (@ new-point 0) "left")
(/ (@ self state pane-element 0 client-width) 2)))))))
(chain this (set-state (create point new-point)))))
:assign
(lambda (value matrix)
(let* ((x (@ this state point 0))
(y (@ this state point 1))
(original-value (getprop matrix y x)))
(setf (getprop matrix y x)
(if (= "[object Array]" (chain -object prototype to-string (call original-value)))
(if (not (null value))
;; assign the unknown type for now;
;; an accurate type will be assigned server-side
(create type "__unknown"
data-inp value))
(if (null value)
(list)
(chain j-query (extend (create) original-value
(create data-inp-ovr value))))))
matrix))
:component-will-receive-props
(lambda (next-props)
(defvar self this)
(let ((new-state (chain this (initialize next-props))))
(if (@ self state context is-point)
(setf (@ new-state action-registered)
(@ next-props action)))
(chain this (set-state new-state)))
(if (and (not (@ self state pane-element))
(not (= "undefined" (typeof (@ self props context fetch-pane-element)))))
(setf (@ new-state pane-element)
(chain (j-query (+ "#branch-" (@ self props context index)
"-" (@ self props data id))))))
(handle-actions
(@ next-props action) (@ self state) next-props
:actions-any-branch
((set-branch-by-id
(if (= (@ params id) (@ self props data id))
(chain self props context methods (set-trace (@ self props context path))))))
:actions-point-and-focus
((move
(chain self (move (@ params vector))))
(delete-point
(if (not (= true (@ next-props data meta locked)))
(chain self state context methods (grow-point nil (create)))))
(record
(if (@ self props context clipboard-id)
(chain self state context methods (grow-point (create)
(create vector (@ params vector)
point (@ self state point)
branch (@ self state data id))
(@ self props context clipboard-id)))))
(recall
(if (and (@ self props context history-id)
(not (= true (@ next-props data meta locked))))
(chain self state context methods (grow-point (create)
(create vector (@ params vector)
"recall-branch" (@ self state data id))
(@ self props context history-id)))))
(trigger-primary
(cond ((= "move" (@ self state context mode))
(if (not (= true (@ next-props data meta locked)))
(chain self state context methods (set-mode "set"))))
((= "set" (@ self props context mode))
(progn (chain self (set-state (create action-registered nil)))
(chain self state context methods (grow-point (@ self state point-attrs delta)
(create)))
(chain self state context methods (set-mode "move"))))))
(trigger-secondary
(if (not (= true (@ next-props data meta locked)))
(chain self state context methods (set-mode "set"))))
(trigger-anti
(chain self state context methods (set-mode "move")))
(commit
(if (not (= true (@ next-props data meta locked)))
(chain self state context methods (grow-branch (@ self state space)
(create save true))))))))
:should-component-update
(lambda (next-props next-state)
(or (not (@ next-state context current))
(not (= (@ next-state context mode)
(@ this state context mode)))
(@ next-state action-registered)))
:component-did-update
(lambda ()
(if (and (= "set" (@ this state context mode))
(@ this state context is-point))
(chain (j-query (+ "#sheet-view-"
(@ this props data id)
" .atom.mode-set.point .editor input"))
(focus))))
;; :render-space
;; (lambda ()
;; (let* ((self this)
;; (space (chain j-query (extend (list) (@ self state space)))))
;; (chain space (unshift (loop for index from 0 to (1- (@ space 0 length))
;; collect (create data-inp (chain -string (from-char-code (+ 65 index)))))))
;; (setq space (chain space (map (lambda (row rix)
;; (chain row (map (lambda (cell cix)
;; (create value cell
;; component; (@ self cell-component)
;; (panic:jsl
;; (:div :class-name "cc"
;; (subcomponent (@ interface-units
;; cell-spreadsheet)
;; (create content cell
;; meta
;; (create
;; is-point
;; false
;; is-parent-point
;; (@ self
;; state
;; context
;; is-point))))))
;; force-component t
;; width 180))))))))
;; space))
)
(defvar self this)
;(cl "SHR" (@ this state just-updated))
;(cl :cel (@ self state data) (@ self props context) (@ self state context))
;(chain console (log :ssp (@ self state space)))
;;(let ((-data-sheet (new -react-data-sheet)))
(panic:jsl (:div :class-name "matrix-view spreadsheet-view"
:id (+ "sheet-view-" (@ this state data id))
(:table :class-name "form"
:ref (+ "formSheet" (@ this state data id))
(:thead (:tr (chain self (build-sheet-heading (@ self state space)))))
(:tbody (chain self (build-sheet-cells (@ self state space)))))))));)
| 12,215
|
Common Lisp
|
.lisp
| 286
| 35.909091
| 107
| 0.575478
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
c645969f774cb000bc31ea59e5d6bb5271c7f5eccb86dbc60d0ca3a72829473c
| 2,692
|
[
-1
] |
2,693
|
form.mode-document.lisp
|
phantomics_seed/seed.ui-spec.form.mode-document/form.mode-document.lisp
|
;;;; seed.ui-spec.form.mode-document.lisp
(in-package #:seed.ui-model.react)
(specify-components
document-view-mode
(document-view
(:get-initial-state
(lambda ()
(let ((initial-value
(chain -slate-value
(from-j-s-o-n (if (and (@ this props data data)
(not (= "undefined" (typeof (@ this props data data)))))
(chain -slate-value (from-j-s-o-n (chain -j-s-o-n
(parse (@ this props data data)))))
(create kind "value"
document
(create nodes
(list (create kind "block"
type "paragraph"
nodes (list (create kind "text"
leaves
(list
(create text
"Line.")))))))))))))
(chain j-query (extend (create point #(0 0)
content initial-value
point-attrs (create value nil delta nil)
meta (chain j-query (extend t (create max-depth 0
confirmed-value nil
invert-axis (list false true))
(@ this props data meta)))
read-only t)
(chain this (initialize (@ this props)))))))
:editor-instance nil
:initialize
(lambda (props)
(let* ((self this)
(state (funcall inherit self props
(lambda (d) (chain j-query (extend (@ props data) (@ d data))))
(lambda (pd) (@ pd data data)))))
(if (@ self props context set-interaction)
(progn (chain self props context
(set-interaction "docMarkBold" (lambda () (chain self (toggle-mark "bold")))))
(chain self props context
(set-interaction "docMarkItalic" (lambda () (chain self (toggle-mark "italic")))))
(chain self props context
(set-interaction "docNodePgraph" (lambda () (chain self (set-node "paragraph")))))
(chain self props context
(set-interaction "docNodeQuote" (lambda () (chain self (set-node "quote")))))
(chain self props context
(set-interaction "docNodePoints" (lambda () (chain self (set-node "points")))))
(chain self props context
(set-interaction "docNodeCount" (lambda () (chain self (set-node "count")))))))
state))
:element-specs #()
:toggle-mark
(lambda (type-string)
(let* ((self this)
(value-container (chain self editor-instance state value (change)
(toggle-mark type-string))))
(chain self (set-state (create content (@ value-container value))))))
:set-node
(lambda (type-string)
(let* ((self this)
(change (chain self editor-instance state value (change)))
(is-member (chain self editor-instance state value blocks (some (lambda (node)
(or (= "section" (@ node type))
(= "member" (@ node type)))))))
(value-container (cond ((or (= type-string "points")
(= type-string "count"))
(chain change (set-block "member") (wrap-block type-string)))
((= type-string "quote")
(if is-member
(chain change (set-block "section")
(unwrap-block "points") (unwrap-block "count")
(wrap-block type-string))
(chain change (set-block "section") (wrap-block type-string))))
(t (if is-member
(chain change (set-block type-string) (unwrap-block "quote")
(unwrap-block "points") (unwrap-block "count"))
(chain change (set-block type-string)))))))
(chain self (set-state (create content (@ value-container value))))))
:modulate-methods
(lambda (methods)
(let* ((self this)
(to-grow (if (@ self props context working-system)
(chain methods (in-context-grow (@ self props context working-system)))
(@ methods grow))))
(chain j-query
(extend (create set-delta (lambda (value) (extend-state point-attrs (create delta value))))
methods (create grow-branch (lambda (space meta callback)
(to-grow (@ self state data id)
space meta callback)))))))
:set-confirmed-value
(lambda (value)
(chain this (set-state (create confirmed-value value))))
:move
(lambda (motion)
;;(cl :mo motion)
)
:component-will-receive-props
(lambda (next-props)
(defvar self this)
(let ((new-state (chain this (initialize next-props))))
(if (@ self state context is-point)
(setf (@ new-state action-registered)
(@ next-props action)))
(chain this (set-state new-state)))
(if (and (not (@ self state pane-element))
(not (= "undefined" (typeof (@ self props context fetch-pane-element)))))
(setf (@ new-state pane-element)
(chain (j-query (+ "#branch-" (@ self props context index)
"-" (@ self props data id))))))
(handle-actions
(@ next-props action) (@ self state) next-props
:actions-any-branch
((set-branch-by-id
(if (= (@ params id) (@ self props data id))
(chain self props context methods (set-trace (@ self props context path))))))
:actions-point-and-focus
((move (chain self (move (@ params vector))))
;; (record
;; (if (@ self props context clipboard-id)
;; (chain self state context methods (grow-point (create)
;; (create vector (@ params vector)
;; point (@ self state point)
;; branch (@ self state data id))
;; (@ self props context clipboard-id)))))
;; (recall
;; (if (and (@ self props context history-id)
;; (not (= true (@ next-props data meta locked))))
;; (chain self state context methods (grow-point (create)
;; (create vector (@ params vector)
;; "recall-branch" (@ self state data id))
;; (@ self props context history-id)))))
(trigger-primary
(cond ((= "move" (@ self state context mode))
(if (not (= true (@ next-props data meta locked)))
(progn (chain self state context methods (set-mode "write"))
(cl :eee)
(chain self (set-state (create read-only false))))))))
(trigger-secondary
(if (not (= true (@ next-props data meta locked)))
(progn (chain self state context methods (set-mode "write"))
(chain self editor-instance (focus))
(chain self (set-state (create read-only false))))))
(trigger-anti
(chain self (set-state (create read-only t)))
(chain self state context methods (set-mode "move")))
(commit
(if (not (= true (@ next-props data meta locked)))
(chain self state context methods (grow-branch (chain -j-s-o-n
(stringify (chain self editor-instance
state value (to-j-s-o-n))))
(create save true)))))
)))
:component-did-update
(lambda ()
(if (and (= "set" (@ this state context mode))
(@ this state context is-point))
(chain (j-query (+ "#sheet-view-" (@ this props data id)
" .atom.mode-set.point .editor input"))
(focus))))
:render-node
(lambda (props)
(let ((node-type (@ props node type))
(children (@ props children)))
(cond ((= node-type "quote")
(panic:jsl (:div :class-name "node-holder blockquote"
(:div :class-name "glyph")
(:blockquote :class-name "node blockquote" children))))
((= node-type "points")
(panic:jsl (:div :class-name "node-holder points"
(:div :class-name "glyph")
(:ul :class-name "node points" children))))
((= node-type "count")
(panic:jsl (:div :class-name "node-holder count"
(:div :class-name "glyph")
(:ol :class-name "node count" children))))
((= node-type "member")
(panic:jsl (:li :class-name "node member" children)))
((= node-type "section")
(panic:jsl (:div :class-name "node member" children)))
(t (panic:jsl (:div :class-name "node-holder p"
(:div :class-name "glyph")
(:div :class-name "node p" children)))))))
:render-mark
(lambda (props)
(let ((mark-type (@ props mark type))
(children (@ props children)))
(cond ((= mark-type "bold")
(panic:jsl (:strong children)))
((= mark-type "italic")
(panic:jsl (:em children))))))
)
(defvar self this)
(panic:jsl (:div :class-name "document-pane-outer"
(:-slate-editor :value (@ self state content)
:on-change (lambda (value)
(chain self (set-state (create content (@ value value)))))
:ref (lambda (ref) (if (not (@ self editor-instance))
(setf (@ self editor-instance) ref)))
:render-node (@ self render-node)
:render-mark (@ self render-mark)
;; :on-focus (lambda (value)
;; (chain self state context methods (set-mode "write")))
;; :on-blur (lambda (value)
;; ;;(chain console (log :bb value))
;; (chain self state context methods (set-mode "move")))
:read-only (@ self state read-only)
:class-name "slate-editor-pane")
(:div :class-name "status-bar"
(if (= "move" (@ self state context mode))
"navigate" "edit"))))))
| 8,995
|
Common Lisp
|
.lisp
| 213
| 34.741784
| 101
| 0.586411
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
959319fffcda7e48b0445141006de5b7367cf62f5383072e40074d758bce286d
| 2,693
|
[
-1
] |
2,694
|
package.lisp
|
phantomics_seed/demo-sheet/package.lisp
|
;;;; package.lisp
(defpackage #:demo-sheet
(:export)
(:use #:common-lisp #:april #:array-operations
#:seed.app-model.sheet.base #:seed.sublimate
#:seed.app-model.graph.garden-path #:seed.app-model.document-slate.base))
| 226
|
Common Lisp
|
.lisp
| 6
| 35.5
| 74
| 0.726027
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
449fc2852c54ab17a5759570246a0e2308890f69262017c33cf12ea13903ff51
| 2,694
|
[
-1
] |
2,695
|
graph.lisp
|
phantomics_seed/demo-sheet/graph.lisp
|
(in-package #:demo-sheet)
(graph-garden-path main-graph
(:ID :CC :TYPE :SWITCH :ITEMS ("Begin")
:META (:TITLE "First Node" :ABOUT "")
:DO ((setf (getf state :bla)
(1+ (getf state :bla))))
:LINKS ((:ID :C1 :TO :AA :META (:TITLE "Return" :ABOUT "")
:IF (= 1 1))
(:ID :C2 :TO :BB :META (:TITLE "Other Node" :ABOUT "")
:IF t)))
(:ID :AA :TYPE :OPTION :ITEMS ("Hello")
:META (:TITLE "Second Node" :ABOUT "")
:LINKS ((:ID :A1 :TO :BB :META (:TITLE "To Next" :ABOUT "")
:ITEMS ("To Next"))
(:ID :A2 :TO :AA :META (:TITLE "To Same" :ABOUT "")
:ITEMS ("To Same"))))
(:ID :BB :TYPE :OPTION :ITEMS ("Next")
:META (:TITLE "Third Node" :ABOUT "")
:LINKS ((:ID :B1 :TO :AA :META (:TITLE "Go Back" :ABOUT "")
:ITEMS "Go Back"))))
(graph-garden-path main-graph
(:ID :CC :TYPE :SWITCH :ITEMS ("Begin")
:META (:TITLE "Delivery By Grower" :ABOUT "")
:DO ((permissions :all))
:LINKS ((:ID :C1 :TO :AA :META (:TITLE "Return" :ABOUT "")
:IF (= 1 1))
(:ID :C2 :TO :BB :META (:TITLE "Other Node" :ABOUT "")
:IF t)))
(:ID :AA :TYPE :OPTION :ITEMS ("Hello")
:META (:TITLE "Regional Processing" :ABOUT "")
:DO ((permissions :modify (:weight)))
:LINKS ((:ID :A1 :TO :BB :META (:TITLE "To Next" :ABOUT "")
:ITEMS ("To Next"))
(:ID :A2 :TO :AA :META (:TITLE "To Same" :ABOUT "")
:ITEMS ("To Same"))))
(:ID :BB :TYPE :OPTION :ITEMS ("Next")
:META (:TITLE "Export" :ABOUT "")
:DO ((permissions :modify (:weight)))
:LINKS ((:ID :B1 :TO :AA :META (:TITLE "Go Back" :ABOUT "")
:ITEMS "Go Back"))))
(graph-garden-path other-graph
(:id :ab :type :portal :to main-graph))
| 1,734
|
Common Lisp
|
.lisp
| 42
| 35.52381
| 62
| 0.534953
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
522a75ce6d4eac262906241a75998a34d05469584bb959a755c6d73497a11590
| 2,695
|
[
-1
] |
2,696
|
main.lisp
|
phantomics_seed/demo-sheet/main.lisp
|
(IN-PACKAGE #:DEMO-SHEET)
(DEFVAR GEN-SPACE-APL)
(SETQ GEN-SPACE-APL "addWalls←{⍺⍪⍵[1+⍳(1⌷⍴⍵)-2;;]⍪⍺}
addFloor←{⍵[;⍳(2⌷⍴⍵)-1;],[2]⍺}
field←16 16 16⍴0
field←1 addWalls 2 addFloor field
field[;5 6;4]←3
field[8;4;6]←4
field[8;8;]←1
field")
(DEFVAR GENERATED-SPACE)
(SETQ GENERATED-SPACE (ARRAY-TO-NESTED-VECTOR (APRIL GEN-SPACE-APL)))
(DEFVAR DOCUMENT-CONTENT)
(SETQ DOCUMENT-CONTENT
(DOCUMENT-AS-HTML
(:DOCUMENT
(:NODES
((:NODES
((:LEAVES ((:MARKS NIL :TEXT "Line 2 change test." :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES
((:MARKS NIL :TEXT "Another line altered again." :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES
((:MARKS NIL :TEXT "This is " :KIND "leaf")
(:MARKS ((:DATA NIL :TYPE "bold" :KIND "mark")) :TEXT
"a test, adding" :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES
((:MARKS ((:DATA NIL :TYPE "bold" :KIND "mark")) :TEXT
"Interspersed." :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES
((:MARKS ((:DATA NIL :TYPE "bold" :KIND "mark")) :TEXT " " :KIND
"leaf")
(:MARKS NIL :TEXT "hello, more testing." :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Test." :KIND "leaf")) :KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:NODES
((:LEAVES ((:MARKS NIL :TEXT "Hello" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "section" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Testing 123 456" :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "section" :KIND "block")
(:NODES
((:LEAVES
((:MARKS NIL :TEXT "Hello " :KIND "leaf")
(:MARKS ((:DATA NIL :TYPE "bold" :KIND "mark")) :TEXT
"again 3" :KIND "leaf")
(:MARKS NIL :TEXT "." :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "section" :KIND "block"))
:DATA NIL :IS-VOID :FALSE :TYPE "quote" :KIND "block")
(:NODES
((:LEAVES
((:MARKS NIL :TEXT "Back " :KIND "leaf")
(:MARKS ((:DATA NIL :TYPE "bold" :KIND "mark")) :TEXT "to"
:KIND "leaf")
(:MARKS NIL :TEXT " normal again." :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:NODES
((:LEAVES ((:MARKS NIL :TEXT "Test 123, hello." :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Test again." :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Tested" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Test" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block"))
:DATA NIL :IS-VOID :FALSE :TYPE "count" :KIND "block")
(:NODES
((:LEAVES
((:MARKS ((:DATA NIL :TYPE "italic" :KIND "mark")) :TEXT
"Testing" :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Hello" :KIND "leaf")) :KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Testing 123" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:NODES
((:LEAVES ((:MARKS NIL :TEXT "Point test" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block")
(:NODES
((:LEAVES
((:MARKS ((:DATA NIL :TYPE "bold" :KIND "mark")) :TEXT
"Tested again" :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block")
(:NODES
((:LEAVES
((:MARKS NIL :TEXT "Hello " :KIND "leaf")
(:MARKS ((:DATA NIL :TYPE "italic" :KIND "mark")) :TEXT "123"
:KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block")
(:NODES
((:LEAVES
((:MARKS ((:DATA NIL :TYPE "bold" :KIND "mark")) :TEXT
"Tested" :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block"))
:DATA NIL :IS-VOID :FALSE :TYPE "points" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "At the end." :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Another paragraph." :KIND "leaf"))
:KIND "text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Paragraph 2." :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:NODES
((:LEAVES ((:MARKS NIL :TEXT "List." :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Item 2" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Item 3" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "member" :KIND "block"))
:DATA NIL :IS-VOID :FALSE :TYPE "points" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Paragraph" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block")
(:NODES
((:NODES
((:LEAVES ((:MARKS NIL :TEXT "Quote 1" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "section" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Quote 2" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "section" :KIND "block"))
:DATA NIL :IS-VOID :FALSE :TYPE "quote" :KIND "block")
(:NODES
((:LEAVES ((:MARKS NIL :TEXT "Continued" :KIND "leaf")) :KIND
"text"))
:DATA NIL :IS-VOID :FALSE :TYPE "paragraph" :KIND "block"))
:DATA NIL :KIND "document")
:KIND "value")))
(DEFVAR GRAPH-CONTENT)
(SETQ GRAPH-CONTENT
'(GRAPH-STEPS
(#:G1573 :TYPE :OPTION :CONTENT "Hello" :LINKS
((#:G1574 :CONTENT "To Next")))
(#:G1574 :TYPE :OPTION :CONTENT "Next" :LINKS
((#:G1573 :CONTENT "Go Back")))))
(DEFVAR MAIN-TABLE)
(SETQ MAIN-TABLE
#2A((NIL NIL (:DATA-COM (16) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
((:DATA-COM (32) :TYPE :NUMBER) (:DATA-INP 19 :TYPE :NUMBER) NIL
NIL NIL NIL (:DATA-COM (3) :TYPE :NUMBER)
(:DATA-COM (3) :TYPE :NUMBER) NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL (:TYPE :NUMBER :DATA-INP 95)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (10 7) :TYPE :NUMBER) (:DATA-COM (10 7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (14 7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER) NIL
NIL NIL NIL NIL NIL NIL NIL)
(NIL (:TYPE :NUMBER :DATA-INP 5) NIL NIL
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (10 7) :TYPE :NUMBER) (:DATA-COM (10 7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (14 7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER) NIL
NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL (:DATA-COM (3) :TYPE :NUMBER)
(:DATA-COM (3) :TYPE :NUMBER) (:DATA-COM (13.75 3) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (39.25 36.25 13) :TYPE :NUMBER)
(:DATA-COM (10 7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (14 7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL (:TYPE :NUMBER :DATA-INP 2)
(:DATA-COM (5) :DATA-INP 2 :TYPE :NUMBER)
(:DATA-COM (6) :DATA-INP 3 :TYPE :NUMBER)
(:DATA-COM (13.75 3) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (10 7) :TYPE :NUMBER) (:DATA-COM (10 7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (14 7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER) NIL
NIL NIL NIL NIL NIL NIL NIL)
(NIL (:DATA-COM ("function") :ARGS-COUNT 1 :TYPE :FUNCTION)
(:DATA-COM (3) :TYPE :NUMBER) (:DATA-COM (3) :TYPE :NUMBER)
(:DATA-COM (13.75 3) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (14 7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER) NIL
NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL (:DATA-COM (3) :TYPE :NUMBER)
(:DATA-COM (3) :TYPE :NUMBER) (:DATA-COM (13.75 3) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (14 7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL (:DATA-COM (3) :TYPE :NUMBER)
(:DATA-COM (3) :TYPE :NUMBER) (:DATA-COM (13.75 3) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (13.75 3) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (14 7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (14 7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL)
((:DATA-COM (2) :TYPE :NUMBER) (:DATA-COM (2) :TYPE :NUMBER)
(:DATA-COM (2) :TYPE :NUMBER) (:DATA-COM (2) :TYPE :NUMBER)
(:DATA-COM (9 7) :TYPE :NUMBER) (:DATA-COM (9 7) :TYPE :NUMBER)
(:DATA-COM (9 7) :TYPE :NUMBER) (:DATA-COM (9 7) :TYPE :NUMBER)
(:DATA-COM (9 7) :TYPE :NUMBER) (:DATA-COM (9 7) :TYPE :NUMBER)
(:DATA-COM (18 9 7) :TYPE :NUMBER) (:DATA-COM (9 7) :TYPE :NUMBER)
(:DATA-COM (2) :TYPE :NUMBER) (:DATA-COM (2) :TYPE :NUMBER)
(:DATA-COM (2) :TYPE :NUMBER) (:DATA-COM (2) :TYPE :NUMBER)
(:DATA-COM (2) :TYPE :NUMBER) (:DATA-COM (2) :TYPE :NUMBER)
(:DATA-COM (2) :TYPE :NUMBER) (:DATA-COM (2) :TYPE :NUMBER))
(NIL NIL (:TYPE :NUMBER :DATA-INP 5) (:DATA-COM (4) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER)
(:DATA-COM (14 7) :TYPE :NUMBER) (:DATA-COM (7) :TYPE :NUMBER) NIL
NIL NIL NIL NIL NIL NIL NIL)
(NIL (:TYPE "STRING" :DATA-INP "Hello") NIL
(:DATA-COM (4) :TYPE :NUMBER) NIL NIL NIL
(:DATA-COM (10) :TYPE :NUMBER) NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL (:TYPE :STRING) NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL (:DATA-COM (8) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL NIL)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
(:DATA-COM (0) :TYPE :NUMBER) NIL NIL NIL NIL NIL NIL NIL NIL
NIL)))
(IN-TABLE MAIN-TABLE (CELL "a2" 32) (CELL "g9" (/ 6 2))
(CELL "c1" (+ 8 (META 3 :COMMENT "This is a test comment.") 5)) (CELL "g5" 13)
(CELL "d12" (- 20 6 (EXPT 2 3) 2)) (CELLS "c5" "e9" (+ 3 VAL-NUMBER))
(CELL "b7" (LAMBDA (C) (+ 4 C)))
(CELLS "e3" "l12" (+ 7 (* 1.25 VAL-NUMBER) VAL-NUMBER))
(CELLS "g2" "h6" (+ 1 2 VAL-NUMBER)) (CELL "d13" (CELL-UP))
(CELL "h13" (CELL-UP 8)) (ROW 11 (+ 1 (+ 1 VAL-NUMBER)))
(COL "k" (* 2 VAL-NUMBER)) (CELL "d16" (FUNCALL (CELL "b7") (CELL "d12"))))
| 15,821
|
Common Lisp
|
.lisp
| 296
| 39.793919
| 79
| 0.490373
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
82dabed62a5c2c51983088b0a05d97b4c4350f753d2f95fbccc3c42b0a5934ff
| 2,696
|
[
-1
] |
2,697
|
ui-model.css.lisp
|
phantomics_seed/seed.ui-model.css/ui-model.css.lisp
|
;;;; ui-model.css.lisp
(in-package #:seed.ui-model.css)
(defun replace-keys-in-form (to-find to-replace-with form)
(loop for item in form collect
(cond ((listp item)
(replace-keys-in-form to-find to-replace-with item))
((and (keywordp item)
(find item to-find))
(nth (position item to-find)
to-replace-with))
(t item))))
(defmacro specify-css-styles (name params &key (by-palette nil) (basic nil))
"Define (part of) a component set specification to be used in building a React interface."
(let ((options (gensym)) (palette (gensym)) (palettes (gensym)) (palette-symbols (gensym))
(palette-contexts (gensym)) (pal-data (gensym)))
`(defmacro ,name (&optional ,options)
(let* ((,palettes (rest (assoc :palettes ,options)))
(,palette-contexts (rest (assoc :palette-contexts ,options)))
(,palette-symbols '(,@(rest (assoc :palette-symbols (rest params))))))
`(append ,@,(if (not (null by-palette))
`(if ,palettes
(loop :for ,palette :in ,palettes :append
`((let* ((,',pal-data ,(second ,palette))
,@(loop :for symbol :in ,palette-symbols
:collect (list symbol `(getf ,',pal-data
,(intern (string-upcase symbol)
"KEYWORD")))))
(declare (ignorable ,@(loop :for symbol :in ,palette-symbols
:collect symbol)))
(list `((:or ,(intern (format nil ".PALETTE-~a" ,(first ,palette)))
,@(loop :for symbol :in ',,palette-contexts
collect (intern (format nil ".PALETTE-~a.~a"
,(first ,palette)
symbol))))
,@,,@by-palette)))))))
,,@basic)))))
;; (defmacro css-style-set (name options &rest components)
;; `(let ,(loop for color in (getf options :palette)
;; collect (list color `(getf ,)))))
(defmacro css-styles (options &rest styles)
`(append ,@(loop for style in styles
collect (macroexpand (if (listp style)
(list (first style)
(append (cdadr style)
(rest options)))
(list style (rest options)))))))
;; (main-branch-styles (with :palettes ((:basic :base3 "#fff" :base2 "#ddd")
;; (:other :base3 "#ff0000" :base2 "#00ff00"))))
;; (hex-express (lab-palette (15 4 -10) (20 4 -10) (45 6 -2) (50 6 0) (60 6 2) (65 6 4) (92 8 12) (97 8 12)))
;; (specify-css-styles
;; main-branch-styles
;; (with :palette-symbols (base3 base2 base1 base0 base00 base01 base02 base03
;; yellow orange red magenta violet blue cyan green))
;; :by-palette
;; (``(.branches
;; ;; styles for the top-level branch display elements
;; (.container
;; :width 100%
;; :background "#fff"
;; (.column-outer :padding-left 0
;; :padding-right 4px)
;; ((:and .column-outer :last-child) :padding-right 0)
;; (.portal-column
;; :padding 0 2px 0 0
;; (.header
;; :position relative
;; :color ,base2
;; ;; :background "repeating-linear-gradient(0deg, #93a1a1, #93a1a1 2px, #073642 2px, #073642 40px)"
;; :background "linear-gradient(0deg, #93a1a1 2px, #073642 2px)"
;; :height 38px
;; :font-family monospace
;; :padding 0 6px
;; :border-left "8px solid #D9D4C5"
;; :border-right "8px solid #D9D4C5"
;; (.locked-indicator
;; :float right
;; :font-weight bold
;; :color "#dc322f"))
;; ))))
;; :basic
;; (``(.branches :position relative)))
| 3,468
|
Common Lisp
|
.lisp
| 81
| 37.716049
| 109
| 0.59234
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
6ede8d044bf75d55888c1389ada4a5ece41acee3e0c141517df56f3fa3589975
| 2,697
|
[
-1
] |
2,698
|
css.base.lisp
|
phantomics_seed/seed.ui-spec.css.base/css.base.lisp
|
;;;; css.base.lisp
(in-package #:seed.ui-model.css)
;; Main CSS styles for Seed's interface.
(specify-css-styles
css-base
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:basic
(``("/* Portal styles */
@keyframes animatedBackground {
from { background-position: 0 50px; }
to { background-position: 0 0; }}"
(body :overflow hidden
:height 100%
:width 100%
(.breaker :clear both))
(|#main|
:height 100%
:width 100%
;; high-level portal styles
(.portal
:height 100%
:width 100%
:padding 0
:position relative
(.row :margin 0)
(|.row > .vista|
:padding 0)
(.vista.full (.row :height 100%)
(.col :padding 0
:height 100%))
(.vista.brief.col-1 :flex 0 0 5.55555%
:max-width 5.55555%)
;; universal form styles go here
((:or ul.form-view.short ul.form-view.brief)
:list-style-type none
:padding 0
(ul.form-view.in
:list-style-type none))
(ul.form-view.short
(ul.form-view.in
:padding 0 0 0 8px))
(|ul.form-view.short > li > ul.form-view.in|
:margin 0
:padding 0)
(|ul.form-view.short > li > ul.form-view.in > li|
:border none)
(.horizontal-view
((:or ul.form-view.short ul.form-view.brief)
;:display inline
(li :display inline
:margin-left 4px
(div :display inline)
;; don't display editor divs in the footer view,
;; since items there are meant as interface elements
;; TODO: this logic should be less tightly coupled
(div.editor :display none))
(.breaker :display none
:clear none))
((:or |ul.form-view.short > li| |ul.form-view.brief > li|)
:display block))
;; styles for common form and atom types
(.form-view
:padding 0
;(.editor :display none)
(table.form
:margin 0 0 0 8px
(.atom
(.content.type-symbol
(.title :color "#839496"))
(.content.type-keyword
:padding-left 2px
(.title :color "#859900"))
(.content.type-name
(.text :color "#073642"))
(.content.type-number
(.text :color "#dc322f"))
(.content.type-boolean
(.text :color "#268bd2"
:text-transform uppercase))
(.content.type-character
(.text :color "#d33682"))
(.content.type-string
(.text :color "#2aa198")
((:and .text :before)
:content "\""))))))
(|.portal > .row|
:height 100%)))))
(specify-css-styles
css-font-spec-ddin
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:basic
(``("/* D-DIN font specification */
@font-face {
font-family: 'DDIN';
src: url('./style-assets/d-din-complete-v1.0/D-DIN.woff') format('woff');
src: url('./style-assets/d-din-complete-v1.0/D-DIN.woff2') format('woff2');
src: url('./style-assets/d-din-complete-v1.0/D-DIN.ttf') format('truetype');
font-weight: normal;
font-style: normal;}
@font-face {
font-family: 'DDINBold';
src: url('./style-assets/d-din-complete-v1.0/D-DIN-Bold.woff') format('woff');
src: url('./style-assets/d-din-complete-v1.0/D-DIN-Bold.woff2') format('woff2');
src: url('./style-assets/d-din-complete-v1.0/D-DIN-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;}
@font-face {
font-family: 'DDINItalic';
src: url('./style-assets/d-din-complete-v1.0/D-DIN-Italic.woff') format('woff');
src: url('./style-assets/d-din-complete-v1.0/D-DIN-Italic.woff2') format('woff2');
src: url('./style-assets/d-din-complete-v1.0/D-DIN-Italic.ttf') format('truetype');
font-weight: normal;
font-style: italic;}
@font-face {
font-family: 'DDINCondensed';
src: url('./style-assets/d-din-complete-v1.0/D-DINCondensed.woff') format('woff');
src: url('./style-assets/d-din-complete-v1.0/D-DINCondensed.woff2') format('woff2');
src: url('./style-assets/d-din-complete-v1.0/D-DINCondensed.ttf') format('truetype');
font-weight: normal;
font-style: normal;}
@font-face {
font-family: 'DDINCondensedBold';
src: url('./style-assets/d-din-complete-v1.0//D-DINCondensed-Bold.woff') format('woff');
src: url('./style-assets/d-din-complete-v1.0//D-DINCondensed-Bold.woff2') format('woff2');
src: url('./style-assets/d-din-complete-v1.0//D-DINCondensed-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;}
@font-face {
font-family: 'DDINExp';
src: url('./style-assets/d-din-complete-v1.0/D-DINExp.woff') format('woff');
src: url('./style-assets/d-din-complete-v1.0/D-DINExp.woff2') format('woff2');
src: url('./style-assets/d-din-complete-v1.0/D-DINExp.ttf') format('truetype');
font-weight: normal;
font-style: normal;}
@font-face {
font-family: 'DDINExpBold';
src: url('./style-assets/d-din-complete-v1.0/D-DINExp-Bold.woff') format('woff');
src: url('./style-assets/d-din-complete-v1.0/D-DINExp-Bold.woff2') format('woff2');
src: url('./style-assets/d-din-complete-v1.0/D-DINExp-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;}
@font-face {
font-family: 'DDINExpItalic';
src: url('./style-assets/d-din-complete-v1.0/D-DINExp-Italic.woff') format('woff');
src: url('./style-assets/d-din-complete-v1.0/D-DINExp-Italic.woff2') format('woff2');
src: url('./style-assets/d-din-complete-v1.0/D-DINExp-Italic.ttf') format('truetype');
font-weight: normal;
font-style: italic;}
"
(body :font-family "'DDIN', Fallback, sans-serif"))))
(specify-css-styles
css-overview
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:by-palette (``((.overview
:background ,base3
:border-right 2px solid ,base2
:color ,base0
(.overview-headspacer :background ,base1)
(.portal-name :color ,blue
;; :background ,base02
:border-bottom 2px solid ,base01)
(.form-view (ul.in (li :border-color red)))
(.footer (.title-container :color ,base1
:border-bottom 2px solid ,base2)))
(.overview.point (.form-view (.point :color ,red)))))
:basic
(``((|#main|
(.portal
(.overview
:font-family monospace
;;:position absolute
;;:top 0
;;:left 0
:height 100%
:width 100%
;;:width 16em
;; :background "#fafafa"
;; :color "#2e3135"
;; :border-right 3px solid ;; "#ebebeb" ;"#dadde2"
:z-index 1000
(.overview-headspacer
:height 10px
:margin-right 6px)
(.form-view
:margin 0 6px
(.portal-name
:height 37px
:margin-bottom 4px
;; :margin 0 6px
(.title :font-family monospace
:font-size 1.2em
:line-height 2.2em))
(ul.in :padding 6px
:list-style-type none
:margin 8px 0
(li :border-bottom 1px solid ; "#dadde2" ;"#e8ded0"
:cursor pointer)
(.index
(.content
((:and .title :after)
:content " ➜"
:float right
:margin 0.05em 6px 0 0
:font-size 1.2em
:line-height 1em)))))
(.form-view.short
:margin 0
(ul.form-view.in :padding 0))
;; styles for the overview footer
(.footer
:position absolute
:bottom 0
:width 100%
(.title-container
:margin 0 12px 5px 0
:position relative
(.title :font-size 1.2em
:margin 0
:padding 2px 0
:font-family monospace
:position absolute
:bottom 0
:right 0
:text-align right)))))))))
(specify-css-styles
css-adjunct
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:by-palette (``((.adjunct-view
:background ,base3
:border-left 2px solid ,base2
(.status :border-bottom 2px solid ,base2)
(.view-section (.header (.id-char :color ,base0))
(.content ((:or .bar .point-marker)
(div :background ,base00))
(.point (.bar (div :background ,red)))
(.bar.sub-point (div :background ,base00))
(.atom-inner.point (.point-marker (div :background ,red)))))
(.view-section.point (.id-char :color ,red)))))
:basic
(``((|#main|
(.portal
;; styles for the main adjunct view pane
(.adjunct-view
:height 100%
(.status :min-height 10px
:margin 0 4px)
(.view-section
:margin 0 4px
(.header :text-align right
(.id-char :font-size 120%
:line-height 1.25em))
(.content
(.bar.composite :float left)
((:or .bar .point-marker)
:width 100%
:height 2px
:margin 0 0 2px 0
(div ;; :background "#dadde2"
:height 100%))
(.point-marker (div :display none))
(.atom-inner.point
(.point-marker (div :display block
;; :background "#cc5c4b"
:width 9%
:float right)))))
(.view-section.empty :display none)
;; (.view-section.display-history
;; (.content ;;(.point (.bar (div :background "#dadde2")))
;; (.bar.sub-point (div :background "#6f7c91"))))
))))))
(specify-css-styles
css-column-view
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:by-palette (``((.branches (.container :background ,base2
(.portal-column
(.header
:color ,base1
:border-top 2px solid ,base1
:background
,(format nil "linear-gradient(0deg, ~a 1px, ~a 1px)" base1 base3))
(.header.point :color ,red)
(.footer :border-top 1px solid ,base1
:background ,base3)
(.holder :background ,base3)
;; (.footer :border-top 1px solid ,base1)
(.sub-header :border-bottom 1px solid ,base1)
((:or .footer .sub-header)
:height 42px
(.inner (span :color ,base0
:border-bottom 2px solid ,base2
:cursor pointer)
(.atom-inner.point
(span :background ,base2))))
((:or .footer.point .sub-header.point)
(.inner :border-bottom 2px solid ,base1
(span :border-bottom 2px solid ,base1)
(.atom-inner.point (span :color ,base3
:background ,base1)))))))))
:basic
(``((|#main|
(.portal
(.view
(.main
;; :margin 0 4em 0 16em
:position relative
;; (.status
;; :margin 0 0 6px
;; :padding 3px 14px
;; :position absolute
;; :width 100%
;; :background "#2e3135"
;; :color "#d1d5da"
;; :opacity 0.8
;; :z-index 800
;; (.text :font-size 0.9em
;; :font-weight bold
;; :font-family monospace
;; :display none))
;; ((:and .status :hover)
;; (.text :display inline))
;; (.focus
;; (.status
;; :background "#888"
;; :color "#fff"))
(.branches
:position relative
;; styles for the top-level branch display elements
(.container
;; :width 100%
:height 100%
:padding 8px; 24px
:margin 0
:max-width 100%
(.column-outer :padding-left 0
:padding-right 8px
:display flex
:flex-direction column)
((:and .column-outer :last-child) :padding-right 0)
(.portal-column
:height 100%
:padding 8px ;0 2px 0 0
(.header
:position relative
;; :color "#93a1a1"
;; :background "repeating-linear-gradient(0deg, #93a1a1, #93a1a1 2px, #073642 2px, #073642 40px)"
;; :background "linear-gradient(0deg, #93a1a1 2px, #073642 2px)"
:height 38px
:font-family monospace
:padding 0 6px
:margin 0 2px
(.branch-info
:height 100%
(.locked-indicator
:float right
:font-weight bold
:color "#dc322f")))
(.footer :margin 0 2px)
(span.id
:font-size 1.25em
:line-height 40px)
(.holder :height "calc(100% - 72px)"
:position relative
:margin 0 2px)
(.canvas-container :height 100%
:width 100%))
((:or .portal-column.form .portal-column.spreadsheet)
(.pane :padding-right 2px))
(.row
((:and .vista :last-child)
(.portal-column :padding 0))))
((:or .footer .sub-header)
:height 30px
(.inner :padding 4px
:text-align right
:font-family monospace
(span.title :padding 0 4px)
(span :cursor pointer)))
(.sub-header (.inner :padding-top 4px
(.form-view :text-align left)))
(div.pane.with-sub-header :height "calc(100% - 30px)")
(div.pane
:background "#fdf6e3"
:position relative
;;:height "calc(100% - 40px)"
:height 100%
:margin 0
:overflow auto)))))))))
(specify-css-styles
css-form-view
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:by-palette (``((.matrix-view
(table.form
(.atom
:border-bottom-color ,base2
(.content (.package-tag :background ,base2)))))))
:basic
(``((|#main|
(.portal
(.view
(.main
(.branches
(div.pane
(.form-view :height 100%
:padding 2px 0
(table.form.root :margin-bottom 2px))
;; styles for popover menus
(.form-view.menu-popover
:height auto
:border "2px solid rgba(0, 0, 0, 0.2)"
:padding 0
:margin-left 2.2em
:margin-top -1.9em
(.arrow :display none)
(.popover-content
:padding 4px
(.form-view
:margin 0
:padding 0
(ul.in :list-style-type none
(li :border-bottom 1px solid "#dadde2" ;"#e8ded0"
:cursor pointer
(.point
(.content
(.title
:color red))))))))
;; form view styles
(.matrix-view
(table.form
(td
:vertical-align top
:position relative
:-moz-box-sizing border-box
:box-sizing border-box)
((:and td :|not(:last-child)|)
:white-space nowrap)
((:and td :last-child)
:width 100%)
((:and td.point :last-child)
:border-right "2px solid #D9D4C5")
;; ((:and td.point :last-child :after)
;; :content " "
;; :width 3px
;; :height 5px
;; :background red)
(tr (.atom :border-bottom-width 1px
:border-bottom-style solid)
(.atom.custom-interface :border-bottom none)
(.atom.last :border-bottom none))
;; styles for areas affected by macros
(.reader-context-quasiquote
:background "rgba(200,99,99,0.065)")
((:and .reader-context-quasiquote .reader-context-start)
:background "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' version='1.1'><g style='fill:#916f6f;fill-opacity:1'><path style='fill:#916f6f;fill-opacity:0.3;stroke:none' d='M 0,3 2.9999998,-1e-7 12,9 9.0000005,12 z'/></g></svg>\"), linear-gradient(90deg, rgba(145,111,111,0.3) 4px, rgba(200,99,99,0.065) 4px)"
:background-repeat no-repeat
:background-position "bottom 2px right 6px, 0 0")
(.reader-context-unquote
:background "#fdf6e3")
((:and .reader-context-unquote .reader-context-start)
:background "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' version='1.1'><g style='fill:#916f6f;fill-opacity:1'><path style='fill:#073642;fill-opacity:0.2;stroke:none' d='M 12,3 9.0000002,-1e-7 0,9 2.9999995,12 z'/></g></svg>\"), linear-gradient(90deg, rgba(7,54,66,0.15) 4px, #fdf6e3 4px)"
:background-repeat no-repeat
:background-position "bottom 2px right 6px, 0 0")
(.reader-context-unquote-splicing
:background "#fdf6e3")
((:and .reader-context-unquote-splicing .reader-context-start)
:background "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='12' version='1.1'><g style='fill:#916f6f;fill-opacity:1'><path style='fill:#073642;fill-opacity:0.2;stroke:none' d='M 12,3 9.0000002,-1e-7 0,9 2.9999995,12 z'/><path style='fill:#073642;fill-opacity:0.2;stroke:none' d='m 16.964286,8.875 a 2.5892856,2.5892856 0 1 1 -5.178572,0 2.5892856,2.5892856 0 1 1 5.178572,0 z' transform='matrix(1.1724138,0,0,1.1724138,-4.2271792,-2.5646177)'/></g></svg>\"), linear-gradient(90deg, rgba(7,54,66,0.15) 4px, #fdf6e3 4px)"
:background-repeat no-repeat
:background-position "bottom 2px right 6px, 0 0")
(.atom
(.editor
(input
:outline none
:position absolute
:color "#586e75"
:font-family monospace
:background none
:border none
:width 100%
:line-height 1em))
(.content
:margin 0 8px 0 9px
:font-family monospace
:min-height 17px
:line-height 17px
(.package-tag
:color "#268bd2"
:cursor help
:font-size 0.75em
:line-height 1em
:padding 0 2px
:border-radius 0 6px 6px 6px
;; :background "#eee8d5"
:opacity 0.6
:margin-left 2px
(span (.seed-symbol
(.divider :display none)
((:or .m .ll)
:display none)
((:and span :|not(:first-child)|)
(.fl :text-transform none))
(span.leading
(.fl :text-transform none))
((:and span.leading :|not(:first-child)|)
(.fl :color "#cb4b16"))))
(span.native :display none))
(.package-tag.mini
:font-size 0.9em
:margin 0 0 0 2px
:border-radius 3px 3px 3px 0)
(.package-tag.native
:color "#cb4b16"
:background "#cb4b16"
:height 8px
:width 8px
:border-radius 0 3px 3px 3px
:display block
(span :display none)
(span.native :display inline))
(.package-tag.native.mini
:display inline
:background none
:font-size 0.7em
:opacity 0.3
:margin 0
:border-radius 3px 3px 3px 0)
(.package-tag (.common :display none)))
((:and .package-tag :hover)
:opacity 1)
(.point-marker
:position absolute
:bottom 0
:right 0
:height 4px
:width 4px
:background "#fdf6e3")
(.meta-comment
:margin 0 4px 0 0
:padding 0 6px
:line-height 1.2em
:font-size 0.8em
:background aliceblue
:border-right "2px solid #93a1a1"
:color cadetblue
:position absolute
:bottom 0
:right 0
(input :border none
:outline none
:background none
:color inherit))
(.rgb-control
:height 16px
:width 24px
:border-radius 8px
:float left
:border "2px solid #ccc")
(.rgb-string
:line-height 1.5em
:color "#6c71c4"))
(.info-tabs
(span :padding 3px
:background "#ededed"
:border "1px solid #dadde2"
:border-bottom none
:border-radius 4px 4px 0 0)
(.title :float left)
(.remove :float right
:padding 3px 9px
:cursor pointer))
(.atom.point
(.meta-comment.focus :border-left "2px solid #93a1a1"))
(.atom.singleton
(.content
(span.title :padding-right 4px
:border-right "1.6px solid #93a1a1")))
;; ((:or .atom.mode-set.point .cell.mode-set.point)
;; (.text :opacity 0)
;; (.title :opacity 0)
;; (.editor :display block
;; :float left))
(.atom.point.active
;; :background "repeating-linear-gradient(0deg, #eee8d5, #eee8d5 6px, #fdf6e3 6px, #fdf6e3 40px)"
:background "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='50'><rect fill='%23eee8d5' x='0' y='21' width='100%' height='8px'/></svg>\")"
:background-repeat repeat-y repeat-x
:background-position 0px 0px
;; :animation "animatedBackground 3s linear infinite"
;; :animation "animatedBackground 3s cubic-bezier(0, 0.5, 1, 1) infinite"
;; :-ms-animation "animatedBackground 10s linear infinite"
;; :-moz-animation "animatedBackground 10s linear infinite"
;; :-webkit-animation "animatedBackground 10s linear infinite"
)
((:or .atom.point .cell.point) :background "#eee8d5")
(.form-value.current :background "#eee8d5")
((:or td.sub-table td.special-table)
:padding 0
:position relative
(.spacer
:width 12px
:height 100%
:float left)
(table
:width "calc(100% - 12px)"))
(td.sub-table.point
:linear-gradient "90deg, #eee8d5, #eee8d5 12px, rgba(0,0,0,0), rgba(0,0,0,0) 12px"
:border-right none
)
))
;; spreadsheet view styles
(.spreadsheet-view
:margin 3px 6px 0 2px
(table.form
(thead
(th :border-left 1px solid "#eee8d5"
:border-bottom 1px solid "#eee8d5"
:text-align left)
((:and th :first-child)
:border-left none))
(th :color "#586e75"
:font-family monospace
:border-right 1px solid "#eee8d5"
:border-bottom 1px solid "#eee8d5"
:text-align right
;:height 20px
:padding 0 4px)
(tbody
(:td :height 20px)
((:and tr :last-child)
((:or th td)
:border-bottom none)))
(.atom
:border 1px solid "#eee8d5"
:min-width 52px
:text-align right
(.editor :float left)
(.content
:margin 0 1px
:padding 0 0px
:position relative
;:background "repeating-linear-gradient(to right, #93a1a1, #93a1a1 1px, transparent 1px, transparent 2px)"
;; :background "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAQCAYAAAAxtt7zAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QgfBgknWYMcHwAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAZSURBVBjTY5i8cOF/BgYGBhjNxIAGRpYAAO3DBcdsmHSyAAAAAElFTkSuQmCC') transparent"
:background-size 0 100%
:background-repeat no-repeat
(.text :color "#839496"
:margin-right 2px)
(.overridden-text :float left
:margin 0 12px 0 0
:color "#dc322f"))
(.content.input
(.text :color "#268bd2"))
(.content.computed-input
(.text :color "#859900"))
(.content.type-function
(.text :color "#6c71c4")))
(.atom.mode-set.point
(.overridden-text :display none))
(.content
((:and .text :before)
:position absolute
:top -2px
:left 0
:transform "rotate(90deg)"
:transform-origin left top 0
:margin 0 0 0 1em
:letter-spacing -2px
:float left))
(.content.it-2
((:and .text :before)
:content "."))
(.content.it-3
((:and .text :before)
:content ".."))
(.content.it-4
((:and .text :before)
:content "..."))
(.content.it-5
((:and .text :before)
:content "...."))
(.content.it-6
((:and .text :before)
:content ":..."))
(.content.it-7
((:and .text :before)
:content "::.."))
(.content.it-8
((:and .text :before)
:content ":::."))
(.content.it-9
((:and .text :before)
:content "::::"))
(.atom.active
:text-align left)
((:and .atom :last-child)
:border-right none)))
(svg.dendroglyphs :position absolute
:height 100%
:width 100%
:pointer-events none
(.glyph (path :fill none
:stroke "#93a1a1"
:stroke-width 1.6))
(.glyph-shadow (path :fill none
:stroke "#fdf6e3"
:stroke-width 2.4))
(.point (.glyph (path :stroke "#073642")))
:z-index 500))))))))))
(specify-css-styles
css-form-view-interface-elements
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:by-palette (``((.item-interface-holder
:color ,base00
:background-color ,base3
:border-color ,base2
:|box-shadow| ,(format nil "2px 2px 0px ~aaa" base1))
((:or .list-interface-holder .menu-holder .item-interface-holder)
:color ,base0
(.navbar :color ,base00
:background-color ,base3
:border-color ,base2
(.main :border-color ,base2))
(.main ((:and .title :hover)
:background-image ,(format nil "-webkit-repeating-linear-gradient(-45deg, ~a33, ~a33 25%, transparent 25%, transparent 50%, ~a33 50%)" base1 base1 base1)
:background-image ,(format nil "-moz-repeating-linear-gradient(-45deg, ~a33, ~a33 25%, transparent 25%, transparent 50%, ~a33 50%)" base1 base1 base1)
:background-image ,(format nil "-mz-repeating-linear-gradient(-45deg, ~a33, ~a33 25%, transparent 25%, transparent 50%, ~a33 50%)" base1 base1 base1)
:background-image ,(format nil "-o-repeating-linear-gradient(-45deg, ~a33, ~a33 25%, transparent 25%, transparent 50%, ~a33 50%)" base1 base1 base1)
:background-image ,(format nil "repeating-linear-gradient(-45deg, ~a33, ~a33 25%, transparent 25%, transparent 50%, ~a33 50%)" base1 base1 base1)))
(button :color ,base00
:background-color ,base3
:border-color ,base2
(.button-detail :border-color ,base1))
(.select-control
:color ,base00
:background-color ,base2
:border-right-color ,base1))
(|.list-interface-holder > .navbar|
:|box-shadow| ,(format nil "2px 2px 0px ~aaa" base1))
(.textfield-holder
:color ,base00
:border-color ,base2
:background-color ,base3
:|box-shadow| ,(format nil "2px 2px 0px ~aaa" base1)
(.input-wrapper
:border-color ,base2
(input :border-color ,base1))
(.input-group-append
:background ,base2
(.label-holder :color ,base0
:border-color ,base1)))
(.textarea-holder
:color ,base00
:border-color ,base2
(input.textarea
:background-color ,base3))
(.menu-holder
(.dropdown.btn-group
:|box-shadow| ,(format nil "2px 2px 0px ~aaa" base1)
(button :border-color ,base2)))))
:basic
(``((|#main|
(.portal
(.form-view
(|.item > .content > table > tbody > tr > td|
:padding 0)
(.item-interface-holder
:margin 6px 12px 0 12px
:padding 0
:min-height 1.6rem
:border-radius 0
:border-width 0 0 1px 4px
:border-style solid)
(.list-interface-holder
(.navbar :margin 6px 12px 0 12px
:padding 0
;; :min-height 1.8em
:border-radius 0
:border-width 0 0 1px 4px
:border-style solid))
((:or .list-interface-holder .menu-holder .item-interface-holder)
(.dropdown.btn-group
(button :border-width 0 1px 0 0
:border-radius 0
:border-style solid
:padding 0.2rem 0.6rem))
(.dropdown.open.btn-group
(.dropdown-menu :display block))
(.main
:height 1.6rem
:flex 1 1 auto
:border-style solid
:border-width 0
:margin 0
(.sortable-glyph :float left
:padding-top 1px)
(.remove :float right :cursor pointer
:padding-top 3px)
(.title :float left
:margin 2px 0 0 0
:padding 2px 0 2px 2px
:cursor grab
:width 80%)
((:and .title :hover)
:background-size 4px 4px)
(.list-label :float right)
(.list-info
:float right
:padding 8px 0
(.remove :margin-left 8px
:padding-top 3px))
(.select
:width 40%
:float left
;; (.select-control
;; :background-color "#fafafa"
;; :border-color "#dadde2"
;; :margin 2px 0
;; :border-radius 0 4px 4px 0
;; :border-left none)
(.select-control
:margin 2px 0
:border-radius 0
:border-width 0
:border-right-width 2px)))
(.btn-group.toggle
:float left
:margin 0
(button :width 3em
:height 1.6rem
:border-width 0
:border-radius 0
:position relative
(.button-detail :position absolute
:bottom 2px
:right 2px
:height 5px
:width 5px
:border-style solid
:border-width 1px 0 0 1px))
((:and button :active)
(.button-detail :top 2px
:left 2px
:border-width 0 1px 1px 0)))
(.list-info))
(.item-interface-holder.with-toggle
(.main :border-width 0 0 0 1px))
(.textfield-holder
(.input-wrapper
:padding 4px
:border-style solid
:border-width 0 0 1px 2px
:border-radius 0
:height auto
:background none
(input.textfield
:border-radius 0
:width "calc(100% - 6px)"
:background none
:border-width 0 0 0 1px
:border-style solid
:margin 0
:padding 0 4px))
(.input-group-append
:border-radius 0
:border-width 0
:border-left-width 1px
:padding 3px 6px
(.label-holder.input-group-text
:padding 0 0 0 6px
:border-width 0 0 1px 0
:border-style solid
:background none
:border-radius 0)))
(.textarea-holder
(textarea
:resize none
:width 100%
:margin 3px 0 3px 12px
:border-style solid
:margin 0
:padding 4px
:border-radius 0))
(.menu-holder
(.dropdown.btn-group
(button :width 100%
:border-width 1px 2px 1px 4px
:border-radius 0
:border-style solid))
(.dropdown.btn-group.open (.dropdown-menu :display block)))
))))))
;; (specify-css-styles
;; css-form-view-interface-elements
;; (with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
;; yellow orange red magenta violet blue cyan green))
;; :by-palette (``(((:or .list-interface-holder .menu-holder .item-interface-holder)
;; (.panel :background-color ,base3
;; :border-left-color ,base2)
;; (button :border-left--color ,base2)
;; (.select-control
;; :background-color ,base2
;; :border-right-color ,base1))))
;; :basic
;; (``((|#main|
;; (.portal
;; (.view
;; (.main
;; (.branches
;; (div.pane
;; (.form-view
;; ((:or .list-interface-holder .menu-holder .item-interface-holder)
;; (.panel
;; :width "calc(100% - 12px)"
;; :margin 3px 0 3px 12px
;; :border-width 0
;; :border-radius 0
;; :border-left-width 2px
;; (.panel-body
;; :padding 4px 8px 4px 0
;; (.panel-heading
;; :padding 0
;; (.handle
;; :float left
;; :height 20px
;; :width 24px
;; :cursor grab
;; :margin 0 0 0 4px
;; :background-image "-webkit-repeating-linear-gradient(-45deg, rgba(0,0,0,0.20), rgba(0,0,0,0.20) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.20) 50%)"
;; :background-image "-moz-repeating-linear-gradient(-45deg, rgba(0,0,0,0.20), rgba(0,0,0,0.20) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.20) 50%)"
;; :background-image "-ms-repeating-linear-gradient(-45deg, rgba(0,0,0,0.20), rgba(0,0,0,0.20) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.20) 50%)"
;; :background-image "-o-repeating-linear-gradient(-45deg, rgba(0,0,0,0.20), rgba(0,0,0,0.20) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.20) 50%)"
;; :background-image "repeating-linear-gradient(-45deg, rgba(0,0,0,0.20), rgba(0,0,0,0.20) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.20) 50%)"
;; :background-size 4px 4px)))
;; (.remove :float right :cursor pointer)
;; (.title :float left
;; :margin-left 8px)
;; (.list-label :float right)
;; (.list-info
;; :float right
;; :padding 8px 0
;; (.remove :margin-left 8px))
;; (.select
;; :width 40%
;; :float left
;; (.select-control
;; :margin 2px 0
;; ;; :border-radius 0 4px 4px 0
;; :border-radius 0
;; :border-width 0
;; :border-right-width 2px))
;; (.item-interface-holder
;; :margin 6px 0 0 12px
;; (.panel :float left
;; :width "calc(100% - 12px)"
;; :height 1.8em
;; :margin 0)
;; (.btn-group.toggle
;; :float left
;; :margin 0
;; (button :width 3em
;; :height 1.8em
;; :background "#fff"
;; ;; :border "1px solid #ddd"
;; :border-width 0
;; ;; :|box-shadow| "0 1px 1px rgba(0,0,0,.05)"
;; ;; :border-radius 4px 0 0 4px
;; :border-radius 0))
;; ;; ((:and .btn-group :|:first-child|)
;; ;; (button :border-left-width 2px))
;; (.item-interface-holder.with-toggle
;; (.panel :width "calc(100% - 12px - 3em)"
;; :border-radius 0 4px 4px 0
;; :border-left none))
;; (.textfield-holder
;; (input.textfield
;; :background-color "#fafafa"
;; :border "1px solid #dadde2"
;; :border-radius 2px
;; :width "calc(100% - 6px)"
;; ;; :margin 1px 0 0 6px
;; :margin 0 0 0 6px
;; :padding 4px 8px))
;; (.textarea-holder
;; (textarea
;; :resize none
;; :width 100%
;; :margin 3px 0 3px 12px
;; :background-color "#fafafa"
;; :border-color "#dadde2"
;; :margin 0
;; :padding 4px
;; :border-radius 0 4px 4px 4px)))))))))))
(specify-css-styles
css-glyph-display
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:by-palette (``((.icon :color ,base0
(.spot :color ,red
:text-shadow 2px 2px ,base3)
(.backdrop :color ,base2))))
:basic
(``((|#main|
(.portal
(.view
((:or div.icon-holder div.icon.simple) :display inline)
(div.icon
;; :display inline
:position relative
:width 2em
(.main :margin 0
:position absolute
:z-index 200
(.material-icons :font-size 1em))
(.hint
:z-index 500
:position absolute
:top 0.4em
:left -0.2em
(.material-icons :font-size 0.6em))
(.backdrop
:z-index 100
:position absolute
(.material-icons :font-size 1em)
;; :right -0.2em
;; :top -0.2em
)
(div :display inline))))))))
(specify-css-styles
css-text-view
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:basic
(``((|#main|
(.portal
(.view
(.main
(.branches
(.portal-column.text
(.text-pane-outer
:height 100%
(.reactcodemirror
:height "calc(100% - 30px)"
(.codemirror :height 100%
:|box-shadow| none
:background transparent))
;;(.status-bar :height 30px)
))
(.portal-column.document
(.document-pane-outer
:height 100%
(.slate-editor-pane
:height "calc(100% - 30px)"
:padding 4px 6px
:color "#002b36"
:font-size 16px
:letter-spacing 0.03em
(div.node-holder
(div.glyph :cursor pointer :height "calc(3px + 1em)" :width 16px :float left
:background "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='20' version='1.1'><g transform='translate(0,3)'><rect style='fill:%23839496;fill-opacity:1;stroke:none' x='0' y='0' width='2' height='15' /></g></svg>\") no-repeat")
(blockquote :font-size 1.2em
:margin 6px 0 6px 6px
:padding 6px 0 6px 18px
:border-left "4px solid #eee8d5")
((:or ul ol) :margin 8px 0))
(div.node-holder.p (div.node :margin-left 16px))
;; ((:and div :before)
;; :content "."
;; :padding-right 16px
;; :opacity 0
;; :cursor pointer
;; ;:background "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' version='1.1'><rect fill='%23eee8d5' x='0' y='21' width='100%' height='8px'/></svg>\")"
;; )
)
(.status-bar :height 30px)))
(.portal-column.html-element
(.html-display
:background "#fefefa"
:padding 12px
:font-family "Verdana"
(svg :height 100%
:width 100%)))
)))))
)))
(specify-css-styles
css-symbol-style-camel-case
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:basic
(``((.seed-symbol
((:and span :|not(:first-child)|)
(.fl :text-transform uppercase))
(span.leading (.fl :text-transform none))
(span.divider :opacity 0.5)
((:and span.divider :before)
:content ".")))))
(specify-css-styles
css-symbol-style-dash-separated
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:basic
(``((.seed-symbol
((:and span :|not(:first-child)|)
((:and .fl :before)
:content "-"
:opacity 0.75))
(span.leading
((:and .fl :before)
:display none))
(span.divider :opacity 0.5)
((:and span.divider :before)
:content ".")))))
(specify-css-styles
css-symbol-style-underscore-separated
(with (:palette-symbols base3 base2 base1 base0 base00 base01 base02 base03
yellow orange red magenta violet blue cyan green))
:basic
(``((.seed-symbol
((:and span :|not(:first-child)|)
((:and .fl :before)
:content "_"
:opacity 0.75))
(span.leading
((:and .fl :before)
:display none))
(span.divider :opacity 0.5)
((:and span.divider :before)
:content ".")))))
(defmacro point-casters (&rest plots)
"Create the styles for the divs used to cast the scrolling multiple shadows."
(loop :for index :from 0 :to (1- (length plots))
append `((,(intern (format nil "#star-caster-~d" index))
:width ,(format nil "~dpx" (getf (nth index plots) :size))
:height ,(format nil "~dpx" (getf (nth index plots) :size))
:background transparent
:animation ,@(getf (nth index plots) :animation)
:|box-shadow| ,(getf (nth index plots) :plot))
((:and ,(intern (format nil "#star-caster-~d" index))
:after)
:content " "
:position absolute
:right 2000px
:width ,(format nil "~dpx" (getf (nth index plots) :size))
:height ,(format nil "~dpx" (getf (nth index plots) :size))
:background transparent
:animation ,@(getf (nth index plots) :animation)
:|box-shadow| ,(getf (nth index plots) :plot)))))
(defmacro css-animation-silicon-sky ()
"Plot a field of scrolling dots, some grouped into rectangular arrays."
(flet ((scatter-stars (star-count &rest params)
(let ((mode-data nil)
(spread-points nil))
(labels ((plot-dots (count &optional output)
;; plot dots, either randomly or in an array pattern
(if (< 0 count)
(let* ((gen-params (getf params :array))
(coords (if spread-points
(let ((pt (first spread-points)))
(setq spread-points (rest spread-points))
pt)
(list (funcall (getf params :x-range))
(funcall (getf params :y-range)))))
(current-mode (first mode-data)))
(if gen-params
(if current-mode
(cond ((eq :array (getf current-mode :mode))
(macrolet ((dims () `(getf current-mode :dims))
(origin () `(getf current-mode :origin))
(space () `(getf current-mode :space)))
(if (dims)
(setf coords (list (+ (first (origin))
(* (space) (first (dims))))
(+ (second (origin))
(* (space) (1- (length (dims))))))
(dims) (if (= 0 (first (dims)))
(rest (dims))
(cons (1- (first (dims)))
(rest (dims)))))
(setf mode-data (rest mode-data))))))
(if (funcall (getf gen-params :block-chance))
(let ((width (funcall (getf gen-params :block-width)))
(height (funcall (getf gen-params :block-height)))
(space (funcall (getf gen-params :block-space)))
(x-origin (funcall (getf params :x-range)))
(y-origin (funcall (getf params :y-range))))
;; don't generate a block if there aren't enough points left
;; in the count to fill it completely
(if (> count (1+ (* width height)))
(setq mode-data
(cons (list :mode :array
:space space
:dims (loop for n from 0 to height
collect width)
:origin (list x-origin y-origin))
mode-data)))))))
(plot-dots (1- count)
(format nil "~a~dpx ~dpx #fff~a"
(if output output "")
(first coords)
(second coords)
(if (< 1 count)
", " ""))))
output)))
(plot-dots star-count)))))
`(quote ("
@keyframes anim-sky1 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
@keyframes anim-sky2 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
@keyframes anim-sky3 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
@keyframes anim-sky4 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
@keyframes anim-sky5 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
@keyframes anim-sky6 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
@keyframes anim-sky7 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
@keyframes anim-sky8 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
@keyframes anim-sky9 {
from { transform: translateX(0px); }
to { transform: translateX(-2000px); }}
"
(.intro-animation
:background "#6f7c91"
:height 100%
:width 100%
:z-index -1000
:position relative
;; :margin-left 16em
:overflow hidden
(.title :color "#fff"
:font-size 1.2em
:margin 0
:padding 4px 2px
:font-family monospace
:position absolute
:bottom 0
:left 4px
:text-align right)
(.animation-inner
:height 100%
:width 100%
:-moz-transform "scale(1, -1)"
:-webkit-transform "scale(1, -1)"
:-o-transform "scale(1, -1)"
:-ms-transform "scale(1, -1)"
:transform "scale(1, -1)"
,@(macroexpand `(point-casters
(:plot
,(scatter-stars 400 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 60 (random 1000))))
:size 1
:animation (anim-sky1 320s linear infinite))
(:plot
,(scatter-stars 60 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 120 (random 1000))))
:size 2
:animation (anim-sky2 440s linear infinite))
(:plot
,(scatter-stars 30 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 200 (random 1000))))
:size 3
:animation (anim-sky3 680s linear infinite))
(:plot
,(scatter-stars
1200 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 20 (random 80) (random 120) (random 120)))
:array (list :block-width (lambda () (+ 3 (random 6) (random 6) (random 6)))
:block-height (lambda () (+ 2 (random 3) (random 6)))
:block-chance (lambda () (= 0 (+ (random 2))))
:block-space (lambda () (+ 4 (random 10) (random 3) (random 3)))))
:size 1
:animation (anim-sky4 220s linear infinite))
(:plot
,(scatter-stars
250 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 60 (random 40) (random 60) (random 200)))
:array (list :block-width (lambda () (+ 3 (random 3) (random 3) (random 3)))
:block-height (lambda () (+ 3 (random 3) (random 3)))
:block-chance (lambda () (= 0 (+ (random 2) (random 2))))
:block-space (lambda () (+ 10 (random 8) (random 8) (random 8)))))
:size 2
:animation (anim-sky5 340s linear infinite))
(:plot
,(scatter-stars
95 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 260 (random 600)))
:array (list :block-width (lambda () (+ 1 (random 2) (random 6)))
:block-height (lambda () (+ 1 (random 2) (random 4)))
:block-chance (lambda () (= 0 (+ (random 2) (random 2))))
:block-space (lambda () (+ 8 (random 10) (random 10) (random 10)))))
:size 3
:animation (anim-sky6 500s linear infinite))
(:plot
,(scatter-stars
1200 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 20 (random 80) (random 180) (random 180)))
:array (list :block-width (lambda () (+ 3 (random 6) (random 6) (random 6)))
:block-height (lambda () (+ 2 (random 3) (random 6)))
:block-chance (lambda () (= 0 (+ (random 2))))
:block-space (lambda () (+ 4 (random 10) (random 3) (random 3)))))
:size 1
:animation (anim-sky4 320s linear infinite))
(:plot
,(scatter-stars
400 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 200 (random 240) (random 240)))
:array (list :block-width (lambda () (+ 3 (random 12) (random 12)))
:block-height (lambda () (+ 2 (random 8) (random 8)))
:block-chance (lambda () (= 0 (+ (random 2))))
:block-space (lambda () (+ 4 (random 24) (random 3) (random 24)))))
:size 1
:animation (anim-sky8 800s linear infinite))
(:plot
,(scatter-stars
50 :x-range (lambda () (random 3000))
:y-range (lambda () (+ 60 (random 160) (random 120) (random 160)))
:array (list :block-width (lambda () (+ 3 (random 4) (random 4) (random 8)))
:block-height (lambda () 0)
:block-chance (lambda () (= 0 (+ (random 2))))
:block-space (lambda () (+ 4 (random 24) (random 3) (random 24)))))
:size 2
:animation (anim-sky9 200s linear infinite))))))))))
| 44,954
|
Common Lisp
|
.lisp
| 1,335
| 27.991011
| 569
| 0.607501
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
d29c4a95383c5439002f1d18f45fbe839b0d194a75c23acaaf08c3e571934d91
| 2,698
|
[
-1
] |
2,699
|
extension.lisp
|
phantomics_seed/seed.ui-spec.css.base/extension.lisp
|
;;;; extension.lisp
(in-package #:seed.ui-model.css)
(export 'css-base)
(export 'css-overview)
(export 'css-adjunct)
(export 'css-column-view)
(export 'css-form-view)
(export 'css-form-view-interface-elements)
(export 'css-text-view)
(export 'css-glyph-display)
(export 'css-font-spec-ddin)
(export 'css-symbol-style-dash-separated)
(export 'css-symbol-style-underscore-separated)
(export 'css-symbol-style-camel-case)
(export 'css-animation-silicon-sky)
| 458
|
Common Lisp
|
.lisp
| 15
| 29.333333
| 47
| 0.772727
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
5ffdadc601a59608d66a1f1dd6cd2a15210b0951c7a54f6e92f669c482cd7537
| 2,699
|
[
-1
] |
2,700
|
main.lisp
|
phantomics_seed/demo-drawing/main.lisp
|
(IN-PACKAGE #:DEMO-DRAWING)
(GEN-SVG
(:G :ID "group1"
(:RECT :X 228 :Y 82 :HEIGHT 100 :WIDTH 40 :FILL
(META "#195e19" :MODE (:VIEW :COLOR-PICKER :OUTPUT :HTML-RGB-STRING)))
(:ELLIPSE :CX 245 :FILL
(META "#CC4B4B" :MODE
(:VIEW :SELECT :OPTIONS
((:VALUE "#CC4B4B" :TITLE "Faded Red")
(:VALUE "#C80000" :TITLE "Dark Red"))))
:CY 320 :RX 100 :RY 100))
(META
(:G :ID "group2"
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX 453.0
:CY 300.0)
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX
452.20193 :CY 303.42932)
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX 447.6961
:CY 305.03406)
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX
442.55453 :CY 301.0613)
(:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE" :CX 443.322
:CY 292.26807)
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX 453.9369
:CY 286.69128)
(:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE" :CX 468.1028
:CY 294.73196)
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX
469.30896 :CY 316.82675)
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX
444.93762 :CY 334.4226)
(:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE" :CX
406.93576 :CY 319.47864)
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX
396.12573 :CY 265.07004)
(:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE" :CX
450.38602 :CY 212.77837)
(:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00" :CX
549.98663 :CY 236.42252)
(:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE" :CX
596.06354 :CY 367.6305))
:MODE
(:VALUE NIL :FORMAT :SPIRAL-POINTS-EXPAND :MODEL
(SPIRAL-POINTS 450 300
(META
((META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VIEW :ITEM :TITLE "Small Green Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VIEW :ITEM :TITLE "Small Green Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VIEW :ITEM :TITLE "Small Green Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL)))
:MODE
(:OPTIONS
((:VALUE
(META
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE (:VIEW :ITEM :TITLE "Small Green Circle" :REMOVABLE T))
:TITLE "Small Green Circle")
(:VALUE
(META
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE (:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T))
:TITLE "Big Blue Circle"))
:REMOVABLE NIL :FILL-BY :SELECT :VIEW :LIST :MODEL
((META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VIEW :ITEM :TITLE "Small Green Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VIEW :ITEM :TITLE "Small Green Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VIEW :ITEM :TITLE "Small Green Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL))
(META ((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:MODE
(:VALUE NIL :MODEL
((:CIRCLE :R 3 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#88AA00"))
:REMOVABLE T :TITLE "Small Green Circle" :VIEW :ITEM))
(META ((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:MODE
(:VIEW :ITEM :TITLE "Big Blue Circle" :REMOVABLE T :MODEL
((:CIRCLE :R 5 :STROKE-WIDTH 2 :STROKE "#E3DBDB" :FILL "#87AADE"))
:VALUE NIL)))
:VALUE NIL))))))
(LET ((A 1) (B 2))
(+ (* A 3) (+ B 1)))
(LIST #\a T NIL (CAR (CDR (LIST 1 2))))
| 9,702
|
Common Lisp
|
.lisp
| 202
| 40.485149
| 79
| 0.575263
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
cb2ca8d4979b1b212545d759db228a98e6b7f11e546b5d5ddd202cc1fc8b09a3
| 2,700
|
[
-1
] |
2,701
|
format.lisp
|
phantomics_seed/demo-drawing/format.lisp
|
;;;; format.lisp
(in-package #:demo-drawing)
(defmacro define-stream (symbol)
`(defvar ,symbol (make-string-output-stream)))
(defmacro gen-svg (&rest form)
(let ((stream-symbol (gensym)))
`(let ((,stream-symbol (make-string-output-stream)))
(defvar svg-content)
(cl-who:with-html-output (,stream-symbol)
(:svg ,@form))
(setq svg-content (get-output-stream-string ,stream-symbol)))))
;; (defmacro gen-svg (&rest form)
;; (let ((stream-symbol (gensym)))
;; (fare-quasiquote:quasiquote
;; (progn (defvar svg-content)
;; (defvar (fare-quasiquote:unquote stream-symbol)
;; (make-string-output-stream))
;; (cl-who:with-html-output ((fare-quasiquote:unquote stream-symbol))
;; (:svg (fare-quasiquote:unquote-splicing form)))
;; (setq svg-content (get-output-stream-string (fare-quasiquote:unquote stream-symbol)))))))
(defmacro rgb-hex-string (color-string) color-string)
(defun fibo-plotter (x y scale iterations)
(let ((e 2.7182818284))
(flet ((e-process (value) (expt e (* value 0.30635))))
(loop for index from 0 to (1- iterations)
collect (list (+ x (* (e-process index)
scale (cos index)))
(+ y (* (e-process index)
scale (sin index))))))))
(defmacro spiral-points-expand (items)
(let ((center-x (second items)) (center-y (third items)))
`(:g :id "group2" ,@(mapcar (lambda (point spiral-coordinate)
(append point (list :cx (first spiral-coordinate)
:cy (second spiral-coordinate))))
(mapcar #'first (fourth items))
(fibo-plotter center-x center-y 3 (length (fourth items)))))))
| 1,631
|
Common Lisp
|
.lisp
| 36
| 41.166667
| 97
| 0.649874
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
37c3ceb8b1a3126a1cc5f8d1df185cd46dcadbc776dc158c00b9e4e105942e1a
| 2,701
|
[
-1
] |
2,702
|
vector.base.lisp
|
phantomics_seed/seed.ui-effects.vector.base/vector.base.lisp
|
;;;; vector.base.lisp
(in-package #:seed.ui-model.react)
(defvar title-text-standard)
(setq title-text-standard
`(lambda (interface)
(let ((text-xoffset-expandable (* 1.7 (@ interface params section)))
(text-xoffset-unexpandable (* 1.1 (@ interface params section)))
(text-yposition 4.8))
(chain interface node-enter (append "text")
(attr "class" "text")
(attr "dy" text-yposition)
(attr "x" (lambda (d) (if (chain interface params visualizer-logic (node-has-children d))
text-xoffset-expandable text-xoffset-unexpandable)))
(text (lambda (d) (if (@ d data meta) (@ d data meta title))))))))
(defvar circle-icon-standard)
(setq circle-icon-standard
`(lambda (interface)
(let* ((section (@ interface params section))
(main-radius (/ (* 0.8 section) 2))
(outmost-radius (/ (* 0.95 section) 2))
(inner-circle-radius-factor (* 0.8 section))
(spoke-radius (/ (* 0.73 section) 2))
(inner-spoke-width (/ section 12))
(outer-dot-radius (/ (* 0.85 section) 2))
(outer-band-radius (/ (* 0.82 section) 2))
(outer-arc-point-radius (/ (* 1.025 section) 2))
(icon-path-x-offset (* 0.65 section))
(icon-path-y-offset (* -1.85 section))
(text-frame-indent (/ (* 0.875 section) 2))
(text-frame-height (* 0.75 section))
(text-frame-border-radius (/ (* 0.75 section) 2)))
(flet ((manifest-inner-circle-radius (value)
;; get radius of inner circle - represents fraction metadata
(/ inner-circle-radius-factor (+ 2.2 (* 0.2 value))))
(manifest-inner-spoke-points (value)
;; create intruding spoke path - represents integer metadata
(let ((step (/ (* pi 2) value))
(arc-position (* pi 0.5)) ;; initial position is at right side of circle
(path "M0,0"))
(loop for x from 0 to (1- value)
do (setq path (+ path " M" (* (* spoke-radius 0.815)
(sin arc-position))
"," (* (* spoke-radius 0.815)
(cos arc-position))
" L" (* spoke-radius (sin arc-position))
"," (* spoke-radius (cos arc-position)) " ")
arc-position (+ step arc-position)))
path))
(manifest-outer-spoke-points (value)
;; create extruding spoke path - represents integer metadata
(let* ((step (/ (* pi -2) 32))
(arc-position (- (* pi 1.75) ;; initial position is at lower left side of circle
(* step (/ (1- value) 2))))
(path ""))
(loop for x from 0 to (1- value)
do (setq path (+ path "M0,0 L" (* outer-dot-radius (sin arc-position))
"," (* outer-dot-radius (cos arc-position)) " ")
arc-position (+ step arc-position)))
path))
(manifest-outer-band (value)
;; create extruding band path - represents fraction metadata
(let* ((start-arc-position (- (* pi 0.75)
(* pi (/ value 2))))
(end-arc-position (+ start-arc-position (* pi (/ value 2))))
(startx (* outer-band-radius (sin start-arc-position)))
(starty (* outer-band-radius (cos start-arc-position))))
(+ "M" startx " " starty " a " outer-band-radius " " outer-band-radius
" 0 0 0 " (- (- startx (* outer-band-radius (sin end-arc-position))))
" " (- (- starty (* outer-band-radius (cos end-arc-position))))))))
(let ((node-icon (chain interface node-enter
(append "svg:g")
;; TODO: complete class function
;;(attr "class" (lambda (d) "object-data-fetch glyph"))
(attr "class" "glyph"))))
(chain node-icon (append "svg:path")
;; TODO: complete class function
(attr "class" "outer-meta-spokes")
(attr "d" (lambda (d) (manifest-outer-spoke-points 3)))
(attr "transform" (+ "translate(" main-radius ",0)")))
(chain node-icon (append "svg:path")
;; TODO: complete class function
(attr "class" "outer-meta-band")
(attr "d" (lambda (d) (manifest-outer-band 0.6)))
(attr "transform" (+ "translate(" main-radius ",0)")))
;; outer chromatic circle
(chain node-icon (append "svg:circle")
(attr "class" "outer-circle")
(attr "cy" 0)
(attr "cx" main-radius)
(attr "r" main-radius))
;; inner white circle with radius according to a metadata fraction
(chain node-icon (append "svg:circle")
(attr "class" "inner-circle")
(attr "cy" 0)
(attr "cx" main-radius)
(attr "r" (manifest-inner-circle-radius 0.5)))
;; .call(d3.drag()
;; .on("start", dragstarted)
;; .on("drag", dragged)
;; .on("end", dragended))
)))))
(defvar expand-button-standard)
(setq expand-button-standard
`(lambda (interface)
(let* ((section (@ interface params section))
(main-radius (* 0.25 section))
(outer-radius (* 0.28 section))
(arc-point-radius (* 0.32 section))
(crossbar-length (* 0.3 section))
(crossbar-breadth (* 0.1 section))
(indentation (* 0.955 section)))
(flet ((manifest-arc-points (value)
;; create encircling dot path - represents integer metadata
(let* ((extra-spoke-length-factor 0.35)
(step (/ (* pi -2) 24))
(arc-position (- (* pi 0.5)
(* step (/ (1- value) 2)))))
"M0,0")))
(let ((button (chain interface node-enter
(append "svg:g")
(attr "class" "expand-control")
(attr "cursor" "pointer")
(attr "transform" (+ "translate(" indentation ",0)"))
(attr "style" (lambda (d)
(if (not (chain interface params visualizer-logic
(node-has-children d)))
"display: none" ""))))))
(chain button (append "svg:circle")
(attr "class" "button-backing")
(attr "cy" 0)
(attr "cx" main-radius)
(attr "r" outer-radius))
(chain button (append "svg:circle")
(attr "class" "button-circle")
(attr "cy" 0)
(attr "cx" main-radius)
(attr "r" main-radius))
(chain button (append "svg:rect")
(attr "x" (- main-radius (/ crossbar-length 2)))
(attr "y" (/ crossbar-breadth -2))
(attr "height" crossbar-breadth)
(attr "width" crossbar-length))
(chain button (append "svg:rect")
(attr "x" (- main-radius (/ crossbar-breadth 2)))
(attr "y" (* -1.5 crossbar-breadth))
(attr "id" (lambda (d) (+ "plusCrossbar" (@ d id))))
(attr "class" "plus-crossbar")
(attr "width" crossbar-breadth)
(attr "height" (lambda (d) (if (chain interface params visualizer-logic (node-expanded d))
0 crossbar-length))))
;; (chain node (select-all ".plus-crossbar")
;; (transition) (duration (@ interface params duration))
;; (attr "y" (lambda (d) (if (chain interface params visualizer-logic (node-expanded d))
;; (* -1.5 crossbar-breadth) (/ crossbar-breadth -2))))
;; (attr "height" (lambda (d) (if (chain interface params visualizer-logic (node-expanded d))
;; 0 crossbar-length))))
(chain button (append "svg:circle")
(on "click" (@ interface params interface-actions expand-toggle-object))
(attr "opacity" 0)
(attr "cy" 0)
(attr "cx" main-radius)
(attr "r" outer-radius))
;; TODO: complete this
)))))
(defvar icon-title-frame-standard)
(setq icon-title-frame-standard
`(lambda (interface)
(let* ((section (@ interface params section))
(main-radius (/ (* 0.8 section) 2))
(outmost-radius (/ (* 0.95 section) 2))
(text-frame-indent (* 0.85 section))
(text-frame-joiner-width (* 2 section))
(text-frame-joiner-indent (* 0.4375 section))
(text-frame-height (* 0.75 section))
(text-outer-frame-height section)
(text-frame-border-radius (/ (* 0.75 section) 2))
(text-frame-outer-border-radius (/ (* 0.95 section) 2)))
(flet ((get-node-bar-width (node)
(- (@ interface params width) (+ (@ node y) (* 1.75 section)))))
(let ((icon-title-frame (chain interface node-enter
(append "svg:g")
(attr "class" "icon-title-frame")
(attr "height" text-frame-height)
(attr "width" get-node-bar-width))))
(chain icon-title-frame (append "svg:rect")
(attr "class" "text-frame-joiner")
(attr "y" (- text-frame-border-radius))
(attr "x" text-frame-joiner-indent)
(attr "height" text-frame-height)
(attr "width" text-frame-joiner-width))
(chain icon-title-frame (append "svg:rect")
(attr "class" "text-frame")
(attr "y" (- text-frame-border-radius))
(attr "x" text-frame-indent)
(attr "height" text-frame-height)
(attr "width" get-node-bar-width)
(attr "rx" text-frame-border-radius)
(attr "ry" text-frame-border-radius))
(chain icon-title-frame (append "svg:rect")
(attr "class" "interactor")
(attr "y" (- text-frame-border-radius))
(attr "x" text-frame-indent)
(attr "height" text-outer-frame-height)
(attr "width" get-node-bar-width)
(attr "opacity" 0)
(on "click" (@ interface params interface-actions set-point-object)))
(chain icon-title-frame (append "svg:circle")
(attr "class" "circle-frame")
(attr "cy" 0)
(attr "cx" main-radius)
(attr "r" outmost-radius)))))))
(defvar standard-effect-set)
(setq standard-effect-set
`(list ,title-text-standard ,icon-title-frame-standard ,circle-icon-standard ,expand-button-standard))
(defmacro standard-vector-effects ()
`(lambda (interface)
(chain ,standard-effect-set (map (lambda (effect) (funcall effect interface))))))
| 9,631
|
Common Lisp
|
.lisp
| 217
| 37.281106
| 108
| 0.592522
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
e958d897377f7f3e49a9c04b930b8737d3a0178b5ca63029fa0917a11d66ba03
| 2,702
|
[
-1
] |
2,703
|
utils.lisp
|
phantomics_seed/demo-market/utils.lisp
|
;; utils.lisp
(in-package #:demo-market)
(defvar chart-data)
(defvar *forex-time-modulation* (list (list :offset 144000 :period 604800 :gap 176400)))
(defun load-exp-from-file (package-name file-path)
"Load a form from a file at the given relative path."
(with-open-file (data (asdf:system-relative-pathname package-name file-path))
(when data (loop for line = (read data nil)
while line collect line))))
(defun generate-data-string (data-array &optional array-length count output)
(let ((array-length (if array-length array-length (length data-array)))
(count (if count count 0))
(output (if output output "")))
(if (> count (1- array-length))
output (let* ((datum (aref data-array count))
(time-string (if (/= 0 count)
(modulate-time (timestamp-to-unix
(universal-to-timestamp (parse-date-time (aref datum 0))))
*forex-time-modulation*)
(aref datum 0))))
(generate-data-string data-array array-length (1+ count)
(format nil "~a~a,~a,~a,~a,~a,~a,~a,~a,~a~%" output time-string
(aref datum 1)
(aref datum 4)
(aref datum 2)
(aref datum 3)
(aref datum 5)
(aref datum 8)
(aref datum 6)
(aref datum 7)))))))
(defun generate-data-jsform (data-array &optional array-length count output)
(let ((array-length (if array-length array-length (length data-array)))
(count (if count count 0))
(output (if output output)))
(if (> count (1- array-length))
(reverse output)
(let* ((datum (aref data-array count))
(time-val (if (/= 0 count)
(modulate-time (timestamp-to-unix
(universal-to-timestamp (parse-date-time (aref datum 0))))
*forex-time-modulation*)
(aref datum 0))))
(generate-data-jsform data-array array-length (1+ count)
(cons (list time-val (aref datum 1) (aref datum 4)
(aref datum 2) (aref datum 3) (aref datum 5)
(aref datum 8) (aref datum 6) (aref datum 7))
output))))))
;; (- 1535907600 1535731200)
;; 1535108400,1.51620,1.51670,1.51359,1.51385,1.51612,1.51662,1.51354,1.51375
;; 1535104800
;; (- 1535302800 1535126400)
;; offset 144000
;; week 604800
;; (setq cdata (aref (lquery:$ (initialize (asdf:system-relative-pathname :demo-market "eurcad.xml"))) 0))
;; (setq rows (reverse (lquery:$ cdata "row")))
;; (let ((rcount 0))
;; (map 'vector (lambda (i)
;; (incf rcount)
;; (if (= rcount (length rows))
;; (lquery:$ i "cell" "data" (html))
;; (let ((ccount 0))
;; (map 'vector (lambda (c)
;; (incf ccount)
;; (if (= 1 ccount)
;; c (parse-number c)))
;; (lquery:$ i "cell" "data" (html))))))
;; rows))
#|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1
1 2 3 4 5 6 7 8 9 10 11
|#
(defun modulate-time (time mods)
(loop for mod in mods
do (multiple-value-bind (dividend remainder)
(floor (- time (getf mod :offset))
(getf mod :period))
(setq time (- time (* (+ dividend (signum remainder))
(getf mod :gap))))))
time)
(defun demodulate-time (time mods)
(loop for mod in (reverse mods)
do (multiple-value-bind (dividend remainder)
(floor (- time (getf mod :offset))
(- (getf mod :period)
(getf mod :gap)))
(setq time (+ remainder (getf mod :offset)
(* dividend (getf mod :period))
(* (signum remainder)
(getf mod :gap))))))
time)
;; (setq chart-entities (list (list :type "line"
;; :start (list 1087455600 1.52)
;; :end (list 1087650000 1.48))))
(let ((cdata (generate-data-jsform (first (load-exp-from-file :demo-market "./data.sexp")))))
(setq chart-data (list :mods *forex-time-modulation*
:content (rest cdata)
:labels (first cdata)
:entities chart-entities)))
#|
(META
(SETQ CHART-ENTITIES
(LIST (LIST :TYPE "line" :START (LIST 1087455600 1.52)
:END (LIST 1087650000 1.48))))
:MODE
(:VALUE NIL :FORMAT :CHART-ENTITIES-EXPAND
:OPTIONS
((:VALUE
(META ((META "" :MODE (:VALUE "" :VIEW :TEXTFIELD :TITLE "Start Time"))
(META "" :MODE (:VALUE "" :VIEW :TEXTFIELD :TITLE "Start Price"))
(META "" :MODE (:VALUE "" :VIEW :TEXTFIELD :TITLE "End Time"))
(META "" :MODE (:VALUE "" :VIEW :TEXTFIELD :TITLE "End Price")))
:MODE
(:VIEW :ITEM :TITLE "Line" :REMOVABLE T :OPEN T
:FORMAT-PROPERTIES (:TYPE :LOAD)))
:TITLE "Line"))
:REMOVABLE NIL :FILL-BY :SELECT :VIEW :LIST :MODEL
((META
((META "1087455600" :MODE (:VALUE "1087455600" :VIEW :TEXTFIELD :TITLE "Start Time"))
(META "1.52" :MODE (:VALUE "1.52" :VIEW :TEXTFIELD :TITLE "Start Price"))
(META "1087650000" :MODE (:VALUE "1087650000" :VIEW :TEXTFIELD :TITLE "End Time"))
(META "1.48" :MODE (:VALUE "1.48" :VIEW :TEXTFIELD :TITLE "End Price")))
:MODE
(:VALUE NIL :MODEL
((META "1087455600" :MODE (:VALUE "1087455600" :VIEW :TEXTFIELD :TITLE "Start Time"))
(META "1.52" :MODE (:VALUE "1.52" :VIEW :TEXTFIELD :TITLE "Start Price"))
(META "1087650000" :MODE (:VALUE "1087650000" :VIEW :TEXTFIELD :TITLE "End Time"))
(META "1.48" :MODE (:VALUE "1.48" :VIEW :TEXTFIELD :TITLE "End Price")))
:FORMAT-PROPERTIES (:TYPE "line") :TOGGLE :ON :REMOVABLE T :OPEN T :TITLE
"Line" :VIEW :ITEM)))))
(:VALUE
(META
((META "" :MODE (:VALUE "" :VIEW :TEXTFIELD :TITLE "Start Time"))
(META "" :MODE (:VALUE "" :VIEW :TEXTFIELD :TITLE "Start Price"))
(META "" :MODE (:VALUE "" :VIEW :TEXTFIELD :TITLE "End Time"))
(META "" :MODE (:VALUE "" :VIEW :TEXTFIELD :TITLE "End Price")))
:MODE
(:VIEW :ITEM :TITLE "Line" :REMOVABLE T :OPEN T :FORMAT-PROPERTIES
(:TYPE :LOAD)))
:TITLE "Line")
|#
| 5,778
|
Common Lisp
|
.lisp
| 141
| 36.219858
| 106
| 0.610637
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
d5abc067c7669e669b884cffe9fc6c5de9a529a505a4c416fc73f5ae019927cb
| 2,703
|
[
-1
] |
2,704
|
main.lisp
|
phantomics_seed/demo-market/main.lisp
|
(IN-PACKAGE #:DEMO-MARKET)
(DEFVAR CHART-ENTITIES)
(META (SETQ CHART-ENTITIES (LIST)) :MODE
(:MODEL
((META
((META "1087455600" :MODE
(:TITLE "Start Time" :VIEW :TEXTFIELD :VALUE "1087455600"))
(META "1.52" :MODE (:TITLE "Start Price" :VIEW :TEXTFIELD :VALUE "1.52"))
(META "1087650000" :MODE
(:TITLE "End Time" :VIEW :TEXTFIELD :VALUE "1087650000"))
(META "1.48" :MODE (:TITLE "End Price" :VIEW :TEXTFIELD :VALUE "1.48")))
:MODE
(:VALUE NIL :MODEL
((META "1087455600" :MODE
(:TITLE "Start Time" :VIEW :TEXTFIELD :VALUE "1087455600"))
(META "1.52" :MODE (:TITLE "Start Price" :VIEW :TEXTFIELD :VALUE "1.52"))
(META "1087650000" :MODE
(:TITLE "End Time" :VIEW :TEXTFIELD :VALUE "1087650000"))
(META "1.48" :MODE (:TITLE "End Price" :VIEW :TEXTFIELD :VALUE "1.48")))
:FORMAT-PROPERTIES (:TYPE :LOAD) :TOGGLE :ON :OPEN T :REMOVABLE T :TITLE
"Line" :VIEW :ITEM))
(META
((META "1089118800" :MODE
(:TITLE "Start Time" :VIEW :TEXTFIELD :VALUE "1089118800"))
(META "1.5304275" :MODE
(:TITLE "Start Price" :VIEW :TEXTFIELD :VALUE "1.5304275"))
(META "1089223200" :MODE
(:TITLE "End Time" :VIEW :TEXTFIELD :VALUE "1089223200"))
(META "1.5019635" :MODE
(:TITLE "End Price" :VIEW :TEXTFIELD :VALUE "1.5019635")))
:MODE
(:VALUE NIL :MODEL
((META "1089118800" :MODE
(:TITLE "Start Time" :VIEW :TEXTFIELD :VALUE "1089118800"))
(META "1.5304275" :MODE
(:TITLE "Start Price" :VIEW :TEXTFIELD :VALUE "1.5304275"))
(META "1089223200" :MODE
(:TITLE "End Time" :VIEW :TEXTFIELD :VALUE "1089223200"))
(META "1.5019635" :MODE
(:TITLE "End Price" :VIEW :TEXTFIELD :VALUE "1.5019635")))
:FORMAT-PROPERTIES (:TYPE :LOAD) :TOGGLE :ON :OPEN T :REMOVABLE T :TITLE
"Line" :VIEW :ITEM)))
:VIEW :LIST :FILL-BY :SELECT :REMOVABLE NIL :OPTIONS
((:TITLE "Line" :VALUE
(META
((META "" :MODE (:TITLE "Start Time" :VIEW :TEXTFIELD :VALUE ""))
(META "" :MODE (:TITLE "Start Price" :VIEW :TEXTFIELD :VALUE ""))
(META "" :MODE (:TITLE "End Time" :VIEW :TEXTFIELD :VALUE ""))
(META "" :MODE (:TITLE "End Price" :VIEW :TEXTFIELD :VALUE ""))
(META "" :NAME :APPLY-APL :MODE
(:REMOVABLE T :TITLE "APL" :VIEW :TEXTFIELD :VALUE "")))
:EACH
(:VISIBLE-MEMBERS ((:NAME :APPLY-APL :TITLE "Apply APL" :STATE :OFF)))
:MODE
(:VIEW :ITEM :TITLE "Line" :REMOVABLE T :OPEN T :FORMAT-PROPERTIES
(:TYPE :LOAD) :TOGGLE :ON :OPTIONS
((:TITLE "Apply APL" :ACTION :TOGGLE-VISIBILITY :NAME :APPLY-APL))))))
:FORMAT :CHART-ENTITIES-EXPAND :VALUE NIL))
| 2,668
|
Common Lisp
|
.lisp
| 58
| 40.137931
| 79
| 0.612644
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
ca29f22fdcadd50d8156636a0ac888732e572e528ce56a44956db93709fa96aa
| 2,704
|
[
-1
] |
2,705
|
package.lisp
|
phantomics_seed/seed.ui-spec.color.base/package.lisp
|
;;;; package.lisp
(defpackage #:seed.ui-spec.color.base
(:export #:palette-hicontrast-solarized #:palette-medcontrast-adjunct
#:palette-medcontrast-dropcloth)
(:use #:cl))
| 181
|
Common Lisp
|
.lisp
| 5
| 33.4
| 71
| 0.737143
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
2ed00d9fe23f2411ff2417c91f878a8e4fc23bdaa26065e748763b5fc8312ede
| 2,705
|
[
-1
] |
2,706
|
color.base.lisp
|
phantomics_seed/seed.ui-spec.color.base/color.base.lisp
|
;;;; seed.ui-spec.color.base.lisp
(in-package #:seed.ui-spec.color.base)
(defvar palette-hicontrast-solarized)
(defvar palette-medcontrast-adjunct)
(defvar palette-medcontrast-dropcloth)
(setq palette-hicontrast-solarized
(list :base03 "#002b36" :base02 "#073642" :base01 "#586e75"
:base00 "#657b83" :base0 "#839496" :base1 "#93a1a1"
:base2 "#eee8d5" :base3 "#fdf6e3" :yellow "#b58900"
:orange "#cb4b16" :red "#dc322f" :magenta "#d33682"
:violet "#6c71c4" :blue "#268bd2" :cyan "#2aa198"
:green "#859900")
palette-medcontrast-adjunct
(list :base03 "#262625" :base02 "#2f3033" :base01 "#676b71"
:base00 "#707784" :base0 "#89919e" :base1 "#9a9ea5"
:base2 "#e6e8ec" :base3 "#f7f6f5" :yellow "#b38a39"
:orange "#bd5a34" :red "#c94f42" :magenta "#be527e"
:violet "#6874af" :blue "#408abc" :cyan "#509d95"
:green "#919637")
palette-medcontrast-dropcloth
(list :base03 "#262625" :base02 "#33302d" :base01 "#716964"
:base00 "#83746a" :base0 "#9e8e83" :base1 "#a59c97"
:base2 "#ece7e4" :base3 "#f7f6f5" :yellow "#b38a39"
:orange "#bd5a34" :red "#c94f42" :magenta "#be527e"
:violet "#6874af" :blue "#408abc" :cyan "#509d95"
:green "#919637"))
#|
purple palette
(:adjunct :base03 "#242434" :base02 "#2F2F3F" :base01 "#73676E"
:base00 "#817477" :base0 "#9D8D8D" :base1 "#AC9A97"
:base2 "#F8E5D5" :base3 "#FFF3E2" :yellow "#b58900"
:orange "#cb4b16" :red "#dc322f" :magenta "#d33682"
:violet "#6c71c4" :blue "#268bd2" :cyan "#2aa198"
:green "#859900")
faded
(hex-express (lab-palette (15 2 -4) (20 2 -4) (45 1 -3) (50 1 -3) (60 1 -3) (65 1 -3) (92 0 -2) (97 0 -2)))
more faded
(:adjunct :base03 "#26252B" :base02 "#313036" :base01 "#6E6969"
:base00 "#7B7676" :base0 "#968F8D" :base1 "#A39D9A"
:base2 "#EFE7E0" :base3 "#FCF3ED" :yellow "#b58900"
:orange "#cb4b16" :red "#dc322f" :magenta "#d33682"
:violet "#6c71c4" :blue "#268bd2" :cyan "#2aa198"
:green "#859900")
brown faded
(hex-express (lab-palette (15 6 2) (20 6 2) (45 4 3) (50 4 3) (60 3 4) (65 3 4) (92 1 2) (97 1 2)))
(:adjunct :base03 "#2F2323" :base02 "#3A2D2E" :base01 "#736866"
:base00 "#807572" :base0 "#998F8A" :base1 "#A69C97"
:base2 "#ECE7E4" :base3 "#FAF6F3" :yellow "#b58900"
:orange "#cb4b16" :red "#dc322f" :magenta "#d33682"
:violet "#6c71c4" :blue "#268bd2" :cyan "#2aa198"
:green "#859900")
gray through blue
(hex-express (lab-palette (15 0 0.6) (20 0 -2) (45 0 -4) (50 0 -8) (60 0 -8) (65 0 -4) (92 0 -2) (97 0 0.6)))
(:adjunct :base03 "#242628" :base02 "#2F3033" :base01 "#676B71"
:base00 "#707784" :base0 "#89919E" :base1 "#9A9EA5"
:base2 "#E6E8EC" :base3 "#F4F6FA" :yellow "#b58900"
:orange "#cb4b16" :red "#dc322f" :magenta "#d33682"
:violet "#6c71c4" :blue "#268bd2" :cyan "#2aa198"
:green "#859900")
gray through brown
(hex-express (lab-palette (15 1 2) (20 1 2) (45 2 4) (50 4 8) (60 4 8) (65 2 4) (92 1 2) (97 1 2)))
(:BASE03 "#282523" :BASE02 "#33302D" :BASE01 "#716964" :BASE00 "#83746A" :BASE0
"#9E8E83" :BASE1 "#A59C97" :BASE2 "#ECE7E4" :BASE3 "#FAF6F3")
- more gray at ends
(hex-express (lab-palette (15 0.16 0.6) (20 1 2) (45 2 4) (50 4 8) (60 4 8) (65 2 4) (92 1 2) (97 0.16 0.6)))
(:BASE03 "#262625" :BASE02 "#33302D" :BASE01 "#716964" :BASE00 "#83746A" :BASE0
"#9E8E83" :BASE1 "#A59C97" :BASE2 "#ECE7E4" :BASE3 "#F7F6F5")
orange peak
(hex-express (lab-palette (15 8 4) (20 8 4) (45 24 16) (50 50 50) (60 50 50) (65 16 24) (92 0 2) (97 0 2)))
orange peak to cinnamon
(hex-express (lab-palette (15 12 6) (20 12 6) (45 24 16) (50 50 50) (60 50 50) (65 16 24) (92 0 2) (97 0 2)))
50% hues
(:yellow "#AB8C58" :orange "#AA654A" :red "#B26053" :magenta "#A9627C"
:violet "#6E759C" :blue "#5F88A9" :cyan "#699995" :green "#939457")
75% hues
(:yellow "#B38A39" :orange "#BD5A34" :red "#C94F42" :magenta "#BE527E"
:violet "#6874AF" :blue "#408ABC" :cyan "#509D95" :green "#919637")
|#
;; (css-styles (with :palettes ((:standard :base03 "#002b36" :base02 "#073642" :base01 "#586e75"
;; :base00 "#657b83" :base0 "#839496" :base1 "#93a1a1"
;; :base2 "#eee8d5" :base3 "#fdf6e3" :yellow "#b58900"
;; :orange "#cb4b16" :red "#dc322f" :magenta "#d33682"
;; :violet "#6c71c4" :blue "#268bd2" :cyan "#2aa198"
;; :green "#859900"))
;; :palette-contexts (:holder))
;; css-form-view)
| 4,396
|
Common Lisp
|
.lisp
| 86
| 47.895349
| 109
| 0.618648
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
d4acbddada70bcc7c956784093594f032730285bd5d353c47e6de7c748c62a37
| 2,706
|
[
-1
] |
2,707
|
package.lisp
|
phantomics_seed/seed.ui-model.html/package.lisp
|
;;;; package.lisp
(defpackage #:seed.ui-model.html
(:export #:browser-interface #:html-stream-to-file #:html-stream-to-string)
(:import-from :seed.modulate #:trace-symbol)
(:use #:cl #:cl-ppcre #:cl-who #:parenscript #:lass #:symbol-munger #:seed.modulate))
| 266
|
Common Lisp
|
.lisp
| 5
| 50.6
| 87
| 0.698842
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
f50c8709ae0dcca5492c1787b6b8812099ef9a12967ef035f8b1d362dd1a8388
| 2,707
|
[
-1
] |
2,708
|
ui-model.html.lisp
|
phantomics_seed/seed.ui-model.html/ui-model.html.lisp
|
;;;; ui-model.html.lisp
(in-package #:seed.ui-model.html)
(defmacro browser-interface (&rest params)
"Top-level macro to generate a browser interface."
(let ((foundation (rest (assoc :foundation params)))
(markup (rest (assoc :markup params)))
(script (rest (assoc :script params)))
(style (rest (assoc :style params))))
`(progn ,@(if foundation (list (macroexpand (cons 'dig-foundation foundation))))
,@(if markup (list (macroexpand (cons 'build-browser-markup markup))))
,@(if script (list (macroexpand (cons 'build-browser-script script))))
,@(if style (list (macroexpand (cons 'build-browser-style style)))))))
(defmacro dig-foundation (&rest args)
(let* ((stream (gensym)) (infile (gensym)) (outfile (gensym)) (line (gensym))
(scripts (rest (assoc :scripts args)))
(styles (rest (assoc :styles args)))
(local-package-name (intern (package-name *package*) "KEYWORD"))
(output-script-path (asdf:system-relative-pathname local-package-name "./main.js"))
(output-style-path (asdf:system-relative-pathname local-package-name "./main.css"))
(output-style-assets-path (asdf:system-relative-pathname local-package-name "./style-assets"))
;; check for the presence of an nvm-based Node.js installation
(nvm-found (and (probe-file "~/.nvm")
(probe-file "~/.nvm/nvm.sh")))
;; if nvm is present, this prefix must come before the invocation of Node build commands
(nvm-prefix "export NVM_DIR=$HOME/.nvm && [ -s \"$NVM_DIR/nvm.sh\" ] && . $NVM_DIR/nvm.sh && "))
`(qualify-build
((defun ,(intern "FOUND-INTERFACE" (package-name *package*)) ()
,(if scripts `(princ ,(format nil "~%Generating foundational Javascript via Gulp and Webpack.~%")))
,@(loop for script in scripts
append (let* ((script-package-name (intern (package-name
(trace-symbol script (package-name *package*)))
"KEYWORD"))
(script-path (asdf:system-relative-pathname script-package-name "./"))
(output-path script-path)
(script-build-file (asdf:system-relative-pathname script-package-name "./gulpfile.js"))
(root-script (asdf:system-relative-pathname script-package-name "./src.js"))
(script-output-filename "main"))
(flet ((gulp-build-script ()
(if script `((chain gulp (src ,(namestring root-script))
(pipe (gulp-webpack webpack-config))
(pipe (chain gulp (dest ,(namestring output-path)))))))))
`((with-open-file (,stream ,(namestring script-build-file)
:direction :output :if-exists :supersede :if-does-not-exist :create)
(format ,stream (ps (let ((gulp (require "gulp"))
(webpack (require "webpack"))
(gulp-webpack (require "gulp-webpack"))
(webpack-config (create context ,(namestring script-path)
entry (create ,script-output-filename "./src.js")
resolve (create extensions (list "" ".js" ".json"))
node (create fs "empty" child_process "empty")
;; the above needed to prevent these modules
;; causing errors when they cannot be loaded
;; for client-side JS
output (create filename "./[name].js")
module
(create loaders
(list (create test (regex "\.json$")
loaders
(list "json-loader")))))))
(chain gulp (task "dev" (lambda () ,@(gulp-build-script))))))))
;; invoke cornerstone macro from script package to create root source file
(with-open-file (,stream ,(namestring root-script)
:direction :output :if-exists :supersede
:if-does-not-exist :create)
(format ,stream (macroexpand (list ',script))))
,@(if script-path (list `(princ
,(format nil "~%Synchronizing source files for Javascript generation.~%"))
(macroexpand (list 'synchronize-npm-modules script-path
(if nvm-found nvm-prefix "")))))
;; run Gulp build process
(uiop:run-program ,(format nil "~agulp --gulpfile ~agulpfile.js dev"
(if nvm-found nvm-prefix "")
(namestring script-path))
:output *standard-output*)
(delete-file ,script-build-file)
(delete-file ,root-script)))))
(if (probe-file ,output-script-path)
(delete-file ,output-script-path))
(with-open-file (,outfile ,output-script-path :direction :output :if-exists :append
:if-does-not-exist :create)
,@(loop for script in scripts
append (let* ((script-package-name (intern (package-name
(trace-symbol script (package-name *package*)))
"KEYWORD"))
(root-script (asdf:system-relative-pathname script-package-name "./main.js")))
`((with-open-file (,infile ,root-script)
(loop :for ,line := (read-line ,infile nil)
:while ,line :do (format ,outfile "~a~%" ,line)))
(delete-file ,root-script)))))
,(if styles `(princ ,(format nil "~%Generating CSS via Gulp and Webpack.~%")))
,@(loop for style in styles
append (let* ((style-package-name (intern (package-name
(trace-symbol style (package-name *package*)))
"KEYWORD"))
(style-path (asdf:system-relative-pathname style-package-name "./"))
(style-assets-path (asdf:system-relative-pathname style-package-name
"./style-assets"))
(output-path style-path)
(style-build-file (asdf:system-relative-pathname style-package-name "./gulpfile.js"))
(style-output-filename "main"))
(flet ((gulp-build-style ()
(if style `((chain gulp
(src (list ,@(mapcar #'namestring
(macroexpand (list style)))))
(pipe (concat ,(format nil "~a.css" style-output-filename)))
(pipe (chain gulp (dest ,(namestring output-path)))))))))
`((with-open-file (,stream ,(namestring style-build-file)
:direction :output :if-exists :supersede
:if-does-not-exist :create)
(format ,stream (ps (let ((gulp (require "gulp"))
(concat (require "gulp-concat")))
(chain gulp (task "dev" (lambda () ,@(gulp-build-style))))))))
,@(if (probe-file (asdf:system-relative-pathname style-package-name "./style-assets"))
(list `(if (not (probe-file ,output-style-assets-path))
(uiop:run-program ,(format nil "mkdir ~a" output-style-assets-path)
:output *standard-output*))
`(uiop:run-program ,(format nil "cp -rfH ~a/* ~a" style-assets-path
output-style-assets-path))))
,@(if style-path
(list `(princ ,(format nil "~%Synchronizing source files for CSS generation.~%"))
(macroexpand (list 'synchronize-npm-modules style-path
(if nvm-found nvm-prefix "")))))
;; run Gulp build process
(uiop:run-program ,(format nil "~agulp --gulpfile ~agulpfile.js dev"
(if nvm-found nvm-prefix "")
(namestring style-path))
:output *standard-output*)
;; erase gulpfile and root Javascript source file when done
(delete-file ,style-build-file)))))
(with-open-file (,outfile ,output-style-path :direction :output :if-exists :append
:if-does-not-exist :create)
,@(loop for style in styles
append (let* ((style-package-name (intern (package-name
(trace-symbol style (package-name *package*)))
"KEYWORD"))
(root-style (asdf:system-relative-pathname style-package-name "./main.css")))
`((with-open-file (,infile ,root-style)
(loop :for ,line := (read-line ,infile nil)
:while ,line :do (format ,outfile "~a~%" ,line)))
(delete-file ,root-style)))))
,(if (and scripts styles)
`(progn (princ ,(format nil "~%Browser interface foundation build complete.~%~%"))
:success)))
(if (and (fboundp (quote ,(intern "FOUND-INTERFACE" (package-name *package*))))
(or (not (probe-file ,output-script-path))
;; (not (probe-file ,style-output-path))
))
,(list (intern "FOUND-INTERFACE" (package-name *package*)))))
("Foundation provisioning failed."))))
(defmacro synchronize-npm-modules (script-path &optional prefix)
"Installs and/or updates required NPM modules in a Javascript package."
(let ((prefix (if prefix prefix "")))
`(progn (princ "Processing NPM modules... ")
(uiop:run-program ,(format nil "~anpm install --prefix \"~a\"" prefix (namestring script-path)))
(princ ,(format nil "done.~%")))))
(defmacro build-browser-markup (&rest form)
"Render interface HTML to file. Assumes a flat structure for file storage; the portal directory is assumed to be one directory upstream from the current package directory."
`(with-open-file (stream ,(asdf:system-relative-pathname (make-symbol (package-name *package*))
"index.html")
:direction :output :if-exists :supersede :if-does-not-exist :create)
(cl-who:with-html-output (stream) (:html ,@form))))
(defmacro build-browser-script (&rest items)
"Render interface JavaScript to file."
(let ((script-content nil) (prepend-content nil))
(loop :for item :in items :do (let ((expanded (macroexpand (if (listp item)
item (list item)))))
(if (keywordp (first expanded))
(setf script-content (append (getf expanded :content)
script-content)
prepend-content (append (getf expanded :prepend)
prepend-content))
(setf script-content (append expanded script-content)))))
`(with-open-file (stream (asdf:system-relative-pathname (make-symbol (package-name *package*))
"portal.js")
:direction :output :if-exists :supersede :if-does-not-exist :create)
,@prepend-content
(let ((data (ps ,@script-content)))
(format stream (if (stringp data)
data (write-to-string data)))))))
(defmacro build-browser-style (&rest items)
"Render interface CSS to file."
`(with-open-file (stream (asdf:system-relative-pathname (make-symbol (package-name *package*))
"portal.css")
:direction :output :if-exists :supersede :if-does-not-exist :create)
(let ((data (apply #'concatenate
(cons 'string (mapcar (lambda (item)
(if (listp item)
(lass:compile-and-write item)
(if (stringp item)
item)))
(append ,@(loop :for item :in items
:collect (macroexpand (if (listp item)
item (list item))))))))))
(format stream (if (stringp data)
data (write-to-string data))))))
(defmacro html-stream-to-string (form)
"Render HTML to string."
`(let ((stream (make-string-output-stream)))
(cl-who:with-html-output (stream) (:html ,@form))
(get-output-stream-string stream)))
| 10,680
|
Common Lisp
|
.lisp
| 200
| 45.53
| 174
| 0.63474
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
1833af109f9de1b2226a545897e2f27755d0fa2e64ade89e0d2481195cafa60e
| 2,708
|
[
-1
] |
2,709
|
qualify-build.lisp
|
phantomics_seed/seed.ui-model.html/qualify-build.lisp
|
;;;; qualify-build.lisp
;;; This macro is broken out in a separate file so it can easily be used in the install-seed program.
(in-package #:seed.ui-model.html)
(defmacro qualify-build (success failure)
"Ensure that the necessary components are in place to build the libraries needed by the frontend interface."
`(flet ((command-exists (command-string prefix)
(= 0 (multiple-value-bind (1st 2nd error-code)
(uiop:run-program (format nil "~acommand -v ~a" prefix command-string)
:ignore-error-status t)
(declare (ignore 1st 2nd))
error-code))))
(let ((nvm-found (and (probe-file "~/.nvm")
(probe-file "~/.nvm/nvm.sh")))
(nvm-prefix "export NVM_DIR=$HOME/.nvm && [ -s \"$NVM_DIR/nvm.sh\" ] && . $NVM_DIR/nvm.sh && "))
;; if an nvm installation if found, the nvm-prefix must come before all invocations of Node commands
(cond ((and (not (and (command-exists "npm" "")
(command-exists "node" "")))
(or (not nvm-found)
(not (and (command-exists "npm" nvm-prefix)
(command-exists "node" nvm-prefix)))))
(progn (princ (format nil "~%~%~a ~%~%The browser interface cannot be built because Node.js and NPM are missing. Please install Node.js, either at the system level or locally using a node version manager like nvm."
,(first failure)))
,@(rest failure)))
((not (command-exists "gulp" (if nvm-found nvm-prefix "")))
(progn (princ (format nil "~%~%~a ~%~%The browser interface cannot be built because Gulp is missing. Please install Node.js, either at the system level or locally using a node version manager like nvm."
,(first failure)))
,@(rest failure)))
(t ,@success)))))
| 1,719
|
Common Lisp
|
.lisp
| 28
| 55
| 221
| 0.654233
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
61b1a8d4ce0796159a3eb8fd76c80dee776799d81ced24c875126592a6738364
| 2,709
|
[
-1
] |
2,710
|
meta.common.lisp
|
phantomics_seed/seed.modes.meta.common/meta.common.lisp
|
;;;; meta.common.lisp
(in-package #:seed.modulate)
(specify-meta-modes
modes-meta-common
(:spiral-points-expand
(lambda (items)
(flet ((fibo-plotter (x y scale iterations)
(flet ((e-process (value) (exp (* value 0.30635))))
(loop :for index :from 0 :to (1- iterations)
:collect (list (+ x (* (e-process index)
scale (cos index)))
(+ y (* (e-process index)
scale (sin index))))))))
(let ((center-x (second items)) (center-y (third items)))
`(:g :id "group2" ,@(mapcar (lambda (point spiral-coordinates)
(append point (list :cx (first spiral-coordinates)
:cy (second spiral-coordinates))))
(mapcar #'caadr (second (fourth items)))
(fibo-plotter center-x center-y 3 (length (second (fourth items))))))))))
(:raster-process-layers-expand
(lambda (items)
(let ((output (loop :for item :in items :append
(let ((type (getf (getf (getf (cddr item) :mode) :format-properties) :type)))
(cond ((eq :off (getf (getf (cddr item) :mode) :toggle))
nil)
((eq :load type)
`((:load :path ,(second (caadr item)))))
((eq :apl type)
`((:apl :exp ,(second (caadr item)))))
((eq :output type)
`((:output :path ,(second (caadr item))))))))))
(cons (intern "RASTER-PROCESS-LAYERS" (package-name *package*))
output))))
(:chart-entities-expand
(lambda (items)
(let ((output (loop :for item :in items :append
(let* ((type (getf (getf (getf (cddr item) :mode) :format-properties) :type))
(members (second item))
(start-time (nth 0 members))
(start-price (nth 1 members))
(end-time (nth 2 members))
(end-price (nth 3 members)))
(cond ((eq :off (getf (getf (cddr item) :mode) :toggle))
nil)
((eq :line type)
members
`((list :type "line"
:points (list (list ,(parse-number (second start-time))
,(parse-number (second start-price)))
(list ,(parse-number (second end-time))
,(parse-number (second end-price))))))))
))))
`(setq ,(intern "CHART-ENTITIES" (package-name *package*))
(list ,@output)))))
(:html-form-components-expand
(lambda (items)
(let ((output (loop :for item :in items :append
(let ((type (getf (getf (getf (cddr item) :mode) :format-properties) :type)))
(cond ((eq :section-title type)
`((:h2 ,(second (caadr item)))))
((eq :form-field type)
(let* ((props (cadr item))
(id (second (first props)))
(title (second (second props))))
`((:div (:label ,title) (:br)
(:input :name ,id))))))))))
(append (list (intern "GENERATE-HTML-FORM" (package-name *package*))
(intern "FORM-OUTPUT" (package-name *package*)))
output)))))
| 3,368
|
Common Lisp
|
.lisp
| 69
| 33.797101
| 109
| 0.478617
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
7abbbc2af7667003b65006c86b8ef5c04a15bebcb4f8206314dc0abbba449a79
| 2,710
|
[
-1
] |
2,711
|
chart.base.lisp
|
phantomics_seed/seed.ui-spec.stage-controls.chart.base/chart.base.lisp
|
;;;; chart.base.lisp
(in-package #:seed.ui-spec.stage.base)
(defmacro stage-controls-chart-base (meta-symbol spec-symbol params-symbol output-symbol)
(declare (ignorable spec-symbol))
`(((eq :select (first ,params-symbol))
(cons `(,',meta-symbol :select :mode (:interaction :chart-select))
,output-symbol))
((eq :line (first ,params-symbol))
(cons `(,',meta-symbol :line :mode (:interaction :chart-draw-line))
,output-symbol))
((eq :retrace-x (first ,params-symbol))
(cons `(,',meta-symbol :retrace-x :mode (:interaction :chart-retrace-x))
,output-symbol))
((eq :retrace-y (first ,params-symbol))
(cons `(,',meta-symbol :retrace-y :mode (:interaction :chart-retrace-y))
,output-symbol))
((eq :zoom-real-size (first ,params-symbol))
(cons `(,',meta-symbol :zoom-real-size :mode (:interaction :chart-zoom-real-size))
,output-symbol))))
| 901
|
Common Lisp
|
.lisp
| 19
| 42.894737
| 89
| 0.663636
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
fd923ca87a7871865f9e89877cc7d9f5e753c773ba0edf03e5da03365322b8e2
| 2,711
|
[
-1
] |
2,712
|
package.lisp
|
phantomics_seed/seed.generate/package.lisp
|
;;;; package.lisp
(defpackage #:seed.generate
(:export #:portal #:media #:file-output #:find-form-in-spec #:get-portal-contacts
#:of-sprout-meta #:get-portal-contact-branch-specs
#:media-spec-base)
; TODO should not be necessary to include this last
(:use #:cl #:asdf #:jonathan #:fare-quasiquote #:quickproject
#:symbol-munger #:seed.modulate #:seed.sublimate))
| 382
|
Common Lisp
|
.lisp
| 8
| 44.375
| 83
| 0.709677
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
8993de7d06b448e204056d90053146204e8683cc6d13b65f66c2f435f2c71ac0
| 2,712
|
[
-1
] |
2,713
|
generate.lisp
|
phantomics_seed/seed.generate/generate.lisp
|
;;;; generate.lisp
(in-package #:seed.generate)
(defun list-dimensions (list depth)
"Get the dimensions of a list."
(loop repeat depth collect (length list)
do (setf list (car list))))
(defun find-form-in-spec (head-name limbs &optional results)
(if limbs (if (listp (first limbs))
(if (string= (string-upcase head-name)
(string-upcase (caar limbs)))
(find-form-in-spec head-name (rest limbs)
(cons (first limbs) results))
(find-form-in-spec head-name (rest limbs)
(append (find-form-in-spec head-name (first limbs))
results)))
(find-form-in-spec head-name (rest limbs)
results))
results))
(defun follow-path (path form action)
(if path (let ((remainder (nthcdr (first path) form)))
(multiple-value-bind (output-form point-output operated)
(follow-path (rest path)
(first remainder)
action)
(values (append (subseq form 0 (first path))
(cons (if operated point-output output-form)
(rest remainder)))
point-output)))
(values form (funcall action form) t)))
(defun list-to-array (list depth)
"Convert list to array."
(make-array (list-dimensions list depth)
:initial-contents list))
(defun array-to-list (array)
"Convert array to list."
(let* ((dimensions (array-dimensions array))
(depth (1- (length dimensions)))
(indices (make-list (1+ depth) :initial-element 0)))
(labels ((recurse (n)
(loop for j below (nth n dimensions)
do (setf (nth n indices) j)
collect (if (= n depth)
(apply #'aref array indices)
(recurse (1+ n))))))
(recurse 0))))
(defun array-map (function &rest arrays)
"Maps the function over the arrays.
Assumes that all arrays are of the same dimensions.
Returns a new result array of the same dimension."
(flet ((make-displaced-array (array)
(make-array (reduce #'* (array-dimensions array))
:displaced-to array)))
(let* ((displaced-arrays (mapcar #'make-displaced-array arrays))
(result-array (make-array (array-dimensions (first arrays))))
(displaced-result-array (make-displaced-array result-array)))
(declare (dynamic-extent displaced-arrays displaced-result-array))
(apply #'map-into displaced-result-array function displaced-arrays)
result-array)))
(defun exp-string (list output)
"Convert the given form to a string."
(if list (if (stringp list)
list (exp-string (rest list)
(concatenate 'string output (write-to-string (first list))
(list #\newline))))
output))
(defun file-output (data file-path)
"Write given form to text and save to a file with the given path."
(with-open-file (stream file-path :direction :output :if-exists :supersede :if-does-not-exist :create)
(format stream (if (stringp data) data
(write-to-string data)))))
(defun load-exp-from-file (package-name file-path)
"Load a form from a file at the given relative path."
(with-open-file (data (asdf:system-relative-pathname package-name file-path))
(when data (loop for line = (read data nil)
while line collect line))))
(defun load-string-from-file (package-name file-path)
"Load a string from a file at the given relative path."
(with-open-file (data (asdf:system-relative-pathname package-name file-path))
(apply #'concatenate (cons 'string (when data (loop for line = (read-line data nil)
while line collect line))))))
;; The generic class for Seed systems. Wraps an ASDF system, implementing the branch-based input/output model.
(defclass sprout ()
((name :accessor sprout-name
:initarg :name)
(meta :accessor sprout-meta
:initform nil
:initarg :meta)
(system :accessor sprout-system
:initform (list :description "Generic sprout description.")
:initarg :system)
(package :accessor sprout-package
:initform (list (list :export)
(list :use :common-lisp))
:initarg :package)
(formats :accessor sprout-formats
:initform nil
:initarg :formats)
(branches :accessor sprout-branches
:initform nil
:initarg :branches)))
;; A subclass for portals - sprouts that have contact with other sprouts. Portals are the basic building block
;; of Seed's system interface graph, with the minimum coherent Seed system consisting of a single portal
;; manifesting the user interface.
(defclass portal (sprout)
((contacts :accessor portal-contacts
:initform nil
:initarg :contacts)))
;; A class representing a conduit for data flowing to and from a system. Along with having methods for input and
;; output, branches often have a persistent state called an image that can be addressed by input and output.
(defclass branch ()
((name :accessor branch-name
:initarg :name)
(image :accessor branch-image
:initform nil
:initarg :image)
(meta :accessor branch-meta
:initform (list :stable t)
:initarg :meta)
(spec :accessor branch-spec
:initform nil
:initarg :spec)
(input :accessor branch-input
:initform nil
:initarg :in)
(output :accessor branch-output
:initform nil
:initarg :out)))
(defgeneric find-branch-by-name (branch-name sprout))
(defmethod find-branch-by-name (branch-name (sprout sprout))
"Return a branch with the specified name in the given sprout."
(labels ((find-branch (b branches)
(if branches (if (eq b (branch-name (first branches)))
(first branches)
(find-branch b (rest branches))))))
(find-branch branch-name (sprout-branches sprout))))
(defgeneric of-branch-meta (branch key))
(defmethod of-branch-meta ((branch branch) key)
"Return a piece of branch metadata with the given key."
(getf (branch-meta branch) key))
(defgeneric set-branch-meta (branch key &optional value))
(defmethod set-branch-meta ((branch branch) key &optional value)
"Assign a value to an element of branch metadata."
(setf (getf (branch-meta branch) key) value))
(defgeneric of-sprout-meta (sprout key))
(defmethod of-sprout-meta ((sprout sprout) key)
"Return a piece of sprout metadata with the given key."
(getf (sprout-meta sprout) key))
(defgeneric set-sprout-meta (sprout key &optional value))
(defmethod set-sprout-meta ((sprout sprout) key &optional value)
"Assign a value to an element of sprout metadata."
(setf (getf (sprout-meta sprout) key) value))
(defgeneric get-sprout-branch-specs (sprout))
(defmethod get-sprout-branch-specs ((sprout sprout))
(mapcar #'branch-spec (sprout-branches sprout)))
(defgeneric describe-as-sprout (sprout))
(defmethod describe-as-sprout ((sprout sprout))
"Generate a form describing a sprout."
`(sprout ,(make-symbol (string-upcase (sprout-name sprout)))
:system ,(sprout-system sprout)
:package ,(sprout-package sprout)
:branches ,(mapcar #'branch-spec (sprout-branches sprout))))
(defgeneric describe-as-package (sprout))
(defmethod describe-as-package ((sprout sprout))
"Generate a package definition for a sprout."
(append (list 'defpackage (make-symbol (string-upcase (sprout-name sprout))))
(sprout-package sprout)))
(defgeneric describe-as-asdf-system (sprout))
(defmethod describe-as-asdf-system ((sprout sprout))
"Generate an ASDF system definition for a sprout."
(labels ((find-file-outputs (branch limbs &optional results)
(if limbs (if (listp (first limbs))
(if (string= "PUT-FILE" (string-upcase (caar limbs)))
(find-file-outputs branch (rest limbs)
(if (eq :-self (first (last (first limbs))))
(cons (string-downcase branch)
results)
(cons (string-downcase (first (last (first limbs))))
results)))
(find-file-outputs branch (rest limbs)
(append (find-file-outputs branch (first limbs))
results)))
(find-file-outputs branch (rest limbs)
results))
results))
(get-filenames-by-branch (branches &optional results)
(if branches
(get-filenames-by-branch (rest branches)
(append (mapcar (lambda (result) (list :file result))
(find-file-outputs (caar branches)
(cdar branches)))
results))
results)))
`(asdf:defsystem ,(make-symbol (string-upcase (sprout-name sprout)))
,(append (sprout-system sprout)
(list :components (get-filenames-by-branch (mapcar #'branch-spec (sprout-branches sprout))))))))
(defgeneric get-portal-contacts (portal))
(defmethod get-portal-contacts ((portal portal))
"Return the list of systems contacted by a portal."
(mapcar #'sprout-name (portal-contacts portal)))
(defgeneric find-portal-contact-by-sprout-name (portal sprout-name))
(defmethod find-portal-contact-by-sprout-name ((portal portal) sprout-name)
"Return a contact from a given portal whose system has the given name."
(labels ((try-contact (id contacts)
(if contacts (if (eq id (sprout-name (first contacts)))
(first contacts)
(try-contact id (rest contacts))))))
(try-contact sprout-name (portal-contacts portal))))
(defgeneric get-portal-contact-branch-specs (portal contact-name))
(defmethod get-portal-contact-branch-specs ((portal portal) contact-name)
"Return a contact from a given portal whose system has the given name."
(get-sprout-branch-specs (find-portal-contact-by-sprout-name portal contact-name)))
#|
TODO: macros that don't exist in the media list act as do-nothing passthroughs regardless of their behavior.
example:
(defmacro aport (a) 1)
(sprout :portal.demo1
:system (:description "This is a test portal.")
:package ((:use :cl))
:contacts (:demo-sheet :demo-drawing)
:branches ((systems (in (put-image (aport (get-image)))
(put-file (get-image) :-self))
(out (set-type :form) (put-image (build-stage)) (codec)))))
inclusion of aport macro here just acts as passthrough
|#
(defmacro till (&rest media)
"Manifest the possible convolutions of the input/output channels that branches may implement."
(let ((medium-spec (gensym)) (media-gen (gensym)) (build-branch (gensym))
(operation (gensym)) (media-registry (gensym)) (is-operation-registered (gensym))
(is-registered-macro (gensym)) (this-direction (gensym)) (direction (gensym)) (params (gensym))
(output (gensym)) (item (gensym)) (name (gensym)) (dat (gensym)))
(flet ((macro-media-builder (medium)
(let ((name (first medium)) (args (second medium))
(io-by-medium `(if (eq :in io) ,(third medium)
,(if (fourth medium) (fourth medium) (third medium)))))
(macrolet ((prepend-args (&rest arg-list)
`(append (quote ,(cons 'io arg-list)) args)))
(cons name
;; this conditional must cover a wide range of argument list taxonomies
(cond ((and (eq 'follows (first args))
(position 'reagent args))
`(,(prepend-args &optional)
(declare (ignorable follows reagent))
`(let ((dat (funcall (lambda (data ,@(if reagent (list 'reagent)))
(declare (ignorable data ,@(if reagent (list 'reagent))))
,@,io-by-medium)
dat ,@(if reagent (list reagent)))))
(declare (ignorable dat))
;; (print ,(quote ,dat))
,(if follows follows 'dat))))
;; reagent functions transform data; note that the 'reagent' argument is evaluated
;; since it is passed to the funcall
((and (eq 'follows (first args))
(eq 'source (second args)))
`(,(prepend-args &optional)
(declare (ignorable follows source))
`(let ((dat (funcall (lambda (data) (declare (ignorable data))
,@,io-by-medium)
dat)))
(declare (ignorable dat))
,(if follows follows 'dat))))
;; source functions retrieve data from some source
((eq 'follows (first args))
`(,(prepend-args &optional)
; all arguments after follows are ignorable
(declare (ignorable ,@(append (list 'follows)
(remove '&rest (rest args)))))
`(let ((dat (funcall (lambda (data) (declare (ignorable data))
,@,io-by-medium) dat)))
(declare (ignorable dat))
,(if follows follows 'dat))))
;; ((eq 'follows (first args))
;; `(,(prepend-args &optional)
;; (let ((dat (gensym)))
;; (declare (ignorable follows))
;; `(let ((,dat (funcall (lambda (data) (declare (ignorable data))
;; ,@,io-by-medium)
;; ,dat)))
;; (declare (ignorable ,dat))
;; ,(if follows follows dat)))))
;; regular functions may do something to the data and are then followed by another
((or (eq 'source (first args))
; the source may be optional or not
(and (eq '&optional (first args))
(eq 'source (second args))))
`(,(prepend-args unused)
(declare (ignorable unused source))
`(,@,io-by-medium)))
;; terminal source functions retrieve data from some source, with nothing following
((eq 'condition (first args))
`(,(prepend-args follows)
`(let ((dat (if ,condition ,@(funcall ,io-by-medium options))))
(declare (ignorable dat))
,(if follows follows 'dat))))
;; condition functions do something based on conditions
((eq 'true-or-not (first (last args)))
`(,(prepend-args unused &optional)
(declare (ignorable unused true-or-not))
(funcall (if (eq :not true-or-not)
(lambda (body) (list 'not body))
(lambda (body) body))
`(funcall (lambda (data) (declare (ignorable data))
(not (not ,,io-by-medium))) dat))))
;; boolean functions return true or false based on some condition; if there is
;; an argument such as hash key the true-or-not variable comes afterward
(t (list args (third medium)))))))))
`(defmacro ,(intern "SPROUT" (package-name *package*))
;; declare this sprout macro internal to the package where the till macro is invoked
(name &key (system nil) (meta nil) (package nil) (formats nil) (branches nil) (contacts nil))
;; generate list of nested macros from linear pipeline spec
(labels ((,medium-spec (,direction params)
;; perhaps medium-spec should be sublimated into a more general
;; template for the foundation of a branch spec
`(lambda (input params branch sprout callback)
(declare (ignorable input params branch sprout))
;; input to function is either the user's input, in input mode,
;; or the branch image in output mode
(funcall callback (flet ((get-param (key) (getf params key))
(set-param (key value) (setf (getf params key) value)))
(let ((dat ,(if (eq :in (intern (string-upcase ,direction) "KEYWORD"))
'input `(branch-image branch))))
(declare (ignorable dat))
,(,media-gen ,direction params)))
params)))
(,media-gen (,direction ,params)
(let* ((,operation (first ,params))
(,media-registry ,(list 'quote (mapcar (lambda (m) (intern (string-upcase (first m))
"KEYWORD"))
media)))
(,is-operation-registered (member (intern (string-upcase (first ,operation)) "KEYWORD")
,media-registry))
;; reverse the direction used for this medium if :reverse is the final param
(,this-direction (if (eq :reverse (first (last ,operation)))
(if (eq :in ,direction) :out :in)
,direction))
;; if that final :reverse param is there, remove it now that its purpose is served
(,operation (if (eq :reverse (first (last ,operation)))
(butlast ,operation) ,operation)))
(if ,operation
(append (if ,is-operation-registered
(list (intern (string-upcase (first ,operation)) "SEED.GENERATE")
(intern (string-upcase ,this-direction) "KEYWORD"))
(list (first ,operation)))
(if ,is-operation-registered
(list (if (rest ,params) (,media-gen ,direction (rest ,params)))))
(mapcar (lambda (,item)
(if (listp ,item)
(let ((,is-registered-macro (member (intern (string-upcase
(first ,item))
"KEYWORD")
,media-registry)))
(if (loop for i in ,item when (listp i) collect i)
;; the list is processed as a macro with media arguments
;; if the head is registered as a macro, otherwise the head
;; is discarded and the subsequent items are processed
(,media-gen ,direction
(if (member (intern (string-upcase (first ,item))
"KEYWORD")
,media-registry)
(list ,item)
(rest ,item)))
(if ,is-registered-macro
(,media-gen ,direction (list ,item))
,item)))
,item))
(rest ,operation))))))
(,build-branch (,params &optional ,output)
(if ,params
(let* ((,item (first ,params))
(,name (intern (string-upcase (first ,item)) "KEYWORD")))
(,build-branch (rest ,params)
;; TODO: the conditional may need to be expanded if other
;; modes are implemented
(append ,output (cons ,name (list (cond ((or (eq :in ,name)
(eq :out ,name))
(,medium-spec ,name
(rest ,item)))))))))
,output)))
;; the media macros are specified here - their arguments form the taxonomy for the code which wraps them
`(macrolet ,(quote ,(mapcar #'macro-media-builder media))
;; create a sprout instance with the branches set up, including the input and output media
(germinate contacts
(make-instance (quote ,(if contacts 'portal 'sprout))
:name ,name :system (quote ,system) :meta (quote ,meta)
:package (quote ,package) :formats (quote ,formats)
,@(if contacts
(list :contacts
`(mapcar (lambda (contact)
;; TODO: the below assumes a flat structure for the
;; system file storage, improve the logic
(if (string= "SPROUT"
(string-upcase (type-of contact)))
;; if the item provided is an actual sprout
;; object, simply pass it through, otherwise
;; generate the sprout as defined by its
;; system's .seed file
contact
(if (handler-case
(progn (asdf:find-system ,name) t)
(condition () nil))
;; don't load the .seed file if the contact
;; is not defined as an ASDF system
(let ((name-string
(string-downcase contact)))
(eval (first (load-exp-from-file
(intern (string-upcase
name-string)
"KEYWORD")
(format nil "~a.seed"
name-string))))))))
(list ,@contacts))))
:branches (list ,@(mapcar (lambda (branch)
`(make-instance 'branch
:name ,(intern (string-upcase
(first branch))
"KEYWORD")
:spec (quote ,branch)
,@(,build-branch (rest
branch))))
branches))))))))))
;; (defmacro till (&rest media)
;; "Manifest the possible convolutions of the input/output channels that branches may implement."
;; (let ((dat-sym (gensym)))
;; (flet ((macro-media-builder (medium)
;; (let ((name (first medium)) (args (second medium))
;; (io-by-medium `(if (eq :in io) ,(third medium)
;; ,(if (fourth medium) (fourth medium) (third medium)))))
;; (macrolet ((prepend-args (&rest arg-list)
;; `(append (quote ,(cons 'io arg-list)) args)))
;; (cons name
;; ;; this conditional must cover a wide range of argument list taxonomies
;; (cond ((and (eq 'follows (first args))
;; (position 'reagent args))
;; `(,(prepend-args &optional)
;; (declare (ignorable follows reagent))
;; `(let ((,,dat-sym (funcall (lambda (data ,@(if reagent (list 'reagent)))
;; (declare (ignorable data
;; ,@(if reagent (list 'reagent))))
;; ,@,io-by-medium)
;; ,,dat-sym ,@(if reagent (list reagent)))))
;; (declare (ignorable ,,dat-sym))
;; ,(if follows follows ',dat-sym))))
;; ;; reagent functions transform data; note that the 'reagent' argument is evaluated
;; ;; since it is passed to the funcall
;; ((and (eq 'follows (first args))
;; (eq 'source (second args)))
;; `(,(prepend-args &optional)
;; (declare (ignorable follows source))
;; `(let ((,,dat-sym (funcall (lambda (data) (declare (ignorable data))
;; ,@,io-by-medium)
;; ,,dat-sym)))
;; (declare (ignorable ,,dat-sym))
;; ,(if follows follows ',dat-sym))))
;; ;; source functions retrieve data from some source
;; ((eq 'follows (first args))
;; `(,(prepend-args &optional)
;; ; all arguments after follows are ignorable
;; (declare (ignorable ,@(append (list 'follows)
;; (remove '&rest (rest args)))))
;; `(let ((,,dat-sym (funcall (lambda (data) (declare (ignorable data))
;; ,@,io-by-medium) ,,dat-sym)))
;; (declare (ignorable ,,dat-sym))
;; ,(if follows follows ',dat-sym))))
;; ;; ((eq 'follows (first args))
;; ;; `(,(prepend-args &optional)
;; ;; (let ((dat (gensym)))
;; ;; (declare (ignorable follows))
;; ;; `(let ((,dat (funcall (lambda (data) (declare (ignorable data))
;; ;; ,@,io-by-medium)
;; ;; ,dat)))
;; ;; (declare (ignorable ,dat))
;; ;; ,(if follows follows dat)))))
;; ;; regular functions may do something to the data and are then followed by another
;; ((or (eq 'source (first args))
;; ; the source may be optional or not
;; (and (eq '&optional (first args))
;; (eq 'source (second args))))
;; `(,(prepend-args unused)
;; (declare (ignorable unused source))
;; `(,@,io-by-medium)))
;; ;; terminal source functions retrieve data from some source, with nothing following
;; ((eq 'condition (first args))
;; `(,(prepend-args follows)
;; `(let ((,,dat-sym (if ,condition ,@(funcall ,io-by-medium options))))
;; (declare (ignorable ,,dat-sym))
;; ,(if follows follows ',dat-sym))))
;; ;; condition functions do something based on conditions
;; ((eq 'true-or-not (first (last args)))
;; `(,(prepend-args unused &optional)
;; (declare (ignorable unused true-or-not))
;; (funcall (if (eq :not true-or-not)
;; (lambda (body) (list 'not body))
;; (lambda (body) body))
;; `(funcall (lambda (data) (declare (ignorable data))
;; (not (not ,,io-by-medium))) ,,dat-sym))))
;; ;; boolean functions return true or false based on some condition; if there is
;; ;; an argument such as hash key the true-or-not variable comes afterward
;; (t (list args (third medium)))))))))
;; `(defmacro ,(intern "SPROUT" (package-name *package*))
;; ;; declare this sprout macro internal to the package where the till macro is invoked
;; (name &key (system nil) (meta nil) (package nil) (formats nil) (branches nil) (contacts nil))
;; ;; generate list of nested macros from linear pipeline spec
;; (labels ((medium-spec (direction params)
;; ;; perhaps medium-spec should be sublimated into a more general
;; ;; template for the foundation of a branch spec
;; `(lambda (input params branch sprout callback)
;; (declare (ignorable input params branch sprout))
;; ;; input to function is either the user's input, in input mode,
;; ;; or the branch image in output mode
;; (funcall callback (flet ((get-param (key) (getf params key))
;; (set-param (key value) (setf (getf params key) value)))
;; (let ((dat ,(if (eq :in (intern (string-upcase direction) "KEYWORD"))
;; 'input `(branch-image branch))))
;; (declare (ignorable dat))
;; ,(media-gen direction params)))
;; params)))
;; (media-gen (direction params)
;; (let* ((operation (first params))
;; (media-registry ,(list 'quote (mapcar (lambda (m) (intern (string-upcase (first m))
;; "KEYWORD"))
;; media)))
;; (is-operation-registered (member (intern (string-upcase (first operation)) "KEYWORD")
;; media-registry))
;; ;; reverse the direction used for this medium if :reverse is the final param
;; (this-direction (if (eq :reverse (first (last operation)))
;; (if (eq :in direction) :out :in)
;; direction))
;; ;; if that final :reverse param is there, remove it now that its purpose is served
;; (operation (if (eq :reverse (first (last operation)))
;; (butlast operation) operation)))
;; (if operation
;; (append (if is-operation-registered
;; (list (intern (string-upcase (first operation)) "SEED.GENERATE")
;; (intern (string-upcase this-direction) "KEYWORD"))
;; (list (first operation)))
;; (if is-operation-registered
;; (list (if (rest params) (media-gen direction (rest params)))))
;; (mapcar (lambda (item)
;; (if (listp item)
;; (let ((is-registered-macro (member (intern (string-upcase (first item))
;; "KEYWORD")
;; media-registry)))
;; (if (loop for i in item when (listp i) collect i)
;; ;; the list is processed as a macro with media arguments
;; ;; if the head is registered as a macro, otherwise the head
;; ;; is discarded and the subsequent items are processed
;; (media-gen direction
;; (if (member (intern (string-upcase (first item))
;; "KEYWORD")
;; media-registry)
;; (list item)
;; (rest item)))
;; (if is-registered-macro
;; (media-gen direction (list item))
;; item)))
;; item))
;; (rest operation))))))
;; (build-branch (params &optional output)
;; (if params
;; (let* ((item (first params))
;; (name (intern (string-upcase (first item)) "KEYWORD")))
;; (build-branch (rest params)
;; ;; TODO: the conditional may need to be expanded if other modes are implemented
;; (append output (cons name (list (cond ((or (eq :in name)
;; (eq :out name))
;; (medium-spec name (rest item)))))))))
;; output)))
;; ;; the media macros are specified here - their arguments form the taxonomy for the code which wraps them
;; `(macrolet ,(quote ,(mapcar #'macro-media-builder media))
;; ;; create a sprout instance with the branches set up, including the input and output media
;; (germinate contacts
;; (make-instance (quote ,(if contacts 'portal 'sprout))
;; :name ,name :system (quote ,system) :meta (quote ,meta)
;; :package (quote ,package) :formats (quote ,formats)
;; ,@(if contacts
;; (list :contacts
;; `(mapcar (lambda (contact)
;; ;; TODO: the below assumes a flat structure for the
;; ;; system file storage, improve the logic
;; (if (string= "SPROUT" (string-upcase (type-of contact)))
;; ;; if the item provided is an actual sprout object,
;; ;; simply pass it through, otherwise generate
;; ;; the sprout as defined by its system's .seed file
;; contact
;; (if (handler-case (progn (asdf:find-system ,name) t)
;; (condition () nil))
;; ;; don't load the .seed file if the contact is
;; ;; not defined as an ASDF system
;; (let ((name-string (string-downcase contact)))
;; (eval (first (load-exp-from-file
;; (intern (string-upcase
;; name-string)
;; "KEYWORD")
;; (format nil "~a.seed"
;; name-string))))))))
;; (list ,@contacts))))
;; :branches (list ,@(mapcar (lambda (branch)
;; `(make-instance 'branch
;; :name ,(intern (string-upcase
;; (first branch))
;; "KEYWORD")
;; :spec (quote ,branch)
;; ,@(build-branch (rest branch))))
;; branches))))))))))
;;;
;; (defmacro sprout (name &key (system nil) (meta nil) (package nil) (formats nil) (branches nil) (contacts nil))
;; ;; generate list of nested macros from linear pipeline spec
;; ;; the media macros are specified here - their arguments form the taxonomy for the code which wraps them
;; ;; create a sprout instance with the branches set up, including the input and output media
;; `(germinate contacts
;; (make-instance (quote ,(if contacts 'portal 'sprout))
;; :name ,name :system (quote ,system) :meta (quote ,meta)
;; :package (quote ,package) :formats (quote ,formats)
;; ,@(if contacts
;; (list :contacts
;; `(mapcar (lambda (contact)
;; ;; TODO: the below assumes a flat structure for the
;; ;; system file storage, improve the logic
;; (if (string= "SPROUT" (string-upcase (type-of contact)))
;; ;; if the item provided is an actual sprout object,
;; ;; simply pass it through, otherwise generate
;; ;; the sprout as defined by its system's .seed file
;; contact
;; (if (handler-case (progn (asdf:find-system ,name) t)
;; (condition () nil))
;; ;; don't load the .seed file if the contact is
;; ;; not defined as an ASDF system
;; (let ((name-string (string-downcase contact)))
;; (eval (first (load-exp-from-file
;; (intern (string-upcase name-string)
;; "KEYWORD")
;; (format nil "~a.seed"
;; name-string))))))))
;; (list ,@contacts))))
;; :branches (list ,@(mapcar (lambda (branch)
;; `(make-instance 'branch
;; :name ,(intern (string-upcase
;; (first branch))
;; "KEYWORD")
;; :spec (quote ,branch)
;; ,@(build-medium (rest branch))))
;; branches)))))
;; (sprout :portal.demo1
;; :system (:description "This is a test portal.")
;; :package ((:use :cl))
;; :contacts (:demo-sheet :demo-graph :demo-image :demo-drawing :demo-market)
;; :branches ((systems (in (if-condition (is-display-format) (:then (codec)))
;; (put-image) (set-active-system-by-selection) (put-file (get-image) :-self))
;; (out (set-type -o :form) (put-image (build-stage -o)) (codec -o)))))
;; (defun thread-operation (input-symbol form &optional output)
;; (if (not form)
;; output (let ((head (first form)))
;; (thread-operation input-symbol (rest form)
;; (cons (first head)
;; (loop :for item :in (rest head)
;; :collect (cond ((listp item)
;; (thread-operation input-symbol (list item) output))
;; ((and (symbolp item)
;; (or (string= "-I" (string-upcase item))
;; (string= "-O" (string-upcase item))))
;; (if output output input-symbol))
;; (t item))))))))
;; (defun build-medium (specs)
;; (loop :for spec :in specs
;; :append (list (intern (string-upcase (first spec)) "KEYWORD")
;; `(lambda (input params branch sprout callback)
;; ,(thread-operation 'input (rest spec))))))
;; '((set-type -o :form) (put-image (build-stage -o)) (codec -o))
;;;-
(defmacro media (&rest media)
"Top-level wrapper for the nested media specification functions, which turns the list of media specs into arguments to the till macro. The order of the media specs is reversed so that the arguments to manifestMedia are intuitively ordered with the foundational spec first, modified by the specs coming after it."
(cons 'till (loop for media-spec in (reverse media)
append (macroexpand (list media-spec)))))
(defmacro specify-media (name &rest params)
"Define (part of) a growth pattern specification to be used with the till macro."
`(defmacro ,name ()
`(,@',params)))
(defgeneric for-branches-that (sprout origin-branch predicate action &optional branches-left))
(defmethod for-branches-that ((sprout sprout) (origin-branch branch) predicate action &optional branches-left)
"Perform an action on branches that match a given predicate."
(let* ((branches-left (if branches-left branches-left (sprout-branches sprout)))
(this-branch (first branches-left)))
(if branches-left
(progn (if (funcall predicate origin-branch this-branch)
(funcall action origin-branch this-branch))
(if (rest branches-left)
(for-branches-that sprout predicate action (rest branches-left)))))))
(defmacro germinate (is-portal portal-def)
"Create a new sprout, which may or may not be a portal, with a set of definition parameters."
(let ((port (gensym)) (sprout (gensym)) (callback (gensym)) (branch (gensym)) (data (gensym)) (params (gensym))
(portal-package-id (gensym)) (sprid (gensym)) (brname (gensym)) (list (gensym))
(data-out (gensym)) (params-out (gensym)))
(if is-portal
`(let ((,port ,portal-def))
;; assign portal object to *portal* and the grow method to the 'grow symbol
(setf (symbol-function (quote ,(intern "GROW" (package-name *package*))))
(lambda (,portal-package-id &optional ,sprid ,brname ,data ,params)
;; if this (grow) function is called with only the portal package argument, meaning
;; that most likely it is being invoked upon a Seed interface page load, clear the
;; active system so that the user is presented with the introductory screen.
;; This behavior works for the time being but it may eventually prove undesirable,
;; so later provisions may be made for someone reloading a Seed interface to pick up
;; immediately where they left off.
;;(print (list :data ,portal-package-id ,sprid ,brname ,data ,params))
(if (not ,sprid)
(setf (getf (sprout-meta ,port) :active-system)
nil))
(let ((,sprout (if ,sprid (find-portal-contact-by-sprout-name ,port ,sprid) ,port))
(,params (postprocess-structure ,params)))
;; if a sprout id and branch-name exist, input is being sent, so mediate
;; through the branch's input function
;;(print (list :exx ,sprout ,port ,sprid (find-branch-by-name ,brname ,sprout)))
(funcall (if ;; (and ,sprid ,brname)
;; TODO: is changing sprid for sprout workable?
(and ,sprout ,brname)
(lambda (,callback)
(let ((,branch (find-branch-by-name ,brname ,sprout)))
;; (print (list ,brname ,sprout ,branch))
;; (print (list 909 ,portal-package-id ,sprid ,brname ,data ,params
;; (mapcar #'branch-name (sprout-branches ,sprout))))
(labels ((assign-meta-from-list (,list)
(if ,list (progn (setf (getf (branch-meta ,branch) (first ,list))
(second ,list))
(assign-meta-from-list (cddr ,list))))))
(assign-meta-from-list (getf ,params :meta)))
(funcall (branch-input ,branch)
,data ,params ,branch ,sprout
(lambda (,data-out ,params-out)
(declare (ignorable ,data-out ,params-out))
(funcall ,callback)))))
(lambda (,callback) (funcall ,callback)))
(lambda ()
(if ,params (labels ((assign-meta-from-list (,list)
(if ,list (progn (setf (getf (sprout-meta ,sprout)
(first ,list))
(second ,list))
(assign-meta-from-list (cddr ,list))))))
(assign-meta-from-list ,params)))
;; invoke the special priority macro system
;; meta tags will be evaluated before macro expansion
;; the first step to doing this is to load the meta form
;; (setf (getf (sprout-meta ,sprout) :active-system)
;; "demo-drawing")
(if (instantiate-priority-macro-reader
(asdf:load-system (if ,sprid ,sprid ,portal-package-id)))
;; load the system if it doesn't exist yet
(mapcar (lambda (,branch)
(setf (getf ,params :to-display) t)
;; in any case, output is needed as well, so mediate appropriately
(funcall (branch-output ,branch)
,data ,params ,branch ,sprout
(lambda (,data-out ,params-out)
;; format the id and type list for JSON conversion
;; with string-downcase
(list :|id| (string-downcase (branch-name ,branch))
:|type| (mapcar #'string-downcase
(getf ,params-out :type))
:|data| ,data-out
:|meta| (preprocess-structure
(branch-meta ,branch))))))
(sprout-branches ,sprout))))))))
(setf (symbol-function (quote ,(intern "LOAD-SEED-SYSTEM" (package-name *package*))))
(lambda (symbol)
(instantiate-priority-macro-reader
(asdf:load-system symbol))))
(if (of-sprout-meta ,port :symbol)
(set (intern (string-upcase (of-sprout-meta ,port :symbol)))
,port)
(setq ,(intern "*PORTAL*" (package-name *package*))
,port)))
portal-def)))
(defmacro portal ()
"Instantiate a new portal."
`(progn (defvar ,(intern "*PORTAL*" (package-name *package*)))
;; declare *portal* variable
(load (asdf:system-relative-pathname
(intern (package-name *package*))
(concatenate 'string (string-downcase (package-name *package*)) ".seed")))))
| 37,863
|
Common Lisp
|
.lisp
| 777
| 43.34749
| 314
| 0.613656
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
82d279008cf157d7a45a78c07b7ab5717a86d815d23c243db6bce959cd05cb87
| 2,713
|
[
-1
] |
2,714
|
main.lisp
|
phantomics_seed/demo-blog/main.lisp
|
(IN-PACKAGE #:DEMO-BLOG)
(META
5
:MODE
(:MODEL
((META
(((META "First Post" :MODE
(:VIEW :TEXTFIELD :VALUE "First Post"))))
:MODE
(:VIEW :ITEM :TITLE "Load File" :REMOVABLE T :FORMAT-PROPERTIES
(:TYPE :LOAD) :MODEL
(((META "First Post" :MODE
(:VIEW :TEXTFIELD :VALUE "First Post"))))
:VALUE NIL)))
:VIEW :LIST :FILL-BY :SELECT :REMOVABLE NIL :OPTIONS
((:TITLE "New Blog Post" :VALUE
(META (((META "" :MODE (:VIEW :TEXTFIELD :VALUE "" :TITLE "Post Title")))) :MODE
(:VIEW :ITEM :TITLE "Post" :REMOVABLE T :FORMAT-PROPERTIES
(:TYPE :OUTPUT)))))
:FORMAT :BLOG-POST-LIST-EXPAND :VALUE NIL))
| 650
|
Common Lisp
|
.lisp
| 20
| 28.3
| 84
| 0.615873
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
b6130db298ad962af453a516f4b8a0c9114f17be1f0d6f8f1c8c063e9b4afa4f
| 2,714
|
[
-1
] |
2,715
|
document-slate.base.lisp
|
phantomics_seed/seed.app-model.document-slate.base/document-slate.base.lisp
|
;;;; slate.base.lisp
(in-package #:seed.app-model.document-slate.base)
(defun render-html (form)
(if (and (eq :document (first form))
(eq :nodes (caadr form))
(string= "document" (getf (second form) :kind)))
(mapcar #'render-node (cadadr form))))
(defun render-node (node)
(labels ((apply-marks (marks object)
(if marks
(let ((this-mark (first marks)))
(apply-marks (rest marks)
(cond ((string= "bold" (getf this-mark :type))
`(:strong ,object))
((string= "italic" (getf this-mark :type))
`(:em ,object))
(t object))))
object)))
(flet ((render-leaf (leaf)
(if (string= "leaf" (getf leaf :kind))
(if (getf leaf :marks)
(apply-marks (getf leaf :marks)
(getf leaf :text))
(getf leaf :text)))))
(cond ((eq :nodes (first node))
(cons (cond ((string= "paragraph" (getf node :type))
:p)
((string= "section" (getf node :type))
:p)
((string= "quote" (getf node :type))
:blockquote)
((string= "count" (getf node :type))
:ol)
((string= "points" (getf node :type))
:ul)
((string= "member" (getf node :type))
:li))
(if (eq :leaves (caaadr node))
(render-node (caadr node))
(mapcar #'render-node (second node)))))
((eq :leaves (first node))
(mapcar #'render-leaf (second node)))))))
(defmacro document-as-html (form)
(let ((stream-symbol (gensym)))
`(let ((,stream-symbol (make-string-output-stream)))
(cl-who:with-html-output (,stream-symbol)
(:div ,@(render-html form)))
(get-output-stream-string ,stream-symbol))))
| 1,642
|
Common Lisp
|
.lisp
| 48
| 28.25
| 58
| 0.579245
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
5aff45e7be274ef1e14e963ecd5afc6a3c97539da1e8d4e16557f0c6c7987fb7
| 2,715
|
[
-1
] |
2,716
|
package.lisp
|
phantomics_seed/seed.ui-spec.keys.map-apl/package.lisp
|
;;;; package.lisp
(defpackage #:seed.ui-spec.keys.map-apl
(:export #:key-ui-map-apl #:key-ui-map-apl-meta-specialized)
(:use #:cl #:parenscript #:seed.ui-model.keys))
| 172
|
Common Lisp
|
.lisp
| 4
| 40.75
| 62
| 0.688623
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
b8948e0c4904d117a2998a7cca43970d4b3f7a4369fabf5e83664247065acae7
| 2,716
|
[
-1
] |
2,717
|
keys.map-apl.lisp
|
phantomics_seed/seed.ui-spec.keys.map-apl/keys.map-apl.lisp
|
;;;; keys.map-apl.lisp
(in-package #:seed.ui-spec.keys.map-apl)
(specify-key-ui
key-ui-map-apl
;; This is an orthodox APL keymap. It is unsuitable for use when using the meta key (ctrl on PC systems and
;; command on Apple systems) as the modifier because most browsers do not allow the reassignment of the
;; meta-N, meta-T and meta-W key combinations.
:keymap
((write cmd (\` nil nil \◊)
(1 nil ! \¨ ⌶) (2 nil @ \¯ ⍫) (3 nil \# < ⍒) (4 nil $ ≤ ⍋) (5 nil % = ⌽) (6 nil ^ ≥ ⍉)
(7 nil & > ⊖) (8 nil * ≠ ⍟) (9 nil \( ∨ ⍱) (0 nil \) ∧ ⍲) (- nil _ × !) (= nil + ÷ ⌹)
(q nil nil ?) (w nil nil ⍵ ⍹) (e nil nil ∊ ⍷) (r nil nil ⍴) (t nil nil \∼ ⍨) (y nil nil ↑ ¥)
(u nil nil ↓) (i nil nil ⍳ ⍸) (o nil nil ○ ⍥) (p nil nil ⋆ ⍣) ([ nil { ← ⍞) (] nil } → ⍬)
(\\ nil \| ⊢ ⊣) (a nil nil ⍺ ⍶) (s nil nil ⌈) (d nil nil ⌊) (f nil nil _ ⍫) (g nil nil ∇)
(h nil nil ∆ ⍙) (j nil nil ∘ ⍤) (k nil nil \' ⌺) (l nil nil ⎕ ⌷) (\; nil \: ⍎ ≡) (\' nil \" ⍕ ≢)
(z nil nil ⊂) (x nil nil ⊃ χ) (c nil nil ∩ ⍧) (v nil nil ∪) (b nil nil ⊥ £) (n nil nil ⊤)
(m nil nil \|) (\, nil < ⍝ ⍪) (\. nil > nil ⍀) (/ nil ? ⌿ ⍠))))
(specify-key-ui
key-ui-map-apl-meta-specialized
;; This is an APL keymap specialized for use with the meta key in current browsers. Important characters
;; assigned to the N and W keys have been moved elsewhere. The tilde character assigned to T has simply been
;; removed since it is already present on most modern keyboards, and the commute operator ⍨ accessed by
;; pressing shift-meta-T has been reassigned to shift-meta-R.
:keymap
((write meta (\` nil nil \◊)
(1 nil ! \¨ ⌶) (2 nil @ \¯ ⍫) (3 nil \# < ⍒) (4 nil $ ≤ ⍋) (5 nil % = ⌽) (6 nil ^ ≥ ⍉)
(7 nil & > ⊖) (8 nil * ≠ ⍟) (9 nil \( ∨ ⍱) (0 nil \) ∧ ⍲) (- nil _ × !) (= nil + ÷ ⌹)
(q nil nil ?) (w nil nil nil ⍹) (e nil nil ∊ ⍷) (r nil nil ⍴ ⍨) (y nil nil ↑ ¥)
(u nil nil ↓) (i nil nil ⍳ ⍸) (o nil nil ○ ⍥) (p nil nil ⋆ ⍣) ([ nil { ← ⍞) (] nil } → ⍬)
(\\ nil \| ⊢ ⊣) (a nil nil ⍺ ⍶) (s nil nil ⌈) (d nil nil ⌊) (f nil nil ⍵ ⍫) (g nil nil ∇ _)
(h nil nil ∆ ⍙) (j nil nil ∘ ⍤) (k nil nil \' ⌺) (l nil nil ⎕ ⌷) (\; nil \: ⍎ ≡) (\' nil \" ⍕ ≢)
(z nil nil ⊂) (x nil nil ⊃ χ) (c nil nil ∩ ⍧) (v nil nil ∪) (b nil nil ⊥ £)
(m nil nil ⊤ \|) (\, nil < ⍝ ⍪) (\. nil > nil ⍀) (/ nil ? ⌿ ⍠))))
| 2,570
|
Common Lisp
|
.lisp
| 33
| 66.454545
| 109
| 0.507105
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
29bc1634b7993467028f79b85762dd58d34c6a52c7efd31f91d50ac9573f5cae
| 2,717
|
[
-1
] |
2,718
|
html-css.glyph-set-mdi.lisp
|
phantomics_seed/seed.ui-spec.html-css.glyph-set-mdi/html-css.glyph-set-mdi.lisp
|
;;;; html-css.glyph-set-mdi.lisp
(in-package #:seed.ui-spec.html-css.glyph-set-mdi)
(defmacro simple-icon (name)
``(:div :class-name "icon simple" (:i :class-name "material-icons" ,,(string-downcase name))))
(defmacro composite-icon (&key (main nil) (hint nil) (backdrop nil))
``(:div :class-name "icon-holder"
(:div :class-name "icon composition"
,,(if hint ``(:div :class-name "hint spot"
(:i :class-name "material-icons" ,,(string-downcase hint))))
(:div :class-name "main"
(:i :class-name "material-icons" ,,(string-downcase main)))
,,(if hint ``(:div :class-name "backdrop"
(:i :class-name "material-icons" ,,(string-downcase backdrop)))))))
(defmacro specify-icons (properties &rest icons)
(let* ((properties (rest properties))
(params-symbol (second (assoc :params-symbol properties)))
(macro-symbol (second (assoc :macro-symbol properties)))
(icon-specs (loop for icon in icons collect (list (first icon)
params-symbol (macroexpand (second icon))))))
`(defmacro ,macro-symbol ()
(declare (ignorable ,params-symbol))
(quote ,icon-specs))))
(specify-icons (with (:macro-symbol material-design-glyph-set-common)
(:params-symbol params))
(face (simple-icon face))
(cake (simple-icon cake))
(close (simple-icon close))
(sortable (simple-icon unfold_more))
(chart-editor (composite-icon :main show_chart :hint add :backdrop crop_square)))
| 1,464
|
Common Lisp
|
.lisp
| 29
| 45.241379
| 96
| 0.665035
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
f6f38b9f59f50a0b5413ec02130d54d182fea03f2b25d241ff26a32c412bcb61
| 2,718
|
[
-1
] |
2,719
|
package.lisp
|
phantomics_seed/seed.app-model.sheet.base/package.lisp
|
;;;; package.lisp
(defpackage #:seed.app-model.sheet.base
(:use #:cl #:jonathan #:parse-number)
(:import-from :swank-backend #:arglist)
(:export #:interpret-cell #:in-table #:cell #:cells #:to-cell
#:cell-right #:cell-left #:cell-up #:cell-down #:make-cell #:row #:col))
| 284
|
Common Lisp
|
.lisp
| 6
| 44.166667
| 76
| 0.655797
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
67098e1af279e168acc751b6c1e5240c4615129566d5b5e8d7f3a9799202775f
| 2,719
|
[
-1
] |
2,720
|
sheet.base.lisp
|
phantomics_seed/seed.app-model.sheet.base/sheet.base.lisp
|
;;;; sheet.base.lisp
(in-package #:seed.app-model.sheet.base)
(defun list-to-2d-array (list)
(make-array (list (length list)
(length (first list)))
:initial-contents list))
(defun array-map (function &rest arrays)
"maps the function over the arrays.
Assumes that all arrays are of the same dimensions.
Returns a new result array of the same dimension."
(flet ((make-displaced-array (array)
(make-array (reduce #'* (array-dimensions array))
:displaced-to array)))
(let* ((displaced-arrays (mapcar #'make-displaced-array arrays))
(result-array (make-array (array-dimensions (first arrays))))
(displaced-result-array (make-displaced-array result-array)))
(declare (dynamic-extent displaced-arrays displaced-result-array))
(apply #'map-into displaced-result-array function displaced-arrays)
result-array)))
(defun numeric-string-p (string)
(handler-case (progn (parse-number:parse-number string) t)
;; parse succeeded, discard it and return true (t)
(parse-number::invalid-number ()
nil)
;; TODO: the above invalid-number condition should work instead of the condition below - why not?
(condition () nil)))
(defun prepare-cell (cell-data)
(if (or (null cell-data)
(eq :inp (cadar cell-data)))
cell-data (prepare-cell (rest cell-data))))
(defun interpret-cell (cell)
(if (and (getf cell :data-inp)
(eq :unknown (getf cell :type)))
(if (numeric-string-p (getf cell :data-inp))
(setf (getf cell :data-inp)
(parse-number (getf cell :data-inp))
(getf cell :type)
:number)
(setf (getf cell :type)
:string)))
(if (getf cell :data-inp-ovr)
(progn (if (numeric-string-p (getf cell :data-inp-ovr))
(setf (getf cell :data-inp)
(parse-number (getf cell :data-inp-ovr))
(getf cell :type)
:number)
(setf (getf cell :data-inp)
(getf cell :data-inp-ovr)
(getf cell :type)
:string))
(remf cell :data-inp-ovr)))
cell)
(defun preprocess-cell (cell)
(let ((interpreted (interpret-cell cell)))
(if (getf interpreted :data-com)
(remf interpreted :data-com))
interpreted))
(defun postprocess-cell (cell)
(if (getf cell :data-com)
(let ((com-value (first (getf cell :data-com))))
(setf (getf cell :type)
(if (numberp com-value)
:number
(if (stringp com-value)
:string
(if (functionp com-value)
(progn (setf (getf cell :args-count)
(length (arglist com-value)))
:function)
(if (symbolp com-value)
:symbol)))))
(setf (getf cell :data-com)
(mapcar (lambda (item)
(cond ((functionp item)
"function")
((symbolp item)
(string-downcase item))
(t item)))
(getf cell :data-com)))))
cell)
(defun translate-cell-coordinates (coord-string &optional original-length coords-out)
(if (symbolp coord-string)
(translate-cell-coordinates (string-upcase coord-string))
(if (< 0 (length coord-string))
(let* ((original-length (if original-length original-length (length coord-string)))
(current-char (char-upcase (char coord-string 0))))
(labels ((char-to-colnum (char number)
(let ((char-index-offset 65)) ;; index of the character 'A'
(+ (* number 26)
(- (char-int (character (string-upcase char)))
char-index-offset))))
(find-next-char (str &optional index)
(let ((index (if index index 0)))
(if (or (= 0 (length str))
(not (numeric-string-p (subseq str 0 1))))
index (find-next-char (subseq str 1)
(1+ index))))))
(translate-cell-coordinates (subseq coord-string (max 1 (find-next-char coord-string)))
original-length
(if (or (not coords-out)
(not (numeric-string-p (subseq coord-string 0 1))))
(cons (char-to-colnum current-char
(if (not coords-out) 0
(1+ (first coords-out))))
(rest coords-out))
(cons (1- (parse-number coord-string))
coords-out)))))
coords-out)))
(defun classify-operation (op)
(if (and op (listp op))
(if (symbolp (first op))
(let ((item (string-upcase (first op))))
(cond ((equal "VAL-NUMBER" item) :number)
((equal "VAL-STRING" item) :string)
(t (classify-operation (rest op)))))
(if (listp (first op))
(let ((sub-list (classify-operation (first op))))
(if sub-list sub-list (classify-operation (rest op))))
(classify-operation (rest op))))))
(defmacro in-table (table-id &body body)
`(let ((working-table (array-map #'preprocess-cell ,table-id)))
,@body
(setq ,table-id (array-map #'postprocess-cell working-table))))
(defmacro cell (coords-or-string &optional operation)
(let* ((coords (if (stringp coords-or-string)
(translate-cell-coordinates coords-or-string)
coords-or-string))
(cell-ref `(aref working-table ,(first coords) ,(second coords))))
(labels ((get-cell-value-or (&optional default)
`(if (getf ,cell-ref :data-com) (first (getf ,cell-ref :data-com))
(if (getf ,cell-ref :data-inp) (getf ,cell-ref :data-inp) ,default))))
(if (null operation)
(get-cell-value-or nil)
`(progn (setf (getf ,cell-ref :data-com)
(cons (let (,@(cond ((eq :number (classify-operation operation))
`((,(intern "VAL-NUMBER" (package-name *package*))
,(get-cell-value-or 0))))
((eq :string (classify-operation operation))
`((,(intern "VAL-STRING" (package-name *package*))
,(get-cell-value-or "")))))
(,(intern "CELL-TYPE" (package-name *package*))
(getf ,cell-ref :type)))
(declare (ignorable ,(intern "CELL-TYPE" (package-name *package*))))
(macrolet ((,(intern "TO-CELL" (package-name *package*))
(vector1 vector2)
`(cell (,(+ vector1 ,(first coords))
,(+ vector2 ,(second coords)))))
(,(intern "CELL-UP" (package-name *package*))
(&optional distance)
`(,(quote ,(intern "TO-CELL" (package-name *package*)))
,(if distance (- distance) -1) 0))
(,(intern "CELL-DOWN" (package-name *package*))
(&optional distance)
`(,(quote ,(intern "TO-CELL" (package-name *package*)))
,(if distance distance 1) 0))
(,(intern "CELL-LEFT" (package-name *package*))
(&optional distance)
`(,(quote ,(intern "TO-CELL" (package-name *package*)))
0 ,(if distance (- distance) -1)))
(,(intern "CELL-RIGHT" (package-name *package*))
(&optional distance)
`(,(quote ,(intern "TO-CELL" (package-name *package*)))
0 ,(if distance distance 1))))
,operation))
(getf ,cell-ref :data-com)))
,cell-ref)))))
(defmacro cells (coords1 coords2 &optional operation)
`(let* ((coords (list (list ,@(if (stringp coords1)
(translate-cell-coordinates coords1)
coords1))
(list ,@(if (stringp coords2)
(translate-cell-coordinates coords2)
coords2))))
(start-col (cadar coords))
(start-row (caar coords))
(cols-dim (- (cadadr coords)
(cadar coords)))
(rows-dim (- (caadr coords)
(caar coords))))
(labels ((proc-cells-row (table row col limit width output-table index)
(progn (setf (aref output-table
(second limit)
(first limit))
(cell (row col)
,@(if (null operation)
nil (list operation))))
(if (and (= rows-dim (first limit))
(= cols-dim (second limit)))
output-table
(proc-cells-row table (if (= cols-dim (second limit))
(1+ row) row)
(if (= cols-dim (second limit))
start-col (1+ col))
(list (if (= cols-dim (second limit))
(1+ (first limit))
(first limit))
(if (= cols-dim (second limit))
0 (1+ (second limit))))
width output-table
(1+ index))))))
(proc-cells-row working-table start-row start-col (list 0 0) rows-dim
(make-array (list (1+ cols-dim) (1+ rows-dim)) :initial-element nil)
0))))
(defmacro row (index &optional operation)
`(let* ((dims (array-dimensions working-table))
(col-max (1- (second dims)))
(ix (1- ,index)))
(cells (ix 0) (ix col-max)
,@(if operation (list operation)))))
(defmacro col (index &optional operation)
`(let* ((dims (array-dimensions working-table))
(row-max (1- (first dims)))
(ix ,(if (stringp index)
(first (translate-cell-coordinates index))
index)))
(cells (0 ix) (row-max ix)
,@(if operation (list operation)))))
;; (defun cell-scan (dims start-point end-point)
;; (let ((row-dim (first dims))
;; (col-dim (second dims))
;; (row-start (first start-point))
;; (col-start (second start-point))
;; (row-end (first end-point))
;; (col-end (second end-point)))
;; (labels ((add-entry (point acc)
;; (let ((row (first point))
;; (col (second point)))
;; (add-entry (list (if (= 0
;; col)
;; (- 1 row)
;; row)
;; (if (= 0
;; col)
;; (col-dim)
;; (- 1 col)))
;; (cons (if ()))))
(defmacro graph-steps (function-name &rest nodes)
(let ((node-ids (mapcar #'first nodes)))
`(let ((nodes (vector ,@(mapcar (lambda (node)
`(lambda (&optional content)
(values ,(getf node :content)
(lambda (input)
(cond ,@(mapcar (lambda (link link-index)
(let ((nix (position (first link)
node-ids)))
(cond ((eq :option (getf node :type))
`((= input ,link-index)
(funcall (aref nodes ,nix)
content)))
((eq :switch (getf node :type))
`((= input ,link-index)
(funcall (aref nodes ,nix)
content))))))
(getf node :links)
(loop for i from 0 to
(1- (length (getf node :links)))
collect i)))))))
(mapcar #'rest nodes)))))
(defun ,function-name ()
(funcall (aref nodes 0))))))
| 10,119
|
Common Lisp
|
.lisp
| 260
| 32.084615
| 101
| 0.588863
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
e1622ec16a9ce86e50d8b1f72e31ef63d5d593a756b57cca23daf78b262b78f6
| 2,720
|
[
-1
] |
2,721
|
package.lisp
|
phantomics_seed/seed.ui-model.react/package.lisp
|
;;;; package.lisp
(defpackage #:seed.ui-model.react
(:export #:react-ui #:component-set #:handle-actions #:extend-state #:subcomponent #:vista)
(:use #:cl #:parenscript #:panic #:symbol-munger))
| 201
|
Common Lisp
|
.lisp
| 4
| 47.75
| 93
| 0.697436
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
c2b29f4c788ece6d7d9d015d26bcb938a51642a8bdb0a8992e2dc3f6c8f627ff
| 2,721
|
[
-1
] |
2,722
|
ui-model.react.lisp
|
phantomics_seed/seed.ui-model.react/ui-model.react.lisp
|
;;;; ui-model.react.lisp
(in-package #:seed.ui-model.react)
(defparameter *this-package-name* (package-name *package*))
(defpsmacro handle-actions (action-obj state props &rest pairs)
;; Handle actions that propagate to a component according to the component's properties,
;; such as whether it is currently the point or along the path of the point trace.
(let ((conditions (list :actions-any-branch
;; actions to be taken for all branches available
(lambda (action-list)
`(cond ,@(mapcar (lambda (action)
(let ((action-id (first action))
(action-content (rest action)))
`((= action ,(lisp->camel-case action-id))
,@action-content
(if action-confirm (action-confirm)))))
action-list)))
:actions-branch-id
;; actions to be taken when the branch's id matches one specified
(lambda (action-list)
`(cond ,@(mapcar (lambda (action)
(let ((action-id (first action))
(branch-id (second action))
(action-content (cddr action)))
`((and (= action ,(lisp->camel-case action-id))
(= ,branch-id (@ self state data id)))
,@action-content
(if action-confirm (action-confirm)))))
action-list)))
:actions-point
(lambda (action-list)
`(cond ,@(mapcar (lambda (action)
(let ((action-id (first action))
(action-content (rest action)))
`((and (= action ,(lisp->camel-case action-id))
(or (@ state context is-point)
(and (@ props meta)
(@ props meta is-point))))
,@action-content
(if action-confirm (action-confirm)))))
action-list)))
:actions-point-and-focus
(lambda (action-list)
`(cond ,@(mapcar (lambda (action)
(let ((action-id (first action))
(action-content (rest action)))
`((and (= action ,(lisp->camel-case action-id))
;(@ state context in-focus)
(or (@ state context is-point)
(and (@ props meta)
(@ props meta is-point))))
;(chain console (log 33 (@ state context)))
(if (and (@ state point-attrs)
(@ state point-attrs props)
(@ state point-attrs props meta)
(@ state point-attrs props meta if)
(@ state point-attrs props meta if interaction)
(@ self interactions)
(getprop self "interactions"
(chain state point-attrs props meta if
interaction (substr 2)))
(getprop self "interactions"
(chain state point-attrs props meta if
interaction (substr 2))
,(lisp->camel-case action-id)))
(funcall (getprop self "interactions"
(chain state point-attrs props meta if
interaction (substr 2))
,(lisp->camel-case action-id))
self (@ state point-data))
(progn ,@action-content))
(if action-confirm (action-confirm)))))
action-list))))))
`(if ,action-obj (let ((action (@ ,action-obj id))
(params (@ ,action-obj params))
(action-confirm (@ ,action-obj confirm))
(state ,state) (props ,props))
,@(loop for item in pairs when (and (keywordp item) (getf conditions item))
collect (funcall (getf conditions item)
(getf pairs item)))))))
(defpsmacro extend-state (&rest items)
"Extend the state of a component using an object or array."
(let ((deep (eq :deep (first items))))
(labels ((process-pairs (items &optional output)
(if items
(process-pairs (cddr items)
(append output (list (first items)
`(chain j-query (extend ,@(if deep (list t))
(create)
(@ self state ,(first items))
,(second items))))))
output)))
`(chain self (set-state (create ,@(process-pairs (if deep (rest items)
items))))))))
;; (defmacro subcomponent (symbol data &optional &key (context nil) (addendum nil))
;; ;; Create a subcomponent for use within a Seed interface.
;; (declare (ignorable addendum))
;; (labels ((assign-sub-context (pairs &optional output)
;; (if pairs
;; (assign-sub-context (cddr pairs)
;; (append (list `(@ sub-con ,(first pairs)) (second pairs))
;; output))
;; output)))
;; `(panic:jsl (,(if (symbolp symbol)
;; (intern (string-upcase symbol) "KEYWORD")
;; symbol)
;; :data ,data
;; :context (let ((sub-con (chain j-query (extend t (create) (@ self state context)))))
;; (progn ,(cons 'setf (assign-sub-context context))
;; sub-con))
;; :action (if (not (= "undefined" (typeof (@ self act))))
;; ;; the act property is only present at the top-level portal component
;; (@ self state action)
;; (@ self props action))))))
(defpsmacro subcomponent (symbol data &optional &key (context nil) (addendum nil))
;; Create a subcomponent for use within a Seed interface.
(declare (ignorable addendum))
(labels ((assign-sub-context (pairs &optional output)
(if pairs
(assign-sub-context (cddr pairs)
(append (list `(@ sub-con ,(first pairs)) (second pairs))
output))
output)))
`(panic:jsl (,(if (symbolp symbol)
(intern (string-upcase symbol) "KEYWORD")
symbol)
:data ,data
:context (let ((sub-con (chain j-query (extend t (create) (@ self state context)))))
(progn ,(cons 'setf (assign-sub-context context))
sub-con))
:action (if (not (= "undefined" (typeof (@ self act))))
;; the act property is only present at the top-level portal component
(@ self state action)
(@ self props action))))))
(defpsmacro vista (space context fill-by &optional respond-by encloser)
;; Create a vista, which contains components or sub-vistas within a Seed interface.
`(panic:jsl (:-vista :key (+ "vista-" index)
:fill ,fill-by
:extend-response ,respond-by
:enclose ,(if encloser encloser `(lambda (item) item))
:data (@ self state data)
:space ,space
:context ,context
:action (if (not (= "undefined" (typeof (@ self act))))
;; the act property is only present at the top-level portal component
(@ self state action)
(@ self props action)))))
(defmacro specify-components (name &rest params)
"Define (part of) a component set specification to be used in building a React interface."
`(defmacro ,name ()
`(,@',params)))
(defmacro component-set (name &rest components)
"Top-level wrapper for the component specification functions, which turns the list of component definitions into a form ready for conversion to Javascript. The order of the component definitions is reversed so that the components are produced in Javascript in the same order as they are listed."
(labels ((process-subcomponents (items &optional output)
(if (not items)
output (process-subcomponents (cddr items)
(append (list (symbol-munger:lisp->camel-case (first items))
(if (symbolp (second items))
(macroexpand (list (second items)))
(second items)))
output)))))
`(setq ,name (funcall (lambda ()
(let ((pairs (create))
(self this))
,@(loop for item in components append
(if (listp item)
`((funcall (lambda ()
(let ((subcomponents (create ,@(process-subcomponents
(rest item)))))
,@(mapcar (lambda (item)
(if (getf (second item) :permute)
`(progn (defcomponent
(@ pairs ,(first item))
,@(rest item))
(setf (@ pairs ,(first item))
(funcall
,(getf (second item)
:permute)
(@ pairs ,(first item)))))
`(defcomponent (@ pairs ,(first item))
,@(rest item))))
(macroexpand (list (first item))))))))
(mapcar (lambda (item)
(if (getf (second item) :permute)
`(progn (defcomponent
(@ pairs ,(first item))
,@(rest item))
(setf (@ pairs ,(first item))
(funcall
,(getf (second item)
:permute)
(@ pairs ,(first item)))))
`(defcomponent (@ pairs ,(first item))
,@(rest item))))
(macroexpand (list item)))))
pairs))))))
(defmacro react-ui (options &rest components)
"Generate a React-based Seed user interface."
(let* ((id (gensym)) (params (gensym))
(ops (rest options))
(url (second (assoc :url ops)))
(component (second (assoc :component ops)))
(glyph-forms (loop :for set :in (rest (assoc :glyph-sets ops))
:append (macroexpand (if (listp set)
set (list set)))))
(glyph-conditions (loop :for form :in glyph-forms :append `(((eq ,id ,(intern (string-upcase (first form))
"KEYWORD"))
(let ((,(second form) ,params))
`(panic:jsl ,,(third form))))))))
(list :prepend `((defpsmacro seed-icon (,id &rest ,params)
(cond ,@glyph-conditions)))
:content
(append (loop for comp in components append (macroexpand (if (listp comp)
comp (list comp))))
`((chain j-query
(ajax (create url ,(concatenate 'string "../" url)
type "POST"
data-type "json"
content-type "application/json; charset=utf-8"
data (chain -j-s-o-n (stringify (list (@ window portal-id) "grow")))
success (lambda (data)
(chain -react-d-o-m
(render (panic:jsl (,component :data data))
(chain document
(get-element-by-id "main")))))))))))))
| 9,729
|
Common Lisp
|
.lisp
| 224
| 35.1875
| 297
| 0.586203
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
fb75e77cee2109b018acf4efa2b83e2660a7e5dfd675b142ed88415ce4b7e43a
| 2,722
|
[
-1
] |
2,723
|
form.mode-text.lisp
|
phantomics_seed/seed.ui-spec.form.mode-text/form.mode-text.lisp
|
;;;; form.mode-text.lisp
(in-package #:seed.ui-model.react)
(defpsmacro cl (&rest items)
`(chain console (log ,@items)))
(specify-components
text-view-mode
(text-view
(:get-initial-state
(lambda ()
(chain j-query (extend (create point #(0 0)
point-attrs (create value nil delta nil)
meta (chain j-query (extend t (create max-depth 0
confirmed-value nil
invert-axis (list false true))
(@ this props data meta)))
read-only t)
(chain this (initialize (@ this props))))))
:initialize
(lambda (props)
(let* ((self this)
(state (funcall inherit self props
(lambda (d) (chain j-query (extend (@ props data) (@ d data))))
(lambda (pd) (@ pd data data)))))
;; (if (@ self props context trace-category)
;; (chain self props context methods (register-branch-path (@ self props context trace-category)
;; (@ self props data id)
;; (@ state context path))))
(if (@ self props context set-interaction)
(progn (chain self props context
(set-interaction "commit" (lambda () (chain self state context methods
(grow-branch (chain self editor-instance
code-mirror doc
(get-value))
(create save true))))))
(chain self props context
(set-interaction "revert" (lambda () (chain self state context methods
(grow-branch (chain self editor-instance
code-mirror doc
(get-value))
(create revert true)))
(chain self editor-instance code-mirror doc
(set-value (@ self props data data))))))))
state))
:element-specs #()
:editor-instance nil
:modulate-methods
(lambda (methods)
(let* ((self this)
(to-grow (if (@ self props context working-system)
(chain methods (in-context-grow (@ self props context working-system)))
(@ methods grow))))
(chain j-query
(extend (create set-delta (lambda (value) (extend-state point-attrs (create delta value))))
methods (create grow-branch (lambda (space meta callback)
(to-grow (@ self state data id)
space meta callback)))))))
;; :set-confirmed-value
;; (lambda (value)
;; (chain this (set-state (create confirmed-value value))))
:component-will-receive-props
(lambda (next-props)
(defvar self this)
(let ((new-state (chain this (initialize next-props))))
;;(cl :news new-state)
(if (@ self state context is-point)
(setf (@ new-state action-registered)
(@ next-props action)))
(chain this (set-state new-state)))
(if (and (not (@ self state pane-element))
(not (= "undefined" (typeof (@ self props context fetch-pane-element)))))
(setf (@ new-state pane-element)
(chain (j-query (+ "#branch-" (@ self props context index)
"-" (@ self props data id))))))
(handle-actions
(@ next-props action) (@ self state) next-props
:actions-any-branch
((set-branch-by-id
(if (= (@ params id) (@ self props data id))
(chain self props context methods (set-trace (@ self props context path))))))
:actions-point-and-focus
((move
(if (@ params vector 0)
(chain self editor-instance code-mirror (exec-command (if (= -1 (@ params vector 0))
"goCharLeft" "goCharRight"))))
(if (@ params vector 1)
(chain self editor-instance code-mirror (exec-command (if (= -1 (@ params vector 1))
"goLineDown" "goLineUp")))))
;; (delete-point
;; (if (not (= true (@ next-props data meta locked)))
;; (chain self state context methods (grow-point nil (create)))))
;; (record
;; (if (@ self props context clipboard-id)
;; (chain self state context methods (grow-point (create)
;; (create vector (@ params vector)
;; point (@ self state point)
;; branch (@ self state data id))
;; (@ self props context clipboard-id)))))
;; (recall
;; (if (and (@ self props context history-id)
;; (not (= true (@ next-props data meta locked))))
;; (chain self state context methods (grow-point (create)
;; (create vector (@ params vector)
;; "recall-branch" (@ self state data id))
;; (@ self props context history-id)))))
(trigger-primary
(cond ((= "move" (@ self state context mode))
(chain self editor-instance (focus))
(chain self state context methods (set-mode "write"))
(chain self (set-state (create read-only false)))
(chain self editor-instance code-mirror (set-option "readOnly" false)))))
(insert-char
(chain self editor-instance code-mirror doc
(replace-range (@ params char)
(chain self editor-instance code-mirror doc (get-cursor))))
false)
(trigger-secondary
(chain self editor-instance (focus))
(chain self state context methods (set-mode "write"))
(chain self (set-state (create read-only false)))
(chain self editor-instance code-mirror (set-option "readOnly" false)))
(trigger-anti
(chain self state context methods (set-mode "move"))
(chain self (set-state (create read-only t))))
(commit
(if (not (= true (@ next-props data meta locked)))
(chain self state context methods (grow-branch (chain self editor-instance code-mirror doc (get-value))
(create save true)))))))
)
:should-component-update
(lambda (next-props next-state)
(or (not (@ next-state context current))
(not (= (@ next-state context mode)
(@ this state context mode)))
;;(@ next-state action-registered)
))
;; :component-did-update
;; (lambda ()
;; (if (and (= "set" (@ this state context mode))
;; (@ this state context is-point))
;; (chain (j-query (+ "#sheet-view-" (@ this props data id)
;; " .atom.mode-set.point .editor input"))
;; (focus))))
)
(let ((self this))
;;(cl "SHR" (@ this state just-updated))
;; (chain console (log :cel (@ self state data) (@ self props context) (@ self state context)))
;;(chain console (log :ssp (@ self state space)))
;;(let ((-data-sheet (new -react-data-sheet)))
;;(chain console (log :dd (@ self props context)))
;;(cl 990 (@ self state context))
(panic:jsl (:div :class-name "text-pane-outer"
(:-code-mirror :value (@ self state data data)
:ref (lambda (ref) (if (not (@ self editor-instance))
(setf (@ self editor-instance) ref)))
;; :on-focus-change (lambda (in-focus)
;; (cl :ed (@ self editor-instance))
;; (chain self state context methods
;; (set-mode (if in-focus "write" "move"))))
:options (create theme "solarized light" key-map "basic"
line-wrapping t line-numbers t
read-only (@ self state read-only)))
(:div :class-name "status-bar"
(if (= "move" (@ self state context mode))
"navigate" "edit")))))))
| 7,168
|
Common Lisp
|
.lisp
| 164
| 36.542683
| 113
| 0.590312
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
ac84a53aeb07d20a97d7618be50ab044486109fdefa26e816bdb4ccb70deda11
| 2,723
|
[
-1
] |
2,724
|
form.base.lisp
|
phantomics_seed/seed.ui-spec.form.base/form.base.lisp
|
;;;; seed.ui-spec.form.base.lisp
(in-package #:seed.ui-model.react)
(specify-components
form-view-mode
(form-view
(:get-initial-state
(lambda ()
(chain j-query (extend (create point (if (= "full" (@ this props context view-scope))
#(0 0) #(0))
point-attrs (create index 0 value nil delta nil start 0 fresh t
depth 0 breadth 1 path #() props #())
point-data nil
index -1
focus (create meta 0 macro 0)
;; TODO: glyphs are only assigned here
meta (chain j-query (extend t (create)
(@ this props data meta)
(create max-depth 0
confirmed-value nil))))
(chain this (initialize (@ this props))))))
:element-specs #()
:root-params (create)
:initialize
(lambda (props)
(let* ((self this)
(state (funcall inherit self props
(lambda (d) (chain j-query (extend t (create) (@ d data) (@ props data))))
(lambda (pd) (@ pd data data)))))
;; (if (and (@ props data meta)
;; (@ self state)
;; (@ self state point-attrs)
;; (not (= "undefined" (typeof (@ props data meta point-to))))
;; (not (= "full" (@ props context view-scope))))
;; (setf (@ state point-attrs)
;; (chain j-query (extend (@ self state point-attrs)
;; (create index (@ props data meta point-to))))))
;; TODO: copy of point-to was eliminated here to prevent paradoxes; see if it's not needed
;; (cl 15 (@ props data data))
(if (@ self props context set-interaction)
(progn (chain self props context
(set-interaction "commit" (lambda () (chain self state context methods
(grow #() (create save true))))))
(chain self props context
(set-interaction "revert" (lambda () (chain self state context methods
(grow #() (create revert true))))))))
(if (@ self props context trace-category)
(chain self props context methods (register-branch-path (@ self props context trace-category)
(@ self props data id)
(@ state context path))))
state))
:modulate-methods
(lambda (methods)
(let* ((self this)
(to-grow (if (@ self props context parent-system)
(chain methods (in-context-grow (@ self props context parent-system)))
(@ methods grow))))
(chain j-query
(extend (create set-delta (lambda (value) (extend-state point-attrs (create delta value)))
set-point (lambda (datum) (chain self (set-point (list (@ datum ly) (@ datum ct)))))
sort (lambda (point new-index)
;; NOTE: This function changes the state data in place as opposed to creating
;; a copy and feeding it to the grow function. The creation of the new copy
;; results in a cyclic reference in the JSON structure. Is this a problem?
(chain self (seek point (@ point 0) (@ self state space)
(lambda (target target-list target-parent target-index path)
(let ((from nil)
(to nil))
(loop for index from 1 to (1- (@ target-parent length))
do (if (= (getprop target-parent index 0 "ct")
(@ point 1))
(setq from index)
(if (= (getprop target-parent index 0 "ix")
(@ new-index ix))
(setq to index))))
(chain target-parent 0
(md (lambda (data)
(chain data
(splice to 0
(@ (chain data (splice from 1)
0))))
data)))
(chain self state context methods (grow)))))))
delete-point (lambda (point) (chain self (delete-point point))))
methods
(create grow
(lambda (data meta alternate-branch)
(let ((space (let ((new-space (chain j-query (extend #() (@ self state space)))))
(chain self (assign (@ self state point-attrs index)
new-space data)))))
(to-grow (if (= "undefined" (typeof alternate-branch))
(@ self state data id)
alternate-branch)
;; TODO: it may be desirable to add certain metadata to
;; the meta for each grow request, that's what the
;; derive-metadata function below may later be used for
space meta)))
grow-branch
(lambda (space meta callback)
(to-grow (@ self state data id)
space meta callback)))))))
;; :derive-metadata
;; (lambda ()
;; (let ((self this))
;; (create point-to (if (@ self state point-attrs)
;; (@ self state point-attrs path)))))
;; :grow-this-branch
;; (lambda (space)
;; (chain this props context methods (grow (@ this state data id)
;; space (create meta (chain this (derive-metadata))))))
:interactions
(create select-system (create click (lambda (self datum)
(chain self (set-state (create index (@ datum ix))))
(chain self (set-point datum))
(funcall (@ self props context methods load-branch)
(@ datum vl)))
trigger-primary (lambda (self datum)
(chain self (set-state (create index (@ datum ix))))
(funcall (@ self props context methods load-branch)
(@ datum vl)))
trigger-secondary (lambda (self datum)
(chain self (set-state (create index (@ datum ix))))
(funcall (@ self props context methods load-branch)
(@ datum vl))))
;;add-graph-node (create click (lambda (self datum) (cl :9080)))
select-branch (create click (lambda (self datum)
(chain self props context methods
(set-branch-by-id (@ datum vl))))
trigger-primary (lambda (self datum)
(cl :tr)
(chain self props context methods
(set-branch-by-id (@ datum vl))))
trigger-secondary (lambda (self datum)
(chain self props context methods
(set-branch-by-id (@ datum vl)))))
;; commit (create click (lambda (self datum)
;; (funcall (chain self props context (get-interaction "commit"))))
;; trigger-primary (lambda (self datum)
;; (funcall (chain self props context (get-interaction "commit"))))
;; trigger-secondary (lambda (self datum)
;; (funcall (chain self props context (get-interaction "commit")))))
revert (create click (lambda (self datum)
(funcall (chain self props context (get-interaction "revert"))))
trigger-primary (lambda (self datum)
(funcall (chain self props context (get-interaction "revert"))))
trigger-secondary (lambda (self datum)
(funcall (chain self props context (get-interaction "revert")))))
insert
(create
click (lambda (self datum)
(let* ((branch (@ self props context branch))
(new-space (chain j-query (extend #() (@ branch state space)))))
(chain branch (seek (@ branch state point) (@ branch state point 0) new-space
(lambda (target target-list target-parent target-index path)
;(cl :form (@ datum mt format) target-parent)
;(chain target-parent (splice target-index 0 (@ datum mt format)))
(setf (getprop target-parent target-index)
(@ datum mt format)))))
(chain branch state context methods (grow new-space))))
trigger-primary (lambda (self datum)
(let* ((branch (@ self props context branch))
(new-space (chain j-query (extend #() (@ branch state space)))))
(chain branch (seek (@ branch state point) (@ branch state point 0) new-space
(lambda (target target-list target-parent target-index path)
;(cl :form (@ datum mt format) target-parent)
(setf (getprop target-parent target-index)
(@ datum mt format)))))
(chain branch state context methods (grow new-space))))))
:interact
(lambda (datum alternative)
(let ((self this))
(if (and datum (@ datum pr) (@ datum pr meta)
(@ datum pr meta mode) (@ datum pr meta mode interaction)
(not (= "undefined" (typeof (getprop (@ self interactions)
(chain datum pr meta mode interaction (substr 2))))))
(not (= "undefined" (typeof (getprop (@ self interactions)
(chain datum pr meta mode interaction (substr 2))
"triggerPrimary")))))
(funcall (getprop (@ self interactions) (chain datum pr meta mode interaction (substr 2))
"triggerPrimary")
self datum)
(funcall alternative))))
:set-focus
(lambda (key value)
(let* ((self this)
(new-object (chain j-query (extend (create) (@ self state focus)))))
(setf (getprop new-object key)
(min 1 (max 0 value)))
(extend-state focus new-object)))
:shift-focus
(lambda (key vector)
(let* ((self this)
(new-object (chain j-query (extend (create) (@ self state focus)))))
(setf (getprop new-object key)
(min 1 (max 0 (+ (getprop (@ self state focus) key)
(@ vector 0)))))
(extend-state focus new-object)))
:set-point
(lambda (target path)
(let ((self this)
(path (if path path (list (@ target ly) (@ target ct)))))
(if target ;; just in case a null target is passed, which shouldn't happen
(progn (chain self (set-state (create point (if (= 2 (@ self state point length))
;; assign the point depending on this form's
;; spatial dimensions
(list (@ target ly) (@ target ct))
(list (@ target ct)))
point-data target
action-registered t
;; need to set this so that component updates
point-attrs
(chain j-query (extend (create)
(@ self state point-attrs)
(create index (@ target ix)
fresh false
props (chain j-query
(extend t (create)
(@ target pr)))
value (if (@ target vl)
(@ target vl)
nil)
path path
start (@ target ct)
atom-macros (if (@ target am)
(@ target am)
#())
form-macros (if (@ target fm)
(@ target fm)
#())
depth (@ target dp)
is-atom (if (@ target br)
false t)
breadth (if (@ target br)
(@ target br)
1)))))))
(if (and (not (= "undefined" (typeof (@ self state pane-element))))
(< 0 (@ self element-specs length)))
(progn (if (< (+ (@ self state pane-element 0 client-height)
(@ self state pane-element 0 scroll-top))
(getprop (@ self element-specs) (@ target ix) "top"))
(setf (@ self state pane-element 0 scroll-top)
(+ (getprop (@ self element-specs) (@ target ix) "top")
(/ (@ self state pane-element 0 client-height) 2)))
(if (> (@ self state pane-element 0 scroll-top)
(getprop (@ self element-specs) (@ target ix) "top"))
(setf (@ self state pane-element 0 scroll-top)
(- (getprop (@ self element-specs) (@ target ix) "top")
(/ (@ self state pane-element 0 client-height) 2)))))))))))
:move
(lambda (motion)
(let* ((self this)
(to-seek (@ this state point)))
;(cl :ss (@ self state point) (@ self state point-attrs))
(if (= "full" (@ this props context view-scope))
(progn (setf (@ to-seek 0) (max 0 (if (= 0 (@ motion 0))
(@ self state point-attrs depth)
(if (< 0 (@ motion 0))
(+ (@ to-seek 0) (@ motion 0))
(+ (@ self state point 0) (@ motion 0))))))
(loop for mix from 0 to (1- (abs (@ motion 1)))
;; axis is inverted, hence < instead of >
do (setf (@ to-seek 1) (max 0 (if (> 0 (@ motion 1))
(+ (@ self state point-attrs start)
(@ self state point-attrs breadth))
(1- (@ self state point-attrs start))))))
;(cl :m0 (@ to-seek 0) (@ self state point-attrs depth) (@ self state point 0))
;(cl :tos to-seek)
(chain self (seek to-seek (@ to-seek 0) nil
(lambda (target list parent index path)
(let ((new-target
(chain j-query
(extend (create)
target
(create dp (if (= 0 (@ motion 0))
(@ self state point-attrs depth)
(if (> 0 (@ motion 0))
(@ target ly)
(max (+ (@ motion 0)
(@ self state point-attrs
depth))
(@ target ly)))))))))
;; extend the target data so that the layer is set as the sought
;; x-coordinate as long as the point is moving vertically or inward. x
;; thus, the layer will remain the same when moving vertically,
;; preventing it from being knocked down to a low level when
;; traversing shallow lists, and the point will always decrement
;; to the layer previous to the visible point. x
(chain self (set-point new-target path)))))))
(let ((target-index (+ (getprop (@ self state point) (1- (@ self state point length)))
(- (@ motion 1)))))
;; don't seek if the target index is less than 0
;; this is impossible and causes an infinite loop
(if (<= 0 target-index)
(chain self (seek (list target-index)
-1 nil (lambda (target list parent index path)
(chain self (set-point target path))))))))))
:seek
(lambda (coords layer form callback path)
(let ((self this)
(path (if path path #()))
(form (if form form (chain this state space (slice 1))))
(index (getprop coords (1- (@ coords length))))
(found-form nil) (member-start 0) (form-index 0) (at-end false) (this-end false))
;; don't seek if there's nothing in the form
(if (not (= "undefined" (typeof (@ form 0))))
(progn
(loop for fix from 0 to (1- (@ form length))
do (if (= "[object Array]" (chain -object prototype to-string (call (getprop form fix))))
(setq member-start (getprop form fix 0 "ct")
this-end false)
(setq member-start (getprop form fix "ct")
this-end true))
;(cl 312 index member-start (getprop form fix) (not (> member-start index)))
;; (if (@ self props context ii) (cl :fl (getprop form fix) (getprop form fix "ct")
;; member-start index))
(if (not (> member-start index))
(setq found-form (getprop form fix)
at-end this-end
form-index fix)))
;(cl :ff coords found-form index form-index (not at-end) (= -1 layer) (< 0 layer))
(chain path (push (- form-index (if (and (not (= "undefined" (typeof (@ form 0 ty))))
(= "plain" (@ form 0 ty 0)))
1 0))))
(if (and (not at-end)
(not (= 0 layer)))
;; if the layer > 0, this is a 2D form and there may be more layers below this one
;; if the layer < 0, this is a 1D form with a starting layer of -1
(chain this (seek coords (1- layer) found-form callback path))
(if found-form
(funcall callback
(if (= "[object Array]" (chain -object prototype to-string (call found-form)))
(@ found-form 0)
found-form)
(if (= "[object Array]" (chain -object prototype to-string (call found-form)))
found-form)
form form-index path)))))))
:delete-point
(lambda (point)
(let* ((self this)
(new-space (chain j-query (extend #() (@ self state space)))))
(chain self (seek point (@ point 0)
new-space
(lambda (target target-list target-parent target-index path)
(chain target-parent (splice target-index 1))
(if (not (> (@ point 1) (@ self state point 1)))
(chain self (move #(0 1)))))))
(chain self state context methods (grow-branch new-space (create)))))
:set-confirmed-value
(lambda (value) (extend-state data (create confirmed-value value)))
:assign
(lambda (index form changed)
;; TODO: the property and sub-property system is convoluted, try to simplify it...
(loop for fix from 0 to (1- (@ form length))
do ;; (cl :fff form fix)
(if (= "[object Array]" (chain -object prototype to-string (call (getprop form fix))))
(chain this (assign index (getprop form fix) changed))
(if (= index (@ (getprop form fix) ix))
(setf (getprop form fix)
(chain j-query (extend (getprop form fix) changed))))))
form)
:build
(lambda (state)
(let* ((self this)
(new-space (chain j-query (extend #() (@ state space)))))
;; the element-specs are set to nil whenever the table is rebuilt
;; so that new coordinates may be sent to the glyph-drawing component
(setf (@ self element-specs) #())
;; (cl :newspace new-space)
(chain self
(build-form new-space
(lambda (meta state)
(chain self (set-state (chain j-query
(extend state
(create space new-space
rendered-content (@ meta output)
point-attrs (@ state point-attrs)
meta (chain
j-query
(extend t (create)
(@ self state data meta)
meta))))))))))))
:build-form
(lambda (data callback meta state)
(let ((self this)
(each-meta (create))
(is-start (= "undefined" (typeof meta)))
;; is this the beginning of the form?
(meta (if meta meta (create succession #() max-depth 0 output #())))
(state (if state state (create row 0 column 0)))
(last-index nil)
(context-begins false)
(meta-mode-active false)
(is-plain-list (= "plain" (@ data 0 ty 0)))
(increment-breadth (lambda (number) (setf (@ data 0 br) (+ (if (or number (= 0 number))
number 1)
(@ data 0 br))))))
(if (@ data 0)
(progn (setf (@ data 0 br) 0)
;; breadth is initially 0, as is the list of sub-lists
(if (and (@ data 0 fm) (< 0 (@ data 0 fm length)))
(setf (@ state reader-context) (chain data 0 fm)
(@ meta context-start) (@ data 0 ix)
context-begins true))
;; handle reader macros for forms
(if (and (@ data 0 am) (< 0 (@ data 0 am length)))
(setf (@ state reader-context) (@ data 0 am)
(@ meta context-start) (@ data 0 ix)
context-begins true))
;; handle reader macros for atoms
(if (@ data 0 mt)
(progn (setf (@ data 0 pr) (create meta (@ data 0 mt)))
(if (@ data 0 mt mode)
(setf (@ data 0 md) (lambda (fn) (setf data (funcall fn data)))
(@ data 0 pr count) (1- (@ data length))))
(if (@ data 0 mt each)
(setf each-meta (@ data 0 mt each)
(@ data 0 pr meta) (chain j-query (extend t (create)
(@ data 0 mt each)
(@ data 0 pr meta)))))))
;; (cl :data (@ data 0) each-meta)
;; assign atom properties from metadata
(setf (@ data 0 ct) (@ state row)
(@ data 0 ly) (max 0 (1- (@ state column)))
(@ data 0 cx) (if context-begins
(chain state reader-context (concat (list "start")))
(@ state reader-context)))
;; assign column, row and reader macro content
;; (if (@ data 0 mt)
;; (cl :iio data))
(chain data
(map (lambda (datum index)
;; (if (@ each-meta visible-members)
;; (cl :atom (@ datum mt) each-meta))
;; if the atom is set to be invisible, do not process it for display
(if (or (not (@ each-meta visible-members))
(not (@ datum mt name))
(let ((visible t))
(loop for member in (@ each-meta visible-members)
do (if (= (@ datum mt name) (@ member name))
(setq visible (and visible (= "__on" (@ member state))))))
visible))
(progn
(if (and (= 1 index)
(not is-plain-list))
(setf (@ state column) (1+ (@ state column))))
;; increment the column, but not for plain lists
(if (> (1+ (@ state column))
(@ meta max-depth))
(setf (@ meta max-depth) (1+ (@ state column))))
;; increment the maximum depth
(if (= "[object Array]" (chain -object prototype to-string (call datum)))
;; if this item is a list
(progn (if (and (or (and is-plain-list (< 0 index))
;; start incrementing right away in plain lists,
;; like the main form list
(< 1 index))
(not (and is-plain-list (= 1 index))))
(setf (@ state row) (1+ (@ state row))))
;; increment the row, but not if this is the form at the beginning of
;; a plain list and this is not the plain list that encloses the
;; whole form; i.e. isStart is not true
(if (or last-index (= 0 last-index))
(setf (getprop meta "succession" last-index)
(@ datum 0 ix)))
(setf last-index (@ datum 0 ix))
;; set succession data for drawing glyphs
(chain self (build-form
datum (lambda (output sub-state)
(increment-breadth (1+ (- (@ sub-state row)
(@ state row))))
;; increment the breadth based on the difference
;; between the current row and the row reached
;; within the sub-list
(setf (@ state row) (+ (@ sub-state row))))
meta (chain j-query (extend (create)
state (if is-plain-list
(create)
(create)))))))
;; if this item is an atom
(let ((pr (chain j-query (extend t (create)
(create meta (chain j-query
(extend t (create)
each-meta
(@ datum mt))))
(@ datum pr)))))
(if (< 0 index)
(progn (if (or last-index (= 0 last-index))
(setf (getprop meta "succession" last-index)
(@ datum ix)))
(setf last-index (@ datum ix))))
(if (< 0 index) (increment-breadth))
(if (or (and is-plain-list (< 0 index))
(< 1 index))
(setf (@ state row) (1+ (@ state row))))
(setf (@ datum ct) (@ state row)
(@ datum ly) (@ state column)
(@ datum pr) pr
;; concatenate macro styles if the atom
;; is within an existing macro
(@ datum cx) (if (@ datum am)
(if (@ state reader-context)
(chain state reader-context
(concat (list (@ datum am) "start")))
(list (@ datum am) "start"))
(@ state reader-context)))
;; increment the column if the list head is a plain list marker
;; and this is not the plain list that encloses the form;
;; this ensures that the elements within the plain list will have
;; their layers correctly marked. x
(if (and (not is-start)
(= "plain" (@ datum ty 0)))
(setf (@ state column) (1+ (@ state column))))
;; push datum to output array; the index is incremented because
;; the indices start with 0 but the array indices start with 1
(if (= "undefined" (typeof (getprop meta "output" (@ state row))))
(setf (getprop meta "output" (@ state row))
#()))
(chain (getprop meta "output" (@ state row))
(push datum)))))
(progn (setf (@ datum hide) t))))))
(funcall callback meta state)))))
:build-list
(lambda (data atom-builder form-builder callback output)
(let ((self this)
(datum (@ data 0))
(output (if output output #())))
(if (= 0 (@ data length))
(funcall callback output)
(chain self
(build-list (chain data (slice 1))
atom-builder form-builder callback
(chain output (concat (funcall (if (= "[object Array]"
(chain -object prototype to-string
(call datum)))
form-builder atom-builder)
datum
(- (@ output length)
(if (and (@ output 0)
(= "plain" (@ output 0 0 ty 0)))
1 0))
(@ output 0)))))))))
:render-atom
(lambda (datum)
(defvar self this)
(panic:jsl (:div :key (+ "form-view-td-" (@ datum ix))
:on-click (lambda ()
;; if this cell does not have a custom interface, set it as point
;; when clicked, cells with custom interfaces have unique behaviors
;; implemented using the set-point method as passed through
;; the modulate-methods function in this component
(let ((interaction (if (and (@ datum pr)
(@ datum pr meta)
(@ datum pr meta mode)
(@ datum pr meta mode interaction))
(if (getprop (@ self interactions)
(chain datum pr meta mode interaction
(substr 2)))
(getprop (@ self interactions)
(chain datum pr meta mode interaction
(substr 2))
"click")
(chain self props context
(get-interaction
(chain datum pr meta mode interaction
(substr 2))))))))
(if (and interaction (not (= null (typeof interaction))))
(funcall interaction self datum)
(let ((datum (chain j-query
(extend (create)
datum (create dp (@ datum ly))))))
(if (/= "set" (@ self state context mode))
(chain self (set-point datum)))))))
:id (+ (@ self state data id)
"-atom-" (@ datum ix))
:class-name (+ "atom-inner"
(if (and (@ datum mt) (@ datum mt mode) (@ datum mt mode view))
" custom-interface" "")
;; (+ " mode-" (@ self state context mode))
;; (+ " row-" (@ datum ct))
;; TODO: IS THERE A BETTER WAY TO HANDLE POINTS IN LISTS VS. FORMS?
;; SUCH AS HAVING THE POINT DESIGNATION WORK IN A MORE SIMILIAR WAY FOR
;; BOTH TYPES
(+ " ot-" (@ self state point-attrs index))
(if (= (@ self state point-attrs index)
(@ datum ix))
" point" "")
(if (= (@ self state index) (@ datum ix))
" index" "")
(if (and (@ datum mt) (@ datum mt mode))
(cond ((or (= "__portalName" (@ datum mt mode view))
(and (@ datum mt atom)
(= "__portalName" (@ datum mt atom mode view))))
" portal-name")
(t ""))
""))
(let ((cell-data (create content
;(progn
;; (if (= (@ self state point index)
;; (@ datum ix))
;; (chain console (log 200
;; (@ self state just-updated)
;; (@ self state action))))
;; (if (= (@ self state point-attrs index)
;; (@ datum ix))
;; (cl :abcd (@ self state point-attrs delta)))
(if (and (@ self state point-attrs delta)
;; (or (not (@ self state action))
;; (not (= "recall"
;; (@ self state action id))))
(= "set" (@ self state context mode))
;; only use the delta value if the state is
;; "set"
;; TODO: this causes flickering
;; HOW TO PREVENT FLICKERING
;; make sure the action is "recall"
(= (@ self state point-attrs index)
(@ datum ix)))
(@ self state point-attrs delta)
datum);)
meta (create branch-id (@ self state data id)
is-point (= (@ self state point-attrs index)
(@ datum ix))
is-parent-point (@ self state context is-point)
breadth (@ datum br)))))
;; (if (and (@ datum mt) (@ datum mt mode)
;; (= "__bar" (@ datum mt mode type)))
;; (cl :celd cell-data datum (@ self state point-attrs)))
(if (and (@ datum mt) (@ datum mt mode))
(cond ((= "__colorPicker" (@ datum mt mode view))
(subcomponent (@ interface-units color-picker)
cell-data))
((= "__item" (@ datum mt mode view))
(subcomponent (@ interface-units item)
;;cell-data
(create content nil ;;(chain self (render-table-body content))
data datum)))
((= "__select" (@ datum mt mode view))
(subcomponent (@ interface-units select)
cell-data))
((= "__textfield" (@ datum mt mode view))
(subcomponent (@ interface-units textfield)
cell-data))
((= "__textarea" (@ datum mt mode view))
(subcomponent (@ interface-units textarea)
cell-data))
((= "__bar" (@ datum mt mode view))
(subcomponent (@ interface-units bar)
cell-data))
(t (subcomponent (@ interface-units cell-standard)
cell-data)))
(subcomponent (@ interface-units cell-standard)
cell-data
:context
(branch self focus (@ self state focus)
is-point (= (@ self state point-attrs index)
(@ datum ix))
menu-content (@ self props context menu-content))
;; ((setf (@ sub-con branch) self
;; (@ sub-con focus) (@ self state focus)
;; (@ sub-con is-point)
;; (= (@ self state point-attrs index)
;; (@ datum ix))
;; ;; (@ sub-con rendered-menu)
;; ;; (@ self props context rendered-menu)
;; (@ sub-con menu-content)
;; (@ self props context menu-content)))
))))))
:render-list
(lambda (rows-input callback)
(let ((self this)
(count 0))
;;(chain console (log :ri rows-input))
(labels ((process-list (input layer index output)
(let ((layer (if layer layer 0))
(index (if index index 0))
(output (if output output #())))
(if (= 0 (@ input length))
output
(process-list (chain input (slice 1))
layer (1+ index)
(if (and (= "[object Object]" (chain -object prototype to-string
(call (@ input 0))))
(= "plain" (@ input 0 ty 0)))
output
(if (and (= "[object Array]" (chain -object prototype to-string
(call (@ input 0)))))
(chain output
(concat (list (panic:jsl
(:li :key (+ "list" (@ rows-input 0 ix)
"-" layer "-" index)
(:ul :class-name "form-view in"
(process-list (@ input 0)
(1+ layer))))))))
(progn (setf (@ input 0 ct) count
count (1+ count))
(chain output
(concat (list (panic:jsl
(:li
:key (+ "li" (@ rows-input 0 ix)
"-" layer "-" (@ input 0 ix))
(chain self (render-atom
(@ input 0))))))))))))))))
(funcall callback (panic:jsl (:ul :class-name (+ "form-view " (@ self props context view-scope))
(process-list rows-input)))))))
:render-sub-list
(lambda (datum content)
(let ((self this))
(panic:jsl (:td :key (+ "form-view-td-" (@ datum ix))
:ref (lambda (ref)
(if (and ref (not (and (@ datum mt) (@ datum mt mode)
(= "__item" (@ datum mt mode view)))))
;; don't assign element spec locations to items
;; within specially-rendered sub-lists
(labels ((pos (element offset)
(let* ((offset (if offset offset (create left 0 top 0)))
(this-offset (create left (+ (@ offset left)
(@ element 0 offset-left))
top (+ (@ offset top)
(@ element 0 offset-top))
height (@ element 0 client-height)
width (@ element 0 client-width))))
;; return the offset if the measurement reaches the container
(if (= "pane" (chain (j-query element) (offset-parent)
(attr "class")))
(setf (getprop (@ self element-specs) (@ datum ix))
this-offset)
(pos (chain (j-query element) (offset-parent))
this-offset)))))
(pos (j-query ref)))))
:class-name (+ (if (and (@ datum mt) (@ datum mt mode)
(= "list" (@ datum mt mode view)))
"special-table" "sub-table")
(+ " mode-" (@ self state context mode))
(if (= (@ datum ix) (@ self state point-attrs index))
" point" ""))
:id (+ (@ self state data id) "-atom-"
(@ datum ix))
:col-span (- (@ self state meta max-depth) (@ datum ly))
:row-span (@ datum br)
;; get the number of rows in the sub-list for the container rowspan
(:div :class-name "spacer")
(cond ((and (@ datum mt) (@ datum mt mode)
(= "__list" (@ datum mt mode view)))
;;(cl :ls-cont content)
(subcomponent (@ interface-units list)
;; remove the first element from the content,
;; since this element usually comes from after
;; the plain list marker
(create content (chain self (render-table-body content))
params datum)))
((and (@ datum mt) (@ datum mt mode)
(= "__item" (@ datum mt mode view)))
(subcomponent (@ interface-units item)
(create content (chain self (render-table-body content))
;; TEMP enabled
data datum)))
(t (chain self (render-table-body content))))))))
:render-table-body
(let ((table-index -1))
(lambda (rows is-root)
(let ((self this))
(setq table-index (1+ table-index))
;; (cl :rrr rows)
(panic:jsl (:table :class-name (+ "form" (if is-root " root" ""))
;; the table-index is used for tables generated...
:key (+ (if (= 0 (@ rows 0 length))
(+ "index-" table-index)
(@ rows 0 0 key))
"-body")
:ref (lambda (ref)
(if ref (let ((elem (j-query ref)))
(if is-root (setf (@ self root-params)
(create parent-height
(@ elem 0 offset-parent client-height)
left (@ elem 0 offset-left)
top (@ elem 0 offset-top)
width (@ elem 0 client-width)
height (@ elem 0 client-height)))))))
(:tbody (chain rows (map (lambda (row-data index)
(panic:jsl (:tr :key (+ "tr-" index)
row-data)))))))))))
:render-table
(lambda (rows-input callback)
(defvar self this)
(labels ((generate-cell (datum)
(panic:jsl (:td :key (+ "table-" (@ datum ix))
:col-span (if (not (@ datum br))
(- (@ self state meta max-depth) (@ datum ly))
1)
:row-span (if (@ datum br) (@ datum br) 1)
:ref (lambda (ref)
(if ref
(let ((in-special-form false))
(labels ((pos (element offset)
(let* ((offset (if offset offset (create left 0 top 0)))
(this-offset
(create left (+ (@ offset left)
(@ element 0 offset-left))
top (+ (@ offset top)
(@ element 0 offset-top))
height (if (@ offset height)
(@ offset height)
(@ element 0 client-height))
width (@ element 0 client-width))))
;; return the offset if the measurement
;; reaches the container
;; TODO: STRANGE SOLUTION - IS THERE
;; A SIMPLER WAY THAN
;; CHECKING THE TYPE OF CONTAINER? x
(if (= "pane" (chain (j-query element)
(offset-parent)
(attr "class")))
(setf (getprop (@ self element-specs)
(@ datum ix))
this-offset)
(pos (chain (j-query element)
(offset-parent))
this-offset)))))
(pos (j-query ref))))))
:class-name (+ "atom"
(if (and (@ datum mt) (@ datum mt mode) (@ datum mt mode view))
" custom-interface" "")
(+ " mode-" (@ self state context mode))
(+ " row-" (@ datum ct))
(if (= (@ self state point-attrs index)
(@ datum ix))
" point" "")
(if (and (not (= "undefined" (typeof (@ datum br))))
(= 0 (@ datum br)))
" singleton" "")
(if (@ datum cx)
(chain datum cx (map (lambda (item index)
(+ " reader-context-" item)))
(join ""))
"")
(if (and (@ datum mt) (@ datum mt mode)
(= "list" (@ datum mt mode view)))
" special-table" ""))
(chain self (render-atom datum)))))
(process-rows (rows output)
(let ((cells (@ rows 0))
(empty-rows #())
(is-outer-form (if (not output)
t false))
(output (if output output (list #()))))
(if (= 0 (@ rows length))
(chain output (slice 0 (1- (@ output length))))
;; remove final empty list that gets appended to output before returning it
(if (= 0 (@ cells length))
(process-rows (chain rows (slice 1))
(chain output (concat (list #()))))
(if (= "plain" (@ cells 0 ty 0))
;; create a sub-table for plain lists
(process-rows
(chain rows (slice (+ (@ cells 0 br)
(if (and (@ cells 0 pr meta mode)
(@ cells 0 pr meta mode open))
1 0))
(- (@ rows length) 0)))
(let* ((enclose-table
(if is-outer-form
(lambda (input) (chain self (render-table-body input t)))
(lambda (input)
(chain self (render-sub-list (@ cells 0)
(chain input
(slice 0 (@ input length))))))))
(rows-to-process
(chain (list (chain cells (slice 1)))
(concat (chain rows
(slice 1 (+ (if (and (@ cells 0 pr meta mode)
(@ cells 0 pr meta mode open))
1 0)
(@ cells 0 br)))))))
;; add the blank output array so that the
;; process-rows function knows that it is not
;; the outer form
(enclosed (enclose-table (process-rows rows-to-process (list #())))))
(loop for ix from 0 to (1- (@ cells 0 br))
do (chain empty-rows (push #())))
(chain output (slice 0 (1- (@ output length)))
(concat (list (chain (getprop output (1- (@ output length)))
(concat enclosed))))
(concat empty-rows))))
;; (process-rows
;; (chain rows (slice (1+ (@ cells 0 br))))
;; (let* ((enclose-table (if is-outer-form
;; (lambda (input) (chain self (render-table-body input t)))
;; (lambda (input) (chain self (render-sub-list (@ cells 0) input)))))
;; (rows-to-process (chain (list (chain cells (slice 1)))
;; (concat (chain rows (slice 1 (1+ (@ cells 0 br)))))))
;; ;;(rows-to-process (chain rows (slice 1 (@ cells 0 br))))
;; ;; add the blank output array so that the
;; ;; process-rows function knows that it is not
;; ;; the outer form
;; (enclosed (enclose-table (process-rows rows-to-process (list #())))))
;; (loop for ix from 0 to (1- (@ cells 0 br))
;; do (chain empty-rows (push #())))
;; (chain output (slice 0 (1- (@ output length)))
;; (concat (list (chain (getprop output (1- (@ output length)))
;; (concat enclosed))))
;; (concat empty-rows))))
;; (process-rows
;; (chain rows (slice (@ cells 0 br)))
;; (let* ((enclose-table (if is-outer-form
;; (lambda (input) (chain self (render-table-body input t)))
;; (lambda (input)
;; (cl :slc cells input (chain rows (slice 1 (@ cells 0 br))))
;; (chain self (render-sub-list (@ cells 0) input)))))
;; (rows-to-process (chain (list (chain cells (slice 1)))
;; (concat (chain rows (slice 1 (+ 0 (@ cells 0 br)))))))
;; ;; add the blank output array so that the
;; ;; process-rows function knows that it is not
;; ;; the outer form
;; (enclosed (enclose-table (process-rows rows-to-process (list #())))))
;; (loop for ix from 0 to (1- (@ cells 0 br))
;; do (chain empty-rows (push #())))
;; (cl :out output enclosed)
;; (chain output (slice 0 (1- (@ output length)))
;; (concat (list (chain (getprop output (1- (@ output length)))
;; (concat enclosed))))
;; (concat empty-rows))))
;; TODO: why are empty rows needed? If not appended, table is uneven
(process-rows (chain (list (chain cells (slice 1)))
(concat (chain rows (slice 1))))
(chain output (slice 0 (1- (@ output length)))
(concat (list (chain (getprop output (1- (@ output length)))
(concat (generate-cell (@ cells 0))))))))))))))
(funcall callback (process-rows rows-input))))
:component-will-receive-props
(lambda (next-props)
(defvar self this)
;; (cl 7989 (jstr (getprop (chain this (initialize next-props)) "space" 1 0))
;; (not (@ next-props context current)))
(let ((new-state (chain this (initialize next-props))))
;(cl :nws new-state next-props) ; TODO: glyphs don't get assigned here
(if (@ self state context is-point)
(setf (@ new-state action-registered)
(@ next-props action)))
(if (not (= (@ next-props data branch-id)
(@ this props data branch-id)))
(setf (@ new-state meta) nil
(@ new-state space) nil
(@ new-state data) nil))
(if (and (not (@ self state pane-element))
(not (= "undefined" (typeof (@ self props context fetch-pane-element)))))
(setf (@ new-state pane-element)
(j-query (+ "#branch-" (@ self props context index)
"-" (@ self props data id)))))
;; (if (not (= "undefined" (typeof (@ self props context fetch-pane-element))))
;; (progn (cl :ffe (@ self props context))
;; (cl :ffe (chain self props context (fetch-pane-element)))))
(if (not (@ next-props context current))
;; only build the form display object if the form is in "full" display mode
;(if (= "full" (@ this props context view-scope))
(chain self (build new-state))
;)
(chain this (set-state new-state))))
;(cl 777 (@ self state context) (@ self props context))
;; (if (@ self props context get-interaction)
;; (cl :int (chain self props context (get-interaction :commit))))
;; (chain self props context methods (chart self))
;; (chain this (set-state (chain this (initialize next-props))))
;; (cl :pr (@ self state data id) (@ self state point-attrs))
(handle-actions
(@ next-props action) (@ self state) next-props
:actions-any-branch
((set-branch-by-id
(if (= (@ params id) (@ self props data id))
(chain self props context methods (set-trace (@ self props context path))))))
:actions-branch-id
((record-move
"clipboard"
(chain self (move (@ params vector)))
(chain self state context methods (grow (create) (create vector (@ params vector))))))
:actions-point-and-focus
((move
(chain self (move (chain self state context (movement-transform (@ params vector))))))
(control-shift-meta
(if (and (= "undefined" (typeof (@ self state point-attrs props meta comment)))
(< 0 (@ params vector 0)))
(chain self state context methods (grow (create mt (create comment "")
am (list "meta")))))
(chain self (shift-focus "meta" (@ params vector))))
(record
(if (@ self props context clipboard-id)
(chain self state context methods
(grow (create)
(create vector (@ params vector)
point-to (@ self state point-attrs path)
branch (@ self state data id))
(@ self props context clipboard-id)))))
(recall
(if (and (@ self props context history-id)
(or (= "undefined" (typeof (@ next-props data meta)))
(not (= true (@ next-props data meta locked)))))
(chain self state context methods (grow (create)
(create vector (@ params vector)
"recall-branch" (@ self state data id))
(@ self props context history-id)))))
(commit
(if (or (= "undefined" (typeof (@ next-props data meta)))
(not (= true (@ next-props data meta locked))))
(chain self state context methods (grow #() (create save true)))))
(revert
(chain self state context methods (grow #() (create revert true))))
(set-point-type
(if (or (= "undefined" (typeof (@ next-props data meta)))
(not (= true (@ next-props data meta locked))))
(progn (chain self state context methods (set-mode "set"))
(chain self (set-state (create action-registered nil)))
(chain self state context methods
(grow (create ty (@ params type) vl (@ params default)))))))
(add-reader-macro
(if (or (= "undefined" (typeof (@ next-props data meta)))
(not (= true (@ next-props data meta locked))))
(progn (chain self (set-state (create action-registered nil)))
(chain self state context methods
(grow (if (@ self state point-attrs is-atom)
(create am (chain (list (@ params name))
(concat (@ self state point-attrs atom-macros))))
(create fm (chain (list (@ params name))
(concat (@ self state point-attrs
form-macros))))))))))
(remove-reader-macro
(if (or (= "undefined" (typeof (@ next-props data meta)))
(not (= true (@ next-props data meta locked))))
(progn (chain self (set-state (create action-registered nil)))
(chain self state context methods
(grow (if (@ self state point-attrs is-atom)
(create am (chain self state point-attrs form-macros (slice 1)))
(if (< 0 (@ self state point-attrs atom-macros length))
(create am (chain self state point-attrs atom-macros (slice 1)))
(create fm (chain self state point-attrs form-macros
(slice 1))))))))))
(delete-point
(if (or (= "undefined" (typeof (@ next-props data meta)))
(not (= true (@ next-props data meta locked))))
(chain this (delete-point (@ this state point)))))
(insert
(let ((new-space (chain j-query (extend #() (@ self state space))))
(new-item (create vl "" ty (list "symbol")) ))
(chain this (seek (@ this state point) (@ this state point-attrs depth) new-space
(lambda (target target-list target-parent target-index path)
(if (= 0 (@ params vector 0)) ;; if this is top level...
(chain target-parent (splice (+ (@ params vector 1) target-index)
0 new-item))
(if (and target-list (< 0 (@ params vector 0)))
(chain target-list (push new-item))
(chain target-parent (splice target-index 1
(list (if (and target-list
(> 0 (@ params vector 0)))
target-list target)))))))))
;(chain self (set-state (create action-registered nil)))
;; TODO: this action is not registered, therefore no rendering happens before the grow
;; AND figure out why movement can't be delayed until after refresh
(chain self state context methods
(grow-branch new-space (create)
;; (lambda ()
;; (cl :sta (@ self state))
;; (chain self (move (list 0 (- (@ params to 1))))))
))))
(trigger-secondary
(if (or (= "undefined" (typeof (@ next-props data meta)))
(not (= true (@ next-props data meta locked))))
(chain self (interact (@ self state point-data)
(lambda () (chain self (set-state (create action-registered nil)))
(chain self state context methods (set-mode "set")))))))
(trigger-primary
(cond ((= "move" (@ self state context mode))
(if (or (= "undefined" (typeof (@ next-props data meta)))
(not (= true (@ next-props data meta locked))))
(chain self (interact (@ self state point-data)
(lambda () (chain self state context methods (set-mode "set")))))))
((= "set" (@ self state context mode))
(chain self (set-state (create action-registered nil)))
(chain self state context methods (grow (@ self state point-attrs delta)))
(chain self (set-focus "meta" 0))
(chain self state context methods (set-delta nil))
(chain self state context methods (set-mode "move")))))
(trigger-anti
(chain self (set-state (create action-registered nil)))
(chain self (set-focus "meta" 0))
(chain self state context methods (set-delta nil))
(chain self state context methods (set-mode "move")))
)))
:component-did-mount
(lambda () (chain this (build (@ this state))))
:should-component-update
(lambda (next-props next-state)
;; (if (= "main" (@ this props data id))
;; (cl :mc (or (not (@ this state rendered-content))
;; (@ this props context force-render)
;; (= 0 (@ this element-specs length))
;; (or (not (@ next-state context current))
;; (not (= (@ next-state context mode)
;; (@ this state context mode)))
;; (@ next-state action-registered)))
;; (@ next-state context current)))
(or (not (@ this state rendered-content))
(@ this props context force-render)
(= 0 (@ this element-specs length))
(or (not (@ next-state context current))
(not (= (@ next-state context mode)
(@ this state context mode)))
(@ next-state action-registered))))
:component-did-update
(lambda ()
(let ((self this))
;; (cl 5432 (@ self state action-registered))
;; (if (= "short" (@ self props context view-scope))
;; (cl :upd (@ self state point-attrs value) (jstr (@ self state point-attrs props))
;; (@ self state point-attrs)))
;; if the point-attrs are marked as fresh, i.e. the form view has just been created,
;; perform a point movement to correctly set the point-attrs
(if (and (@ self state point-attrs fresh)
(< 0 (@ self state space length)))
;; only do the movement if there's something in the form's space
;; i.e. it isn't an empty form
(chain self (move (if (@ self props context initial-motion)
(@ self props context initial-motion)
#(0 0)))))
(if (@ self state action-registered)
(chain self (set-state (create action-registered nil))))
;; (if (not (@ self state context current))
;; (extend-state context (create current true)))
;(cl 110 (not (@ self state meta element-specs)))
(if (not (@ self state meta element-specs))
(extend-state meta (create element-specs (@ self element-specs))
context (create current false)))
(if (and (= "set" (@ self state context mode))
(@ self state context is-point)
;;(= null (@ self state point-attrs delta))
)
(let* ((input-ref (chain (j-query (+ "#form-view-" (@ this state data id)
" .atom.mode-set.point input"))))
(temp-val (chain input-ref (val))))
;; need to momentarily blank the value so the cursor goes to the end on all browsers
(chain input-ref (focus))
(chain input-ref (val ""))
(chain input-ref (val temp-val))))
(if (and (= "set" (@ self state context mode))
(= 1 (@ self state focus meta))
(@ self state context is-point))
(let* ((input-ref (chain (j-query (+ "#form-view-" (@ this state data id)
" .atom.point .meta-comment input"))))
(temp-val (chain input-ref (val))))
(chain input-ref (focus))
(chain input-ref (val ""))
(chain input-ref (val temp-val)))))))
(defvar self this)
;; (if (= "main" (@ this props data id))
;; (chain console (log :ioi (@ this state context))))
(if (or (not (= "undefined" (typeof (@ this state rendered-content))))
(and (= "[object Array]" (chain -object prototype to-string (call (@ this state rendered-content))))
(= 0 (@ this state rendered-content length))))
(cond ((= "full" (@ this props context view-scope))
(let* ((root-index (labels ((find-index (item)
(if (= "[object Object]" (chain -object prototype to-string (call item)))
(@ item ix)
(find-index (@ item 0)))))
(find-index (getprop (@ this state space)
(1- (@ this state space length))))))
(glyph-content (chain j-query (extend (create branch-id (@ self state data id)
base-atom root-index
branch-index (@ self props context branch-index)
root-params (@ self root-params)
point-index (@ self state point-attrs index))
(@ self state meta)
;; TODO: this is a hack. assigning the glyphs straight
;; from props shouldn't be necessary - or the state
;; meta property shouldn't be necessary. Without this,
;; the glyphs do not refresh when changing systems
(create glyphs (@ self props data meta glyphs))))))
(chain self (render-table (@ this state rendered-content)
(lambda (rendered)
;; send the base-atom to the glyph-display so that the stem
;; at the bottom of the glyph pattern can be drawn
(panic:jsl (:div :class-name "matrix-view form-view"
:id (+ "form-view-" (@ self state data id))
:key (+ "form-view-" (@ self state data id))
;; (subcomponent (@ view-modes glyph-display)
;; glyph-content)
rendered)))))))
(t (chain self (render-list (@ this state space)
(lambda (rendered depth base-atom)
(panic:jsl (:div :class-name "form-view"
:id (+ "form-view-" (@ self state data id))
:key (+ "form-view-" (@ self state data id))
rendered)))))))
(panic:jsl (:div))))
(glyph-display
(:get-initial-state
(lambda () (chain this (initialize (@ this props))))
:initialize
(lambda (props)
(cl :glprops props)
(let ((self this))
(funcall inherit self props
(lambda (d) (@ d data))
(lambda (pd) (@ pd data glyphs)))))
:component-will-receive-props
(lambda (next-props)
;(chain this (set-state (chain this (initialize next-props))))
;(cl :nxp next-props)
(let ((new-state (chain this (initialize next-props))))
(if (@ next-props data root-params width)
(let ((params (@ next-props data root-params)))
;; add 3 or subtract 3 for the margin beneath the table TODO a more elegant way to do this? x
(chain this (set-state (chain j-query (extend
new-state
(create dims (list (@ params width)
(max (- (@ params parent-height) 3)
(+ 3 (@ params height)))))))))
(chain (j-query (getprop (@ this refs) (+ "formTable-" (@ next-props data branch-id))))
(find "g.point")
(remove-class "point"))
(chain (j-query (getprop (@ this refs) (+ "g" (@ next-props data point-index))))
(add-class "point")))
(chain this (set-state new-state)))))
:should-component-update
(lambda (next-props next-state)
(and (not (@ next-state context current))
(not (or (= nil (@ next-props data element-specs))
(= "undefined" (typeof (@ next-props data element-specs)))))))
:component-did-update
(lambda ()
(chain (j-query (getprop (@ this refs) (+ "formTable-" (@ this props data branch-id))))
(find "g.point")
(remove-class "point"))
(chain (j-query (getprop (@ this refs) (+ "g" (@ this props data point-index))))
(add-class "point"))))
(defvar self this)
;; (chain console (log "RE" (@ self state just-updated)))
;; (cl 88 (jstr (chain -object (keys (@ self props table-refs)))) (@ self props glyphs))
;; (cl 909 (@ self state) (@ self props data))
(defun render-glyph (points con-height xos yos next-line nexcon-height next-xos next-yos is-last is-root)
(let* ((height-factor (+ 1 (@ (j-query (+ "#branch-" (@ self props data branch-index)
"-" (@ self props data branch-id)
" table.form tbody tr:first-child td:last-child"))
0 client-height)))
;; take the height factor from the first single-height cell
;; TODO: a better way to find it? search for first cell with rowspan=1? x
(x-offset (- xos 3))
(y-offset (+ 0 yos (- con-height height-factor)))
(next-y-offset (+ 1 next-yos (- nexcon-height height-factor)))
(y-int (/ height-factor 16))
(output ""))
(loop for pix from 0 to (1- (@ points length))
do (if (or (not is-last)
(and is-last next-line)
(and is-last is-root (not next-line))
(and is-last (not next-line)
(not (= pix (1- (@ points length))))))
;; don't plot the last point if this is the last line in the glyph and isn't connected
;; to a glyph below it, so the "tail" is not left hanging. The only exception is for
;; the root glyph, whose tail extends to the bottom of the pane
(setq output (+ output (if (equal output "") "M " "L ")
(+ x-offset (* y-int (getprop points pix 0)))
" " (+ y-offset (* y-int (getprop points pix 1)))
" "))))
(if (and next-line is-last)
(loop for pix from 0 to (1- (@ next-line length))
do (setq output (+ output "L " (+ x-offset (* y-int (getprop next-line pix 0)))
" " (+ next-y-offset (* y-int (getprop next-line pix 1)))
" "))))
(if (and is-root is-last)
(setq output (+ output "L " x-offset " " (1- (@ self state dims 1)))))
output))
(if (and (@ this state space)
(@ this props data root-params top)
(@ this props data element-specs))
(let ((display #()))
;; (cl :scc (@ this state space))
(loop for glix from 0 to (1- (@ self state space length))
do (if (and (@ this state) (getprop (@ self props data element-specs) glix))
(let* ((origin (getprop (@ self props data element-specs) glix))
(successor (if (not (= "undefined" (getprop (@ self state data succession) glix)))
(getprop (@ self props data element-specs)
(getprop (@ self state data succession) glix))))
(container-height (@ origin "height"))
(nexcon-height (if successor (@ successor height)))
(next-line (if successor (getprop (@ this state space)
(getprop (@ self state data succession) glix)
0)))
(nxo (if successor successor (create left nil top nil)))
(each-line
(list (if (not (or (= "undefined" (typeof origin))
(= "undefined" (typeof nxo))))
(chain (getprop (@ self state space) glix)
(map (lambda (line index)
(if (not (= 0 index))
(jsl (:path :key (+ "line-" index)
:d (render-glyph
line container-height
(@ origin left) (@ origin top)
next-line nexcon-height
(@ nxo left) (@ nxo top)
(= index (1- (@ (getprop (@ self state space)
glix) length)))
(= glix
(@ self props data base-atom)))))))))))))
(chain display (push (panic:jsl (:g :id (+ "glyph-" (@ self props data branch-id)
"-" glix)
:ref (+ "g" glix)
:key (+ "glyph-g-" glix)
(:g :key (+ "glyph-colsh1-" glix)
:class-name "glyph-shadow"
:transform "translate(2)"
(@ each-line 0))
(:g :key (+ "glyph-colsh2-" glix)
:class-name "glyph-shadow"
:transform "translate(-1)"
(@ each-line 0))
(:g :key (+ "glyph-col-" glix)
:class-name "glyph"
(@ each-line 0)))))))))
(cl :disp display)
(panic:jsl (:svg :class-name "dendroglyphs"
:id (+ "dend" (new (chain (-date) (get-time))))
:style (create height (+ (@ self state dims 1) "px")
width (+ (@ self state dims 0) "px"))
:ref (+ "formTable-" (@ self state data branch-id))
display)))
(panic:jsl (:svg :class-name "dendroglyphs")))))
| 59,670
|
Common Lisp
|
.lisp
| 1,323
| 36.207105
| 107
| 0.556588
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
d3f2c7b2be40065b532017476b79c90a2981b35abeffa8696e5469d3e8621abc
| 2,724
|
[
-1
] |
2,725
|
package.lisp
|
phantomics_seed/panic/package.lisp
|
;;;; package.lisp
;;; The MIT License (MIT)
;;;
;;; Copyright (c) 2015 Michael J. Forster
;;;
;;; Permission is hereby granted, free of charge, to any person obtaining a copy
;;; of this software and associated documentation files (the "Software"), to deal
;;; in the Software without restriction, including without limitation the rights
;;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
;;; copies of the Software, and to permit persons to whom the Software is
;;; furnished to do so, subject to the following conditions:
;;;
;;; The above copyright notice and this permission notice shall be included in all
;;; copies or substantial portions of the Software.
;;;
;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
;;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
;;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
;;; SOFTWARE.
(defpackage #:panic
(:use #:cl)
(:export #:defcomponent
#:jsl))
| 1,264
|
Common Lisp
|
.lisp
| 26
| 46.961538
| 82
| 0.746764
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
913ed64c77dc3db101284a5bca24502e0424365ad3634c73d870f93f86953ef2
| 2,725
|
[
34453
] |
2,726
|
panic.lisp
|
phantomics_seed/panic/panic.lisp
|
;;;; panic.lisp
;;; The MIT License (MIT)
;;;
;;; Copyright (c) 2015 Michael J. Forster
;;;
;;; Permission is hereby granted, free of charge, to any person obtaining a copy
;;; of this software and associated documentation files (the "Software"), to deal
;;; in the Software without restriction, including without limitation the rights
;;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
;;; copies of the Software, and to permit persons to whom the Software is
;;; furnished to do so, subject to the following conditions:
;;;
;;; The above copyright notice and this permission notice shall be included in all
;;; copies or substantial portions of the Software.
;;;
;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
;;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
;;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
;;; SOFTWARE.
(in-package #:panic)
(defun self-evaluating-form-p (form)
"Return true if FORM is a self-evaluating object, false otherwise.
See CLHS 3.1.2.1.3 Self-Evaluating Objects."
(and (not (symbolp form))
(not (consp form))))
(defun jsl-form-p (form)
"Return true if FORM is a JSL form, false otherwise.
A JSL form is an extension of a Common Lisp compound form, with the
car of the form being a keyword. See CLHS 3.1.2.1.2 Conses as Forms."
(and (consp form)
(or (keywordp (car form))
(and (consp (car form))
(or (eq (caar form)
'ps:@)
;; (eq (caar form)
;; 'ps:chain)
)))))
(defun destructure-jsl-form (form)
"Return as multiple values the type (a keyword), props (a property
list), and children (a list) of the JSL form FORM."
(let ((type (first form))
(props nil)
(children (rest form)))
(do ((rest (rest form) (cddr rest)))
((or (null (cdr rest))
(not (keywordp (first rest))))
(setf children rest))
(push (second rest) props)
(push (first rest) props))
(values type props children)))
(defun walk-form (form)
"Walk the form FORM, expanding JSL forms into Parenscript function
forms for React DOM operations, and return the resulting form."
(cond ((self-evaluating-form-p form)
form)
((symbolp form)
form)
((jsl-form-p form)
(multiple-value-bind (type props children)
(destructure-jsl-form form)
`(ps:chain -react (create-element ,(if (consp type)
(mapcar #'alexandria:ensure-symbol type)
(let ((sym (alexandria:ensure-symbol type)))
(if (eql #\- (aref (write-to-string sym) 0))
sym
(string-downcase sym))))
(ps:create ,@(mapcar #'(lambda (x)
(if (keywordp x)
(alexandria:ensure-symbol x)
x))
props))
,@(mapcar #'walk-form children)))))
((consp form)
form)
(t
(error "~A fell through COND expression." form))))
(ps:defpsmacro jsl (form)
"Return the form FORM with any JSL forms expanded.
JSL is a Lispy take on JSX, the React Javascript syntax extension. A
JSL form is a list with the first element being a keyword naming a
React element type. All but the last of the remaining elements
constitute a possibly empty list of alternating React property names
and values. The last element is a possibly empty list of the children
of the React element. See the React JSX documentation."
(walk-form form))
(ps:defpsmacro defcomponent (name (&rest args
&key (display-name (string (if (consp name)
(first (last name))
name)))
get-initial-state
get-default-props
prop-types
mixins
statics
component-will-mount
component-did-mount
component-will-receive-props
should-component-update
component-will-update
component-did-update
component-will-unmount
&allow-other-keys)
&body render-body)
"Define a Parenscript special variable named NAME with the value
being a React component class with DISPLAY-NAME attribute NAME, with a
mandatory RENDER method having the body RENDER-BODY, and with optional
lifecycle methods GET-INITIAL-STATE, GET-DEFAULT-PROPS, PROP-TYPES,
MIXINS, STATICS, COMPONENT-WILL-MOUNT, COMPONENT-DID-MOUNT,
COMPONENT-WILL-RECEIVE-PROPS, SHOULD-COMPONENT-UPDATE,
COMPONENT-WILL-UPDATE, COMPONENT-DID-UPDATE, and
COMPONENT-WILL-UNMOUNT.
See the React Top Level API, Component API, and Component Specs and
Lifecycle documentation."
(flet ((plist-with-symbols (plist)
(let ((new-plist '()))
(alexandria:doplist (k v plist new-plist)
(setf (getf new-plist (alexandria:ensure-symbol k)) v)))))
`(,(if (consp name) 'setf 'defvar) ,name
(create-react-class
;;(ps:chain -react
;; (create-class
(ps:create 'display-name ,display-name
'render #'(lambda () ,@render-body)
,@(when get-initial-state `('get-initial-state ,get-initial-state))
,@(when get-default-props `('get-default-props ,get-default-props))
,@(when prop-types `('prop-types ,prop-types))
,@(when mixins `('mixins ,mixins))
,@(when statics `('statics ,statics))
,@(when component-will-mount `('component-will-mount ,component-will-mount))
,@(when component-did-mount `('component-did-mount ,component-did-mount))
,@(when component-will-receive-props `('component-will-receive-props ,component-will-receive-props))
,@(when should-component-update `('should-component-update ,should-component-update))
,@(when component-will-update `('component-will-update ,component-will-update))
,@(when component-did-update `('component-did-update ,component-did-update))
,@(when component-will-unmount `('component-will-unmount ,component-will-unmount))
,@(plist-with-symbols
(alexandria:remove-from-plist args
:display-name
:get-initial-state
:get-default-props
:prop-types
:mixins
:statics
:component-will-mount
:component-did-mount
:component-will-receive-props
:should-component-update
:component-will-update
:component-did-update
:component-will-unmount)))))));)
| 7,123
|
Common Lisp
|
.lisp
| 153
| 36.862745
| 104
| 0.618945
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
4936dcdaf889446b2dd7b06e13502f83f2bbe4260142ac74626f129e29d12b1a
| 2,726
|
[
-1
] |
2,727
|
form.mode-block-space.lisp
|
phantomics_seed/seed.ui-spec.form.mode-block-space/form.mode-block-space.lisp
|
;;;; seed.ui-spec.form.mode-block-space.lisp
(in-package #:seed.ui-model.react)
(defpsmacro cl (&rest items)
`(chain console (log ,@items)))
(specify-components
block-space-view-mode
(block-space-view
(:get-initial-state
(lambda ()
(chain j-query (extend (create point #(0 0)
point-attrs (create value nil delta nil)
meta (chain j-query (extend t (create max-depth 0
confirmed-value nil
invert-axis (list false true))
(@ this props data meta))))
(chain this (initialize (@ this props))))))
:initialize
(lambda (props)
(let* ((self this)
(state (funcall inherit self props
(lambda (d) (chain j-query (extend (@ props data) (@ d data))))
(lambda (pd) (@ pd data data)))))
;; (if (@ self props context trace-category)
;; (chain self props context methods (register-branch-path (@ self props context trace-category)
;; (@ self props data id)
;; (@ state context path))))
state))
:element-specs #()
:container-element nil
:modulate-methods
(lambda (methods)
(let* ((self this)
(to-grow (if (@ self props context working-system)
(chain methods (in-context-grow (@ self props context working-system)))
(@ methods grow))))
(chain j-query
(extend (create set-delta (lambda (value) (extend-state point-attrs (create delta value))))
methods (create grow-branch (lambda (space meta callback)
(to-grow (@ self state data id)
space meta callback)))))))
:component-will-receive-props
(lambda (next-props)
(defvar self this)
(let ((new-state (chain this (initialize next-props))))
(if (@ self state context is-point)
(setf (@ new-state action-registered)
(@ next-props action)))
(chain this (set-state new-state)))
(if (and (not (@ self state pane-element))
(not (= "undefined" (typeof (@ self props context fetch-pane-element)))))
(setf (@ new-state pane-element)
(chain (j-query (+ "#branch-" (@ self props context index)
"-" (@ self props data id))))))
(handle-actions
(@ next-props action) (@ self state) next-props
:actions-any-brancho
((set-branch-by-id
(if (= (@ params id) (@ self props data id))
(chain self props context methods (set-trace (@ self props context path))))))
:actions-point-and-focus
(
;; (move
;; (chain self (move (@ params vector))))
;; (delete-point
;; (if (not (= true (@ next-props data meta locked)))
;; (chain self state context methods (grow-point nil (create)))))
;; (trigger-primary
;; (cond ((= "move" (@ self state context mode))
;; (if (not (= true (@ next-props data meta locked)))
;; (chain self state context methods (set-mode "set"))))
;; ((= "set" (@ self props context mode))
;; (progn (chain self (set-state (create action-registered nil)))
;; (chain self state context methods (grow-point (@ self state point-attrs delta)
;; (create)))
;; (chain self state context methods (set-mode "move"))))))
;; (trigger-secondary
;; (chain self editor-instance (focus))
;; (chain self state context methods (set-mode "write")))
(trigger-anti
(chain self state context methods (set-mode "move"))))))
:should-component-update
(lambda (next-props next-state)
(or (not (@ next-state context current))
(not (= (@ next-state context mode)
(@ this state context mode)))
(@ next-state action-registered)))
:component-did-mount
(lambda ()
(let* ((self this)
(cl #())
(space-length (@ self state space length))
(section (/ space-length 4))
(radius (/ space-length 2))
(new-space (-voxel-space (create materials (list "#8baba8" "#f3827c" "#dfe0de" "#4f5e5d" "#000000")
material-flat-color t
sky-color 0x002b36
chunk-size section
lights-disabled t
fog-disabled t
generate (lambda (x y z)
(getprop self "state" "space"
(mod (+ radius x) space-length)
(mod (+ radius y) space-length)
(mod (+ radius z) space-length)))
width (@ self container-element client-width))))
(window-width (@ self container-element client-width))
(window-height (@ self container-element client-height))
(create-player (-voxel-space-player new-space))
(new-player (create-player)))
;; (cl :coords cl)
(chain new-player yaw position (set 0 0 0))
;;(chain new-player (subject-to (new (chain window three-js (-vector3 0 0 0)))))
(chain new-player (possess))
(setf (@ new-space width) (@ self container-element client-width))
;; (cl :nn new-space)
(chain new-space (append-to (@ self container-element)))
(setf (@ self container-element children 0 client-width) window-width)
;; (cl window-width window-height (j-query (@ self container-element)))
;; (cl (@ self container-element children 0))
(setf (@ self container-element children 0 height) 400)
(chain (j-query (@ self container-element children 0))
(width window-width))))
;; :component-did-update
;; (lambda ()
;; (if (and (= "set" (@ this state context mode))
;; (@ this state context is-point))
;; (chain (j-query (+ "#sheet-view-" (@ this props data id)
;; " .atom.mode-set.point .editor input"))
;; (focus))))
)
(defvar self this)
;;(cl "SHR" (@ this state just-updated))
;; (chain console (log :cel (@ self state data) (@ self props context) (@ self state context)))
;;(chain console (log :ssp (@ self state space)))
;;(let ((-data-sheet (new -react-data-sheet)))
;;(chain console (log :dd (@ self props context)))
;;(cl 90 (@ self state space))
(panic:jsl (:div :class-name "canvas-container"
:ref (lambda (ref) (if (not (@ self container-element))
(setf (@ self container-element) ref)))))))
| 6,130
|
Common Lisp
|
.lisp
| 140
| 37.164286
| 107
| 0.597928
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
0fd4c90375e85caba1ca9cea549f3f67181d34a5687dc55a8d49aacd96237d66
| 2,727
|
[
-1
] |
2,728
|
package.lisp
|
phantomics_seed/seed.foreign.browser-spec.ss.form-dygraphs/package.lisp
|
;;;; package.lisp
(defpackage #:seed.foreign.browser-spec.ss.form-dygraphs
(:export #:foundational-browser-script-dygraphs
#:foundational-browser-style-dygraphs)
(:use #:cl #:parenscript))
| 198
|
Common Lisp
|
.lisp
| 5
| 36.8
| 56
| 0.75
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
070bb0108fc8f69e11b6ce7ab28d8118c6a3e82939f71e1cd4d024e7dadeae94
| 2,728
|
[
-1
] |
2,729
|
ss.form-dygraphs.lisp
|
phantomics_seed/seed.foreign.browser-spec.ss.form-dygraphs/ss.form-dygraphs.lisp
|
;;;; ss.form-dygraphs.lisp
(in-package #:seed.foreign.browser-spec.ss.form-dygraphs)
(defparameter *local-package-name* (package-name *package*))
(defmacro foundational-browser-script-dygraphs ()
"Generate the content for the root script source file."
`(parenscript:ps (setf (@ window -dygraph) (require "dygraphs"))
(setf (@ window -dygraph-crosshair) (require "dygraphs/src/extras/crosshair"))
t))
(defmacro foundational-browser-style-dygraphs ()
"Generate the paths for the style source files."
(mapcar (lambda (item) (asdf:system-relative-pathname (intern *local-package-name* "KEYWORD") item))
(list "./node_modules/dygraphs/dist/dygraph.min.css")))
| 680
|
Common Lisp
|
.lisp
| 12
| 53.583333
| 102
| 0.740964
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
95ce5826e778520e02cc59f62a005b0e2cf2446a4ca97836d694db6a4e944f99
| 2,729
|
[
-1
] |
2,730
|
form.mode-chart-dygraph.lisp
|
phantomics_seed/seed.ui-spec.form.mode-chart-dygraph/form.mode-chart-dygraph.lisp
|
;;;; seed.ui-spec.form.mode-chart-dygraph.lisp
(in-package #:seed.ui-model.react)
(specify-components
dygraph-chart-view-mode
(dygraph-chart-view
(:get-initial-state
(lambda ()
(chain j-query (extend (create point 0
data (@ this props data)
entities (@ this props data data entities)
content-index (create))
(chain this (initialize (@ this props))))))
:initialize
(lambda (props)
(let* ((self this)
(state (funcall inherit self props
(lambda (d) (@ props data))
(lambda (pd) (@ pd data data content)))))
(if (@ self props context set-interaction)
(progn (chain self props context
(set-interaction "chartSelect"
(lambda () (setf (@ self ephemera interaction) "select"))))
(chain self props context
(set-interaction "chartDrawLine"
(lambda ()
(cl :draw-clicked)
(setf (@ self ephemera interaction) "draw"
(@ self ephemera draw-entity) "line"))))
(chain self props context
(set-interaction "chartRetraceX"
(lambda () (setf (@ self ephemera interaction) "draw"
(@ self ephemera draw-entity) "retraceX"))))
(chain self props context
(set-interaction "chartRetraceY"
(lambda () (setf (@ self ephemera interaction) "draw"
(@ self ephemera draw-entity) "retraceY"))))
(chain self props context
(set-interaction "chartZoomRealSize"
(lambda () (chain self chart (reset-zoom)))))))
(setf (@ state content-index) (create))
(loop for item in (@ props data data content)
do (setf (getprop state "contentIndex" (@ item 0)) (chain item (slice 1))))
state))
:chart nil
:pane-element nil
:container-element nil
:ephemera (create interaction "select"
draw-entity "line"
moving-from nil
mousedown false
active-entity nil
entities-in-flux (list)
entities (list))
#|
Entities list exists in ephemera. When a save event happens, the static list is overwritten with it.
|#
:modulate-methods
(lambda (methods)
(let* ((self this)
(to-grow (if (@ self props context parent-system)
(chain methods (in-context-grow (@ self props context parent-system)))
(@ methods grow))))
(chain j-query
(extend methods
(create grow-adding-entity
(lambda (entity meta callback)
(to-grow (@ self state data id)
entity meta)))))))
:commit-entities
(lambda ()
(let ((self this))
(chain self state context methods (grow-adding-entity (@ self ephemera entities) (create save true)))
(chain self (set-state (create entities (@ self ephemera entities))))))
:entity-templates
(create line (create)
retrace-x (create ratios (list (list 0 0.382 0.618 1)))
retrace-y (create ratios (list (list) (list 0 0.236 0.382 0.500 0.618 0.764 1))))
:entity-methods
(let* ((derive-points (lambda (ent chart)
(list (if (or (not (@ ent layer-points))
(not (@ ent layer-points 0))
(= "undefined" (typeof (@ ent layer-points 0))))
(chain chart (to-dom-coords (@ ent points 0 0) (@ ent points 0 1)))
(@ ent layer-points 0))
(if (or (not (@ ent layer-points))
(not (@ ent layer-points 1))
(= "undefined" (typeof (@ ent layer-points 1))))
(chain chart (to-dom-coords (@ ent points 1 0) (@ ent points 1 1)))
(@ ent layer-points 1)))))
(draw-line (lambda (ctx ent chart points)
(if (@ ent in-flux)
(setf (@ ctx line-width) 2))
(chain ctx (begin-path))
(let ((points (if points points (derive-points ent chart)))
(circle-radius 5))
(chain ctx (move-to (@ points 0 0) (@ points 0 1)))
(chain ctx (line-to (@ points 1 0) (@ points 1 1)))
(chain ctx (close-path))
(chain ctx (stroke))
(if (@ ent in-flux)
(let* ((diffs (list (list (- (@ points 0 0) (@ points 1 0))
(- (@ points 0 1) (@ points 1 1)))
(list (- (@ points 1 0) (@ points 0 0))
(- (@ points 1 1) (@ points 0 1)))))
;; numbers corresponding to radian intersections of line with arcs encircling
;; start (0) and end (1) points
(ri (list (* (chain -math (sign (@ diffs 0 1)))
(acos (/ (@ diffs 0 0) (sqrt (+ (expt (@ diffs 0 0) 2)
(expt (@ diffs 0 1) 2))))))
(* (chain -math (sign (@ diffs 1 1)))
(acos (/ (@ diffs 1 0) (sqrt (+ (expt (@ diffs 1 0) 2)
(expt (@ diffs 1 1) 2)))))))))
(setf (@ ctx stroke-style) "black"
(@ ctx fill-style) "black"
(@ ctx line-width) 0.5)
(chain ctx (begin-path))
(chain ctx (arc (@ points 0 0) (@ points 0 1) 1 0 (* pi 2) true))
(chain ctx (fill))
(chain ctx (begin-path))
(chain ctx (arc (@ points 1 0) (@ points 1 1) 1 0 (* pi 2) true))
(chain ctx (fill))
(chain ctx (begin-path))
;; (chain ctx (arc (@ points 0 0) (@ points 0 1) 5 0 (* pi 2) true))
;; (chain ctx (stroke))
;; (chain ctx (begin-path))
;; (chain ctx (arc (@ points 1 0) (@ points 1 1) 5 0 (* pi 2) true))
(chain ctx (arc (@ points 0 0) (@ points 0 1) circle-radius
(+ (- pi) (- (@ ri 0) (* pi 0.20)))
(+ (- pi) (+ (@ ri 0) (* pi 0.20)))
true))
(chain ctx (stroke))
(chain ctx (begin-path))
(chain ctx (arc (@ points 1 0) (@ points 1 1) circle-radius
(+ (- pi) (- (@ ri 1) (* pi 0.20)))
(+ (- pi) (+ (@ ri 1) (* pi 0.20)))
true))
(chain ctx (stroke)))))
(setf (@ ctx stroke-style) "black"
(@ ctx line-width) 1)))
(intersect-line (lambda (ent chart point callback)
(let ((line-points (list (chain chart (to-dom-coords (@ ent points 0 0)
(@ ent points 0 1)))
(chain chart (to-dom-coords (@ ent points 1 0)
(@ ent points 1 1)))))
(margin 8))
(if (not (or (and (> (@ point 0) (+ (@ line-points 0 0) margin))
(> (@ point 0) (+ (@ line-points 1 0) margin)))
(and (< (@ point 0) (- (@ line-points 0 0) margin))
(< (@ point 0) (- (@ line-points 1 0) margin)))
(and (> (@ point 1) (+ (@ line-points 0 1) margin))
(> (@ point 1) (+ (@ line-points 1 1) margin)))
(and (< (@ point 1) (- (@ line-points 0 1) margin))
(< (@ point 1) (- (@ line-points 1 1) margin)))))
(let* ((ratio (/ (- (@ line-points 0 1) (@ line-points 1 1))
(- (@ line-points 1 0) (@ line-points 0 0))))
(x-pos (- (@ point 0) (@ line-points 0 0)))
(cross-y (abs (- (* x-pos ratio) (@ line-points 0 1)))))
(if (> 8 (abs (- cross-y (@ point 1))))
(funcall callback ent))))))))
(create line (create draw draw-line
intersect intersect-line)
retrace-x (create draw (lambda (ctx ent chart)
(let ((points (derive-points ent chart)))
(funcall draw-line ctx ent chart points)
(setf (@ ctx stroke-style) "blue"
(@ ctx line-width) 1)
(let ((x-origin (if (< (@ points 0 0) (@ points 1 0))
(@ points 0 0) (@ points 1 0)))
(x-interval (- (@ points 0 0) (@ points 1 0))))
(loop for ratio in (@ ent ratios 0)
do (let ((x-level (if (< (@ points 0 0) (@ points 1 0))
(- x-origin (* ratio x-interval))
(+ x-origin (* ratio x-interval)))))
(chain ctx (begin-path))
(chain ctx (move-to x-level 0))
(chain ctx (line-to x-level (@ ctx canvas height)))
(chain ctx (close-path))
(chain ctx (stroke)))))
(setf (@ ctx stroke-style) "black"
(@ ctx line-width) 1.5)))
intersect intersect-line)
retrace-y (create draw (lambda (ctx ent chart)
(let ((points (derive-points ent chart)))
(funcall draw-line ctx ent chart points)
(setf (@ ctx stroke-style) "red"
(@ ctx line-width) 1)
(let ((x-origin (if (< (@ points 0 0) (@ points 1 0))
(@ points 0 0) (@ points 1 0)))
(y-origin (if (< (@ points 0 1) (@ points 1 1))
(@ points 0 1) (@ points 1 1)))
(y-interval (- (@ points 0 1) (@ points 1 1))))
(loop for ratio in (@ ent ratios 1)
do (let ((y-level (if (< (@ points 0 1) (@ points 1 1))
(- y-origin (* ratio y-interval))
(+ y-origin (* ratio y-interval)))))
(chain ctx (begin-path))
(chain ctx (move-to x-origin y-level))
(chain ctx (line-to (@ ctx canvas width) y-level))
(chain ctx (close-path))
(chain ctx (stroke)))))
(setf (@ ctx stroke-style) "black"
(@ ctx line-width) 1.5)))
intersect intersect-line)))
:demodulate-time
(lambda (time mods)
(loop for modix from (1- (@ mods length)) to 0
do (let ((dividend (floor (/ (- time (getprop mods modix "offset"))
(- (getprop mods modix "period") (getprop mods modix "gap")))))
(remainder (mod (- time (getprop mods modix "offset"))
(- (getprop mods modix "period") (getprop mods modix "gap")))))
(setq time (+ remainder (getprop mods modix "offset")
(* dividend (getprop mods modix "period"))
(* (getprop mods modix "gap") (if (/= 0 remainder) 1 0))))))
time)
:format-date-string
(lambda (date-string)
(let* ((self this)
(dval (parse-int (+ (chain self (demodulate-time date-string (@ self props data data mods)))
"000")))
(d (new (-date dval))))
(+ (1+ (chain d (get-month)))
"/" (1+ (chain d (get-date)))
"/" (chain d (get-full-year)))))
:render-entity
(lambda (context entity))
:interact-mousedown
(lambda (event g context)
(let* ((self this))
(setf (@ self ephemera mousedown) t)
(let ((canvas-coords (list (@ event layer-x) (@ event layer-y)))
(dom-coords (chain g (event-to-dom-coords event)))
(entities-count (@ self ephemera entities length)))
(if (= "select" (@ self ephemera interaction))
(let ((entity-clicked false))
(loop for entix from 0 to (1- entities-count)
do (chain self entity-methods line
(intersect
(getprop (@ self ephemera entities) entix) (@ self chart) dom-coords
(lambda (ent)
(setf entity-clicked true
(@ ent layer-points)
(list (chain g (to-dom-coords (@ ent points 0 0) (@ ent points 0 1)))
(chain g (to-dom-coords (@ ent points 1 0) (@ ent points 1 1)))))
(if (@ ent in-flux)
(if (and (> 8 (abs (- (@ ent layer-points 0 0) (@ dom-coords 0))))
(> 8 (abs (- (@ ent layer-points 0 1) (@ dom-coords 1)))))
(chain (@ ent points-in-flux) (push 0))
(if (and (> 8 (abs (- (@ ent layer-points 1 0) (@ dom-coords 0))))
(> 8 (abs (- (@ ent layer-points 1 1) (@ dom-coords 1)))))
(chain (@ ent points-in-flux) (push 1)))))
(if (not (@ ent in-flux))
;; only push the entity if it isn't already in flux, else
;; entities can be pushed into the in-flux list multiple times
(progn (setf (@ ent in-flux) true)
(chain self ephemera entities-in-flux (push ent))))))))
(if (not entity-clicked)
(progn (setf (@ self ephemera entities-in-flux) (list))
(loop for ent in (@ self ephemera entities)
do (setf (@ ent in-flux) false))))
;; (cl :flux (@ self ephemera entities-in-flux))
(setf (@ self ephemera moving-from) canvas-coords)
;; (cl :mm (@ self ephemera moving-from))
(if (= 0 (@ self ephemera entities-in-flux length))
(progn (chain context (initialize-mouse-down event g context))
(chain window -dygraph (start-pan event g context)))
(chain g (draw-graph_))))
(if (= "draw" (@ self ephemera interaction))
(let* ((time-interval (- (@ g raw-data_ 1 0) (@ g raw-data_ 0 0)))
(data-pos (chain g (to-data-coords (@ dom-coords 0) (@ dom-coords 1))))
(remainder (mod (@ data-pos 0) time-interval)))
(if (/= 0 remainder)
(setf (@ data-pos 0) (- (@ data-pos 0) remainder)))
(let* ((base (create type (@ self ephemera draw-entity)
in-flux true
points (list (list (@ data-pos 0) (@ data-pos 1))
(list (@ data-pos 0) (@ data-pos 1)))
points-in-flux (list)))
(new-entity (chain j-query (extend t base (getprop self "entityTemplates"
(@ self ephemera draw-entity))))))
(chain self ephemera entities (push new-entity))
(chain self ephemera entities-in-flux (push new-entity))
(setf (@ self ephemera active-entity)
new-entity))))))))
:interact-mouseup
(lambda (event chart context)
(let ((self this))
(setf (@ self ephemera mousedown) false)
(if (= "select" (@ self ephemera interaction))
(if (@ context is-panning)
(progn (chain window -dygraph (end-pan event chart context))
(chain chart (draw-graph_)))
(progn (loop for ent in (@ self ephemera entities)
do (if (@ ent in-flux)
(setf (@ ent points 0) (chain chart (to-data-coords (@ ent layer-points 0 0)
(@ ent layer-points 0 1)))
(@ ent points 1) (chain chart (to-data-coords (@ ent layer-points 1 0)
(@ ent layer-points 1 1)))
(@ ent layer-points) nil
(@ ent points-in-flux) (list))))
(chain self (commit-entities))
(chain chart (draw-graph_))))
(if (= "draw" (@ self ephemera interaction))
(progn (setf (@ self ephemera active-entity) nil
(@ self ephemera interaction) "select")
(chain self (commit-entities))
(chain chart (draw-graph_)))))))
:interact-mousemove
(lambda (event chart context)
(let ((self this)
(temp-canvas (@ chart canvas_ctx_)))
(if (@ self ephemera mousedown)
(if (= "select" (@ self ephemera interaction))
(if (= 0 (@ self ephemera entities-in-flux length))
(if (@ context is-panning)
(chain window -dygraph (move-pan event chart context))
(chain chart (draw-graph_)))
(let ((moving-from (@ self ephemera moving-from)))
(chain temp-canvas (clear-rect 0 0 (@ chart canvas_ width) (@ chart canvas_ height)))
;; (cl :ent (@ self ephemera entities-in-flux))
(loop for ent in (@ self ephemera entities-in-flux)
do (if (= 0 (@ ent points-in-flux length))
(setf (@ ent layer-points)
(list (list (- (@ ent layer-points 0 0)
(- (@ moving-from 0) (@ event layer-x)))
(- (@ ent layer-points 0 1)
(- (@ moving-from 1) (@ event layer-y))))
(list (- (@ ent layer-points 1 0)
(- (@ moving-from 0) (@ event layer-x)))
(- (@ ent layer-points 1 1)
(- (@ moving-from 1) (@ event layer-y))))))
(let* ((time-interval (- (@ chart raw-data_ 1 0) (@ chart raw-data_ 0 0)))
(dom-coords (chain chart (event-to-dom-coords event)))
(data-pos (chain chart (to-data-coords (@ dom-coords 0) (@ dom-coords 1))))
(remainder (mod (@ data-pos 0) time-interval)))
(if (/= 0 remainder)
(setf (@ data-pos 0) (- (@ data-pos 0) remainder)))
(setf column-value (getprop (@ self state content-index) (@ data-pos 0)))
(loop for point in (@ ent points-in-flux)
do (setf (getprop ent "layerPoints" point)
(list (@ event layer-x) (@ event layer-y))
time-coord (chain chart (to-dom-y-coord (@ column-value 1))))
(if (> 8 (abs (- time-coord (getprop ent "layerPoints" point 1))))
(progn (cl "Snapped!")
(setf (getprop ent "layerPoints" point 1) time-coord))))))
(setf (@ self ephemera moving-from) (list (@ event layer-x) (@ event layer-y)))
(funcall (getprop self "entityMethods" (@ ent type) "draw")
temp-canvas ent chart))))
;; TODO: add move-ephemera logic
(if (= "draw" (@ self ephemera interaction))
(let* ((time-interval (- (@ chart raw-data_ 1 0) (@ chart raw-data_ 0 0)))
(dom-coords (chain chart (event-to-dom-coords event)))
(data-pos (chain chart (to-data-coords (@ dom-coords 0) (@ dom-coords 1))))
(remainder (mod (@ data-pos 0) time-interval))
(ent (@ self ephemera active-entity)))
;; snap to nearest rounded-down time interval
(if (/= 0 remainder)
(setf (@ data-pos 0) (- (@ data-pos 0) remainder)))
;; (cl :ss remainder (@ data-pos 0))
(setf (@ ent points 1) (list (@ data-pos 0) (@ data-pos 1)))
(chain temp-canvas (clear-rect 0 0 (@ chart canvas_ width) (@ chart canvas_ height)))
(funcall (getprop self "entityMethods" (@ ent type) "draw")
temp-canvas ent chart)))))))
:interact-mousewheel
(lambda (event chart context)
;; (cl :ev event)
(if (@ event shift-key)
(let* ((price-range (chain chart (y-axis-range)))
(price-interval (- (@ price-range 0) (@ price-range 1)))
(zoom-interval (* 0.05 price-interval))
(wheel-delta (if (< 0 (@ event delta-y)) 1 -1)))
(chain chart (update-options (create date-window (chain chart (x-axis-range))
value-range (list (if (= 1 wheel-delta)
(- (@ price-range 0) zoom-interval)
(+ (@ price-range 0) zoom-interval))
(@ price-range 1))))))
(let* ((time-range (chain chart (x-axis-range)))
(time-interval (- (@ time-range 1) (@ time-range 0)))
(zoom-interval (* 0.05 time-interval))
(wheel-delta (if (< 0 (@ event delta-y)) 1 -1)))
(chain chart (update-options (create date-window (list (if (= 1 wheel-delta)
(- (@ time-range 0) zoom-interval)
(+ (@ time-range 0) zoom-interval))
(@ time-range 1))
value-range (chain chart (y-axis-range))))))))
:candle-plotter
(lambda (e)
(if (/= 0 (@ e series-index))
(let ((self this)
(set-count (@ e series-count)))
(if (/= 8 set-count)
(cl "Error: Exactly 4 prices each point must be provided for the candle chart.")
(let* ((prices #())
(sets (@ e all-series-points))
(area (@ e plot-area))
(ctx (@ e drawing-context))
(candle-max-spacing 3)
(bar-count (let ((range (chain e dygraph (x-axis-range)))
(counting false)
(length 0))
(loop for point in (@ sets 0)
do (if (and (not counting)
(> (@ point xval) (@ range 0)))
(setf counting true))
(if (and counting (> (@ point xval) (floor (@ range 1))))
(setf counting false))
(if counting (setq length (1+ length))))
length))
(view-width (@ (chain e dygraph (get-area)) w))
(bar-width (max 1 (* 0.7 (/ view-width bar-count))))
(up-fill-style "rgba(38,139,210,1.0)")
(up-stroke-style (if (< 2 bar-width) "rgba(38,139,210,1.0)" "rgba(38,139,210,0.6)"))
(down-fill-style "rgba(220,50,47,1.0)")
(down-stroke-style (if (< 2 bar-width) "rgba(220,50,47,1.0)" "rgba(220,50,47,0.6)")))
(setf (@ ctx line-width) 0.6)
(loop for p from 0 to (1- (@ sets 0 length))
do (let* ((price (create open (getprop sets 0 p "yval")
close (getprop sets 1 p "yval")
high (getprop sets 2 p "yval")
low (getprop sets 3 p "yval")
open-y (getprop sets 0 p "y")
close-y (getprop sets 1 p "y")
high-y (getprop sets 2 p "y")
low-y (getprop sets 3 p "y")))
(top-y (+ (@ area y) (* (@ area h) (@ price high-y))))
(bottom-y (+ (@ area y) (* (@ area h) (@ price low-y))))
(center-x (+ (@ area x) (* (@ area w) (getprop sets 0 p "x"))))
(body-y nil)
(body-height nil))
(chain prices (push price))
(chain ctx (begin-path))
(chain ctx (move-to center-x top-y))
(chain ctx (line-to center-x bottom-y))
(chain ctx (close-path))
(if (> (@ price open) (@ price close))
(setf (@ ctx fill-style) down-fill-style
(@ ctx stroke-style) down-stroke-style
body-y (+ (@ area y) (* (@ area h) (@ price open-y))))
(setf (@ ctx fill-style) up-fill-style
(@ ctx stroke-style) up-stroke-style
body-y (+ (@ area y) (* (@ area h) (@ price close-y)))))
(chain ctx (stroke))
(setq body-height (* (@ area h) (abs (- (@ price open-y) (@ price close-y)))))
(chain ctx (fill-rect (- center-x (/ bar-width 2))
body-y bar-width body-height))))
(setf (@ ctx stroke-style) "black"
(@ ctx line-width) 1.5)
;; (cl :ents (@ self ephemera entities))
(loop for ent in (@ self ephemera entities)
do (if (not (and (@ self ephemera mousedown) (@ ent in-flux)))
(funcall (getprop self "entityMethods" (@ ent type) "draw")
ctx ent (@ e dygraph))))
)))))
:graph nil
:component-did-mount
(lambda ()
(let* ((self this))
(setf (@ self pane-element)
(@ (j-query (+ "#branch-" (@ self props context index)
"-" (@ self props data id)))
0)
(@ self chart)
(new (chain window
(-dygraph (@ self container-element)
(@ self state space)
(create plotter (@ self candle-plotter)
labels (@ self state data data labels)
sig-figs 6
;; series (create "EUR/CAD(Open, Ask)" (create axis "y2")
;; "EUR/CAD(High, Ask)" (create axis "y2")
;; "EUR/CAD(Low, Ask)" (create axis "y2")
;; "EUR/CAD(Close, Ask)" (create axis "y2")
;; "EUR/CAD(Open, Bid)*" (create axis "y2")
;; "EUR/CAD(High, Bid)*" (create axis "y2")
;; "EUR/CAD(Low, Bid)*" (create axis "y2")
;; ;; "EUR/CAD(Close, Bid)*" (create axis "y2")
;; )
axes (create x (create axis-label-formatter (@ self format-date-string))
y (create draw-grid true
independent-ticks true
;; axis-label-width 0
)
;; y2 (create ;; draw-grid true
;; axis-label-width 50
;; labels-k-m-b true
;; independent-ticks true
;; )
)
height (- (@ self pane-element client-height) 20)
width (- (@ self pane-element client-width) 20)
;; pan-edge-fraction 0.8
;; color-value 0.9
;; hide-overlay-on-mouse-out false
interaction-model (create mousedown (@ self interact-mousedown)
mouseup (@ self interact-mouseup)
mousemove (@ self interact-mousemove)
wheel (@ self interact-mousewheel))
;; draw-callback
;; (lambda (chart is-initial)
;; (cl :draw (chain chart (to-dom-y-coord 1.51)))
;; (loop for ent in (@ self ephemera entities)
;; do (if (not (@ ent in-flux))
;; (funcall (getprop self "entityMethods" (@ ent type) "draw")
;; (@ chart hidden_ctx_) ent chart))))
)))))
(chain self chart (update-options (create value-range (let ((range (chain self chart (y-axis-extremes))))
(list (* 0.995 (@ range 0))
(* 1.005 (@ range 1)))))))
(setf (@ window use-chart) (@ self chart))
)))
(let ((self this))
(if (= 0 (@ self ephemera entities length))
(setf (@ self ephemera entities)
(chain j-query (extend (list) (@ self state entities)))))
(panic:jsl (:div :class-name "dygraph-chart-holder"
(:div :class-name "dygraph-chart"
:ref (lambda (ref) (if (not (@ self container-element))
(setf (@ self container-element)
ref)))
:id (+ "dygraph-chart-" (@ this props data id))))))))
;; (flet ((offset-to-percentage (ch offset-x offset-y)
;; (let* ((x-offset (@ (chain ch (to-dom-coords (@ (chain ch (x-axis-range)) 0) nil)) 0))
;; (yar0 (chain ch (y-axis-range 0)))
;; (y-offset (@ (chain ch (to-dom-coords nil (@ yar0 1))) 1))
;; (x (- offset-x x-offset))
;; (y (- offset-y y-offset))
;; (width (- (@ (chain ch (to-dom-coords (@ (chain ch (x-axis-range)) 1) null)) 0)
;; x-offset))
;; (height (- (@ (chain ch (to-dom-coords null (@ yar0 0))) 1)
;; y-offset))
;; (x-pct (if (= 0 width) 0 (/ x width)))
;; (y-pct (if (= 0 height) 0 (/ y height))))
;; (list x-pct (- 1 y-pct))))
;; (zoom (ch zoom-in-percentage x-bias y-bias)
;; (flet ((adjust-axis (axis zoom-in-percentage bias)
;; (let* ((delta (- (@ axis 1) (@ axis 0)))
;; (increment (* delta zoom-in-percentage))
;; (foo (list (* increment bias) (* increment (- bias 1)))))
;; (list (+ (@ axis 0) (@ foo 0))
;; (- (@ axis 1) (@ foo 1))))))
;; (let ((x-bias (if x-bias x-bias 0.5))
;; (y-bias (if y-bias y-bias 0.5))
;; (y-axes (chain ch (y-axis-ranges)))
;; (new-y-axes (list)))
;; (loop for i from 0 to (1- (@ y-axes length))
;; do (setf (getprop new-y-axes i)
;; (adjust-axis (getprop y-axes i) zoom-in-percentage y-bias))
;; (cl (chain ch (x-axis-range)))
;; (chain ch (update-options (create date-window (adjust-axis (chain ch (x-axis-range))
;; zoom-in-percentage x-bias)
;; ;; value-range (@ new-y-axes 0)
;; ))))))))
;; (let* ((normal (if (@ event detail) (* -1 (@ event detail))
;; (* 2 (@ event delta-y))))
;; (percentage (/ normal 50)))
;; (if (not (and (@ event offset-x) (@ event offset-y)))
;; (setf (@ event offset-x) (- (@ event layer-x) (@ event target offset-left))
;; (@ event offset-y) (- (@ event layer-y) (@ event target offset-top))))
;; (let ((percentages (offset-to-percentage chart (@ event offset-x) (@ event offset-y))))
;; (chain event (prevent-default))
;; (chain event (stop-propagation))
;; (zoom chart percentage (@ percentages 0) 0)
;; (cl :percent percentages))))
;; function zoom(g, zoomInPercentage, xBias, yBias) {
;; xBias = xBias || 0.5;
;; yBias = yBias || 0.5;
;; function adjustAxis(axis, zoomInPercentage, bias) {
;; var delta = axis[1] - axis[0];
;; var increment = delta * zoomInPercentage;
;; var foo = [increment * bias, increment * (1-bias)];
;; return [ axis[0] + foo[0], axis[1] - foo[1] ];
;; }
;; var yAxes = g.yAxisRanges();
;; var newYAxes = [];
;; for (var i = 0; i < yAxes.length; i++) {
;; newYAxes[i] = adjustAxis(yAxes[i], zoomInPercentage, yBias);
;; }
;; g.updateOptions({
;; dateWindow: adjustAxis(g.xAxisRange(), zoomInPercentage, xBias),
;; valueRange: newYAxes[0]
;; });
;; }
;; function offsetToPercentage(g, offsetX, offsetY) {
;; // This is calculating the pixel offset of the leftmost date.
;; var xOffset = g.toDomCoords(g.xAxisRange()[0], null)[0];
;; var yar0 = g.yAxisRange(0);
;; // This is calculating the pixel of the higest value. (Top pixel)
;; var yOffset = g.toDomCoords(null, yar0[1])[1];
;; // x y w and h are relative to the corner of the drawing area,
;; // so that the upper corner of the drawing area is (0, 0).
;; var x = offsetX - xOffset;
;; var y = offsetY - yOffset;
;; // This is computing the rightmost pixel, effectively defining the
;; // width.
;; var w = g.toDomCoords(g.xAxisRange()[1], null)[0] - xOffset;
;; // This is computing the lowest pixel, effectively defining the height.
;; var h = g.toDomCoords(null, yar0[0])[1] - yOffset;
;; // Percentage from the left.
;; var xPct = w == 0 ? 0 : (x / w);
;; // Percentage from the top.
;; var yPct = h == 0 ? 0 : (y / h);
;; // The (1-) part below changes it from "% distance down from the top"
;; // to "% distance up from the bottom".
;; return [xPct, (1-yPct)];
;; }
;; function scrollV3(event, g, context) {
;; var today = new Date();
;; milliseconds = today.getMilliseconds();
;; var normal = event.detail ? event.detail * -1 : event.deltaY * 2;
;; // For me the normalized value shows 0.075 for one click. If I took
;; // that verbatim, it would be a 7.5%.
;; var percentage = normal / 50;
;; if (!(event.offsetX && event.offsetY)){
;; event.offsetX = event.layerX - event.target.offsetLeft;
;; event.offsetY = event.layerY - event.target.offsetTop;
;; }
;; var percentages = offsetToPercentage(g, event.offsetX, event.offsetY);
;; var xPct = percentages[0];
;; var yPct = percentages[1];
;; zoom(g, percentage, xPct, yPct);
;; event.preventDefault();
;; event.stopPropagation();
;; }
| 28,581
|
Common Lisp
|
.lisp
| 622
| 38.512862
| 112
| 0.552919
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
f633c073b3915fc02406ef4b798f67be12fcd2d8889f21e445be26d8c2737061
| 2,730
|
[
-1
] |
2,731
|
package.lisp
|
phantomics_seed/seed.ui-model.stage/package.lisp
|
;;;; package.lisp
(defpackage #:seed.ui-model.stage
(:export #:stage #:stage-control-set)
(:use #:cl #:seed.generate))
| 125
|
Common Lisp
|
.lisp
| 4
| 28.75
| 39
| 0.672269
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
629b315dba7689f34bd877d5c618de22bd7a241d8a3f8bae4a702ac34cfc9812
| 2,731
|
[
-1
] |
2,732
|
ui-model.stage.lisp
|
phantomics_seed/seed.ui-model.stage/ui-model.stage.lisp
|
;;;; ui-model.stage.lisp
(in-package #:seed.ui-model.stage)
(defmacro stage (spec)
"Generate an interface model, or stage, based on parameters specifying stage components."
(let ((portal-symbol (intern "*PORTAL*" (package-name *package*)))
(function-symbol (intern "BUILD-STAGE" (package-name *package*))))
`(progn (if (not (fboundp (quote ,function-symbol)))
(defun ,function-symbol ()))
;; declare the function if it doesn't exist, this prevents warnings of an undefined function
(setf (symbol-function (quote ,function-symbol))
,(macroexpand (cons (first spec)
(cons portal-symbol (rest spec))))))))
(defmacro stage-control-set (&key (by-spec nil) (by-parameters nil))
"Generate stage control specifications from sub-macros that provide specifications for classes of stage controls. The sub-macros may provide for definition of specifications according to parameters passed to the control bank generation function or according to parameters present in the system I/O spec."
`(labels ((process-params (spec params &optional output)
(if (not params)
(funcall (lambda (output)
,@(loop for element in by-spec
append (macroexpand (if (listp element)
(cons (first element)
(append (list 'meta 'spec 'params 'output)
(rest element)))
(list element 'meta 'spec 'params 'output)))))
output)
(process-params spec (rest params)
(cond ,@(loop for element in by-parameters
append (macroexpand (if (listp element)
(cons (first element)
(append (list 'meta 'spec
'params 'output)
(rest element)))
(list element 'meta 'spec
'params 'output))))
(t output))))))
#'process-params))
| 1,779
|
Common Lisp
|
.lisp
| 35
| 43.742857
| 306
| 0.667433
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
da364065e5dedbb00a5855a11da55ba5eb9ecebc0eca81cbd4b25a54f6fe009c
| 2,732
|
[
-1
] |
2,733
|
package.lisp
|
phantomics_seed/seed.app-model.raster-layers.base/package.lisp
|
;;;; package.lisp
(defpackage #:seed.app-model.raster-layers.base
(:export #:raster-process-layers)
(:use #:cl #:opticl #:april))
| 136
|
Common Lisp
|
.lisp
| 4
| 31.5
| 47
| 0.692308
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
d02a713cee2fd3b24606fc90e9e72bb6e0a5ec6e10926ceb38bb2d621ba0a853
| 2,733
|
[
-1
] |
2,734
|
raster-layers.base.lisp
|
phantomics_seed/seed.app-model.raster-layers.base/raster-layers.base.lisp
|
;;;;raster-layers.base.lisp
(in-package #:seed.app-model.raster-layers.base)
(defun do-test ()
(let* ((img-src-path (namestring (asdf:system-relative-pathname (intern (package-name *package*)
"KEYWORD")
"sample.jpg")))
(img-out-path (namestring (asdf:system-relative-pathname (intern (package-name *package*)
"KEYWORD")
"sample-out.jpg")))
(img (read-jpeg-file img-src-path)))
;;(print (list :ii img-src-path img-out-path))
(typecase img
(8-bit-rgb-image
(locally (declare (type 8-bit-rgb-image img))
(with-image-bounds (height width)
img
(time (loop for i below height
do (loop for j below width
do (multiple-value-bind (r g b)
(pixel img i j)
(declare (type (unsigned-byte 8) r g b))
(setf (pixel img i j)
(values (- 255 r) g b))))))))))
(write-jpeg-file img-out-path img)))
(defun type-array (img)
(with-image-bounds (height width)
img
(let ((new-img (make-8-bit-rgb-image height width)))
(loop for i below height
do (loop for j below width
do (multiple-value-bind (r g b)
(pixel img i j)
(declare (type (unsigned-byte 8) r g b))
(setf (pixel new-img i j)
(values r g b)))))
new-img)))
(defmacro raster-process-layers (&rest layers)
(labels ((process (layers &optional output)
(if layers
(let* ((layer (first layers))
(layer-type (intern (string-upcase (first layer))
"KEYWORD"))
(layer-data (rest layer))
(path-string (namestring (asdf:system-relative-pathname
(intern (package-name *package*)
"KEYWORD")
"")))
(input (gensym)))
(process (rest layers)
(cond ((eq layer-type :load)
`(read-jpeg-file ,(concatenate 'string path-string
(getf layer-data :path))))
((eq layer-type :apl)
`(funcall (lambda (,input)
(type-array
,(eval (macroexpand `(april (set (:compile-only)
(:state :in ((input ,input))))
,(getf layer-data :exp))))))
,output))
((eq layer-type :output)
`(funcall (lambda (,input)
;;(print (type-of ,input))
(write-jpeg-file ,(concatenate 'string path-string
(getf layer-data :path))
,input))
,output)))))
output)))
(process layers)))
| 2,371
|
Common Lisp
|
.lisp
| 68
| 27.661765
| 98
| 0.584602
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
015ac2bff688319c521b2e4739c5f08bec7628c802cb1bf22e961aefabcc776b
| 2,734
|
[
-1
] |
2,735
|
form.base.lisp
|
phantomics_seed/seed.modes.form.base/form.base.lisp
|
;;;; form.base.lisp
(in-package #:seed.modulate)
(specify-form-modes
modes-form-base
(:predicate
(:enclosed-by (meta))
:to-process (if (and (getf (cddr form) :mode)
(getf (getf (cddr form) :mode) :format))
(getf (getf (cddr form) :mode) :model)
(second form))
:encode ((if (keywordp (first result-output))
(setf (getf result-output :am) (cons "meta" (getf result-output :am))
(getf result-output :mt)
(preprocess-structure (cddr form)))
(setf (getf (first result-output) :fm)
(cons "meta" (getf (first result-output) :fm))
(getf (first result-output) :mt)
(let* ((meta-content (preprocess-structure (cddr form)))
(processed-meta-content
(progn (if (and (getf meta-content :mode)
(getf (getf meta-content :mode) :model))
(setf (getf (getf meta-content :mode) :value)
(second form)))
meta-content)))
(if (and (getf (first result-output) :mt)
(getf (first result-output) :am))
;; if the form macro metadata is being imprinted over existing atom macro metadata
;; i.e. the list is subject to a form macro and the atom at the head of the list is also
;; subject to an atom macro, put the atom macro metadata into an "atom" property
;; prepended to the form metadata
(append (list :|atom| (getf (first result-output) :mt))
processed-meta-content)
processed-meta-content)))))
:decode ((let ((meta-content (postprocess-structure (getf original-form :mt))))
(if (getf meta-content :mode)
(setf (getf (getf meta-content :mode) :model)
form
(getf (getf meta-content :mode) :value)
nil))
(cons (intern "META")
(cons (if (getf (getf meta-content :mode) :format)
(meta-format (getf (getf meta-content :mode) :format)
(getf (getf meta-content :mode) :model))
form)
meta-content)))))
(:predicate (:enclosed-by (quote quasiquote unquote unquote-splicing))))
#|
(:predicate
(:enclosed-by (meta))
:to-process (if (and (getf (cddr form) :mode)
(getf (getf (cddr form) :mode) :format))
(getf (getf (cddr form) :mode) :model)
(second form))
:encode ((if (keywordp (first result-output))
(setf (getf result-output :am) (cons "meta" (getf result-output :am))
(getf result-output :mt)
(let ((meta-content (cddr form)))
(if (getf meta-content :mode)
(setf (getf (getf meta-content :mode) :model)
nil
(getf (getf meta-content :mode) :content)
(second form)))
(preprocess-structure meta-content)))
(setf (getf (first result-output) :fm)
(cons "meta" (getf (first result-output) :fm))
(getf (first result-output) :mt)
(let* ((meta-content (cddr form))
(processed-meta-content
(progn (if (getf meta-content :mode)
(setf ;;(getf (getf meta-content :mode) :model)
;;nil
(getf (getf meta-content :mode) :content)
(second form)))
(print (list :sc (second form)))
(preprocess-structure meta-content))))
(print (list :sc (second form)))
(if (getf (first result-output) :mt)
;; if the form macro metadata is being imprinted over existing atom macro metadata
;; i.e. the list is subject to a form macro and the atom at the head of the list is also
;; subject to an atom macro, put the atom macro metadata into an "atom" property
;; prepended to the form metadata
(if (getf (first result-output) :am)
(append (list :|atom| (getf (first result-output) :mt))
processed-meta-content)
processed-meta-content)
processed-meta-content)))))
:decode ((let ((meta-content (postprocess-structure (getf original-form :mt))))
(print (list :mmt form meta-content))
(cons (intern "META")
(cons (if (getf (getf meta-content :mode) :format)
(meta-format (getf (getf meta-content :mode) :format)
(getf (getf meta-content :mode) :model))
form)
meta-content)))))
|#
| 4,128
|
Common Lisp
|
.lisp
| 95
| 35.915789
| 94
| 0.613913
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
7f1d0471f8ea4749e513b95b6a91cd576f7fabcd08440e967157b20d33133e7a
| 2,735
|
[
-1
] |
2,736
|
script.base.lisp
|
phantomics_seed/seed.foreign.browser-spec.script.base/script.base.lisp
|
;;;; script.base.lisp
(in-package #:seed.foreign.browser-spec.script.base)
(defmacro foundational-browser-script-base ()
"Generate the content for the root script source file."
`(parenscript:ps
(let ((j-query (require "jquery/dist/jquery.min.js")))
(setf (@ window $) j-query
(@ window j-query) j-query
(@ window -react) (require "react")
(@ window -react-d-o-m) (require "react-dom")
(@ window -react-bootstrap) (require "react-bootstrap/dist/react-bootstrap")
(@ window create-react-class) (require "create-react-class")
(@ window -grid) (require "react-bootstrap/lib/Grid")
(@ window -row) (require "react-bootstrap/lib/Row")
(@ window -col) (require "react-bootstrap/lib/Col")
;; (@ window -tooltip) (require "react-bootstrap/lib/Tooltip")
(@ window -popover) (require "react-bootstrap/lib/Popover")
(@ window -overlay) (require "react-bootstrap/lib/Overlay")
(@ window -overlay-trigger) (require "react-bootstrap/lib/OverlayTrigger")
(@ window -autosize-input) (getprop (require "react-input-autosize") "default")
(@ window -autosize-textarea) (require "react-textarea-autosize")
(@ window -select) (getprop (require "react-select") "default")
(@ window -react-d-n-d-html5-backend) (getprop (require "react-dnd-html5-backend") "default")
(@ window -drag-drop-context) (getprop (require "react-dnd") "DragDropContext")
(@ window -drag-source) (getprop (require "react-dnd") "DragSource")
(@ window -drag-source-monitor) (getprop (require "react-dnd") "DragSourceMonitor")
(@ window -drop-target) (getprop (require "react-dnd") "DropTarget")
(@ window -drop-target-monitor) (getprop (require "react-dnd") "DropTargetMonitor")
(@ window -code-mirror) (require "react-codemirror")
(@ window -slate-editor) (getprop (require "slate-react") "Editor")
(@ window -slate-value) (getprop (require "slate") "Value")
(@ window -sketch-color-picker) (getprop (require "react-color/lib/components/sketch/Sketch")
"default")
;; TODO: keypress package has only this numbered, minified script to include.
;; Fork a version of keypress with a main script file.
(@ window -keypress) (require "keypress.js/keypress-2.1.5.min.js")
(@ window three-js) (require "three")
(@ window -react-faux-dom) (require "react-faux-dom")
(@ window -voxel-space) (require "voxel-engine")
(@ window -voxel-space-player) (require "voxel-player")
(@ window d3) (require "d3"))
;; (require "bootstrap/js/tooltip")
(require "script-loader!jquery-serializejson/jquery.serializejson.js")
t)))
| 2,703
|
Common Lisp
|
.lisp
| 44
| 54.772727
| 99
| 0.663907
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
52f722f6c5340ca30947975c209383b3a7e5d78bdebfd63f167bcdbfeae627f1
| 2,736
|
[
-1
] |
2,737
|
package.lisp
|
phantomics_seed/seed.ui-spec.keys.base/package.lisp
|
;;;; package.lisp
(defpackage #:seed.ui-spec.keys.base
(:export #:key-ui-base)
(:use #:cl #:parenscript #:seed.ui-model.keys))
| 133
|
Common Lisp
|
.lisp
| 4
| 30.75
| 49
| 0.669291
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
a62a80dd8ce2bfb3ba58ec12c52073e3767e2663ad15e8f5fecf57aa8865516d
| 2,737
|
[
-1
] |
2,738
|
keys.base.lisp
|
phantomics_seed/seed.ui-spec.keys.base/keys.base.lisp
|
;;;; keys.base.lisp
(in-package #:seed.ui-spec.keys.base)
(specify-key-ui
key-ui-base
:discrete
((move ("space" on-keydown (portal-action trigger-secondary))
("enter" on-keyup (portal-action trigger-primary))
;; this must be on-keyup, not on-keydown, or else the enter action in the specify-keys
;; keyset will also be executed right after the swap happens. x
(("f s" ",") on-keydown (portal-action set-point-type default "" type (list "symbol")))
(("f d" ".") on-keydown (portal-action set-point-type default "0" type (list "number"))
is-exclusive false)
(("f w" ";") on-keydown (portal-action set-point-type default "x" type (list "keyword"))
is-exclusive false)
(("f c" "\\") on-keydown (portal-action set-point-type default "_" type (list "character")))
(("f r" "'") on-keydown (portal-action set-point-type default "" type (list "string")))
("delete" on-keydown (portal-action delete-point))
("meta c" is-exclusive false on-keyup (portal-action record vector #(1 0)))
;; meta-c copies the item at point
("meta t" on-keydown (lambda (e) (chain console (log :ee e))))
("meta s" on-keydown (lambda (e) (chain console (log :ee e))))
("meta v" is-exclusive false on-keyup (portal-action record vector #(-1 0)))
;; meta-v pastes the item at point
(("meta s" "shift s") on-keydown (portal-action commit))
(("meta r" "shift r") on-keydown (portal-action revert)))
(set ("esc" on-keydown (portal-action trigger-anti))
("enter" on-keyup (portal-action trigger-primary)))
(write ("esc" prevent-default false on-keydown (portal-action trigger-anti))
("enter" prevent-default false on-keyup (portal-action trigger-primary))))
:navigational
((move
(("h" "l" "k" "j") ("left" "right" "up" "down") ("num_left" "num_right" "num_up" "num_down"))
("" (is-unordered t on-keyup (portal-action move vector #(-1 0)))
(is-unordered t on-keyup (portal-action move vector #(1 0)))
(is-unordered t on-keyup (portal-action move vector #(0 1)))
(is-unordered t on-keyup (portal-action move vector #(0 -1))))
("e" (on-keyup (portal-action retrace vector #(-1 0)))
(on-keyup (portal-action retrace vector #(1 0)))
(on-keyup (portal-action retrace vector #(0 1)))
(on-keyup (portal-action retrace vector #(0 -1))))
("f" (on-keyup (portal-action insert vector #(-1 0)))
(on-keyup (portal-action insert vector #(1 0)))
(on-keyup (portal-action insert vector #(0 0)))
(on-keyup (portal-action insert vector #(0 1))))
("q w" (on-keyup (portal-action add-reader-macro name "quasiquote"))
(on-keyup (lambda ())))
("q e" (on-keyup (portal-action add-reader-macro name "unquote-splicing"))
(on-keyup (lambda ())))
("q d" (on-keyup (portal-action add-reader-macro name "unquote"))
(on-keyup (lambda ())))
("q" (on-keyup (lambda ()))
(on-keyup (portal-action remove-reader-macro))
(on-keyup (lambda ()))
(on-keyup (lambda ())))
("w" (on-keyup (portal-action recall vector #(1)))
(on-keyup (portal-action recall vector #(-1)))
(on-keyup (portal-action recall vector #(5)))
(on-keyup (portal-action recall vector #(-5))))
("c" (on-keyup (portal-action record vector #(-1 0)))
(on-keyup (portal-action record vector #(1 0)))
(on-keyup (portal-action record-move vector #(0 1)))
(on-keyup (portal-action record-move vector #(0 -1))))
("v" (on-keyup (portal-action control-shift-menu vector #(-1)))
(on-keyup (portal-action control-shift-menu vector #(1))))
("r" (on-keyup (portal-action control-shift-meta vector #(-1 0)))
(on-keyup (portal-action control-shift-meta vector #(1 0)))
(on-keyup (lambda ()))
(on-keyup (lambda ())))))
)
| 3,629
|
Common Lisp
|
.lisp
| 69
| 49.623188
| 96
| 0.663856
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
33bd6bc6bf0f3a53fbdf02eb7bcc579dca14a703ca4042e3e297100a164a26b1
| 2,738
|
[
-1
] |
2,739
|
package.lisp
|
phantomics_seed/seed.ui-spec.html.base/package.lisp
|
;;;; package.lisp
(defpackage #:seed.ui-spec.html.base
(:export #:html-index-header #:html-index-body)
(:use #:cl #:symbol-munger))
| 138
|
Common Lisp
|
.lisp
| 4
| 32
| 49
| 0.681818
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
9a346cb13f8cab8d641952f6c45dd5cda701dd3ef7794bda7260f6c2cc516c76
| 2,739
|
[
-1
] |
2,740
|
html.base.lisp
|
phantomics_seed/seed.ui-spec.html.base/html.base.lisp
|
;;;; html.base.lisp
(in-package #:seed.ui-spec.html.base)
(defmacro html-index-header (title)
"Generates HTML header using given page title."
`(cl-who:htm (:head (:meta :charset "utf-8")
(:title ,title)
(:link :rel "stylesheet" :href "./main.css")
(:link :rel "stylesheet" :href "./portal.css"))))
(defmacro html-index-body ()
"Generates HTML body."
`(cl-who:htm (:body (:div :id "main")
(:script :type "text/javascript" :src "./main.js")
(:script :type "text/javascript" ,(concatenate 'string
"window.portalId = '"
(string-downcase (package-name *package*))
"'; window.portalTitle = '"
(lisp->camel-case (package-name *package*))
"';"))
(:script :type "text/javascript" :src "./portal.js"))))
| 818
|
Common Lisp
|
.lisp
| 19
| 35.526316
| 63
| 0.580402
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
9737f07f801c8c420f29d09d428ccc4af0a1d7a39e0bf70562cb47a7137a3f6a
| 2,740
|
[
-1
] |
2,741
|
package.lisp
|
phantomics_seed/seed.sublimate/package.lisp
|
;;;; package.lisp
(defpackage #:seed.sublimate
(:export #:meta #:fetch-meta #:instantiate-priority-macro-reader)
(:use #:cl #:prove))
| 140
|
Common Lisp
|
.lisp
| 4
| 32.5
| 67
| 0.69403
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
e1560dde0972477d2da85493996c437b74cd7cdcddaee11a6c6ef249fa0dba9d
| 2,741
|
[
-1
] |
2,742
|
test-load.lisp
|
phantomics_seed/seed.sublimate/test-load.lisp
|
;;;; test-load.lisp
;; The code in this file is loaded by test.lisp to test the priority macro reader.
(princ (format nil "~% Collapse of meta forms in read phase:~%"))
(is (META (+ 1 2) :a 1 :b 2 :c 3)
3)
;; (princ (format nil "~% Applying format macros during meta form collapse:~%"))
;; (is (META (2 2) :FORMAT FORMAT-ADD)
;; (format-add (2 2)))
;; (is (META (+ 1 2) :FORMAT FORMAT-INCREMENT-NUMBERS)
;; (format-increment-numbers (+ 1 2)))
| 462
|
Common Lisp
|
.lisp
| 10
| 44.3
| 82
| 0.635347
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
b5182f8d0ca620494a9f66d0eec3ff856628a763d5e46b713e1624eef0dc9b9a
| 2,742
|
[
-1
] |
2,743
|
sublimate.lisp
|
phantomics_seed/seed.sublimate/sublimate.lisp
|
;;;; sublimate.lisp
(in-package #:seed.sublimate)
(defparameter *opening-parenthesis-handler* (get-macro-character #\())
(defun priority-macro-reader-extension (stream character)
"Extend a character reader macro, typically for the left/opening parenthesis '(', to check for the presence of certain macro names so that those macros may be expanded in the read phase, before any other macros are expanded."
(let ((open t)
(string (make-array 5 :element-type 'character :initial-element #\ )))
(loop for index from 0 to 4 while open for char = (read-char stream nil) while char
do (if (char= #\) char) (setq open nil))
(setf (aref string index) char))
(if (and (or (char= #\ (aref string 4))
(char= #\Tab (aref string 4))
(char= #\Newline (aref string 4))
(char= #\Return (aref string 4)))
(string= "META" (subseq string 0 4)))
(macroexpand-1 (read (make-concatenated-stream (make-string-input-stream "(SEED.SUBLIMATE::EXPAND-META ")
stream)
nil nil t))
(funcall *opening-parenthesis-handler*
(make-concatenated-stream (make-string-input-stream string)
stream)
character))))
(defmacro instantiate-priority-macro-reader (&body body)
"Instantiate the priority macro reader for the opening parenthesis and evaluate the body of code."
`(let ((*readtable* (copy-readtable *readtable* nil)))
(set-macro-character #\( #'priority-macro-reader-extension)
,@body))
(defmacro expand-meta (form &rest params)
(declare (ignore params))
form)
(defmacro meta (form &rest params)
(declare (ignore params))
"The macro used in evaluation of meta forms. It simply strips the meta information away, leaving the first member of the form to be evaluated."
form)
(defun fetch-meta (form &optional operation output)
"Given a form containing meta forms, perform an operation on the meta forms within and return the results in a hierarchical format."
(if (or (not form)
(not (listp form)))
output
(fetch-meta (rest form)
operation
(append (let ((point (first form)))
(if (listp point)
(list (if (and (symbolp (first point))
(equal "META" (string-upcase (first point))))
(append (funcall (if operation operation (lambda (input) input))
(cddr point))
(let ((sub-meta (fetch-meta (second point) operation)))
(if sub-meta (cons :meta sub-meta))))
(fetch-meta point operation)))))
output))))
| 2,496
|
Common Lisp
|
.lisp
| 51
| 43.294118
| 227
| 0.679245
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
24a62260e423dc950bbe9906060e972b600b00da9eb20e6e308c6080ce2d12d3
| 2,743
|
[
-1
] |
2,744
|
test.lisp
|
phantomics_seed/seed.sublimate/test.lisp
|
;;;; test.lisp
(in-package #:seed.sublimate)
(princ (format nil "~%Tests for seed.sublimate:~%"))
(defmacro format-add (items) (cons '+ items))
(defmacro format-increment-numbers (items) (mapcar (lambda (item)
(if (numberp item)
(1+ item)
item))
items))
(instantiate-priority-macro-reader
(load (asdf:system-relative-pathname (make-symbol (package-name *package*))
"./test-load.lisp")))
(princ #\Newline)
| 460
|
Common Lisp
|
.lisp
| 13
| 30.153846
| 77
| 0.648526
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
db3ff143d36598b1ca4cdae6f0efa89311e97196e6c5a44eedb4fc6296df8967
| 2,744
|
[
-1
] |
2,745
|
package.lisp
|
phantomics_seed/seed.app-model.graph.garden-path/package.lisp
|
;;;; package.lisp
(defpackage #:seed.app-model.graph.garden-path
(:export #:graph-garden-path #:generate-blank-node #:generate-blank-link
#:add-blank-node #:add-blank-link #:connect-link
#:remove-graph-element #:preprocess-nodes #:postprocess-nodes)
(:use #:cl #:cl-utilities #:uuid))
| 298
|
Common Lisp
|
.lisp
| 6
| 46.5
| 74
| 0.71134
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
b551a2dc754660550e29b90aa551e4b8b7a5dc169ee5a759cfc32be3ac9e9f6d
| 2,745
|
[
-1
] |
2,746
|
graph.garden-path.lisp
|
phantomics_seed/seed.app-model.graph.garden-path/graph.garden-path.lisp
|
;;;; graph.garden-path.lisp
(in-package #:seed.app-model.graph.garden-path)
(defmacro graph-garden-path (function-name &rest nodes)
"Build the function for traversal of a path given the specification of the nodes in the path."
(let ((node-ids (mapcar (lambda (node) (getf node :id))
nodes))
(nodes-sym (gensym)) (state (gensym)) (content (gensym)))
(labels ((build-conditions (node)
;; manifest the conditions that pertain to this link; for option nodes, conditions are evaluated
;; to determine whether the node is presented, while for action and switch nodes the conditions
;; for each link are evaluated in turn and the first link whose condition evaluates to true is
;; followed, or the last link is followed in case it has a condition that evaluates to false
(let ((last-link-index (1- (length (getf node :links)))))
`(cond ,@(mapcar (lambda (link-data link-index)
(let ((nix (position (getf link-data :to)
node-ids))
(link link-data))
(cond ((or (eq :switch (getf node :type))
(eq :action (getf node :type)))
`(,(if (= link-index last-link-index)
t (getf link :if))
(funcall (aref nodes ,nix)
state content)))
((eq :option (getf node :type))
`(,(if (= link-index last-link-index)
t `(= input ,link-index))
(funcall (aref nodes ,nix)
state content))))))
(getf node :links)
(loop for i from 0 to last-link-index collect i)))))
(import-designated-symbols (form)
;; import 'state symbols into the current package so the evaluation of code works properly
(mapcar (lambda (element) (cond ((listp element)
(import-designated-symbols element))
((not (symbolp element))
element)
((string= "STATE" (string-upcase element))
'state)
(t element)))
form))
(format-node (node)
;; generate the top-level format for each node
`(lambda (state &optional content)
(let ((content ,(if (getf node :items)
`(append content (quote (,(getf node :items))))
`content)))
,@(import-designated-symbols (getf node :do))
,(cond ((eq :portal (getf node :type))
`(funcall (function ,(getf node :to)) state))
((eq :switch (getf node :type))
(build-conditions node))
(t `(values content state
(lambda (state input) ,(build-conditions node)))))))))
`(let ((,nodes-sym (vector ,@(mapcar #'format-node nodes))))
(defun ,function-name (state) (funcall (aref ,nodes-sym 0) state))))))
(defun generate-blank-node (type meta)
"Generate a blank node for use in a garden path, starting with a UUID key so the node can be uniquely identified for logging purposes."
(let* ((id (let ((str (make-string-output-stream)))
(uuid:format-as-urn str (uuid:make-v1-uuid))
(intern (string-upcase (third (split-sequence #\: (get-output-stream-string str))))
"KEYWORD")))
(base (list :id id :type type :meta meta)))
(values (append base (if (eq :portal type)
(list :to nil)
(list :items nil :do nil :links nil)))
id)))
(defun generate-blank-link (meta)
"Generate a blank link to connect garden path nodes."
(list :id (let ((str (make-string-output-stream)))
(uuid:format-as-urn str (uuid:make-v1-uuid))
(intern (string-upcase (third (split-sequence #\: (get-output-stream-string str))))
"KEYWORD"))
:meta meta :items nil :if nil))
(defun add-blank-node (list type meta)
"Add a blank node to the specified graph node list with the specified type and metadata."
(multiple-value-bind (output-item output-id)
(generate-blank-node type meta)
(values (append list (list output-item))
output-id)))
(defun add-blank-link (list node-id meta)
"Add a blank link to the node with the specified id in graph node list with the provided metadata."
(loop for item in list
do (if (eq node-id (getf item :id))
(setf (getf item :links)
(append (getf item :links)
(list (generate-blank-link meta))))))
list)
(defun connect-link (list node-id link-id destination-node-id meta)
"Connect a link to a node."
(loop for item in list when (eq node-id (getf item :id))
do (loop for link in (getf item :links) when (eq link-id (getf link :id))
do (setf (getf link :to)
destination-node-id)))
list)
(defun remove-graph-element (list node-id &optional link-id)
"Remove the node or link from the specified graph node list. The presence of the link-id argument means a link will be removed, otherwise the node with the specified id will be removed."
(loop for node in list when (or link-id (not (eq node-id (getf node :id))))
collect (if (and link-id (eq node-id (getf node :id)))
(let ((new-node (copy-tree node)))
(progn (setf (getf new-node :links)
(loop for link in (getf new-node :links)
when (not (eq link-id (getf link :id)))
collect link))
new-node))
node)))
(defun preprocess-nodes (input)
"Prepare a set of nodes for expression as JSON."
(let ((nodes (copy-tree input)))
(loop for node in nodes
do (setf (getf node :id)
(string-upcase (getf node :id)))
(if (getf node :links)
(loop for link in (getf node :links)
do (setf (getf link :id)
(string-upcase (getf link :id)))
(if (getf link :to)
(setf (getf link :to)
(string-upcase (getf link :to)))))))
nodes))
(defun postprocess-nodes (input)
"Prepare a structure converted back from JSON for use within the system."
(let ((nodes (copy-tree input)))
(loop for node in nodes
do (setf (getf node :id)
(intern (getf node :id) "KEYWORD"))
(if (getf node :links)
(loop for link in (getf node :links)
do (setf (getf link :id)
(intern (getf link :id) "KEYWORD"))
(if (getf link :to)
(setf (getf link :to)
(intern (getf link :to) "KEYWORD"))))))
nodes))
#|
(graph-garden-path other-graph
(:id :ab :type :portal :to main-graph))
|#
| 6,085
|
Common Lisp
|
.lisp
| 137
| 38.379562
| 188
| 0.640667
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
ef0110b4cb00d30bac617c30adf81df392f208836152f834ade157f9b50746b5
| 2,746
|
[
-1
] |
2,747
|
react.base.lisp
|
phantomics_seed/seed.ui-spec.react.base/react.base.lisp
|
;;; react.base.lisp
(in-package #:seed.ui-model.react)
(defpsmacro cl (&rest items)
`(chain console (log ,@items)))
(defpsmacro jstr (item)
`(chain -j-s-o-n (stringify ,item)))
(defpsmacro for-data-branch (id branches-list action)
"Perform an operation on the Javascript representation of each data branch within a Seed system."
(let ((val (gensym)) (index (gensym)))
`(let ((,val nil))
(loop for ,index in ,branches-list do (if (= (@ ,index id) ,id)
(setf ,val (funcall ,action ,index))))
,val)))
(defmacro react-portal-core (&rest content)
"Specify a React portal interface implementing different interfaces for Lisp forms and other data types."
`(,@(loop for item in content append (list (macroexpand (if (listp item)
item (list item)))))
(defun inherit (self prop-data process-data map-data)
(let* ((data (funcall process-data prop-data))
(c (@ prop-data context))
(is-vista (= "function" (typeof (@ self props fill))))
(is-parent-vista (@ c is-vista))
(display-vertical (or (and (@ c meta) (= "__y" (@ c meta axis)))
(or (= "short" (@ c breadth))
(= "brief" (@ c breadth)))))
(this-index (if (@ c index) (@ c index) 0)) ;; add 0 if there's no explicit index
(path (chain c path (concat (list (if (and (@ c meta)
(= "__encloseBranchSegment" (@ c meta enclose)))
0 this-index)))))
;; a 0 is always added to the path in case of an __encloseBranchSegment vista,
;; since only a single branch segment is displayed and the displayed segment is always "first"
;; for the purposes of the display logic
(trace (if (< (@ c trace) (@ path length))
(chain c trace (concat (list 0)))
(@ c trace)))
(on-trace (progn
;; (if (= 4 (@ c path length))
;; (cl :ac (@ c on-trace) prop-data))
(and (@ c on-trace)
(or (= (getprop (@ c trace) (1- (@ path length)))
(getprop path (1- (@ path length))))
;; if no trace information exists beyond the
;; path length, presume that the 0-index branch
;; is the one to follow to the point
(and (< (@ c trace length) (@ path length))
;; make sure trace and path match up to the
;; point where path goes further
;; TODO: ACTUALLY, NOT VALID
;; (= (getprop trace (1- (@ trace length)))
;; (getprop path (1- (@ trace length))))
;;(= 0 (if (@ c index) (@ c index) 0))
;; (let ((matched true))
;; (loop for x from (@ c trace length)
;; to (1- (@ path length)) do
;; ;; (cl :uu (@ c trace) path
;; ;; (getprop path x)
;; ;; (- (@ path length)
;; ;; (@ c trace length))
;; ;; (1- (@ path length)))
;; (if (not (= 0 (getprop path x)))
;; (setq matched false)))
;; (if (< (@ path length) 5)
;; (cl :ma (@ c trace)
;; (@ path) matched
;; (- (@ path length)
;; (@ c trace length))
;; (1- (@ path length))
;; ))
;; matched)
(= 0 (getprop path (1- (@ path length)))))))))
(is-point (and on-trace (or (= (@ path length) (@ trace length))
(not is-vista))))
(retracers (if (@ self props enclose)
(chain c retracers (concat (list (chain c methods (build-retracer self)))))
(@ c retracers)))
(orientations (if (@ self props enclose)
(chain c orientations (concat (list display-vertical)))
(@ c orientations)))
(dont-render false)
(new-trace false)
(vertical-sequence-matched false)
(vertical-sequence-broken false)
(context
;; (if (> 5 (@ path length))
;; (cl :tr path c display-vertical (@ c is-parent-vertical)
;; ;trace path (@ c index) (= 0 (getprop path (1- (@ path length)))) c
;; ;(if (@ self state) (@ self state space)) self
;; ;(@ self props context) (@ self state)
;; ;is-vista
;; ;:ont (@ self props context on-trace) on-trace
;; ;:isp (@ self props context is-point) is-point
;; ))
(progn (if (and is-point is-parent-vista (@ prop-data action)
(= "retrace" (@ prop-data action id)))
(progn (loop for x from (1- (@ retracers length)) downto 0 do
;; prevent motion vector from propagating if the orientation
;; switches from vertical to horizontal
(if (and (getprop orientations x)
(not (= 0 (@ prop-data action params vector 1))))
(setq vertical-sequence-matched true))
(if (and vertical-sequence-matched (not (getprop orientations x)))
(setq vertical-sequence-broken true))
(if (and (not new-trace)
(not vertical-sequence-broken)
;; (or (not (@ c meta))
;; (not (= "__encloseBranchesMain" (@ c meta enclose))))
(= "function" (typeof (getprop retracers x))))
(let ((shift-value (funcall (getprop retracers x)
(@ prop-data action params vector)
path)))
(if (or shift-value (= 0 shift-value))
(setf new-trace (chain path (slice 0 x) (concat shift-value)))))))
;; if the movement vector is negative, once a valid branch has been
;; found, run the trace along the highest-numbered downstream branches.
;; the indices of the highest-numbered branches are found by running
;; the retracers functions from those branches with no argument,
;; which should cause them to return the breadth of their rendered
;; elements.
;; (if (and (< (@ new-trace length) (@ retracers length))
;; (> 0 (@ prop-data action params vector 0)))
;; (chain new-trace (push nil)))
;; TODO: CURRENTLY, THIS ONLY WORKS FOR HORIZONTAL MOVEMENT - ADJUST
;; SO THAT VERTICAL MOTION IS HANDLED AS WELL
;(cl :newt new-trace)
(if new-trace (chain c methods (set-trace new-trace)))))
;; (if (> 7 (@ path length))
;; (cl :path path trace (if (@ c meta) (@ c meta enclose))
;; c))
(if (and (@ self props meta) (@ self props meta transparent))
c (create trace trace
path path
on-trace on-trace
retracers retracers
orientations orientations
is-point is-point
working-system (@ c working-system)
movement-transform (if (@ c movement-transform)
(@ c movement-transform)
(lambda (input) input))
index (@ c index)
is-vista is-vista
dont-render dont-render
updated (@ c updated)
methods (if (@ self modulate-methods)
(chain self (modulate-methods (@ c methods)))
(@ c methods))
mode (@ c mode)
current (if (not (= "undefined" (typeof (@ c current))))
(@ c current)
(and (@ self state)
(@ self state context)
(= (@ c updated) (@ self state context updated)))))))))
(create action (@ prop-data action)
action-registered nil
data data
space (if map-data
(funcall map-data prop-data)
data)
context context)))
(defvar interface-components
(create save (panic:jsl (:span :on-click (lambda () (chain self context methods
(grow (@ branch id)
(@ branch data)
(create save true))))
"save"))))
(defun generate-vistas (parent)
(flet ((fill-standard (sub-space)
(lambda (self space)
(let ((space sub-space))
(setf (@ self size) (@ space length))
(chain space (map (generate-vistas self))))))
(respond-standard (sub-space) (lambda (self space))))
(lambda (sector index)
(let* ((self parent)
(initial-sector (if (@ sector 0)
(if (@ sector 0 mt)
(@ sector 0)
(if (= "plain" (@ sector 0 ty 0))
(if (@ sector 1)
(if (@ sector 1 0) (@ sector 1 0) (@ sector 1))
(@ sector 0))
(@ sector 0)))
sector))
(sector-data (@ initial-sector mt))
;; (sector-space (if (and (@ sector 0)
;; (@ sector 0 ty)
;; (= "plain" (@ sector 0 ty 0)))
;; (chain sector (slice 1))
;; sector))
)
;(cl :sc sector initial-sector sector-data)
;(cl :sec sector); sector-space)
;(if transparent (cl 554 index :sec sector (@ parent state context)))
(if (and sector-data (= "__vista" (@ sector-data mode view))
;; don't render the vista if the value inside is nil
(or (not (@ sector vl))
(not (= "nil" (@ sector vl)))))
(vista sector
(let ((ex (create breadth
(if (@ sector-data mode breadth)
(chain sector-data mode breadth (slice 2))
"full")
parent-breadth
(if (@ parent props context)
(@ parent props context breadth))
index index
meta (@ sector-data mode)
parent-meta (if (@ parent props context)
(@ parent props context meta)))))
;; (cl :ex (@ sector-data if) sector-data)
(chain j-query (extend (create) (@ parent state context) ex)))
(if (@ sector-data mode fill)
(getprop window (chain sector-data mode fill (slice 2)))
(fill-standard (chain sector (slice 1))))
(if (@ sector-data mode extend-response)
(getprop window (chain sector-data mode extend-response (slice 2)))
;(respond-standard (chain sector (slice 1)))
(respond-standard sector))
(if (@ sector-data mode enclose)
(getprop window (chain sector-data mode enclose (slice 2)))
enclose-blank)))))))
(defun enclose-blank (self body)
body)
(defun enclose-content (self body)
(panic:jsl (:div :class-name "row" body)))
(defun enclose-branches-main (self body)
(labels ((find-selected-index (id)
(let ((in-segment nil))
(loop for segix from 1 to (1- (@ self props context meta index format length))
do (if (let ((segment (getprop (@ self props context meta index format)
segix))
(found nil))
(loop for index from 0 to (1- (@ segment length))
do (if (= id (getprop segment index "vl"))
(setq found true)))
found)
(setq in-segment segix)))
(1- in-segment))))
(if (and (@ self props action)
(= "setBranchById" (@ self props action id)))
(setf (@ self props context meta point)
(find-selected-index (@ self props action params id))))
(panic:jsl (:div :class-name "branch-segment" (getprop body (@ self props context meta point))))))
(defun enclose-branch-segment (self body)
(let ((portion (/ 12 (@ body length))))
(panic:jsl (:div :class-name "view"
(:div :class-name "main palette-backdrop"
(:div :class-name "branches"
((@ window -react-bootstrap -grid)
((@ window -react-bootstrap -row)
:class-name "show-grid"
(chain body (map (lambda (element index)
(panic:jsl ((@ window -react-bootstrap
-col)
:md portion
:class-name
"column-outer"
:key (+ "branch-" index)
:id (+ "branch-" index)
element)))))))))))))
(defun enclose-branches-adjunct (self body)
(panic:jsl (:div :class-name "palette-adjunct"
(:div :class-name (+ "adjunct-view"
(if (= 0 (@ self props context focus))
" focus" "")
(if (@ self props context is-point)
" point" ""))
(:div :class-name "status")
(:div :class-name (+ "branches" (if (= 1 (@ self props context focus))
" focus" ""))
body)))))
(defun fill-overview (self space)
(let ((branch (create data space id "systems")))
(subcomponent (@ view-modes form-view)
branch :context (index
0
initial-motion #(0 -1)
set-control-target
(lambda (index) (chain self (set-state (create control-target index))))))))
(defun enclose-overview (self body)
(panic:jsl ;; (:div :class-name "palette-adjunct"
(:div :class-name (+ "overview palette-adjunct" (if (@ self state context on-trace)
" point" ""))
(:div :class-name "overview-headspacer")
body (:div :class-name "footer"
(if (< 0 (@ self state data branches length))
(panic:jsl (:div :class-name "title-container"
(:h3 :class-name "title" "seed"))))))));)
;; (defun fill-main-stage (self space)
;; (defvar stuff nil)
;; (setf (@ self size) 0)
;; (if (< 0 (@ self state data branches length))
;; (chain self state data branches (map (lambda (branch index)
;; (if (= "stage" (@ branch id))
;; (panic:jsl (:div :class-name "stage-content"
;; (funcall (generate-vistas self)
;; ;; 0 for the first item in the space
;; (@ branch data 1) 0)))))))))
(let ((interactions (create))
(branch-index (create)))
(defun fill-branch (self space)
;; (cl 22 self space)
;; (cl 21 (@ self state))
(if (and (@ self props action)
(= "setBranchById" (@ self props action id)))
(let* ((set-index nil))
(loop for brix from 0 to (1- (@ self state data branches length))
when (= (@ self props action params id)
(getprop (@ self state data branches) brix "id"))
do (setq set-index brix))))
(setf (@ self size) (@ space length))
(if (< 0 (@ self state data branches length))
(let ((branch (chain self state data branches
(find (lambda (branch)
(= (@ branch id) (chain self props context meta branch (substr 2))))))))
(setf (getprop branch-index (@ branch id)) (create)
(getprop interactions (@ branch id)) (create)
(getprop branch-index (@ branch id) "setInteraction")
(lambda (interaction-name interaction)
(setf (getprop interactions (@ branch id) interaction-name)
interaction))
(getprop branch-index (@ branch id) "getInteraction")
(lambda (interaction-name)
;;(cl :inout interactions (@ branch id) interaction-name)
(getprop interactions (@ branch id) interaction-name)))
(if (= "undefined" (typeof fetch-pane-element))
(setq fetch-pane-element (lambda (element) (if element
(setf (@ self pane-element) element)
(@ self pane-element)))))
(let* ((index (@ self props context meta ct))
(this-set-interaction (getprop branch-index (@ branch id) "setInteraction"))
(this-get-interaction (getprop branch-index (@ branch id) "getInteraction"))
(element-ids (funcall (lambda ()
(let ((history-index nil)
(cboard-index nil))
(chain self props data branches (map (lambda (branch index)
(if (= "history" (@ branch id))
(setq history-index index))
(if (= "clipboard" (@ branch id))
(setq cboard-index index)))))
(create history-index history-index
cboard-index cboard-index)))))
(flip-axis (lambda (vector) (list (@ vector 1) (- (@ vector 0)))))
(trace-index (getprop (@ self state context trace)
(@ self state context path length)))
(this-index (if (@ self state context on-trace)
(if (not (= "undefined" (typeof trace-index)))
trace-index 0)
-1))
(element (cond ;; ((or (not branch)
;; (= (@ branch id) "stage")
;; (= (@ branch id) "clipboard")
;; (= (@ branch id) "history"))
;; nil)
((= (@ branch type 0) "form")
(subcomponent (@ view-modes form-view)
branch
:context
(index
0
interactions interactions
parent-system (@ self props context working-system)
branch-index index
;; TODO: the above only needed for glyph rendering -
;; is there a way to obviate?
force-render t
;;(@ sub-con pane-specs) (@ self element-specs)
fetch-pane-element fetch-pane-element
trace-category "major"
parent-meta (@ self props context meta)
retracer (@ self retrace)
set-interaction this-set-interaction
menu-content
(if (and (@ self state branch-modes)
(= "menu"
(getprop (@ self state branch-modes) index)))
(@ self props space 0 mt mode contextual-menu format))
history-id (if (@ element-ids history-index) "history" nil)
clipboard-id (if (@ element-ids cboard-index) "clipboard" nil)
;; cut the trace if the menu is active - prevents
;; movement commands from registering in form area
;; and menu at the same time
on-trace (if (and (not (= "undefined"
(typeof (@ self state branch-modes))))
(= "menu" (@ self state branch-modes 0)))
false (@ self state context on-trace)))))
((= (@ branch type 0) "text")
(subcomponent (@ view-modes text-view)
branch
:context (index
0
set-interaction this-set-interaction)))
((= (@ branch type 0) "document")
(subcomponent (@ view-modes document-view)
branch
:context (index
0
set-interaction this-set-interaction)))
((and (= (@ branch type 0) "matrix")
(= (@ branch type 1) "spreadsheet"))
;;(cl :vm (@ window d3) (@ view-modes) (@ view-modes block-space-view))
(subcomponent (@ view-modes sheet-view)
branch :context (index
0
interactions interactions
branch-index index
trace-category "major"
parent-meta (@ self props context meta)
pane-specs (@ self element-specs)
;;pane-element (@ self pane-element)
fetch-pane-element fetch-pane-element
retracer (@ self retrace)
set-interaction this-set-interaction
history-id (if (@ element-ids history-index)
"history" nil)
clipboard-id (if (@ element-ids cboard-index)
"clipboard" nil))))
((and (= (@ branch type 0) "space")
(= (@ branch type 1) "block"))
(subcomponent (@ view-modes block-space-view)
branch :context (index 0)))
((and (= (@ branch type 0) "shape")
(= (@ branch type 1) "graph"))
(let ((-this-component ;; (chain window -react-faux-dom
;; (with-faux-d-o-m (@ view-modes
;; graph-shape-view)))
nil))
;; the leading dash in -this-component is required so that the
;; JSL composition happens correctly; it expects the name of a component
;; to begin with a capital letter
(subcomponent (@ view-modes graph-shape-view)
branch :context (index
0
set-interaction this-set-interaction
parent-system
(@ self props context working-system)))))
((and (= (@ branch type 0) "chart")
(= (@ branch type 1) "dygraph"))
(subcomponent (@ view-modes dygraph-chart-view)
branch :context (index 0
set-interaction
this-set-interaction
parent-system
(@ self props context working-system))))
((and (= (@ branch type 0) "graphic")
(= (@ branch type 1) "bitmap"))
(subcomponent (@ view-modes bitmap-display)
(@ branch data)
:context (index index)))
((= (@ branch type 0) "html-element")
(subcomponent (@ view-modes html-display)
(@ branch data)
:context (index index)))))
(top-controls (if (and (@ self props context meta primary-controls)
(not (= "nil" (@ self props context meta primary-controls format 0 vl))))
;; don't display the sub-controls if the value is 'nil',
;; i.e. there's nothing to show
(subcomponent (@ view-modes form-view)
(create id "sub-controls"
data (@ self props context meta
primary-controls format))
:context (view-scope
"short"
index -1
interactions interactions
get-interaction this-get-interaction
movement-transform flip-axis))))
(sub-controls (if (not (= "nil" (@ self props context meta secondary-controls format 0 vl)))
;; don't display the sub-controls if the value is 'nil',
;; i.e. there's nothing to show
(subcomponent (@ view-modes form-view)
(create id "sub-controls"
data (@ self props context meta
secondary-controls format))
:context (view-scope
"short"
index 1
interactions interactions
get-interaction this-get-interaction
movement-transform flip-axis)))))
;;(cl :ef top-controls branch (@ self props context meta))
(if element (panic:jsl (:div :class-name (+ "portal-column " (chain branch type (join " ")))
(:div :class-name (+ "header" (if (@ self state context on-trace)
" point" ""))
(:div :class-name "branch-info"
(:span :class-name "id" (@ branch id))
(if (= true (@ branch meta locked))
(panic:jsl (:span :class-name "locked-indicator"
"locked")))))
(:div :class-name "holder palette-standard"
(if top-controls
(panic:jsl (:div :class-name
(+ "sub-header horizontal-view"
(if (= -1 this-index)
" point" ""))
(:div :class-name "inner"
top-controls))))
;;(:div :class-name "palette-standard"
(:div :class-name
(+ "pane"
(if top-controls " with-sub-header" ""))
;; TODO: WARNING: CHANGE THIS AND THE
;; GLYPH RENDERING BREAKS BECAUSE
;; THE FIRST TERMINAL TD CAN'T BE FOUND!
;; FIGURE OUT WHY
:id (+ "branch-" index "-" (@ branch id))
:ref (lambda (ref)
(let ((element (j-query ref)))
(if (@ element 0)
(fetch-pane-element
element))))
element))
(:div :class-name (+ "footer horizontal-view" (if (= 1 this-index)
" point" ""))
(:div :class-name "inner" sub-controls))))))))))
(defun respond-branches-main (self next-props)
;; toggle the activation of the contextual menu in a branch
;; the controlShiftMenu action is intercepted here
;(cl :space (@ self props data) space rendered)
;(cl :resp self)
(flet ((set-control-target (index)
(chain self (set-state (create control-target index)))))
(if (= "undefined" (typeof (@ self state control-target)))
(set-control-target 0))
(if (and (= "undefined" (typeof (@ self state branch-modes)))
(not (= 0 (@ self props data branches length))))
(chain self (set-state (create branch-modes (chain self props data branches (map (lambda (branch index)
"normal")))))))
(let ((new-modes (chain j-query (extend #() (@ self state branch-modes)))))
(chain next-props data branches
(map (lambda (branch index)
;; ;; dismiss the menu when the user interacts with an entry
;; ;; TODO: this logic needs to encompass a lot more use cases
;; (if (and (= index (@ next-props context index))
;; (@ next-props action)
;; (or (= "triggerPrimary" (@ next-props action id))
;; (= "triggerSecondary" (@ next-props action id))))
;; (setf (getprop new-modes index) "normal"))
;; set the branch-mode to menu if the movement vector is rightward
(if (and (= index (@ next-props context index))
(@ next-props action)
(= "controlShiftMenu" (@ next-props action id)))
(setf (getprop new-modes index)
(if (= 1 (@ next-props action params vector 0))
"menu" "normal"))))))
(chain self (set-state (create action nil branch-modes new-modes))))))
(defun fill-branches-adjunct (self space)
(if (< 0 (@ self state data branches length))
(chain space
(filter (lambda (sector)
(let ((branch (chain self state data branches
(find (lambda (branch) (= (@ branch id) (@ sector vl)))))))
(< 0 (@ branch data length)))))
(map (lambda (sector index)
(setf (@ self size) (1+ (@ self size)))
(let ((branch (chain self state data branches
(find (lambda (branch) (= (@ branch id) (@ sector vl))))))
(active-index (if (@ self state context on-trace)
(if (= (@ self state context path length)
(@ self state context trace length))
0 (getprop (@ self state context trace)
(@ self state context path length)))
-1)))
(chain branch data
(map (lambda (item index)
(if (= "[object Array]" (chain -object prototype to-string (call item)))
(chain item (map (lambda (sub index)
(if (not (= "undefined" (typeof (@ sub mt))))
(setf (@ sub mt mode) (create view "__bar"))
(progn (setf (@ sub mt)
(create mode (create view "__bar")))
sub))))))
item)))
(panic:jsl (:div :class-name (+ "display-" (@ branch id) " view-section"
(if (= index active-index) " point" ""))
:key (+ "display-" index)
(:div :class-name "header"
(:div :class-name "branch-info"
(:span :class-name "id-char"
(cond ((= "history" (@ branch id)) "●")
((= "clipboard" (@ branch id)) "■")))))
(:div :class-name "content"
(subcomponent (@ view-modes form-view)
branch :context (index
index
parent-system
(@ self props context
working-system))))))))))))
(defun -seed-symbol (props)
(let ((segments (@ props symbol)))
(panic:jsl (:span :class-name (+ "seed-symbol" (if (@ props common) " common" ""))
(chain (@ props symbol)
(map (lambda (item-set set-index)
(chain item-set
(map (lambda (item index)
(let ((fl (@ item 0))
(ll (if (< 1 (@ item length))
(getprop item (1- (@ item length)))
"")))
(panic:jsl
(:span :key (+ "atom-part-" index)
:class-name (+ "" (if (= index 0)
"leading" ""))
(if (< 0 (@ set-index))
(panic:jsl (:span :class-name "divider")))
(:span :class-name "fl" fl)
(:span :class-name "m"
(chain item (substr 1 (- (@ item length)
2))))
(:span :class-name "ll" ll))))))))))))))
(defvar -vista
(create-react-class
(create get-initial-state (lambda () (chain this (initialize (@ this props))))
size 0
initialize (lambda (props)
(let* ((self this)
(data (funcall inherit self props
(lambda (d) (@ d data))
(lambda (pd) (@ pd data)))))
(setf (@ data context view-scope)
(if (@ props context view-scope)
(cond ((= "full" (@ props context view-scope))
(@ props context breadth))
((= "short" (@ props context view-scope))
(if (= "brief" (@ props context breadth))
"brief" "short"))
((= "brief" (@ props context view-scope))
"brief"))
(@ props context breadth))
(@ data space) (@ props space))
data))
component-will-receive-props (lambda (next-props)
(let ((self this))
(setf (@ self size) 0)
(chain this (set-state (chain this (initialize next-props))))
(chain this props (extend-response this next-props))))
render (lambda ()
(defvar self this)
(if (or (not (@ this props data))
(= 0 (@ this props data length)))
(panic:jsl (:div))
(let ((class1 (+ "vista " (@ self props context breadth)
(if (= "short" (@ self props context breadth))
" col-2"
(if (= "brief" (@ self props context
breadth))
" col-1" " col")))))
(setf (@ self rendered) (chain self props (fill self (@ self state space))))
(panic:jsl (:div :class-name class1
(chain self props (enclose self (@ self rendered)))))))))))
;; (panic:defcomponent -vista
;; (:get-initial-state
;; (lambda () (chain this (initialize (@ this props))))
;; :size 0
;; :initialize
;; (lambda (props)
;; (let* ((self this)
;; (data (funcall inherit self props
;; (lambda (d) (@ d data))
;; (lambda (pd) (@ pd data)))))
;; (setf (@ data context view-scope)
;; (if (@ props context view-scope)
;; (cond ((= "full" (@ props context view-scope))
;; (@ props context breadth))
;; ((= "short" (@ props context view-scope))
;; (if (= "brief" (@ props context breadth))
;; "brief" "short"))
;; ((= "brief" (@ props context view-scope))
;; "brief"))
;; (@ props context breadth))
;; (@ data space) (@ props space))
;; data))
;; :component-will-receive-props
;; (lambda (next-props)
;; (let ((self this))
;; (setf (@ self size) 0)
;; (chain this (set-state (chain this (initialize next-props))))
;; (chain this props (extend-response this next-props)))))
;; (defvar self this)
;; (if (or (not (@ this props data))
;; (= 0 (@ this props data length)))
;; (panic:jsl (:div))
;; (progn (setf (@ self rendered) (chain self props (fill self (@ self state space))))
;; (panic:jsl (:div :class-name (+ "vista " (@ self props context breadth))
;; (chain self props (enclose self (@ self rendered))))))))
;; (defun -vista (props)
;; (setf
;; ;; (@ this get-initial-state)
;; ;; (lambda () (chain this (initialize props)))
;; (@ this size) 0
;; (@ this initialize)
;; (lambda ()
;; (let* ((self this)
;; (data (funcall inherit self props
;; (lambda (d) (@ d data))
;; (lambda (pd) (@ pd data)))))
;; (setf (@ data context view-scope)
;; (if (@ props context view-scope)
;; (cond ((= "full" (@ props context view-scope))
;; (@ props context breadth))
;; ((= "short" (@ props context view-scope))
;; (if (= "brief" (@ props context breadth))
;; "brief" "short"))
;; ((= "brief" (@ props context view-scope))
;; "brief"))
;; (@ props context breadth))
;; (@ data space) (@ props space))
;; data))
;; (@ this component-will-receive-props)
;; (lambda (next-props)
;; (let ((self this))
;; (setf (@ self size) 0)
;; (chain this (set-state (chain this (initialize next-props))))
;; (chain props (extend-response this next-props))))
;; (@ this render)
;; (lambda ()
;; (defvar self this)
;; (cl :ss self)
;; (if (or (not (@ props data))
;; (= 0 (@ props data length)))
;; (panic:jsl (:div))
;; (progn (setf (@ self rendered) (chain props (fill self (@ self state space))))
;; (panic:jsl (:div :class-name (+ "vista " (@ props context breadth))
;; (chain props (enclose self (@ self rendered)))))))))
;; (setf (@ this state) (chain this (initialize)))
;; (cl :vv this))
;; (setf (@ -vista prototype) (chain -object (create (@ -react -component prototype)))
;; (@ -vista prototype constructor) -vista)
(panic:defcomponent -portal
(:get-initial-state
(lambda ()
(chain console (log 905 this))
(let* ((self this)
(this-date (new (-date)))
(modes (list "move" "set" "write"))
(data (for-data-branch "systems" (@ self props data) (@ self set-up-systems)))
(space (for-data-branch "systems" (@ self props data)
(lambda (item) (chain item data (slice 1)))))
(gen-methods
(funcall
(lambda (self)
;;(cl :dat data)
(lambda ()
(let ((grow-fn (lambda (working-system)
(lambda (branch-id data params callback)
(chain self (transact "grow"
(list (+ "__" working-system)
(+ "__" branch-id)
data params)
(if (not (= "undefined" (typeof callback)))
(funcall callback))))))))
(create grow (grow-fn)
in-context-grow (lambda (ws) (grow-fn ws))
build-retracer (@ self build-retracer)
set-mode (@ self set-mode)
load-branch (@ self fill)
set-branch-by-id (@ self set-branch-by-id)
set-trace (@ self set-trace)
register-branch-path (@ self register-branch-path)
trace-branch (@ self trace-branch)))))
this)))
;(cl 333 (@ self props data))
(create data data
space space
is-portal t
point 0
mark nil
action nil
context (create trace #(0 0)
on-trace t
path #()
branch-paths (create)
retracers (list (@ self retrace))
orientations (list false)
methods (gen-methods)
mode (@ modes 0)
updated (chain this-date (get-time)))
ui (create modes modes
listeners (funcall (lambda ()
(let ((listeners (create)))
(loop for mix from 0 to (1- (@ modes length))
do (setf (getprop listeners (getprop modes mix))
(new (chain window -keypress (-listener)))))
listeners)))))))
:set-up-systems
(lambda (item) (let ((systems nil))
;;(cl 89 (@ item data 1))
(loop for datum in (@ item data 1)
do (if (and (= "[object Array]" (chain -object prototype to-string (call datum)))
(@ datum 0 mt)
(@ datum 0 mt mode)
(= "__portalSpecs" (@ datum 0 mt mode name)))
(setq systems (create branches #()
portal-name (@ datum 0 vl)
systems (@ datum 1)
working-system nil))))
systems))
:build-retracer
(lambda (self)
;;(cl :self (@ self props context))
(lambda (primal-vector)
(let* ((display-vertical (or (and (@ self props context meta)
(= "__y" (@ self props context meta axis)))
(not (= "full" (@ self state context view-scope)))))
(vector (if display-vertical
(chain (list (- (@ primal-vector 1)) (@ primal-vector 0))
(concat (chain primal-vector (slice 2))))
primal-vector))
(path (chain self state context path (concat (list (@ self props context index)))))
(current-point (if (getprop (@ self state context trace) (1- (@ path length)))
(getprop (@ self state context trace) (1- (@ path length)))
0))
(new-point (+ current-point (@ vector 0)))
(count-vistas (lambda ()
(if (not (@ self state space)) 0
(chain self state space (slice 1)
(map (lambda (item index)
(let ((index-item (if (= "[object Array]"
(chain -object prototype to-string
(call item)))
(@ item 0) item)))
(and index-item (@ index-item mt) (@ index-item mt mode)
(= "__vista" (@ index-item mt mode view))))))
(reduce (lambda (total this-item)
(+ total (if this-item 1 0)))))))))
(if (and (= 0 (@ vector 1))
(not (= 0 (@ vector 0)))
;; don't retrace if this is an enclosure for branches; since only one segment will
;; ever by visible, retracing for branch enclosures with more than one segment
;; causes an inability to move the trace past the multi-segment enclosure
(or (not (@ self props context meta))
(not (= "__encloseBranchesMain" (@ self props context meta enclose))))
;; check whether space is subdivided into plain lists; if so, one should be subtracted
;; from the space length since the space will have a plain list at its beginning that
;; pads its length by one. TODO: this is clumsy, is there a better way to determine the
;; navigable area within vistas?
(< (if (and (@ self props context meta)
(@ self props context meta starting-index))
(1- (@ self props context meta starting-index))
-1)
new-point (@ self size)))
;; (+ (if (and (@ self state space 1)
;; (@ self state space 1 0)
;; (@ self state space 1 0 ty)
;; (= "plain" (@ self state space 1 0 ty 0)))
;; -1 0)
;; (@ self state space length))
;(count-vistas)
;))
;; set the upper bound to the space length - 1, since one member of the space is always a
;; plain-list initial marker
new-point false))))
:retrace
(lambda (vector)
;; in this retrace function, the point is *** SOMETHING
(let* ((self this)
(path (chain self state context path (concat (list (@ self state context index)))))
(current-point (if (getprop (@ self state context trace)
(1- (@ path length)))
(getprop (@ self state context trace)
(1- (@ path length)))
0))
(new-point (+ current-point (@ vector 0))))
;; (cl :ccr current-point new-point (@ self state space) (@ self rendered))
(if (< -1 new-point (@ self state space length))
new-point false)))
:component-did-mount
(lambda ()
(loop for mix from 0 to (1- (@ this state ui modes length))
do (chain (getprop (@ this state ui listeners) (getprop (@ this state ui modes) mix))
(register_many (funcall (getprop keystroke-maps (getprop (@ this state ui modes) mix))
this)))
(chain (getprop (@ this state ui listeners) (getprop (@ this state ui modes) mix))
(stop_listening)))
(setf (@ window kls) (@ this state ui listeners))
;; activate the "move" mode by default
(chain (@ this state ui listeners move)
(listen)))
:set-trace
(lambda (new-trace)
;; (cl :newtrace (@ this state context trace) new-trace)
(let ((self this))
(chain self (set-state (create action nil
context (chain j-query (extend (create) (@ self state context)
(create trace new-trace))))))))
:set-mode
(lambda (mode)
(defvar self this)
(defvar this-date (new (-date)))
;; TODO: the set-state must be done with a function so that the mode and action are set
;; at the same time
(chain this (set-state (lambda (previous-state current-props)
(let ((found false)
(new-state
(create context
(chain j-query
(extend (create) (@ previous-state context)
(create mode
(getprop (chain (@ self state ui modes)
(sort (lambda (a b)
(= b mode))))
0))))
action nil)))
(if (not (= -1 (chain (@ self state ui modes) (index-of mode))))
(loop for mix from 0 to (1- (@ self state ui modes length))
do (if (= mode (getprop (@ self state ui modes) mix))
(chain (getprop (@ self state ui listeners)
(getprop (@ self state ui modes) mix))
(listen))
(chain (getprop (@ self state ui listeners)
(getprop (@ self state ui modes) mix))
(stop_listening)))))
new-state)))))
:set-branch-by-id
(lambda (id)
(let ((this-date (new (-date))))
(chain this (set-state (lambda () (create action (create id "setBranchById"
params (create id id))))))))
:act
(lambda (id params)
(let ((this-date (new (-date))))
(chain this (set-state (lambda () (create action (create id id params params)))))))
:transact
(lambda (portal-method params callback)
(defvar self this)
(if (= "__undefined" (@ params 0))
(setf (@ params 0) null))
;; (chain console (log "par" params
;; (chain (list (@ window portal-id) portal-method)
;; (concat params))))
(chain j-query
(ajax (create
url "../portal"
type "POST"
data-type "json"
content-type "application/json; charset=utf-8"
data (chain -j-s-o-n (stringify (chain (list (@ window portal-id) portal-method)
(concat params))))
success
(lambda (data)
(defvar this-date (new (-date)))
;; (chain console (log "DAT2" data (@ self state data) (@ self state)))
;; (chain console (log "DAT2" (chain -j-s-o-n (stringify data))))
(chain self (set-state (lambda (previous-state current-props)
(create
data
;; TODO: REPLACE SELF STATE BELOW WITH PREVIOUS-STATE
(chain j-query (extend (create)
(@ self state data)
(if (@ params 0)
(create branches data)
(for-data-branch
"systems" data
(@ self set-up-systems)))))
action nil
context
(chain j-query
(extend (create) (@ self state context)
(create updated (chain this-date
(get-time)))))))))
(if (not (@ params 0))
(chain self (fill (@ data 0 meta active-system))))
(if callback (callback)))
error (lambda (data err) (chain console (log 11 data err)))))))
:fill
(lambda (system-id)
(defvar self this)
(chain this (set-mode "move"))
(chain this (load-branch-data
system-id
(lambda (stage-data data)
(let ((this-date (new (-date)))
(new-space (chain j-query (extend #() (@ self state space)))))
;; when the system is loaded, set the trace to #(1), pointing to the first branch
(chain self (set-state (create data (chain j-query (extend (create) (@ self state data)
(create branches data)))
space (for-data-branch
"systems" stage-data
(lambda (item) (chain item data (slice 1))))
context
(chain j-query
(extend (create) (@ self state context)
(create updated
(chain this-date (get-time))
trace #(1))))))))))))
:load-branch-data
(lambda (system-id callback)
(let ((self this))
(extend-state context (create working-system system-id))
(chain j-query
(ajax (create url "../portal"
type "POST"
data-type "json"
content-type "application/json; charset=utf-8"
data (chain -j-s-o-n (stringify (list (@ window portal-id) "grow" null null null
(create active-system
(if (= "nil" system-id)
null system-id)))))
success (lambda (data)
(chain self (load-b-data data system-id callback)))
error (lambda (data err) (chain console (log 11 data err))))))))
:load-b-data
(lambda (stage-data system-id callback)
(let ((self this))
(extend-state context (create working-system system-id))
(chain j-query
(ajax (create url "../portal"
type "POST"
data-type "json"
content-type "application/json; charset=utf-8"
data (chain -j-s-o-n (stringify (list (@ window portal-id) "grow"
(if (= "nil" system-id)
null (+ "__" system-id)))))
success (lambda (data)
(callback stage-data data))
error (lambda (data err) (chain console (log 11 data err))))))))
:register-branch-path
(lambda (category name path)
(let* ((self this)
(new-paths (chain j-query (extend (create) (@ self state context branch-paths)))))
(if (or (= "undefined" (typeof (getprop new-paths category)))
(= "undefined" (typeof (getprop new-paths category name))))
(chain self (set-state (create context
(chain j-query
(extend (create) (@ self state context)
(create branch-paths
(progn
(if (= "undefined"
(typeof (getprop new-paths
category)))
(setf (getprop new-paths category)
(create)))
(setf (getprop new-paths category name)
path)
new-paths))))))))))
:trace-branch
(lambda (category name)
;; TODO: make this work
;;(cl 9191 category name (@ this state context))
;; (chain this (set-state ;; (create trace (getprop (@ this state branch-paths)
;; ;; category name))
;; (create context (chain j-query (extend (create) (@ this state context)
;; (create trace
;; (getprop (@ this state context
;; branch-paths)
;; category name)))))))
)
;; :should-component-update
;; (lambda (next-props next-state)
;; (or (@ next-state just-updated)
;; (and (@ this state context in-focus)
;; ; don't update if an action was received, since the
;; ; props are always repropagated after the action is completed and nullified
;; (and (not (@ this state action))
;; (@ this state context is-point)))))
:component-did-update
(lambda ()
(defvar self this)
;; actions at the portal level are handled with the did-update method
;; since it does not receive a props update upon command execution
(handle-actions (@ self state action) (@ self state) (@ self props)
:actions-point-and-focus
((move (chain self (set-state (create action nil)))
(chain self (move (@ params vector))))))))
;(cl 234 (jstr (@ this state context)) (@ this state context))
;(chain this (build-retracer 0 (create breadth "full") (@ this state space)))
;(cl 888 (@ this state) (chain this (build-retracer 0 (create breadth "full") (@ this state space))))
;; (cl 921 (@ this props) (@ this state) (@ this state space))
(let* ((self this))
(panic:jsl (:div :class-name "portal palette-standard container-fluid"
(:div :class-name "row"
(chain this state space (map (generate-vistas self)))
(if (= 0 (@ this state data branches length))
(panic:jsl (:div :class-name "intro-animation col"
(:div :class-name "animation-inner"
(funcall (lambda ()
(loop for n from 0 to 11 collect
(panic:jsl (:div :key (+ "sc-" n)
:id (+ "star-caster-"
n)))))))
(:h3 :class-name "title" "seed")))))))))
(setq -portal (chain ((chain window (-drag-drop-context (@ window -react-d-n-d-html5-backend)))
-portal)))
))
| 46,911
|
Common Lisp
|
.lisp
| 1,084
| 34.559041
| 110
| 0.552304
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
4e6e1d9a6acecf752558102dc5110f34504e876b2393116e780a1cb12aa445c2
| 2,747
|
[
-1
] |
2,748
|
seed.asd
|
phantomics_seed/seed.asd
|
;;;; seed.asd
(asdf:defsystem #:seed
:description "This is the root system for Seed, an interactive software environment. It instantiates the portals and contact points associated with this instance of Seed."
:author "Andrew Sengul"
:license "GPL"
:serial t
:depends-on (#:seed.contact #:seed.platform-model.router.base #:portal.demo1)
:components
((:file "package")
(:file "seed")))
| 403
|
Common Lisp
|
.asd
| 10
| 37.4
| 173
| 0.732143
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
5450e8153d3330049623e9688167b5f25b7a036fd5a491e0288dae4304c04808
| 2,748
|
[
-1
] |
2,749
|
seed.ui-spec.form.mode-shape-graph.asd
|
phantomics_seed/seed.ui-spec.form.mode-shape-graph/seed.ui-spec.form.mode-shape-graph.asd
|
;;;; seed.ui-spec.form.mode-shape-graph.asd
(asdf:defsystem #:seed.ui-spec.form.mode-shape-graph
:description "Describe seed.ui-spec.form.mode-shape-graph here"
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components ((:file "extension")
(:file "form.mode-shape-graph")))
| 308
|
Common Lisp
|
.asd
| 8
| 34.125
| 65
| 0.687919
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
50f1095308f3ce7f207ab57d572d25377e4633776cf1dc8cd65198d8cbdf11a2
| 2,749
|
[
-1
] |
2,750
|
seed.ui-model.color.asd
|
phantomics_seed/seed.ui-model.color/seed.ui-model.color.asd
|
;;;; seed.ui-model.color.asd
(asdf:defsystem #:seed.ui-model.color
:description "Models for defining and modulating color palettes for use in Seed's user interface."
:author "Andrew Sengul"
:license "GPL-3.0"
:version "0.0.1"
:serial t
:depends-on (:dufy)
:components ((:file "package")
(:file "ui-model.color")))
| 344
|
Common Lisp
|
.asd
| 10
| 30.4
| 100
| 0.675676
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
9640441437862b38ec053f51bef317b3288291cfb221bd89809d7fb1eca1e171
| 2,750
|
[
-1
] |
2,751
|
seed.media.graph.garden-path.asd
|
phantomics_seed/seed.media.graph.garden-path/seed.media.graph.garden-path.asd
|
;;;; seed.media.graph.garden-path.asd
(asdf:defsystem #:seed.media.graph.garden-path
:description "A set of media supporting the growth of garden path graph structures."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:depends-on (:uuid #:seed.app-model.graph.garden-path)
:components ((:file "extension")
(:file "graph.garden-path")))
| 370
|
Common Lisp
|
.asd
| 9
| 36.888889
| 86
| 0.699164
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
4147c02b46865c14a515100941cf37b6b841bec1020601b48fc5cbdca5c8b4d0
| 2,751
|
[
-1
] |
2,752
|
seed.app-model.feed.base.asd
|
phantomics_seed/seed.app-model.feed.base/seed.app-model.feed.base.asd
|
;;;; seed.app-model.feed.base.asd
(asdf:defsystem #:seed.app-model.feed.base
:description "Seed application model for content feeds, such as blogs, publishing systems and more."
:author "Andrew Sengul"
:license "GPL-3.0"
:version "0.0.1"
:serial t
:components ((:file "package")
(:file "feed.base")))
| 330
|
Common Lisp
|
.asd
| 9
| 32.555556
| 102
| 0.678125
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
e4011b732ededb06834210d15fb54190e3fda3927140796d76d972acc0495321
| 2,752
|
[
-1
] |
2,753
|
seed.platform-model.router.base.asd
|
phantomics_seed/seed.platform-model.router.base/seed.platform-model.router.base.asd
|
;;;; seed.platform-model.router.base.asd
(asdf:defsystem #:seed.platform-model.router.base
:description "The model for Seed's standard router: a set of portal and contacts that route communication with systems in a standard namespace to specific remote or local destinations."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:depends-on (#:seed.generate #:seed.media.base)
:components ((:file "package")
(:file "router.base")))
| 462
|
Common Lisp
|
.asd
| 9
| 47.111111
| 187
| 0.727273
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
983db8dbca3b5d6b3b3a2cd2b31f10494b9243bf8ca787125ad4fca0bf556187
| 2,753
|
[
-1
] |
2,754
|
seed.ui-spec.stage-menu.base.asd
|
phantomics_seed/seed.ui-spec.stage-menu.base/seed.ui-spec.stage-menu.base.asd
|
;;;; seed.ui-spec.stage-menu.base.asd
(asdf:defsystem #:seed.ui-spec.stage-menu.base
:description "Standard set of contextual menu options for the Seed stage."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components ((:file "package")
(:file "stage-menu.base")))
| 299
|
Common Lisp
|
.asd
| 8
| 33
| 76
| 0.681661
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
89638e127b7c8949c4e7f7f8f6cc7000a8b8cf478b6c5cad373dbb5c18a29038
| 2,754
|
[
-1
] |
2,755
|
seed.express.glyphs.base.asd
|
phantomics_seed/seed.express.glyphs.base/seed.express.glyphs.base.asd
|
;;;; seed.express.glyphs.base.asd
(asdf:defsystem #:seed.express.glyphs.base
:description "The standard set of glyphs representing Common Lisp symbols and datatypes."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components
((:file "package")
(:file "glyphs.base")))
| 291
|
Common Lisp
|
.asd
| 9
| 29.555556
| 91
| 0.725979
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
f5a2049203e09a762baa5558136a97e025ce7a34915aa2ffbfd39109325d9eba
| 2,755
|
[
-1
] |
2,756
|
seed.ui-model.keys.asd
|
phantomics_seed/seed.ui-model.keys/seed.ui-model.keys.asd
|
;;;; seed.ui-model.keys.asd
(asdf:defsystem #:seed.ui-model.keys
:description "The model for the key/action associations that enable keyboard input in the Seed interface."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:depends-on (#:parenscript #:symbol-munger)
:components
((:file "package")
(:file "ui-model.keys")))
| 346
|
Common Lisp
|
.asd
| 10
| 31.6
| 108
| 0.712575
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
cf755ba039ce40f1adb84e698b3e48541a353d43b71130ad60dd78860a153075
| 2,756
|
[
-1
] |
2,757
|
demo-image.asd
|
phantomics_seed/demo-image/demo-image.asd
|
;;;; demo-image.asd
(asdf:defsystem #:demo-image
:description "Sample Seed system implementing a raster image editor."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:depends-on (:seed.app-model.raster-layers.base)
:components ((:file "package")
(:file "main")
(:file "utils")))
| 322
|
Common Lisp
|
.asd
| 10
| 27.5
| 71
| 0.654839
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
1656a554e2238ca299ae2b9c464d43d0655bbd787fb49c7081bb9081f6a8ed33
| 2,757
|
[
-1
] |
2,758
|
seed.modes.atom.base.asd
|
phantomics_seed/seed.modes.atom.base/seed.modes.atom.base.asd
|
;;;; seed.modes.atom.base.asd
(asdf:defsystem #:seed.modes.atom.base
:description "Baseline specifications for modulating atoms in Seed."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components
((:file "atom.base")
(:file "extension")))
| 263
|
Common Lisp
|
.asd
| 9
| 26.333333
| 70
| 0.710317
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
5f707368c59f55646d415b175afed0013328d971b90d845c71f1a5a4b6e6a1da
| 2,758
|
[
-1
] |
2,759
|
seed.app-model.site.base.asd
|
phantomics_seed/seed.app-model.site.base/seed.app-model.site.base.asd
|
;;;; seed.app-model.site.base.asd
(asdf:defsystem #:seed.app-model.site.base
:description "Seed application model with basic facilities for creating HTML pages."
:author "Andrew Sengul"
:license "GPL-3.0"
:version "0.0.1"
:serial t
:components ((:file "package")
(:file "site.base")))
| 314
|
Common Lisp
|
.asd
| 9
| 30.777778
| 86
| 0.677632
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
0e1f81f67fe4cd4ab6490d1d892b0877bb6afd005faf583ab599b3b9936c9d99
| 2,759
|
[
-1
] |
2,760
|
seed.contact.asd
|
phantomics_seed/seed.contact/seed.contact.asd
|
;;;; seed.contact.asd
(asdf:defsystem #:seed.contact
:description "This system is the point of contact between Seed systems and the larger network, routing HTTP requests to the appropriate handler functions and returning output."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:depends-on (#:jonathan #:symbol-munger #:hunchentoot #:seed.modulate)
:components
((:file "package")
(:file "contact")))
| 424
|
Common Lisp
|
.asd
| 10
| 39.5
| 178
| 0.738499
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
f63cbe94e151be2523e4d96c9041277e2947d2699bee626c52ca412bb2f3a5f3
| 2,760
|
[
-1
] |
2,761
|
seed.media.chart.base.asd
|
phantomics_seed/seed.media.chart.base/seed.media.chart.base.asd
|
;;;; seed.media.chart.base.asd
(asdf:defsystem #:seed.media.chart.base
:description "A set of media supporting the growth of charts and chart entities."
:author "Andrew Sengul"
:license "GPL-3.0"
:version "0.0.1"
:serial t
:components ((:file "extension")
(:file "chart.base")))
| 308
|
Common Lisp
|
.asd
| 9
| 30.111111
| 83
| 0.671141
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
9ae9da92064f3c76f4360a7ece70425c83a61ac5cc82fa35cb9701ec3a0c8e33
| 2,761
|
[
-1
] |
2,762
|
seed.ui-spec.display.common.asd
|
phantomics_seed/seed.ui-spec.display.common/seed.ui-spec.display.common.asd
|
;;;; seed.ui-spec.display.common.asd
(asdf:defsystem #:seed.ui-spec.display.common
:description "Display templates for common types of static data within Seed's browser interface."
:author "Andrew Sengul"
:license "GPL-3.0"
:version "0.0.1"
:serial t
:components ((:file "extension")
(:file "display.common")))
| 340
|
Common Lisp
|
.asd
| 9
| 33.666667
| 99
| 0.693939
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
06bcf55996ad6992a262c0f77168efe3297a3bce3d42d30bc780e24d072dfae0
| 2,762
|
[
-1
] |
2,763
|
seed.foreign.browser-spec.style.icons-m-design.asd
|
phantomics_seed/seed.foreign.browser-spec.style.icons-m-design/seed.foreign.browser-spec.style.icons-m-design.asd
|
;;;; seed.foreign.browser-spec.style.icons-m-design.asd
(asdf:defsystem #:seed.foreign.browser-spec.style.icons-m-design
:description "Parameters to implement material design icons in Seed's user interface via CSS rules."
:author "Andrew Sengul"
:license "GPL-3.0"
:version "0.0.1"
:serial t
:components ((:file "package")
(:file "style.icons-m-design")))
| 385
|
Common Lisp
|
.asd
| 9
| 38.666667
| 102
| 0.706667
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
c2d53bebe9d4d0ffa564a9c9397bc635e2cf6562f95615e5f18964d4840200ea
| 2,763
|
[
-1
] |
2,764
|
seed.media.base.asd
|
phantomics_seed/seed.media.base/seed.media.base.asd
|
;;;; seed.media.standard.asd
(asdf:defsystem #:seed.media.base
:description "Standard I/O media for Seed."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:depends-on (#:seed.app-model.sheet.base #:drakma #:seed.app-model.document-slate.base)
:components ((:file "extension")
(:file "media.base")))
| 333
|
Common Lisp
|
.asd
| 9
| 32.777778
| 89
| 0.673913
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
4fefa9898e5c772466aad6bc4ee189300ca405119ef0c3ebc9d2d6d807e53a9b
| 2,764
|
[
-1
] |
2,765
|
seed.modulate.asd
|
phantomics_seed/seed.modulate/seed.modulate.asd
|
(asdf:defsystem #:seed.modulate
:description "The seed.modulate system mediates the external and internal representations of data used by Seed."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:depends-on (#:fare-quasiquote #:cl-ppcre #:cl-utilities #:parse-number #:symbol-munger)
:components
((:file "package")
(:file "modulate")))
| 357
|
Common Lisp
|
.asd
| 9
| 36.666667
| 114
| 0.724138
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
5c1d0e507b7af6ff82e7b4664b8a15a972c3e1e5d38a13012c0ec020a6815307
| 2,765
|
[
-1
] |
2,766
|
seed.ui-spec.stage-controls.document.base.asd
|
phantomics_seed/seed.ui-spec.stage-controls.document.base/seed.ui-spec.stage-controls.document.base.asd
|
;;;; seed.ui-spec.stage-controls.document.base.asd
(asdf:defsystem #:seed.ui-spec.stage-controls.document.base
:description "A set of standard control interface specs for rich text documents."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components ((:file "extension")
(:file "document.base")))
| 331
|
Common Lisp
|
.asd
| 8
| 37.125
| 83
| 0.708075
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
5b95801940c8aeef58d6bb0a820d38828350183303075205d9c11eabfac6df2a
| 2,766
|
[
-1
] |
2,767
|
portal.demo1.asd
|
phantomics_seed/portal.demo1/portal.demo1.asd
|
;;;; portal.demo1.asd
(asdf/defsystem:defsystem #:portal.demo1
:description "This is my portal."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:depends-on (#:seed.generate #:seed.media.base #:seed.media.chart.base
#:seed.media.graph.garden-path #:seed.modulate
#:seed.modes.atom.base #:seed.modes.form.base
#:seed.modes.meta.common
#:seed.express.glyphs.base #:seed.ui-model.stage
#:seed.ui-model.keys #:seed.ui-model.html #:seed.ui-model.css
#:seed.ui-model.react #:seed.ui-spec.stage.base
#:seed.ui-spec.keys.base #:seed.ui-spec.keys.map-apl
#:seed.ui-spec.html.base #:seed.ui-spec.color.base
#:seed.ui-spec.display.common #:seed.ui-spec.css.base
#:seed.ui-spec.react.base #:seed.ui-spec.css-vector.base
#:seed.ui-spec.stage-menu.base #:seed.ui-spec.stage-controls.graph
#:seed.ui-spec.stage-controls.document.base
#:seed.ui-spec.stage-controls.chart.base
#:seed.ui-spec.unit.base #:seed.ui-spec.form.base
#:seed.ui-spec.html-css.glyph-set-mdi
#:seed.ui-spec.form.mode-text
#:seed.ui-spec.form.mode-document
#:seed.ui-spec.form.mode-sheet
#:seed.ui-spec.form.mode-block-space
#:seed.ui-spec.form.mode-shape-graph
#:seed.ui-spec.form.mode-chart-dygraph
#:seed.ui-effects.vector.base
#:seed.foreign.browser-spec.script.base
#:seed.foreign.browser-spec.ss.form-dygraphs
#:seed.foreign.browser-spec.style.base
#:seed.foreign.browser-spec.style.icons-m-design
#:seed.app-model.site.base
#:quickproject #:prove #:parenscript #:panic #:lass
#:swank) ;; TODO: swank included only for demoSheet, are there other options?
:components
((:file "package")
(:file "test-core-systems")
(:file "portal")))
| 1,853
|
Common Lisp
|
.asd
| 40
| 39
| 85
| 0.655629
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
8aac1190518253a8ae0c67363817cf1bfea3b80862bb7cb21f7109e993cc7978
| 2,767
|
[
-1
] |
2,768
|
seed.ui-spec.unit.base.asd
|
phantomics_seed/seed.ui-spec.unit.base/seed.ui-spec.unit.base.asd
|
;;;; seed.ui-spec.unit.base.asd
(asdf:defsystem #:seed.ui-spec.unit.base
:description "Standard templates for the display of data units in the Seed interface."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components ((:file "extension")
(:file "unit.base")))
| 295
|
Common Lisp
|
.asd
| 8
| 32.5
| 88
| 0.680702
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
ab693cf91468a7007ed9ceec42d500328e4aaaa402f568a67293e7bd08447da4
| 2,768
|
[
-1
] |
2,769
|
seed.foreign.browser-spec.style.base.asd
|
phantomics_seed/seed.foreign.browser-spec.style.base/seed.foreign.browser-spec.style.base.asd
|
;;;; seed.foreign.browser-spec.style.base.asd
(asdf:defsystem #:seed.foreign.browser-spec.style.base
:description "Defines the system through which CSS modules are compiled and built to create the base library supporting Seed interface functions in the browser."
:author "Andrew Sengul"
:license "GPL"
:serial t
:depends-on (#:parenscript)
:components ((:file "package")
(:file "style.base")))
| 423
|
Common Lisp
|
.asd
| 9
| 42.777778
| 163
| 0.730583
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
680d7b85be59b0ff29890721c7632a1b70ccc9db4264c4f2f298609a54ba9e77
| 2,769
|
[
-1
] |
2,770
|
seed.ui-spec.css-vector.base.asd
|
phantomics_seed/seed.ui-spec.css-vector.base/seed.ui-spec.css-vector.base.asd
|
;;;; seed.ui-spec.css-vector.base.asd
(asdf:defsystem #:seed.ui-spec.css-vector.base
:description "Common styles for Seed's vector graphics-based user interface modules."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components ((:file "extension")
(:file "css-vector.base")))
| 312
|
Common Lisp
|
.asd
| 8
| 34.625
| 87
| 0.692053
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
ed00ff0956791735850fa7dfa25cf081c13281df61da24d4e08a70807add724a
| 2,770
|
[
-1
] |
2,771
|
seed.ui-spec.stage.base.asd
|
phantomics_seed/seed.ui-spec.stage.base/seed.ui-spec.stage.base.asd
|
;;;; seed.ui-spec.stage.base.asd
(asdf:defsystem #:seed.ui-spec.stage.base
:description "The standard layout templates for presentation of a Seed interface."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components ((:file "package")
(:file "stage.base")))
| 291
|
Common Lisp
|
.asd
| 8
| 32.125
| 84
| 0.684397
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
475fb5a7fdd90a3f4eafd7a53dabf7afc4340a1b1cba8cbbe6a58548b7b8b0dd
| 2,771
|
[
-1
] |
2,772
|
seed.ui-spec.stage-controls.graph.asd
|
phantomics_seed/seed.ui-spec.stage-controls.graph/seed.ui-spec.stage-controls.graph.asd
|
;;;; seed.ui-spec.stage-controls.graph.asd
(asdf:defsystem #:seed.ui-spec.stage-controls.graph
:description "A set of standard control interface specs for graphs."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components ((:file "extension")
(:file "stage-controls.graph")))
| 310
|
Common Lisp
|
.asd
| 8
| 34.375
| 70
| 0.696667
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
b3c689b4e98a6c1e7276c94dac0121a3a6a4fc9f1727f778d6934651f8d0ae86
| 2,772
|
[
-1
] |
2,773
|
seed.ui-spec.form.mode-sheet.asd
|
phantomics_seed/seed.ui-spec.form.mode-sheet/seed.ui-spec.form.mode-sheet.asd
|
;;;; seed.ui-spec.form.mode-sheet.asd
(asdf:defsystem #:seed.ui-spec.form.mode-sheet
:description "A template for the display of spreadsheet-formatted data in the Seed interface."
:author "Andrew Sengul"
:license "GPL-3.0"
:serial t
:components ((:file "extension")
(:file "form.mode-sheet")))
| 321
|
Common Lisp
|
.asd
| 8
| 35.75
| 96
| 0.694534
|
phantomics/seed
| 77
| 4
| 3
|
GPL-3.0
|
9/19/2024, 11:25:50 AM (Europe/Amsterdam)
|
64cf950673fdfdf8fb0ee91e6cf56d8cbf271fb238d9ba6c0da5068d0d16706c
| 2,773
|
[
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.