@welldot/vue 0.1.1 → 0.2.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.
- package/README.md +55 -14
- package/dist/grid/cells/GridUnitEditor.d.ts +2 -0
- package/dist/grid/cells/GridUnitEditor.d.ts.map +1 -1
- package/dist/grid/cells/GridUnitEditor.js.map +1 -1
- package/dist/grid/cells/GridUnitEditor.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/grid/cells/GridUnitEditor.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/grid/useWellGridColumns.d.ts +21 -0
- package/dist/grid/useWellGridColumns.d.ts.map +1 -1
- package/dist/grid/useWellGridColumns.js +91 -86
- package/dist/grid/useWellGridColumns.js.map +1 -1
- package/dist/tailwind.css +7 -144
- package/dist/theme/define.d.ts +2 -2
- package/dist/theme/define.js.map +1 -1
- package/dist/theme/preset.d.ts.map +1 -1
- package/dist/theme/preset.js +31 -126
- package/dist/theme/preset.js.map +1 -1
- package/dist/theme.css +149 -0
- package/dist/tokens.css +127 -0
- package/package.json +13 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWellGridColumns.js","names":[],"sources":["../../src/grid/useWellGridColumns.ts"],"sourcesContent":["import type {\n AfterEditEvent,\n BeforeSaveDataDetails,\n ColumnRegular,\n Editors,\n FocusAfterRenderEvent,\n GridPlugin,\n} from '@revolist/revogrid';\nimport {\n BasePlugin,\n VGridVueEditor,\n type PluginProviders,\n} from '@revolist/vue3-datagrid';\nimport type { LanguageTextInput } from '@welldot/core';\nimport {\n computed,\n defineComponent,\n h,\n ref,\n toValue,\n type Component,\n type MaybeRefOrGetter,\n} from 'vue';\nimport { useWellText } from '../composables/useWellText';\nimport type { DisplayUnitType } from '../composables/useWellUnits';\nimport { resolvePart, useWelldotConfig } from '../config';\nimport GridCheckboxCell from './cells/GridCheckboxCell.vue';\nimport GridColorCell from './cells/GridColorCell.vue';\nimport GridColorPickerEditor from './cells/GridColorPickerEditor.vue';\nimport GridComboEditor from './cells/GridComboEditor.vue';\nimport GridDeleteCell from './cells/GridDeleteCell.vue';\nimport GridDragCell from './cells/GridDragCell.vue';\nimport GridFormattedCell from './cells/GridFormattedCell.vue';\nimport GridHeaderCell from './cells/GridHeaderCell.vue';\nimport GridNumberEditor from './cells/GridNumberEditor.vue';\nimport GridSelectButtonCell from './cells/GridSelectButtonCell.vue';\nimport GridSelectCell from './cells/GridSelectCell.vue';\nimport GridSelectEditor from './cells/GridSelectEditor.vue';\nimport GridTextEditor from './cells/GridTextEditor.vue';\nimport GridTextureSelectCell from './cells/GridTextureSelectCell.vue';\nimport GridTextureSelectEditor from './cells/GridTextureSelectEditor.vue';\nimport GridUnitCell from './cells/GridUnitCell.vue';\nimport GridUnitEditor from './cells/GridUnitEditor.vue';\nimport { columnStretchPlugin } from './columnStretchPlugin';\nimport {\n useCellTemplate,\n type GridVueTemplate,\n} from './composables/useCellTemplate';\nimport { useUnitSuffix } from './composables/useUnitSuffix';\nimport WellGridDeleteButton from './parts/WellGridDeleteButton.vue';\nimport type {\n ResolvedGridOption,\n WellDataGridComponents,\n WellDataGridLabels,\n WellGridColumn,\n WellGridOption,\n} from './types';\n\n// ─── Column kinds ──────────────────────────────────────────────────────────\n// Declares how each column \"kind\" renders and edits.\n// `resolveColumnKind` decides which kind a column declaration maps to.\n\ntype ColumnKind =\n | 'text'\n | 'number'\n | 'unit'\n | 'color'\n | 'select'\n | 'select-button'\n | 'combo'\n | 'formatted'\n | 'checkbox'\n | 'texture';\n\n/** What a kind needs from one column, with its text already resolved. */\ninterface ResolvedColumn {\n col: WellGridColumn;\n options?: ResolvedGridOption[];\n}\n\ninterface ColumnKindDef {\n editor?: string;\n numeric?: boolean;\n cellProperties?: ColumnRegular['cellProperties'];\n cellTemplate?: (c: ResolvedColumn) => GridVueTemplate;\n /** Per-column props handed to the editor (read from `column.editorProps`). */\n editorProps?: (c: ResolvedColumn) => Record<string, unknown>;\n}\n\nfunction resolveColumnKind(col: WellGridColumn): ColumnKind {\n if (col.type === 'texture') return 'texture';\n if (col.type === 'select') return 'select';\n if (col.type === 'select-button') return 'select-button';\n if (col.type === 'combo') return 'combo';\n if (col.type === 'color') return 'color';\n if (col.type === 'checkbox') return 'checkbox';\n if (col.unitType) return 'unit';\n if (col.formatter) return 'formatted';\n return col.type === 'number' ? 'number' : 'text';\n}\n\nconst UNIT_TYPES: readonly DisplayUnitType[] = [\n 'length',\n 'diameter',\n 'flow',\n 'power',\n 'volume',\n];\n\n/** Props RevoGrid hands to every editor (`EditorType`). */\ninterface GridEditorProps {\n val?: unknown;\n save: (value: unknown, preventFocus?: boolean) => void;\n close: (focusNext?: boolean) => void;\n /** Cell data model; `column.column` is the `ColumnRegular`. */\n column?: { column?: { editorProps?: Record<string, unknown> } };\n}\n\n/* eslint-disable vue/one-component-per-file -- tiny render-function editor\n adapters, not SFCs */\n\nconst EDITOR_PROP_KEYS: Array<keyof GridEditorProps> = [\n 'val',\n 'save',\n 'close',\n 'column',\n];\n\n/**\n * Editor that forwards `val`/`save`/`close` plus the column's\n * `editorProps` (and optional grid-wide props) to `component`. Lets one\n * editor per kind — registered once in setup — serve every column.\n */\nfunction columnEditor(\n component: Component,\n extraProps?: () => Record<string, unknown>,\n) {\n return VGridVueEditor(\n defineComponent(\n (p: GridEditorProps) => () =>\n h(component, {\n val: p.val,\n save: p.save,\n close: p.close,\n ...p.column?.column?.editorProps,\n ...extraProps?.(),\n }),\n { inheritAttrs: false, props: EDITOR_PROP_KEYS },\n ),\n );\n}\n\nconst NoopEditor = defineComponent(\n (p: GridEditorProps) => {\n p.close();\n return () => null;\n },\n { inheritAttrs: false, props: EDITOR_PROP_KEYS },\n);\n\n/* eslint-enable vue/one-component-per-file */\n\nexport interface UseWellGridColumnsOptions {\n columns: MaybeRefOrGetter<WellGridColumn[]>;\n onDelete: (rowIndex: number, model: Record<string, unknown>) => void;\n onChange: (rowIndex: number, prop: string, value: unknown) => void;\n /** Include the pinned-start drag-handle column (default true) */\n enableDrag?: boolean;\n /** Include the pinned-end delete-row column (default true) */\n enableDelete?: boolean;\n /** Label handed to the delete-button part (its aria-label by default). */\n deleteLabel?: MaybeRefOrGetter<LanguageTextInput>;\n /** Grid-internal text (texture editor, header info trigger). */\n labels?: MaybeRefOrGetter<WellDataGridLabels | undefined>;\n /** Part overrides; `addButton` is rendered by `WellDataGrid` itself. */\n components?: MaybeRefOrGetter<WellDataGridComponents | undefined>;\n}\n\n/**\n * Editor registry, column-kind resolution and RevoGrid column builder for a\n * well feature grid. **Call it in `setup`**: cell templates and editors are\n * bound to the calling component's app context there (see\n * `useCellTemplate`), which is what lets cells reach `createWelldot` and\n * PrimeVue.\n */\nexport function useWellGridColumns(options: UseWellGridColumnsOptions) {\n const {\n onDelete,\n onChange,\n enableDrag = true,\n enableDelete = true,\n } = options;\n const cols = computed(() => toValue(options.columns));\n const labels = computed(() => toValue(options.labels) ?? {});\n const parts = computed(() => toValue(options.components) ?? {});\n\n const config = useWelldotConfig();\n const text = useWellText();\n const cellTemplate = useCellTemplate();\n const suffixes = Object.fromEntries(\n UNIT_TYPES.map(type => [type, useUnitSuffix(type)]),\n ) as Record<DisplayUnitType, ReturnType<typeof useUnitSuffix>>;\n\n // ─── Editors ───────────────────────────────────────────────────────────────\n // Created once, here in setup: `VGridVueEditor` captures the current\n // instance's app context when called. Per-column data (unit type, options)\n // travels on the column as `editorProps`.\n\n const gridEditors: Editors = {\n noop: VGridVueEditor(NoopEditor),\n text: VGridVueEditor(GridTextEditor),\n number: VGridVueEditor(GridNumberEditor),\n color: VGridVueEditor(GridColorPickerEditor),\n unit: columnEditor(GridUnitEditor),\n select: columnEditor(GridSelectEditor),\n combo: columnEditor(GridComboEditor, () => ({\n hint: labels.value.comboHint,\n })),\n texture: columnEditor(GridTextureSelectEditor, () => ({\n placeholder: labels.value.texturePlaceholder,\n showPending: labels.value.showPendingTextures,\n })),\n };\n\n const headerTemplate = cellTemplate(GridHeaderCell);\n\n const stretchCol = computed(() => cols.value.find(c => c.stretch) ?? null);\n const stretchProp = computed(() => stretchCol.value?.prop ?? null);\n const gridStretch = computed(() => stretchProp.value === null);\n\n const plugins = computed(() => {\n const list: GridPlugin[] = [];\n if (enableDrag) {\n list.push(\n class HRPlugin extends BasePlugin {\n constructor(r: HTMLRevoGridElement, p: PluginProviders) {\n super(r, p);\n this.addEventListener('rowdragstart', e => {\n const name = e.detail.model?.['name'];\n if (typeof name === 'string' && name) {\n e.detail.text = name;\n }\n });\n }\n },\n );\n }\n if (stretchProp.value !== null) {\n list.push(\n columnStretchPlugin(stretchProp.value, stretchCol.value?.minSize),\n );\n }\n return list;\n });\n\n const checkboxCellProperties = () => ({ class: 'well-grid-checkbox-cell' });\n\n const columnKinds: Record<ColumnKind, ColumnKindDef> = {\n text: {},\n number: { numeric: true },\n unit: {\n editor: 'unit',\n numeric: true,\n editorProps: ({ col }) => ({ unitType: col.unitType }),\n cellTemplate: ({ col }) =>\n cellTemplate(GridUnitCell, { unitType: col.unitType }),\n },\n color: {\n editor: 'color',\n cellTemplate: () => cellTemplate(GridColorCell),\n },\n select: {\n editor: 'select',\n editorProps: ({ options }) => ({ options }),\n cellTemplate: ({ options }) => cellTemplate(GridSelectCell, { options }),\n },\n combo: {\n editor: 'combo',\n editorProps: ({ options }) => ({ options }),\n // GridSelectCell already falls back to the raw value when it isn't\n // one of the suggested options, which is exactly what free text needs.\n cellTemplate: ({ options }) => cellTemplate(GridSelectCell, { options }),\n },\n formatted: {\n cellTemplate: ({ col }) =>\n cellTemplate(GridFormattedCell, { formatter: col.formatter }),\n },\n checkbox: {\n editor: 'noop',\n cellProperties: checkboxCellProperties,\n cellTemplate: ({ col }) =>\n cellTemplate(GridCheckboxCell, {\n prop: col.prop,\n onToggle: (rowIndex: number, prop: string, value: boolean) =>\n onChange(rowIndex, prop, value),\n }),\n },\n 'select-button': {\n editor: 'noop',\n cellProperties: checkboxCellProperties,\n cellTemplate: ({ col, options }) =>\n cellTemplate(GridSelectButtonCell, {\n prop: col.prop,\n options,\n onChange: (rowIndex: number, prop: string, value: unknown) =>\n onChange(rowIndex, prop, value),\n }),\n },\n texture: {\n editor: 'texture',\n cellTemplate: () => cellTemplate(GridTextureSelectCell),\n },\n };\n\n function resolveOptions(\n list: readonly WellGridOption[],\n ): ResolvedGridOption[] {\n return list.map(o => ({\n value: o.value,\n label: text(o.label) ?? o.value,\n ...(o.deprecated && { deprecated: true }),\n }));\n }\n\n function buildColumn(col: WellGridColumn): ColumnRegular {\n const kind = columnKinds[resolveColumnKind(col)];\n const resolved: ResolvedColumn = {\n col,\n options: 'options' in col ? resolveOptions(col.options) : undefined,\n };\n const label = text(col.label) ?? '';\n const unit = col.unitType ? suffixes[col.unitType].value : null;\n const readonly = col.readonly ?? false;\n const info = text(col.info);\n\n return {\n prop: col.prop,\n name: unit ? `${label} (${unit})` : label,\n autoSize: !col.size && !col.stretch,\n size: col.size,\n readonly,\n editor: readonly\n ? undefined\n : (kind.editor ??\n col.editor ??\n (col.type === 'number' ? 'number' : 'text')),\n editorProps: kind.editorProps?.(resolved),\n pin: col.pin,\n cellProperties:\n kind.cellProperties ??\n (kind.numeric ? () => ({ class: 'num' }) : undefined),\n cellTemplate: kind.cellTemplate?.(resolved),\n ...(info && {\n info,\n infoHighlight: text(col.infoHighlight),\n infoLabel: text(labels.value.columnInfo),\n columnTemplate: headerTemplate,\n }),\n };\n }\n\n const revoColumns = computed<ColumnRegular[]>(() => {\n const result: ColumnRegular[] = [];\n if (enableDrag) {\n const dragHandle = resolvePart(\n 'dragHandle',\n parts.value.dragHandle,\n undefined,\n config,\n );\n result.push({\n prop: '_drag',\n name: '',\n size: 30,\n pin: 'colPinStart',\n rowDrag: true,\n cellProperties: () => ({ class: 'well-grid-drag-cell' }),\n // Without an override RevoGrid draws its own handle (styled by\n // grid.css). A template replaces it, so GridDragCell re-emits the\n // drag start RevoGrid's handle would have emitted.\n ...(dragHandle && {\n cellTemplate: cellTemplate(GridDragCell, { part: dragHandle }),\n }),\n });\n }\n result.push(...cols.value.map(buildColumn));\n if (enableDelete) {\n result.push({\n prop: '_delete',\n name: '',\n size: 40,\n readonly: true,\n pin: 'colPinEnd',\n cellProperties: () => ({ class: 'well-grid-delete-cell' }),\n cellTemplate: cellTemplate(GridDeleteCell, {\n part: resolvePart(\n 'deleteButton',\n parts.value.deleteButton,\n WellGridDeleteButton,\n config,\n ),\n label: text(toValue(options.deleteLabel)),\n requestDelete: onDelete,\n }),\n });\n }\n return result;\n });\n\n function coerceCellValue(prop: string, val: unknown): unknown {\n const col = cols.value.find(c => c.prop === prop);\n if (col?.type === 'checkbox' && typeof val === 'string') {\n return val === 'true' || val === '1' || val.toLowerCase() === 'yes';\n }\n return val;\n }\n\n // ─── Click-on-focused-cell → enter edit mode ───────────────────────────────\n // `afterfocus` only fires when focus moves to a new cell. A click that\n // triggers such a focus change is suppressed; a second click on the cell\n // that's already focused enters edit mode for it.\n\n const gridContainerRef = ref<HTMLElement | null>(null);\n const focusedCell = ref<{\n rowIndex: number;\n colIndex: number;\n prop: string;\n } | null>(null);\n let suppressNextClick = false;\n\n function handleAfterFocus(event: CustomEvent<FocusAfterRenderEvent>) {\n const { rowIndex, colIndex, column } = event.detail;\n focusedCell.value = column\n ? { rowIndex, colIndex, prop: String(column.prop) }\n : null;\n suppressNextClick = true;\n }\n\n function handleGridMousedown() {\n suppressNextClick = false;\n }\n\n function handleGridClick(event: MouseEvent) {\n if (suppressNextClick) {\n suppressNextClick = false;\n return;\n }\n const cell = focusedCell.value;\n if (!cell) return;\n\n const target = (event.target as HTMLElement).closest<HTMLElement>(\n '[data-rgrow][data-rgcol]',\n );\n if (!target) return;\n if (\n Number(target.dataset.rgrow) !== cell.rowIndex ||\n Number(target.dataset.rgcol) !== cell.colIndex\n ) {\n return;\n }\n\n const col = cols.value.find(c => c.prop === cell.prop);\n if (!col || col.readonly) return;\n\n const gridEl = gridContainerRef.value?.querySelector('revo-grid') as\n | HTMLRevoGridElement\n | undefined;\n gridEl?.setCellEdit(cell.rowIndex, cell.prop);\n }\n\n function handleAfterEdit(event: CustomEvent<AfterEditEvent>) {\n const detail = event.detail as Record<string, unknown>;\n\n // Single-cell edit: detail has rowIndex + prop + val\n if ('rowIndex' in detail) {\n const { rowIndex, prop, val } =\n detail as unknown as BeforeSaveDataDetails;\n onChange(rowIndex, String(prop), coerceCellValue(String(prop), val));\n return;\n }\n\n // Block edit (paste, range clear, etc.): detail has data keyed by row index\n const blockData = detail.data as\n | Record<string, Record<string, unknown>>\n | undefined;\n if (!blockData) return;\n\n for (const [rowKey, rowData] of Object.entries(blockData)) {\n const rowIndex = Number(rowKey);\n for (const [prop, val] of Object.entries(rowData)) {\n onChange(rowIndex, prop, coerceCellValue(prop, val));\n }\n }\n }\n\n return {\n gridEditors,\n revoColumns,\n gridStretch,\n plugins,\n coerceCellValue,\n handleAfterEdit,\n gridContainerRef,\n handleAfterFocus,\n handleGridMousedown,\n handleGridClick,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,SAAS,GAAkB,GAAiC;AAS1D,QARI,EAAI,SAAS,YAAkB,YAC/B,EAAI,SAAS,WAAiB,WAC9B,EAAI,SAAS,kBAAwB,kBACrC,EAAI,SAAS,UAAgB,UAC7B,EAAI,SAAS,UAAgB,UAC7B,EAAI,SAAS,aAAmB,aAChC,EAAI,WAAiB,SACrB,EAAI,YAAkB,cACnB,EAAI,SAAS,WAAW,WAAW;;AAG5C,IAAM,IAAyC;CAC7C;CACA;CACA;CACA;CACA;CACD,EAcK,IAAiD;CACrD;CACA;CACA;CACA;CACD;AAOD,SAAS,EACP,GACA,GACA;AACA,QAAO,EACL,GACG,YACC,EAAE,GAAW;EACX,KAAK,EAAE;EACP,MAAM,EAAE;EACR,OAAO,EAAE;EACT,GAAG,EAAE,QAAQ,QAAQ;EACrB,GAAG,KAAc;EAClB,CAAC,EACJ;EAAE,cAAc;EAAO,OAAO;EAAkB,CACjD,CACF;;AAGH,IAAM,IAAa,GAChB,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E,aAAU,SAAM,WACtB;AACF,KAAS,GAAU,OAAO,EAAK,EAAE,EAAgB,OAAO,EAAK,EAAE,EAAI,CAAC;AACpE;;EAIF,IAAM,IAAY,EAAO;AAGpB,QAEL,MAAK,IAAM,CAAC,GAAQ,MAAY,OAAO,QAAQ,EAAU,EAAE;GACzD,IAAM,IAAW,OAAO,EAAO;AAC/B,QAAK,IAAM,CAAC,GAAM,MAAQ,OAAO,QAAQ,EAAQ,CAC/C,GAAS,GAAU,GAAM,EAAgB,GAAM,EAAI,CAAC;;;AAK1D,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"useWellGridColumns.js","names":[],"sources":["../../src/grid/useWellGridColumns.ts"],"sourcesContent":["import type {\n AfterEditEvent,\n BeforeSaveDataDetails,\n ColumnRegular,\n Editors,\n FocusAfterRenderEvent,\n GridPlugin,\n} from '@revolist/revogrid';\nimport {\n BasePlugin,\n VGridVueEditor,\n type PluginProviders,\n} from '@revolist/vue3-datagrid';\nimport type { LanguageTextInput } from '@welldot/core';\nimport {\n computed,\n defineComponent,\n h,\n ref,\n toValue,\n type Component,\n type MaybeRefOrGetter,\n} from 'vue';\nimport { useWellText } from '../composables/useWellText';\nimport type { DisplayUnitType } from '../composables/useWellUnits';\nimport { resolvePart, useWelldotConfig } from '../config';\nimport GridCheckboxCell from './cells/GridCheckboxCell.vue';\nimport GridColorCell from './cells/GridColorCell.vue';\nimport GridColorPickerEditor from './cells/GridColorPickerEditor.vue';\nimport GridComboEditor from './cells/GridComboEditor.vue';\nimport GridDeleteCell from './cells/GridDeleteCell.vue';\nimport GridDragCell from './cells/GridDragCell.vue';\nimport GridFormattedCell from './cells/GridFormattedCell.vue';\nimport GridHeaderCell from './cells/GridHeaderCell.vue';\nimport GridNumberEditor from './cells/GridNumberEditor.vue';\nimport GridSelectButtonCell from './cells/GridSelectButtonCell.vue';\nimport GridSelectCell from './cells/GridSelectCell.vue';\nimport GridSelectEditor from './cells/GridSelectEditor.vue';\nimport GridTextEditor from './cells/GridTextEditor.vue';\nimport GridTextureSelectCell from './cells/GridTextureSelectCell.vue';\nimport GridTextureSelectEditor from './cells/GridTextureSelectEditor.vue';\nimport GridUnitCell from './cells/GridUnitCell.vue';\nimport GridUnitEditor from './cells/GridUnitEditor.vue';\nimport { columnStretchPlugin } from './columnStretchPlugin';\nimport {\n useCellTemplate,\n type GridVueTemplate,\n} from './composables/useCellTemplate';\nimport { useUnitSuffix } from './composables/useUnitSuffix';\nimport WellGridDeleteButton from './parts/WellGridDeleteButton.vue';\nimport type {\n ResolvedGridOption,\n WellDataGridComponents,\n WellDataGridLabels,\n WellGridColumn,\n WellGridOption,\n} from './types';\n\n// ─── Column kinds ──────────────────────────────────────────────────────────\n// Declares how each column \"kind\" renders and edits.\n// `resolveColumnKind` decides which kind a column declaration maps to.\n\ntype ColumnKind =\n | 'text'\n | 'number'\n | 'unit'\n | 'color'\n | 'select'\n | 'select-button'\n | 'combo'\n | 'formatted'\n | 'checkbox'\n | 'texture';\n\n/** What a kind needs from one column, with its text already resolved. */\ninterface ResolvedColumn {\n col: WellGridColumn;\n options?: ResolvedGridOption[];\n}\n\ninterface ColumnKindDef {\n editor?: string;\n numeric?: boolean;\n cellProperties?: ColumnRegular['cellProperties'];\n cellTemplate?: (c: ResolvedColumn) => GridVueTemplate;\n /** Per-column props handed to the editor (read from `column.editorProps`). */\n editorProps?: (c: ResolvedColumn) => Record<string, unknown>;\n}\n\nfunction resolveColumnKind(col: WellGridColumn): ColumnKind {\n if (col.type === 'texture') return 'texture';\n if (col.type === 'select') return 'select';\n if (col.type === 'select-button') return 'select-button';\n if (col.type === 'combo') return 'combo';\n if (col.type === 'color') return 'color';\n if (col.type === 'checkbox') return 'checkbox';\n if (col.unitType) return 'unit';\n if (col.formatter) return 'formatted';\n return col.type === 'number' ? 'number' : 'text';\n}\n\nconst UNIT_TYPES: readonly DisplayUnitType[] = [\n 'length',\n 'diameter',\n 'flow',\n 'power',\n 'volume',\n];\n\n/** Props RevoGrid hands to every editor (`EditorType`). */\nexport interface GridEditorProps {\n val?: unknown;\n save: (value: unknown, preventFocus?: boolean) => void;\n close: (focusNext?: boolean) => void;\n /** Cell data model; `column.column` is the `ColumnRegular`. */\n column?: { column?: { editorProps?: Record<string, unknown> } };\n /** Row model of the edited cell. */\n model?: Record<string, unknown>;\n /** Key of the edited cell on `model`. */\n prop?: string | number;\n}\n\n/* eslint-disable vue/one-component-per-file -- tiny render-function editor\n adapters, not SFCs */\n\nconst EDITOR_PROP_KEYS: Array<keyof GridEditorProps> = [\n 'val',\n 'save',\n 'close',\n 'column',\n 'model',\n 'prop',\n];\n\n/**\n * Whether `val` is the key the user typed to open the editor rather than\n * the cell's stored value (RevoGrid passes `editCell.val || modelValue`).\n */\nexport function isEnteredValue(p: GridEditorProps): boolean {\n return p.prop != null && p.val !== p.model?.[p.prop];\n}\n\n/**\n * Editor that forwards `val`/`save`/`close` plus the column's\n * `editorProps` (and optional grid-wide props) to `component`. Lets one\n * editor per kind — registered once in setup — serve every column.\n */\nfunction columnEditor(\n component: Component,\n extraProps?: (p: GridEditorProps) => Record<string, unknown>,\n) {\n return VGridVueEditor(\n defineComponent(\n (p: GridEditorProps) => () =>\n h(component, {\n val: p.val,\n save: p.save,\n close: p.close,\n ...p.column?.column?.editorProps,\n ...extraProps?.(p),\n }),\n { inheritAttrs: false, props: EDITOR_PROP_KEYS },\n ),\n );\n}\n\nconst NoopEditor = defineComponent(\n (p: GridEditorProps) => {\n p.close();\n return () => null;\n },\n { inheritAttrs: false, props: EDITOR_PROP_KEYS },\n);\n\n/* eslint-enable vue/one-component-per-file */\n\nexport interface UseWellGridColumnsOptions {\n columns: MaybeRefOrGetter<WellGridColumn[]>;\n onDelete: (rowIndex: number, model: Record<string, unknown>) => void;\n onChange: (rowIndex: number, prop: string, value: unknown) => void;\n /** Include the pinned-start drag-handle column (default true) */\n enableDrag?: boolean;\n /** Include the pinned-end delete-row column (default true) */\n enableDelete?: boolean;\n /** Label handed to the delete-button part (its aria-label by default). */\n deleteLabel?: MaybeRefOrGetter<LanguageTextInput>;\n /** Grid-internal text (texture editor, header info trigger). */\n labels?: MaybeRefOrGetter<WellDataGridLabels | undefined>;\n /** Part overrides; `addButton` is rendered by `WellDataGrid` itself. */\n components?: MaybeRefOrGetter<WellDataGridComponents | undefined>;\n}\n\n/**\n * Editor registry, column-kind resolution and RevoGrid column builder for a\n * well feature grid. **Call it in `setup`**: cell templates and editors are\n * bound to the calling component's app context there (see\n * `useCellTemplate`), which is what lets cells reach `createWelldot` and\n * PrimeVue.\n */\nexport function useWellGridColumns(options: UseWellGridColumnsOptions) {\n const {\n onDelete,\n onChange,\n enableDrag = true,\n enableDelete = true,\n } = options;\n const cols = computed(() => toValue(options.columns));\n const labels = computed(() => toValue(options.labels) ?? {});\n const parts = computed(() => toValue(options.components) ?? {});\n\n const config = useWelldotConfig();\n const text = useWellText();\n const cellTemplate = useCellTemplate();\n const suffixes = Object.fromEntries(\n UNIT_TYPES.map(type => [type, useUnitSuffix(type)]),\n ) as Record<DisplayUnitType, ReturnType<typeof useUnitSuffix>>;\n\n // ─── Editors ───────────────────────────────────────────────────────────────\n // Created once, here in setup: `VGridVueEditor` captures the current\n // instance's app context when called. Per-column data (unit type, options)\n // travels on the column as `editorProps`.\n\n const gridEditors: Editors = {\n noop: VGridVueEditor(NoopEditor),\n text: VGridVueEditor(GridTextEditor),\n number: VGridVueEditor(GridNumberEditor),\n color: VGridVueEditor(GridColorPickerEditor),\n unit: columnEditor(GridUnitEditor, p => ({\n entered: isEnteredValue(p),\n })),\n select: columnEditor(GridSelectEditor),\n combo: columnEditor(GridComboEditor, () => ({\n hint: labels.value.comboHint,\n })),\n texture: columnEditor(GridTextureSelectEditor, () => ({\n placeholder: labels.value.texturePlaceholder,\n showPending: labels.value.showPendingTextures,\n })),\n };\n\n const headerTemplate = cellTemplate(GridHeaderCell);\n\n const stretchCol = computed(() => cols.value.find(c => c.stretch) ?? null);\n const stretchProp = computed(() => stretchCol.value?.prop ?? null);\n const gridStretch = computed(() => stretchProp.value === null);\n\n const plugins = computed(() => {\n const list: GridPlugin[] = [];\n if (enableDrag) {\n list.push(\n class HRPlugin extends BasePlugin {\n constructor(r: HTMLRevoGridElement, p: PluginProviders) {\n super(r, p);\n this.addEventListener('rowdragstart', e => {\n const name = e.detail.model?.['name'];\n if (typeof name === 'string' && name) {\n e.detail.text = name;\n }\n });\n }\n },\n );\n }\n if (stretchProp.value !== null) {\n list.push(\n columnStretchPlugin(stretchProp.value, stretchCol.value?.minSize),\n );\n }\n return list;\n });\n\n const checkboxCellProperties = () => ({ class: 'well-grid-checkbox-cell' });\n\n const columnKinds: Record<ColumnKind, ColumnKindDef> = {\n text: {},\n number: { numeric: true },\n unit: {\n editor: 'unit',\n numeric: true,\n editorProps: ({ col }) => ({ unitType: col.unitType }),\n cellTemplate: ({ col }) =>\n cellTemplate(GridUnitCell, { unitType: col.unitType }),\n },\n color: {\n editor: 'color',\n cellTemplate: () => cellTemplate(GridColorCell),\n },\n select: {\n editor: 'select',\n editorProps: ({ options }) => ({ options }),\n cellTemplate: ({ options }) => cellTemplate(GridSelectCell, { options }),\n },\n combo: {\n editor: 'combo',\n editorProps: ({ options }) => ({ options }),\n // GridSelectCell already falls back to the raw value when it isn't\n // one of the suggested options, which is exactly what free text needs.\n cellTemplate: ({ options }) => cellTemplate(GridSelectCell, { options }),\n },\n formatted: {\n cellTemplate: ({ col }) =>\n cellTemplate(GridFormattedCell, { formatter: col.formatter }),\n },\n checkbox: {\n editor: 'noop',\n cellProperties: checkboxCellProperties,\n cellTemplate: ({ col }) =>\n cellTemplate(GridCheckboxCell, {\n prop: col.prop,\n onToggle: (rowIndex: number, prop: string, value: boolean) =>\n onChange(rowIndex, prop, value),\n }),\n },\n 'select-button': {\n editor: 'noop',\n cellProperties: checkboxCellProperties,\n cellTemplate: ({ col, options }) =>\n cellTemplate(GridSelectButtonCell, {\n prop: col.prop,\n options,\n onChange: (rowIndex: number, prop: string, value: unknown) =>\n onChange(rowIndex, prop, value),\n }),\n },\n texture: {\n editor: 'texture',\n cellTemplate: () => cellTemplate(GridTextureSelectCell),\n },\n };\n\n function resolveOptions(\n list: readonly WellGridOption[],\n ): ResolvedGridOption[] {\n return list.map(o => ({\n value: o.value,\n label: text(o.label) ?? o.value,\n ...(o.deprecated && { deprecated: true }),\n }));\n }\n\n function buildColumn(col: WellGridColumn): ColumnRegular {\n const kind = columnKinds[resolveColumnKind(col)];\n const resolved: ResolvedColumn = {\n col,\n options: 'options' in col ? resolveOptions(col.options) : undefined,\n };\n const label = text(col.label) ?? '';\n const unit = col.unitType ? suffixes[col.unitType].value : null;\n const readonly = col.readonly ?? false;\n const info = text(col.info);\n\n return {\n prop: col.prop,\n name: unit ? `${label} (${unit})` : label,\n autoSize: !col.size && !col.stretch,\n size: col.size,\n readonly,\n editor: readonly\n ? undefined\n : (kind.editor ??\n col.editor ??\n (col.type === 'number' ? 'number' : 'text')),\n editorProps: kind.editorProps?.(resolved),\n pin: col.pin,\n cellProperties:\n kind.cellProperties ??\n (kind.numeric ? () => ({ class: 'num' }) : undefined),\n cellTemplate: kind.cellTemplate?.(resolved),\n ...(info && {\n info,\n infoHighlight: text(col.infoHighlight),\n infoLabel: text(labels.value.columnInfo),\n columnTemplate: headerTemplate,\n }),\n };\n }\n\n const revoColumns = computed<ColumnRegular[]>(() => {\n const result: ColumnRegular[] = [];\n if (enableDrag) {\n const dragHandle = resolvePart(\n 'dragHandle',\n parts.value.dragHandle,\n undefined,\n config,\n );\n result.push({\n prop: '_drag',\n name: '',\n size: 30,\n pin: 'colPinStart',\n rowDrag: true,\n cellProperties: () => ({ class: 'well-grid-drag-cell' }),\n // Without an override RevoGrid draws its own handle (styled by\n // grid.css). A template replaces it, so GridDragCell re-emits the\n // drag start RevoGrid's handle would have emitted.\n ...(dragHandle && {\n cellTemplate: cellTemplate(GridDragCell, { part: dragHandle }),\n }),\n });\n }\n result.push(...cols.value.map(buildColumn));\n if (enableDelete) {\n result.push({\n prop: '_delete',\n name: '',\n size: 40,\n readonly: true,\n pin: 'colPinEnd',\n cellProperties: () => ({ class: 'well-grid-delete-cell' }),\n cellTemplate: cellTemplate(GridDeleteCell, {\n part: resolvePart(\n 'deleteButton',\n parts.value.deleteButton,\n WellGridDeleteButton,\n config,\n ),\n label: text(toValue(options.deleteLabel)),\n requestDelete: onDelete,\n }),\n });\n }\n return result;\n });\n\n function coerceCellValue(prop: string, val: unknown): unknown {\n const col = cols.value.find(c => c.prop === prop);\n if (col?.type === 'checkbox' && typeof val === 'string') {\n return val === 'true' || val === '1' || val.toLowerCase() === 'yes';\n }\n return val;\n }\n\n // ─── Click-on-focused-cell → enter edit mode ───────────────────────────────\n // `afterfocus` only fires when focus moves to a new cell. A click that\n // triggers such a focus change is suppressed; a second click on the cell\n // that's already focused enters edit mode for it.\n\n const gridContainerRef = ref<HTMLElement | null>(null);\n const focusedCell = ref<{\n rowIndex: number;\n colIndex: number;\n prop: string;\n } | null>(null);\n let suppressNextClick = false;\n\n function handleAfterFocus(event: CustomEvent<FocusAfterRenderEvent>) {\n const { rowIndex, colIndex, column } = event.detail;\n focusedCell.value = column\n ? { rowIndex, colIndex, prop: String(column.prop) }\n : null;\n suppressNextClick = true;\n }\n\n function handleGridMousedown() {\n suppressNextClick = false;\n }\n\n function handleGridClick(event: MouseEvent) {\n if (suppressNextClick) {\n suppressNextClick = false;\n return;\n }\n const cell = focusedCell.value;\n if (!cell) return;\n\n const target = (event.target as HTMLElement).closest<HTMLElement>(\n '[data-rgrow][data-rgcol]',\n );\n if (!target) return;\n if (\n Number(target.dataset.rgrow) !== cell.rowIndex ||\n Number(target.dataset.rgcol) !== cell.colIndex\n ) {\n return;\n }\n\n const col = cols.value.find(c => c.prop === cell.prop);\n if (!col || col.readonly) return;\n\n const gridEl = gridContainerRef.value?.querySelector('revo-grid') as\n | HTMLRevoGridElement\n | undefined;\n gridEl?.setCellEdit(cell.rowIndex, cell.prop);\n }\n\n function handleAfterEdit(event: CustomEvent<AfterEditEvent>) {\n const detail = event.detail as Record<string, unknown>;\n\n // Single-cell edit: detail has rowIndex + prop + val\n if ('rowIndex' in detail) {\n const { rowIndex, prop, val } =\n detail as unknown as BeforeSaveDataDetails;\n onChange(rowIndex, String(prop), coerceCellValue(String(prop), val));\n return;\n }\n\n // Block edit (paste, range clear, etc.): detail has data keyed by row index\n const blockData = detail.data as\n | Record<string, Record<string, unknown>>\n | undefined;\n if (!blockData) return;\n\n for (const [rowKey, rowData] of Object.entries(blockData)) {\n const rowIndex = Number(rowKey);\n for (const [prop, val] of Object.entries(rowData)) {\n onChange(rowIndex, prop, coerceCellValue(prop, val));\n }\n }\n }\n\n return {\n gridEditors,\n revoColumns,\n gridStretch,\n plugins,\n coerceCellValue,\n handleAfterEdit,\n gridContainerRef,\n handleAfterFocus,\n handleGridMousedown,\n handleGridClick,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,SAAS,EAAkB,GAAiC;AAS1D,QARI,EAAI,SAAS,YAAkB,YAC/B,EAAI,SAAS,WAAiB,WAC9B,EAAI,SAAS,kBAAwB,kBACrC,EAAI,SAAS,UAAgB,UAC7B,EAAI,SAAS,UAAgB,UAC7B,EAAI,SAAS,aAAmB,aAChC,EAAI,WAAiB,SACrB,EAAI,YAAkB,cACnB,EAAI,SAAS,WAAW,WAAW;;AAG5C,IAAM,IAAyC;CAC7C;CACA;CACA;CACA;CACA;CACD,EAkBK,IAAiD;CACrD;CACA;CACA;CACA;CACA;CACA;CACD;AAMD,SAAgB,EAAe,GAA6B;AAC1D,QAAO,EAAE,QAAQ,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;;AAQjD,SAAS,EACP,GACA,GACA;AACA,QAAO,EACL,GACG,YACC,EAAE,GAAW;EACX,KAAK,EAAE;EACP,MAAM,EAAE;EACR,OAAO,EAAE;EACT,GAAG,EAAE,QAAQ,QAAQ;EACrB,GAAG,IAAa,EAAE;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D,YAAY,EAAK,UAAU,EAAK,KAAK;;CAG/C,SAAS,GAAgB,GAAoC;EAC3D,IAAM,IAAS,EAAM;AAGrB,MAAI,cAAc,GAAQ;GACxB,IAAM,EAAE,aAAU,SAAM,WACtB;AACF,KAAS,GAAU,OAAO,EAAK,EAAE,EAAgB,OAAO,EAAK,EAAE,EAAI,CAAC;AACpE;;EAIF,IAAM,IAAY,EAAO;AAGpB,QAEL,MAAK,IAAM,CAAC,GAAQ,MAAY,OAAO,QAAQ,EAAU,EAAE;GACzD,IAAM,IAAW,OAAO,EAAO;AAC/B,QAAK,IAAM,CAAC,GAAM,MAAQ,OAAO,QAAQ,EAAQ,CAC/C,GAAS,GAAU,GAAM,EAAgB,GAAM,EAAI,CAAC;;;AAK1D,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
package/dist/tailwind.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @welldot/vue — Tailwind CSS 4 layer:
|
|
3
|
-
* layer, the data grid's global styles and the
|
|
2
|
+
* @welldot/vue — Tailwind CSS 4 layer: color tokens, theme (dark variant,
|
|
3
|
+
* fonts, radii, base layer), the data grid's global styles and the
|
|
4
|
+
* components' own styles.
|
|
4
5
|
*
|
|
5
6
|
* Import it from the app's main stylesheet, after Tailwind itself, so the
|
|
6
7
|
* tokens join the app's Tailwind compilation:
|
|
@@ -10,151 +11,13 @@
|
|
|
10
11
|
* @import '@welldot/vue/tailwind.css';
|
|
11
12
|
*
|
|
12
13
|
* The relative imports and `@source` below resolve against `dist/`, where
|
|
13
|
-
* this file ships next to `grid.css
|
|
14
|
+
* this file ships next to `grid.css`, `style.css`, `tokens.css` and
|
|
15
|
+
* `theme.css` (see vite.config.ts).
|
|
14
16
|
*/
|
|
15
17
|
@import './grid.css';
|
|
16
18
|
@import './style.css';
|
|
19
|
+
@import './tokens.css';
|
|
20
|
+
@import './theme.css';
|
|
17
21
|
|
|
18
22
|
/* Scan the package's built JS so its utility classes are generated. */
|
|
19
23
|
@source './**/*.js';
|
|
20
|
-
|
|
21
|
-
@custom-variant dark (&:where(.dark-mode, .dark-mode *));
|
|
22
|
-
|
|
23
|
-
@theme {
|
|
24
|
-
/* Surface — resolved from PrimeVue CSS vars (flips per mode) */
|
|
25
|
-
--color-surface-0: var(--w-surface-0);
|
|
26
|
-
--color-surface-50: var(--w-surface-50);
|
|
27
|
-
--color-surface-100: var(--w-surface-100);
|
|
28
|
-
--color-surface-200: var(--w-surface-200);
|
|
29
|
-
--color-surface-300: var(--w-surface-300);
|
|
30
|
-
--color-surface-400: var(--w-surface-400);
|
|
31
|
-
--color-surface-500: var(--w-surface-500);
|
|
32
|
-
--color-surface-600: var(--w-surface-600);
|
|
33
|
-
--color-surface-700: var(--w-surface-700);
|
|
34
|
-
--color-surface-800: var(--w-surface-800);
|
|
35
|
-
--color-surface-900: var(--w-surface-900);
|
|
36
|
-
--color-surface-950: var(--w-surface-950);
|
|
37
|
-
|
|
38
|
-
/* Content — mirror of surface, flips per mode */
|
|
39
|
-
--color-content-0: var(--w-content-0);
|
|
40
|
-
--color-content-50: var(--w-content-50);
|
|
41
|
-
--color-content-100: var(--w-content-100);
|
|
42
|
-
--color-content-200: var(--w-content-200);
|
|
43
|
-
--color-content-300: var(--w-content-300);
|
|
44
|
-
--color-content-400: var(--w-content-400);
|
|
45
|
-
--color-content-500: var(--w-content-500);
|
|
46
|
-
--color-content-600: var(--w-content-600);
|
|
47
|
-
--color-content-700: var(--w-content-700);
|
|
48
|
-
--color-content-800: var(--w-content-800);
|
|
49
|
-
--color-content-900: var(--w-content-900);
|
|
50
|
-
--color-content-950: var(--w-content-950);
|
|
51
|
-
|
|
52
|
-
/* Primary — explicitly mapped so bg-primary-* / text-primary-* work */
|
|
53
|
-
--color-primary-50: var(--w-primary-50);
|
|
54
|
-
--color-primary-100: var(--w-primary-100);
|
|
55
|
-
--color-primary-200: var(--w-primary-200);
|
|
56
|
-
--color-primary-300: var(--w-primary-300);
|
|
57
|
-
--color-primary-400: var(--w-primary-400);
|
|
58
|
-
--color-primary-500: var(--w-primary-500);
|
|
59
|
-
--color-primary-600: var(--w-primary-600);
|
|
60
|
-
--color-primary-700: var(--w-primary-700);
|
|
61
|
-
--color-primary-800: var(--w-primary-800);
|
|
62
|
-
--color-primary-900: var(--w-primary-900);
|
|
63
|
-
--color-primary-950: var(--w-primary-950);
|
|
64
|
-
|
|
65
|
-
/* Error — explicitly mapped so bg-error-* / text-error-* / ring-error-* work */
|
|
66
|
-
--color-error-50: var(--w-error-50);
|
|
67
|
-
--color-error-100: var(--w-error-100);
|
|
68
|
-
--color-error-200: var(--w-error-200);
|
|
69
|
-
--color-error-300: var(--w-error-300);
|
|
70
|
-
--color-error-400: var(--w-error-400);
|
|
71
|
-
--color-error-500: var(--w-error-500);
|
|
72
|
-
--color-error-600: var(--w-error-600);
|
|
73
|
-
--color-error-700: var(--w-error-700);
|
|
74
|
-
--color-error-800: var(--w-error-800);
|
|
75
|
-
--color-error-900: var(--w-error-900);
|
|
76
|
-
--color-error-950: var(--w-error-950);
|
|
77
|
-
|
|
78
|
-
/* Warning */
|
|
79
|
-
--color-warning-50: var(--w-warning-50);
|
|
80
|
-
--color-warning-100: var(--w-warning-100);
|
|
81
|
-
--color-warning-200: var(--w-warning-200);
|
|
82
|
-
--color-warning-300: var(--w-warning-300);
|
|
83
|
-
--color-warning-400: var(--w-warning-400);
|
|
84
|
-
--color-warning-500: var(--w-warning-500);
|
|
85
|
-
--color-warning-600: var(--w-warning-600);
|
|
86
|
-
--color-warning-700: var(--w-warning-700);
|
|
87
|
-
--color-warning-800: var(--w-warning-800);
|
|
88
|
-
--color-warning-900: var(--w-warning-900);
|
|
89
|
-
--color-warning-950: var(--w-warning-950);
|
|
90
|
-
|
|
91
|
-
/* Success */
|
|
92
|
-
--color-success-50: var(--w-success-50);
|
|
93
|
-
--color-success-100: var(--w-success-100);
|
|
94
|
-
--color-success-200: var(--w-success-200);
|
|
95
|
-
--color-success-300: var(--w-success-300);
|
|
96
|
-
--color-success-400: var(--w-success-400);
|
|
97
|
-
--color-success-500: var(--w-success-500);
|
|
98
|
-
--color-success-600: var(--w-success-600);
|
|
99
|
-
--color-success-700: var(--w-success-700);
|
|
100
|
-
--color-success-800: var(--w-success-800);
|
|
101
|
-
--color-success-900: var(--w-success-900);
|
|
102
|
-
--color-success-950: var(--w-success-950);
|
|
103
|
-
|
|
104
|
-
/* Info */
|
|
105
|
-
--color-info-50: var(--w-info-50);
|
|
106
|
-
--color-info-100: var(--w-info-100);
|
|
107
|
-
--color-info-200: var(--w-info-200);
|
|
108
|
-
--color-info-300: var(--w-info-300);
|
|
109
|
-
--color-info-400: var(--w-info-400);
|
|
110
|
-
--color-info-500: var(--w-info-500);
|
|
111
|
-
--color-info-600: var(--w-info-600);
|
|
112
|
-
--color-info-700: var(--w-info-700);
|
|
113
|
-
--color-info-800: var(--w-info-800);
|
|
114
|
-
--color-info-900: var(--w-info-900);
|
|
115
|
-
--color-info-950: var(--w-info-950);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/*
|
|
119
|
-
* Fonts and radii are read through var() from component styles Tailwind
|
|
120
|
-
* doesn't scan, so `static` always emits them (unused theme variables are
|
|
121
|
-
* otherwise dropped). Override any of them in the app's own `@theme` block,
|
|
122
|
-
* after importing this file.
|
|
123
|
-
*/
|
|
124
|
-
@theme static {
|
|
125
|
-
/* Typography families — TW v4 convention: --font-{name} → font-{name} utility */
|
|
126
|
-
--font-display: 'Space Grotesk', system-ui, sans-serif;
|
|
127
|
-
--font-serif: 'IBM Plex Serif', Georgia, serif;
|
|
128
|
-
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
|
|
129
|
-
|
|
130
|
-
/* Legacy names kept for CSS var usage */
|
|
131
|
-
--font-family-display: var(--font-display);
|
|
132
|
-
--font-family-serif: var(--font-serif);
|
|
133
|
-
--font-family-mono: var(--font-mono);
|
|
134
|
-
|
|
135
|
-
/* Border radius tokens (also drive rounded-{sm…2xl,pill}) */
|
|
136
|
-
--radius-sm: 6px;
|
|
137
|
-
--radius-md: 8px;
|
|
138
|
-
--radius-lg: 12px;
|
|
139
|
-
--radius-xl: 14px;
|
|
140
|
-
--radius-2xl: 16px;
|
|
141
|
-
--radius-pill: 999px;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/*
|
|
145
|
-
* Focus/error rings switch shade with the color scheme, so they live in the
|
|
146
|
-
* base layer. Override them in the app's own `@layer base` (`:root` and
|
|
147
|
-
* `.dark-mode`), after importing this file.
|
|
148
|
-
*/
|
|
149
|
-
@layer base {
|
|
150
|
-
:root {
|
|
151
|
-
/* Input cell rings — lighter accent shades in dark mode */
|
|
152
|
-
--color-focus-ring: var(--color-primary-500);
|
|
153
|
-
--color-error-ring: var(--color-error-500);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.dark-mode {
|
|
157
|
-
--color-focus-ring: var(--color-primary-300);
|
|
158
|
-
--color-error-ring: var(--color-error-300);
|
|
159
|
-
}
|
|
160
|
-
}
|
package/dist/theme/define.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export interface WelldotThemeOverrides {
|
|
|
18
18
|
* merge key by key, any other value set in `overrides` wins, arrays are
|
|
19
19
|
* concatenated). The defaults are never mutated.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* Colors come from the `--w-*` variables of `@welldot/vue/tokens.css`; override
|
|
22
|
+
* them there, in CSS, not through the preset, so PrimeVue and Tailwind agree.
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* app.use(PrimeVue, {
|
package/dist/theme/define.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.js","names":[],"sources":["../../src/theme/define.ts"],"sourcesContent":["import type { Preset } from '@primeuix/themes/types';\nimport { defu } from 'defu';\nimport type { PrimeVuePTOptions } from 'primevue/config';\nimport { WelldotPreset } from './preset';\nimport { welldotPt } from './pt';\n\ntype DeepPartial<T> = T extends (...args: never[]) => unknown\n ? T\n : T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\n/** PrimeVue `theme` option shape: `{ preset, options }`. */\nexport type WelldotTheme = typeof WelldotPreset;\n\n/** Overrides merged onto `WelldotPreset` by `defineWelldotTheme`. */\nexport interface WelldotThemeOverrides {\n /** Design tokens (`primitive`, `semantic`, `components`…) */\n preset?: DeepPartial<Preset> & Record<string, unknown>;\n /** Theme options (`prefix`, `darkModeSelector`, `cssLayer`) */\n options?: DeepPartial<WelldotTheme['options']>;\n}\n\n/**\n * `WelldotPreset` with `overrides` deep-merged on top (`defu`: plain objects\n * merge key by key, any other value set in `overrides` wins, arrays are\n * concatenated). The defaults are never mutated.\n *\n *
|
|
1
|
+
{"version":3,"file":"define.js","names":[],"sources":["../../src/theme/define.ts"],"sourcesContent":["import type { Preset } from '@primeuix/themes/types';\nimport { defu } from 'defu';\nimport type { PrimeVuePTOptions } from 'primevue/config';\nimport { WelldotPreset } from './preset';\nimport { welldotPt } from './pt';\n\ntype DeepPartial<T> = T extends (...args: never[]) => unknown\n ? T\n : T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\n/** PrimeVue `theme` option shape: `{ preset, options }`. */\nexport type WelldotTheme = typeof WelldotPreset;\n\n/** Overrides merged onto `WelldotPreset` by `defineWelldotTheme`. */\nexport interface WelldotThemeOverrides {\n /** Design tokens (`primitive`, `semantic`, `components`…) */\n preset?: DeepPartial<Preset> & Record<string, unknown>;\n /** Theme options (`prefix`, `darkModeSelector`, `cssLayer`) */\n options?: DeepPartial<WelldotTheme['options']>;\n}\n\n/**\n * `WelldotPreset` with `overrides` deep-merged on top (`defu`: plain objects\n * merge key by key, any other value set in `overrides` wins, arrays are\n * concatenated). The defaults are never mutated.\n *\n * Colors come from the `--w-*` variables of `@welldot/vue/tokens.css`; override\n * them there, in CSS, not through the preset, so PrimeVue and Tailwind agree.\n *\n * @example\n * app.use(PrimeVue, {\n * theme: defineWelldotTheme({\n * preset: { components: { tabs: { tab: { padding: '0.5rem 1rem' } } } },\n * }),\n * })\n */\nexport function defineWelldotTheme(\n overrides: WelldotThemeOverrides = {},\n): WelldotTheme {\n return defu(overrides, WelldotPreset) as WelldotTheme;\n}\n\n/**\n * `welldotPt` with `overrides` deep-merged on top, per component and section.\n * A section set in `overrides` replaces the default (a class string or a\n * function is not combined with the default's); nested sections merge.\n *\n * @example\n * app.use(PrimeVue, {\n * pt: defineWelldotPt({ tabpanels: { root: 'p-0' } }),\n * })\n */\nexport function defineWelldotPt(\n overrides: PrimeVuePTOptions = {},\n): PrimeVuePTOptions {\n return defu(\n overrides as Record<string, unknown>,\n welldotPt as Record<string, unknown>,\n ) as PrimeVuePTOptions;\n}\n"],"mappings":";;;;AAsCA,SAAgB,EACd,IAAmC,EAAE,EACvB;AACd,QAAO,EAAK,GAAW,EAAc;;AAavC,SAAgB,EACd,IAA+B,EAAE,EACd;AACnB,QAAO,EACL,GACA,EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/theme/preset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA0B,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/theme/preset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA0B,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAy7B7E;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CAUzB,CAAC"}
|
package/dist/theme/preset.js
CHANGED
|
@@ -1,104 +1,35 @@
|
|
|
1
1
|
import { definePreset as e } from "@primeuix/themes";
|
|
2
2
|
import t from "@primeuix/themes/aura";
|
|
3
3
|
//#region src/theme/preset.ts
|
|
4
|
-
var n =
|
|
5
|
-
0
|
|
6
|
-
50
|
|
7
|
-
100
|
|
8
|
-
200
|
|
9
|
-
300
|
|
10
|
-
400
|
|
11
|
-
500
|
|
12
|
-
600
|
|
13
|
-
700
|
|
14
|
-
800
|
|
15
|
-
900
|
|
16
|
-
950
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
300: "#3d4a60",
|
|
23
|
-
400: "#4f5d75",
|
|
24
|
-
500: "#7888a0",
|
|
25
|
-
600: "#b9c0c8",
|
|
26
|
-
700: "#d8dde3",
|
|
27
|
-
800: "#eef0f3",
|
|
28
|
-
900: "#f7f8fa",
|
|
29
|
-
950: "#ffffff"
|
|
30
|
-
}, i = {
|
|
4
|
+
var n = [
|
|
5
|
+
0,
|
|
6
|
+
50,
|
|
7
|
+
100,
|
|
8
|
+
200,
|
|
9
|
+
300,
|
|
10
|
+
400,
|
|
11
|
+
500,
|
|
12
|
+
600,
|
|
13
|
+
700,
|
|
14
|
+
800,
|
|
15
|
+
900,
|
|
16
|
+
950
|
|
17
|
+
], r = n.slice(1);
|
|
18
|
+
function i(e, t) {
|
|
19
|
+
return Object.fromEntries(t.map((t) => [t, `var(--w-${e}-${t})`]));
|
|
20
|
+
}
|
|
21
|
+
var a = i("surface", n), o = i("content", n), s = {
|
|
31
22
|
preset: e(t, {
|
|
32
23
|
primitive: {
|
|
33
|
-
surface:
|
|
34
|
-
content:
|
|
24
|
+
surface: a,
|
|
25
|
+
content: o
|
|
35
26
|
},
|
|
36
27
|
semantic: {
|
|
37
|
-
primary:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
400: "#5d86d2",
|
|
43
|
-
500: "#2f5fae",
|
|
44
|
-
600: "#29539b",
|
|
45
|
-
700: "#22427d",
|
|
46
|
-
800: "#1a325f",
|
|
47
|
-
900: "#112343",
|
|
48
|
-
950: "#0a172e"
|
|
49
|
-
},
|
|
50
|
-
error: {
|
|
51
|
-
50: "oklch(97% 0.02 25)",
|
|
52
|
-
100: "oklch(94% 0.05 25)",
|
|
53
|
-
200: "oklch(85% 0.11 25)",
|
|
54
|
-
300: "oklch(72% 0.17 25)",
|
|
55
|
-
400: "oklch(61% 0.19 25)",
|
|
56
|
-
500: "oklch(50% 0.20 25)",
|
|
57
|
-
600: "oklch(43% 0.19 25)",
|
|
58
|
-
700: "oklch(36% 0.17 25)",
|
|
59
|
-
800: "oklch(29% 0.14 25)",
|
|
60
|
-
900: "oklch(23% 0.11 25)",
|
|
61
|
-
950: "oklch(17% 0.08 25)"
|
|
62
|
-
},
|
|
63
|
-
warning: {
|
|
64
|
-
50: "oklch(97% 0.02 75)",
|
|
65
|
-
100: "oklch(94% 0.05 75)",
|
|
66
|
-
200: "oklch(85% 0.11 75)",
|
|
67
|
-
300: "oklch(72% 0.17 75)",
|
|
68
|
-
400: "oklch(61% 0.19 75)",
|
|
69
|
-
500: "oklch(50% 0.20 75)",
|
|
70
|
-
600: "oklch(43% 0.19 75)",
|
|
71
|
-
700: "oklch(36% 0.17 75)",
|
|
72
|
-
800: "oklch(29% 0.14 75)",
|
|
73
|
-
900: "oklch(23% 0.11 75)",
|
|
74
|
-
950: "oklch(17% 0.08 75)"
|
|
75
|
-
},
|
|
76
|
-
success: {
|
|
77
|
-
50: "oklch(97% 0.02 145)",
|
|
78
|
-
100: "oklch(94% 0.05 145)",
|
|
79
|
-
200: "oklch(85% 0.11 145)",
|
|
80
|
-
300: "oklch(72% 0.17 145)",
|
|
81
|
-
400: "oklch(61% 0.19 145)",
|
|
82
|
-
500: "oklch(50% 0.20 145)",
|
|
83
|
-
600: "oklch(43% 0.19 145)",
|
|
84
|
-
700: "oklch(36% 0.17 145)",
|
|
85
|
-
800: "oklch(29% 0.14 145)",
|
|
86
|
-
900: "oklch(23% 0.11 145)",
|
|
87
|
-
950: "oklch(17% 0.08 145)"
|
|
88
|
-
},
|
|
89
|
-
info: {
|
|
90
|
-
50: "oklch(97% 0.02 235)",
|
|
91
|
-
100: "oklch(94% 0.05 235)",
|
|
92
|
-
200: "oklch(85% 0.11 235)",
|
|
93
|
-
300: "oklch(72% 0.17 235)",
|
|
94
|
-
400: "oklch(61% 0.19 235)",
|
|
95
|
-
500: "oklch(50% 0.20 235)",
|
|
96
|
-
600: "oklch(43% 0.19 235)",
|
|
97
|
-
700: "oklch(36% 0.17 235)",
|
|
98
|
-
800: "oklch(29% 0.14 235)",
|
|
99
|
-
900: "oklch(23% 0.11 235)",
|
|
100
|
-
950: "oklch(17% 0.08 235)"
|
|
101
|
-
},
|
|
28
|
+
primary: i("primary", r),
|
|
29
|
+
error: i("error", r),
|
|
30
|
+
warning: i("warning", r),
|
|
31
|
+
success: i("success", r),
|
|
32
|
+
info: i("info", r),
|
|
102
33
|
colorScheme: {
|
|
103
34
|
light: {
|
|
104
35
|
primary: {
|
|
@@ -107,8 +38,8 @@ var n = {
|
|
|
107
38
|
hoverColor: "{primary.500}",
|
|
108
39
|
activeColor: "{primary.600}"
|
|
109
40
|
},
|
|
110
|
-
surface:
|
|
111
|
-
content:
|
|
41
|
+
surface: a,
|
|
42
|
+
content: o,
|
|
112
43
|
text: {
|
|
113
44
|
color: "{content.0}",
|
|
114
45
|
hoverColor: "{content.50}",
|
|
@@ -144,34 +75,8 @@ var n = {
|
|
|
144
75
|
hoverColor: "{primary.600}",
|
|
145
76
|
activeColor: "{primary.500}"
|
|
146
77
|
},
|
|
147
|
-
surface:
|
|
148
|
-
|
|
149
|
-
50: "#131922",
|
|
150
|
-
100: "#1a2230",
|
|
151
|
-
200: "#2a3344",
|
|
152
|
-
300: "#3d4a60",
|
|
153
|
-
400: "#4f5d75",
|
|
154
|
-
500: "#7888a0",
|
|
155
|
-
600: "#b9c0c8",
|
|
156
|
-
700: "#d8dde3",
|
|
157
|
-
800: "#eef0f3",
|
|
158
|
-
900: "#f7f8fa",
|
|
159
|
-
950: "#ffffff"
|
|
160
|
-
},
|
|
161
|
-
content: {
|
|
162
|
-
0: "#ffffff",
|
|
163
|
-
50: "#f7f8fa",
|
|
164
|
-
100: "#eef0f3",
|
|
165
|
-
200: "#d8dde3",
|
|
166
|
-
300: "#b9c0c8",
|
|
167
|
-
400: "#7888a0",
|
|
168
|
-
500: "#4f5d75",
|
|
169
|
-
600: "#3d4a60",
|
|
170
|
-
700: "#2a3344",
|
|
171
|
-
800: "#1a2230",
|
|
172
|
-
900: "#131922",
|
|
173
|
-
950: "#0d1218"
|
|
174
|
-
},
|
|
78
|
+
surface: a,
|
|
79
|
+
content: o,
|
|
175
80
|
text: {
|
|
176
81
|
color: "{content.0}",
|
|
177
82
|
hoverColor: "{content.50}",
|
|
@@ -963,7 +868,7 @@ var n = {
|
|
|
963
868
|
}
|
|
964
869
|
}),
|
|
965
870
|
options: {
|
|
966
|
-
prefix: "
|
|
871
|
+
prefix: "p",
|
|
967
872
|
darkModeSelector: ".dark-mode",
|
|
968
873
|
cssLayer: {
|
|
969
874
|
name: "primevue",
|
|
@@ -972,6 +877,6 @@ var n = {
|
|
|
972
877
|
}
|
|
973
878
|
};
|
|
974
879
|
//#endregion
|
|
975
|
-
export {
|
|
880
|
+
export { s as WelldotPreset };
|
|
976
881
|
|
|
977
882
|
//# sourceMappingURL=preset.js.map
|