@charmland/gem 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/LICENSE +177 -0
  2. package/NOTICE +13 -0
  3. package/README.md +24 -2
  4. package/assets/fonts/Hypography-Italic.woff2 +0 -0
  5. package/assets/fonts/Hypography-Regular.woff2 +0 -0
  6. package/assets/fonts/PPFraktionMono-Variable.ttf +0 -0
  7. package/assets/fonts/PPFraktionMonoItalic-Variable.ttf +0 -0
  8. package/assets/fonts/PPFraktionSans-Variable.ttf +0 -0
  9. package/assets/fonts/PPFraktionSansItalic-Variable.ttf +0 -0
  10. package/bin/gem-elm.js +3 -0
  11. package/dist/browser/boot.d.ts +10 -0
  12. package/dist/browser/boot.js +14 -0
  13. package/dist/browser/color-scheme.d.ts +9 -0
  14. package/dist/browser/color-scheme.js +76 -0
  15. package/dist/browser/ports.d.ts +37 -0
  16. package/dist/browser/ports.js +90 -0
  17. package/dist/browser/router.d.ts +5 -0
  18. package/dist/browser/router.js +35 -0
  19. package/dist/browser/runtime.d.ts +12 -0
  20. package/dist/browser/runtime.js +22 -0
  21. package/dist/browser/tabs.d.ts +9 -0
  22. package/dist/browser/tabs.js +69 -0
  23. package/dist/default/theme.css +4664 -0
  24. package/dist/default/theme.js +13652 -0
  25. package/dist/node/build.d.ts +16 -0
  26. package/dist/node/build.js +48 -0
  27. package/dist/node/cli.d.ts +2 -0
  28. package/dist/node/cli.js +21 -0
  29. package/elm.json +28 -0
  30. package/package.json +86 -4
  31. package/src/app/Gem/App.elm +1275 -0
  32. package/src/app/Gem/CharmSticker.elm +35 -0
  33. package/src/app/Gem/Components.elm +292 -0
  34. package/src/app/Gem/Main.elm +17 -0
  35. package/src/app/Gem/Ports.elm +32 -0
  36. package/src/app/Gem/Shell.elm +964 -0
  37. package/src/browser/theme.d.ts +1 -0
  38. package/src/core/Gem/Node.elm +219 -0
  39. package/src/core/Gem/Page.elm +409 -0
  40. package/src/core/Gem/Render.elm +472 -0
  41. package/src/core/Gem/Slots.elm +11 -0
  42. package/src/styles/docs.scss +1083 -0
  43. package/src/styles/fonts.scss +51 -0
  44. package/src/styles/gem.scss +362 -0
  45. package/src/styles/theme.scss +8 -0
  46. package/src/styles/ui/burger.scss +272 -0
  47. package/src/styles/ui/button.scss +350 -0
  48. package/src/styles/ui/charmtone.scss +70 -0
  49. package/src/styles/ui/controls-extra.scss +316 -0
  50. package/src/styles/ui/controls.scss +110 -0
  51. package/src/styles/ui/display.scss +359 -0
  52. package/src/styles/ui/dropdown.scss +341 -0
  53. package/src/styles/ui/form.scss +314 -0
  54. package/src/styles/ui/menu.scss +200 -0
  55. package/src/styles/ui/meter.scss +124 -0
  56. package/src/styles/ui/modal.scss +545 -0
  57. package/src/styles/ui/oauth.scss +50 -0
  58. package/src/styles/ui/page-nav.scss +63 -0
  59. package/src/styles/ui/reset.scss +111 -0
  60. package/src/styles/ui/scrollbar.scss +39 -0
  61. package/src/styles/ui/search.scss +164 -0
  62. package/src/styles/ui/sidebar.scss +229 -0
  63. package/src/styles/ui/squircle.scss +60 -0
  64. package/src/styles/ui/table.scss +97 -0
  65. package/src/styles/ui/theme.scss +132 -0
  66. package/src/styles/ui/toast.scss +587 -0
  67. package/src/styles/ui/toc.scss +128 -0
  68. package/src/styles/ui/typography.scss +21 -0
  69. package/src/styles/ui/ui.scss +33 -0
  70. package/src/ui/Ui/Badge.elm +51 -0
  71. package/src/ui/Ui/Banner.elm +97 -0
  72. package/src/ui/Ui/Burger.elm +259 -0
  73. package/src/ui/Ui/Button.elm +261 -0
  74. package/src/ui/Ui/Card.elm +32 -0
  75. package/src/ui/Ui/Cards.elm +15 -0
  76. package/src/ui/Ui/ChoiceGroup.elm +62 -0
  77. package/src/ui/Ui/CopyButton.elm +139 -0
  78. package/src/ui/Ui/Divider.elm +16 -0
  79. package/src/ui/Ui/Dropdown.elm +600 -0
  80. package/src/ui/Ui/Empty.elm +41 -0
  81. package/src/ui/Ui/ErrorBubble.elm +34 -0
  82. package/src/ui/Ui/Field.elm +45 -0
  83. package/src/ui/Ui/FormStatus.elm +32 -0
  84. package/src/ui/Ui/Icon.elm +381 -0
  85. package/src/ui/Ui/InlineForm.elm +51 -0
  86. package/src/ui/Ui/Input.elm +113 -0
  87. package/src/ui/Ui/KeyValue.elm +25 -0
  88. package/src/ui/Ui/ListRow.elm +67 -0
  89. package/src/ui/Ui/Loader.elm +32 -0
  90. package/src/ui/Ui/Logo/Charm.elm +21 -0
  91. package/src/ui/Ui/Logo/CharmMark.elm +32 -0
  92. package/src/ui/Ui/Logo/CharmSticker.elm +35 -0
  93. package/src/ui/Ui/Logo/Discord.elm +26 -0
  94. package/src/ui/Ui/Logo/GitHub.elm +21 -0
  95. package/src/ui/Ui/Logo/Google.elm +21 -0
  96. package/src/ui/Ui/Logo/Hexy.elm +29 -0
  97. package/src/ui/Ui/Logo/Hyper.elm +42 -0
  98. package/src/ui/Ui/Logo/Integration.elm +117 -0
  99. package/src/ui/Ui/Logo/Prism.elm +35 -0
  100. package/src/ui/Ui/Logos.elm +115 -0
  101. package/src/ui/Ui/Menu.elm +348 -0
  102. package/src/ui/Ui/Meter.elm +132 -0
  103. package/src/ui/Ui/Modal.elm +247 -0
  104. package/src/ui/Ui/Motion.elm +32 -0
  105. package/src/ui/Ui/NumberBox.elm +86 -0
  106. package/src/ui/Ui/OAuthButton.elm +39 -0
  107. package/src/ui/Ui/PageNav.elm +65 -0
  108. package/src/ui/Ui/Pager.elm +49 -0
  109. package/src/ui/Ui/Search.elm +396 -0
  110. package/src/ui/Ui/SearchBox.elm +78 -0
  111. package/src/ui/Ui/Section.elm +21 -0
  112. package/src/ui/Ui/Sidebar.elm +239 -0
  113. package/src/ui/Ui/Stat.elm +29 -0
  114. package/src/ui/Ui/Switch.elm +34 -0
  115. package/src/ui/Ui/Table.elm +89 -0
  116. package/src/ui/Ui/Tabs.elm +280 -0
  117. package/src/ui/Ui/ToC.elm +120 -0
  118. package/src/ui/Ui/Toast.elm +1145 -0
  119. package/src/ui/Ui/Toolbar.elm +31 -0
  120. package/src/ui/Ui/TwoStepConfirm.elm +159 -0
  121. package/src/ui/Ui/Typography.elm +33 -0
