@colisweb/rescript-toolkit 2.67.0 → 2.67.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 (66) hide show
  1. package/.gitlab-ci.yml +3 -2
  2. package/.yarn/cache/boolbase-npm-1.0.0-965fe9af6d-3e25c80ef6.zip +0 -0
  3. package/.yarn/cache/camelcase-npm-3.0.0-0c65af0c7f-ae4fe1c17c.zip +0 -0
  4. package/.yarn/cache/comma-separated-tokens-npm-1.0.8-00dbbf3418-0adcb07174.zip +0 -0
  5. package/.yarn/cache/css-selector-parser-npm-1.4.1-b8c642c4c5-31948754e5.zip +0 -0
  6. package/.yarn/cache/fault-npm-2.0.1-c462630f58-c9b30f47d9.zip +0 -0
  7. package/.yarn/cache/format-npm-0.2.2-679f3acc64-646a60e133.zip +0 -0
  8. package/.yarn/cache/github-slugger-npm-2.0.0-3afba76e6c-250375cde2.zip +0 -0
  9. package/.yarn/cache/hast-util-has-property-npm-1.0.4-a09b607810-23025cee66.zip +0 -0
  10. package/.yarn/cache/hast-util-has-property-npm-2.0.1-aa6919669c-cc909b7e29.zip +0 -0
  11. package/.yarn/cache/hast-util-heading-rank-npm-2.1.1-0d71da5801-a49233e9ac.zip +0 -0
  12. package/.yarn/cache/hast-util-is-element-npm-1.1.0-be10e62fa7-30fad3f65e.zip +0 -0
  13. package/.yarn/cache/hast-util-is-element-npm-2.1.3-3051d610ff-9d988f6839.zip +0 -0
  14. package/.yarn/cache/hast-util-select-npm-1.0.1-115974f390-9cdb20850f.zip +0 -0
  15. package/.yarn/cache/hast-util-to-string-npm-2.0.0-c6108aa2b8-0c087f8dee.zip +0 -0
  16. package/.yarn/cache/hast-util-to-text-npm-3.1.2-922eb1f623-d17cf3344c.zip +0 -0
  17. package/.yarn/cache/hast-util-whitespace-npm-1.0.4-43bb1ff3d0-b7f4a1942b.zip +0 -0
  18. package/.yarn/cache/{husky-npm-8.0.2-46c70b41ed-e101656fcb.zip → husky-npm-8.0.3-b0b59c5127-837bc7e441.zip} +0 -0
  19. package/.yarn/cache/lowlight-npm-2.8.0-c65abb6cac-c45a91e715.zip +0 -0
  20. package/.yarn/cache/not-npm-0.1.0-a1712708cd-8043bb53bc.zip +0 -0
  21. package/.yarn/cache/nth-check-npm-1.0.2-3f6d0d22eb-59e115fdd7.zip +0 -0
  22. package/.yarn/cache/property-information-npm-3.2.0-ae434c241d-ed2614520d.zip +0 -0
  23. package/.yarn/cache/rehype-add-classes-npm-1.0.0-ddf6b4e74d-25c0e2dbf5.zip +0 -0
  24. package/.yarn/cache/rehype-autolink-headings-npm-6.1.1-fe8058cc11-60782fb2e5.zip +0 -0
  25. package/.yarn/cache/rehype-highlight-npm-6.0.0-5179257139-5a70e7ad45.zip +0 -0
  26. package/.yarn/cache/rehype-slug-npm-5.1.0-ae08840ba8-2a7c17fd74.zip +0 -0
  27. package/.yarn/cache/space-separated-tokens-npm-1.1.5-2352c83473-8ef68f1cfa.zip +0 -0
  28. package/.yarn/cache/unist-util-find-after-npm-4.0.0-11b3b7fb4f-8381ef0bad.zip +0 -0
  29. package/.yarn/cache/zwitch-npm-1.0.5-5911cef6ce-28a1bebaca.zip +0 -0
  30. package/.yarn/install-state.gz +0 -0
  31. package/package.json +8 -5
  32. package/playground/{App.res → PlaygroundApp.res} +14 -7
  33. package/playground/PlaygroundComponents.res +109 -0
  34. package/playground/PlaygroundLocales.res +1 -0
  35. package/playground/PlaygroundRouter.res +23 -0
  36. package/playground/{CodeBlock.res → Playground_CodeBlock.res} +12 -16
  37. package/playground/{stories/IntroductionColors.stories.mdx → design/DesignSystem_Colors.mdx} +0 -0
  38. package/playground/{stories/IntroductionFonts.stories.mdx → design/DesignSystem_Fonts.mdx} +0 -0
  39. package/playground/{stories/IntroductionMediaQueries.stories.mdx → design/DesignSystem_MediaQueries.mdx} +0 -0
  40. package/playground/design/Playground_DesignSystem.res +12 -0
  41. package/playground/{stories/TailwindConfigBreakpoints.js → design/TailwindConfigBreakpoints.jsx} +1 -1
  42. package/playground/{stories/TailwindConfigColorsPreview.js → design/TailwindConfigColorsPreview.jsx} +1 -1
  43. package/playground/{stories/TailwindConfigFontsPreview.js → design/TailwindConfigFontsPreview.jsx} +1 -1
  44. package/playground/docs/ApiDecoding.mdx +70 -0
  45. package/playground/docs/Form.mdx +109 -0
  46. package/playground/docs/Identifiers.mdx +38 -0
  47. package/playground/{Doc.res → docs/Playground_Docs.res} +8 -8
  48. package/playground/docs/Primitives.mdx +53 -0
  49. package/playground/docs/Request.mdx +281 -0
  50. package/playground/docs/Router.mdx +43 -0
  51. package/playground/docs/Setup.mdx +58 -0
  52. package/playground/docs/Unleash.mdx +53 -0
  53. package/playground/main.jsx +1 -1
  54. package/src/intl/Toolkit__Intl.res +5 -9
  55. package/src/intl/Toolkit__Intl.resi +1 -0
  56. package/src/logger/Toolkit__BrowserLogger.res +15 -15
  57. package/src/tailwind/tailwind.config.cjs +3 -5
  58. package/vite.config.js +43 -1
  59. package/.yarn/cache/cosmiconfig-npm-7.0.0-b9d0d7d156-6801feaa02.zip +0 -0
  60. package/.yarn/cache/import-fresh-npm-3.3.0-3e34265ca9-2cacfad06e.zip +0 -0
  61. package/.yarn/cache/klona-npm-2.0.4-6bc4e7cd86-abc6690882.zip +0 -0
  62. package/.yarn/cache/postcss-loader-npm-4.2.0-f01fec2503-c45ec1ca1b.zip +0 -0
  63. package/.yarn/cache/semver-npm-7.3.4-4c3baf0ead-96451bfd7c.zip +0 -0
  64. package/playground/Playground_Component.res +0 -33
  65. package/playground/Playground_ComponentDetails.res +0 -25
  66. package/playground/Playground_ComponentsList.res +0 -43
