@flickfyi/flkr 0.0.182 → 0.0.185
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.
- package/dist/{api-client-CAg1b8Bh.js → api-client-nn4U_Vfn.js} +1 -1
- package/dist/{app-DpM5nhb9.js → app-COXGJhrt.js} +3 -3
- package/dist/{bundler-DNrDcqyk.js → bundler-CW4YC73e.js} +4 -2
- package/dist/cli.js +11 -11
- package/dist/{delegate-DcVye0KE.js → delegate-aUVluBjB.js} +2 -2
- package/dist/{generate-B1l1z_FZ.js → generate-BeL1QPDi.js} +1 -1
- package/dist/{preview-Dqn_Tq6K.js → preview-DTVM8Csb.js} +2 -2
- package/dist/{publish-BmDqO1xU.js → publish-BJG-s-w5.js} +4 -4
- package/dist/{pull-CO80DMn8.js → pull-B_Yfjpi2.js} +1 -1
- package/dist/{save-8crfOeo1.js → save-UrfgmK2-.js} +2 -2
- package/dist/{sdk-app-BXWrf_pf.js → sdk-app-BAxznAf9.js} +3 -3
- package/dist/{sdk-deploy-CaEonlvx.js → sdk-deploy-D1wgQxse.js} +3 -3
- package/dist/{sdk-generation-CF8ATbrL.js → sdk-generation-CLQ-QrVM.js} +1 -1
- package/dist/{sdk-project-CKV3U3u9.js → sdk-project-BaO0fqhW.js} +1 -1
- package/dist/{use-auth-B6nwU2rp.js → use-auth-CtM4_BAY.js} +1 -1
- package/node_modules/@flickfyi/biscuit/.turbo/turbo-build.log +4 -4
- package/node_modules/@flickfyi/core/README.md +19 -9
- package/node_modules/@flickfyi/core/dist/chunks/{default-CuxDsQoM.js → default-BTmKidHV.js} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{default-BB6YexEH.cjs → default-JhTq5I_y.cjs} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{define-CUJRqVKY.cjs → define-BKCRhpuY.cjs} +1 -1
- package/node_modules/@flickfyi/core/dist/chunks/{define-e_VqSs4M.js → define-DZXgUsy7.js} +5 -5
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.js +728 -549
- package/node_modules/@flickfyi/core/dist/kowalski/index.cjs +5 -5
- package/node_modules/@flickfyi/core/dist/kowalski/index.js +4297 -3700
- package/node_modules/@flickfyi/core/dist/kowalski/schemas.cjs +1 -0
- package/node_modules/@flickfyi/core/dist/kowalski/schemas.js +637 -0
- package/node_modules/@flickfyi/core/dist/kowalski-catalog.css +516 -0
- package/node_modules/@flickfyi/core/dist/kowalski.css +10 -0
- package/node_modules/@flickfyi/core/dist/themes/athletic/athletic.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/athletic/athletic.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/compact/compact.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/compact/compact.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/default/default.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/default/default.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/editorial/editorial.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/editorial/editorial.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/handwritten/handwritten.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/handwritten/handwritten.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/index.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/kids/kids.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/kids/kids.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/rounded/rounded.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/rounded/rounded.js +1 -1
- package/node_modules/@flickfyi/core/dist/themes/technical/technical.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/themes/technical/technical.js +1 -1
- package/node_modules/@flickfyi/core/dist-types/hooks/use-feature-store/index.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/calculations.d.ts +57 -3
- package/node_modules/@flickfyi/core/dist-types/kowalski/calculator.d.ts +7 -6
- package/node_modules/@flickfyi/core/dist-types/kowalski/catalog.d.cts +524 -809
- package/node_modules/@flickfyi/core/dist-types/kowalski/catalog.d.ts +524 -809
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/bill-split.d.ts +38 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/bookmark.d.ts +48 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/budget.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/calculator.d.ts +62 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/checklist.d.ts +35 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/color-palette.d.ts +32 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/contact.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/countdown.d.ts +34 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/event.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/expense.d.ts +40 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/goal.d.ts +36 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/habit.d.ts +57 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/ledger.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/note.d.ts +35 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/poll.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/random-picker.d.ts +69 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/rating.d.ts +33 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/reminder.d.ts +48 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/rotation.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/scoreboard.d.ts +37 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/shopping-list.d.ts +41 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/task-board.d.ts +39 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/time-zone.d.ts +34 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/timer.d.ts +43 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/trip.d.ts +61 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/components/unit-converter.d.ts +106 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/create-schemas.d.ts +6 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/date-time.d.ts +1 -1
- package/node_modules/@flickfyi/core/dist-types/kowalski/everyday.d.ts +28 -8
- package/node_modules/@flickfyi/core/dist-types/kowalski/feature-schema.d.ts +65 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/format.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/fortune.d.ts +21 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/frame.d.ts +4 -4
- package/node_modules/@flickfyi/core/dist-types/kowalski/index.d.cts +31 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/index.d.ts +31 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/lesson.d.ts +89 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/recipe.d.ts +129 -8
- package/node_modules/@flickfyi/core/dist-types/kowalski/schemas.d.cts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/schemas.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist-types/kowalski/time-since.d.ts +34 -0
- package/node_modules/@flickfyi/core/examples/example-metadata.ts +19 -2
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.stories.tsx +25 -6
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.tsx +6 -12
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.stories.tsx +19 -6
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.tsx +6 -17
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.stories.tsx +30 -5
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.stories.tsx +23 -5
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.stories.tsx +23 -5
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/fortune/fortune.stories.tsx +61 -0
- package/node_modules/@flickfyi/core/examples/kowalski/fortune/fortune.tsx +11 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.tsx +3 -19
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.tsx +6 -20
- package/node_modules/@flickfyi/core/examples/kowalski/lesson/lesson.stories.tsx +99 -0
- package/node_modules/@flickfyi/core/examples/kowalski/lesson/lesson.tsx +11 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.stories.tsx +21 -5
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.tsx +3 -17
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.tsx +3 -21
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.stories.tsx +37 -6
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.tsx +6 -14
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.stories.tsx +117 -5
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.tsx +6 -115
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.stories.tsx +22 -5
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.stories.tsx +26 -5
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.tsx +6 -21
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.stories.tsx +28 -6
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.stories.tsx +27 -6
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.tsx +6 -22
- package/node_modules/@flickfyi/core/examples/kowalski/time-since/time-since.stories.tsx +33 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-since/time-since.tsx +12 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.stories.tsx +22 -6
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.tsx +6 -17
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.stories.tsx +18 -5
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.tsx +6 -18
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.stories.tsx +25 -5
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.tsx +3 -21
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.stories.tsx +19 -6
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.tsx +6 -19
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.tsx +2 -13
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.tsx +4 -9
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/list/list.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/list/list.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/log/log.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/log/log.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.tsx +0 -8
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.stories.tsx +10 -3
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.tsx +0 -8
- package/node_modules/@flickfyi/core/package.json +16 -3
- package/node_modules/@flickfyi/core/src/{kowalski/use-configured-feature.ts → hooks/use-configured-feature/index.ts} +1 -1
- package/node_modules/@flickfyi/core/src/{kowalski/use-feature-store.ts → hooks/use-feature-store/index.ts} +37 -12
- package/node_modules/@flickfyi/core/src/kowalski/README.md +13 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculations.ts +36 -8
- package/node_modules/@flickfyi/core/src/kowalski/calculator.ts +15 -7
- package/node_modules/@flickfyi/core/src/kowalski/catalog.ts +110 -704
- package/node_modules/@flickfyi/core/src/kowalski/components/bill-split.tsx +284 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/bookmark.tsx +347 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/budget.tsx +169 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/calculator.tsx +202 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/checklist.tsx +119 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/color-palette.tsx +302 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/contact.tsx +247 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/countdown.tsx +173 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/event.tsx +260 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/expense.tsx +257 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/goal.tsx +182 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/habit.tsx +272 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/ledger.tsx +211 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/note.tsx +188 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/poll.tsx +242 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/random-picker.tsx +308 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/rating.tsx +112 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/reminder.tsx +298 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/rotation.tsx +146 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/scoreboard.tsx +139 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/shopping-list.tsx +144 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/task-board.tsx +146 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/time-zone.tsx +240 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/timer.tsx +225 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/trip.tsx +338 -0
- package/node_modules/@flickfyi/core/src/kowalski/components/unit-converter.tsx +285 -0
- package/node_modules/@flickfyi/core/src/kowalski/create-schemas.ts +8 -0
- package/node_modules/@flickfyi/core/src/kowalski/date-time.tsx +1 -1
- package/node_modules/@flickfyi/core/src/kowalski/everyday.tsx +1 -640
- package/node_modules/@flickfyi/core/src/kowalski/feature-schema.ts +84 -0
- package/node_modules/@flickfyi/core/src/kowalski/format.ts +29 -3
- package/node_modules/@flickfyi/core/src/kowalski/fortune.tsx +67 -0
- package/node_modules/@flickfyi/core/src/kowalski/frame.tsx +5 -6
- package/node_modules/@flickfyi/core/src/kowalski/index.ts +31 -22
- package/node_modules/@flickfyi/core/src/kowalski/lesson.tsx +564 -0
- package/node_modules/@flickfyi/core/src/kowalski/recipe.tsx +78 -37
- package/node_modules/@flickfyi/core/src/kowalski/schemas.ts +67 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.tsx +22 -20
- package/node_modules/@flickfyi/core/src/kowalski/time-since.tsx +145 -0
- package/node_modules/@flickfyi/core/src/molecules/progress/progress.tsx +4 -1
- package/node_modules/@flickfyi/core/src/oklch.ts +1 -6
- package/node_modules/@flickfyi/core/src/parrott/theme.ts +3 -1
- package/node_modules/@flickfyi/core/src/themes/editorial/editorial.ts +6 -1
- package/node_modules/@flickfyi/core/src/themes/palette.ts +5 -5
- package/node_modules/@flickfyi/core/src/themes/stories/composition.tsx +11 -9
- package/node_modules/@flickfyi/core/src/themes/stories/gallery.tsx +7 -11
- package/node_modules/@flickfyi/core/tsgo.bun.lock +7 -7
- package/node_modules/@flickfyi/core/tsgo.package.json +1 -1
- package/package.json +2 -2
- package/node_modules/@flickfyi/core/dist-types/kowalski/clocks.d.ts +0 -4
- package/node_modules/@flickfyi/core/dist-types/kowalski/details.d.ts +0 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/productivity.d.ts +0 -5
- package/node_modules/@flickfyi/core/dist-types/kowalski/tools.d.ts +0 -7
- package/node_modules/@flickfyi/core/dist-types/kowalski/use-feature-store.d.ts +0 -15
- package/node_modules/@flickfyi/core/src/kowalski/clocks.tsx +0 -464
- package/node_modules/@flickfyi/core/src/kowalski/details.tsx +0 -1387
- package/node_modules/@flickfyi/core/src/kowalski/productivity.tsx +0 -575
- package/node_modules/@flickfyi/core/src/kowalski/tools.tsx +0 -1213
- /package/node_modules/@flickfyi/core/dist-types/{kowalski/use-clock.d.ts → hooks/use-clock/index.d.ts} +0 -0
- /package/node_modules/@flickfyi/core/dist-types/{kowalski/use-configured-feature.d.ts → hooks/use-configured-feature/index.d.ts} +0 -0
- /package/node_modules/@flickfyi/core/src/{kowalski/use-clock.ts → hooks/use-clock/index.ts} +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Flex, Text } from '@flickfyi/core'
|
|
2
|
+
import { Input } from '@flickfyi/core/atoms'
|
|
3
|
+
import * as stylex from '@stylexjs/stylex'
|
|
4
|
+
import { useMemo, useState } from 'react'
|
|
5
|
+
import { z } from 'zod/v4'
|
|
6
|
+
|
|
7
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
8
|
+
import type { CreateSchemas } from '~/kowalski/create-schemas'
|
|
9
|
+
import { featureFields, replacement, store } from '~/kowalski/feature-schema'
|
|
10
|
+
import { format } from '~/kowalski/format'
|
|
11
|
+
import { FeatureAction, FeatureFrame, FeatureWell } from '~/kowalski/frame'
|
|
12
|
+
import { space } from '~/themes/scale.stylex'
|
|
13
|
+
import { roles } from '~/themes/shared'
|
|
14
|
+
|
|
15
|
+
const defaultId = 'KowalskiNote'
|
|
16
|
+
const defaultScope = 'private'
|
|
17
|
+
|
|
18
|
+
export const NoteData = /* @__PURE__ */ z
|
|
19
|
+
.strictObject({
|
|
20
|
+
body: z.string().describe('The note text, as plain text.'),
|
|
21
|
+
title: z.string().describe('A short heading. Use an empty string for none.'),
|
|
22
|
+
})
|
|
23
|
+
.describe('An editable persistent note. Plain text; no HTML or code execution.')
|
|
24
|
+
|
|
25
|
+
export type NoteData = z.infer<typeof NoteData>
|
|
26
|
+
|
|
27
|
+
export const NoteProps = z.strictObject({
|
|
28
|
+
data: NoteData,
|
|
29
|
+
...featureFields,
|
|
30
|
+
scope: featureFields.scope.default(defaultScope),
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export type NoteProps = z.input<typeof NoteProps> & {
|
|
34
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const noteStoreSchema = store({
|
|
38
|
+
body: replacement(z.string().default('')),
|
|
39
|
+
title: replacement(z.string().default('')),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export const createSchemas: CreateSchemas = ({
|
|
43
|
+
id = defaultId,
|
|
44
|
+
scope = defaultScope,
|
|
45
|
+
} = {}) => ({
|
|
46
|
+
[`stores/${scope}/${id}`]: noteStoreSchema,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
export function Note({ data, id, revision = 0, scope = defaultScope, style }: NoteProps) {
|
|
50
|
+
const schema = noteStoreSchema
|
|
51
|
+
const store = useConfiguredFeature({
|
|
52
|
+
name: id ?? defaultId,
|
|
53
|
+
revision,
|
|
54
|
+
schema,
|
|
55
|
+
scope,
|
|
56
|
+
seed: schema.parse({ body: { value: data.body }, title: { value: data.title } }),
|
|
57
|
+
})
|
|
58
|
+
const [bodyDraft, setBodyDraft] = useState<{ value: string } | null>(null)
|
|
59
|
+
const [titleDraft, setTitleDraft] = useState<{ value: string } | null>(null)
|
|
60
|
+
const body = bodyDraft?.value ?? store.value.body.value
|
|
61
|
+
const title = titleDraft?.value ?? store.value.title.value
|
|
62
|
+
const text = store.ready ? body : store.value.body.value
|
|
63
|
+
const wordCount = useMemo(
|
|
64
|
+
() =>
|
|
65
|
+
[...new Intl.Segmenter('en', { granularity: 'word' }).segment(text)].filter(
|
|
66
|
+
// Older JavaScriptCore versions mark numeric words as non-word-like.
|
|
67
|
+
word => word.isWordLike || /\p{N}/u.test(word.segment)
|
|
68
|
+
).length,
|
|
69
|
+
[text]
|
|
70
|
+
)
|
|
71
|
+
const hasDraft = bodyDraft !== null || titleDraft !== null
|
|
72
|
+
const status = store.ready
|
|
73
|
+
? store.saving
|
|
74
|
+
? 'Saving…'
|
|
75
|
+
: hasDraft || store.error
|
|
76
|
+
? 'Not saved'
|
|
77
|
+
: 'Saved'
|
|
78
|
+
: store.error
|
|
79
|
+
? 'Read-only'
|
|
80
|
+
: 'Loading…'
|
|
81
|
+
return (
|
|
82
|
+
<FeatureFrame
|
|
83
|
+
style={style}
|
|
84
|
+
onRetry={store.retry}
|
|
85
|
+
notice={store.error}
|
|
86
|
+
component="note"
|
|
87
|
+
title={store.value.title.value || 'Untitled note'}
|
|
88
|
+
header={false}
|
|
89
|
+
>
|
|
90
|
+
<FeatureWell>
|
|
91
|
+
{store.ready ? (
|
|
92
|
+
<Input
|
|
93
|
+
multiline
|
|
94
|
+
placeholder="Untitled note"
|
|
95
|
+
value={title}
|
|
96
|
+
onChange={next => {
|
|
97
|
+
const draft = { value: next }
|
|
98
|
+
setTitleDraft(draft)
|
|
99
|
+
store.set(
|
|
100
|
+
() => ({ title: draft }),
|
|
101
|
+
() => setTitleDraft(current => (current === draft ? null : current))
|
|
102
|
+
)
|
|
103
|
+
}}
|
|
104
|
+
style={[roles.h2, noteStyles.page]}
|
|
105
|
+
/>
|
|
106
|
+
) : (
|
|
107
|
+
<Text {...stylex.props(roles.h2)}>
|
|
108
|
+
{store.value.title.value || 'Untitled note'}
|
|
109
|
+
</Text>
|
|
110
|
+
)}
|
|
111
|
+
{store.ready ? (
|
|
112
|
+
<Input
|
|
113
|
+
multiline
|
|
114
|
+
placeholder="Start writing…"
|
|
115
|
+
value={body}
|
|
116
|
+
onChange={next => {
|
|
117
|
+
const draft = { value: next }
|
|
118
|
+
setBodyDraft(draft)
|
|
119
|
+
store.set(
|
|
120
|
+
() => ({ body: draft }),
|
|
121
|
+
() => setBodyDraft(current => (current === draft ? null : current))
|
|
122
|
+
)
|
|
123
|
+
}}
|
|
124
|
+
style={[roles.text, noteStyles.page, noteStyles.body]}
|
|
125
|
+
/>
|
|
126
|
+
) : (
|
|
127
|
+
<Text {...stylex.props(roles.text, noteStyles.body)}>
|
|
128
|
+
{text || (store.error ? 'This note is empty.' : 'Loading note…')}
|
|
129
|
+
</Text>
|
|
130
|
+
)}
|
|
131
|
+
</FeatureWell>
|
|
132
|
+
<Flex {...stylex.props(noteStyles.writing)}>
|
|
133
|
+
<Flex {...stylex.props(noteStyles.footer)}>
|
|
134
|
+
<Text {...stylex.props(roles.muted)}>
|
|
135
|
+
{format.formatMessage(
|
|
136
|
+
{
|
|
137
|
+
defaultMessage: '{count, plural, one {# word} other {# words}}',
|
|
138
|
+
id: 'kowalski.note.words',
|
|
139
|
+
},
|
|
140
|
+
{ count: wordCount }
|
|
141
|
+
)}
|
|
142
|
+
</Text>
|
|
143
|
+
<Text {...stylex.props(roles.muted)}>{status}</Text>
|
|
144
|
+
</Flex>
|
|
145
|
+
{store.ready && !store.saving && hasDraft && (
|
|
146
|
+
<FeatureAction
|
|
147
|
+
component="note"
|
|
148
|
+
onClick={() => {
|
|
149
|
+
store.set(
|
|
150
|
+
() => ({
|
|
151
|
+
...(bodyDraft && { body: bodyDraft }),
|
|
152
|
+
...(titleDraft && { title: titleDraft }),
|
|
153
|
+
}),
|
|
154
|
+
() => {
|
|
155
|
+
setBodyDraft(current => (current === bodyDraft ? null : current))
|
|
156
|
+
setTitleDraft(current => (current === titleDraft ? null : current))
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
Retry save
|
|
162
|
+
</FeatureAction>
|
|
163
|
+
)}
|
|
164
|
+
</Flex>
|
|
165
|
+
</FeatureFrame>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// The note is a page: borderless text on one surface, word count and status below it.
|
|
170
|
+
const noteStyles = /* @__PURE__ */ stylex.create({
|
|
171
|
+
body: { minHeight: space[24] },
|
|
172
|
+
footer: {
|
|
173
|
+
alignItems: 'center',
|
|
174
|
+
flexDirection: 'row',
|
|
175
|
+
flexWrap: 'wrap',
|
|
176
|
+
gap: space[2],
|
|
177
|
+
justifyContent: 'space-between',
|
|
178
|
+
},
|
|
179
|
+
page: {
|
|
180
|
+
backgroundColor: 'transparent',
|
|
181
|
+
borderWidth: 0,
|
|
182
|
+
paddingLeft: 0,
|
|
183
|
+
paddingRight: 0,
|
|
184
|
+
textAlign: 'left',
|
|
185
|
+
width: '100%',
|
|
186
|
+
},
|
|
187
|
+
writing: { gap: space[2] },
|
|
188
|
+
})
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { Flex, Text } from '@flickfyi/core'
|
|
2
|
+
import { Button } from '@flickfyi/core/atoms'
|
|
3
|
+
import * as stylex from '@stylexjs/stylex'
|
|
4
|
+
import { useMemo } from 'react'
|
|
5
|
+
import { z } from 'zod/v4'
|
|
6
|
+
|
|
7
|
+
import { useConfiguredFeature } from '~/hooks/use-configured-feature'
|
|
8
|
+
import { useFeatureStore } from '~/hooks/use-feature-store'
|
|
9
|
+
import { ChecklistData } from '~/kowalski/components/checklist'
|
|
10
|
+
import type { CreateSchemas, CreateSchemasInput } from '~/kowalski/create-schemas'
|
|
11
|
+
import { entries, featureFields } from '~/kowalski/feature-schema'
|
|
12
|
+
import { format } from '~/kowalski/format'
|
|
13
|
+
import { FeatureFrame, FeatureProgress, layout } from '~/kowalski/frame'
|
|
14
|
+
import { radius, size, space } from '~/themes/scale.stylex'
|
|
15
|
+
import { appearance, button, roles } from '~/themes/shared'
|
|
16
|
+
import { colors, shape } from '~/themes/tokens.stylex'
|
|
17
|
+
|
|
18
|
+
const defaultId = 'KowalskiPoll'
|
|
19
|
+
|
|
20
|
+
export const PollData = /* @__PURE__ */ z
|
|
21
|
+
.strictObject({
|
|
22
|
+
options: z
|
|
23
|
+
.array(
|
|
24
|
+
z.strictObject({
|
|
25
|
+
id: z.string().describe('A short ID, unique within this list, e.g. "tent".'),
|
|
26
|
+
label: z.string().describe('One short answer choice.'),
|
|
27
|
+
})
|
|
28
|
+
)
|
|
29
|
+
.describe('Two or more answer choices.'),
|
|
30
|
+
question: z.string().describe('The question being voted on.'),
|
|
31
|
+
shared: z
|
|
32
|
+
.boolean()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe(
|
|
35
|
+
'True only when other people vote on the same poll. Omit for a private poll.'
|
|
36
|
+
),
|
|
37
|
+
})
|
|
38
|
+
.describe(
|
|
39
|
+
'Cast or change a vote and derive totals from votes. Shared voting only when explicitly requested.'
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
export type PollData = z.infer<typeof PollData>
|
|
43
|
+
|
|
44
|
+
export const PollProps = z.strictObject({
|
|
45
|
+
data: PollData,
|
|
46
|
+
...featureFields,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
export type PollProps = z.input<typeof PollProps> & {
|
|
50
|
+
style?: stylex.StyleXArray<stylex.StyleXStyles>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const pollStoreSchema = entries(
|
|
54
|
+
'vote_',
|
|
55
|
+
ChecklistData.shape.items.element.shape.id,
|
|
56
|
+
{}
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
export const createSchemas: CreateSchemas = ({
|
|
60
|
+
id = defaultId,
|
|
61
|
+
scope,
|
|
62
|
+
}: CreateSchemasInput = {}) => {
|
|
63
|
+
const schemas: Record<string, z.ZodType> = {}
|
|
64
|
+
for (const voteScope of scope === undefined ? ['private', 'public'] : [scope]) {
|
|
65
|
+
schemas[`stores/${voteScope}/${id}`] = pollStoreSchema
|
|
66
|
+
schemas[`stores/private/${id}Voter`] = pollVoterSchema
|
|
67
|
+
}
|
|
68
|
+
return schemas
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function Poll({ data, id, revision = 0, style }: PollProps) {
|
|
72
|
+
const options = data.options
|
|
73
|
+
const schema = pollStoreSchema
|
|
74
|
+
const name = id ?? defaultId
|
|
75
|
+
const identity = useMemo(
|
|
76
|
+
() =>
|
|
77
|
+
`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`,
|
|
78
|
+
[name]
|
|
79
|
+
)
|
|
80
|
+
const voter = useFeatureStore({
|
|
81
|
+
initialState: { configuration: '', voter: identity },
|
|
82
|
+
name: `${name}Voter`,
|
|
83
|
+
schema: pollVoterSchema,
|
|
84
|
+
scope: 'private',
|
|
85
|
+
})
|
|
86
|
+
const store = useConfiguredFeature({
|
|
87
|
+
name,
|
|
88
|
+
revision,
|
|
89
|
+
schema,
|
|
90
|
+
scope: data.shared ? 'public' : 'private',
|
|
91
|
+
seed: schema.parse({}),
|
|
92
|
+
})
|
|
93
|
+
const validIds = new Set(options.map(option => option.id))
|
|
94
|
+
const ballotKey = `vote_${voter.value.voter}`
|
|
95
|
+
const votes = Object.entries(store.value)
|
|
96
|
+
.filter(
|
|
97
|
+
([key, id]) => key.startsWith('vote_') && typeof id === 'string' && validIds.has(id)
|
|
98
|
+
)
|
|
99
|
+
.map(([, id]) => id)
|
|
100
|
+
const choice = options.find(option => option.id === store.value[ballotKey])
|
|
101
|
+
const notice = store.error ?? voter.error
|
|
102
|
+
const ready = store.ready && voter.ready
|
|
103
|
+
const loading = !ready && !notice
|
|
104
|
+
const percent = format.formatters.getNumberFormat(format.locale, {
|
|
105
|
+
maximumFractionDigits: 1,
|
|
106
|
+
style: 'percent',
|
|
107
|
+
})
|
|
108
|
+
return (
|
|
109
|
+
<FeatureFrame
|
|
110
|
+
style={style}
|
|
111
|
+
onRetry={
|
|
112
|
+
store.retry || voter.retry
|
|
113
|
+
? () => {
|
|
114
|
+
store.retry?.()
|
|
115
|
+
voter.retry?.()
|
|
116
|
+
}
|
|
117
|
+
: undefined
|
|
118
|
+
}
|
|
119
|
+
notice={notice}
|
|
120
|
+
component="poll"
|
|
121
|
+
title={data.question}
|
|
122
|
+
trailing={
|
|
123
|
+
<Text {...stylex.props(roles.muted)}>
|
|
124
|
+
{loading
|
|
125
|
+
? 'Loading…'
|
|
126
|
+
: format.formatMessage(
|
|
127
|
+
{
|
|
128
|
+
defaultMessage: '{count, plural, one {# vote} other {# votes}}',
|
|
129
|
+
id: 'kowalski.poll.votes',
|
|
130
|
+
},
|
|
131
|
+
{ count: votes.length }
|
|
132
|
+
)}
|
|
133
|
+
</Text>
|
|
134
|
+
}
|
|
135
|
+
>
|
|
136
|
+
<Flex {...stylex.props(pollStyles.options)}>
|
|
137
|
+
{options.map(option => {
|
|
138
|
+
const count = votes.filter(id => id === option.id).length
|
|
139
|
+
const selected = choice?.id === option.id
|
|
140
|
+
const share = votes.length ? count / votes.length : 0
|
|
141
|
+
const shareLabel =
|
|
142
|
+
share > 0 && share < 0.001
|
|
143
|
+
? '<0.1%'
|
|
144
|
+
: share < 1 && share > 0.999
|
|
145
|
+
? '>99.9%'
|
|
146
|
+
: percent.format(share)
|
|
147
|
+
return (
|
|
148
|
+
<Button
|
|
149
|
+
key={option.id}
|
|
150
|
+
selected={selected}
|
|
151
|
+
disabled={!ready}
|
|
152
|
+
onClick={() => {
|
|
153
|
+
store.set(() => ({ [ballotKey]: option.id }))
|
|
154
|
+
}}
|
|
155
|
+
style={[button.secondary, pollStyles.option, !ready && button.disabled]}
|
|
156
|
+
>
|
|
157
|
+
<Flex {...stylex.props(pollStyles.optionHeading)}>
|
|
158
|
+
<Flex
|
|
159
|
+
{...stylex.props(
|
|
160
|
+
pollStyles.radio,
|
|
161
|
+
selected && pollStyles.selectedRadio
|
|
162
|
+
)}
|
|
163
|
+
>
|
|
164
|
+
{selected && <Flex {...stylex.props(pollStyles.dot)} />}
|
|
165
|
+
</Flex>
|
|
166
|
+
<Flex {...stylex.props(layout.grow, layout.choiceText)}>
|
|
167
|
+
<Text>{option.label}</Text>
|
|
168
|
+
{selected && (
|
|
169
|
+
<Text {...stylex.props(roles.muted, appearance.accent)}>
|
|
170
|
+
Your vote
|
|
171
|
+
</Text>
|
|
172
|
+
)}
|
|
173
|
+
{votes.length > 0 && (
|
|
174
|
+
<>
|
|
175
|
+
<FeatureProgress component="poll" value={share} />
|
|
176
|
+
<Text {...stylex.props(roles.muted)}>
|
|
177
|
+
{format.formatMessage(
|
|
178
|
+
{
|
|
179
|
+
defaultMessage:
|
|
180
|
+
'{count, plural, one {# vote} other {# votes}} · {share}',
|
|
181
|
+
id: 'kowalski.poll.share',
|
|
182
|
+
},
|
|
183
|
+
{ count, share: shareLabel }
|
|
184
|
+
)}
|
|
185
|
+
</Text>
|
|
186
|
+
</>
|
|
187
|
+
)}
|
|
188
|
+
</Flex>
|
|
189
|
+
</Flex>
|
|
190
|
+
</Button>
|
|
191
|
+
)
|
|
192
|
+
})}
|
|
193
|
+
</Flex>
|
|
194
|
+
<Text {...stylex.props(roles.muted)}>
|
|
195
|
+
{ready
|
|
196
|
+
? store.saving && choice
|
|
197
|
+
? 'Saving… You can still change your vote.'
|
|
198
|
+
: notice
|
|
199
|
+
? 'Choose an option to try again.'
|
|
200
|
+
: choice
|
|
201
|
+
? 'Tap another option to change your vote.'
|
|
202
|
+
: votes.length === 0
|
|
203
|
+
? 'Be the first to vote. Choose one option.'
|
|
204
|
+
: 'Choose one option to add your vote.'
|
|
205
|
+
: notice
|
|
206
|
+
? 'Voting is unavailable.'
|
|
207
|
+
: 'Loading your ballot…'}
|
|
208
|
+
</Text>
|
|
209
|
+
</FeatureFrame>
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// A real radio: a round size-6 ring, filled with a centred dot when chosen.
|
|
214
|
+
const pollStyles = /* @__PURE__ */ stylex.create({
|
|
215
|
+
dot: {
|
|
216
|
+
backgroundColor: colors.onAccent,
|
|
217
|
+
borderRadius: radius.full,
|
|
218
|
+
height: size[2],
|
|
219
|
+
width: size[2],
|
|
220
|
+
},
|
|
221
|
+
option: { alignItems: 'stretch', padding: space[3] },
|
|
222
|
+
optionHeading: { alignItems: 'flex-start', flexDirection: 'row', gap: space[3] },
|
|
223
|
+
options: { gap: space[2] },
|
|
224
|
+
radio: {
|
|
225
|
+
alignItems: 'center',
|
|
226
|
+
backgroundColor: colors.surface,
|
|
227
|
+
borderColor: colors.border,
|
|
228
|
+
borderRadius: radius.full,
|
|
229
|
+
borderStyle: 'solid',
|
|
230
|
+
borderWidth: shape.stroke,
|
|
231
|
+
flexShrink: 0,
|
|
232
|
+
height: size[6],
|
|
233
|
+
justifyContent: 'center',
|
|
234
|
+
width: size[6],
|
|
235
|
+
},
|
|
236
|
+
selectedRadio: { backgroundColor: colors.accent, borderColor: colors.accent },
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
export const pollVoterSchema = z.object({
|
|
240
|
+
configuration: z.string().default(''),
|
|
241
|
+
voter: z.string(),
|
|
242
|
+
})
|