@e280/shiny 0.1.0-15 → 0.1.0-16

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 (277) hide show
  1. package/README.md +34 -80
  2. package/package.json +18 -25
  3. package/s/_archive/demo/utils/lipsum.ts +19 -0
  4. package/s/_archive/demo/views/showcase/style.css.ts +53 -0
  5. package/s/_archive/demo/views/showcase/view.ts +54 -0
  6. package/s/_archive/index.html.ts +34 -0
  7. package/s/_archive/index.ts +19 -0
  8. package/s/_archive/utils/states.ts +15 -0
  9. package/s/demo/main.bundle.ts +16 -0
  10. package/s/demo/main.css +71 -0
  11. package/s/demo/parts/exhibit.ts +15 -0
  12. package/s/demo/utils/lipsum.ts +1 -1
  13. package/s/demo/views/codebox/style.css.ts +43 -0
  14. package/s/demo/views/codebox/use-prism-styles.ts +13 -0
  15. package/s/demo/views/codebox/view.ts +39 -0
  16. package/s/demo/views/showcase/style.css.ts +42 -11
  17. package/s/demo/views/showcase/view.ts +41 -45
  18. package/s/demo/views/stylebox/view.ts +21 -0
  19. package/s/index.html.ts +42 -29
  20. package/s/index.ts +1 -17
  21. package/s/test.ts +5 -0
  22. package/s/theme/parts/core.ts +34 -0
  23. package/s/theme/parts/reset.ts +20 -0
  24. package/s/theme/parts/vars.ts +41 -0
  25. package/s/theme/theme-string.ts +15 -0
  26. package/s/theme/theme.css.ts +7 -0
  27. package/s/views/button/showcase.ts +43 -0
  28. package/s/views/button/style.css.ts +110 -0
  29. package/s/views/button/view.ts +30 -0
  30. package/s/views/copy/parts/copy-status.ts +3 -0
  31. package/s/views/copy/parts/determine-base-status.ts +7 -0
  32. package/s/views/copy/parts/use-copier.ts +20 -0
  33. package/s/views/copy/showcase.ts +54 -0
  34. package/s/views/copy/style.css.ts +46 -0
  35. package/s/views/copy/view.ts +58 -0
  36. package/s/views/drawer/control.ts +31 -0
  37. package/s/views/drawer/showcase.ts +83 -0
  38. package/s/views/drawer/style.css.ts +128 -0
  39. package/s/views/drawer/view.ts +76 -0
  40. package/s/views/tabs/control.ts +31 -0
  41. package/s/views/tabs/showcase.ts +89 -0
  42. package/s/views/tabs/style.css.ts +46 -0
  43. package/s/views/tabs/view.ts +66 -0
  44. package/x/demo/main.bundle.js +13 -0
  45. package/x/demo/main.bundle.js.map +1 -0
  46. package/x/demo/main.bundle.min.js +794 -0
  47. package/x/demo/main.bundle.min.js.map +7 -0
  48. package/x/demo/main.css +71 -0
  49. package/x/demo/parts/exhibit.d.ts +11 -0
  50. package/x/demo/parts/exhibit.js +2 -0
  51. package/x/demo/parts/exhibit.js.map +1 -0
  52. package/x/demo/utils/lipsum.d.ts +1 -1
  53. package/x/demo/utils/lipsum.js +1 -1
  54. package/x/demo/utils/lipsum.js.map +1 -1
  55. package/x/demo/views/codebox/style.css.js +42 -0
  56. package/x/demo/views/codebox/style.css.js.map +1 -0
  57. package/x/demo/views/codebox/use-prism-styles.d.ts +1 -0
  58. package/x/demo/views/codebox/use-prism-styles.js +12 -0
  59. package/x/demo/views/codebox/use-prism-styles.js.map +1 -0
  60. package/x/demo/views/codebox/view.d.ts +2 -0
  61. package/x/demo/views/codebox/view.js +29 -0
  62. package/x/demo/views/codebox/view.js.map +1 -0
  63. package/x/demo/views/showcase/style.css.js +42 -11
  64. package/x/demo/views/showcase/style.css.js.map +1 -1
  65. package/x/demo/views/showcase/view.d.ts +2 -7
  66. package/x/demo/views/showcase/view.js +39 -35
  67. package/x/demo/views/showcase/view.js.map +1 -1
  68. package/x/demo/views/stylebox/view.d.ts +3 -0
  69. package/x/demo/views/stylebox/view.js +13 -0
  70. package/x/demo/views/stylebox/view.js.map +1 -0
  71. package/x/index.d.ts +1 -11
  72. package/x/index.html +212 -62
  73. package/x/index.html.js +40 -26
  74. package/x/index.html.js.map +1 -1
  75. package/x/index.js +1 -11
  76. package/x/index.js.map +1 -1
  77. package/x/test.js +3 -0
  78. package/x/test.js.map +1 -0
  79. package/x/theme/parts/core.d.ts +1 -0
  80. package/x/theme/parts/core.js +33 -0
  81. package/x/theme/parts/core.js.map +1 -0
  82. package/x/theme/parts/reset.d.ts +1 -0
  83. package/x/theme/parts/reset.js +19 -0
  84. package/x/theme/parts/reset.js.map +1 -0
  85. package/x/theme/parts/vars.d.ts +1 -0
  86. package/x/theme/parts/vars.js +34 -0
  87. package/x/theme/parts/vars.js.map +1 -0
  88. package/x/theme/theme-string.d.ts +1 -0
  89. package/x/theme/theme-string.js +14 -0
  90. package/x/theme/theme-string.js.map +1 -0
  91. package/x/theme/theme.css.d.ts +1 -0
  92. package/x/theme/theme.css.js +4 -0
  93. package/x/theme/theme.css.js.map +1 -0
  94. package/x/views/button/showcase.d.ts +1 -0
  95. package/x/views/button/showcase.js +41 -0
  96. package/x/views/button/showcase.js.map +1 -0
  97. package/x/views/button/style.css.js +109 -0
  98. package/x/views/button/style.css.js.map +1 -0
  99. package/x/views/button/view.d.ts +4 -0
  100. package/x/views/button/view.js +22 -0
  101. package/x/views/button/view.js.map +1 -0
  102. package/x/views/copy/parts/copy-status.d.ts +1 -0
  103. package/x/views/copy/parts/copy-status.js +2 -0
  104. package/x/views/copy/parts/copy-status.js.map +1 -0
  105. package/x/views/copy/parts/determine-base-status.d.ts +1 -0
  106. package/x/views/copy/parts/determine-base-status.js +6 -0
  107. package/x/views/copy/parts/determine-base-status.js.map +1 -0
  108. package/x/views/copy/parts/use-copier.d.ts +6 -0
  109. package/x/views/copy/parts/use-copier.js +13 -0
  110. package/x/views/copy/parts/use-copier.js.map +1 -0
  111. package/x/views/copy/showcase.d.ts +1 -0
  112. package/x/views/copy/showcase.js +51 -0
  113. package/x/views/copy/showcase.js.map +1 -0
  114. package/x/views/copy/style.css.js.map +1 -0
  115. package/x/views/copy/view.d.ts +4 -0
  116. package/x/views/copy/view.js +47 -0
  117. package/x/views/copy/view.js.map +1 -0
  118. package/x/{components → views}/drawer/control.d.ts +1 -1
  119. package/x/views/drawer/control.js.map +1 -0
  120. package/x/views/drawer/showcase.d.ts +1 -0
  121. package/x/views/drawer/showcase.js +75 -0
  122. package/x/views/drawer/showcase.js.map +1 -0
  123. package/x/{components → views}/drawer/style.css.js +1 -0
  124. package/x/views/drawer/style.css.js.map +1 -0
  125. package/x/views/drawer/view.d.ts +6 -0
  126. package/x/views/drawer/view.js +60 -0
  127. package/x/views/drawer/view.js.map +1 -0
  128. package/x/{components → views}/tabs/control.d.ts +2 -2
  129. package/x/{components → views}/tabs/control.js +3 -3
  130. package/x/views/tabs/control.js.map +1 -0
  131. package/x/views/tabs/showcase.d.ts +1 -0
  132. package/x/views/tabs/showcase.js +86 -0
  133. package/x/views/tabs/showcase.js.map +1 -0
  134. package/x/{components → views}/tabs/style.css.js +5 -5
  135. package/x/views/tabs/style.css.js.map +1 -0
  136. package/x/views/tabs/view.d.ts +5 -0
  137. package/x/views/tabs/view.js +52 -0
  138. package/x/views/tabs/view.js.map +1 -0
  139. package/x/components/button/component.d.ts +0 -6
  140. package/x/components/button/component.js +0 -25
  141. package/x/components/button/component.js.map +0 -1
  142. package/x/components/button/showcase.d.ts +0 -1
  143. package/x/components/button/showcase.js +0 -116
  144. package/x/components/button/showcase.js.map +0 -1
  145. package/x/components/button/style.css.js +0 -62
  146. package/x/components/button/style.css.js.map +0 -1
  147. package/x/components/copy/component.d.ts +0 -376
  148. package/x/components/copy/component.js +0 -63
  149. package/x/components/copy/component.js.map +0 -1
  150. package/x/components/copy/showcase.d.ts +0 -1
  151. package/x/components/copy/showcase.js +0 -48
  152. package/x/components/copy/showcase.js.map +0 -1
  153. package/x/components/copy/style.css.js.map +0 -1
  154. package/x/components/drawer/component.d.ts +0 -387
  155. package/x/components/drawer/component.js +0 -73
  156. package/x/components/drawer/component.js.map +0 -1
  157. package/x/components/drawer/control.js.map +0 -1
  158. package/x/components/drawer/showcase.d.ts +0 -1
  159. package/x/components/drawer/showcase.js +0 -105
  160. package/x/components/drawer/showcase.js.map +0 -1
  161. package/x/components/drawer/style.css.js.map +0 -1
  162. package/x/components/example/component.d.ts +0 -371
  163. package/x/components/example/component.js +0 -22
  164. package/x/components/example/component.js.map +0 -1
  165. package/x/components/example/showcase.d.ts +0 -1
  166. package/x/components/example/showcase.js +0 -30
  167. package/x/components/example/showcase.js.map +0 -1
  168. package/x/components/example/style.css.js +0 -10
  169. package/x/components/example/style.css.js.map +0 -1
  170. package/x/components/foundation.css.d.ts +0 -1
  171. package/x/components/foundation.css.js +0 -14
  172. package/x/components/foundation.css.js.map +0 -1
  173. package/x/components/framework.d.ts +0 -8
  174. package/x/components/framework.js +0 -5
  175. package/x/components/framework.js.map +0 -1
  176. package/x/components/raw-components.d.ts +0 -12
  177. package/x/components/raw-components.js +0 -13
  178. package/x/components/raw-components.js.map +0 -1
  179. package/x/components/tabs/component.d.ts +0 -374
  180. package/x/components/tabs/component.js +0 -60
  181. package/x/components/tabs/component.js.map +0 -1
  182. package/x/components/tabs/control.js.map +0 -1
  183. package/x/components/tabs/showcase.d.ts +0 -1
  184. package/x/components/tabs/showcase.js +0 -167
  185. package/x/components/tabs/showcase.js.map +0 -1
  186. package/x/components/tabs/style.css.js.map +0 -1
  187. package/x/demo/demo.bundle.js +0 -42
  188. package/x/demo/demo.bundle.js.map +0 -1
  189. package/x/demo/demo.bundle.min.js +0 -893
  190. package/x/demo/demo.bundle.min.js.map +0 -7
  191. package/x/demo/lipsum.d.ts +0 -2
  192. package/x/demo/lipsum.js +0 -4
  193. package/x/demo/lipsum.js.map +0 -1
  194. package/x/demo/views/exhibit/style.css.d.ts +0 -2
  195. package/x/demo/views/exhibit/style.css.js +0 -84
  196. package/x/demo/views/exhibit/style.css.js.map +0 -1
  197. package/x/demo/views/exhibit/view.d.ts +0 -29
  198. package/x/demo/views/exhibit/view.js +0 -40
  199. package/x/demo/views/exhibit/view.js.map +0 -1
  200. package/x/demo/viewsets.d.ts +0 -17
  201. package/x/demo/viewsets.js +0 -9
  202. package/x/demo/viewsets.js.map +0 -1
  203. package/x/install/aura.bundle.js +0 -5
  204. package/x/install/aura.bundle.js.map +0 -1
  205. package/x/install/aura.bundle.min.js +0 -471
  206. package/x/install/aura.bundle.min.js.map +0 -7
  207. package/x/install/plain.bundle.d.ts +0 -1
  208. package/x/install/plain.bundle.js +0 -5
  209. package/x/install/plain.bundle.js.map +0 -1
  210. package/x/install/plain.bundle.min.js +0 -398
  211. package/x/install/plain.bundle.min.js.map +0 -7
  212. package/x/shiny.d.ts +0 -47
  213. package/x/shiny.js +0 -8
  214. package/x/shiny.js.map +0 -1
  215. package/x/tests.test.d.ts +0 -1
  216. package/x/tests.test.js +0 -3
  217. package/x/tests.test.js.map +0 -1
  218. package/x/themes/aura.css.d.ts +0 -1
  219. package/x/themes/aura.css.js +0 -85
  220. package/x/themes/aura.css.js.map +0 -1
  221. package/x/themes/index.barrel.d.ts +0 -2
  222. package/x/themes/index.barrel.js +0 -3
  223. package/x/themes/index.barrel.js.map +0 -1
  224. package/x/themes/index.d.ts +0 -2
  225. package/x/themes/index.js +0 -2
  226. package/x/themes/index.js.map +0 -1
  227. package/x/themes/infra/css-vars.d.ts +0 -15
  228. package/x/themes/infra/css-vars.js +0 -22
  229. package/x/themes/infra/css-vars.js.map +0 -1
  230. package/x/themes/plain.css.d.ts +0 -1
  231. package/x/themes/plain.css.js +0 -10
  232. package/x/themes/plain.css.js.map +0 -1
  233. /package/s/{components → _archive/components}/button/component.ts +0 -0
  234. /package/s/{components → _archive/components}/button/showcase.ts +0 -0
  235. /package/s/{components → _archive/components}/button/style.css.ts +0 -0
  236. /package/s/{components → _archive/components}/copy/component.ts +0 -0
  237. /package/s/{components → _archive/components}/copy/showcase.ts +0 -0
  238. /package/s/{components → _archive/components}/copy/style.css.ts +0 -0
  239. /package/s/{components → _archive/components}/drawer/component.ts +0 -0
  240. /package/s/{components → _archive/components}/drawer/control.ts +0 -0
  241. /package/s/{components → _archive/components}/drawer/showcase.ts +0 -0
  242. /package/s/{components → _archive/components}/drawer/style.css.ts +0 -0
  243. /package/s/{components → _archive/components}/example/component.ts +0 -0
  244. /package/s/{components → _archive/components}/example/showcase.ts +0 -0
  245. /package/s/{components → _archive/components}/example/style.css.ts +0 -0
  246. /package/s/{components → _archive/components}/foundation.css.ts +0 -0
  247. /package/s/{components → _archive/components}/framework.ts +0 -0
  248. /package/s/{components → _archive/components}/raw-components.ts +0 -0
  249. /package/s/{components → _archive/components}/tabs/component.ts +0 -0
  250. /package/s/{components → _archive/components}/tabs/control.ts +0 -0
  251. /package/s/{components → _archive/components}/tabs/showcase.ts +0 -0
  252. /package/s/{components → _archive/components}/tabs/style.css.ts +0 -0
  253. /package/s/{demo → _archive/demo}/demo.bundle.ts +0 -0
  254. /package/s/{demo → _archive/demo}/demo.css +0 -0
  255. /package/s/{demo → _archive/demo}/lipsum.ts +0 -0
  256. /package/s/{demo → _archive/demo}/views/exhibit/style.css.ts +0 -0
  257. /package/s/{demo → _archive/demo}/views/exhibit/view.ts +0 -0
  258. /package/s/{demo → _archive/demo}/viewsets.ts +0 -0
  259. /package/s/{install → _archive/install}/aura.bundle.ts +0 -0
  260. /package/s/{install → _archive/install}/plain.bundle.ts +0 -0
  261. /package/s/{shiny.ts → _archive/shiny.ts} +0 -0
  262. /package/s/{tests.test.ts → _archive/tests.test.ts} +0 -0
  263. /package/s/{themes → _archive/themes}/aura.css.ts +0 -0
  264. /package/s/{themes → _archive/themes}/index.barrel.ts +0 -0
  265. /package/s/{themes → _archive/themes}/index.ts +0 -0
  266. /package/s/{themes → _archive/themes}/infra/css-vars.ts +0 -0
  267. /package/s/{themes → _archive/themes}/plain.css.ts +0 -0
  268. /package/x/{demo → _archive/demo}/demo.css +0 -0
  269. /package/x/demo/{demo.bundle.d.ts → main.bundle.d.ts} +0 -0
  270. /package/x/{components/button → demo/views/codebox}/style.css.d.ts +0 -0
  271. /package/x/{install/aura.bundle.d.ts → test.d.ts} +0 -0
  272. /package/x/{components/copy → views/button}/style.css.d.ts +0 -0
  273. /package/x/{components/drawer → views/copy}/style.css.d.ts +0 -0
  274. /package/x/{components → views}/copy/style.css.js +0 -0
  275. /package/x/{components → views}/drawer/control.js +0 -0
  276. /package/x/{components/example → views/drawer}/style.css.d.ts +0 -0
  277. /package/x/{components → views}/tabs/style.css.d.ts +0 -0
