Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create - theme_widget #21

Open
63 of 64 tasks
alyhxn opened this issue Jun 16, 2024 · 27 comments
Open
63 of 64 tasks

Create - theme_widget #21

alyhxn opened this issue Jun 16, 2024 · 27 comments

Comments

@alyhxn
Copy link

alyhxn commented Jun 16, 2024

Todo












  • Update - theme_widget_v0.0.11

@alyhxn
Copy link
Author

alyhxn commented Jun 16, 2024

Tasks - 2024.06.17

  • Create - theme_widget
    • Implemented communication - 4h
    • Implemented theme widget - 3h
    • Logged task - 2min
    • Recorded Worklog - 13min
    • @output 📦 theme_widget_v0.0.1

Worklog

worklog-216

@serapath
Copy link
Member

feedback 2024.06.16

Brilliant. I love it.
One question though.
What happens if a name repeats?
What about "nested components"?
What if e.g. "editor" would have a sub component "menu"?

How do you display those?
They should be displayed i guess.

Last - if you select any component, it should show the current CSS and you edit it instead of adding to the current CSS.

Also - one should be able to give a name to the totality of all css of all components, changed or unchanged, and save it.

Then, a dropdown should allow me to select any of the saved themes and it will apply it and also restore the css from that theme in the editor if i select the components.

Finally, of course, a selected saved theme should also be deleteable (apart from the hard coded default themes)

Now, an additional cool feature would be, once a theme is selected and gets changed, to keep track of all component names in the list visually where the css has been changed, until we "save" those changes under the current or a new name.

The hard coded ones are the ones provided by ibrar at some point. At least the current theme fixed and an additional dark theme or night theme.
theme-files

@alyhxn
Copy link
Author

alyhxn commented Jun 20, 2024

Tasks - 2024.06.21

  • Update - theme_widget_v0.0.1
    • index.js cleanup - 30min
    • Load operation - 2h
    • Add operation - 1h
    • Save operation - 2h
    • Debugging - 1h
    • Recorded worklog - 10min
    • Logged tasks - 5min
    • @output 📦 theme_widget_v0.0.2

Worklog

worklog-217


Feedback

Also - one should be able to give a name to the totality of all CSS of all components, changed or unchanged, and save it.

I have implemented this but not like what we have in VScode but we can save components into specific themes individually.

Now, an additional cool feature would be, once a theme is selected and gets changed, to keep track of all component names in the list visually where the CSS has been changed until we "save" those changes under the current or a new name.

This is an advanced feature and needs some critical thinking about how to carry it out.

@alyhxn
Copy link
Author

alyhxn commented Jun 22, 2024

Tasks - 2024.06.22

  • Update - theme_widget_v0.0.2
    • Enabled IDs for components - 1h
    • Converted theme_widget list into tree - 2h30min
    • Enabled jumping to a section - 30min
    • Style adjustments - 30min
    • Logged tasks - 5min
    • Recorded worklog - 10min
    • @output 📦 theme_widget_v0.0.3

Worklog

worklog-218

@serapath
Copy link
Member

feedback 2024.06.23

Good job. Excellent.
Current github page of your fork seems to have a broken built, maybe you can take a look and fix it as well, but i saw how it works in your worklogs, which seems good.

Would be good to make what you have work for all components, so ibrar can start playing with it even while you are still improving things. It seems this should already be somewhat usable now.


Otherwise:

  • make theme for all components work, not just "our_contributors"
  • any "unsaved changes" in component themes (cached, but not saved under a name yet)
    • maybe diting css "autosaves", so refresh will still show what you changed last
    • but if you select a theme and apply changes to it, it will set a "dirty" flag in localStorage
    • when theme editor loads, it will check dirty flag for all component names and make the font, e.g. yellow, to indicate there are changes, but those have not been saved to the specific "theme name" yet. If you switch a theme name before you save, those changes will be lost and overriden by what is loaded from that new selected theme.
  • needs to have a delete option for named theme
  • needs a reset button to clear localStorage to go back to hardcoded defaults
  • needs to have ability to inject custom default styling per component type not just instance

Let me say something about the last option, which might sound confusing, but for example:

  1. we have "our contributors" with styling to layout contributors
  2. we have instances of individual contributors to apply custom styling to one or many of those
  3. BUT: we also have the default style shared by all instanced of a component

There is a difference between applying specific styling to a few specific button instances or applying a change to the styling in the shared stylesheet that all buttons might re-use.

This needs to be addressed as well - that's maybe the biggest challenge in the changes requested above.

@alyhxn
Copy link
Author

alyhxn commented Jun 24, 2024

Tasks - 2024.06.25

  • Update - theme_widget_v0.0.3
    • Enabled autosave - 3h
    • Added theme control for all components - 4h
    • Debugging - 1h
    • Recorded worklog - 15min
    • Logged tasks - 5min
    • @output 📦 theme_widget_v0.0.4

