Skip to content

Commit 2f45d55

Browse files
authored
Merge pull request #70 from Semantic-Org/feat/tailwind4
Feat/tailwind4
2 parents dd7e813 + 4455570 commit 2f45d55

File tree

40 files changed

+2597
-661
lines changed

40 files changed

+2597
-661
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ dist/
1010
tests/results/
1111
tests/test-case/dist
1212

13+
# for my ai friends
14+
ai/meta/agent-guestbook.md
15+
1316
# Numerous always-ignore extensions
1417
*.diff
1518
*.err

RELEASE-NOTES.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ This is a pre-release version and APIs will change quickly. Before `1.0` release
44

55
Please note after `1.0` Semver will be followed using normal protocols.
66

7+
# Version 0.12.0
8+
* **Tailwind** - Added a plugin for using Tailwind inside Semantic UI components. This can be used alongside the css tokens provided by the css framework, or instead of it. This will scan your component javascript, html and css and attach only the tailwind styles used.
9+
10+
> Note: the plugin code may be modified if `defineComponent` gets a formal 'Plugin API'. For now you will need to pass in the component to the plugin before defining the component.
11+
12+
13+
```javascript
14+
import { TailwindPlugin } from '@semantic-ui/tailwind';
15+
const tailwindPlugin = TailwindPlugin();
16+
17+
18+
// Transform with Tailwind plugin
19+
const definition = {
20+
// your component definition
21+
template: `<div class="p-4 bg-red-500"></div>`
22+
}
23+
defineComponent( await tailwindPlugin(definition) );
24+
25+
```
26+
27+
* **Template Compiler** - Fixed an issue with nested conditionals inside svg.
28+
729
# Version 0.11.3
830
* **Input** - Fix placeholder focused color to be theme aware
931

docs/astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default defineConfig({
6363
},
6464
optimizeDeps: {
6565
force: true,
66-
exclude: ['playground-elements'],
66+
exclude: ['playground-elements', 'tailwindcss-iso'],
6767
},
6868
},
6969

docs/src/components/CodePlayground/CodePlayground.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ const createComponent = (
398398
// and the right pane is just the iframe preview
399399
if (filter && self.onlyPageFiles(fileArray)) {
400400
if (filter == 'main') {
401-
console.log(fileArray.filter(file => self.isPageFile(file.filename)));
402401
return fileArray.filter(file => self.isPageFile(file.filename));
403402
}
404403
else if (filter == 'page') {

docs/src/content/examples/cdn.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 'CDN'
33
exampleType: 'page'
4-
category: 'UI Framework'
4+
category: 'Components'
55
subcategory: 'Usage'
66
tags: ['component', 'usage']
77
description: An example of using the component framework from a cdn
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: 'Tailwind'
3+
exampleType: 'component'
4+
category: 'Components'
5+
subcategory: 'Usage'
6+
fold: false
7+
tags: ['component', 'usage']
8+
description: An example of using Tailwinds with web components
9+
---
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
Example using @theme inside a component
3+
4+
*/
5+
6+
@theme {
7+
/* This changes the bluish grays to a monochrome color */
8+
--color-gray-100: theme(colors.zinc.100);
9+
--color-gray-300: theme(colors.zinc.300);
10+
--color-gray-700: theme(colors.zinc.700);
11+
--color-gray-950: theme(colors.zinc.950);
12+
}
13+
14+
/* this allows us to add "dark" class to component to trigger dark mode */
15+
@custom-variant dark (&:where(.dark, .dark *));
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{#snippet bullet}
2+
<li class="flex">
3+
<svg class="h-6 w-6 flex-shrink-0" viewBox="0 0 22 22" fill="none" stroke-linecap="square">
4+
<circle cx="11" cy="11" r="11" class="fill-sky-400 opacity-25" />
5+
<circle cx="11" cy="11" r="10.5" class="stroke-sky-400 opacity-25" />
6+
<path d="M8 11.5L10.5 14L14 8" class="stroke-sky-800 dark:stroke-sky-300" />
7+
</svg>
8+
<p class="ml-3">
9+
{#html content}
10+
</p>
11+
</li>
12+
{/snippet}
13+
14+
<div class="component {darkMode ? 'dark' : ''}">
15+
<div class="relative grid min-h-screen grid-cols-[1fr_2.5rem_auto_2.5rem_1fr] grid-rows-[1fr_1px_auto_1px_1fr] bg-white [--pattern-fg:var(--color-gray-950)]/5 dark:bg-gray-950 dark:[--pattern-fg:var(--color-white)]/10">
16+
<div class="col-start-3 row-start-3 flex max-w-lg flex-col bg-gray-100 p-2 dark:bg-white/10">
17+
<div class="rounded-xl bg-white p-10 text-sm/7 text-gray-700 dark:bg-gray-950 dark:text-gray-300">
18+
<img src="https://play.tailwindcss.com/img/logo.svg" class="mb-12 h-6 dark:hidden" alt="Tailwind Play" />
19+
<img src="https://play.tailwindcss.com/img/logo-dark.svg" class="mb-12 h-6 hidden dark:block" alt="Tailwind Play" />
20+
<div class="space-y-6">
21+
<p>An advanced online playground for Tailwind CSS, including support for things like:</p>
22+
<ul class="space-y-3">
23+
{#each item in proofPoints}
24+
{>bullet content=item}
25+
{/each}
26+
</ul>
27+
<p>Perfect for learning how the framework works, prototyping a new idea, or creating a demo to share online.</p>
28+
</div>
29+
<hr class="my-6 w-full border-gray-200 dark:border-gray-700" />
30+
<p class="mb-3">Want to dig deeper into Tailwind?</p>
31+
<ui-button primary href="https://tailwindcss.com/docs" icon="open book">Read the docs</ui-button>
32+
</div>
33+
</div>
34+
<div class="relative -right-px col-start-2 row-span-full row-start-1 border-x border-x-(--pattern-fg) bg-[image:repeating-linear-gradient(315deg,_var(--pattern-fg)_0,_var(--pattern-fg)_1px,_transparent_0,_transparent_50%)] bg-[size:10px_10px] bg-fixed"></div>
35+
<div class="relative -left-px col-start-4 row-span-full row-start-1 border-x border-x-(--pattern-fg) bg-[image:repeating-linear-gradient(315deg,_var(--pattern-fg)_0,_var(--pattern-fg)_1px,_transparent_0,_transparent_50%)] bg-[size:10px_10px] bg-fixed"></div>
36+
<div class="relative -bottom-px col-span-full col-start-1 row-start-2 h-px bg-(--pattern-fg)"></div>
37+
<div class="relative -top-px col-span-full col-start-1 row-start-4 h-px bg-(--pattern-fg)"></div>
38+
</div>
39+
</div>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineComponent, getText } from '@semantic-ui/component';
2+
import { TailwindPlugin } from '@semantic-ui/tailwind';
3+
4+
const template = await getText('./component.html');
5+
const css = await getText('./component.css');
6+
7+
const defaultSettings = {
8+
proofPoints: [],
9+
};
10+
11+
let definition = {
12+
tagName: 'tailwind-demo',
13+
template,
14+
css,
15+
defaultSettings,
16+
};
17+
18+
// Transform with Tailwind plugin
19+
definition = await TailwindPlugin(definition);
20+
21+
export const TailwindDemo = defineComponent(definition);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
html {
2+
/*
3+
note tailwind base em size is 16px instead of semantic ui's 14px
4+
this means to have everything sized the same as other tailwind projects
5+
when using sui + tailwinds you will want to resize semantic components
6+
*/
7+
--font-size: 16px;
8+
}

0 commit comments

Comments
 (0)