@@ -0,0 +1,120 @@
1
+ module Ui.ToC exposing (Item(..), view)
2
+
3
+ {-| The table of contents: a quiet anchor rail with a flat hairline,
4
+ the blush edge marking the section in view. Nested entries indent
5
+ under their parent — same rail, no curves.
6
+ -}
7
+
8
+ import Html exposing (Attribute, Html, nav, span, text)
9
+ import Html.Attributes
10
+ import Html.Events
11
+ import Ui.Icon
12
+
13
+
14
+ {-| One entry: the label shown, the anchor it links to, and any
15
+ nested sub-entries. A custom type because the nesting is recursive
16
+ (type aliases can't recurse).
17
+ -}
18
+ type Item
19
+ = Item
20
+ { label : String
21
+ , href : String
22
+ , children : List Item
23
+ }
24
+
25
+
26
+ itemsView : Maybe String -> List Item -> Html msg
27
+ itemsView active items =
28
+ Html.ul []
29
+ (List.map
30
+ (\(Item item) ->
31
+ Html.li
32
+ [ Html.Attributes.classList
33
+ [ ( "active", active == Just item.href ) ]
34
+ ]
35
+ ([ Html.a [ Html.Attributes.href item.href ] [ text item.label ] ]
36
+ ++ (if List.isEmpty item.children then
37
+ []
38
+
39
+ else
40
+ [ itemsView active item.children ]
41
+ )
42
+ )
43
+ )
44
+ items
45
+ )
46
+
47
+
48
+ {-| Render the table of contents. `active` is the href of the
49
+ current section (or nothing).
50
+
51
+ `disclosure` folds the list behind its title: a `Just` turns the
52
+ title into a toggle button (chevron and all) and the list only shows
53
+ while `open` — the mobile pattern. `Nothing` renders the quiet
54
+ title-over-list the desktop rail uses. Both shapes render the same
55
+ dom, so one call serves both; the responsive split is CSS's job.
56
+
57
+ -}
58
+ view :
59
+ { title : String
60
+ , items : List Item
61
+ , active : Maybe String
62
+ , disclosure : Maybe { open : Bool, onToggle : msg }
63
+ , attributes : List (Attribute msg)
64
+ }
65
+ -> Html msg
66
+ view config =
67
+ nav
68
+ ([ Html.Attributes.class "toc"
69
+ , Html.Attributes.classList
70
+ [ ( "collapsible"
71
+ , case config.disclosure of
72
+ Just _ ->
73
+ True
74
+
75
+ Nothing ->
76
+ False
77
+ )
78
+ , ( "open"
79
+ , case config.disclosure of
80
+ Just d ->
81
+ d.open
82
+
83
+ Nothing ->
84
+ True
85
+ )
86
+ ]
87
+ , Html.Attributes.attribute "aria-label" config.title
88
+ ]
89
+ ++ config.attributes
90
+ )
91
+ (titleView config.disclosure config.title
92
+ :: [ itemsView config.active config.items ]
93
+ )
94
+
95
+
96
+ {-| The title: a plain heading, or a toggle button when the ToC is
97
+ collapsible (the chevron folds with the open state).
98
+ -}
99
+ titleView : Maybe { open : Bool, onToggle : msg } -> String -> Html msg
100
+ titleView disclosure title =
101
+ case disclosure of
102
+ Just d ->
103
+ Html.button
104
+ [ Html.Attributes.class "toc-title toc-toggle"
105
+ , Html.Attributes.attribute "aria-expanded"
106
+ (if d.open then
107
+ "true"
108
+
109
+ else
110
+ "false"
111
+ )
112
+ , Html.Events.onClick d.onToggle
113
+ ]
114
+ [ span [ Html.Attributes.class "label" ] [ text title ]
115
+ , span [ Html.Attributes.class "chevron" ]
116
+ [ Ui.Icon.view Ui.Icon.Chevron ]
117
+ ]
118
+
119
+ Nothing ->
120
+ Html.p [ Html.Attributes.class "toc-title" ] [ text title ]