Worklog

worklog-219

@serapath
Copy link
Member

serapath commented Jun 24, 2024

feedback 2024.06.24

One thing - please take time to un-intermingle the components that get styled by parents please :-)
That makes things a lot easier for Ibrar as well.

When a component css is changed, great that it shows color in the tree navigation. The dropdown creates (default-v2)
I think we should more stick to the pattern editors use.
They usually indicate it with a default* or some dot in the tab to indicate a file has unsaved changes (that's at least what vscode does) and maybe we should adopt that.

But to be honest, that is probably a UI/UX question, so maybe Ibrar can propose a remake of the theme widget.

I wonder if the "theme widget" itself should be displayed in the tree navigation as well? :-)

Otherwise this looks good, but what is weird now: we lost all the styling options for the instances...

  • this should exist both
    1. the "contributor"
    2. the individual instances too

We should be able to decide (or rather Ibrar) of whether individual instances or all of them receive a styling. I make a proposal at the end of this feedback.

Otherwise, it looks prefect the way it works.

I do think you should maybe reach out to Ibrar and share your fork of the playproject page so he can start playing and applying the new themes already and also he can provide feedback whether he can use it or not and maybe comes up with ideas about what would make things easier :-)


PROPOSAL:
So if you can send/inject styling to a specific component and it goes into the .adoptedStyleSheet array of it.
Then the components could be coded in a way where clicking on any component gives you an array with style sheets and you can visualize it in the theme widget, by clicking on a component in the tree navigation and then you will see one or more editor tabs for each style element in that array of the component and you can maybe add additional ones.

Let's say the first editor tab is the default style element of that component. You then click + and create another editor tab. When you click inject, they get both injected in the order they are listed as tabs (you can re-arrange those tabs), because the order matters when css decided which css rules take preceedence.

Now advanced would be, if we could "re-use" some stylesheet across many different components, e.g. one that only deals with FONTS and we want it to be the same thing everywhere.

There are 3 parts to this:

  1. make that inject work and also let each component share the defaults from all current style elements in it's array
  2. optimize the efficiency of how we achieve this behind the scenes.
  3. Optimize the user interface of the theme editor widget (maybe with Ibrars help)

I think 1 should take a tiny bit priority, so Ibrar can start and then we can optmize the code behind the scenes to make it work more effieciently and take into consideration Ibrars feedback from working with that system.

Regarding 3, it would be cool, to shift- or control-select multiple widgets in the tree and then maybe "group" them and give that name a group. Here we would probably re-use the idea of the "task tree component" (from the task messenger) to expand and see multiple parents of a component, where those would be those "groups"... but it needs additional thinking.


Finally, going back to my initial discord thread,
We should be able to save or store a theme in a folder with css files and then have a json to map it to components, the way i described it on discord, unless you have a comment to improve what i suggested :-) Maybe include that in the next worklog as well?

We do not have an "export" feature yet, to download and save css from localStorage theme to files and we don't have an "import" feature yet, where somebody could upload a bunch of css file themes - those have to be included in the original repository at the moment in order to be displayable and selectable in the theme widget. We might consider an import/export in the following form by representing a filesystem in json:

{
  "css/": {
    "index.json": JSON.stringify({
      "rainbow": "...",
      "electro": "...",
      "fantasy": "...",
    }),
    "rainbow/": {
      // ...
    },
    "electro/": {
      // ...
    },
    "fantasy/": {
      // ...
    },
  }
}

The above would then just represent everything, but for details check my original discord post.

This way we can import and export it to offer users to download their themes and/or upload themes.

Why is it needed?

THAT WAY, Ibrar can play with the theme widget and in the end export his theme files and submit them in a worklog and we can import it and then we can write a command line tool, to take such a json theme file and create the files/folder on disk and add them to the repository and commit it to the actualy repo :-)

@serapath
Copy link
Member

feedback 2024.06.25

Idea

  • Every component is encapsulated in it's own shadow dom.
  • Thus we can write css for them without thinking about the rest of the page when writing css
  • So being able to maybe have a folder ... like e.g. css/ in the repository
    • ...and then inside that folder a css/index.json with an array of names of themes
    • and then css/<theme-name>/... for each theme name
    • and then inside those folders, maybe we could store one file per component we use and theme
      • e.g. css/<theme-name>/button.css
    • And then when the page loads, it will always check for css/index.json
    • and then enable a "theme picker" component to list all possible themes mentioned in the json file
    • And then lookup the selected theme under css/<theme-name>/...
    • and because the app knows all component names it uses ....it could look up those theme files
  • Or each component will know about the <theme-name> it uses
    • and then looks up it's own custom theme file and applies it to itself.
    • It also needs a listener function to notice via communication
    • for when the theme picker selects a different theme, so it can switch

