0.0.122 • Published 4 months ago

@robertakarobin/web v0.0.122

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

Web

Goals

  • Valid typing
  • Valid HTML
  • No custom template syntax
  • No custom CSS syntax
  • Automates the boring stuff with CSS
  • Produces static HTML/CSS files for SSG
  • Adds interactivity with JS to static HTML files, without needing to rerender
  • Produces interactive sites for CSR
  • Blends seamlessly from static files to CSR
  • Autocompletes routes
  • Markdown support

Notes

  • The build script copies the contents of src to a tmp folder so that it can transpile <markdown> tags before the TS is compiled. Without this step the Markdown would need to be compiled in the browser. However, if your tsconfig.json has path aliases for src then it'll keep the Markdown from getting transpiled correctly. To resolve, point your alias to tmp as well as src, e.g. paths: { "@src/*": ["tmp/*", "src/*"]}
  • Have to include tmp in the tsconfig includes for until TSX fixes an issue with decorators: https://github.com/evanw/esbuild/issues/3496
  • Using [on] attributes
      • Easier to debug in HTML
      • Don't need to place event listeners
      • Will error if page doesn't have JS
      • Verbose
      • Not best practice
  • Using JS expressions instead of HTML tags
      • Can set private properties inline
      • Has typing out of the box
      • Don't have to manually import
      • Will always call constructor and/or chained functions
      • Extra step: have to translate to comment
  • Router outlet
    • Page extends RouterOutlet
        • Rebuilds page on every route
    • Argument to Resolver
        • Resolver is just to map routes to views; shouldn't actually do anything
    • Renderer
        • Importing would import/cache everthing else?
  • Rerendering
    • toString
      • returns comment with ID
        • On first render
          • If comment with ID
            • Replace comment with cached component
        • On rerender
          • If element with ID
            • If Component
              • Replace attributes
              • cachedComponent.render()
            • If not component
              • Replace attributes
              • Replace children with updatedComponent.childNodes
      • renders and returns outerHTML
          • Requires rendering the template twice, which would instantiate double the components
      • returns outerHTML
        • On new component, has no content
        • On existing component, has outdated content
        • Then render template

Existing frameworks

  • Lit
    • Have to extend HTMLElement
    • HTML tagged templates are a little annoying
    • Have to use shadow DOM for lit-ssr
    • Have to render first before can rerender
  • Svelte
    • Magic syntax, e.g. $ state prefixes
    • Don't care for route structure
  • Preact
    • Clunky state management
  • lwc
    • Limited Typescript support
  • Marko
    • Weird custom syntax
  • Riot.js
    • Old and not actively maintained?
  • Stencil

TODO

  • Don't use [on] attributes?
  • isHydrated

  • CSS class mapping

  • Declare CSS variables inline
  • Import from other file (ergo SVG)

  • Match routes with params

  • Remove CSS from JS bundles
  • Image preprocessing

  • Autocomplete CSS classes

  • VS plugin for CSS
  • VS plugin for HTML

Done:

  • onEl => onConstruct
  • Extract out link component
  • Make Emitter subscriptions strong by default
  • Make Component.instances weak
  • Extract util/index.ts to separate files, for code splitting
  • Add isHydrated option
  • Don't require script
  • Bust CSS cache
  • Add minify as build option
  • Template/CSS prefix
  • .bind works on emitters too
  • Use constructor to create or get existing instance
  • Components emit events
  • Show [data-component] on build?
  • Jump anchors
  • Base URI
  • Add route helper
  • Don't use Component.push in <script>
  • Set absolute path for imports
  • Extract window. boilerplate to beginning of layout
  • Automatically set HTML attributes
  • Differentiate between weak/strong subscriptions
  • Add config with HTML/CSS validator/formatter
  • Fix Windows paths
  • toFunction should return the instance
  • Component content shouldn't be duplicated
  • Bug: Instances not binding to elements on rerender
  • bind without needing page referesh
  • Route names for HTML IDs
  • Fix route() names not bring strongly typed
  • CSS to external
  • Vendor doesn't need own bundle
  • CSS breakpoints
  • Declare CSS variables inline
  • Get CSS variable names inline
  • Support nested tokens
  • Bundle all components/pages together
  • Markdown support
  • Include CSS on fallback pages

Notes

  • Components need a UID so that SSG pages have a way of differentiating between instances
    • ...unless every instance is a new one?
0.0.117

4 months ago

0.0.119

4 months ago

0.0.118

4 months ago

0.0.120

4 months ago

0.0.122

4 months ago

0.0.121

4 months ago

0.0.109

4 months ago

0.0.116

4 months ago

0.0.115

4 months ago

0.0.114

4 months ago

0.0.113

4 months ago

0.0.112

4 months ago

0.0.111

4 months ago

0.0.110

4 months ago

0.0.106

4 months ago

0.0.108

4 months ago

0.0.107

4 months ago

0.0.105

4 months ago

0.0.104

4 months ago

0.0.103

4 months ago

0.0.98

4 months ago

0.0.99

4 months ago

0.0.102

4 months ago

0.0.101

4 months ago

0.0.100

4 months ago

0.0.95

4 months ago

0.0.96

4 months ago

0.0.97

4 months ago

0.0.92

4 months ago

0.0.93

4 months ago

0.0.94

4 months ago

0.0.89

4 months ago

0.0.90

4 months ago

0.0.91

4 months ago

0.0.88

5 months ago

0.0.84

5 months ago

0.0.85

5 months ago

0.0.86

5 months ago

0.0.87

5 months ago

0.0.80

5 months ago

0.0.81

5 months ago

0.0.82

5 months ago

0.0.83

5 months ago

0.0.74

5 months ago

0.0.75

5 months ago

0.0.76

5 months ago

0.0.77

5 months ago

0.0.78

5 months ago

0.0.79

5 months ago

0.0.73

5 months ago

0.0.72

5 months ago

0.0.70

5 months ago

0.0.71

5 months ago

0.0.65

5 months ago

0.0.66

5 months ago

0.0.67

5 months ago

0.0.68

5 months ago

0.0.69

5 months ago

0.0.62

5 months ago

0.0.63

5 months ago

0.0.64

5 months ago

0.0.60

5 months ago

0.0.61

5 months ago

0.0.59

5 months ago

0.0.51

5 months ago

0.0.52

5 months ago

0.0.53

5 months ago

0.0.54

5 months ago

0.0.55

5 months ago

0.0.56

5 months ago

0.0.57

5 months ago

0.0.58

5 months ago

0.0.50

5 months ago

0.0.46

5 months ago

0.0.47

5 months ago

0.0.48

5 months ago

0.0.49

5 months ago

0.0.41

5 months ago

0.0.42

5 months ago

0.0.43

5 months ago

0.0.44

5 months ago

0.0.45

5 months ago

0.0.40

5 months ago

0.0.28

5 months ago

0.0.26

5 months ago

0.0.25

5 months ago

0.0.24

5 months ago

0.0.23

6 months ago

0.0.22

6 months ago

0.0.21

6 months ago

0.0.20

6 months ago

0.0.19

6 months ago

0.0.18

6 months ago

0.0.17

6 months ago

0.0.16

6 months ago

0.0.15

6 months ago

0.0.14

6 months ago

0.0.13

6 months ago

0.0.12

6 months ago

0.0.11

6 months ago

0.0.10

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

7 months ago