@@ -2,15 +2,15 @@
2
2
  import {css} from "lit"
3
3
  export default css`@layer view {
4
4
 
5
- :host {
5
+ section.showcase {
6
6
  position: relative;
7
7
 
8
8
  display: flex;
9
9
  flex-direction: column;
10
10
 
11
11
  padding: 1em;
12
- border-radius: 0.5em;
13
- gap: 1em;
12
+ border-radius: var(--rounded);
13
+ gap: var(--padding);
14
14
 
15
15
  background: linear-gradient(to right top, #252dd985, #aa6affbd);
16
16
  backdrop-filter: blur(0.5em);
@@ -19,29 +19,29 @@ export default css`@layer view {
19
19
  border-top: 2px solid #fff4;
20
20
 
21
21
  &::before {
22
+ z-index: 0;
22
23
  content: "";
23
24
  display: block;
24
25
  position: absolute;
25
26
  inset: 0;
26
- border-radius: 0.5em;
27
- background: #0007;
28
- width: calc(100% - 0.3em);
29
- height: calc(100% - 0.3em);
27
+ border-radius: var(--rounded);
28
+ background: #0006;
29
+ width: calc(100% - var(--padding));
30
+ height: calc(100% - var(--padding));
30
31
  margin: auto;
31
- z-index: 0;
32
32
  }
33
33
 
34
34
  > * {
35
- position: relative;
36
35
  z-index: 1;
36
+ position: relative;
37
37
  }
38
38
  }