One thing to keep in mind though is the "COMPONENT PATH" ... by which i mean, maybe you have the button component being used in the header and the footer, but the footer/button wants a different theme than the header/button, even though it's technically uses the same button component code. Even if you decide to use a counter to use integers as id's, debugging is easier if we can have a mapping to path names to know what component we are talking about.

So maybe each component has to not just pass the default name or the custom theme picked name, but also, the path towards the root component to know if it is a footer/button or header/button in the component tree which is the app.

Alternatively just having css/<them-name>/<component-name>.css isn't good enough.
Instead we need to take care of css/<them-name>/footer?/<component-name>.css or css/<them-name>/header?/<component-name>.css as well, which makes things complicated.

I am thinking, basically it would be good if the app had an easy way to spit out all the paths of component names/instances in uses, e.g.:

- app
- app/header
- app/header/button
- app/content
- app/footer
- app/footer/button
... and so on

for a theme widget to learn about and then know ALL components in use everywhere and where different components are used.

  • e.g. the button is used in header and footer

A designer could then write a <theme-name>.json files, where he does not define the theme or style, but he can define those component paths and map them to css files for the components, e.g. rainbow.json

{
  "app": "css/rainbow/app.css",
  "app/header": "css/rainbow/header.css",
  "app/header/button": "css/rainbow/btn1.css",
  "app/content": "css/rainbow/content.css",
  "app/footer": "css/rainbow/footer.css",
  "app/footer/button": "css/rainbow/btn2.css",
}

@alyhxn
Copy link
Author

alyhxn commented Jun 28, 2024

Tasks - 2024.06.29

  • Update - theme_widget_v0.0.4
    • Test and trial - 5h
    • Finding the best CSS file structure - 2h
    • Defining the logic - 2h
    • Added tabs to theme_widget - 30min
    • Recorded worklog - 15min
    • Logged tasks - 10min
    • @output 📦 theme_widget_v0.0.5

Worklog

worklog-220


Feedback

The tree mentioned just above this comment is inefficient and complex to implement. I tried and almost built it but things were getting out of hand. Here are the reasons:

  • For simple operations, like accessing a specific CSS file, multiple loops were required everywhere making the code dirty.
  • For project folder, addresses like app/header/button are fine but for JSON extra functions for reading and editing are needed.
  • This approach makes CSS unusable for other components, For instance, app/header/button can never be used by the footer whereas list does not force this.
  • Long CSS file names. For the website, every CSS file needs to have a different name in many cases for which I was forced to use full file address while list is built on unique names or IDs.
  • I want to add a preference of an instance whose address is app/header/button/very/long then I will need to first check along the way if every ancestor is present there, if not then add. I mean it's a very expensive operation.
  • There are countless more drawbacks that almost forced me to give up. Yeah, it looks fancy from far away but it's implementation is a mess. Just like storing the tree of task-messenger into a tree data structure got things complicated, this is a similar case. List is far better.

@serapath
Copy link
Member

serapath commented Jul 5, 2024

feedback 2024.07.05

Alright, maybe it is a misunderstanding.
I'm not sure i understand what you are saying.
I imagine, every component and/or component instance needs a unique ID and can be added to a list. That is ok.
I just think, with every ID, there should be an associated path where that instance sits inside that tree.

Now i think in previous feedback i said there should be an easy way to highlight a component with a red border to make it visible and scroll to it.
THe scroll to it would still be cool, but the highlight would probably just work by actually adding a border: 1px solid red; to the css for an instance, so no need to add extra features for that. It's already possible for a designer to do it.


many shared files
yes, that is needed.
usually, every component has probably one shared file for all it's instances and the option to have a specific extra style sheet per instance.

Now we want the ability for a designer, to select one or more components or component instances to be more specific and create a "shared stylesheet" for them.
Editing that shared style sheet will update ALL the instances.

Now if a style sheet IS shared by many component instances or even multiple sheets are shared, then each comonent instance, just like our "task explorer" needs to be able to expand parent sheets to see a list of "multiple parent sheets" that are all active.

expanding the sheet itself will show all the instances it applies to, regardless of where an instance is otherwise positioned in the tree.

Let's just say, the sheets are similar to "inputs" of a task :-)


Regarding injecting one or many sheets into the component instance, how about:

  1. let's make each sheet shown as a tab visible in the "active instance explorer" too.
  2. distinguish between component instances and sheets similar to how we distinguish between tasks and inputs/outputs
  3. allow a toggle button next to each sheet to inject or not inject it

That way we can get rid of the inject button, but toggle specific sheets on/off
Also other buttons could be action buttons shown based on the specific item in the tree that is selected.

Cypher is currently working on the wireframe of the task messenger, and maybe he can join here to help out with the UI/UX :-)


code

Maybe get rid of the css folder structure for now and create under css/ just theme files light.json, dark.json, rainbow.json, etc... which are mean to be structured in whatever ways you can export from your theme editor widget.

So You need to somehow capture the component instances and all the css sheets that were default or created custom. The default ones should probably be "published" by each individual component by sharing with the theme widget what it's internal default css is.