package/vite.config.js CHANGED
@@ -3,14 +3,56 @@ import react from "@vitejs/plugin-react";
3
3
  import createReScriptPlugin from "@jihchi/vite-plugin-rescript";
4
4
  import mdx from "@mdx-js/rollup";
5
5
  import fs from "fs";
6
+ import addClasses from "rehype-add-classes";
7
+ import rehypeHighlight from "rehype-highlight";
8
+ import rescriptHighlight from "./playground/utils/rescript-highlight";
9
+ import rehypeAutolinkHeadings from "rehype-autolink-headings";
10
+ import rehypeSlug from "rehype-slug";
6
11
 
7
12
  const appDirectory = fs.realpathSync(process.cwd());
13
+ const isProduction = process.env.NODE_ENV === "production";
8
14
 
9
15
  export default defineConfig({
10
- plugins: [mdx(), createReScriptPlugin(), react()],
16
+ base: isProduction ? "/colisweb-open-source/rescript-toolkit/" : "",
17
+ build: {
18
+ sourcemap: true,
19
+ },
20
+ plugins: [
21
+ mdx({
22
+ rehypePlugins: [
23
+ [
24
+ addClasses,
25
+ {
26
+ h1: "text-4xl",
27
+ h2: "text-3xl",
28
+ h3: "text-2xl",
29
+ "h1,h2,h3,h4": "font-display font-bold underline mb-1",
30
+ p: "mb-1",
31
+ pre: "bg-white p-2 rounded-lg border my-4 block",
32
+ ul: "list-disc",
33
+ },
34
+ ],
35
+ [rehypeSlug],
36
+ [rehypeAutolinkHeadings, { behavior: "wrap" }],
37
+ [
38
+ rehypeHighlight,
39
+ {
40
+ languages: {
41
+ rescript: rescriptHighlight,
42
+ },
43
+ },
44
+ ],
45
+ ],
46
+ }),
47
+ createReScriptPlugin(),
48
+ react(),
49
+ ],
11
50
  define: {
12
51
  global: {},
13
52
  },
53
+ optimizeDeps: {
54
+ include: ["highlight.js"],
55
+ },
14
56
  resolve: {
15
57
  alias: [
16
58
  {
@@ -1,33 +0,0 @@
1
- module type Config = {
2
- let resi: string
3
- let codeExample: string
4
- @react.component
5
- let make: unit => React.element
6
- }
7
-
8
- module ComponentDetails = {
9
- @react.component
10
- let make = (~component: module(Config)) => {
11
- let module(Config) = component
12
- <div>
13
- <ReachUi.Tabs>
14
- <ReachUi.TabList className="mb-4">
15
- <ReachUi.Tab> {"Example"->React.string} </ReachUi.Tab>
16
- <ReachUi.Tab> {"Code example"->React.string} </ReachUi.Tab>
17
- <ReachUi.Tab> {"API"->React.string} </ReachUi.Tab>
18
- </ReachUi.TabList>
19
- <ReachUi.TabPanels>
20
- <ReachUi.TabPanel>
21
- <Config />
22
- </ReachUi.TabPanel>
23
- <ReachUi.TabPanel>
24
- <CodeBlock> {Config.codeExample->React.string} </CodeBlock>
25
- </ReachUi.TabPanel>
26
- <ReachUi.TabPanel>
27
- <CodeBlock> {Config.resi->React.string} </CodeBlock>
28
- </ReachUi.TabPanel>
29
- </ReachUi.TabPanels>
30
- </ReachUi.Tabs>
31
- </div>
32
- }
33
- }
@@ -1,25 +0,0 @@
1
- @react.component
2
- let make = (~component: string) => {
3
- PlaygroundRouter.Breadcrumb.use([
4
- {
5
- route: Components(List),
6
- text: "Components"->React.string,
7
- },
8
- {
9
- route: Components(Details(component)),
10
- text: <span className="capitalize"> {`${component}`->React.string} </span>,
11
- },
12
- ])
13
- <div>
14
- <h1 className="text-4xl font-bold font-display mb-4 capitalize"> {component->React.string} </h1>
15
- <div>
16
- {Playground_ComponentsList.components
17
- ->Array.getBy(((name, _)) => {
18
- component === name
19
- })
20
- ->Option.mapWithDefault("unknown"->React.string, ((_, playgroundModule)) => {
21
- <Playground_Component.ComponentDetails component={playgroundModule} />
22
- })}
23
- </div>
24
- </div>
25
- }
@@ -1,43 +0,0 @@
1
- let components: array<(string, module(Playground_Component.Config))> = [
2
- ("card", module(Playground_Card)),
3
- ("switch", module(Playground_Switch)),
4
- ]
5
-
6
- module ComponentLink = {
7
- @react.component
8
- let make = (~name) => {
9
- <PlaygroundRouter.Link
10
- route={Components(Details(name))}
11
- className="p-4 rounded-lg border bg-white hover:border-primary-700 w-64">
12
- <strong className="capitalize"> {name->React.string} </strong>
13
- </PlaygroundRouter.Link>
14
- }
15
- }
16
-
17
- @react.component
18
- let make = () => {
19
- let (search, setSearch) = React.useState(() => "")
20
-
21
- <div>
22
- <h1 className="text-4xl font-bold font-display mb-4 flex flex-row gap-4 items-center">
23
- {"Components"->React.string}
24
- <input
25
- type_="search"
26
- placeholder="Search"
27
- value={search}
28
- onChange={event => {
29
- let target = event->ReactEvent.Form.target
30
-
31
- setSearch(_ => target["value"])
32
- }}
33
- className="bg-white text-sm font-sans px-4 font-normal rounded-md border border-neutral-300 focus:border-primary-700 h-10 w-60"
34
- />
35
- </h1>
36
- <div className="flex flex-row flex-wrap gap-4">
37
- {components
38
- ->Array.keep(((name, _)) => name->Js.String2.toLowerCase->Js.String2.includes(search))
39
- ->Array.map(((name, _)) => <ComponentLink name />)
40
- ->React.array}
41
- </div>
42
- </div>
43
- }