39
39
 
40
40
  header {
41
41
  display: flex;
42
42
  flex-wrap: wrap;
43
- place-content: center center;
44
- gap: 0.5em;
43
+ place-content: center;
44
+ gap: var(--padding);
45
45
 
46
46
  h2 {
47
47
  flex: 1 1 auto;
@@ -49,5 +49,36 @@ header {
49
49
  }
50
50
  }
51
51
 
52
+ .sides {
53
+ display: flex;
54
+ flex-wrap: wrap;
55
+ gap: var(--padding);
56
+
57
+ > * {
58
+ flex: 1 1 0;
59
+ }
60
+
61
+ }
62
+
63
+ .codezone {
64
+ display: flex;
65
+ flex-direction: column;
66
+ gap: var(--padding);
67
+
68
+ > * {
69
+ flex: 1 1 auto;
70
+ }
71
+ }
72
+
73
+ .stage {
74
+ display: flex;
75
+ flex-direction: column;
76
+ justify-content: start;
77
+ align-items: center;
78
+ padding: calc(var(--padding) * 2) var(--padding);
79
+ border: 1px dashed color-mix(in oklch, transparent, currentColor 50%);
80
+ border-radius: var(--rounded);
81
+ }
82
+
52
83
  }`
53
84
 
@@ -1,54 +1,50 @@
1
1
 
2
- import {view} from "@e280/sly"
3
- import {CSSResultGroup, html} from "lit"
4
- import styleCss from "./style.css.js"
5
- import {auraViews, viewsets} from "../../viewsets.js"
6
- import {Exhibit, ExhibitParams} from "../exhibit/view.js"
7
- import {TabControl} from "../../../components/tabs/control.js"
8
- import {foundationCss} from "../../../components/foundation.css.js"
2
+ import {css, html} from "lit"
3
+ import {shadow, useCss, useName, useOnce} from "@e280/sly"
9
4
 
10
- export const Showcase = view(use => (options: {
11
- name: string
12
- style: CSSResultGroup
13
- exhibits: ExhibitParams[]
14
- }) => {
5
+ import showcaseCss from "./style.css.js"
6
+ import {Codebox} from "../codebox/view.js"
7
+ import {Stylebox} from "../stylebox/view.js"
8
+ import {Exhibit} from "../../parts/exhibit.js"
9
+ import {themeCss} from "../../../theme/theme.css.js"
10
+ import {ShinyTabs} from "../../../views/tabs/view.js"
11
+ import {ShinyButton} from "../../../views/button/view.js"
12
+ import {TabsControl} from "../../../views/tabs/control.js"
15
13
 
16
- use.name(`showcase-${options.name}`)
17
- use.styles(foundationCss, styleCss)
14
+ export const Showcase = shadow((title: string, exhibits: Exhibit[]) => {
15
+ useName("showcase")
16
+ useCss(themeCss, showcaseCss)
18
17
 
19
- const exhibitTabControl = use.once(() => new TabControl())
20
- const themeTabControl = use.once(() => new TabControl())
21
-
22
- const exhibitViews = viewsets.at(themeTabControl.index)![1]
23
- const exhibit = options.exhibits.at(exhibitTabControl.index)!
18
+ const control = useOnce(() => new TabsControl())
19
+ const exhibit = exhibits.at(control.index)
24
20
 
25
21
  return html`