a theme like light.css can have an object with the pathnames or whatever you need and at some point, it includes the actual css source that can be stored.
maybe just as a simple dictionary, e.g.

// light.json
{
  "app": `
   :host { color: red; }
  `,
  "app/header": `
   :host { color: red; }
  `,
  "app/header/button": `
   :host { color: red; }
  `,
  "app/content": `
   :host { color: red; }
  `,
  "app/footer": `
   :host { color: red; }
  `,
  "app/footer/button": `
   :host { color: red; }
  `,
}

So you make your filesystem that single json file instead of creating files and folders for now. Of course in practice json doesnt support template literals, so it would more look like:

// light.json
{
  "app": "\n   :host { color: red; }\n  ",
  "app/header": "\n   :host { color: red; }\n  ",
  "app/header/button": "\n   :host { color: red; }\n  ",
  "app/content": "\n   :host { color: red; }\n  ",
  "app/footer": "\n   :host { color: red; }\n  ",
  "app/footer/button": "\n   :host { color: red; }\n  ",
}

All in all, let's add the feature to export or download the file, so anyone, e.g. like me, could play with the css and then download the file that contains my customizations.

I can then send it to you via discord and then you can import/upload that file when you have the theme widget open and it will apply my style to your page :-)

@alyhxn
Copy link
Author

alyhxn commented Jul 10, 2024

Tasks - 2024.07.10

  • Update - theme_widget_v0.0.5
    • Added scroll to and highlight on click for components - 1h
    • Added naming system for files - 3h
    • Added import and export functions - 2h
    • Debugging - 4h
    • Logged tasks - 5min
    • Recorded worklog - 30min
    • @output 📦 theme_widget_v0.0.6

Worklog

worklog-221

@alyhxn alyhxn mentioned this issue Jul 26, 2024
32 tasks
@serapath
Copy link
Member

serapath commented Jul 29, 2024

feedback 2024.07.29

Thank you for the worklog 221.
I know my feedback now took some time and things have to moved on since then. Looking forward to the next worklog.

All feedback i could share was shared on discord during the last chaotic month which where i needed to do a lot of business related activities and visit 2 conferences.

In essence, regarding feedback to this worklog:

  • explorer should become a generic graph explorer component
  • all buttons in editor should move into a menu below the explorer (currently wireframed by cypher) :-)
  • all tabs can be shown in explorer and names can be edited in explorer and e.g. unique vs shared just means how many "super" or "sub" entries a css file has, if it has only one, it is unique, if it has more than one, it is shared ...we have to set/edit connections of an explorer entry in terms of how many "super" or "sub" entries it has.

In essence - let's move slower but without errors.
Let's make everything we build stable and reliable - maybe as a separate component or module and then use it to build the next step on top once we are ready.

By splitting the "whole problem" into independent well defined and testable modules we can implement the solution step by step and we avoid regressions.

Features can be kept in github issues so we dont forget them while we work on the more basic re-usable modules we will use to implement the whole graph explorer with all features.


Regarding button placement and stuff, let cypher figure out the UI/UX and how to integrate the functionality :-)

You can share those "problems" with him and let's see what ideas he has.

@alyhxn
Copy link
Author

alyhxn commented Aug 6, 2024

Tasks - 2024.08.07

  • Update - theme_widget_v0.0.6
    • Added and integrated io.js module - 6h
    • Added inputs to graph - 2h
    • Debugging - 2h
    • Logged tasks - 5min
    • Recorded worklog - 10min
    • @output 📦 theme_widget_v0.0.7

Worklog

worklog-225


Feedback

In the worklog, I meant I don't know your ideas about what operations we need to do on theme entries in the graph. I guess we can open the theme file upon clicking and all files inside a theme upon theme entry click.

@alyhxn
Copy link
Author

alyhxn commented Aug 10, 2024

Tasks - 2024.08.11

  • Update - theme_widget_v0.0.7
    • Enabled input click - 2h
    • Change instance click - 1h
    • Divided defaults data - 2h
    • Added statedb to privately get data for each component - 2h
    • Debugging - 1h
    • Logged tasks - 5min
    • Recorded Worklog - 10min
    • @output 📦 theme_widget_v0.0.8

Worklog

worklog-226


Feedback

One point I missed: In data.json, super instances point to their subs using their sid.

@serapath
Copy link
Member

feedback 2024.08.10

Feedback as discussed on discord this time :-)

@alyhxn
Copy link
Author

alyhxn commented Aug 13, 2024

Tasks - 2024.08.13

  • Update - theme_widget_v0.0.8
    • Update STATE.js - 2h
    • Updated components dependent on STATE.js - 2h
    • Implemented add operation for instances - 3h
    • Added extensions to file names - 1h
    • Debugging - 2h
    • Logged tasks - 5min
    • Recorded Worklog - 15min
    • @output 📦 theme_widget_v0.0.9

