@viewstem/ui 0.0.0-stage → 0.1.0

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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.ko.md +47 -0
  3. package/README.md +60 -2
  4. package/dist/BASECOAT-LICENSE.md +21 -0
  5. package/dist/basecoat-contracts.d.ts +2 -0
  6. package/dist/basecoat-contracts.js +358 -0
  7. package/dist/basecoat-controllers.js +1612 -0
  8. package/dist/behaviors.d.ts +29 -0
  9. package/dist/behaviors.js +1475 -0
  10. package/dist/browser.d.ts +2 -0
  11. package/dist/browser.js +2 -0
  12. package/dist/catalog-meta.d.ts +26 -0
  13. package/dist/catalog-meta.js +130 -0
  14. package/dist/component-context.d.ts +7 -0
  15. package/dist/component-context.js +10 -0
  16. package/dist/components.d.ts +2 -0
  17. package/dist/components.js +532 -0
  18. package/dist/data-table.d.ts +2 -0
  19. package/dist/data-table.js +231 -0
  20. package/dist/date-calendar.d.ts +4 -0
  21. package/dist/date-calendar.js +512 -0
  22. package/dist/dynamic-catalog.d.ts +2 -0
  23. package/dist/dynamic-catalog.js +118 -0
  24. package/dist/form-scroll-families.d.ts +7 -0
  25. package/dist/form-scroll-families.js +895 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +12 -0
  28. package/dist/markup-families.d.ts +10 -0
  29. package/dist/markup-families.js +492 -0
  30. package/dist/menus.d.ts +8 -0
  31. package/dist/menus.js +427 -0
  32. package/dist/shadcn.d.ts +13 -0
  33. package/dist/shadcn.js +8 -0
  34. package/dist/slider-values.d.ts +9 -0
  35. package/dist/slider-values.js +43 -0
  36. package/dist/slider.d.ts +2 -0
  37. package/dist/slider.js +148 -0
  38. package/dist/static-catalog.d.ts +2 -0
  39. package/dist/static-catalog.js +87 -0
  40. package/dist/style-scope.d.ts +2 -0
  41. package/dist/style-scope.js +3 -0
  42. package/dist/styles.css +9573 -0
  43. package/dist/styles.css.d.ts +1 -0
  44. package/dist/support.json +1 -0
  45. package/dist/widget-families.d.ts +6 -0
  46. package/dist/widget-families.js +739 -0
  47. package/package.json +59 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 miinhlym
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.ko.md ADDED
@@ -0,0 +1,47 @@
1
+ # @viewstem/ui
2
+
3
+ [English](README.md) | 한국어
4
+
5
+ `@viewstem/ui`는 Viewstem의 기본 UI 리소스 셋입니다. `@viewstem/dom` 연결자와 Basecoat Vega 스타일로 66개 계열, 357개 JSON Component ID를 제공합니다. 순수 JS·React·Vue·Svelte에서 같은 JSON을 실행할 수 있습니다.
6
+
7
+ ```js
8
+ import { createRuntime } from '@viewstem/core';
9
+ import { createRenderer } from '@viewstem/dom';
10
+ import { ui } from '@viewstem/ui';
11
+
12
+ const runtime = createRuntime();
13
+ runtime.registry.registerResourceSet(ui);
14
+ const renderer = createRenderer({ runtime });
15
+ const target = document.querySelector('#app');
16
+ if (!target) throw new Error('Missing #app element');
17
+ const screen = renderer.mount({
18
+ target,
19
+ source: {
20
+ render: {
21
+ id: 'save',
22
+ componentRef: 'shadcn.Button',
23
+ inputs: { text: 'Save', variant: 'outline' },
24
+ },
25
+ },
26
+ });
27
+ await screen.ready;
28
+ await screen.whenRendered();
29
+ ```
30
+
31
+ 화면이 닫히면 `await screen.unmount()`를 호출하세요. 앱을 종료할 때는 `renderer.dispose()`를 기다린 뒤 예제에서 만든 Runtime의 `runtime.dispose()`도 기다립니다. 최초 Query 보고까지 필요하면 `await screen.whenSettled(view.initial)`을 사용하세요. 여기서 `view`는 `screen.ready`가 반환한 View입니다.
32
+
33
+ View를 만들기 전에 `ui` 셋을 등록합니다. 다른 셋이 `dependencies`에 `ui`를 포함하면 그 셋을 등록할 때 `ui`도 함께 등록됩니다. 두 경우 모두 브라우저 번들러가 `browser` 진입점을 선택하면 `@viewstem/ui` import에 기본 CSS가 포함됩니다. 스타일시트를 직접 불러오는 호스트는 `@viewstem/ui/styles.css`를 사용할 수 있습니다. `renderer.attach(view, target)`은 기존 View를 빌리며 `await attachment.detach()`로 연결을 정리합니다. `whenRendered()`는 해당 표시 연결의 DOM 반영을 기다립니다.
34
+
35
+ Slider의 `type: "multiple"`은 `value`의 숫자마다 손잡이를 만들고, `thumbLabels`로 각 손잡이의 접근성 이름을 지정할 수 있습니다. `valueChange`는 조작 중 값, `valueCommit`은 드래그를 마치거나 키보드로 값을 조절한 뒤의 확정 값을 전달합니다. 이벤트의 `value`는 다중 모드에서 숫자 배열이고 단일 모드에서 숫자입니다.
36
+
37
+ Slider의 숫자 `step`은 일정한 간격을 지정합니다. 비어 있지 않은 배열은 마우스와 키보드로 선택할 수 있는 값 목록입니다. `min`이나 `max`를 생략하면 각각 목록의 최솟값과 최댓값을 사용합니다. 목록의 모든 값이 범위 밖이면 선택 가능한 값이 생길 때까지 Slider가 비활성화됩니다. 다중 모드의 `value: []`는 손잡이를 모두 제거합니다.
38
+
39
+ `Command.Dialog`는 Escape로 닫으면 `openChange`에 `{ value: false }`를 전달합니다. `open`을 State에 연결했다면 이 이벤트에서 State를 갱신할 수 있습니다. 핸들러가 없는 기존 View도 Escape로 닫히며 이후 `open` 값이 `true`로 바뀌면 다시 열립니다. `Popover.Root`와 `Tooltip.Root`에 `open`을 제공하면 사용자 조작은 `openChange`로 전환을 요청합니다. 입력값이 실제 화면에 반영되고 전환이 끝나면 `openChangeComplete`가 발생합니다.
40
+
41
+ Date Picker는 `min`과 `max` 범위에 맞춰 트리거와 그리드에 같은 날짜를 표시합니다. State 값은 호출자가 관리합니다. Data Table은 문자열과 숫자 행 ID를 지원하며, 문자열로 변환한 ID가 고유해야 합니다. `selectedIds`와 `selectedIdsChange`는 문자열 ID를 사용합니다. 페이지 크기를 바꾸면 현재 화면의 첫 행을 기준으로 새 페이지를 계산합니다.
42
+
43
+ 저장소에서 `npm run check:ui`를 실행하면 독립 환경에 Core·DOM·UI tarball을 설치해 네 가지 브라우저 호스트의 실행 및 원본 카탈로그 예제를 검사합니다.
44
+
45
+ `--viewstem-primary`, `--viewstem-radius`처럼 접두사가 있는 변수를 조상에 선언해 테마를 조정하세요. 기존 `data-viewstem-ui`의 역할은 이전 테마 변수의 범위를 지정하는 것입니다. 여러 셋을 섞으면 각 셋의 CSS가 자기 요소에 직접 적용됩니다.
46
+
47
+ [이 버전의 소스와 문서](https://github.com/miinhlym/viewstem/blob/da46e078af0c11f28f4102bb132ec7e2445c464f/docs/README.ko.md)
package/README.md CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # @viewstem/ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ English | [한국어](README.ko.md)
4
+
5
+ Default UI resource set for Viewstem. Its components use the `@viewstem/dom` connector, Basecoat 1.1.0 Vega styles, and selected Vanilla JS controllers. The host supplies a connected element.
6
+
7
+ ```js
8
+ import { createRuntime } from '@viewstem/core';
9
+ import { createRenderer } from '@viewstem/dom';
10
+ import { ui } from '@viewstem/ui';
11
+
12
+ const runtime = createRuntime();
13
+ runtime.registry.registerResourceSet(ui);
14
+ const renderer = createRenderer({ runtime });
15
+ const target = document.querySelector('#app');
16
+ if (!target) throw new Error('Missing #app element');
17
+ const screen = renderer.mount({
18
+ target,
19
+ source: {
20
+ render: {
21
+ id: 'save',
22
+ componentRef: 'shadcn.Button',
23
+ inputs: { text: 'Save', variant: 'outline' },
24
+ },
25
+ },
26
+ });
27
+ await screen.ready;
28
+ await screen.whenRendered();
29
+ ```
30
+
31
+ Call `await screen.unmount()` when the screen closes. On app shutdown, await `renderer.dispose()` and then await `runtime.dispose()` for the Runtime created above. If you need the initial Query report, use `await screen.whenSettled(view.initial)` with the View returned by `screen.ready`.
32
+
33
+ Register the exported `ui` resource set before creating a View. A set that includes `ui` in `dependencies` registers it along with its own resources. When a browser bundler selects the `browser` export, the import of `@viewstem/ui` includes its scoped CSS in either case. Hosts that load stylesheets explicitly can use `@viewstem/ui/styles.css`. `renderer.attach(view, target)` borrows a View, and `await attachment.detach()` releases the display. `whenRendered()` waits for the requested DOM projection.
34
+
35
+ ## Shared JSON catalog
36
+
37
+ The `ui` set provides 66 families and 357 JSON Component IDs. Use the generated `@viewstem/ui/support.json` export for the implemented port schemas, slots, and event payloads. The build derives this reference from the package’s `catalog/shadcn-contracts.json` and the supported inputs, slots, and events of the DOM adapters.
38
+
39
+ Dropdown Menu, Context Menu, and Menubar share a Zag Vanilla menu adapter, including nested menus. Hover Card, Navigation Menu, Resizable, and Scroll Area also use Zag Vanilla. Carousel uses Embla 8.6.0. Select scroll buttons extend the existing Select controller. The remaining components use browser DOM controls and CSS.
40
+
41
+ The DOM adapters support documented JSON input and event subsets. Portal slots are rendered in the owning subtree, so custom portal destinations are outside the catalog. The modal families use the browser dialog top layer. The Chart recipe uses an SVG rendering of the data. Sonner comparisons use the JSON `Notifications` component. Rendering takes place in a connected client-side DOM container.
42
+
43
+ Slider uses a native range input for `type: "single"` and Zag Vanilla for `type: "multiple"`. In multiple mode, each number in `value` creates a thumb. The thumbs stay in ascending order, and `thumbLabels` can give them distinct accessible names. `valueChange` carries the current values during interaction, and `valueCommit` carries the final values when the drag ends or a keyboard adjustment takes effect. The payload is `{ value: number[] }` in multiple mode and `{ value: number }` in single mode.
44
+
45
+ A numeric Slider `step` sets a regular interval. A non-empty array defines discrete values for pointer and keyboard input. When `min` or `max` is omitted, its default comes from the lowest or highest stop. If every stop falls outside the bounds, the slider is disabled until a stop becomes available. An explicit `value: []` in multiple mode removes all thumbs.
46
+
47
+ `Command.Dialog` emits `openChange` with `{ value: false }` when dismissed with Escape. Use the event to update a bound `open` State. An existing view without this handler can still dismiss the dialog. It reopens when the supplied `open` value changes to `true` again. `Popover.Root` and `Tooltip.Root` emit `openChange` to request a transition when `open` is supplied. They emit `openChangeComplete` after the supplied value is reflected and the transition finishes.
48
+
49
+ Calendar, Range Calendar, and Date Picker use Zag Vanilla for date navigation and selection. Their JSON contracts use date-only strings and range objects. Calendar and Range Calendar render complete grids through their Root IDs. Date Picker clamps the date shown in its trigger and grid to `min` and `max` while keeping the caller's State value.
50
+
51
+ Data Table uses TanStack Table Core. The JSON recipe keeps caller-owned sorting, filtering, pagination, and selection state. A page outside the available range is clamped for display, and a page size change starts from the first displayed row. Row IDs may be strings or numbers and must be unique after conversion to strings. `selectedIds` and `selectedIdsChange` use the string form. Selected IDs outside the current data remain in the selection state.
52
+
53
+ Basecoat styles target elements owned by the default UI. Set `.dark` or `data-theme="dark"` on an ancestor to switch themes. Basecoat controllers are registered locally and attached to individual DOM nodes. Their teardown is part of attachment disposal. The build includes the Basecoat license in `dist/BASECOAT-LICENSE.md`.
54
+
55
+ ## Verify locally
56
+
57
+ From the workspace root, install the locked dependencies and Chromium, then run `npm run check:ui`. The test installs the Core, DOM, and UI tarballs in an isolated consumer and runs the same [View JSON](test/view.json) in plain JS, React, Vue, and Svelte. The vanilla dependency and bundle checks enforce the framework boundary. The browser suite also mounts the [66 original catalog ViewSpecs](test/fixtures/samples.mjs) and verifies State and Action behavior for the date and table recipes.
58
+
59
+ Set prefixed theme variables such as `--viewstem-primary` and `--viewstem-radius` on an ancestor. The legacy `data-viewstem-ui` attribute provides a boundary for older theme variables. When sets are mixed, each set's CSS directly styles its own elements.
60
+
61
+ [Source and documentation for this version](https://github.com/miinhlym/viewstem/blob/da46e078af0c11f28f4102bb132ec7e2445c464f/docs/README.md)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ronan Berder
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ import type { ComponentPublicContract } from '@viewstem/core';
2
+ export const support: readonly (ComponentPublicContract & { id: string; family: string })[];