26
- <header>
27
- <h2>✨shiny-${options.name}✨</h2>
28
- ${auraViews.ShinyTabs
29
- .props(exhibitTabControl)
30
- .attr("snug")
31
- .children(options.exhibits.map(p =>
32
- auraViews.ShinyButton
33
- .props()
34
- .attr("sad")
35
- .children(p.label)
36
- .render()
37
- ))
38
- .render()}
39
- ${auraViews.ShinyTabs
40
- .props(themeTabControl)
41
- .attr("snug")
42
- .children(viewsets.map(([theme]) =>
43
- auraViews.ShinyButton
44
- .props()
45
- .children(theme)
46
- .render()
47
- ))
48
- .render()}
49
- </header>
50
-
51
- ${Exhibit(exhibit, exhibitViews, options.style)}
22
+ <section class=showcase>
23
+ <header>
24
+ <h2>✨${title}✨</h2>
25
+ <nav>
26
+ ${ShinyTabs.with({
27
+ props: [{control, snug: true}],
28
+ children: exhibits.map(exhibit => ShinyButton(exhibit.name)),
29
+ })}
30
+ </nav>
31
+ </header>
32
+
33
+ ${exhibit && html`
34
+ <div class=explain>${exhibit.explain}</div>
35
+
36
+ <div class=sides>
37
+ <div class=codezone>
38
+ ${Codebox("lit-html", "js", exhibit.js)}
39
+ ${exhibit.css && Codebox("css", "css", exhibit.css.toString())}
40
+ </div>
41
+
42
+ <div class=stage>
43
+ ${Stylebox(exhibit.styleboxCss, exhibit.css ?? css``, exhibit.render())}
44
+ </div>
45
+ </div>
46
+ `}
47
+ </section>
52
48
  `
53
49
  })
54
50
 
@@ -0,0 +1,21 @@
1
+
2
+ import {CSSResult, html, unsafeCSS} from "lit"
3
+ import {Content, shadow, useCss, useName} from "@e280/sly"
4
+ import {themeCss} from "../../../theme/theme.css.js"
5
+
6
+ export const Stylebox = shadow((
7
+ styleboxCss: CSSResult,
8
+ styles: CSSResult,
9
+ content: Content,
10
+ ) => {
11
+
12
+ useName("stylebox")
13
+ useCss(themeCss, styleboxCss, styles)
14
+
15
+ return html`
16
+ <style>${unsafeCSS(styleboxCss)}</style>
17
+ <style>${unsafeCSS(styles)}</style>
18
+ ${content}
19
+ `
20
+ })
21
+
package/s/index.html.ts CHANGED
@@ -1,34 +1,47 @@
1
1
 
2
- import {ssg, html} from "@e280/scute"
2
+ import {template, html, socialCard} from "@e280/scute"
3
+ import {themeString} from "./theme/theme-string.js"
3
4
 
4
5
  const favicon = "/assets/favicon.png"
5
6
 
6
- export default ssg.page(import.meta.url, async orb => ({
7
- title: "shiny",
8
- js: "demo/demo.bundle.min.js",
9
- css: "demo/demo.css",
10
- favicon,
11
- dark: true,
12
- socialCard: {
13
- themeColor: "#d068ff",
14
- siteName: "@e280/shiny",
15
- title: "✨shiny✨",
16
- description: "web ui components",
17
- image: "https://shiny.e280.org" + favicon,
18
- },
19
-
20
- body: html`
21
- <h1>
22
- <strong>✨shiny✨</strong>
23
- <small>v${orb.packageVersion()}</small>
24
- </h1>
25
-
26
- <section>
27
- <p>web ui components</p>
28
- <p><a href="https://github.com/e280/shiny#readme">readme for installation</a></p>
29
- </section>
30
-
31
- <shiny-demo></shiny-demo>
32
- `,
33
- }))
7
+ export default template(import.meta.url, async orb => html`
8
+ <!doctype html>
9
+ <html>
10
+ <head>
11
+ <meta charset="utf-8"/>
12
+ <meta name="viewport" content="width=device-width,initial-scale=1"/>
13
+ <meta name="darkreader-lock"/>
14
+ <style>@layer base{html{background:#000;color:#aaa;}}</style>
15
+
16
+ <title>shiny</title>
17
+ <link rel="icon" href="${favicon}"/>
18
+ <script type="module" src="${orb.hashurl("demo/main.bundle.min.js")}"></script>
19
+
20
+ <style>${themeString}</style>
21
+ <style>${orb.inject("demo/main.css")}</style>
22
+ <style data-prism>${orb.inject("$/node_modules/prismjs/themes/prism-tomorrow.css")}</style>
23
+
24
+ ${socialCard({
25
+ themeColor: "#d068ff",
26
+ siteName: "@e280/shiny",
27
+ title: "✨shiny✨",
28
+ description: "web ui library",
29
+ image: "https://shiny.e280.org" + favicon,
30
+ })}
31
+ </head>
32
+ <body>
33
+ <h1>
34
+ <strong>✨shiny✨</strong>
35
+ <small>v${orb.packageVersion()}</small>
36
+ </h1>
37
+
38
+ <section>
39
+ <p>e280's web ui library</p>
40
+ <p><a href="https://github.com/e280/shiny#readme">readme for installation</a></p>
41
+ </section>
42
+
43
+ <div class="gallery"></div>
44
+ </body>
45
+ </html>
46
+ `)
34
47
 
package/s/index.ts CHANGED
@@ -1,19 +1,3 @@
1
1
 
2
- export * from "./themes/index.js"
3
-
4
- export * from "./components/copy/component.js"
5
-
6
- export * from "./components/drawer/component.js"
7
- export * from "./components/drawer/control.js"
8
-
9
- export * from "./components/example/component.js"
10
-
11
- export * from "./components/tabs/component.js"
12
- export * from "./components/tabs/control.js"
13
-
14
- export * from "./components/foundation.css.js"
15
- export * from "./components/framework.js"
16
- export * from "./components/raw-components.js"
17
-
18
- export * from "./shiny.js"
2
+ export * from "./views/copy/view.js"
19
3
 
package/s/test.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ import {run} from "@e280/science"
3
+
4
+ await run({})
5
+
@@ -0,0 +1,34 @@
1
+
2
+ import {templateString as css} from "@e280/stz"
3
+ export const coreString = css`@layer core {
4
+
5
+ ::selection {
6
+ color: var(--selection);
7
+ background-color: var(--selection-bg);
8
+ }
9
+
10
+ ::-webkit-scrollbar { width: 8px; }
11
+ ::-webkit-scrollbar-track { background: transparent; }
12
+ ::-webkit-scrollbar-thumb { background: #444; border-radius: 1em; }
13
+ ::-webkit-scrollbar-thumb:hover { background: #666; }
14
+
15
+ a {
16
+ color: var(--link);
17
+ text-decoration: none;
18
+
19
+ &:visited {
20
+ color: color-mix(in srgb, purple, var(--link) 70%);
21
+ }
22
+
23
+ &:hover {
24
+ color: color-mix(in srgb, white, var(--link) 90%);
25
+ text-decoration: underline;
26
+ }
27
+
28
+ &:active {
29
+ color: color-mix(in srgb, white, var(--link) 50%);
30
+ }
31
+ }
32
+
33
+ }`
34
+
@@ -0,0 +1,20 @@
1
+
2
+ import {templateString as css} from "@e280/stz"
3
+ export const resetString = css`@layer reset {
4
+
5
+ * {
6
+ margin: 0;
7
+ padding: 0;
8
+ box-sizing: border-box;
9
+
10
+ scrollbar-width: thin;
11
+ scrollbar-color: #888 transparent;
12
+ }
13
+
14
+ ::-webkit-scrollbar { width: 8px; }
15
+ ::-webkit-scrollbar-track { background: transparent; }
16
+ ::-webkit-scrollbar-thumb { background: #888; border-radius: 1em; }
17
+ ::-webkit-scrollbar-thumb:hover { background: #999; }
18
+
19
+ }`
20
+
@@ -0,0 +1,41 @@
1
+
2
+ import {templateString as css} from "@e280/stz"
3
+ export const varsString = css`@layer vars {
4
+
5
+ :is(:root, :host) {
6
+ ${renderVars({
7
+ "bg": "#111",
8
+ "alpha": "#def",
9
+
10
+ "rounded": "0.5em",
11
+ "padding": "0.5em",
12
+
13
+ "prime": "#d068ff",
14
+ "code": "#3f1",
15
+ "link": "cyan",
16
+ "selection": "white",
17
+ "selection-bg": "#f70",
18
+
19
+ "lame": "#8888",
20
+ "angry": "#f50",
21
+ "zesty": "#cf0",
22
+ "happy": "#0fa",
23
+ "calm": "#0af",
24
+ "sad": "#74f",
25
+ "quirky": "#f49",
26
+
27
+ "inactive-opacity": "0.5",
28
+ "anim-duration": "300ms",
29
+ })}
30
+ }
31
+
32
+ }`
33
+
34
+ function renderVar([name, value]: [string, string]) {
35
+ return `--${name}: var(--shiny-${name}, ${value});`
36
+ }
37
+
38
+ function renderVars(varsObject: Record<string, string>) {
39
+ return Object.entries(varsObject).map(renderVar).join("\n")
40
+ }
41
+
@@ -0,0 +1,15 @@
1
+
2
+ import {templateString as css} from "@e280/stz"
3
+ import {coreString} from "./parts/core.js"
4
+ import {varsString} from "./parts/vars.js"
5
+ import {resetString} from "./parts/reset.js"
6
+ export const themeString = css`
7
+
8
+ @layer vars, reset, core, underlay, view, overlay;
9
+
10
+ ${varsString}
11
+ ${resetString}
12
+ ${coreString}
13
+
14
+ `
15
+
@@ -0,0 +1,7 @@
1
+
2
+ import {themeString} from "./theme-string.js"
3
+
4
+ export const themeCss = new CSSStyleSheet()
5
+
6
+ themeCss.replaceSync(themeString)
7
+
@@ -0,0 +1,43 @@
1
+
2
+ import {css} from "lit"
3
+ import {ShinyButton} from "./view.js"
4
+ import {exhibit} from "../../demo/parts/exhibit.js"
5
+ import {Showcase} from "../../demo/views/showcase/view.js"
6
+
7
+ export const buttonShowcase = () => Showcase("ShinyButton", [
8
+ exhibit({
9
+ name: "catalog",
10
+ explain: "click-to-copy button.",
11
+ render: () => [
12
+ ShinyButton("e280"),
13
+ ShinyButton("e280", {vibe: "happy"}),
14
+ ShinyButton("e280", {vibe: "sad"}),
15
+ ShinyButton("e280", {vibe: "angry"}),
16
+ ShinyButton("e280", {vibe: "zesty"}),
17
+ ShinyButton("e280", {vibe: "quirky"}),
18
+ ShinyButton("e280", {vibe: "lame"}),
19
+ ],
20
+ styleboxCss: css`
21
+ :host {
22
+ font-size: 1.5em;
23
+ display: flex;
24
+ justify-content: center;
25
+ flex-wrap: wrap;
26
+ gap: calc(var(--padding) / 2);
27
+ }
28
+ `,
29
+ js: `
30
+ [
31
+ ShinyButton("e280"),
32
+ ShinyButton("e280", {vibe: "happy"}),
33
+ ShinyButton("e280", {vibe: "sad"}),
34
+ ShinyButton("e280", {vibe: "angry"}),
35
+ ShinyButton("e280", {vibe: "zesty"}),
36
+ ShinyButton("e280", {vibe: "quirky"}),
37
+ ShinyButton("e280", {vibe: "lame"}),
38
+ ]
39
+ `,
40
+ css: undefined,
41
+ }),
42
+ ])
43
+
@@ -0,0 +1,110 @@
1
+
2
+ import {css} from "lit"
3
+ export default css`@layer view {
4
+
5
+ :host {
6
+ display: inline-flex;
7
+ width: max-content;
8
+ height: max-content;
9
+
10
+ cursor: pointer;
11
+ background: transparent;
12
+ user-select: none;
13
+
14
+ --button-padding: 0.3em 0.7em;
15
+ --button-color: var(--calm);
16
+ }
17
+
18
+ slot {
19
+ z-index: 1;
20
+ position: relative;
21
+ display: block;
22
+ }
23
+
24
+ button {
25
+ opacity: 0.8;
26
+ position: relative;
27
+
28
+ font: inherit;
29
+ cursor: inherit;
30
+ text-shadow: inherit;
31
+ font-weight: medium;
32
+
33
+ display: inline-flex;
34
+ justify-content: center;
35
+ align-items: center;
36
+
37
+ width: 100%;
38
+ height: 100%;
39
+ padding: var(--button-padding);
40
+
41
+ border-radius: 2em;
42
+ background: var(--button-color);
43
+ text-shadow: 0.1em 0.1em 0.1em #0004;
44
+ box-shadow: 0.1em 0.2em 0.3em #0002;
45
+
46
+ color: white;
47
+ border: none;
48
+ background: linear-gradient(
49
+ to bottom right,
50
+ color-mix(in oklab, var(--button-color), white 40%),
51
+ color-mix(in oklab, var(--button-color), black 20%)
52
+ );
53
+
54
+ &::before {
55
+ content: "";
56
+ display: block;
57
+ position: absolute;
58
+ z-index: 0;
59
+ inset: 0.15em;
60
+ border-radius: inherit;
61
+ background: color-mix(in oklab, var(--button-color), #0004 50%);
62
+ }
63
+
64
+ &:not([disabled]):is(:hover, :focus-visible) { opacity: 1; }
65
+ &:not([disabled]):active { opacity: 0.6; }
66
+
67
+ &[data-vibe="lame"] { --button-color: var(--lame); }
68
+ &[data-vibe="angry"] { --button-color: var(--angry); }
69
+ &[data-vibe="zesty"] { --button-color: var(--zesty); }
70
+ &[data-vibe="happy"] { --button-color: var(--happy); }
71
+ &[data-vibe="calm"] { --button-color: var(--calm); }
72
+ &[data-vibe="sad"] { --button-color: var(--sad); }
73
+ &[data-vibe="quirky"] { --button-color: var(--quirky); }
74
+ &[data-vibe="tabbed"] { --button-color: var(--tabbed); }
75
+
76
+ > * {
77
+ position: relative;
78
+ z-index: 1;
79
+ }
80
+
81
+ &[disabled] {
82
+ cursor: default;
83
+ }
84
+
85
+ &[hidden] {
86
+ display: none !important;
87
+ }
88
+ }
89
+
90
+ :host([data-tabbed]) > button {
91
+ opacity: 1;
92
+ filter: brightness(120%);
93
+ }
94
+
95
+ :host(:not([data-tabbed])) > button[disabled] {
96
+ --button-color: var(--lame);
97
+ }
98
+
99
+ :host([data-snug]:not([data-last])) > button {
100
+ border-top-right-radius: 0;
101
+ border-bottom-right-radius: 0;
102
+ }
103
+
104
+ :host([data-snug]:not([data-first])) > button {
105
+ border-top-left-radius: 0;
106
+ border-bottom-left-radius: 0;
107
+ }
108
+
109
+ }`
110
+
@@ -0,0 +1,30 @@
1
+
2
+ import {html} from "lit"
3
+ import {Content, shadow, useCss, useName, useAttrs} from "@e280/sly"
4
+
5
+ import styleCss from "./style.css.js"
6
+ import {themeCss} from "../../theme/theme.css.js"
7
+
8
+ export const ShinyButton = shadow((content?: Content, options: {
9
+ vibe?: "calm" | "lame" | "happy" | "sad" | "angry" | "zesty" | "quirky"
10
+ } = {}) => {
11
+
12
+ useName("shiny-button")
13
+ useCss(themeCss, styleCss)
14
+
15
+ const attrs = useAttrs({
16
+ hidden: Boolean,
17
+ disabled: Boolean,
18
+ })
19
+
20
+ return html`
21
+ <button
22
+ part=button
23
+ data-vibe="${options.vibe ?? "calm"}"
24
+ ?disabled="${attrs.disabled}"
25
+ ?hidden="${attrs.hidden}">
26
+ <slot>${content}</slot>
27
+ </button>
28
+ `
29
+ })
30
+
@@ -0,0 +1,3 @@
1
+
2
+ export type CopyStatus = "neutral" | "good" | "bad" | "invalid"
3
+
@@ -0,0 +1,7 @@
1
+
2
+ export function determineBaseStatus(text: string | undefined) {
3
+ return text === undefined
4
+ ? "invalid"
5
+ : "neutral"
6
+ }
7
+
@@ -0,0 +1,20 @@
1
+
2
+ import {debounce} from "@e280/stz"
3
+ import {useOnce, useSignal} from "@e280/sly"
4
+
5
+ import {CopyStatus} from "./copy-status.js"
6
+ import {determineBaseStatus} from "./determine-base-status.js"
7
+
8
+ export function useCopier(text: string | undefined, ms: number) {
9
+ const $status = useSignal<CopyStatus>(determineBaseStatus(text))
10
+
11
+ const reset = useOnce(() => debounce(ms, () => $status.set(determineBaseStatus(text))))
12
+
13
+ const flash = useOnce(() => async(status: CopyStatus) => {
14
+ await $status.set(status)
15
+ await reset()
16
+ })
17
+
18
+ return {reset, flash, status: $status()}
19
+ }
20
+