Worklog

worklog-227

@serapath
Copy link
Member

feedback 2024.08.13

Small request - you used the transparency slider at minute 3:41, which made me realise, the default transparency should probably be set to ~75% to make the transparency a bit more noticable imho :-)


Nina
Here you clicked "Nina" and it shows the json in the editor.
I do think, clicking on "Nina" (or any instance should not show anything.
Instead, we have "inputs" which we can expand.

It is unfinished, but this wireframe here:
cypher
Shows the "topnav component" with expanded "inputs"


     _`css:`
    | |  _Light:Page/Projects/Topnav
    | | |_Night:Page/Projects/Topnav
    | | |
    | |_ header.css
    | |_ 1.css
  -- topnav

and extend it to look like this:

     _`opts:`
    | |
    | |_nina.json
    |
    |_`css:`
    | |  _Light:Page/Projects/Topnav
    | | |_Night:Page/Projects/Topnav
    | | |
    | |_ header.css
    | |_ 1.css
  -- topnav

And then you click "nina.json" to see what you currently see when you click the component instance.


Next, when you click "new"
new
You do that on "nina" instance.
But if you actually wanted to create a new project or contributor, i would assume you should click on our_contributor in the graph explorer and then use the "new" action, to create a new sub entry and then paste in the json you prepared.

In our graph explorer, we dont just have "sub entries" like in file explorers, but we can also create new "super entries" and we can create those "input/output" entries as well, so i guess the action needs to specify what type of "new" we are going to create :-)

Regarding the JSON as such - later we can think about a data verification logic and a visual form maybe generated from a defined data type - but in the current step, the raw json is probably fine and we just should make sure it is well formed :-)

Otherwise, great job - and of course, we should also now have a "delete" action.
We already have the change action by changing the json, but if we can add contributors (which is great) we should also be able to remove them :-)


shared
Reagarding "unique" vs "shared".

I tried to give feedback earlier.
It's not just:

  • apply to Nina only
  • vs. apply to all contributors

It's also:

  • apply to all designers
  • apply to all senior designers
  • etc...

Or even:

  • apply to all senior developers AND all project instances

The grouping is arbitrary and decided by the designer.
The idea is to shift/ctrl select or ..by clicking select checkboxes for multiple instances across the entire graph explorer and then adding a new or linking an existing CSS FILE to those.

From then on, that new or existing CSS FILE, will show up as an input for ALL of those in the selection. It is then shared by all of them.

This behavior is a bit tedious or impossible to model with the current unique/shared dropdown.


Regarding COMPLETE RE-ARRANGING :-)
You mention the theme widget cant re-arrange everything.
That is fine.
It is not meant to change the HTML or the Javascript and basic structure.
All that is possible is to provide new data input (e.g. arguments passed to instances)
And changing, removing existing, and adding new CSS files to them as well.

It's up to the designer to see what they can pull off using that.
The "css zen garden project" showcased a long time ago then more is possible than what one might assume, but if there are certain limitations, that is fine. No worries :-)

At the end, what can be changed depends on what the json data input to a component allows.
Maybe it allows to select an island type, maybe it doesnt. We don't care for now.
This is more about the type of components we build and use in a website than about the theme widgget. If we can provide different css and json as input, that is good enough for now.


One last thing - when we have the real data shell in the future, the "theme widget" will or might also show the javascript source files used by the different modules we require inside the app and then we can start changing those as well, but for now that is OUT OF SCOPE.

@alyhxn
Copy link
Author

alyhxn commented Aug 16, 2024

Tasks - 2024.08.16

  • Update - theme_widget_v0.0.9
    • Added json entry to graph - 3h
    • Merged uniq and shared to just CSS - 2h
    • Debugging - 1h
    • Logged tasks - 5min
    • @output 📦 theme_widget_v0.0.10

Feedback

  • Nothing much to explain. I just wanted to say that the add new file button is implemented but will be finalized when its position is decided, I mean the position of all buttons. There are small changes to STATE.js, I am gonna send in discord :)

@serapath
Copy link
Member

feedback 2024.08.17

I noticed a few bugs in the theme widget.
First - at least icons should be disabled (maybe grayed out) if there are no super or sub entries. Many entries have this issue, including the entire dark theme as well. There arent any entries.

contributors collapsed

vs.

contributors expanded

as you can see there is a weirdly formatted themes entry that appears between our_contributors and footer and it has no inputs, no outputs and no sub entries and the super entry is "our_contributors" ....strange.

contributors
Also, all contributors are named contributors and they all have contributor.json, contributor.css and contributor_1.css
This is not ideal.
Maybe we can brainstorm what should happen and how.

css files
Also, clicking the css files in the theme section shows nothing and they have no sub entries and no inputs/outputs.
Also not ideal :-)
Maybe let's take a look at the following, which is the latest state of the wireframing with cypher (also posted that on discord):

