@charmland/gem 0.0.0-stage → 0.1.1

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 +13815 -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 +1268 -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 +957 -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 +560 -0
  40. package/src/core/Gem/Render.elm +510 -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,16 @@
1
+ /**
2
+ * Compiles the Elm theme and rewrites `elm make`'s trailing `}(this));` to
3
+ * `globalThis`, so the same bundle imports in the browser and in jsdom.
4
+ */
5
+ export interface CompileElmOptions {
6
+ input: string;
7
+ output: string;
8
+ cwd?: string;
9
+ }
10
+ export interface GemSourceDirectories {
11
+ core: string;
12
+ app: string;
13
+ ui: string;
14
+ }
15
+ export declare function compileElm(options: CompileElmOptions): string;
16
+ export declare function sourceDirectories(): GemSourceDirectories;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Compiles the Elm theme and rewrites `elm make`'s trailing `}(this));` to
3
+ * `globalThis`, so the same bundle imports in the browser and in jsdom.
4
+ */
5
+ import { execFileSync } from "node:child_process";
6
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
+ import { dirname, join, resolve } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ export function compileElm(options) {
10
+ const cwd = resolve(options.cwd ?? process.cwd());
11
+ const input = resolve(cwd, options.input);
12
+ const output = resolve(cwd, options.output);
13
+ const elm = findElm(cwd);
14
+ mkdirSync(dirname(output), { recursive: true });
15
+ execFileSync(elm, ["make", input, "--output", output, "--optimize"], {
16
+ cwd,
17
+ stdio: "inherit",
18
+ });
19
+ const source = readFileSync(output, "utf8");
20
+ const patched = source.replace(/\}\(this\)\);\s*$/, "}(globalThis));\n");
21
+ if (patched === source) {
22
+ throw new Error("gem-elm: could not patch the elm bundle (expected `}(this));` at the end)");
23
+ }
24
+ writeFileSync(output, patched);
25
+ return output;
26
+ }
27
+ export function sourceDirectories() {
28
+ const root = fileURLToPath(new URL("../../", import.meta.url));
29
+ return {
30
+ core: join(root, "src", "core"),
31
+ app: join(root, "src", "app"),
32
+ ui: join(root, "src", "ui"),
33
+ };
34
+ }
35
+ function findElm(start) {
36
+ for (let dir = start;; dir = dirname(dir)) {
37
+ const candidate = join(dir, "node_modules", ".bin", "elm");
38
+ try {
39
+ readFileSync(candidate);
40
+ return candidate;
41
+ }
42
+ catch {
43
+ }
44
+ if (dirname(dir) === dir)
45
+ break;
46
+ }
47
+ throw new Error("elm is not installed; run `bun add -D elm` in the project root");
48
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import { compileElm } from "./build.js";
3
+ const usage = "Usage: gem-elm <input.elm> <output.js>";
4
+ function run(argv) {
5
+ if (argv.length === 1 && (argv[0] === "--help" || argv[0] === "-h")) {
6
+ console.log(usage);
7
+ return;
8
+ }
9
+ if (argv.length !== 2)
10
+ throw new Error(usage);
11
+ const [input, output] = argv;
12
+ const written = compileElm({ input, output });
13
+ console.log(`gem-elm: wrote ${written}`);
14
+ }
15
+ try {
16
+ run(process.argv.slice(2));
17
+ }
18
+ catch (error) {
19
+ console.error(error instanceof Error ? error.message : error);
20
+ process.exitCode = 1;
21
+ }
package/elm.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "type": "application",
3
+ "source-directories": [
4
+ "src/core",
5
+ "src/app",
6
+ "src/ui"
7
+ ],
8
+ "elm-version": "0.19.2",
9
+ "dependencies": {
10
+ "direct": {
11
+ "elm/browser": "1.0.2",
12
+ "elm/core": "1.0.5",
13
+ "elm/html": "1.0.1",
14
+ "elm/json": "1.1.4",
15
+ "elm/url": "1.0.0",
16
+ "carlsson87/spring": "1.0.0",
17
+ "elm/svg": "1.0.1"
18
+ },
19
+ "indirect": {
20
+ "elm/time": "1.0.0",
21
+ "elm/virtual-dom": "1.0.5"
22
+ }
23
+ },
24
+ "test-dependencies": {
25
+ "direct": {},
26
+ "indirect": {}
27
+ }
28
+ }
package/package.json CHANGED
@@ -1,6 +1,88 @@
1
1
  {
2
2
  "name": "@charmland/gem",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Gem's Elm sources, default application, browser runtime, UI kit, stylesheet and fonts.",
5
+ "keywords": ["gem", "elm", "documentation", "theme", "ui"],
6
+ "homepage": "https://github.com/charmbracelet/gem/tree/main/packages/gem",
7
+ "bugs": {
8
+ "url": "https://github.com/charmbracelet/gem/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/charmbracelet/gem.git",
13
+ "directory": "packages/gem"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "license": "Apache-2.0",
19
+ "type": "module",
20
+ "engines": {
21
+ "node": ">=20.19"
22
+ },
23
+ "bin": {
24
+ "gem-elm": "./bin/gem-elm.js"
25
+ },
26
+ "exports": {
27
+ "./theme.js": {
28
+ "types": "./src/browser/theme.d.ts",
29
+ "import": "./dist/default/theme.js",
30
+ "default": "./dist/default/theme.js"
31
+ },
32
+ "./theme.css": "./dist/default/theme.css",
33
+ "./boot": {
34
+ "types": "./dist/browser/boot.d.ts",
35
+ "import": "./dist/browser/boot.js"
36
+ },
37
+ "./runtime": {
38
+ "types": "./dist/browser/runtime.d.ts",
39
+ "import": "./dist/browser/runtime.js"
40
+ },
41
+ "./router": {
42
+ "types": "./dist/browser/router.d.ts",
43
+ "import": "./dist/browser/router.js"
44
+ },
45
+ "./build": {
46
+ "types": "./dist/node/build.d.ts",
47
+ "import": "./dist/node/build.js"
48
+ },
49
+ "./css": "./src/styles/theme.scss",
50
+ "./source/core/*": "./src/core/*",
51
+ "./source/app/*": "./src/app/*",
52
+ "./source/ui/*": "./src/ui/*",
53
+ "./source/styles/*": "./src/styles/*",
54
+ "./source/elm.json": "./elm.json",
55
+ "./fonts/*": "./assets/fonts/*",
56
+ "./package.json": "./package.json"
57
+ },
58
+ "files": [
59
+ "bin/gem-elm.js",
60
+ "dist",
61
+ "src/browser/theme.d.ts",
62
+ "src/core",
63
+ "src/app",
64
+ "src/ui",
65
+ "src/styles",
66
+ "assets/fonts",
67
+ "elm.json",
68
+ "LICENSE",
69
+ "NOTICE"
70
+ ],
71
+ "scripts": {
72
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
73
+ "theme:elm": "node dist/node/cli.js src/app/Gem/Main.elm dist/default/theme.js",
74
+ "theme:css": "sass src/styles/theme.scss dist/default/theme.css --no-source-map",
75
+ "theme:js": "tsc -p tsconfig.browser.json && tsc -p tsconfig.node.json && chmod +x dist/node/cli.js",
76
+ "build": "bun run clean && bun run theme:js && bun run theme:elm && bun run theme:css",
77
+ "prepack": "bun run build"
78
+ },
79
+ "dependencies": {
80
+ "@charmland/gem-compiler": "0.1.1"
81
+ },
82
+ "devDependencies": {
83
+ "@types/node": "^26.6.5",
84
+ "elm": "0.19.2-0",
85
+ "sass": "^1.105.2",
86
+ "typescript": "^7.0.2"
87
+ }
88
+ }