Skip to content

Commit d052d92

Browse files
committed
Update playground to let select the flavor
1 parent 77bc575 commit d052d92

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

‎playground/src/App.vue

+20
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77
<p class="text-sm font-normal mt-2 text-slate-300">
88
Tiny Language Detector, simply detect the language of a unicode UTF-8 text
99
</p>
10+
<div class="flex justify-between mt-4">
11+
<div class="flex items-center px-4 py-2 rounded border border-gray-200 dark:border-gray-700 bg-slate-200">
12+
<input id="bordered-radio-2" type="radio" v-model="flavor" value="tinyld-light" name="bordered-radio" class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
13+
<label for="bordered-radio-2" class="ml-2 w-full text-sm font-medium text-gray-900 dark:text-gray-300">TinyLD Light <span class="text-slate-400">~65KB</span></label>
14+
</div>
15+
<div class="flex items-center px-4 py-2 rounded border border-gray-200 dark:border-gray-700 bg-slate-200">
16+
<input id="bordered-radio-1" type="radio" v-model="flavor" value="tinyld" name="bordered-radio" class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
17+
<label for="bordered-radio-1" class="ml-2 w-full text-sm font-medium text-gray-900 dark:text-gray-300">TinyLD <span class="text-slate-400">~500KB</span></label>
18+
</div>
19+
<div class="flex items-center px-4 py-2 rounded border border-gray-200 dark:border-gray-700 bg-slate-200">
20+
<input id="bordered-radio-3" type="radio" v-model="flavor" value="tinyld-heavy" name="bordered-radio" class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
21+
<label for="bordered-radio-3" class="ml-2 w-full text-sm font-medium text-gray-900 dark:text-gray-300">TinyLD Heavy <span class="text-slate-400">~2MB</span></label>
22+
</div>
23+
</div>
1024
<textarea
1125
rows="8"
1226
v-model="input"
@@ -68,12 +82,18 @@
6882
<script setup>
6983
import { ref, computed } from 'vue'
7084
import { detectAll } from 'tinyld'
85+
import { detectAll as detectAllLight } from 'tinyld/light'
86+
import { detectAll as detectAllHeavy } from 'tinyld/heavy'
7187
import { useClipboard } from '@vueuse/core'
7288
7389
const input = ref('')
90+
const flavor = ref('tinyld')
7491
const results = computed(() => {
92+
if (flavor.value === "tinyld-light") return detectAllLight(input.value)
93+
if (flavor.value === "tinyld-heavy") return detectAllHeavy(input.value)
7594
return detectAll(input.value)
7695
})
96+
7797
const link = computed(() => {
7898
return `https://tinyld.vercel.app/?text=${encodeURIComponent(input.value)}`
7999
})

‎playground/src/main.js

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ library.add(faGithub)
1212
library.add(faChartLine)
1313
library.add(faShareFromSquare)
1414
library.add(faCircleQuestion)
15-
console.log(faShareFromSquare)
1615

1716
const app = createApp(App)
1817
app.component('v-icon', FontAwesomeIcon)

‎playground/yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,9 @@ tailwindcss@^3.2.3:
741741
resolve "^1.22.1"
742742

743743
tinyld@^1.3.1:
744-
version "1.3.1"
745-
resolved "https://registry.yarnpkg.com/tinyld/-/tinyld-1.3.1.tgz#048388a01f03f283911183af733c7b079fdcbc5a"
746-
integrity sha512-INB2is03ygze5dUeAp5wCYBUf/+FsXcElCmfewe1ujirCUTe4nGUNDN229Ay/C2W+f15qD7uhclstNHY+a6fgg==
744+
version "1.3.2"
745+
resolved "https://registry.yarnpkg.com/tinyld/-/tinyld-1.3.2.tgz#6a5a639a60183ad5cb5110fad1f7be70139bf5c6"
746+
integrity sha512-VBeK+qS2mDggbJpNm+iCitULKbrJnkdvv3Lm/ptSVRBzKaPS/LXGKCByrascOFaFGYZM5sXT2JyqfcHKp9a2kg==
747747

748748
to-regex-range@^5.0.1:
749749
version "5.0.1"

0 commit comments

Comments
 (0)