📚➖[✨]◀🌐playproject.io
  │  └🔃reset
  ├📁📌▶pins/
  │┌🌐playproject.io🔗
  ├📂📂▶📗themes
  │  ├📁📁▶🎨rainbow.json
  │  ├📁📁▶🎨fantasy.json
  │  ├📁📁▶🎨electro.json
  │  ├📁📁▶🎨light.json
  │  │┌📗themes🔗
  │  └📂📂▶🎨night.json📍
  │     ├🗄️🖇page
  │     ├🗄️🖇page/header
  │     ├🗄️🖇page/header/menu
  │     ├🗄️🖇page/projects
  │     ├🗃️🖇page/projects/datdot
  │     ││┌🗄️night.json:page/projects/datdot🔗
  │     ││├🗄️light.json:page/projects/datdot🔗
  │     │├📂▶🖼️header.css
  │     │└📁▶🖼️1
  │     ├🗄️🖇page/footer
  │     └🗄️🖇page/footer/socials
  │┌➕➕▶🇹app
  ││    ┌🗃️css
  └➖➖[📥🪄]◀🧩page
     │       👇
     ├➕➕[📦✨]◀🧩theme_widget
     │       ├📝rename
     │       ├🕳️unlink
     │       ├📌link[➕➕📦📦🆕]        // link as: [➕super/➕sub/📦input/📦output/🆕new]
     │       ├🖨️copy[➕➕📦📦🆕]        // copy to: [➕super/➕sub/📦input/📦output/🆕new]
     │       └❌delete
     ├➕➕▶🧩topnav
     ├➕➕▶🧩header
     ├➕➖▶🧩projects
     │  │┌➕➕▶🇹itemcard
     │  │├▶🧩projects🔗
     │  ││  ┌🗃️css
     │  ││  ││┌🗄️night.json:page/projects/datdot
     │  ││  ││├🗄️light.json:page/projects/datdot
     │  ││  │├📂▶🖼️header.css🔗
     │  ││  │└📂▶🖼️1🔗
     │  ││  ├🗄️data
     │  ├➖[📥🪄]◀🧩datdot
     │  ├➕▶🧩played
     │  ├➕▶🧩smartcontract_codes
     │  ├➕▶🧩wizardamigos
     │  ├➕▶🧩dat_ecosystem
     │  └➕▶🧩data_shell
     ├➕➕▶🧩supporters
     │┌🧩page🔗
     ├➖➖▶🧩our_contributors
     │  │┌➕➕▶🇹itemcard
     │  ├➖▶🧩Nina
     │  ├➕▶🧩Serapath
     │  ├➕▶🧩Jam
     │  ├➕▶🧩Mauve
     │  ├➕▶🧩Fiona
     │  ├➕▶🧩Toshi
     │  ├➕▶🧩Ailin
     │  ├➕▶🧩Kayla
     │  ├➕▶🧩Tommings
     │  ├➕▶🧩Santies
     │  ├➕▶🧩Pepe
     │  ├➕▶🧩Jannis
     │  ├➕▶🧩Nora
     │  ├➕▶🧩Mimi
     │  ├➕▶🧩Helenphina
     │  ├➕▶🧩ali
     │  ├➕▶🧩Ibrar
     │  └➕▶🧩Cypher
     └➕➕▶🧩footer

Not saying this is the final version, but one important bit is "themeability", so e.g. whether there are additional lines between icons or not should be themable.

I think one thing that could help here are the css selctors:
::before and ::after and the css property content: "...";
That way it should be possible to insert additional images ot unicode characters between icons, etc...

@alyhxn
Copy link
Author

alyhxn commented Aug 19, 2024

Tasks - 2024.08.20

  • Update - theme_widget_v0.0.10
    • Simplified graph_explorer - 4h
    • Changes in other files accordingly - 30min
    • Debugging - 2h
    • Logged tasks - 5min
    • Recorded Worklog - 25min
    • @output 📦 theme_widget_v0.0.11

Worklog

worklog-228
worklog-228.2

@serapath
Copy link
Member

serapath commented Aug 20, 2024

feedback 2024.08.20

200 lines of code reduction sounds great :)

I saw you often do e.g. data.sub && data.sub.length els.push
This can be shortened to data?.sub?.length && els.push
But i do think in those cases it is more readable to do:

if (data?.sub?.length) els.push(...)
//instead of
data?.sub?.length && els.push(...)

They are almost the same, but the former is so much easier to read. The && technique requires a bit more in-depth understanding of how the language works.


bug
Some connecting lines between "theme_editor" and "graph_explorer" seem to be missing.

theme
These icons defined as params are great, but i wonder if they could be defined in CSS instead. That would be great.
There are css properties:

.icon {
  --hub-off: 📫
  /* ... */
}

and css allows to generate virtual dom elements using ::before and ::after css selectors and there is also the content property.

.icon::before {
  content: "📫"
}

