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

[js/html] Custom HTMLElement design unification #10

Open
GuillaumeDua opened this issue Nov 9, 2022 · 0 comments
Open

[js/html] Custom HTMLElement design unification #10

GuillaumeDua opened this issue Nov 9, 2022 · 0 comments
Labels
dev: refactoring enhancement New feature or request

Comments

@GuillaumeDua
Copy link
Owner

GuillaumeDua commented Nov 9, 2022

Context

Rather than having 3 components (BasicCodeSection, CodeSection, RemoteCodeSection),
we could - at user-level - offer a unique interface CodeSection with a strategy attribute.

Expected behavior

<code-section strategy="basic">
// some code here, no metadatas parsing ...
</code-section>

<code-section>
// implicitly, default strategy is "local"
// metadatas parsing
</code-section>

<code-section strategy="remote" url="url/to/the/code/example">
</code-section>

Internal details

code-section becomes a placeholder for underlying technical components :

  • BasicCodeSection
  • LocalCodeSection
  • RemoteCodeSection

It provides only some basic html-element parsing, then :

  • Design option 1 : Is replaced by the underlying one ?
  • Design option 2 : Is empty and spawn a child-elements which is the underlying one ?

Additional considerations

  • We might wanna keep the components named in the previous section still accessible on the user-side for explicit usage purpose

  • Design option 2 allow dynamic component replacement.

    <code-section strategy="basic" id='some-id'>
    </code-section>
    let element = document.getElementById('some_id')
    element.setAttribute('strategy', 'local')
@GuillaumeDua GuillaumeDua added enhancement New feature or request dev: refactoring labels Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev: refactoring enhancement New feature or request
Projects
Status: Pending (requires evaluation)
Development

No branches or pull requests

1 participant