Not saying exactly how and what, but maybe a designer could help here. ... but maybe we can do a round of refactoring later and keep the icons for now the way you did them.

What I am missing is a theme.json file, which is mapping which component will use which css files :-)
That theme.json should be generated by the component or the app being run the first time without any external theme or css files being provided, so the app running for the first time generates and initializes all these files with the built in default css values...

In the previous worklog you can see some of the emojis used for different types of entries, e.g. themes, css files, components, etc...

i do understand the issue of copy to clipboard:
We want to strictly separate user data (e.g. project tasks data or component parameter) from app related css/styling data.
There are ways to fix that.

const style = document.createElement('style')
style.textContent = `
  h3::after {
    content: " rocks!";
  }
`
const h3 = document.createElement('h3')
document.body.append(style, h3)


document.addEventListener('copy', handleClipboard)

function handleClipboard (e) {
  const selection = window.getSelection().toString()
  const { content } = getComputedStyle(h3, ":after")
  console.log("the generated content is: ", content)
  const newClipboard = `${content} ${selection}`
  e.clipboardData.setData('text/plain', newClipboard)
  e.preventDefault()
}

The code above might not yet solve everything, but you can interact and intercept clipboard activity and you can read the css before/after content properties and adjust/adapt/change any specific clipboard content before it copies, so this is solvable.


Thanks for talking about the data a clicked entry sends to the super component. That is helpful.

I do think the main work outputs of our project in general are:

  1. a working theme widget :-)
  2. standards for the json sent and stored in the database

cypher works on UX details and we brainstorm features and slowly make (1.) work. But we will need to refactor many times to slowly optimize (2.) as well and then document those standards in the README. I dont have an opinion yet whether { comp, css, hub, id, inputs, name, sub, type } is a good structure, but good that we have it.

Maybe we should start by adding a doc/ folder to the repository with .md files so we can slowly start capturing those "standards" when we feel good about them - if you think they are still subject to change, then lets not do it yet though. We can also delay it until we re-use the graph explorer in the task messenger.


database

  1. graph data
  2. state data
  3. theme files
  4. meta data

Thats great.
Before we write down any specifications for those, we can just make sure to add enough comments, possibly with examples, to the source code, so we know exactly how each database is supposed to look.

Is the data sent to a super entry when you click a sub entry the "meta data" ? ...how does that tie in? how would you call that data?

Also - if not too much work, a short doc/README.md file with a rough example of how each of those data structure (1-4) looks like might help.


themes bug

how could it happen that a themes component id was occupied.
If we reset the database and it then reads from the database the id's and we always generate unique id's it should never happen. so hopefully just a bug but not an architectural flaw :-) i imagine in theory this shouldnt happen.


entries
Thanks for explaining that again.
So const { hub, sub, inputs, outputs } = data are the links. I imagine all of them to contain arrays of numbers which represent unique id's or maybe even Symbol(number) to represent unique sid's.

Having an id or sid in any of those arrays means there is a LINK between the current entry and the entry behind that id or sid contained in the array of sub/hub/inputs/outputs.

Of course, the corresponding e.g. sub entry would have the id or sid of the parent entry inside of their array as well.

deleting a link means removing an id in both arrays.
adding a link means adding a new id into both arrays.

example
This makes sense.
So there is no "output" link, so no output icon.
There are links to super, sub and input entries.

What is confusing is, that you call the super node of "theme_widget" a entry of type "link" ...

That is confusing, because in my mind i am calling the connecting lines in the graph explorer links and they are represented in the data by id's or rather sid's in arrays, e.g. entry.sub = [...], entry.hub = [...], entry.inputs = [...], entry.outputs = [...]
The "label" of those might be different from app to app. The theme widget might have different names for those than the task messenger, so maybe we should store them under
entry.link[label] = [...], where label can be e.g. "sub", "hub", "inputs" or "outputs", or whatever is defined when one creates an instance of the graph explorer or maybe even an instance of specific "graph explorer entries".

Maybe what you call a link entry (e.g. index↗️) should be called a reference entry, just so we dont confuse this with "links", which i would reserve not for entries but for the connecting and expandable/collapsable lines between entries, represented in the data structure as id's stored in arrays as described above if that makes sense.

💯 cool that clicking those will jump to the original entry.
I'm not sure how great the UX of that is compared to opening a specific part of the graph multiple times. we'll have to see when we start using it. for now that's how it is. seems fine.


problem theme_widget.json

So here is the thing.
I tried to say it above.
If the app runs for the first time and the database is empty, the app will use it's default values hard coded inside of components or paramters etc... to populate the database, so this generates a default theme with css files per component with the default values and the same goes for the json files like theme_widget.json, which gets stored in the database to load from it again on page reload.

So we might want to have another entry in the graph explorer, next to themes/ and we could maybe call it data/ and we store all the json files that get generated in that folder and link to them.


228.2

So there should only be one type of node, an entry and that is it.
There should not be "nodes" of types...
There should only be "entries" of types...
Lets not use "node" in the graph explorer, for now, because we or at least i am using "node" in the context of message sending via the io module. ...but an entry like a "theme" or "json file" or "css file" is not running live to recieve/send messages, thus only "component instance" entries are also happen to be nodes.

If we use "nodes" it is hard to know - are we talking about the graph explorer or about io module communication.
We need a glossary in doc/GLOSSARY.md :-)

But there can be "component instance entries"
And there can be "input entries" or "css file" entries, etc... all kinds of types of entries.

Links are only the lines that connect things.
Each entry type can be slightly different, different icons, different types of links.

Some entries might not have any inputs/outputs at all.

But let's call them all "entry" and never "node".
Lets also not call any type of entry a "link enty".
Lets reserve "link" for the lines or connections or relations between entries ... the lines.

e.g.
two entries with a super/sub relation have a "link".
if an component instance entry has an css file entry as input, that is a link between the component instance and the css file ... the type of link is "input".

So entries have types.
Links or relations have types (we call them links)

I would strongly assume, that the an entry of type component instance is what we could call a "node" in the future, but entries could be all kinds of things, e.g. "css files", which is not a "node", because a "node" is something that has live running code associated with it and it can send/receive messages ...so not every "entry" is a "node".

slots:
Basically, e.g. two entries, can have a link between each other, each link is connected to a slot.

The "component instance" type of entry has an "input slot"
The "css file" type of entry has a "??? slot".
There can be a link between those two entries by connecting the slots. This is done in code or in data by adding a component_instance_entry.input.push(css_file_id)
and
css_file[???].push(component_instance_id)

If that makes sense.

Unlinking just has to remove the id from the slots.
At the moment all links are bi-directional in the graph.

If we later decide to connect one entry to another but not in both ways, that is a unidirectional link (or "edge" in graph theory).

If we start creating doc/README.md to document some basic data structures with good examples, we should also have a little glossary of the words we are using.

If you feel like creating a first very minimal iteration on that, that would help as well to really sync our vocabulary of how we speak about this stuff :-)


reference entries

just as described above.
I do think for UX reasons my preferred way would be to

  1. have every entry be a normal entry, so if you expaned some super entries you might end up displaying a specific entry more than once in the currently expanded graph explorer
  2. but because that can be confusing and might make you expand things in circles, we should probably indicate with a color that a specific currently selected entry is already expanded elsewhere in the graph explorer
  3. we could have a "jump" button next to such entries that allow you to click to jump to the next instance of that particular entry elsewhere in the graph explorer
  4. if you click that "jump" button multiple times on each expanded copy of a specific entry you can jump in circles ...which means you can come back to those entries.

For example, if i have a specific css file expanded 10 times in the graph explorer, then i can cycle between those 10 different spots in the graph explorer which display the same css file, but if i now collapse one of them, ...how would i know continue to jump to the NEXT instance of that css file?

So maybe the "jump" button cant be just next to the entry that is open multiple times?

@alyhxn
Copy link
Author

alyhxn commented Aug 22, 2024

Tasks - 2024.08.23

  • Update - theme_widget_v0.0.11
    • Fixed links between entries - 4h
    • Transferred emojis to CSS - 1h
    • Implemented before and after copy - 2h
    • Debugging - 2h
    • Added data folder in the graph - 30min
    • Added README.md and GLOSSARY.md in doc - 30min
    • Logged tasks - 5min
    • Recorded Worklog - 10min
    • @output 📦 theme_widget_v0.0.12

Worklog

worklog-229

@serapath
Copy link
Member

feedback 2024.08.24

this time provided on discord :-)

@alyhxn
Copy link
Author

alyhxn commented Aug 29, 2024

Tasks - 2024.08.30

  • Update - theme_widget_v0.0.12
    • Added type emojis and menu - 1h
    • Styling and emoji on/off logic - 1h
    • Implemented dynamic spacing - 4h
    • Debugging - 30min
    • Logged tasks - 5min
    • Recorded Worklog - 25min
    • @output 📦 theme_widget_v0.0.13

Worklog

Worklog-230

@serapath
Copy link
Member

feedback 2024.08.30

feedback on discord :-)

This was referenced Oct 11, 2024
@alyhxn
Copy link
Author

alyhxn commented Oct 23, 2024

Task - 2024.10.18

  • Update - theme_widget_v0.0.13
    • Show state on alive data click - 1h
    • Add source files - 2h
    • Logged tasks - 5min
    • @output 📦 theme_widget_v0.0.14

Worklog

worklog-238

@serapath
Copy link
Member

feedback 2024.10.23
Sadly the worklog video does not show and explain those changes. Would be cool if in the future, for every update, there would be a small section in the worklog video that walks me through :-)

Maybe in the future - write all worklog comments first - and then use the finished tasks and descriptions as a "table of content" about what to record in the worklog video to not forget stuff :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants